Rewrote various AI switching checks

This commit is contained in:
Maruno17
2023-03-25 23:26:34 +00:00
parent 138d41f7bc
commit 0bb0fb4a26
6 changed files with 316 additions and 116 deletions

View File

@@ -92,6 +92,7 @@ module Battle::AI::Handlers
GeneralMoveScore = HandlerHash.new
GeneralMoveAgainstTargetScore = HandlerHash.new
ShouldSwitch = HandlerHash.new
ShouldNotSwitch = HandlerHash.new
def self.move_will_fail?(function_code, *args)
return MoveFailureCheck.trigger(function_code, *args) || false
@@ -140,4 +141,13 @@ module Battle::AI::Handlers
end
return ret
end
def self.should_not_switch?(*args)
ret = false
ShouldNotSwitch.each do |id, switch_proc|
ret ||= switch_proc.call(*args)
break if ret
end
return ret
end
end