Merge branch 'dev' into ai

This commit is contained in:
Maruno17
2022-12-31 17:28:56 +00:00
75 changed files with 4599 additions and 3590 deletions

View File

@@ -309,16 +309,17 @@ def pbDecideWinnerEffectiveness(move, otype1, otype2, ability, scores)
data = GameData::Move.get(move)
return 0 if data.base_damage == 0
atype = data.type
typemod = Effectiveness::NORMAL_EFFECTIVE_ONE**2
typemod = 1.0
if ability != :LEVITATE || data.type != :GROUND
mod1 = Effectiveness.calculate_one(atype, otype1)
mod2 = (otype1 == otype2) ? Effectiveness::NORMAL_EFFECTIVE_ONE : Effectiveness.calculate_one(atype, otype2)
mod1 = Effectiveness.calculate(atype, otype1)
mod2 = (otype1 == otype2) ? 1.0 : Effectiveness.calculate(atype, otype2)
if ability == :WONDERGUARD
mod1 = Effectiveness::NORMAL_EFFECTIVE_ONE if mod1 <= Effectiveness::NORMAL_EFFECTIVE_ONE
mod2 = Effectiveness::NORMAL_EFFECTIVE_ONE if mod2 <= Effectiveness::NORMAL_EFFECTIVE_ONE
mod1 = 1.0 if !Effectiveness.super_effective?(mod1)
mod2 = 1.0 if !Effectiveness.super_effective?(mod2)
end
typemod = mod1 * mod2
end
typemod *= 4 # Because dealing with 2 types
return scores[0] if typemod == 0 # Ineffective
return scores[1] if typemod == 1 # Doubly not very effective
return scores[2] if typemod == 2 # Not very effective