Pokémon sent into battle now default to the Fight option, fixed bugs in Instruct, fixed some AI bugs, fixed parameter mixup for def pbMoveCanTarget?, renamed function to function_code everywhere, fixed black party Pokémon icons in storage, added some more AI testing code

This commit is contained in:
Maruno17
2023-06-18 20:12:36 +01:00
parent 9c2a9130a5
commit b5e37248b9
42 changed files with 305 additions and 174 deletions

View File

@@ -477,7 +477,7 @@ class Battle::Battler
def pbHasMoveFunction?(*arg)
return false if !arg
eachMove do |m|
arg.each { |code| return true if m.function == code }
arg.each { |code| return true if m.function_code == code }
end
return false
end

View File

@@ -293,7 +293,7 @@ class Battle::Battler
end
# "But it failed!" checks
if move.pbMoveFailed?(user, targets)
PBDebug.log(sprintf("[Move failed] In function code %s's def pbMoveFailed?", move.function))
PBDebug.log(sprintf("[Move failed] In function code %s's def pbMoveFailed?", move.function_code))
user.lastMoveFailed = true
pbCancelMoves
pbEndTurn(choice)
@@ -356,7 +356,7 @@ class Battle::Battler
# Pokémon which becomes Ghost-type because of Protean, it should
# target and curse itself. I think this is silly, so I'm making it
# choose a random opponent to curse instead.
if move.function == "CurseTargetOrLowerUserSpd1RaiseUserAtkDef1" && targets.length == 0
if move.function_code == "CurseTargetOrLowerUserSpd1RaiseUserAtkDef1" && targets.length == 0
choice[3] = -1
targets = pbFindTargets(choice, move, user)
end
@@ -528,7 +528,7 @@ class Battle::Battler
oldLastRoundMoved = b.lastRoundMoved
@battle.pbDisplay(_INTL("{1} used the move instructed by {2}!", b.pbThis, user.pbThis(true)))
b.effects[PBEffects::Instructed] = true
if b.pbCanChooseMove?(@moves[idxMove], false)
if b.pbCanChooseMove?(b.moves[idxMove], false)
PBDebug.logonerr do
b.pbUseMoveSimple(b.lastMoveUsed, b.lastRegularMoveTarget, idxMove, false)
end

View File

@@ -87,7 +87,7 @@ class Battle::Battler
end
# Assault Vest (prevents choosing status moves but doesn't prevent
# executing them)
if hasActiveItem?(:ASSAULTVEST) && move.statusMove? && move.function != "UseMoveTargetIsAboutToUse" && commandPhase
if hasActiveItem?(:ASSAULTVEST) && move.statusMove? && move.function_code != "UseMoveTargetIsAboutToUse" && commandPhase
if showMessages
msg = _INTL("The effects of the {1} prevent status moves from being used!", itemName)
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
@@ -308,7 +308,7 @@ class Battle::Battler
return true if user.effects[PBEffects::TwoTurnAttack]
# Move-specific failures
if move.pbFailsAgainstTarget?(user, target, show_message)
PBDebug.log(sprintf("[Move failed] In function code %s's def pbFailsAgainstTarget?", move.function))
PBDebug.log(sprintf("[Move failed] In function code %s's def pbFailsAgainstTarget?", move.function_code))
return false
end
# Immunity to priority moves because of Psychic Terrain
@@ -545,7 +545,7 @@ class Battle::Battler
# Future Sight
hitsInvul = true if @battle.futureSight
# Helping Hand
hitsInvul = true if move.function == "PowerUpAllyMove"
hitsInvul = true if move.function_code == "PowerUpAllyMove"
if !hitsInvul
# Semi-invulnerable moves
if target.effects[PBEffects::TwoTurnAttack]

View File

@@ -135,7 +135,7 @@ class Battle::Battler
end
end
# Room Service
if move.function == "StartSlowerBattlersActFirst" && @battle.field.effects[PBEffects::TrickRoom] > 0
if move.function_code == "StartSlowerBattlersActFirst" && @battle.field.effects[PBEffects::TrickRoom] > 0
@battle.allBattlers.each do |b|
next if !b.hasActiveItem?(:ROOMSERVICE)
next if !b.pbCanLowerStatStage?(:SPEED)