AI now checks for immunities to status moves

This commit is contained in:
Maruno17
2022-03-28 18:04:45 +01:00
parent 3c6799091e
commit 3a4339c658
2 changed files with 9 additions and 7 deletions

View File

@@ -233,6 +233,8 @@ class Battle::AI
end
end
end
# Don't prefer moves that are ineffective because of abilities or effects
return 0 if pbCheckMoveImmunity(score, move, user, target, skill)
# Adjust score based on how much damage it can deal
if move.damagingMove?
score = pbGetMoveScoreDamage(score, move, user, target, skill)
@@ -254,8 +256,7 @@ class Battle::AI
# of the target's current HP)
#=============================================================================
def pbGetMoveScoreDamage(score, move, user, target, skill)
# Don't prefer moves that are ineffective because of abilities or effects
return 0 if score <= 0 || pbCheckMoveImmunity(score, move, user, target, skill)
return 0 if score <= 0
# Calculate how much damage the move will do (roughly)
baseDmg = pbMoveBaseDamage(move, user, target, skill)
realDamage = pbRoughDamage(move, user, target, skill, baseDmg)