Merge branch 'dev' into ai

This commit is contained in:
Maruno17
2022-11-05 20:42:12 +00:00
33 changed files with 198 additions and 168 deletions

View File

@@ -35,7 +35,7 @@ class Battle::Battler
end
def pbRecoverHPFromDrain(amt, target, msg = nil)
if target.hasActiveAbility?(:LIQUIDOOZE)
if target.hasActiveAbility?(:LIQUIDOOZE, true)
@battle.pbShowAbilitySplash(target)
pbReduceHP(amt)
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", pbThis))

View File

@@ -160,17 +160,19 @@ class Battle::Battler
# Start using the move
pbBeginTurn(choice)
# Force the use of certain moves if they're already being used
if usingMultiTurnAttack?
choice[2] = Battle::Move.from_pokemon_move(@battle, Pokemon::Move.new(@currentMove))
specialUsage = true
elsif @effects[PBEffects::Encore] > 0 && choice[1] >= 0 &&
@battle.pbCanShowCommands?(@index)
idxEncoredMove = pbEncoredMoveIndex
if idxEncoredMove >= 0 && choice[1] != idxEncoredMove &&
@battle.pbCanChooseMove?(@index, idxEncoredMove, false) # Change move if battler was Encored mid-round
choice[1] = idxEncoredMove
choice[2] = @moves[idxEncoredMove]
choice[3] = -1 # No target chosen
if !@battle.futureSight
if usingMultiTurnAttack?
choice[2] = Battle::Move.from_pokemon_move(@battle, Pokemon::Move.new(@currentMove))
specialUsage = true
elsif @effects[PBEffects::Encore] > 0 && choice[1] >= 0 &&
@battle.pbCanShowCommands?(@index)
idxEncoredMove = pbEncoredMoveIndex
if idxEncoredMove >= 0 && choice[1] != idxEncoredMove &&
@battle.pbCanChooseMove?(@index, idxEncoredMove, false) # Change move if battler was Encored mid-round
choice[1] = idxEncoredMove
choice[2] = @moves[idxEncoredMove]
choice[3] = -1 # No target chosen
end
end
end
# Labels the move being used as "move"
@@ -361,6 +363,8 @@ class Battle::Battler
targets = pbFindTargets(choice, move, user)
end
end
# For two-turn moves when they charge and attack in the same turn
move.pbQuickChargingMove(user, targets)
#---------------------------------------------------------------------------
magicCoater = -1
magicBouncer = -1

View File

@@ -27,8 +27,8 @@ class Battle::Move
#=============================================================================
#
#=============================================================================
# Whether the move is currently in the "charging" turn of a two turn attack.
# Is false if Power Herb or another effect lets a two turn move charge and
# Whether the move is currently in the "charging" turn of a two-turn move.
# Is false if Power Herb or another effect lets a two-turn move charge and
# attack in the same turn.
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID during the
# charging turn, and is nil during the attack turn.
@@ -52,6 +52,9 @@ class Battle::Move
return 1
end
# For two-turn moves when they charge and attack in the same turn.
def pbQuickChargingMove(user, targets); end
#=============================================================================
# Effect methods per hit
#=============================================================================
@@ -271,6 +274,7 @@ class Battle::Move
# Messages upon being hit
#=============================================================================
def pbEffectivenessMessage(user, target, numTargets = 1)
return if self.is_a?(Battle::Move::FixedDamageMove)
return if target.damageState.disguise || target.damageState.iceFace
if Effectiveness.super_effective?(target.damageState.typeMod)
if numTargets > 1

View File

@@ -323,33 +323,41 @@ class Battle::Move::TwoTurnMove < Battle::Move
return super
end
# Does the charging part of this move, for when this move only takes one round
# to use.
def pbQuickChargingMove(user, targets)
return if !@chargingTurn || !@damagingTurn # Move only takes one turn to use
pbChargingTurnMessage(user, targets)
pbShowAnimation(@id, user, targets, 1) # Charging anim
targets.each { |b| pbChargingTurnEffect(user, b) }
if @powerHerb
# Moves that would make the user semi-invulnerable will hide the user
# after the charging animation, so the "UseItem" animation shouldn't show
# for it
if !["TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableUnderground",
"TwoTurnAttackInvulnerableUnderwater",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
"TwoTurnAttackInvulnerableRemoveProtections",
"TwoTurnAttackInvulnerableInSkyTargetCannotAct"].include?(@function)
@battle.pbCommonAnimation("UseItem", user)
end
@battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!", user.pbThis))
user.pbConsumeItem
end
end
def pbAccuracyCheck(user, target)
return true if !@damagingTurn
return super
end
def pbInitialEffect(user, targets, hitNum)
pbChargingTurnMessage(user, targets) if @chargingTurn
if @chargingTurn && @damagingTurn # Move only takes one turn to use
pbShowAnimation(@id, user, targets, 1) # Charging anim
targets.each { |b| pbChargingTurnEffect(user, b) }
if @powerHerb
# Moves that would make the user semi-invulnerable will hide the user
# after the charging animation, so the "UseItem" animation shouldn't show
# for it
if !["TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableUnderground",
"TwoTurnAttackInvulnerableUnderwater",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
"TwoTurnAttackInvulnerableRemoveProtections",
"TwoTurnAttackInvulnerableInSkyTargetCannotAct"].include?(@function)
@battle.pbCommonAnimation("UseItem", user)
end
@battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!", user.pbThis))
user.pbConsumeItem
end
if @damagingTurn
pbAttackingTurnMessage(user, targets)
elsif @chargingTurn
pbChargingTurnMessage(user, targets)
end
pbAttackingTurnMessage(user, targets) if @damagingTurn
end
def pbChargingTurnMessage(user, targets)
@@ -359,14 +367,6 @@ class Battle::Move::TwoTurnMove < Battle::Move
def pbAttackingTurnMessage(user, targets)
end
def pbChargingTurnEffect(user, target)
# Skull Bash/Sky Drop are the only two-turn moves with an effect here, and
# the latter just records the target is being Sky Dropped
end
def pbAttackingTurnEffect(user, target)
end
def pbEffectAgainstTarget(user, target)
if @damagingTurn
pbAttackingTurnEffect(user, target)
@@ -375,6 +375,14 @@ class Battle::Move::TwoTurnMove < Battle::Move
end
end
def pbChargingTurnEffect(user, target)
# Skull Bash/Sky Drop are the only two-turn moves with an effect here, and
# the latter just records the target is being Sky Dropped
end
def pbAttackingTurnEffect(user, target)
end
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim
super

View File

@@ -141,7 +141,7 @@ class Battle::Move::HealUserByTargetAttackLowerTargetAttack1 < Battle::Move
target.pbLowerStatStage(:ATTACK, 1, user)
end
# Heal user
if target.hasActiveAbility?(:LIQUIDOOZE)
if target.hasActiveAbility?(:LIQUIDOOZE, true)
@battle.pbShowAbilitySplash(target)
user.pbReduceHP(healAmt)
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", user.pbThis))

View File

@@ -388,6 +388,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
def refreshMoveData(move)
# Write PP and type of the selected move
if !USE_GRAPHICS
return if !move
moveType = GameData::Type.get(move.display_type(@battler)).name
if move.total_pp <= 0
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}", moveType)