AI function code rewrites for base stat changes, electrifying moves and multi-turn moves

This commit is contained in:
Maruno17
2023-01-29 23:24:07 +00:00
parent d8f38947f4
commit 4da9a8c4e3
4 changed files with 362 additions and 94 deletions

View File

@@ -168,20 +168,25 @@ class Battle::AI::AIBattler
def speed; return @battler.speed; end
def base_stat(stat)
ret = 0
case stat
when :ATTACK then ret = @battler.attack
when :DEFENSE then ret = @battler.defense
when :SPECIAL_ATTACK then ret = @battler.spatk
when :SPECIAL_DEFENSE then ret = @battler.spdef
when :SPEED then ret = @battler.speed
end
return ret
end
# TODO: Cache calculated rough stats? Forget them in def refresh_battler.
def rough_stat(stat)
return @battler.pbSpeed if stat == :SPEED && @ai.trainer.high_skill?
stageMul = [2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8]
stageDiv = [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2]
stage = @battler.stages[stat] + 6
value = 0
case stat
when :ATTACK then value = @battler.attack
when :DEFENSE then value = @battler.defense
when :SPECIAL_ATTACK then value = @battler.spatk
when :SPECIAL_DEFENSE then value = @battler.spdef
when :SPEED then value = @battler.speed
end
value = base_stat(stat)
return (value.to_f * stageMul[stage] / stageDiv[stage]).floor
end