AI function code rewrites

This commit is contained in:
Maruno17
2023-01-12 23:08:26 +00:00
parent a22f75f500
commit 84bdd1f60b
10 changed files with 330 additions and 180 deletions

View File

@@ -84,6 +84,7 @@ class Battle
attr_accessor :poke_ball_failed # Set after first_poke_ball to prevent it being set again
attr_reader :switching # True if during the switching phase of the round
attr_reader :futureSight # True if Future Sight is hitting
attr_reader :command_phase
attr_reader :endOfRound # True during the end of round
attr_accessor :moldBreaker # True if Mold Breaker applies
attr_reader :struggle # The Struggle move
@@ -159,6 +160,7 @@ class Battle
@lastMoveUser = -1
@switching = false
@futureSight = false
@command_phase = false
@endOfRound = false
@moldBreaker = false
@runCommand = 0

View File

@@ -172,6 +172,7 @@ class Battle
# Command phase
#=============================================================================
def pbCommandPhase
@command_phase = true
@scene.pbBeginCommandPhase
# Reset choices if commands can be shown
@battlers.each_with_index do |b, i|
@@ -186,8 +187,12 @@ class Battle
end
# Choose actions for the round (player first, then AI)
pbCommandPhaseLoop(true) # Player chooses their actions
return if @decision != 0 # Battle ended, stop choosing actions
if @decision != 0 # Battle ended, stop choosing actions
@command_phase = false
return
end
pbCommandPhaseLoop(false) # AI chooses their actions
@command_phase = false
end
def pbCommandPhaseLoop(isPlayer)