mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Fixed partner trainers not having Bag items, fixed Flame Burst AI bug, added AI for Wonder Guard + switching
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
|||||||
Audio/
|
Audio/
|
||||||
Graphics/
|
Graphics/
|
||||||
Plugins/
|
Plugins/
|
||||||
|
Screenshots/
|
||||||
|
|
||||||
# Data folder, but not Data/Scripts folder or messages_core.dat
|
# Data folder, but not Data/Scripts folder or messages_core.dat
|
||||||
Data/*
|
Data/*
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class Battle
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
items = pbGetOwnerItems(idxBattler)
|
items = pbGetOwnerItems(idxBattler)
|
||||||
items.delete_at(items.index(item))
|
items.delete_at(items.index(item)) if items
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ class Battle
|
|||||||
@mega_rings.each { |item| return GameData::Item.get(item).name if $bag.has?(item) }
|
@mega_rings.each { |item| return GameData::Item.get(item).name if $bag.has?(item) }
|
||||||
else
|
else
|
||||||
trainer_items = pbGetOwnerItems(idxBattler)
|
trainer_items = pbGetOwnerItems(idxBattler)
|
||||||
@mega_rings.each { |item| return GameData::Item.get(item).name if trainer_items&.include?(item) }
|
if trainer_items
|
||||||
|
@mega_rings.each { |item| return GameData::Item.get(item).name if trainer_items.include?(item) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return _INTL("Mega Ring")
|
return _INTL("Mega Ring")
|
||||||
|
|||||||
@@ -633,6 +633,7 @@ Battle::AI::Handlers::ShouldNotSwitch.add(:lethal_entry_hazards,
|
|||||||
Battle::AI::Handlers::ShouldNotSwitch.add(:battler_has_super_effective_move,
|
Battle::AI::Handlers::ShouldNotSwitch.add(:battler_has_super_effective_move,
|
||||||
proc { |battler, reserves, ai, battle|
|
proc { |battler, reserves, ai, battle|
|
||||||
next false if battler.effects[PBEffects::PerishSong] == 1
|
next false if battler.effects[PBEffects::PerishSong] == 1
|
||||||
|
next false if battler.rough_end_of_round_damage >= battler.hp * 2 / 3
|
||||||
next false if battle.rules["suddendeath"]
|
next false if battle.rules["suddendeath"]
|
||||||
has_super_effective_move = false
|
has_super_effective_move = false
|
||||||
battler.battler.eachMove do |move|
|
battler.battler.eachMove do |move|
|
||||||
@@ -676,3 +677,29 @@ Battle::AI::Handlers::ShouldNotSwitch.add(:battler_has_very_raised_stats,
|
|||||||
next false
|
next false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Don't bother switching if the battler has Wonder Guard and is immune to the
|
||||||
|
# foe's damaging attacks.
|
||||||
|
#===============================================================================
|
||||||
|
Battle::AI::Handlers::ShouldNotSwitch.add(:battler_is_immune_via_wonder_guard,
|
||||||
|
proc { |battler, reserves, ai, battle|
|
||||||
|
next false if battler.effects[PBEffects::PerishSong] == 1
|
||||||
|
next false if battler.rough_end_of_round_damage >= battler.hp / 2
|
||||||
|
next false if !battler.has_active_ability?(:WONDERGUARD)
|
||||||
|
super_effective_foe = false
|
||||||
|
ai.each_foe_battler(battler.side) do |b|
|
||||||
|
next if !b.check_for_move do |m|
|
||||||
|
next false if !m.damagingMove?
|
||||||
|
eff = battler.effectiveness_of_type_against_battler(m.pbCalcType(b.battler), b, m)
|
||||||
|
next Effectiveness.super_effective?(eff)
|
||||||
|
end
|
||||||
|
super_effective_foe = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if !super_effective_foe
|
||||||
|
PBDebug.log_ai("#{battler.name} won't switch after all because it has Wonder Guard and can't be damaged by foes")
|
||||||
|
end
|
||||||
|
next !super_effective_foe
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ Battle::AI::Handlers::MoveEffectAgainstTargetScore.copy("OHKO",
|
|||||||
Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("DamageTargetAlly",
|
Battle::AI::Handlers::MoveEffectAgainstTargetScore.add("DamageTargetAlly",
|
||||||
proc { |score, move, user, target, ai, battle|
|
proc { |score, move, user, target, ai, battle|
|
||||||
target.battler.allAllies.each do |b|
|
target.battler.allAllies.each do |b|
|
||||||
next if !b.near?(target.battler) || !b.battler.takesIndirectDamage?
|
next if !b.near?(target.battler) || !b.takesIndirectDamage?
|
||||||
score += 10
|
score += 10
|
||||||
if ai.trainer.has_skill_flag?("HPAware")
|
if ai.trainer.has_skill_flag?("HPAware")
|
||||||
score += 10 if b.hp <= b.totalhp / 16
|
score += 10 if b.hp <= b.totalhp / 16
|
||||||
|
|||||||
@@ -189,7 +189,8 @@ module BattleCreationHelperMethods
|
|||||||
ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
|
ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
|
||||||
ally.id = $PokemonGlobal.partner[2]
|
ally.id = $PokemonGlobal.partner[2]
|
||||||
ally.party = $PokemonGlobal.partner[3]
|
ally.party = $PokemonGlobal.partner[3]
|
||||||
ally_items[1] = ally.items.clone
|
data = GameData::Trainer.try_get($PokemonGlobal.partner[0], $PokemonGlobal.partner[1], $PokemonGlobal.partner[2])
|
||||||
|
ally_items[1] = data&.items.clone || []
|
||||||
trainer_array.push(ally)
|
trainer_array.push(ally)
|
||||||
pokemon_array = []
|
pokemon_array = []
|
||||||
$player.party.each { |pkmn| pokemon_array.push(pkmn) }
|
$player.party.each { |pkmn| pokemon_array.push(pkmn) }
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ You will need Ruby installed to run these scripts. The intention is to replace t
|
|||||||
|
|
||||||
The .gitignore file lists the files that will not be included in this repo. These are:
|
The .gitignore file lists the files that will not be included in this repo. These are:
|
||||||
|
|
||||||
* The Audio/, Graphics/ and Plugins/ folders and everything in them.
|
* The Audio/, Graphics/, Plugins/ and Screenshots/ folders and everything in them.
|
||||||
* Everything in the Data/ folder, except for:
|
* Everything in the Data/ folder, except for:
|
||||||
* The Data/Scripts/ folder and everything in there.
|
* The Data/Scripts/ folder and everything in there.
|
||||||
* Scripts.rxdata (a special version that just loads the individual script files).
|
* Scripts.rxdata (a special version that just loads the individual script files).
|
||||||
* messages_core.dat, which contains common messages and is useful for translation projects.
|
* messages_core.dat, which contains common messages and is useful for translation projects.
|
||||||
* A few files in the main project folder (two of the Game.xxx files, and the RGSS dll file).
|
* A few files in the main project folder (two of the Game.xxx files, the RGSS dll file and errorlog.txt).
|
||||||
* Temporary files.
|
* Temporary files.
|
||||||
|
|||||||
Reference in New Issue
Block a user