Merged species Type1/Type2 into Types, did the same for Pokemon and Battler

This commit is contained in:
Maruno17
2021-11-22 23:55:28 +00:00
parent a5f91f62ea
commit 00c2df5772
33 changed files with 3756 additions and 5552 deletions

View File

@@ -2458,8 +2458,8 @@ class Battle::AI
when "UseTargetDefenseInsteadOfTargetSpDef"
#---------------------------------------------------------------------------
when "FailsUnlessTargetSharesTypeWithUser"
if !target.pbHasType?(user.type1) &&
!target.pbHasType?(user.type2)
if !(user.types[0] && target.pbHasType?(user.types[0])) &&
!(user.types[1] && target.pbHasType?(user.types[1]))
score -= 90
end
#---------------------------------------------------------------------------

View File

@@ -82,10 +82,10 @@ class Battle::AI
# For switching. Determines the effectiveness of a potential switch-in against
# an opposing battler.
def pbCalcTypeModPokemon(battlerThis,_battlerOther)
mod1 = Effectiveness.calculate(battlerThis.type1,target.type1,target.type2)
mod1 = Effectiveness.calculate(battlerThis.types[0], target.types[0], target.types[1])
mod2 = Effectiveness::NORMAL_EFFECTIVE
if battlerThis.type1!=battlerThis.type2
mod2 = Effectiveness.calculate(battlerThis.type2,target.type1,target.type2)
if battlerThis.types.length > 1
mod2 = Effectiveness.calculate(battlerThis.types[1], target.types[0], target.types[1])
mod2 = mod2.to_f / Effectivenesss::NORMAL_EFFECTIVE
end
return mod1*mod2
@@ -275,7 +275,7 @@ class Battle::AI
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
else
mult = Effectiveness.calculate(:FLYING,
target.type1,target.type2,target.effects[PBEffects::Type3])
target.types[0], target.types[1], target.effects[PBEffects::Type3])
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
end
end