mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 06:34:59 +00:00
AI now keeps their last defined Pokémon for last, tweaks to some battle effects based on mechanics generation
This commit is contained in:
@@ -91,7 +91,9 @@ class PokeBattle_AI
|
||||
end
|
||||
if shouldSwitch
|
||||
list = []
|
||||
idxPartyStart, idxPartyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
@battle.pbParty(idxBattler).each_with_index do |pkmn,i|
|
||||
next if i == idxPartyEnd - 1 # Don't choose to switch in ace
|
||||
next if !@battle.pbCanSwitch?(idxBattler,i)
|
||||
# If perish count is 1, it may be worth it to switch
|
||||
# even with Spikes, since Perish Song's effect will end
|
||||
@@ -147,7 +149,9 @@ class PokeBattle_AI
|
||||
#=============================================================================
|
||||
def pbDefaultChooseNewEnemy(idxBattler,party)
|
||||
enemies = []
|
||||
idxPartyStart, idxPartyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)
|
||||
party.each_with_index do |_p,i|
|
||||
next if i == idxPartyEnd - 1 && enemies.length > 0 # Ignore ace if possible
|
||||
enemies.push(i) if @battle.pbCanSwitchLax?(idxBattler,i)
|
||||
end
|
||||
return -1 if enemies.length==0
|
||||
|
||||
@@ -2021,8 +2021,9 @@ class PokeBattle_AI
|
||||
score -= 100 if @battle.trainerBattle?
|
||||
#---------------------------------------------------------------------------
|
||||
when "SwitchOutUserStatusMove"
|
||||
if !@battle.pbCanChooseNonActive?(user.index)
|
||||
score -= 80
|
||||
if !@battle.pbCanChooseNonActive?(user.index) ||
|
||||
@battle.pbTeamAbleNonActiveCount(user.index) > 1 # Don't switch in ace
|
||||
score -= 100
|
||||
else
|
||||
score += 40 if user.effects[PBEffects::Confusion]>0
|
||||
total = 0
|
||||
@@ -2042,6 +2043,12 @@ class PokeBattle_AI
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "SwitchOutUserDamagingMove"
|
||||
if !@battle.pbCanChooseNonActive?(user.index) ||
|
||||
@battle.pbTeamAbleNonActiveCount(user.index) > 1 # Don't switch in ace
|
||||
score -= 100
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "SwitchOutTargetStatusMove"
|
||||
if target.effects[PBEffects::Ingrain] ||
|
||||
(skill>=PBTrainerAI.highSkill && target.hasActiveAbility?(:SUCTIONCUPS))
|
||||
@@ -2069,7 +2076,7 @@ class PokeBattle_AI
|
||||
#---------------------------------------------------------------------------
|
||||
when "SwitchOutUserPassOnEffects"
|
||||
if !@battle.pbCanChooseNonActive?(user.index)
|
||||
score -= 80
|
||||
score -= 100
|
||||
else
|
||||
score -= 40 if user.effects[PBEffects::Confusion]>0
|
||||
total = 0
|
||||
@@ -2089,8 +2096,6 @@ class PokeBattle_AI
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "SwitchOutUserDamagingMove"
|
||||
#---------------------------------------------------------------------------
|
||||
when "TrapTargetInBattle"
|
||||
score -= 90 if target.effects[PBEffects::MeanLook]>=0
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user