Added decent spacing to all scripts thanks to Rubocop

This commit is contained in:
Maruno17
2021-12-18 15:25:40 +00:00
parent f7b76ae62e
commit d17fc40a47
207 changed files with 18577 additions and 18587 deletions

View File

@@ -67,7 +67,7 @@ class Battle::Move
def pbTarget(_user); return GameData::Target.get(@target); end
def total_pp
return @total_pp if @total_pp && @total_pp>0 # Usually undefined
return @total_pp if @total_pp && @total_pp > 0 # Usually undefined
return @realMove.total_pp if @realMove
return 0
end
@@ -75,7 +75,7 @@ class Battle::Move
# NOTE: This method is only ever called while using a move (and also by the
# AI), so using @calcType here is acceptable.
def physicalMove?(thisType = nil)
return (@category==0) if Settings::MOVE_CATEGORY_PER_MOVE
return (@category == 0) if Settings::MOVE_CATEGORY_PER_MOVE
thisType ||= @calcType
thisType ||= @type
return true if !thisType
@@ -85,15 +85,15 @@ class Battle::Move
# NOTE: This method is only ever called while using a move (and also by the
# AI), so using @calcType here is acceptable.
def specialMove?(thisType = nil)
return (@category==1) if Settings::MOVE_CATEGORY_PER_MOVE
return (@category == 1) if Settings::MOVE_CATEGORY_PER_MOVE
thisType ||= @calcType
thisType ||= @type
return false if !thisType
return GameData::Type.get(thisType).special?
end
def damagingMove?; return @category!=2; end
def statusMove?; return @category==2; end
def damagingMove?; return @category != 2; end
def statusMove?; return @category == 2; end
def pbPriority(user); return @priority; end
@@ -135,7 +135,7 @@ class Battle::Move
# Causes perfect accuracy (param=1) and double damage (param=2).
def tramplesMinimize?(_param = 1); return false; end
def nonLethal?(_user,_target); return false; end # For False Swipe
def nonLethal?(_user, _target); return false; end # For False Swipe
def ignoresSubstitute?(user) # user is the Pokémon using this move
if Settings::MECHANICS_GENERATION >= 6

View File

@@ -2,14 +2,14 @@ class Battle::Move
#=============================================================================
# Effect methods per move usage
#=============================================================================
def pbCanChooseMove?(user,commandPhase,showMessages); return true; end # For Belch
def pbCanChooseMove?(user, commandPhase, showMessages); return true; end # For Belch
def pbDisplayChargeMessage(user); end # For Focus Punch/shell Trap/Beak Blast
def pbOnStartUse(user,targets); end
def pbAddTarget(targets,user); end # For Counter, etc. and Bide
def pbOnStartUse(user, targets); end
def pbAddTarget(targets, user); end # For Counter, etc. and Bide
def pbModifyTargets(targets, user); end # For Dragon Darts
# Reset move usage counters (child classes can increment them).
def pbChangeUsageCounters(user,specialUsage)
def pbChangeUsageCounters(user, specialUsage)
user.effects[PBEffects::FuryCutter] = 0
user.effects[PBEffects::ParentalBond] = 0
user.effects[PBEffects::ProtectRate] = 1
@@ -18,11 +18,11 @@ class Battle::Move
end
def pbDisplayUseMessage(user)
@battle.pbDisplayBrief(_INTL("{1} used {2}!",user.pbThis,@name))
@battle.pbDisplayBrief(_INTL("{1} used {2}!", user.pbThis, @name))
end
def pbShowFailMessages?(targets); return true; end
def pbMissMessage(user,target); return false; end
def pbMissMessage(user, target); return false; end
#=============================================================================
#
@@ -42,9 +42,9 @@ class Battle::Move
# The maximum number of hits in a round this move will actually perform. This
# can be 1 for Beat Up, and can be 2 for any moves affected by Parental Bond.
def pbNumHits(user,targets)
def pbNumHits(user, targets)
if user.hasActiveAbility?(:PARENTALBOND) && pbDamagingMove? &&
!chargingTurnMove? && targets.length==1
!chargingTurnMove? && targets.length == 1
# Record that Parental Bond applies, to weaken the second attack
user.effects[PBEffects::ParentalBond] = 3
return 2
@@ -55,29 +55,29 @@ class Battle::Move
#=============================================================================
# Effect methods per hit
#=============================================================================
def pbOverrideSuccessCheckPerHit(user,target); return false; end
def pbOverrideSuccessCheckPerHit(user, target); return false; end
def pbCrashDamage(user); end
def pbInitialEffect(user,targets,hitNum); end
def pbInitialEffect(user, targets, hitNum); end
def pbDesignateTargetsForHit(targets, hitNum); return targets; end # For Dragon Darts
def pbRepeatHit?; return false; end # For Dragon Darts
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
return if !showAnimation
if user.effects[PBEffects::ParentalBond]==1
@battle.pbCommonAnimation("ParentalBond",user,targets)
if user.effects[PBEffects::ParentalBond] == 1
@battle.pbCommonAnimation("ParentalBond", user, targets)
else
@battle.pbAnimation(id,user,targets,hitNum)
@battle.pbAnimation(id, user, targets, hitNum)
end
end
def pbSelfKO(user); end
def pbEffectWhenDealingDamage(user,target); end
def pbEffectAgainstTarget(user,target); end
def pbEffectWhenDealingDamage(user, target); end
def pbEffectAgainstTarget(user, target); end
def pbEffectGeneral(user); end
def pbAdditionalEffect(user,target); end
def pbEffectAfterAllHits(user,target); end # Move effects that occur after all hits
def pbAdditionalEffect(user, target); end
def pbEffectAfterAllHits(user, target); end # Move effects that occur after all hits
def pbSwitchOutTargetEffect(user, targets, numHits, switched_battlers); end
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers); end
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers); end
#=============================================================================
# Check if target is immune to the move because of its ability
@@ -96,7 +96,7 @@ class Battle::Move
# Move failure checks
#=============================================================================
# Check whether the move fails completely due to move-specific requirements.
def pbMoveFailed?(user,targets); return false; end
def pbMoveFailed?(user, targets); return false; end
# Checks whether the move will be ineffective against the target.
def pbFailsAgainstTarget?(user, target, show_message); return false; end
@@ -114,24 +114,24 @@ class Battle::Move
end
def pbMoveFailedTargetAlreadyMoved?(target, showMessage = true)
if (@battle.choices[target.index][0]!=:UseMove &&
@battle.choices[target.index][0]!=:Shift) || target.movedThisRound?
if (@battle.choices[target.index][0] != :UseMove &&
@battle.choices[target.index][0] != :Shift) || target.movedThisRound?
@battle.pbDisplay(_INTL("But it failed!")) if showMessage
return true
end
return false
end
def pbMoveFailedAromaVeil?(user,target,showMessage = true)
def pbMoveFailedAromaVeil?(user, target, showMessage = true)
return false if @battle.moldBreaker
if target.hasActiveAbility?(:AROMAVEIL)
if showMessage
@battle.pbShowAbilitySplash(target)
if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis))
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
else
@battle.pbDisplay(_INTL("{1} is unaffected because of its {2}!",
target.pbThis,target.abilityName))
target.pbThis, target.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -142,10 +142,10 @@ class Battle::Move
if showMessage
@battle.pbShowAbilitySplash(target)
if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis))
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis))
else
@battle.pbDisplay(_INTL("{1} is unaffected because of {2}'s {3}!",
target.pbThis,b.pbThis(true),b.abilityName))
target.pbThis, b.pbThis(true), b.abilityName))
end
@battle.pbHideAbilitySplash(target)
end
@@ -157,10 +157,10 @@ class Battle::Move
#=============================================================================
# Weaken the damage dealt (doesn't actually change a battler's HP)
#=============================================================================
def pbCheckDamageAbsorption(user,target)
def pbCheckDamageAbsorption(user, target)
# Substitute will take the damage
if target.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(user) &&
(!user || user.index!=target.index)
if target.effects[PBEffects::Substitute] > 0 && !ignoresSubstitute?(user) &&
(!user || user.index != target.index)
target.damageState.substitute = true
return
end
@@ -172,17 +172,17 @@ class Battle::Move
end
# Disguise will take the damage
if !@battle.moldBreaker && target.isSpecies?(:MIMIKYU) &&
target.form==0 && target.ability == :DISGUISE
target.form == 0 && target.ability == :DISGUISE
target.damageState.disguise = true
return
end
end
def pbReduceDamage(user,target)
def pbReduceDamage(user, target)
damage = target.damageState.calcDamage
# Substitute takes the damage
if target.damageState.substitute
damage = target.effects[PBEffects::Substitute] if damage>target.effects[PBEffects::Substitute]
damage = target.effects[PBEffects::Substitute] if damage > target.effects[PBEffects::Substitute]
target.damageState.hpLost = damage
target.damageState.totalHPLost += damage
return
@@ -190,22 +190,22 @@ class Battle::Move
# Disguise/Ice Face takes the damage
return if target.damageState.disguise || target.damageState.iceFace
# Target takes the damage
if damage>=target.hp
if damage >= target.hp
damage = target.hp
# Survive a lethal hit with 1 HP effects
if nonLethal?(user,target)
if nonLethal?(user, target)
damage -= 1
elsif target.effects[PBEffects::Endure]
target.damageState.endured = true
damage -= 1
elsif damage==target.totalhp
elsif damage == target.totalhp
if target.hasActiveAbility?(:STURDY) && !@battle.moldBreaker
target.damageState.sturdy = true
damage -= 1
elsif target.hasActiveItem?(:FOCUSSASH) && target.hp==target.totalhp
elsif target.hasActiveItem?(:FOCUSSASH) && target.hp == target.totalhp
target.damageState.focusSash = true
damage -= 1
elsif target.hasActiveItem?(:FOCUSBAND) && @battle.pbRandom(100)<10
elsif target.hasActiveItem?(:FOCUSBAND) && @battle.pbRandom(100) < 10
target.damageState.focusBand = true
damage -= 1
elsif Settings::AFFECTION_EFFECTS && @battle.internalBattle &&
@@ -218,7 +218,7 @@ class Battle::Move
end
end
end
damage = 0 if damage<0
damage = 0 if damage < 0
target.damageState.hpLost = damage
target.damageState.totalHPLost += damage
end
@@ -238,14 +238,14 @@ class Battle::Move
# Animate the damage dealt, including lowering the HP
#=============================================================================
# Animate being damaged and losing HP (by a move)
def pbAnimateHitAndHPLost(user,targets)
def pbAnimateHitAndHPLost(user, targets)
# Animate allies first, then foes
animArray = []
for side in 0...2 # side here means "allies first, then foes"
targets.each do |b|
next if b.damageState.unaffected || b.damageState.hpLost==0
next if (side==0 && b.opposes?(user)) || (side==1 && !b.opposes?(user))
oldHP = b.hp+b.damageState.hpLost
next if b.damageState.unaffected || b.damageState.hpLost == 0
next if (side == 0 && b.opposes?(user)) || (side == 1 && !b.opposes?(user))
oldHP = b.hp + b.damageState.hpLost
PBDebug.log("[Move damage] #{b.pbThis} lost #{b.damageState.hpLost} HP (#{oldHP}=>#{b.hp})")
effectiveness = 0
if Effectiveness.resistant?(b.damageState.typeMod)
@@ -253,9 +253,9 @@ class Battle::Move
elsif Effectiveness.super_effective?(b.damageState.typeMod)
effectiveness = 2
end
animArray.push([b,oldHP,effectiveness])
animArray.push([b, oldHP, effectiveness])
end
if animArray.length>0
if animArray.length > 0
@battle.scene.pbHitAndHPLossAnimation(animArray)
animArray.clear
end
@@ -265,27 +265,27 @@ class Battle::Move
#=============================================================================
# Messages upon being hit
#=============================================================================
def pbEffectivenessMessage(user,target,numTargets = 1)
def pbEffectivenessMessage(user, target, numTargets = 1)
return if target.damageState.disguise || target.damageState.iceFace
if Effectiveness.super_effective?(target.damageState.typeMod)
if numTargets>1
@battle.pbDisplay(_INTL("It's super effective on {1}!",target.pbThis(true)))
if numTargets > 1
@battle.pbDisplay(_INTL("It's super effective on {1}!", target.pbThis(true)))
else
@battle.pbDisplay(_INTL("It's super effective!"))
end
elsif Effectiveness.not_very_effective?(target.damageState.typeMod)
if numTargets>1
@battle.pbDisplay(_INTL("It's not very effective on {1}...",target.pbThis(true)))
if numTargets > 1
@battle.pbDisplay(_INTL("It's not very effective on {1}...", target.pbThis(true)))
else
@battle.pbDisplay(_INTL("It's not very effective..."))
end
end
end
def pbHitEffectivenessMessages(user,target,numTargets = 1)
def pbHitEffectivenessMessages(user, target, numTargets = 1)
return if target.damageState.disguise || target.damageState.iceFace
if target.damageState.substitute
@battle.pbDisplay(_INTL("The substitute took damage for {1}!",target.pbThis(true)))
@battle.pbDisplay(_INTL("The substitute took damage for {1}!", target.pbThis(true)))
end
if target.damageState.critical
if $game_temp.party_critical_hits_dealt && user.pbOwnedByPlayer?
@@ -307,12 +307,12 @@ class Battle::Move
end
end
# Effectiveness message, for moves with 1 hit
if !multiHitMove? && user.effects[PBEffects::ParentalBond]==0
pbEffectivenessMessage(user,target,numTargets)
if !multiHitMove? && user.effects[PBEffects::ParentalBond] == 0
pbEffectivenessMessage(user, target, numTargets)
end
if target.damageState.substitute && target.effects[PBEffects::Substitute]==0
if target.damageState.substitute && target.effects[PBEffects::Substitute] == 0
target.effects[PBEffects::Substitute] = 0
@battle.pbDisplay(_INTL("{1}'s substitute faded!",target.pbThis))
@battle.pbDisplay(_INTL("{1}'s substitute faded!", target.pbThis))
end
end
@@ -322,10 +322,10 @@ class Battle::Move
if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("Its disguise served it as a decoy!"))
else
@battle.pbDisplay(_INTL("{1}'s disguise served it as a decoy!",target.pbThis))
@battle.pbDisplay(_INTL("{1}'s disguise served it as a decoy!", target.pbThis))
end
@battle.pbHideAbilitySplash(target)
target.pbChangeForm(1,_INTL("{1}'s disguise was busted!",target.pbThis))
target.pbChangeForm(1, _INTL("{1}'s disguise was busted!", target.pbThis))
target.pbReduceHP(target.totalhp / 8, false) if Settings::MECHANICS_GENERATION >= 8
elsif target.damageState.iceFace
@battle.pbShowAbilitySplash(target)
@@ -335,36 +335,36 @@ class Battle::Move
target.pbChangeForm(1, _INTL("{1} transformed!", target.pbThis))
@battle.pbHideAbilitySplash(target)
elsif target.damageState.endured
@battle.pbDisplay(_INTL("{1} endured the hit!",target.pbThis))
@battle.pbDisplay(_INTL("{1} endured the hit!", target.pbThis))
elsif target.damageState.sturdy
@battle.pbShowAbilitySplash(target)
if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} endured the hit!",target.pbThis))
@battle.pbDisplay(_INTL("{1} endured the hit!", target.pbThis))
else
@battle.pbDisplay(_INTL("{1} hung on with Sturdy!",target.pbThis))
@battle.pbDisplay(_INTL("{1} hung on with Sturdy!", target.pbThis))
end
@battle.pbHideAbilitySplash(target)
elsif target.damageState.focusSash
@battle.pbCommonAnimation("UseItem",target)
@battle.pbDisplay(_INTL("{1} hung on using its Focus Sash!",target.pbThis))
@battle.pbCommonAnimation("UseItem", target)
@battle.pbDisplay(_INTL("{1} hung on using its Focus Sash!", target.pbThis))
target.pbConsumeItem
elsif target.damageState.focusBand
@battle.pbCommonAnimation("UseItem",target)
@battle.pbDisplay(_INTL("{1} hung on using its Focus Band!",target.pbThis))
@battle.pbCommonAnimation("UseItem", target)
@battle.pbDisplay(_INTL("{1} hung on using its Focus Band!", target.pbThis))
elsif target.damageState.affection_endured
@battle.pbDisplay(_INTL("{1} toughed it out so you wouldn't feel sad!", target.pbThis))
end
end
# Used by Counter/Mirror Coat/Metal Burst/Revenge/Focus Punch/Bide/Assurance.
def pbRecordDamageLost(user,target)
def pbRecordDamageLost(user, target)
damage = target.damageState.hpLost
# NOTE: In Gen 3 where a move's category depends on its type, Hidden Power
# is for some reason countered by Counter rather than Mirror Coat,
# regardless of its calculated type. Hence the following two lines of
# code.
moveType = nil
moveType = :NORMAL if @function=="TypeDependsOnUserIVs" # Hidden Power
moveType = :NORMAL if @function == "TypeDependsOnUserIVs" # Hidden Power
if physicalMove?(moveType)
target.effects[PBEffects::Counter] = damage
target.effects[PBEffects::CounterTarget] = user.index
@@ -372,7 +372,7 @@ class Battle::Move
target.effects[PBEffects::MirrorCoat] = damage
target.effects[PBEffects::MirrorCoatTarget] = user.index
end
if target.effects[PBEffects::Bide]>0
if target.effects[PBEffects::Bide] > 0
target.effects[PBEffects::BideDamage] += damage
target.effects[PBEffects::BideTarget] = user.index
end

View File

@@ -29,7 +29,7 @@ class Battle::Move
#=============================================================================
# Type effectiveness calculation
#=============================================================================
def pbCalcTypeModSingle(moveType,defType,user,target)
def pbCalcTypeModSingle(moveType, defType, user, target)
ret = Effectiveness.calculate_one(moveType, defType)
# Ring Target
if target.hasActiveItem?(:RINGTARGET)
@@ -57,7 +57,7 @@ class Battle::Move
return ret
end
def pbCalcTypeMod(moveType,user,target)
def pbCalcTypeMod(moveType, user, target)
return Effectiveness::NORMAL_EFFECTIVE if !moveType
return Effectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
target.pbHasType?(:FLYING) &&
@@ -73,8 +73,8 @@ class Battle::Move
typeMods[0] = Effectiveness::SUPER_EFFECTIVE_ONE
end
else
tTypes.each_with_index do |type,i|
typeMods[i] = pbCalcTypeModSingle(moveType,type,user,target)
tTypes.each_with_index do |type, i|
typeMods[i] = pbCalcTypeModSingle(moveType, type, user, target)
end
end
# Multiply all effectivenesses together
@@ -87,15 +87,15 @@ class Battle::Move
#=============================================================================
# Accuracy check
#=============================================================================
def pbBaseAccuracy(user,target); return @accuracy; end
def pbBaseAccuracy(user, target); return @accuracy; end
# Accuracy calculations for one-hit KO moves are handled elsewhere.
def pbAccuracyCheck(user,target)
def pbAccuracyCheck(user, target)
# "Always hit" effects and "always hit" accuracy
return true if target.effects[PBEffects::Telekinesis]>0
return true if target.effects[PBEffects::Telekinesis] > 0
return true if target.effects[PBEffects::Minimize] && tramplesMinimize?(1)
baseAcc = pbBaseAccuracy(user,target)
return true if baseAcc==0
baseAcc = pbBaseAccuracy(user, target)
return true if baseAcc == 0
# Calculate all multiplier effects
modifiers = {}
modifiers[:base_accuracy] = baseAcc
@@ -103,14 +103,14 @@ class Battle::Move
modifiers[:evasion_stage] = target.stages[:EVASION]
modifiers[:accuracy_multiplier] = 1.0
modifiers[:evasion_multiplier] = 1.0
pbCalcAccuracyModifiers(user,target,modifiers)
pbCalcAccuracyModifiers(user, target, modifiers)
# Check if move can't miss
return true if modifiers[:base_accuracy] == 0
# Calculation
accStage = [[modifiers[:accuracy_stage], -6].max, 6].min + 6
evaStage = [[modifiers[:evasion_stage], -6].max, 6].min + 6
stageMul = [3,3,3,3,3,3, 3, 4,5,6,7,8,9]
stageDiv = [9,8,7,6,5,4, 3, 3,3,3,3,3,3]
stageMul = [3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9]
stageDiv = [9, 8, 7, 6, 5, 4, 3, 3, 3, 3, 3, 3, 3]
accuracy = 100.0 * stageMul[accStage] / stageDiv[accStage]
evasion = 100.0 * stageMul[evaStage] / stageDiv[evaStage]
accuracy = (accuracy * modifiers[:accuracy_multiplier]).round
@@ -128,29 +128,29 @@ class Battle::Move
return r < threshold
end
def pbCalcAccuracyModifiers(user,target,modifiers)
def pbCalcAccuracyModifiers(user, target, modifiers)
# Ability effects that alter accuracy calculation
if user.abilityActive?
Battle::AbilityEffects.triggerAccuracyCalcFromUser(user.ability,
modifiers,user,target,self,@calcType)
modifiers, user, target, self, @calcType)
end
user.allAllies.each do |b|
next if !b.abilityActive?
Battle::AbilityEffects.triggerAccuracyCalcFromAlly(b.ability,
modifiers,user,target,self,@calcType)
modifiers, user, target, self, @calcType)
end
if target.abilityActive? && !@battle.moldBreaker
Battle::AbilityEffects.triggerAccuracyCalcFromTarget(target.ability,
modifiers,user,target,self,@calcType)
modifiers, user, target, self, @calcType)
end
# Item effects that alter accuracy calculation
if user.itemActive?
Battle::ItemEffects.triggerAccuracyCalcFromUser(user.item,
modifiers,user,target,self,@calcType)
modifiers, user, target, self, @calcType)
end
if target.itemActive?
Battle::ItemEffects.triggerAccuracyCalcFromTarget(target.item,
modifiers,user,target,self,@calcType)
modifiers, user, target, self, @calcType)
end
# Other effects, inc. ones that set accuracy_multiplier or evasion_stage to
# specific values
@@ -172,41 +172,41 @@ class Battle::Move
# -1: Never a critical hit.
# 0: Calculate normally.
# 1: Always a critical hit.
def pbCritialOverride(user,target); return 0; end
def pbCritialOverride(user, target); return 0; end
# Returns whether the move will be a critical hit.
def pbIsCritical?(user,target)
return false if target.pbOwnSide.effects[PBEffects::LuckyChant]>0
def pbIsCritical?(user, target)
return false if target.pbOwnSide.effects[PBEffects::LuckyChant] > 0
# Set up the critical hit ratios
ratios = (Settings::NEW_CRITICAL_HIT_RATE_MECHANICS) ? [24,8,2,1] : [16,8,4,3,2]
ratios = (Settings::NEW_CRITICAL_HIT_RATE_MECHANICS) ? [24, 8, 2, 1] : [16, 8, 4, 3, 2]
c = 0
# Ability effects that alter critical hit rate
if c>=0 && user.abilityActive?
if c >= 0 && user.abilityActive?
c = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.ability, user, target, c)
end
if c>=0 && target.abilityActive? && !@battle.moldBreaker
if c >= 0 && target.abilityActive? && !@battle.moldBreaker
c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c)
end
# Item effects that alter critical hit rate
if c>=0 && user.itemActive?
if c >= 0 && user.itemActive?
c = Battle::ItemEffects.triggerCriticalCalcFromUser(user.item, user, target, c)
end
if c>=0 && target.itemActive?
if c >= 0 && target.itemActive?
c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c)
end
return false if c<0
return false if c < 0
# Move-specific "always/never a critical hit" effects
case pbCritialOverride(user,target)
case pbCritialOverride(user, target)
when 1 then return true
when -1 then return false
end
# Other effects
return true if c>50 # Merciless
return true if user.effects[PBEffects::LaserFocus]>0
return true if c > 50 # Merciless
return true if user.effects[PBEffects::LaserFocus] > 0
c += 1 if highCriticalRate?
c += user.effects[PBEffects::FocusEnergy]
c += 1 if user.inHyperMode? && @type == :SHADOW
c = ratios.length-1 if c>=ratios.length
c = ratios.length - 1 if c >= ratios.length
# Calculation
return true if ratios[c] == 1
r = @battle.pbRandom(ratios[c])
@@ -222,49 +222,49 @@ class Battle::Move
#=============================================================================
# Damage calculation
#=============================================================================
def pbBaseDamage(baseDmg,user,target); return baseDmg; end
def pbBaseDamageMultiplier(damageMult,user,target); return damageMult; end
def pbModifyDamage(damageMult,user,target); return damageMult; end
def pbBaseDamage(baseDmg, user, target); return baseDmg; end
def pbBaseDamageMultiplier(damageMult, user, target); return damageMult; end
def pbModifyDamage(damageMult, user, target); return damageMult; end
def pbGetAttackStats(user,target)
def pbGetAttackStats(user, target)
if specialMove?
return user.spatk, user.stages[:SPECIAL_ATTACK]+6
return user.spatk, user.stages[:SPECIAL_ATTACK] + 6
end
return user.attack, user.stages[:ATTACK]+6
return user.attack, user.stages[:ATTACK] + 6
end
def pbGetDefenseStats(user,target)
def pbGetDefenseStats(user, target)
if specialMove?
return target.spdef, target.stages[:SPECIAL_DEFENSE]+6
return target.spdef, target.stages[:SPECIAL_DEFENSE] + 6
end
return target.defense, target.stages[:DEFENSE]+6
return target.defense, target.stages[:DEFENSE] + 6
end
def pbCalcDamage(user,target,numTargets = 1)
def pbCalcDamage(user, target, numTargets = 1)
return if statusMove?
if target.damageState.disguise || target.damageState.iceFace
target.damageState.calcDamage = 1
return
end
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]
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]
# Get the move's type
type = @calcType # nil is treated as physical
# Calculate whether this hit deals critical damage
target.damageState.critical = pbIsCritical?(user,target)
target.damageState.critical = pbIsCritical?(user, target)
# Calcuate base power of move
baseDmg = pbBaseDamage(@baseDamage,user,target)
baseDmg = pbBaseDamage(@baseDamage, user, target)
# Calculate user's attack stat
atk, atkStage = pbGetAttackStats(user,target)
atk, atkStage = pbGetAttackStats(user, target)
if !target.hasActiveAbility?(:UNAWARE) || @battle.moldBreaker
atkStage = 6 if target.damageState.critical && atkStage<6
atk = (atk.to_f*stageMul[atkStage]/stageDiv[atkStage]).floor
atkStage = 6 if target.damageState.critical && atkStage < 6
atk = (atk.to_f * stageMul[atkStage] / stageDiv[atkStage]).floor
end
# Calculate target's defense stat
defense, defStage = pbGetDefenseStats(user,target)
defense, defStage = pbGetDefenseStats(user, target)
if !user.hasActiveAbility?(:UNAWARE)
defStage = 6 if target.damageState.critical && defStage>6
defense = (defense.to_f*stageMul[defStage]/stageDiv[defStage]).floor
defStage = 6 if target.damageState.critical && defStage > 6
defense = (defense.to_f * stageMul[defStage] / stageDiv[defStage]).floor
end
# Calculate all multiplier effects
multipliers = {
@@ -273,17 +273,17 @@ class Battle::Move
:defense_multiplier => 1.0,
:final_damage_multiplier => 1.0
}
pbCalcDamageMultipliers(user,target,numTargets,type,baseDmg,multipliers)
pbCalcDamageMultipliers(user, target, numTargets, type, baseDmg, multipliers)
# Main damage calculation
baseDmg = [(baseDmg * multipliers[:base_damage_multiplier]).round, 1].max
atk = [(atk * multipliers[:attack_multiplier]).round, 1].max
defense = [(defense * multipliers[:defense_multiplier]).round, 1].max
damage = (((2.0 * user.level / 5 + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2
damage = [(damage * multipliers[:final_damage_multiplier]).round, 1].max
damage = [(damage * multipliers[:final_damage_multiplier]).round, 1].max
target.damageState.calcDamage = damage
end
def pbCalcDamageMultipliers(user,target,numTargets,type,baseDmg,multipliers)
def pbCalcDamageMultipliers(user, target, numTargets, type, baseDmg, multipliers)
# Global abilities
if (@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)
@@ -296,7 +296,7 @@ class Battle::Move
# Ability effects that alter damage
if user.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromUser(user.ability,
user,target,self,multipliers,baseDmg,type)
user, target, self, multipliers, baseDmg, type)
end
if !@battle.moldBreaker
# NOTE: It's odd that the user's Mold Breaker prevents its partner's
@@ -305,31 +305,31 @@ class Battle::Move
user.allAllies.each do |b|
next if !b.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromAlly(b.ability,
user,target,self,multipliers,baseDmg,type)
user, target, self, multipliers, baseDmg, type)
end
if target.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromTarget(target.ability,
user,target,self,multipliers,baseDmg,type) if !@battle.moldBreaker
user, target, self, multipliers, baseDmg, type) if !@battle.moldBreaker
Battle::AbilityEffects.triggerDamageCalcFromTargetNonIgnorable(target.ability,
user,target,self,multipliers,baseDmg,type)
user, target, self, multipliers, baseDmg, type)
end
target.allAllies.each do |b|
next if !b.abilityActive?
Battle::AbilityEffects.triggerDamageCalcFromTargetAlly(b.ability,
user,target,self,multipliers,baseDmg,type)
user, target, self, multipliers, baseDmg, type)
end
end
# Item effects that alter damage
if user.itemActive?
Battle::ItemEffects.triggerDamageCalcFromUser(user.item,
user,target,self,multipliers,baseDmg,type)
user, target, self, multipliers, baseDmg, type)
end
if target.itemActive?
Battle::ItemEffects.triggerDamageCalcFromTarget(target.item,
user,target,self,multipliers,baseDmg,type)
user, target, self, multipliers, baseDmg, type)
end
# Parental Bond's second attack
if user.effects[PBEffects::ParentalBond]==1
if user.effects[PBEffects::ParentalBond] == 1
multipliers[:base_damage_multiplier] /= (Settings::MECHANICS_GENERATION >= 7) ? 4 : 2
end
# Other
@@ -339,7 +339,7 @@ class Battle::Move
if user.effects[PBEffects::HelpingHand] && !self.is_a?(Battle::Move::Confusion)
multipliers[:base_damage_multiplier] *= 1.5
end
if user.effects[PBEffects::Charge]>0 && type == :ELECTRIC
if user.effects[PBEffects::Charge] > 0 && type == :ELECTRIC
multipliers[:base_damage_multiplier] *= 2
end
# Mud Sport
@@ -347,7 +347,7 @@ class Battle::Move
if @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] }
multipliers[:base_damage_multiplier] /= 3
end
if @battle.field.effects[PBEffects::MudSportField]>0
if @battle.field.effects[PBEffects::MudSportField] > 0
multipliers[:base_damage_multiplier] /= 3
end
end
@@ -356,7 +356,7 @@ class Battle::Move
if @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] }
multipliers[:base_damage_multiplier] /= 3
end
if @battle.field.effects[PBEffects::WaterSportField]>0
if @battle.field.effects[PBEffects::WaterSportField] > 0
multipliers[:base_damage_multiplier] /= 3
end
end
@@ -390,7 +390,7 @@ class Battle::Move
end
end
# Multi-targeting attacks
if numTargets>1
if numTargets > 1
multipliers[:final_damage_multiplier] *= 0.75
end
# Weather
@@ -422,7 +422,7 @@ class Battle::Move
end
# Random variance
if !self.is_a?(Battle::Move::Confusion)
random = 85+@battle.pbRandom(16)
random = 85 + @battle.pbRandom(16)
multipliers[:final_damage_multiplier] *= random / 100.0
end
# STAB
@@ -444,13 +444,13 @@ class Battle::Move
if !ignoresReflect? && !target.damageState.critical &&
!user.hasActiveAbility?(:INFILTRATOR)
if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
if @battle.pbSideBattlerCount(target)>1
if @battle.pbSideBattlerCount(target) > 1
multipliers[:final_damage_multiplier] *= 2 / 3.0
else
multipliers[:final_damage_multiplier] /= 2
end
elsif target.pbOwnSide.effects[PBEffects::Reflect] > 0 && physicalMove?
if @battle.pbSideBattlerCount(target)>1
if @battle.pbSideBattlerCount(target) > 1
multipliers[:final_damage_multiplier] *= 2 / 3.0
else
multipliers[:final_damage_multiplier] /= 2
@@ -476,12 +476,12 @@ class Battle::Move
#=============================================================================
# Additional effect chance
#=============================================================================
def pbAdditionalEffectChance(user,target,effectChance = 0)
def pbAdditionalEffectChance(user, target, effectChance = 0)
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
ret = (effectChance>0) ? effectChance : @addlEffect
ret = (effectChance > 0) ? effectChance : @addlEffect
if Settings::MECHANICS_GENERATION >= 6 || @function != "EffectDependsOnEnvironment"
ret *= 2 if user.hasActiveAbility?(:SERENEGRACE) ||
user.pbOwnSide.effects[PBEffects::Rainbow]>0
user.pbOwnSide.effects[PBEffects::Rainbow] > 0
end
ret = 100 if $DEBUG && Input.press?(Input::CTRL)
return ret
@@ -489,17 +489,17 @@ class Battle::Move
# NOTE: Flinching caused by a move's effect is applied in that move's code,
# not here.
def pbFlinchChance(user,target)
def pbFlinchChance(user, target)
return 0 if flinchingMove?
return 0 if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
ret = 0
if user.hasActiveAbility?(:STENCH,true)
if user.hasActiveAbility?(:STENCH, true)
ret = 10
elsif user.hasActiveItem?([:KINGSROCK,:RAZORFANG],true)
elsif user.hasActiveItem?([:KINGSROCK, :RAZORFANG], true)
ret = 10
end
ret *= 2 if user.hasActiveAbility?(:SERENEGRACE) ||
user.pbOwnSide.effects[PBEffects::Rainbow]>0
user.pbOwnSide.effects[PBEffects::Rainbow] > 0
return ret
end
end

View File

@@ -8,7 +8,7 @@
# Status moves always fail.
#===============================================================================
class Battle::Move::Unimplemented < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if statusMove?
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -21,7 +21,7 @@ end
# Pseudomove for confusion damage.
#===============================================================================
class Battle::Move::Confusion < Battle::Move
def initialize(battle,move)
def initialize(battle, move)
@battle = battle
@realMove = move
@id = :CONFUSEDAMAGE
@@ -41,16 +41,16 @@ class Battle::Move::Confusion < Battle::Move
@snatched = false
end
def physicalMove?(thisType = nil); return true; end
def specialMove?(thisType = nil); return false; end
def pbCritialOverride(user,target); return -1; end
def physicalMove?(thisType = nil); return true; end
def specialMove?(thisType = nil); return false; end
def pbCritialOverride(user, target); return -1; end
end
#===============================================================================
# Struggle.
#===============================================================================
class Battle::Move::Struggle < Battle::Move
def initialize(battle,move)
def initialize(battle, move)
@battle = battle
@realMove = nil # Not associated with a move
@id = (move) ? move.id : :STRUGGLE
@@ -73,10 +73,10 @@ class Battle::Move::Struggle < Battle::Move
def physicalMove?(thisType = nil); return true; end
def specialMove?(thisType = nil); return false; end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if target.damageState.unaffected
user.pbReduceHP((user.totalhp/4.0).round,false)
@battle.pbDisplay(_INTL("{1} is damaged by recoil!",user.pbThis))
user.pbReduceHP((user.totalhp / 4.0).round, false)
@battle.pbDisplay(_INTL("{1} is damaged by recoil!", user.pbThis))
user.pbItemHPHealCheck
end
end
@@ -87,19 +87,19 @@ end
class Battle::Move::StatUpMove < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
return false if damagingMove?
return !user.pbCanRaiseStatStage?(@statUp[0],user,self,true)
return !user.pbCanRaiseStatStage?(@statUp[0], user, self, true)
end
def pbEffectGeneral(user)
return if damagingMove?
user.pbRaiseStatStage(@statUp[0],@statUp[1],user)
user.pbRaiseStatStage(@statUp[0], @statUp[1], user)
end
def pbAdditionalEffect(user,target)
if user.pbCanRaiseStatStage?(@statUp[0],user,self)
user.pbRaiseStatStage(@statUp[0],@statUp[1],user)
def pbAdditionalEffect(user, target)
if user.pbCanRaiseStatStage?(@statUp[0], user, self)
user.pbRaiseStatStage(@statUp[0], @statUp[1], user)
end
end
end
@@ -110,16 +110,16 @@ end
class Battle::Move::MultiStatUpMove < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
return false if damagingMove?
failed = true
for i in 0...@statUp.length/2
next if !user.pbCanRaiseStatStage?(@statUp[i*2],user,self)
for i in 0...@statUp.length / 2
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
failed = false
break
end
if failed
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",user.pbThis))
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!", user.pbThis))
return true
end
return false
@@ -128,19 +128,19 @@ class Battle::Move::MultiStatUpMove < Battle::Move
def pbEffectGeneral(user)
return if damagingMove?
showAnim = true
for i in 0...@statUp.length/2
next if !user.pbCanRaiseStatStage?(@statUp[i*2],user,self)
if user.pbRaiseStatStage(@statUp[i*2],@statUp[i*2+1],user,showAnim)
for i in 0...@statUp.length / 2
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim)
showAnim = false
end
end
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
showAnim = true
for i in 0...@statUp.length/2
next if !user.pbCanRaiseStatStage?(@statUp[i*2],user,self)
if user.pbRaiseStatStage(@statUp[i*2],@statUp[i*2+1],user,showAnim)
for i in 0...@statUp.length / 2
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim)
showAnim = false
end
end
@@ -151,12 +151,12 @@ end
# Lower multiple of user's stats.
#===============================================================================
class Battle::Move::StatDownMove < Battle::Move
def pbEffectWhenDealingDamage(user,target)
def pbEffectWhenDealingDamage(user, target)
return if @battle.pbAllFainted?(target.idxOwnSide)
showAnim = true
for i in 0...@statDown.length/2
next if !user.pbCanLowerStatStage?(@statDown[i*2],user,self)
if user.pbLowerStatStage(@statDown[i*2],@statDown[i*2+1],user,showAnim)
for i in 0...@statDown.length / 2
next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if user.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user, showAnim)
showAnim = false
end
end
@@ -174,15 +174,15 @@ class Battle::Move::TargetStatDownMove < Battle::Move
return !target.pbCanLowerStatStage?(@statDown[0], user, self, show_message)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbLowerStatStage(@statDown[0],@statDown[1],user)
target.pbLowerStatStage(@statDown[0], @statDown[1], user)
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
return if !target.pbCanLowerStatStage?(@statDown[0],user,self)
target.pbLowerStatStage(@statDown[0],@statDown[1],user)
return if !target.pbCanLowerStatStage?(@statDown[0], user, self)
target.pbLowerStatStage(@statDown[0], @statDown[1], user)
end
end
@@ -195,8 +195,8 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
return false if damagingMove?
failed = true
for i in 0...@statDown.length/2
next if !target.pbCanLowerStatStage?(@statDown[i*2],user,self)
for i in 0...@statDown.length / 2
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
failed = false
break
end
@@ -205,19 +205,19 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
# is shown here, I know.
canLower = false
if target.hasActiveAbility?(:CONTRARY) && !@battle.moldBreaker
for i in 0...@statDown.length/2
next if target.statStageAtMax?(@statDown[i*2])
for i in 0...@statDown.length / 2
next if target.statStageAtMax?(@statDown[i * 2])
canLower = true
break
end
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",user.pbThis)) if !canLower && show_message
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!", user.pbThis)) if !canLower && show_message
else
for i in 0...@statDown.length/2
next if target.statStageAtMin?(@statDown[i*2])
for i in 0...@statDown.length / 2
next if target.statStageAtMin?(@statDown[i * 2])
canLower = true
break
end
@battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",user.pbThis)) if !canLower && show_message
@battle.pbDisplay(_INTL("{1}'s stats won't go any lower!", user.pbThis)) if !canLower && show_message
end
if canLower
target.pbCanLowerStatStage?(@statDown[0], user, self, show_message)
@@ -264,11 +264,11 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
@battle.pbHideAbilitySplash(target) # To hide target's Mirror Armor splash
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
pbLowerTargetMultipleStats(user, target) if !damagingMove?
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
pbLowerTargetMultipleStats(user, target) if !target.damageState.substitute
end
end
@@ -277,12 +277,12 @@ end
# Fixed damage-inflicting move.
#===============================================================================
class Battle::Move::FixedDamageMove < Battle::Move
def pbFixedDamage(user,target); return 1; end
def pbFixedDamage(user, target); return 1; end
def pbCalcDamage(user,target,numTargets = 1)
def pbCalcDamage(user, target, numTargets = 1)
target.damageState.critical = false
target.damageState.calcDamage = pbFixedDamage(user,target)
target.damageState.calcDamage = 1 if target.damageState.calcDamage<1
target.damageState.calcDamage = pbFixedDamage(user, target)
target.damageState.calcDamage = 1 if target.damageState.calcDamage < 1
end
end
@@ -315,16 +315,16 @@ class Battle::Move::TwoTurnMove < Battle::Move
return super
end
def pbAccuracyCheck(user,target)
def pbAccuracyCheck(user, target)
return true if !@damagingTurn
return super
end
def pbInitialEffect(user,targets,hitNum)
pbChargingTurnMessage(user,targets) if @chargingTurn
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) }
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
@@ -335,39 +335,39 @@ class Battle::Move::TwoTurnMove < Battle::Move
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
"TwoTurnAttackInvulnerableRemoveProtections",
"TwoTurnAttackInvulnerableInSkyTargetCannotAct"].include?(@function)
@battle.pbCommonAnimation("UseItem",user)
@battle.pbCommonAnimation("UseItem", user)
end
@battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",user.pbThis))
@battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!", user.pbThis))
user.pbConsumeItem
end
end
pbAttackingTurnMessage(user,targets) if @damagingTurn
pbAttackingTurnMessage(user, targets) if @damagingTurn
end
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} began charging up!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} began charging up!", user.pbThis))
end
def pbAttackingTurnMessage(user,targets)
def pbAttackingTurnMessage(user, targets)
end
def pbChargingTurnEffect(user,target)
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)
def pbAttackingTurnEffect(user, target)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
if @damagingTurn
pbAttackingTurnEffect(user,target)
pbAttackingTurnEffect(user, target)
elsif @chargingTurn
pbChargingTurnEffect(user,target)
pbChargingTurnEffect(user, target)
end
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim
super
end
@@ -381,9 +381,9 @@ class Battle::Move::HealingMove < Battle::Move
def pbHealAmount(user); return 1; end
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if user.hp==user.totalhp
@battle.pbDisplay(_INTL("{1}'s HP is full!",user.pbThis))
def pbMoveFailed?(user, targets)
if user.hp == user.totalhp
@battle.pbDisplay(_INTL("{1}'s HP is full!", user.pbThis))
return true
end
return false
@@ -392,7 +392,7 @@ class Battle::Move::HealingMove < Battle::Move
def pbEffectGeneral(user)
amt = pbHealAmount(user)
user.pbRecoverHP(amt)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",user.pbThis))
@battle.pbDisplay(_INTL("{1}'s HP was restored.", user.pbThis))
end
end
@@ -401,16 +401,16 @@ end
#===============================================================================
class Battle::Move::RecoilMove < Battle::Move
def recoilMove?; return true; end
def pbRecoilDamage(user,target); return 1; end
def pbRecoilDamage(user, target); return 1; end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if target.damageState.unaffected
return if !user.takesIndirectDamage?
return if user.hasActiveAbility?(:ROCKHEAD)
amt = pbRecoilDamage(user,target)
amt = 1 if amt<1
user.pbReduceHP(amt,false)
@battle.pbDisplay(_INTL("{1} is damaged by recoil!",user.pbThis))
amt = pbRecoilDamage(user, target)
amt = 1 if amt < 1
user.pbReduceHP(amt, false)
@battle.pbDisplay(_INTL("{1} is damaged by recoil!", user.pbThis))
user.pbItemHPHealCheck
end
end
@@ -419,18 +419,18 @@ end
# Protect move.
#===============================================================================
class Battle::Move::ProtectMove < Battle::Move
def initialize(battle,move)
def initialize(battle, move)
super
@sidedEffect = false
end
def pbChangeUsageCounters(user,specialUsage)
def pbChangeUsageCounters(user, specialUsage)
oldVal = user.effects[PBEffects::ProtectRate]
super
user.effects[PBEffects::ProtectRate] = oldVal
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if @sidedEffect
if user.pbOwnSide.effects[@effect]
user.effects[PBEffects::ProtectRate] = 1
@@ -443,8 +443,8 @@ class Battle::Move::ProtectMove < Battle::Move
return true
end
if (!@sidedEffect || Settings::MECHANICS_GENERATION <= 5) &&
user.effects[PBEffects::ProtectRate]>1 &&
@battle.pbRandom(user.effects[PBEffects::ProtectRate])!=0
user.effects[PBEffects::ProtectRate] > 1 &&
@battle.pbRandom(user.effects[PBEffects::ProtectRate]) != 0
user.effects[PBEffects::ProtectRate] = 1
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -468,9 +468,9 @@ class Battle::Move::ProtectMove < Battle::Move
def pbProtectMessage(user)
if @sidedEffect
@battle.pbDisplay(_INTL("{1} protected {2}!",@name,user.pbTeam(true)))
@battle.pbDisplay(_INTL("{1} protected {2}!", @name, user.pbTeam(true)))
else
@battle.pbDisplay(_INTL("{1} protected itself!",user.pbThis))
@battle.pbDisplay(_INTL("{1} protected itself!", user.pbThis))
end
end
end
@@ -479,12 +479,12 @@ end
# Weather-inducing move.
#===============================================================================
class Battle::Move::WeatherMove < Battle::Move
def initialize(battle,move)
def initialize(battle, move)
super
@weatherType = :None
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
case @battle.field.weather
when :HarshSun
@battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
@@ -503,7 +503,7 @@ class Battle::Move::WeatherMove < Battle::Move
end
def pbEffectGeneral(user)
@battle.pbStartWeather(user,@weatherType,true,false)
@battle.pbStartWeather(user, @weatherType, true, false)
end
end
@@ -511,7 +511,7 @@ end
# Pledge move.
#===============================================================================
class Battle::Move::PledgeMove < Battle::Move
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
@pledgeSetup = false
@pledgeCombo = false
@pledgeOtherUser = nil
@@ -519,7 +519,7 @@ class Battle::Move::PledgeMove < Battle::Move
@overrideAnim = nil
# Check whether this is the use of a combo move
@combos.each do |i|
next if i[0]!=user.effects[PBEffects::FirstPledge]
next if i[0] != user.effects[PBEffects::FirstPledge]
@battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
@pledgeCombo = true
@comboEffect = i[1]
@@ -529,11 +529,11 @@ class Battle::Move::PledgeMove < Battle::Move
return if @pledgeCombo
# Check whether this is the setup of a combo move
user.allAllies.each do |b|
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
next if @battle.choices[b.index][0] != :UseMove || b.movedThisRound?
move = @battle.choices[b.index][2]
next if !move
@combos.each do |i|
next if i[0]!=move.function
next if i[0] != move.function
@pledgeSetup = true
@pledgeOtherUser = b
break
@@ -558,7 +558,7 @@ class Battle::Move::PledgeMove < Battle::Move
return super
end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
baseDmg *= 2 if @pledgeCombo
return baseDmg
end
@@ -567,33 +567,33 @@ class Battle::Move::PledgeMove < Battle::Move
user.effects[PBEffects::FirstPledge] = nil
return if !@pledgeSetup
@battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",
user.pbThis,@pledgeOtherUser.pbThis(true)))
user.pbThis, @pledgeOtherUser.pbThis(true)))
@pledgeOtherUser.effects[PBEffects::FirstPledge] = @function
@pledgeOtherUser.effects[PBEffects::MoveNext] = true
user.lastMoveFailed = true # Treated as a failure for Stomping Tantrum
end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if !@pledgeCombo
msg = nil
animName = nil
case @comboEffect
when :SeaOfFire # Grass + Fire
if user.pbOpposingSide.effects[PBEffects::SeaOfFire]==0
if user.pbOpposingSide.effects[PBEffects::SeaOfFire] == 0
user.pbOpposingSide.effects[PBEffects::SeaOfFire] = 4
msg = _INTL("A sea of fire enveloped {1}!",user.pbOpposingTeam(true))
msg = _INTL("A sea of fire enveloped {1}!", user.pbOpposingTeam(true))
animName = (user.opposes?) ? "SeaOfFire" : "SeaOfFireOpp"
end
when :Rainbow # Fire + Water
if user.pbOwnSide.effects[PBEffects::Rainbow]==0
if user.pbOwnSide.effects[PBEffects::Rainbow] == 0
user.pbOwnSide.effects[PBEffects::Rainbow] = 4
msg = _INTL("A rainbow appeared in the sky on {1}'s side!",user.pbTeam(true))
msg = _INTL("A rainbow appeared in the sky on {1}'s side!", user.pbTeam(true))
animName = (user.opposes?) ? "RainbowOpp" : "Rainbow"
end
when :Swamp # Water + Grass
if user.pbOpposingSide.effects[PBEffects::Swamp]==0
if user.pbOpposingSide.effects[PBEffects::Swamp] == 0
user.pbOpposingSide.effects[PBEffects::Swamp] = 4
msg = _INTL("A swamp enveloped {1}!",user.pbOpposingTeam(true))
msg = _INTL("A swamp enveloped {1}!", user.pbOpposingTeam(true))
animName = (user.opposes?) ? "Swamp" : "SwampOpp"
end
end
@@ -601,7 +601,7 @@ class Battle::Move::PledgeMove < Battle::Move
@battle.pbCommonAnimation(animName) if animName
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
return if @pledgeSetup # No animation for setting up
id = @overrideAnim if @overrideAnim
return super

View File

@@ -10,9 +10,9 @@ end
class Battle::Move::DoesNothingCongratulations < Battle::Move
def pbEffectGeneral(user)
if user.wild?
@battle.pbDisplay(_INTL("Congratulations from {1}!",user.pbThis(true)))
@battle.pbDisplay(_INTL("Congratulations from {1}!", user.pbThis(true)))
else
@battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwnerName(user.index)))
@battle.pbDisplay(_INTL("Congratulations, {1}!", @battle.pbGetOwnerName(user.index)))
end
end
end
@@ -23,7 +23,7 @@ end
class Battle::Move::DoesNothingFailsIfNoAlly < Battle::Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.allAllies.length == 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -53,7 +53,7 @@ end
class Battle::Move::AddMoneyGainedFromBattle < Battle::Move
def pbEffectGeneral(user)
if user.pbOwnedByPlayer?
@battle.field.effects[PBEffects::PayDay] += 5*user.level
@battle.field.effects[PBEffects::PayDay] += 5 * user.level
end
@battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
end
@@ -73,7 +73,7 @@ end
# Fails if this isn't the user's first turn. (First Impression)
#===============================================================================
class Battle::Move::FailsIfNotUserFirstTurn < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.turnCount > 1
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -91,9 +91,9 @@ class Battle::Move::FailsIfUserHasUnusedMove < Battle::Move
hasOtherMoves = false
hasUnusedMoves = false
user.eachMove do |m|
hasThisMove = true if m.id==@id
hasOtherMoves = true if m.id!=@id
hasUnusedMoves = true if m.id!=@id && !user.movesUsed.include?(m.id)
hasThisMove = true if m.id == @id
hasOtherMoves = true if m.id != @id
hasUnusedMoves = true if m.id != @id && !user.movesUsed.include?(m.id)
end
if !hasThisMove || !hasOtherMoves || hasUnusedMoves
@battle.pbDisplay(_INTL("But it failed!")) if show_message
@@ -107,10 +107,10 @@ end
# Fails unless user has consumed a berry at some point. (Belch)
#===============================================================================
class Battle::Move::FailsIfUserNotConsumedBerry < Battle::Move
def pbCanChooseMove?(user,commandPhase,showMessages)
def pbCanChooseMove?(user, commandPhase, showMessages)
if !user.belched?
if showMessages
msg = _INTL("{1} hasn't eaten any held berry, so it can't possibly belch!",user.pbThis)
msg = _INTL("{1} hasn't eaten any held berry, so it can't possibly belch!", user.pbThis)
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
end
return false
@@ -118,7 +118,7 @@ class Battle::Move::FailsIfUserNotConsumedBerry < Battle::Move
return true
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.belched?
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -156,7 +156,7 @@ class Battle::Move::FailsUnlessTargetSharesTypeWithUser < Battle::Move
break
end
if !sharesType
@battle.pbDisplay(_INTL("{1} is unaffected!",target.pbThis)) if show_message
@battle.pbDisplay(_INTL("{1} is unaffected!", target.pbThis)) if show_message
return true
end
return false
@@ -169,17 +169,17 @@ end
class Battle::Move::FailsIfUserDamagedThisTurn < Battle::Move
def pbDisplayChargeMessage(user)
user.effects[PBEffects::FocusPunch] = true
@battle.pbCommonAnimation("FocusPunch",user)
@battle.pbDisplay(_INTL("{1} is tightening its focus!",user.pbThis))
@battle.pbCommonAnimation("FocusPunch", user)
@battle.pbDisplay(_INTL("{1} is tightening its focus!", user.pbThis))
end
def pbDisplayUseMessage(user)
super if !user.effects[PBEffects::FocusPunch] || user.lastHPLost==0
super if !user.effects[PBEffects::FocusPunch] || user.lastHPLost == 0
end
def pbMoveFailed?(user,targets)
if user.effects[PBEffects::FocusPunch] && user.lastHPLost>0
@battle.pbDisplay(_INTL("{1} lost its focus and couldn't move!",user.pbThis))
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::FocusPunch] && user.lastHPLost > 0
@battle.pbDisplay(_INTL("{1} lost its focus and couldn't move!", user.pbThis))
return true
end
return false
@@ -192,13 +192,13 @@ end
#===============================================================================
class Battle::Move::FailsIfTargetActed < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
if @battle.choices[target.index][0]!=:UseMove
if @battle.choices[target.index][0] != :UseMove
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
oppMove = @battle.choices[target.index][2]
if !oppMove ||
(oppMove.function!="UseMoveTargetIsAboutToUse" &&
(oppMove.function != "UseMoveTargetIsAboutToUse" &&
(target.movedThisRound? || oppMove.statusMove?))
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
@@ -217,9 +217,9 @@ class Battle::Move::CrashDamageIfFailsUnusableInGravity < Battle::Move
def pbCrashDamage(user)
return if !user.takesIndirectDamage?
@battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
@battle.pbDisplay(_INTL("{1} kept going and crashed!", user.pbThis))
@battle.scene.pbDamageAnimation(user)
user.pbReduceHP(user.totalhp/2,false)
user.pbReduceHP(user.totalhp / 2, false)
user.pbItemHPHealCheck
user.pbFaint if user.fainted?
end
@@ -229,7 +229,7 @@ end
# Starts sunny weather. (Sunny Day)
#===============================================================================
class Battle::Move::StartSunWeather < Battle::Move::WeatherMove
def initialize(battle,move)
def initialize(battle, move)
super
@weatherType = :Sun
end
@@ -239,7 +239,7 @@ end
# Starts rainy weather. (Rain Dance)
#===============================================================================
class Battle::Move::StartRainWeather < Battle::Move::WeatherMove
def initialize(battle,move)
def initialize(battle, move)
super
@weatherType = :Rain
end
@@ -249,7 +249,7 @@ end
# Starts sandstorm weather. (Sandstorm)
#===============================================================================
class Battle::Move::StartSandstormWeather < Battle::Move::WeatherMove
def initialize(battle,move)
def initialize(battle, move)
super
@weatherType = :Sandstorm
end
@@ -259,7 +259,7 @@ end
# Starts hail weather. (Hail)
#===============================================================================
class Battle::Move::StartHailWeather < Battle::Move::WeatherMove
def initialize(battle,move)
def initialize(battle, move)
super
@weatherType = :Hail
end
@@ -271,7 +271,7 @@ end
# (Electric Terrain)
#===============================================================================
class Battle::Move::StartElectricTerrain < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Electric
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -290,7 +290,7 @@ end
# (Grassy Terrain)
#===============================================================================
class Battle::Move::StartGrassyTerrain < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Grassy
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -309,7 +309,7 @@ end
# (Misty Terrain)
#===============================================================================
class Battle::Move::StartMistyTerrain < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Misty
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -328,7 +328,7 @@ end
# Pokémon only. (Psychic Terrain)
#===============================================================================
class Battle::Move::StartPsychicTerrain < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Psychic
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -375,8 +375,8 @@ end
class Battle::Move::AddSpikesToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
if user.pbOpposingSide.effects[PBEffects::Spikes]>=3
def pbMoveFailed?(user, targets)
if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -397,8 +397,8 @@ end
class Battle::Move::AddToxicSpikesToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
def pbMoveFailed?(user, targets)
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes] >= 2
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -418,7 +418,7 @@ end
class Battle::Move::AddStealthRocksToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.pbOpposingSide.effects[PBEffects::StealthRock]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -439,7 +439,7 @@ end
class Battle::Move::AddStickyWebToFoeSide < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.pbOpposingSide.effects[PBEffects::StickyWeb]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -523,22 +523,22 @@ end
class Battle::Move::UserMakeSubstitute < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if user.effects[PBEffects::Substitute]>0
@battle.pbDisplay(_INTL("{1} already has a substitute!",user.pbThis))
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Substitute] > 0
@battle.pbDisplay(_INTL("{1} already has a substitute!", user.pbThis))
return true
end
@subLife = user.totalhp/4
@subLife = 1 if @subLife<1
if user.hp<=@subLife
@subLife = user.totalhp / 4
@subLife = 1 if @subLife < 1
if user.hp <= @subLife
@battle.pbDisplay(_INTL("But it does not have enough HP left to make a substitute!"))
return true
end
return false
end
def pbOnStartUse(user,targets)
user.pbReduceHP(@subLife,false,false)
def pbOnStartUse(user, targets)
user.pbReduceHP(@subLife, false, false)
user.pbItemHPHealCheck
end
@@ -546,7 +546,7 @@ class Battle::Move::UserMakeSubstitute < Battle::Move
user.effects[PBEffects::Trapping] = 0
user.effects[PBEffects::TrappingMove] = nil
user.effects[PBEffects::Substitute] = @subLife
@battle.pbDisplay(_INTL("{1} put in a substitute!",user.pbThis))
@battle.pbDisplay(_INTL("{1} put in a substitute!", user.pbThis))
end
end
@@ -555,44 +555,44 @@ end
# Raises user's Speed by 1 stage (Gen 8+). (Rapid Spin)
#===============================================================================
class Battle::Move::RemoveUserBindingAndEntryHazards < Battle::Move::StatUpMove
def initialize(battle,move)
def initialize(battle, move)
super
@statUp = [:SPEED, 1]
end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if user.fainted? || target.damageState.unaffected
if user.effects[PBEffects::Trapping]>0
if user.effects[PBEffects::Trapping] > 0
trapMove = GameData::Move.get(user.effects[PBEffects::TrappingMove]).name
trapUser = @battle.battlers[user.effects[PBEffects::TrappingUser]]
@battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",user.pbThis,trapUser.pbThis(true),trapMove))
@battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!", user.pbThis, trapUser.pbThis(true), trapMove))
user.effects[PBEffects::Trapping] = 0
user.effects[PBEffects::TrappingMove] = nil
user.effects[PBEffects::TrappingUser] = -1
end
if user.effects[PBEffects::LeechSeed]>=0
if user.effects[PBEffects::LeechSeed] >= 0
user.effects[PBEffects::LeechSeed] = -1
@battle.pbDisplay(_INTL("{1} shed Leech Seed!",user.pbThis))
@battle.pbDisplay(_INTL("{1} shed Leech Seed!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::StealthRock]
user.pbOwnSide.effects[PBEffects::StealthRock] = false
@battle.pbDisplay(_INTL("{1} blew away stealth rocks!",user.pbThis))
@battle.pbDisplay(_INTL("{1} blew away stealth rocks!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::Spikes]>0
if user.pbOwnSide.effects[PBEffects::Spikes] > 0
user.pbOwnSide.effects[PBEffects::Spikes] = 0
@battle.pbDisplay(_INTL("{1} blew away spikes!",user.pbThis))
@battle.pbDisplay(_INTL("{1} blew away spikes!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
if user.pbOwnSide.effects[PBEffects::ToxicSpikes] > 0
user.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
@battle.pbDisplay(_INTL("{1} blew away poison spikes!",user.pbThis))
@battle.pbDisplay(_INTL("{1} blew away poison spikes!", user.pbThis))
end
if user.pbOwnSide.effects[PBEffects::StickyWeb]
user.pbOwnSide.effects[PBEffects::StickyWeb] = false
@battle.pbDisplay(_INTL("{1} blew away sticky webs!",user.pbThis))
@battle.pbDisplay(_INTL("{1} blew away sticky webs!", user.pbThis))
end
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
super if Settings::MECHANICS_GENERATION >= 8
end
end
@@ -608,7 +608,7 @@ class Battle::Move::AttackTwoTurnsLater < Battle::Move
return super
end
def pbAccuracyCheck(user,target)
def pbAccuracyCheck(user, target)
return true if !@battle.futureSight
return super
end
@@ -619,14 +619,14 @@ class Battle::Move::AttackTwoTurnsLater < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
if !@battle.futureSight &&
@battle.positions[target.index].effects[PBEffects::FutureSightCounter]>0
@battle.positions[target.index].effects[PBEffects::FutureSightCounter] > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if @battle.futureSight # Attack is hitting
effects = @battle.positions[target.index].effects
effects[PBEffects::FutureSightCounter] = 3
@@ -634,13 +634,13 @@ class Battle::Move::AttackTwoTurnsLater < Battle::Move
effects[PBEffects::FutureSightUserIndex] = user.index
effects[PBEffects::FutureSightUserPartyIndex] = user.pokemonIndex
if @id == :DOOMDESIRE
@battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",user.pbThis))
@battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!", user.pbThis))
else
@battle.pbDisplay(_INTL("{1} foresaw an attack!",user.pbThis))
@battle.pbDisplay(_INTL("{1} foresaw an attack!", user.pbThis))
end
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if !@battle.futureSight # Charging anim
super
end
@@ -650,17 +650,17 @@ end
# User switches places with its ally. (Ally Switch)
#===============================================================================
class Battle::Move::UserSwapsPositionsWithAlly < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
numTargets = 0
@idxAlly = -1
idxUserOwner = @battle.pbGetOwnerIndexFromBattlerIndex(user.index)
user.allAllies.each do |b|
next if @battle.pbGetOwnerIndexFromBattlerIndex(b.index)!=idxUserOwner
next if @battle.pbGetOwnerIndexFromBattlerIndex(b.index) != idxUserOwner
next if !b.near?(user)
numTargets += 1
@idxAlly = b.index
end
if numTargets!=1
if numTargets != 1
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -670,9 +670,9 @@ class Battle::Move::UserSwapsPositionsWithAlly < Battle::Move
def pbEffectGeneral(user)
idxA = user.index
idxB = @idxAlly
if @battle.pbSwapBattlers(idxA,idxB)
if @battle.pbSwapBattlers(idxA, idxB)
@battle.pbDisplay(_INTL("{1} and {2} switched places!",
@battle.battlers[idxB].pbThis,@battle.battlers[idxA].pbThis(true)))
@battle.battlers[idxB].pbThis, @battle.battlers[idxA].pbThis(true)))
[idxA, idxB].each { |idx| @battle.pbEffectsOnBattlerEnteringPosition(@battle.battlers[idx]) }
end
end
@@ -685,7 +685,7 @@ end
class Battle::Move::BurnAttackerBeforeUserActs < Battle::Move
def pbDisplayChargeMessage(user)
user.effects[PBEffects::BeakBlast] = true
@battle.pbCommonAnimation("BeakBlast",user)
@battle.pbDisplay(_INTL("{1} started heating up its beak!",user.pbThis))
@battle.pbCommonAnimation("BeakBlast", user)
@battle.pbDisplay(_INTL("{1} started heating up its beak!", user.pbThis))
end
end

View File

@@ -9,14 +9,14 @@ class Battle::Move::SleepTarget < Battle::Move
return !target.pbCanSleep?(user, show_message, self)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbSleep
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbSleep if target.pbCanSleep?(user,false,self)
target.pbSleep if target.pbCanSleep?(user, false, self)
end
end
@@ -24,9 +24,9 @@ end
# Puts the target to sleep. Fails if user is not Darkrai. (Dark Void (Gen 7+))
#===============================================================================
class Battle::Move::SleepTargetIfUserDarkrai < Battle::Move::SleepTarget
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.isSpecies?(:DARKRAI) && user.effects[PBEffects::TransformSpecies] != :DARKRAI
@battle.pbDisplay(_INTL("But {1} can't use the move!",user.pbThis))
@battle.pbDisplay(_INTL("But {1} can't use the move!", user.pbThis))
return true
end
return false
@@ -38,13 +38,13 @@ end
# (Relic Song)
#===============================================================================
class Battle::Move::SleepTargetChangeUserMeloettaForm < Battle::Move::SleepTarget
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
return if numHits==0
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
return if numHits == 0
return if user.fainted? || user.effects[PBEffects::Transform]
return if !user.isSpecies?(:MELOETTA)
return if user.hasActiveAbility?(:SHEERFORCE) && @addlEffect>0
newForm = (user.form+1)%2
user.pbChangeForm(newForm,_INTL("{1} transformed!",user.pbThis))
return if user.hasActiveAbility?(:SHEERFORCE) && @addlEffect > 0
newForm = (user.form + 1) % 2
user.pbChangeForm(newForm, _INTL("{1} transformed!", user.pbThis))
end
end
@@ -55,17 +55,17 @@ class Battle::Move::SleepTargetNextTurn < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Yawn]>0
if target.effects[PBEffects::Yawn] > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return true if !target.pbCanSleep?(user,true,self)
return true if !target.pbCanSleep?(user, true, self)
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Yawn] = 2
@battle.pbDisplay(_INTL("{1} made {2} drowsy!",user.pbThis,target.pbThis(true)))
@battle.pbDisplay(_INTL("{1} made {2} drowsy!", user.pbThis, target.pbThis(true)))
end
end
@@ -75,7 +75,7 @@ end
class Battle::Move::PoisonTarget < Battle::Move
def canMagicCoat?; return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@toxic = false
end
@@ -85,14 +85,14 @@ class Battle::Move::PoisonTarget < Battle::Move
return !target.pbCanPoison?(user, show_message, self)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbPoison(user,nil,@toxic)
target.pbPoison(user, nil, @toxic)
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbPoison(user,nil,@toxic) if target.pbCanPoison?(user,false,self)
target.pbPoison(user, nil, @toxic) if target.pbCanPoison?(user, false, self)
end
end
@@ -103,18 +103,18 @@ class Battle::Move::PoisonTargetLowerTargetSpeed1 < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.pbCanPoison?(user,false,self) &&
!target.pbCanLowerStatStage?(:SPEED,user,self)
if !target.pbCanPoison?(user, false, self) &&
!target.pbCanLowerStatStage?(:SPEED, user, self)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.pbPoison(user) if target.pbCanPoison?(user,false,self)
if target.pbCanLowerStatStage?(:SPEED,user,self)
target.pbLowerStatStage(:SPEED,1,user)
def pbEffectAgainstTarget(user, target)
target.pbPoison(user) if target.pbCanPoison?(user, false, self)
if target.pbCanLowerStatStage?(:SPEED, user, self)
target.pbLowerStatStage(:SPEED, 1, user)
end
end
end
@@ -123,12 +123,12 @@ end
# Badly poisons the target. (Poison Fang, Toxic)
#===============================================================================
class Battle::Move::BadPoisonTarget < Battle::Move::PoisonTarget
def initialize(battle,move)
def initialize(battle, move)
super
@toxic = true
end
def pbOverrideSuccessCheckPerHit(user,target)
def pbOverrideSuccessCheckPerHit(user, target)
return (Settings::MORE_TYPE_EFFECTS && statusMove? && user.pbHasType?(:POISON))
end
end
@@ -144,14 +144,14 @@ class Battle::Move::ParalyzeTarget < Battle::Move
return !target.pbCanParalyze?(user, show_message, self)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbParalyze(user)
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
end
end
@@ -175,8 +175,8 @@ end
#===============================================================================
class Battle::Move::ParalyzeTargetTrampleMinimize < Battle::Move::ParalyzeTarget
def tramplesMinimize?(param = 1)
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param==2 # Double damage
return true if param == 1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param == 2 # Double damage
return super
end
end
@@ -188,7 +188,7 @@ end
class Battle::Move::ParalyzeTargetAlwaysHitsInRainHitsTargetInSky < Battle::Move::ParalyzeTarget
def hitsFlyingTargets?; return true; end
def pbBaseAccuracy(user,target)
def pbBaseAccuracy(user, target)
case target.effectiveWeather
when :Sun, :HarshSun
return 50
@@ -205,14 +205,14 @@ end
class Battle::Move::ParalyzeFlinchTarget < Battle::Move
def flinchingMove?; return true; end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user,target,10)
return if chance==0
if @battle.pbRandom(100)<chance
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
chance = pbAdditionalEffectChance(user, target, 10)
return if chance == 0
if @battle.pbRandom(100) < chance
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
end
target.pbFlinch(user) if @battle.pbRandom(100)<chance
target.pbFlinch(user) if @battle.pbRandom(100) < chance
end
end
@@ -227,14 +227,14 @@ class Battle::Move::BurnTarget < Battle::Move
return !target.pbCanBurn?(user, show_message, self)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbBurn(user)
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
target.pbBurn(user) if target.pbCanBurn?(user, false, self)
end
end
@@ -254,14 +254,14 @@ end
class Battle::Move::BurnFlinchTarget < Battle::Move
def flinchingMove?; return true; end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user,target,10)
return if chance==0
if @battle.pbRandom(100)<chance
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
chance = pbAdditionalEffectChance(user, target, 10)
return if chance == 0
if @battle.pbRandom(100) < chance
target.pbBurn(user) if target.pbCanBurn?(user, false, self)
end
target.pbFlinch(user) if @battle.pbRandom(100)<chance
target.pbFlinch(user) if @battle.pbRandom(100) < chance
end
end
@@ -276,14 +276,14 @@ class Battle::Move::FreezeTarget < Battle::Move
return !target.pbCanFreeze?(user, show_message, self)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbFreeze
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbFreeze if target.pbCanFreeze?(user,false,self)
target.pbFreeze if target.pbCanFreeze?(user, false, self)
end
end
@@ -291,7 +291,7 @@ end
# Freezes the target. Effectiveness against Water-type is 2x. (Freeze-Dry)
#===============================================================================
class Battle::Move::FreezeTargetSuperEffectiveAgainstWater < Battle::Move::FreezeTarget
def pbCalcTypeModSingle(moveType,defType,user,target)
def pbCalcTypeModSingle(moveType, defType, user, target)
return Effectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
return super
end
@@ -301,7 +301,7 @@ end
# Freezes the target. Accuracy perfect in hail. (Blizzard)
#===============================================================================
class Battle::Move::FreezeTargetAlwaysHitsInHail < Battle::Move::FreezeTarget
def pbBaseAccuracy(user,target)
def pbBaseAccuracy(user, target)
return 0 if target.effectiveWeather == :Hail
return super
end
@@ -313,14 +313,14 @@ end
class Battle::Move::FreezeFlinchTarget < Battle::Move
def flinchingMove?; return true; end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
chance = pbAdditionalEffectChance(user,target,10)
return if chance==0
if @battle.pbRandom(100)<chance
target.pbFreeze if target.pbCanFreeze?(user,false,self)
chance = pbAdditionalEffectChance(user, target, 10)
return if chance == 0
if @battle.pbRandom(100) < chance
target.pbFreeze if target.pbCanFreeze?(user, false, self)
end
target.pbFlinch(user) if @battle.pbRandom(100)<chance
target.pbFlinch(user) if @battle.pbRandom(100) < chance
end
end
@@ -328,7 +328,7 @@ end
# Burns, freezes or paralyzes the target. (Tri Attack)
#===============================================================================
class Battle::Move::ParalyzeBurnOrFreezeTarget < Battle::Move
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
case @battle.pbRandom(3)
when 0 then target.pbBurn(user) if target.pbCanBurn?(user, false, self)
@@ -342,7 +342,7 @@ end
# User passes its status problem to the target. (Psycho Shift)
#===============================================================================
class Battle::Move::GiveUserStatusToTarget < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.status == :NONE
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -351,33 +351,33 @@ class Battle::Move::GiveUserStatusToTarget < Battle::Move
end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.pbCanInflictStatus?(user.status,user,false,self)
if !target.pbCanInflictStatus?(user.status, user, false, self)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
msg = ""
case user.status
when :SLEEP
target.pbSleep
msg = _INTL("{1} woke up.",user.pbThis)
msg = _INTL("{1} woke up.", user.pbThis)
when :POISON
target.pbPoison(user,nil,user.statusCount!=0)
msg = _INTL("{1} was cured of its poisoning.",user.pbThis)
target.pbPoison(user, nil, user.statusCount != 0)
msg = _INTL("{1} was cured of its poisoning.", user.pbThis)
when :BURN
target.pbBurn(user)
msg = _INTL("{1}'s burn was healed.",user.pbThis)
msg = _INTL("{1}'s burn was healed.", user.pbThis)
when :PARALYSIS
target.pbParalyze(user)
msg = _INTL("{1} was cured of paralysis.",user.pbThis)
msg = _INTL("{1} was cured of paralysis.", user.pbThis)
when :FROZEN
target.pbFreeze
msg = _INTL("{1} was thawed out.",user.pbThis)
msg = _INTL("{1} was thawed out.", user.pbThis)
end
if msg!=""
if msg != ""
user.pbCureStatus(false)
@battle.pbDisplay(msg)
end
@@ -390,7 +390,7 @@ end
class Battle::Move::CureUserBurnPoisonParalysis < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if ![:BURN, :POISON, :PARALYSIS].include?(user.status)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -403,11 +403,11 @@ class Battle::Move::CureUserBurnPoisonParalysis < Battle::Move
user.pbCureStatus(false)
case old_status
when :BURN
@battle.pbDisplay(_INTL("{1} healed its burn!",user.pbThis))
@battle.pbDisplay(_INTL("{1} healed its burn!", user.pbThis))
when :POISON
@battle.pbDisplay(_INTL("{1} cured its poisoning!",user.pbThis))
@battle.pbDisplay(_INTL("{1} cured its poisoning!", user.pbThis))
when :PARALYSIS
@battle.pbDisplay(_INTL("{1} cured its paralysis!",user.pbThis))
@battle.pbDisplay(_INTL("{1} cured its paralysis!", user.pbThis))
end
end
end
@@ -426,7 +426,7 @@ class Battle::Move::CureUserPartyStatus < Battle::Move
def canSnatch?; return true; end
def worksWithNoTargets?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
has_effect = @battle.allSameSideBattlers(user).any? { |b| b.status != :NONE }
if !has_effect
has_effect = @battle.pbParty(user.index).any? { |pkmn| pkmn && pkmn.able? && pkmn.status != :NONE }
@@ -442,7 +442,7 @@ class Battle::Move::CureUserPartyStatus < Battle::Move
return target.status == :NONE
end
def pbAromatherapyHeal(pkmn,battler = nil)
def pbAromatherapyHeal(pkmn, battler = nil)
oldStatus = (battler) ? battler.status : pkmn.status
curedName = (battler) ? battler.pbThis : pkmn.name
if battler
@@ -453,21 +453,21 @@ class Battle::Move::CureUserPartyStatus < Battle::Move
end
case oldStatus
when :SLEEP
@battle.pbDisplay(_INTL("{1} was woken from sleep.",curedName))
@battle.pbDisplay(_INTL("{1} was woken from sleep.", curedName))
when :POISON
@battle.pbDisplay(_INTL("{1} was cured of its poisoning.",curedName))
@battle.pbDisplay(_INTL("{1} was cured of its poisoning.", curedName))
when :BURN
@battle.pbDisplay(_INTL("{1}'s burn was healed.",curedName))
@battle.pbDisplay(_INTL("{1}'s burn was healed.", curedName))
when :PARALYSIS
@battle.pbDisplay(_INTL("{1} was cured of paralysis.",curedName))
@battle.pbDisplay(_INTL("{1} was cured of paralysis.", curedName))
when :FROZEN
@battle.pbDisplay(_INTL("{1} was thawed out.",curedName))
@battle.pbDisplay(_INTL("{1} was thawed out.", curedName))
end
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
# Cure all Pokémon in battle on the user's side.
pbAromatherapyHeal(target.pokemon,target)
pbAromatherapyHeal(target.pokemon, target)
end
def pbEffectGeneral(user)
@@ -481,14 +481,14 @@ class Battle::Move::CureUserPartyStatus < Battle::Move
# Cure all Pokémon in the user's and partner trainer's party.
# NOTE: This intentionally affects the partner trainer's inactive Pokémon
# too.
@battle.pbParty(user.index).each_with_index do |pkmn,i|
@battle.pbParty(user.index).each_with_index do |pkmn, i|
next if !pkmn || !pkmn.able? || pkmn.status == :NONE
next if @battle.pbFindBattler(i,user) # Skip Pokémon in battle
next if @battle.pbFindBattler(i, user) # Skip Pokémon in battle
pbAromatherapyHeal(pkmn)
end
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
super
if @id == :AROMATHERAPY
@battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
@@ -502,7 +502,7 @@ end
# Cures the target's burn. (Sparkling Aria)
#===============================================================================
class Battle::Move::CureTargetBurn < Battle::Move
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.fainted? || target.damageState.substitute
return if target.status != :BURN
target.pbCureStatus
@@ -516,8 +516,8 @@ end
class Battle::Move::StartUserSideImmunityToInflictedStatus < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if user.pbOwnSide.effects[PBEffects::Safeguard]>0
def pbMoveFailed?(user, targets)
if user.pbOwnSide.effects[PBEffects::Safeguard] > 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -526,7 +526,7 @@ class Battle::Move::StartUserSideImmunityToInflictedStatus < Battle::Move
def pbEffectGeneral(user)
user.pbOwnSide.effects[PBEffects::Safeguard] = 5
@battle.pbDisplay(_INTL("{1} became cloaked in a mystical veil!",user.pbTeam))
@battle.pbDisplay(_INTL("{1} became cloaked in a mystical veil!", user.pbTeam))
end
end
@@ -536,12 +536,12 @@ end
class Battle::Move::FlinchTarget < Battle::Move
def flinchingMove?; return true; end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbFlinch(user)
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbFlinch(user)
end
@@ -553,8 +553,8 @@ end
#===============================================================================
class Battle::Move::FlinchTargetTrampleMinimize < Battle::Move::FlinchTarget
def tramplesMinimize?(param = 1)
return true if param==1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param==2 # Double damage
return true if param == 1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param == 2 # Double damage
return super
end
end
@@ -565,7 +565,7 @@ end
class Battle::Move::FlinchTargetFailsIfUserNotAsleep < Battle::Move::FlinchTarget
def usableWhenAsleep?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.asleep?
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -579,7 +579,7 @@ end
# (Fake Out)
#===============================================================================
class Battle::Move::FlinchTargetFailsIfNotUserFirstTurn < Battle::Move::FlinchTarget
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.turnCount > 1
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -595,11 +595,11 @@ end
class Battle::Move::FlinchTargetDoublePowerIfTargetInSky < Battle::Move::FlinchTarget
def hitsFlyingTargets?; return true; end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
baseDmg *= 2 if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
"TwoTurnAttackInvulnerableInSkyTargetCannotAct") ||
target.effects[PBEffects::SkyDrop]>=0
target.effects[PBEffects::SkyDrop] >= 0
return baseDmg
end
end
@@ -615,14 +615,14 @@ class Battle::Move::ConfuseTarget < Battle::Move
return !target.pbCanConfuse?(user, show_message, self)
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbConfuse
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
return if !target.pbCanConfuse?(user,false,self)
return if !target.pbCanConfuse?(user, false, self)
target.pbConfuse
end
end
@@ -634,7 +634,7 @@ end
class Battle::Move::ConfuseTargetAlwaysHitsInRainHitsTargetInSky < Battle::Move::ConfuseTarget
def hitsFlyingTargets?; return true; end
def pbBaseAccuracy(user,target)
def pbBaseAccuracy(user, target)
case target.effectiveWeather
when :Sun, :HarshSun
return 50
@@ -659,14 +659,14 @@ class Battle::Move::AttractTarget < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.pbAttract(user)
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbAttract(user) if target.pbCanAttract?(user,false)
target.pbAttract(user) if target.pbCanAttract?(user, false)
end
end
@@ -676,7 +676,7 @@ end
class Battle::Move::SetUserTypesBasedOnEnvironment < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.canChangeType?
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -742,7 +742,7 @@ class Battle::Move::SetUserTypesBasedOnEnvironment < Battle::Move
def pbEffectGeneral(user)
user.pbChangeTypes(@newType)
typeName = GameData::Type.get(@newType).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", user.pbThis, typeName))
end
end
@@ -794,7 +794,7 @@ end
class Battle::Move::SetUserTypesToTargetTypes < Battle::Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.canChangeType?
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -804,22 +804,22 @@ class Battle::Move::SetUserTypesToTargetTypes < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
newTypes = target.pbTypes(true)
if newTypes.length==0 # Target has no type to copy
if newTypes.length == 0 # Target has no type to copy
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if user.pbTypes==target.pbTypes &&
user.effects[PBEffects::Type3]==target.effects[PBEffects::Type3]
if user.pbTypes == target.pbTypes &&
user.effects[PBEffects::Type3] == target.effects[PBEffects::Type3]
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
user.pbChangeTypes(target)
@battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",
user.pbThis,target.pbThis(true)))
user.pbThis, target.pbThis(true)))
end
end
@@ -831,20 +831,20 @@ end
class Battle::Move::SetUserTypesToUserMoveType < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.canChangeType?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
userTypes = user.pbTypes(true)
@newTypes = []
user.eachMoveWithIndex do |m,i|
break if Settings::MECHANICS_GENERATION >= 6 && i>0
user.eachMoveWithIndex do |m, i|
break if Settings::MECHANICS_GENERATION >= 6 && i > 0
next if GameData::Type.get(m.type).pseudo_type
next if userTypes.include?(m.type)
@newTypes.push(m.type) if !@newTypes.include?(m.type)
end
if @newTypes.length==0
if @newTypes.length == 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -855,7 +855,7 @@ class Battle::Move::SetUserTypesToUserMoveType < Battle::Move
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
user.pbChangeTypes(newType)
typeName = GameData::Type.get(newType).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", user.pbThis, typeName))
end
end
@@ -896,10 +896,10 @@ class Battle::Move::SetTargetTypesToWater < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.pbChangeTypes(:WATER)
typeName = GameData::Type.get(:WATER).name
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",target.pbThis,typeName))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!", target.pbThis, typeName))
end
end
@@ -917,10 +917,10 @@ class Battle::Move::AddGhostTypeToTarget < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Type3] = :GHOST
typeName = GameData::Type.get(:GHOST).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", target.pbThis, typeName))
end
end
@@ -938,10 +938,10 @@ class Battle::Move::AddGrassTypeToTarget < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Type3] = :GRASS
typeName = GameData::Type.get(:GRASS).name
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", target.pbThis, typeName))
end
end
@@ -949,7 +949,7 @@ end
# User loses their Fire type. Fails if user is not Fire-type. (Burn Up)
#===============================================================================
class Battle::Move::UserLosesFireType < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.pbHasType?(:FIRE)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -957,10 +957,10 @@ class Battle::Move::UserLosesFireType < Battle::Move
return false
end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
if !user.effects[PBEffects::BurnUp]
user.effects[PBEffects::BurnUp] = true
@battle.pbDisplay(_INTL("{1} burned itself out!",user.pbThis))
@battle.pbDisplay(_INTL("{1} burned itself out!", user.pbThis))
end
end
end
@@ -971,7 +971,7 @@ end
class Battle::Move::SetTargetAbilityToSimple < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !GameData::Ability.exists?(:SIMPLE)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -987,12 +987,12 @@ class Battle::Move::SetTargetAbilityToSimple < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(target,true,false)
def pbEffectAgainstTarget(user, target)
@battle.pbShowAbilitySplash(target, true, false)
oldAbil = target.ability
target.ability = :SIMPLE
@battle.pbReplaceAbilitySplash(target)
@battle.pbDisplay(_INTL("{1} acquired {2}!",target.pbThis,target.abilityName))
@battle.pbDisplay(_INTL("{1} acquired {2}!", target.pbThis, target.abilityName))
@battle.pbHideAbilitySplash(target)
target.pbOnLosingAbility(oldAbil)
target.pbTriggerAbilityOnGainingIt
@@ -1005,7 +1005,7 @@ end
class Battle::Move::SetTargetAbilityToInsomnia < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !GameData::Ability.exists?(:INSOMNIA)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -1021,12 +1021,12 @@ class Battle::Move::SetTargetAbilityToInsomnia < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(target,true,false)
def pbEffectAgainstTarget(user, target)
@battle.pbShowAbilitySplash(target, true, false)
oldAbil = target.ability
target.ability = :INSOMNIA
@battle.pbReplaceAbilitySplash(target)
@battle.pbDisplay(_INTL("{1} acquired {2}!",target.pbThis,target.abilityName))
@battle.pbDisplay(_INTL("{1} acquired {2}!", target.pbThis, target.abilityName))
@battle.pbHideAbilitySplash(target)
target.pbOnLosingAbility(oldAbil)
target.pbTriggerAbilityOnGainingIt
@@ -1039,7 +1039,7 @@ end
class Battle::Move::SetUserAbilityToTargetAbility < Battle::Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.unstoppableAbility?
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -1048,7 +1048,7 @@ class Battle::Move::SetUserAbilityToTargetAbility < Battle::Move
end
def pbFailsAgainstTarget?(user, target, show_message)
if !target.ability || user.ability==target.ability
if !target.ability || user.ability == target.ability
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -1060,13 +1060,13 @@ class Battle::Move::SetUserAbilityToTargetAbility < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(user,true,false)
def pbEffectAgainstTarget(user, target)
@battle.pbShowAbilitySplash(user, true, false)
oldAbil = user.ability
user.ability = target.ability
@battle.pbReplaceAbilitySplash(user)
@battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",
user.pbThis,target.pbThis(true),target.abilityName))
user.pbThis, target.pbThis(true), target.abilityName))
@battle.pbHideAbilitySplash(user)
user.pbOnLosingAbility(oldAbil)
user.pbTriggerAbilityOnGainingIt
@@ -1079,7 +1079,7 @@ end
class Battle::Move::SetTargetAbilityToUserAbility < Battle::Move
def canMagicCoat?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.ability
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -1100,12 +1100,12 @@ class Battle::Move::SetTargetAbilityToUserAbility < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
@battle.pbShowAbilitySplash(target,true,false)
def pbEffectAgainstTarget(user, target)
@battle.pbShowAbilitySplash(target, true, false)
oldAbil = target.ability
target.ability = user.ability
@battle.pbReplaceAbilitySplash(target)
@battle.pbDisplay(_INTL("{1} acquired {2}!",target.pbThis,target.abilityName))
@battle.pbDisplay(_INTL("{1} acquired {2}!", target.pbThis, target.abilityName))
@battle.pbHideAbilitySplash(target)
target.pbOnLosingAbility(oldAbil)
target.pbTriggerAbilityOnGainingIt
@@ -1118,7 +1118,7 @@ end
class Battle::Move::UserTargetSwapAbilities < Battle::Move
def ignoresSubstitute?(user); return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.ability
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -1151,10 +1151,10 @@ class Battle::Move::UserTargetSwapAbilities < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
if user.opposes?(target)
@battle.pbShowAbilitySplash(user,false,false)
@battle.pbShowAbilitySplash(target,true,false)
@battle.pbShowAbilitySplash(user, false, false)
@battle.pbShowAbilitySplash(target, true, false)
end
oldUserAbil = user.ability
oldTargetAbil = target.ability
@@ -1165,10 +1165,10 @@ class Battle::Move::UserTargetSwapAbilities < Battle::Move
@battle.pbReplaceAbilitySplash(target)
end
if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} swapped Abilities with its target!",user.pbThis))
@battle.pbDisplay(_INTL("{1} swapped Abilities with its target!", user.pbThis))
else
@battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
user.pbThis,target.abilityName,user.abilityName))
user.pbThis, target.abilityName, user.abilityName))
end
if user.opposes?(target)
@battle.pbHideAbilitySplash(user)
@@ -1195,10 +1195,10 @@ class Battle::Move::NegateTargetAbility < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::GastroAcid] = true
target.effects[PBEffects::Truant] = false
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!", target.pbThis))
target.pbOnLosingAbility(target.ability, true)
end
end
@@ -1208,15 +1208,15 @@ end
# performed its action this round. (Core Enforcer)
#===============================================================================
class Battle::Move::NegateTargetAbilityIfTargetActed < Battle::Move
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if target.damageState.substitute || target.effects[PBEffects::GastroAcid]
return if target.unstoppableAbility?
return if @battle.choices[target.index][0]!=:UseItem &&
!((@battle.choices[target.index][0]==:UseMove ||
@battle.choices[target.index][0]==:Shift) && target.movedThisRound?)
return if @battle.choices[target.index][0] != :UseItem &&
!((@battle.choices[target.index][0] == :UseMove ||
@battle.choices[target.index][0] == :Shift) && target.movedThisRound?)
target.effects[PBEffects::GastroAcid] = true
target.effects[PBEffects::Truant] = false
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",target.pbThis))
@battle.pbDisplay(_INTL("{1}'s Ability was suppressed!", target.pbThis))
target.pbOnLosingAbility(target.ability, true)
end
end
@@ -1226,7 +1226,7 @@ end
# (Moongeist Beam, Sunsteel Strike)
#===============================================================================
class Battle::Move::IgnoreTargetAbility < Battle::Move
def pbChangeUsageCounters(user,specialUsage)
def pbChangeUsageCounters(user, specialUsage)
super
@battle.moldBreaker = true if !specialUsage
end
@@ -1239,10 +1239,10 @@ class Battle::Move::StartUserAirborne < Battle::Move
def unusableInGravity?; return true; end
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Ingrain] ||
user.effects[PBEffects::SmackDown] ||
user.effects[PBEffects::MagnetRise]>0
user.effects[PBEffects::MagnetRise] > 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1251,7 +1251,7 @@ class Battle::Move::StartUserAirborne < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::MagnetRise] = 5
@battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",user.pbThis))
@battle.pbDisplay(_INTL("{1} levitated with electromagnetism!", user.pbThis))
end
end
@@ -1265,7 +1265,7 @@ class Battle::Move::StartTargetAirborneAndAlwaysHitByMoves < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Ingrain] ||
target.effects[PBEffects::SmackDown] ||
target.effects[PBEffects::Telekinesis]>0
target.effects[PBEffects::Telekinesis] > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -1280,9 +1280,9 @@ class Battle::Move::StartTargetAirborneAndAlwaysHitByMoves < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Telekinesis] = 3
@battle.pbDisplay(_INTL("{1} was hurled into the air!",target.pbThis))
@battle.pbDisplay(_INTL("{1} was hurled into the air!", target.pbThis))
end
end
@@ -1300,19 +1300,19 @@ end
class Battle::Move::HitsTargetInSkyGroundsTarget < Battle::Move
def hitsFlyingTargets?; return true; end
def pbCalcTypeModSingle(moveType,defType,user,target)
def pbCalcTypeModSingle(moveType, defType, user, target)
return Effectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
return super
end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if target.fainted?
return if target.damageState.unaffected || target.damageState.substitute
return if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSkyTargetCannotAct") ||
target.effects[PBEffects::SkyDrop]>=0 # Sky Drop
target.effects[PBEffects::SkyDrop] >= 0 # Sky Drop
return if !target.airborne? && !target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget")
target.effects[PBEffects::SmackDown] = true
target.effects[PBEffects::SmackDown] = true
if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget") # NOTE: Not Sky Drop.
target.effects[PBEffects::TwoTurnAttack] = nil
@@ -1320,7 +1320,7 @@ class Battle::Move::HitsTargetInSkyGroundsTarget < Battle::Move
end
target.effects[PBEffects::MagnetRise] = 0
target.effects[PBEffects::Telekinesis] = 0
@battle.pbDisplay(_INTL("{1} fell straight down!",target.pbThis))
@battle.pbDisplay(_INTL("{1} fell straight down!", target.pbThis))
end
end
@@ -1329,8 +1329,8 @@ end
# (Gravity)
#===============================================================================
class Battle::Move::StartGravity < Battle::Move
def pbMoveFailed?(user,targets)
if @battle.field.effects[PBEffects::Gravity]>0
def pbMoveFailed?(user, targets)
if @battle.field.effects[PBEffects::Gravity] > 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1349,9 +1349,9 @@ class Battle::Move::StartGravity < Battle::Move
@battle.pbClearChoice(b.index) if !b.movedThisRound?
showMessage = true
end
if b.effects[PBEffects::MagnetRise]>0 ||
b.effects[PBEffects::Telekinesis]>0 ||
b.effects[PBEffects::SkyDrop]>=0
if b.effects[PBEffects::MagnetRise] > 0 ||
b.effects[PBEffects::Telekinesis] > 0 ||
b.effects[PBEffects::SkyDrop] >= 0
b.effects[PBEffects::MagnetRise] = 0
b.effects[PBEffects::Telekinesis] = 0
b.effects[PBEffects::SkyDrop] = -1
@@ -1367,7 +1367,7 @@ end
# User transforms into the target. (Transform)
#===============================================================================
class Battle::Move::TransformUserIntoTarget < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Transform]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -1384,12 +1384,12 @@ class Battle::Move::TransformUserIntoTarget < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
user.pbTransform(target)
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
super
@battle.scene.pbChangePokemon(user,targets[0].pokemon)
@battle.scene.pbChangePokemon(user, targets[0].pokemon)
end
end

View File

@@ -2,16 +2,16 @@
# Hits twice.
#===============================================================================
class Battle::Move::HitTwoTimes < Battle::Move
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 2; end
def multiHitMove?; return true; end
def pbNumHits(user, targets); return 2; end
end
#===============================================================================
# Hits twice. May poison the target on each hit. (Twineedle)
#===============================================================================
class Battle::Move::HitTwoTimesPoisonTarget < Battle::Move::PoisonTarget
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 2; end
def multiHitMove?; return true; end
def pbNumHits(user, targets); return 2; end
end
#===============================================================================
@@ -69,19 +69,19 @@ end
# An accuracy check is performed for each hit.
#===============================================================================
class Battle::Move::HitThreeTimesPowersUpWithEachHit < Battle::Move
def multiHitMove?; return true; end
def pbNumHits(user,targets); return 3; end
def multiHitMove?; return true; end
def pbNumHits(user, targets); return 3; end
def successCheckPerHit?
return @accCheckPerHit
end
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
@calcBaseDmg = 0
@accCheckPerHit = !user.hasActiveAbility?(:SKILLLINK)
end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
@calcBaseDmg += baseDmg
return @calcBaseDmg
end
@@ -103,7 +103,7 @@ end
class Battle::Move::HitTwoToFiveTimes < Battle::Move
def multiHitMove?; return true; end
def pbNumHits(user,targets)
def pbNumHits(user, targets)
hitChances = [
2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3,
@@ -111,7 +111,7 @@ class Battle::Move::HitTwoToFiveTimes < Battle::Move
5, 5, 5
]
r = @battle.pbRandom(hitChances.length)
r = hitChances.length-1 if user.hasActiveAbility?(:SKILLLINK)
r = hitChances.length - 1 if user.hasActiveAbility?(:SKILLLINK)
return hitChances[r]
end
end
@@ -121,12 +121,12 @@ end
# (Water Shuriken)
#===============================================================================
class Battle::Move::HitTwoToFiveTimesOrThreeForAshGreninja < Battle::Move::HitTwoToFiveTimes
def pbNumHits(user,targets)
def pbNumHits(user, targets)
return 3 if user.isSpecies?(:GRENINJA) && user.form == 2
return super
end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
return 20 if user.isSpecies?(:GRENINJA) && user.form == 2
return super
end
@@ -171,27 +171,27 @@ end
class Battle::Move::HitOncePerUserTeamMember < Battle::Move
def multiHitMove?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
@beatUpList = []
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,i|
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn, i|
next if !pkmn.able? || pkmn.status != :NONE
@beatUpList.push(i)
end
if @beatUpList.length==0
if @beatUpList.length == 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbNumHits(user,targets)
def pbNumHits(user, targets)
return @beatUpList.length
end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
i = @beatUpList.shift # First element in array, and removes it from array
atk = @battle.pbParty(user.index)[i].baseStats[:ATTACK]
return 5+(atk/10)
return 5 + (atk / 10)
end
end
@@ -209,8 +209,8 @@ end
# Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
#===============================================================================
class Battle::Move::TwoTurnAttack < Battle::Move::TwoTurnMove
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} whipped up a whirlwind!", user.pbThis))
end
end
@@ -232,11 +232,11 @@ class Battle::Move::TwoTurnAttackOneTurnInSun < Battle::Move::TwoTurnMove
return ret
end
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} took in sunlight!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} took in sunlight!", user.pbThis))
end
def pbBaseDamageMultiplier(damageMult,user,target)
def pbBaseDamageMultiplier(damageMult, user, target)
damageMult /= 2 if ![:None, :Sun, :HarshSun].include?(user.effectiveWeather)
return damageMult
end
@@ -247,13 +247,13 @@ end
# May paralyze the target.
#===============================================================================
class Battle::Move::TwoTurnAttackParalyzeTarget < Battle::Move::TwoTurnMove
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!", user.pbThis))
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
end
end
@@ -262,13 +262,13 @@ end
# May burn the target.
#===============================================================================
class Battle::Move::TwoTurnAttackBurnTarget < Battle::Move::TwoTurnMove
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} became cloaked in freezing air!", user.pbThis))
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
target.pbBurn(user) if target.pbCanBurn?(user, false, self)
end
end
@@ -279,11 +279,11 @@ end
class Battle::Move::TwoTurnAttackFlinchTarget < Battle::Move::TwoTurnMove
def flinchingMove?; return true; end
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!", user.pbThis))
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbFlinch(user)
end
@@ -294,27 +294,27 @@ end
# Special Defense and Speed by 2 stages each in the second turn. (Geomancy)
#===============================================================================
class Battle::Move::TwoTurnAttackRaiseUserSpAtkSpDefSpd2 < Battle::Move::TwoTurnMove
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
return false if user.effects[PBEffects::TwoTurnAttack] # Charging turn
if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self) &&
!user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self) &&
!user.pbCanRaiseStatStage?(:SPEED,user,self)
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",user.pbThis))
if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK, user, self) &&
!user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, user, self) &&
!user.pbCanRaiseStatStage?(:SPEED, user, self)
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!", user.pbThis))
return true
end
return false
end
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} is absorbing power!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} is absorbing power!", user.pbThis))
end
def pbEffectGeneral(user)
return if !@damagingTurn
showAnim = true
[:SPECIAL_ATTACK,:SPECIAL_DEFENSE,:SPEED].each do |s|
next if !user.pbCanRaiseStatStage?(s,user,self)
if user.pbRaiseStatStage(s,2,user,showAnim)
[:SPECIAL_ATTACK, :SPECIAL_DEFENSE, :SPEED].each do |s|
next if !user.pbCanRaiseStatStage?(s, user, self)
if user.pbRaiseStatStage(s, 2, user, showAnim)
showAnim = false
end
end
@@ -326,13 +326,13 @@ end
# (Skull Bash)
#===============================================================================
class Battle::Move::TwoTurnAttackChargeRaiseUserDefense1 < Battle::Move::TwoTurnMove
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} tucked in its head!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} tucked in its head!", user.pbThis))
end
def pbChargingTurnEffect(user,target)
if user.pbCanRaiseStatStage?(:DEFENSE,user,self)
user.pbRaiseStatStage(:DEFENSE,1,user)
def pbChargingTurnEffect(user, target)
if user.pbCanRaiseStatStage?(:DEFENSE, user, self)
user.pbRaiseStatStage(:DEFENSE, 1, user)
end
end
end
@@ -358,8 +358,8 @@ end
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
#===============================================================================
class Battle::Move::TwoTurnAttackInvulnerableUnderground < Battle::Move::TwoTurnMove
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} burrowed its way under the ground!", user.pbThis))
end
end
@@ -368,8 +368,8 @@ end
# (Handled in Battler's pbSuccessCheckPerHit): Is semi-invulnerable during use.
#===============================================================================
class Battle::Move::TwoTurnAttackInvulnerableUnderwater < Battle::Move::TwoTurnMove
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} hid underwater!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} hid underwater!", user.pbThis))
end
end
@@ -380,8 +380,8 @@ end
class Battle::Move::TwoTurnAttackInvulnerableInSky < Battle::Move::TwoTurnMove
def unusableInGravity?; return true; end
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} flew up high!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} flew up high!", user.pbThis))
end
end
@@ -393,13 +393,13 @@ end
class Battle::Move::TwoTurnAttackInvulnerableInSkyParalyzeTarget < Battle::Move::TwoTurnMove
def unusableInGravity?; return true; end
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} sprang up!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} sprang up!", user.pbThis))
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.damageState.substitute
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
end
end
@@ -426,44 +426,44 @@ class Battle::Move::TwoTurnAttackInvulnerableInSkyTargetCannotAct < Battle::Move
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if target.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(user)
if target.effects[PBEffects::Substitute] > 0 && !ignoresSubstitute?(user)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if Settings::MECHANICS_GENERATION >= 6 && target.pbWeight>=2000 # 200.0kg
if Settings::MECHANICS_GENERATION >= 6 && target.pbWeight >= 2000 # 200.0kg
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if target.semiInvulnerable? ||
(target.effects[PBEffects::SkyDrop]>=0 && @chargingTurn)
(target.effects[PBEffects::SkyDrop] >= 0 && @chargingTurn)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if target.effects[PBEffects::SkyDrop]!=user.index && @damagingTurn
if target.effects[PBEffects::SkyDrop] != user.index && @damagingTurn
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbCalcTypeMod(movetype,user,target)
def pbCalcTypeMod(movetype, user, target)
return Effectiveness::INEFFECTIVE if target.pbHasType?(:FLYING)
return super
end
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} took {2} into the sky!",user.pbThis,targets[0].pbThis(true)))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} took {2} into the sky!", user.pbThis, targets[0].pbThis(true)))
end
def pbAttackingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",targets[0].pbThis))
def pbAttackingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!", targets[0].pbThis))
end
def pbChargingTurnEffect(user,target)
def pbChargingTurnEffect(user, target)
target.effects[PBEffects::SkyDrop] = user.index
end
def pbAttackingTurnEffect(user,target)
def pbAttackingTurnEffect(user, target)
target.effects[PBEffects::SkyDrop] = -1
end
end
@@ -473,11 +473,11 @@ end
# use. Ends target's protections upon hit. (Shadow Force, Phantom Force)
#===============================================================================
class Battle::Move::TwoTurnAttackInvulnerableRemoveProtections < Battle::Move::TwoTurnMove
def pbChargingTurnMessage(user,targets)
@battle.pbDisplay(_INTL("{1} vanished instantly!",user.pbThis))
def pbChargingTurnMessage(user, targets)
@battle.pbDisplay(_INTL("{1} vanished instantly!", user.pbThis))
end
def pbAttackingTurnEffect(user,target)
def pbAttackingTurnEffect(user, target)
target.effects[PBEffects::BanefulBunker] = false
target.effects[PBEffects::KingsShield] = false
target.effects[PBEffects::Obstruct] = false
@@ -499,10 +499,10 @@ end
#===============================================================================
class Battle::Move::MultiTurnAttackPreventSleeping < Battle::Move
def pbEffectGeneral(user)
return if user.effects[PBEffects::Uproar]>0
return if user.effects[PBEffects::Uproar] > 0
user.effects[PBEffects::Uproar] = 3
user.currentMove = @id
@battle.pbDisplay(_INTL("{1} caused an uproar!",user.pbThis))
@battle.pbDisplay(_INTL("{1} caused an uproar!", user.pbThis))
@battle.pbPriority(true).each do |b|
next if b.fainted? || b.status != :SLEEP
next if b.hasActiveAbility?(:SOUNDPROOF)
@@ -516,15 +516,15 @@ end
# (Outrage, Petal Dange, Thrash)
#===============================================================================
class Battle::Move::MultiTurnAttackConfuseUserAtEnd < Battle::Move
def pbEffectAfterAllHits(user,target)
if !target.damageState.unaffected && user.effects[PBEffects::Outrage]==0
user.effects[PBEffects::Outrage] = 2+@battle.pbRandom(2)
def pbEffectAfterAllHits(user, target)
if !target.damageState.unaffected && user.effects[PBEffects::Outrage] == 0
user.effects[PBEffects::Outrage] = 2 + @battle.pbRandom(2)
user.currentMove = @id
end
if user.effects[PBEffects::Outrage]>0
if user.effects[PBEffects::Outrage] > 0
user.effects[PBEffects::Outrage] -= 1
if user.effects[PBEffects::Outrage]==0 && user.pbCanConfuseSelf?(false)
user.pbConfuse(_INTL("{1} became confused due to fatigue!",user.pbThis))
if user.effects[PBEffects::Outrage] == 0 && user.pbCanConfuseSelf?(false)
user.pbConfuse(_INTL("{1} became confused due to fatigue!", user.pbThis))
end
end
end
@@ -535,7 +535,7 @@ end
# Power is also doubled if user has curled up. (Ice Ball, Rollout)
#===============================================================================
class Battle::Move::MultiTurnAttackPowersUpEachTurn < Battle::Move
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
shift = (5 - user.effects[PBEffects::Rollout]) # 0-4, where 0 is most powerful
shift = 0 if user.effects[PBEffects::Rollout] == 0 # For first turn
shift += 1 if user.effects[PBEffects::DefenseCurl]
@@ -543,7 +543,7 @@ class Battle::Move::MultiTurnAttackPowersUpEachTurn < Battle::Move
return baseDmg
end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
if !target.damageState.unaffected && user.effects[PBEffects::Rollout] == 0
user.effects[PBEffects::Rollout] = 5
user.currentMove = @id
@@ -558,23 +558,23 @@ end
# (Bide)
#===============================================================================
class Battle::Move::MultiTurnAttackBideThenReturnDoubleDamage < Battle::Move::FixedDamageMove
def pbAddTarget(targets,user)
return if user.effects[PBEffects::Bide]!=1 # Not the attack turn
def pbAddTarget(targets, user)
return if user.effects[PBEffects::Bide] != 1 # Not the attack turn
idxTarget = user.effects[PBEffects::BideTarget]
t = (idxTarget>=0) ? @battle.battlers[idxTarget] : nil
if !user.pbAddTarget(targets,user,t,self,false)
user.pbAddTargetRandomFoe(targets,user,self,false)
t = (idxTarget >= 0) ? @battle.battlers[idxTarget] : nil
if !user.pbAddTarget(targets, user, t, self, false)
user.pbAddTargetRandomFoe(targets, user, self, false)
end
end
def pbMoveFailed?(user,targets)
return false if user.effects[PBEffects::Bide]!=1 # Not the attack turn
if user.effects[PBEffects::BideDamage]==0
def pbMoveFailed?(user, targets)
return false if user.effects[PBEffects::Bide] != 1 # Not the attack turn
if user.effects[PBEffects::BideDamage] == 0
@battle.pbDisplay(_INTL("But it failed!"))
user.effects[PBEffects::Bide] = 0 # No need to reset other Bide variables
return true
end
if targets.length==0
if targets.length == 0
@battle.pbDisplay(_INTL("But there was no target..."))
user.effects[PBEffects::Bide] = 0 # No need to reset other Bide variables
return true
@@ -582,15 +582,15 @@ class Battle::Move::MultiTurnAttackBideThenReturnDoubleDamage < Battle::Move::Fi
return false
end
def pbOnStartUse(user,targets)
@damagingTurn = (user.effects[PBEffects::Bide]==1) # If attack turn
def pbOnStartUse(user, targets)
@damagingTurn = (user.effects[PBEffects::Bide] == 1) # If attack turn
end
def pbDisplayUseMessage(user)
if @damagingTurn # Attack turn
@battle.pbDisplayBrief(_INTL("{1} unleashed energy!",user.pbThis))
elsif user.effects[PBEffects::Bide]>1 # Charging turns
@battle.pbDisplayBrief(_INTL("{1} is storing energy!",user.pbThis))
@battle.pbDisplayBrief(_INTL("{1} unleashed energy!", user.pbThis))
elsif user.effects[PBEffects::Bide] > 1 # Charging turns
@battle.pbDisplayBrief(_INTL("{1} is storing energy!", user.pbThis))
else
super # Start using Bide
end
@@ -601,12 +601,12 @@ class Battle::Move::MultiTurnAttackBideThenReturnDoubleDamage < Battle::Move::Fi
return super
end
def pbFixedDamage(user,target)
return user.effects[PBEffects::BideDamage]*2
def pbFixedDamage(user, target)
return user.effects[PBEffects::BideDamage] * 2
end
def pbEffectGeneral(user)
if user.effects[PBEffects::Bide]==0 # Starting using Bide
if user.effects[PBEffects::Bide] == 0 # Starting using Bide
user.effects[PBEffects::Bide] = 3
user.effects[PBEffects::BideDamage] = 0
user.effects[PBEffects::BideTarget] = -1
@@ -615,7 +615,7 @@ class Battle::Move::MultiTurnAttackBideThenReturnDoubleDamage < Battle::Move::Fi
user.effects[PBEffects::Bide] -= 1
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if !@damagingTurn # Charging anim
super
end

View File

@@ -2,22 +2,22 @@
# Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
#===============================================================================
class Battle::Move::HealUserFullyAndFallAsleep < Battle::Move::HealingMove
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.asleep?
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return true if !user.pbCanSleep?(user,true,self,true)
return true if !user.pbCanSleep?(user, true, self, true)
return true if super
return false
end
def pbHealAmount(user)
return user.totalhp-user.hp
return user.totalhp - user.hp
end
def pbEffectGeneral(user)
user.pbSleepSelf(_INTL("{1} slept and became healthy!",user.pbThis),3)
user.pbSleepSelf(_INTL("{1} slept and became healthy!", user.pbThis), 3)
super
end
end
@@ -27,7 +27,7 @@ end
#===============================================================================
class Battle::Move::HealUserHalfOfTotalHP < Battle::Move::HealingMove
def pbHealAmount(user)
return (user.totalhp/2.0).round
return (user.totalhp / 2.0).round
end
end
@@ -36,14 +36,14 @@ end
# Synthesis)
#===============================================================================
class Battle::Move::HealUserDependingOnWeather < Battle::Move::HealingMove
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
case user.effectiveWeather
when :Sun, :HarshSun
@healAmount = (user.totalhp*2/3.0).round
@healAmount = (user.totalhp * 2 / 3.0).round
when :None, :StrongWinds
@healAmount = (user.totalhp/2.0).round
@healAmount = (user.totalhp / 2.0).round
else
@healAmount = (user.totalhp/4.0).round
@healAmount = (user.totalhp / 4.0).round
end
end
@@ -68,7 +68,7 @@ end
#===============================================================================
class Battle::Move::HealUserHalfOfTotalHPLoseFlyingTypeThisTurn < Battle::Move::HealingMove
def pbHealAmount(user)
return (user.totalhp/2.0).round
return (user.totalhp / 2.0).round
end
def pbEffectGeneral(user)
@@ -94,10 +94,10 @@ class Battle::Move::CureTargetStatusHealUserHalfOfTotalHP < Battle::Move::Healin
end
def pbHealAmount(user)
return (user.totalhp/2.0).round
return (user.totalhp / 2.0).round
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.pbCureStatus
super
end
@@ -129,28 +129,28 @@ class Battle::Move::HealUserByTargetAttackLowerTargetAttack1 < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
# Calculate target's effective attack value
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]
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]
atk = target.attack
atkStage = target.stages[:ATTACK]+6
healAmt = (atk.to_f*stageMul[atkStage]/stageDiv[atkStage]).floor
atkStage = target.stages[:ATTACK] + 6
healAmt = (atk.to_f * stageMul[atkStage] / stageDiv[atkStage]).floor
# Reduce target's Attack stat
if target.pbCanLowerStatStage?(:ATTACK,user,self)
target.pbLowerStatStage(:ATTACK,1,user)
if target.pbCanLowerStatStage?(:ATTACK, user, self)
target.pbLowerStatStage(:ATTACK, 1, user)
end
# Heal user
if target.hasActiveAbility?(:LIQUIDOOZE)
@battle.pbShowAbilitySplash(target)
user.pbReduceHP(healAmt)
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",user.pbThis))
@battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!", user.pbThis))
@battle.pbHideAbilitySplash(target)
user.pbItemHPHealCheck
elsif user.canHeal?
healAmt = (healAmt*1.3).floor if user.hasActiveItem?(:BIGROOT)
healAmt = (healAmt * 1.3).floor if user.hasActiveItem?(:BIGROOT)
user.pbRecoverHP(healAmt)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",user.pbThis))
@battle.pbDisplay(_INTL("{1}'s HP was restored.", user.pbThis))
end
end
end
@@ -161,10 +161,10 @@ end
class Battle::Move::HealUserByHalfOfDamageDone < Battle::Move
def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end
def pbEffectAgainstTarget(user,target)
return if target.damageState.hpLost<=0
hpGain = (target.damageState.hpLost/2.0).round
user.pbRecoverHPFromDrain(hpGain,target)
def pbEffectAgainstTarget(user, target)
return if target.damageState.hpLost <= 0
hpGain = (target.damageState.hpLost / 2.0).round
user.pbRecoverHPFromDrain(hpGain, target)
end
end
@@ -183,10 +183,10 @@ class Battle::Move::HealUserByHalfOfDamageDoneIfTargetAsleep < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
return if target.damageState.hpLost<=0
hpGain = (target.damageState.hpLost/2.0).round
user.pbRecoverHPFromDrain(hpGain,target)
def pbEffectAgainstTarget(user, target)
return if target.damageState.hpLost <= 0
hpGain = (target.damageState.hpLost / 2.0).round
user.pbRecoverHPFromDrain(hpGain, target)
end
end
@@ -196,10 +196,10 @@ end
class Battle::Move::HealUserByThreeQuartersOfDamageDone < Battle::Move
def healingMove?; return Settings::MECHANICS_GENERATION >= 6; end
def pbEffectAgainstTarget(user,target)
return if target.damageState.hpLost<=0
hpGain = (target.damageState.hpLost*0.75).round
user.pbRecoverHPFromDrain(hpGain,target)
def pbEffectAgainstTarget(user, target)
return if target.damageState.hpLost <= 0
hpGain = (target.damageState.hpLost * 0.75).round
user.pbRecoverHPFromDrain(hpGain, target)
end
end
@@ -278,7 +278,7 @@ class Battle::Move::HealTargetHalfOfTotalHP < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.hp==target.totalhp
if target.hp == target.totalhp
@battle.pbDisplay(_INTL("{1}'s HP is full!", target.pbThis)) if show_message
return true
elsif !target.canHeal?
@@ -288,13 +288,13 @@ class Battle::Move::HealTargetHalfOfTotalHP < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
hpGain = (target.totalhp/2.0).round
def pbEffectAgainstTarget(user, target)
hpGain = (target.totalhp / 2.0).round
if pulseMove? && user.hasActiveAbility?(:MEGALAUNCHER)
hpGain = (target.totalhp*3/4.0).round
hpGain = (target.totalhp * 3 / 4.0).round
end
target.pbRecoverHP(hpGain)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
end
end
@@ -307,7 +307,7 @@ class Battle::Move::HealTargetDependingOnGrassyTerrain < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.hp==target.totalhp
if target.hp == target.totalhp
@battle.pbDisplay(_INTL("{1}'s HP is full!", target.pbThis)) if show_message
return true
elsif !target.canHeal?
@@ -317,11 +317,11 @@ class Battle::Move::HealTargetDependingOnGrassyTerrain < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
hpGain = (target.totalhp/2.0).round
hpGain = (target.totalhp*2/3.0).round if @battle.field.terrain == :Grassy
def pbEffectAgainstTarget(user, target)
hpGain = (target.totalhp / 2.0).round
hpGain = (target.totalhp * 2 / 3.0).round if @battle.field.terrain == :Grassy
target.pbRecoverHP(hpGain)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
end
end
@@ -333,8 +333,8 @@ class Battle::Move::HealUserPositionNextTurn < Battle::Move
def healingMove?; return true; end
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if @battle.positions[user.index].effects[PBEffects::Wish]>0
def pbMoveFailed?(user, targets)
if @battle.positions[user.index].effects[PBEffects::Wish] > 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -343,7 +343,7 @@ class Battle::Move::HealUserPositionNextTurn < Battle::Move
def pbEffectGeneral(user)
@battle.positions[user.index].effects[PBEffects::Wish] = 2
@battle.positions[user.index].effects[PBEffects::WishAmount] = (user.totalhp/2.0).round
@battle.positions[user.index].effects[PBEffects::WishAmount] = (user.totalhp / 2.0).round
@battle.positions[user.index].effects[PBEffects::WishMaker] = user.pokemonIndex
end
end
@@ -355,7 +355,7 @@ end
class Battle::Move::StartHealUserEachTurn < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::AquaRing]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -365,7 +365,7 @@ class Battle::Move::StartHealUserEachTurn < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::AquaRing] = true
@battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",user.pbThis))
@battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!", user.pbThis))
end
end
@@ -376,7 +376,7 @@ end
class Battle::Move::StartHealUserEachTurnTrapUserInBattle < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Ingrain]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -386,7 +386,7 @@ class Battle::Move::StartHealUserEachTurnTrapUserInBattle < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::Ingrain] = true
@battle.pbDisplay(_INTL("{1} planted its roots!",user.pbThis))
@battle.pbDisplay(_INTL("{1} planted its roots!", user.pbThis))
end
end
@@ -402,9 +402,9 @@ class Battle::Move::StartDamageTargetEachTurnIfTargetAsleep < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Nightmare] = true
@battle.pbDisplay(_INTL("{1} began having a nightmare!",target.pbThis))
@battle.pbDisplay(_INTL("{1} began having a nightmare!", target.pbThis))
end
end
@@ -416,7 +416,7 @@ class Battle::Move::StartLeechSeedTarget < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::LeechSeed]>=0
if target.effects[PBEffects::LeechSeed] >= 0
@battle.pbDisplay(_INTL("{1} evaded the attack!", target.pbThis)) if show_message
return true
end
@@ -427,14 +427,14 @@ class Battle::Move::StartLeechSeedTarget < Battle::Move
return false
end
def pbMissMessage(user,target)
@battle.pbDisplay(_INTL("{1} evaded the attack!",target.pbThis))
def pbMissMessage(user, target)
@battle.pbDisplay(_INTL("{1} evaded the attack!", target.pbThis))
return true
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::LeechSeed] = user.index
@battle.pbDisplay(_INTL("{1} was seeded!",target.pbThis))
@battle.pbDisplay(_INTL("{1} was seeded!", target.pbThis))
end
end
@@ -459,16 +459,16 @@ end
class Battle::Move::UserLosesHalfOfTotalHPExplosive < Battle::Move
def worksWithNoTargets?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !@battle.moldBreaker
bearer = @battle.pbCheckGlobalAbility(:DAMP)
if bearer!=nil
if bearer != nil
@battle.pbShowAbilitySplash(bearer)
if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} cannot use {2}!",user.pbThis,@name))
@battle.pbDisplay(_INTL("{1} cannot use {2}!", user.pbThis, @name))
else
@battle.pbDisplay(_INTL("{1} cannot use {2} because of {3}'s {4}!",
user.pbThis,@name,bearer.pbThis(true),bearer.abilityName))
user.pbThis, @name, bearer.pbThis(true), bearer.abilityName))
end
@battle.pbHideAbilitySplash(bearer)
return true
@@ -479,7 +479,7 @@ class Battle::Move::UserLosesHalfOfTotalHPExplosive < Battle::Move
def pbSelfKO(user)
return if !user.takesIndirectDamage?
user.pbReduceHP((user.totalhp/2.0).round,false)
user.pbReduceHP((user.totalhp / 2.0).round, false)
user.pbItemHPHealCheck
end
end
@@ -489,18 +489,18 @@ end
#===============================================================================
class Battle::Move::UserFaintsExplosive < Battle::Move
def worksWithNoTargets?; return true; end
def pbNumHits(user,targets); return 1; end
def pbNumHits(user, targets); return 1; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !@battle.moldBreaker
bearer = @battle.pbCheckGlobalAbility(:DAMP)
if bearer!=nil
if bearer != nil
@battle.pbShowAbilitySplash(bearer)
if Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} cannot use {2}!",user.pbThis,@name))
@battle.pbDisplay(_INTL("{1} cannot use {2}!", user.pbThis, @name))
else
@battle.pbDisplay(_INTL("{1} cannot use {2} because of {3}'s {4}!",
user.pbThis,@name,bearer.pbThis(true),bearer.abilityName))
user.pbThis, @name, bearer.pbThis(true), bearer.abilityName))
end
@battle.pbHideAbilitySplash(bearer)
return true
@@ -511,7 +511,7 @@ class Battle::Move::UserFaintsExplosive < Battle::Move
def pbSelfKO(user)
return if user.fainted?
user.pbReduceHP(user.hp,false)
user.pbReduceHP(user.hp, false)
user.pbItemHPHealCheck
end
end
@@ -532,19 +532,19 @@ end
# User faints (if successful).
#===============================================================================
class Battle::Move::UserFaintsFixedDamageUserHP < Battle::Move::FixedDamageMove
def pbNumHits(user,targets); return 1; end
def pbNumHits(user, targets); return 1; end
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
@finalGambitDamage = user.hp
end
def pbFixedDamage(user,target)
def pbFixedDamage(user, target)
return @finalGambitDamage
end
def pbSelfKO(user)
return if user.fainted?
user.pbReduceHP(user.hp,false)
user.pbReduceHP(user.hp, false)
user.pbItemHPHealCheck
end
end
@@ -556,9 +556,9 @@ end
class Battle::Move::UserFaintsLowerTargetAtkSpAtk2 < Battle::Move::TargetMultiStatDownMove
def canMagicCoat?; return false; end
def initialize(battle,move)
def initialize(battle, move)
super
@statDown = [:ATTACK,2,:SPECIAL_ATTACK,2]
@statDown = [:ATTACK, 2, :SPECIAL_ATTACK, 2]
end
# NOTE: The user faints even if the target's stats cannot be changed, so this
@@ -569,7 +569,7 @@ class Battle::Move::UserFaintsLowerTargetAtkSpAtk2 < Battle::Move::TargetMultiSt
def pbSelfKO(user)
return if user.fainted?
user.pbReduceHP(user.hp,false)
user.pbReduceHP(user.hp, false)
user.pbItemHPHealCheck
end
end
@@ -582,7 +582,7 @@ class Battle::Move::UserFaintsHealAndCureReplacement < Battle::Move
def healingMove?; return true; end
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !@battle.pbCanChooseNonActive?(user.index)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -592,7 +592,7 @@ class Battle::Move::UserFaintsHealAndCureReplacement < Battle::Move
def pbSelfKO(user)
return if user.fainted?
user.pbReduceHP(user.hp,false)
user.pbReduceHP(user.hp, false)
user.pbItemHPHealCheck
@battle.positions[user.index].effects[PBEffects::HealingWish] = true
end
@@ -606,7 +606,7 @@ class Battle::Move::UserFaintsHealAndCureReplacementRestorePP < Battle::Move
def healingMove?; return true; end
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !@battle.pbCanChooseNonActive?(user.index)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -616,7 +616,7 @@ class Battle::Move::UserFaintsHealAndCureReplacementRestorePP < Battle::Move
def pbSelfKO(user)
return if user.fainted?
user.pbReduceHP(user.hp,false)
user.pbReduceHP(user.hp, false)
user.pbItemHPHealCheck
@battle.positions[user.index].effects[PBEffects::LunarDance] = true
end
@@ -626,10 +626,10 @@ end
# All current battlers will perish after 3 more rounds. (Perish Song)
#===============================================================================
class Battle::Move::StartPerishCountsForAllBattlers < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
failed = true
targets.each do |b|
next if b.effects[PBEffects::PerishSong]>0 # Heard it before
next if b.effects[PBEffects::PerishSong] > 0 # Heard it before
failed = false
break
end
@@ -641,15 +641,15 @@ class Battle::Move::StartPerishCountsForAllBattlers < Battle::Move
end
def pbFailsAgainstTarget?(user, target, show_message)
return target.effects[PBEffects::PerishSong]>0 # Heard it before
return target.effects[PBEffects::PerishSong] > 0 # Heard it before
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::PerishSong] = 4
target.effects[PBEffects::PerishSongUser] = user.index
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
super
@battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
end
@@ -660,7 +660,7 @@ end
# (Destiny Bond)
#===============================================================================
class Battle::Move::AttackerFaintsIfUserFaints < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if Settings::MECHANICS_GENERATION >= 7 && user.effects[PBEffects::DestinyBondPrevious]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -670,7 +670,7 @@ class Battle::Move::AttackerFaintsIfUserFaints < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::DestinyBond] = true
@battle.pbDisplay(_INTL("{1} is hoping to take its attacker down with it!",user.pbThis))
@battle.pbDisplay(_INTL("{1} is hoping to take its attacker down with it!", user.pbThis))
end
end
@@ -681,6 +681,6 @@ end
class Battle::Move::SetAttackerMovePPTo0IfUserFaints < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::Grudge] = true
@battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",user.pbThis))
@battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!", user.pbThis))
end
end

View File

@@ -3,7 +3,7 @@
# Items stolen from wild Pokémon are kept after the battle.
#===============================================================================
class Battle::Move::UserTakesTargetItem < Battle::Move
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if user.wild? # Wild Pokémon can't thieve
return if user.fainted?
return if target.damageState.unaffected || target.damageState.substitute
@@ -20,7 +20,7 @@ class Battle::Move::UserTakesTargetItem < Battle::Move
else
target.pbRemoveItem(false)
end
@battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",user.pbThis,target.pbThis(true),itemName))
@battle.pbDisplay(_INTL("{1} stole {2}'s {3}!", user.pbThis, target.pbThis(true), itemName))
user.pbHeldItemTriggerCheck
end
end
@@ -35,7 +35,7 @@ class Battle::Move::TargetTakesUserItem < Battle::Move
return super
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.item || user.unlosableItem?(user.item)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -51,7 +51,7 @@ class Battle::Move::TargetTakesUserItem < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
itemName = user.itemName
target.item = user.item
# Permanently steal the item from wild Pokémon
@@ -61,7 +61,7 @@ class Battle::Move::TargetTakesUserItem < Battle::Move
else
user.pbRemoveItem(false)
end
@battle.pbDisplay(_INTL("{1} received {2} from {3}!",target.pbThis,itemName,user.pbThis(true)))
@battle.pbDisplay(_INTL("{1} received {2} from {3}!", target.pbThis, itemName, user.pbThis(true)))
target.pbHeldItemTriggerCheck
end
end
@@ -71,7 +71,7 @@ end
# (Switcheroo, Trick)
#===============================================================================
class Battle::Move::UserTargetSwapItems < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.wild?
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -107,7 +107,7 @@ class Battle::Move::UserTargetSwapItems < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
oldUserItem = user.item
oldUserItemName = user.itemName
oldTargetItem = target.item
@@ -122,9 +122,9 @@ class Battle::Move::UserTargetSwapItems < Battle::Move
if target.wild? && !user.initialItem && oldTargetItem == target.initialItem
user.setInitialItem(oldTargetItem)
end
@battle.pbDisplay(_INTL("{1} switched items with its opponent!",user.pbThis))
@battle.pbDisplay(_INTL("{1} obtained {2}.",user.pbThis,oldTargetItemName)) if oldTargetItem
@battle.pbDisplay(_INTL("{1} obtained {2}.",target.pbThis,oldUserItemName)) if oldUserItem
@battle.pbDisplay(_INTL("{1} switched items with its opponent!", user.pbThis))
@battle.pbDisplay(_INTL("{1} obtained {2}.", user.pbThis, oldTargetItemName)) if oldTargetItem
@battle.pbDisplay(_INTL("{1} obtained {2}.", target.pbThis, oldUserItemName)) if oldUserItem
user.pbHeldItemTriggerCheck
target.pbHeldItemTriggerCheck
end
@@ -136,7 +136,7 @@ end
class Battle::Move::RestoreUserConsumedItem < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.recycleItem
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -153,9 +153,9 @@ class Battle::Move::RestoreUserConsumedItem < Battle::Move
user.effects[PBEffects::PickupUse] = 0
itemName = GameData::Item.get(item).name
if itemName.starts_with_vowel?
@battle.pbDisplay(_INTL("{1} found an {2}!",user.pbThis,itemName))
@battle.pbDisplay(_INTL("{1} found an {2}!", user.pbThis, itemName))
else
@battle.pbDisplay(_INTL("{1} found a {2}!",user.pbThis,itemName))
@battle.pbDisplay(_INTL("{1} found a {2}!", user.pbThis, itemName))
end
user.pbHeldItemTriggerCheck
end
@@ -166,17 +166,17 @@ end
# If target has a losable item, damage is multiplied by 1.5.
#===============================================================================
class Battle::Move::RemoveTargetItem < Battle::Move
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
if Settings::MECHANICS_GENERATION >= 6 &&
target.item && !target.unlosableItem?(target.item)
# NOTE: Damage is still boosted even if target has Sticky Hold or a
# substitute.
baseDmg = (baseDmg*1.5).round
baseDmg = (baseDmg * 1.5).round
end
return baseDmg
end
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if user.wild? # Wild Pokémon can't knock off
return if user.fainted?
return if target.damageState.unaffected || target.damageState.substitute
@@ -184,7 +184,7 @@ class Battle::Move::RemoveTargetItem < Battle::Move
return if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
itemName = target.itemName
target.pbRemoveItem(false)
@battle.pbDisplay(_INTL("{1} dropped its {2}!",target.pbThis,itemName))
@battle.pbDisplay(_INTL("{1} dropped its {2}!", target.pbThis, itemName))
end
end
@@ -192,12 +192,12 @@ end
# Target's berry/Gem is destroyed. (Incinerate)
#===============================================================================
class Battle::Move::DestroyTargetBerryOrGem < Battle::Move
def pbEffectWhenDealingDamage(user,target)
def pbEffectWhenDealingDamage(user, target)
return if target.damageState.substitute || target.damageState.berryWeakened
return if !target.item || (!target.item.is_berry? &&
!(Settings::MECHANICS_GENERATION >= 6 && target.item.is_gem?))
target.pbRemoveItem
@battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",target.pbThis,target.itemName))
@battle.pbDisplay(_INTL("{1}'s {2} was incinerated!", target.pbThis, target.itemName))
end
end
@@ -251,16 +251,16 @@ class Battle::Move::StartTargetCannotUseItem < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Embargo]>0
if target.effects[PBEffects::Embargo] > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Embargo] = 5
@battle.pbDisplay(_INTL("{1} can't use items anymore!",target.pbThis))
@battle.pbDisplay(_INTL("{1} can't use items anymore!", target.pbThis))
end
end
@@ -270,7 +270,7 @@ end
#===============================================================================
class Battle::Move::StartNegateHeldItems < Battle::Move
def pbEffectGeneral(user)
if @battle.field.effects[PBEffects::MagicRoom]>0
if @battle.field.effects[PBEffects::MagicRoom] > 0
@battle.field.effects[PBEffects::MagicRoom] = 0
@battle.pbDisplay(_INTL("The area returned to normal!"))
else
@@ -279,8 +279,8 @@ class Battle::Move::StartNegateHeldItems < Battle::Move
end
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
return if @battle.field.effects[PBEffects::MagicRoom]>0 # No animation
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
return if @battle.field.effects[PBEffects::MagicRoom] > 0 # No animation
super
end
end
@@ -374,7 +374,7 @@ end
# User consumes target's berry and gains its effect. (Bug Bite, Pluck)
#===============================================================================
class Battle::Move::UserConsumeTargetBerry < Battle::Move
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if user.fainted? || target.fainted?
return if target.damageState.unaffected || target.damageState.substitute
return if !target.item || !target.item.is_berry?
@@ -382,8 +382,8 @@ class Battle::Move::UserConsumeTargetBerry < Battle::Move
item = target.item
itemName = target.itemName
target.pbRemoveItem
@battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",user.pbThis,itemName))
user.pbHeldItemTriggerCheck(item,false)
@battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!", user.pbThis, itemName))
user.pbHeldItemTriggerCheck(item, false)
end
end
@@ -391,114 +391,114 @@ end
# User flings its item at the target. Power/effect depend on the item. (Fling)
#===============================================================================
class Battle::Move::ThrowUserItemAtTarget < Battle::Move
def initialize(battle,move)
def initialize(battle, move)
super
# 80 => all Mega Stones
# 10 => all Berries
@flingPowers = {
130 => [:IRONBALL],
100 => [:HARDSTONE,:RAREBONE,
100 => [:HARDSTONE, :RAREBONE,
# Fossils
:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HELIXFOSSIL,
:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:ROOTFOSSIL,:SAILFOSSIL,
:ARMORFOSSIL, :CLAWFOSSIL, :COVERFOSSIL, :DOMEFOSSIL, :HELIXFOSSIL,
:JAWFOSSIL, :OLDAMBER, :PLUMEFOSSIL, :ROOTFOSSIL, :SAILFOSSIL,
:SKULLFOSSIL],
90 => [:DEEPSEATOOTH,:GRIPCLAW,:THICKCLUB,
90 => [:DEEPSEATOOTH, :GRIPCLAW, :THICKCLUB,
# Plates
:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,:FLAMEPLATE,
:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,:MEADOWPLATE,:MINDPLATE,
:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,:SPOOKYPLATE,:STONEPLATE,
:TOXICPLATE,:ZAPPLATE],
80 => [:ASSAULTVEST,:CHIPPEDPOT,:CRACKEDPOT,:DAWNSTONE,:DUSKSTONE,
:ELECTIRIZER,:HEAVYDUTYBOOTS,:MAGMARIZER,:ODDKEYSTONE,:OVALSTONE,
:PROTECTOR,:QUICKCLAW,:RAZORCLAW,:SACHET,:SAFETYGOGGLES,
:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY,:WHIPPEDDREAM],
70 => [:DRAGONFANG,:POISONBARB,
:DRACOPLATE, :DREADPLATE, :EARTHPLATE, :FISTPLATE, :FLAMEPLATE,
:ICICLEPLATE, :INSECTPLATE, :IRONPLATE, :MEADOWPLATE, :MINDPLATE,
:PIXIEPLATE, :SKYPLATE, :SPLASHPLATE, :SPOOKYPLATE, :STONEPLATE,
:TOXICPLATE, :ZAPPLATE],
80 => [:ASSAULTVEST, :CHIPPEDPOT, :CRACKEDPOT, :DAWNSTONE, :DUSKSTONE,
:ELECTIRIZER, :HEAVYDUTYBOOTS, :MAGMARIZER, :ODDKEYSTONE, :OVALSTONE,
:PROTECTOR, :QUICKCLAW, :RAZORCLAW, :SACHET, :SAFETYGOGGLES,
:SHINYSTONE, :STICKYBARB, :WEAKNESSPOLICY, :WHIPPEDDREAM],
70 => [:DRAGONFANG, :POISONBARB,
# EV-training items (Macho Brace is 60)
:POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
:POWERANKLET, :POWERBAND, :POWERBELT, :POWERBRACER, :POWERLENS,
:POWERWEIGHT,
# Drives
:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:SHOCKDRIVE],
60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LEEK,:LUSTROUSORB,
:MACHOBRACE,:ROCKYHELMET,:STICK,:TERRAINEXTENDER],
50 => [:DUBIOUSDISC,:SHARPBEAK,
:BURNDRIVE, :CHILLDRIVE, :DOUSEDRIVE, :SHOCKDRIVE],
60 => [:ADAMANTORB, :DAMPROCK, :GRISEOUSORB, :HEATROCK, :LEEK, :LUSTROUSORB,
:MACHOBRACE, :ROCKYHELMET, :STICK, :TERRAINEXTENDER],
50 => [:DUBIOUSDISC, :SHARPBEAK,
# Memories
:BUGMEMORY,:DARKMEMORY,:DRAGONMEMORY,:ELECTRICMEMORY,:FAIRYMEMORY,
:FIGHTINGMEMORY,:FIREMEMORY,:FLYINGMEMORY,:GHOSTMEMORY,
:GRASSMEMORY,:GROUNDMEMORY,:ICEMEMORY,:POISONMEMORY,
:PSYCHICMEMORY,:ROCKMEMORY,:STEELMEMORY,:WATERMEMORY],
40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],
30 => [:ABSORBBULB,:ADRENALINEORB,:AMULETCOIN,:BINDINGBAND,:BLACKBELT,
:BLACKGLASSES,:BLACKSLUDGE,:BOTTLECAP,:CELLBATTERY,:CHARCOAL,
:CLEANSETAG,:DEEPSEASCALE,:DRAGONSCALE,:EJECTBUTTON,:ESCAPEROPE,
:EXPSHARE,:FLAMEORB,:FLOATSTONE,:FLUFFYTAIL,:GOLDBOTTLECAP,
:HEARTSCALE,:HONEY,:KINGSROCK,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,
:LUCKYEGG,:LUMINOUSMOSS,:MAGNET,:METALCOAT,:METRONOME,
:MIRACLESEED,:MYSTICWATER,:NEVERMELTICE,:PASSORB,:POKEDOLL,
:POKETOY,:PRISMSCALE,:PROTECTIVEPADS,:RAZORFANG,:SACREDASH,
:SCOPELENS,:SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
:SOULDEW,:SPELLTAG,:TOXICORB,:TWISTEDSPOON,:UPGRADE,
:BUGMEMORY, :DARKMEMORY, :DRAGONMEMORY, :ELECTRICMEMORY, :FAIRYMEMORY,
:FIGHTINGMEMORY, :FIREMEMORY, :FLYINGMEMORY, :GHOSTMEMORY,
:GRASSMEMORY, :GROUNDMEMORY, :ICEMEMORY, :POISONMEMORY,
:PSYCHICMEMORY, :ROCKMEMORY, :STEELMEMORY, :WATERMEMORY],
40 => [:EVIOLITE, :ICYROCK, :LUCKYPUNCH],
30 => [:ABSORBBULB, :ADRENALINEORB, :AMULETCOIN, :BINDINGBAND, :BLACKBELT,
:BLACKGLASSES, :BLACKSLUDGE, :BOTTLECAP, :CELLBATTERY, :CHARCOAL,
:CLEANSETAG, :DEEPSEASCALE, :DRAGONSCALE, :EJECTBUTTON, :ESCAPEROPE,
:EXPSHARE, :FLAMEORB, :FLOATSTONE, :FLUFFYTAIL, :GOLDBOTTLECAP,
:HEARTSCALE, :HONEY, :KINGSROCK, :LIFEORB, :LIGHTBALL, :LIGHTCLAY,
:LUCKYEGG, :LUMINOUSMOSS, :MAGNET, :METALCOAT, :METRONOME,
:MIRACLESEED, :MYSTICWATER, :NEVERMELTICE, :PASSORB, :POKEDOLL,
:POKETOY, :PRISMSCALE, :PROTECTIVEPADS, :RAZORFANG, :SACREDASH,
:SCOPELENS, :SHELLBELL, :SHOALSALT, :SHOALSHELL, :SMOKEBALL, :SNOWBALL,
:SOULDEW, :SPELLTAG, :TOXICORB, :TWISTEDSPOON, :UPGRADE,
# Healing items
:ANTIDOTE,:AWAKENING,:BERRYJUICE,:BIGMALASADA,:BLUEFLUTE,
:BURNHEAL,:CASTELIACONE,:ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ETHER,
:FRESHWATER,:FULLHEAL,:FULLRESTORE,:HEALPOWDER,:HYPERPOTION,
:ICEHEAL,:LAVACOOKIE,:LEMONADE,:LUMIOSEGALETTE,:MAXELIXIR,
:MAXETHER,:MAXHONEY,:MAXPOTION,:MAXREVIVE,:MOOMOOMILK,:OLDGATEAU,
:PARALYZEHEAL,:PARLYZHEAL,:PEWTERCRUNCHIES,:POTION,:RAGECANDYBAR,
:REDFLUTE,:REVIVALHERB,:REVIVE,:SHALOURSABLE,:SODAPOP,
:SUPERPOTION,:SWEETHEART,:YELLOWFLUTE,
:ANTIDOTE, :AWAKENING, :BERRYJUICE, :BIGMALASADA, :BLUEFLUTE,
:BURNHEAL, :CASTELIACONE, :ELIXIR, :ENERGYPOWDER, :ENERGYROOT, :ETHER,
:FRESHWATER, :FULLHEAL, :FULLRESTORE, :HEALPOWDER, :HYPERPOTION,
:ICEHEAL, :LAVACOOKIE, :LEMONADE, :LUMIOSEGALETTE, :MAXELIXIR,
:MAXETHER, :MAXHONEY, :MAXPOTION, :MAXREVIVE, :MOOMOOMILK, :OLDGATEAU,
:PARALYZEHEAL, :PARLYZHEAL, :PEWTERCRUNCHIES, :POTION, :RAGECANDYBAR,
:REDFLUTE, :REVIVALHERB, :REVIVE, :SHALOURSABLE, :SODAPOP,
:SUPERPOTION, :SWEETHEART, :YELLOWFLUTE,
# Battle items
:XACCURACY,:XACCURACY2,:XACCURACY3,:XACCURACY6,
:XATTACK,:XATTACK2,:XATTACK3,:XATTACK6,
:XDEFEND,:XDEFEND2,:XDEFEND3,:XDEFEND6,
:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
:XSPATK,:XSPATK2,:XSPATK3,:XSPATK6,
:XSPECIAL,:XSPECIAL2,:XSPECIAL3,:XSPECIAL6,
:XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,
:XSPEED,:XSPEED2,:XSPEED3,:XSPEED6,
:DIREHIT,:DIREHIT2,:DIREHIT3,
:ABILITYURGE,:GUARDSPEC,:ITEMDROP,:ITEMURGE,:RESETURGE,
:XACCURACY, :XACCURACY2, :XACCURACY3, :XACCURACY6,
:XATTACK, :XATTACK2, :XATTACK3, :XATTACK6,
:XDEFEND, :XDEFEND2, :XDEFEND3, :XDEFEND6,
:XDEFENSE, :XDEFENSE2, :XDEFENSE3, :XDEFENSE6,
:XSPATK, :XSPATK2, :XSPATK3, :XSPATK6,
:XSPECIAL, :XSPECIAL2, :XSPECIAL3, :XSPECIAL6,
:XSPDEF, :XSPDEF2, :XSPDEF3, :XSPDEF6,
:XSPEED, :XSPEED2, :XSPEED3, :XSPEED6,
:DIREHIT, :DIREHIT2, :DIREHIT3,
:ABILITYURGE, :GUARDSPEC, :ITEMDROP, :ITEMURGE, :RESETURGE,
:MAXMUSHROOMS,
# Vitamins
:CALCIUM,:CARBOS,:HPUP,:IRON,:PPUP,:PPMAX,:PROTEIN,:ZINC,
:CALCIUM, :CARBOS, :HPUP, :IRON, :PPUP, :PPMAX, :PROTEIN, :ZINC,
:RARECANDY,
# Most evolution stones (see also 80)
:EVERSTONE,:FIRESTONE,:ICESTONE,:LEAFSTONE,:MOONSTONE,:SUNSTONE,
:THUNDERSTONE,:WATERSTONE,:SWEETAPPLE,:TARTAPPLE, :GALARICACUFF,
:EVERSTONE, :FIRESTONE, :ICESTONE, :LEAFSTONE, :MOONSTONE, :SUNSTONE,
:THUNDERSTONE, :WATERSTONE, :SWEETAPPLE, :TARTAPPLE, :GALARICACUFF,
:GALARICAWREATH,
# Repels
:MAXREPEL,:REPEL,:SUPERREPEL,
:MAXREPEL, :REPEL, :SUPERREPEL,
# Mulches
:AMAZEMULCH,:BOOSTMULCH,:DAMPMULCH,:GOOEYMULCH,:GROWTHMULCH,
:RICHMULCH,:STABLEMULCH,:SURPRISEMULCH,
:AMAZEMULCH, :BOOSTMULCH, :DAMPMULCH, :GOOEYMULCH, :GROWTHMULCH,
:RICHMULCH, :STABLEMULCH, :SURPRISEMULCH,
# Shards
:BLUESHARD,:GREENSHARD,:REDSHARD,:YELLOWSHARD,
:BLUESHARD, :GREENSHARD, :REDSHARD, :YELLOWSHARD,
# Valuables
:BALMMUSHROOM,:BIGMUSHROOM,:BIGNUGGET,:BIGPEARL,:COMETSHARD,
:NUGGET,:PEARL,:PEARLSTRING,:RELICBAND,:RELICCOPPER,:RELICCROWN,
:RELICGOLD,:RELICSILVER,:RELICSTATUE,:RELICVASE,:STARDUST,
:STARPIECE,:STRANGESOUVENIR,:TINYMUSHROOM,
:BALMMUSHROOM, :BIGMUSHROOM, :BIGNUGGET, :BIGPEARL, :COMETSHARD,
:NUGGET, :PEARL, :PEARLSTRING, :RELICBAND, :RELICCOPPER, :RELICCROWN,
:RELICGOLD, :RELICSILVER, :RELICSTATUE, :RELICVASE, :STARDUST,
:STARPIECE, :STRANGESOUVENIR, :TINYMUSHROOM,
# Exp Candies
:EXPCANDYXS, :EXPCANDYS, :EXPCANDYM, :EXPCANDYL, :EXPCANDYXL],
20 => [ # Feathers
:CLEVERFEATHER,:GENIUSFEATHER,:HEALTHFEATHER,:MUSCLEFEATHER,
:PRETTYFEATHER,:RESISTFEATHER,:SWIFTFEATHER,
:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
:RESISTWING,:SWIFTWING],
10 => [:AIRBALLOON,:BIGROOT,:BRIGHTPOWDER,:CHOICEBAND,:CHOICESCARF,
:CHOICESPECS,:DESTINYKNOT,:DISCOUNTCOUPON,:EXPERTBELT,:FOCUSBAND,
:FOCUSSASH,:LAGGINGTAIL,:LEFTOVERS,:MENTALHERB,:METALPOWDER,
:MUSCLEBAND,:POWERHERB,:QUICKPOWDER,:REAPERCLOTH,:REDCARD,
:RINGTARGET,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,:SMOOTHROCK,
:SOFTSAND,:SOOTHEBELL,:WHITEHERB,:WIDELENS,:WISEGLASSES,:ZOOMLENS,
:CLEVERFEATHER, :GENIUSFEATHER, :HEALTHFEATHER, :MUSCLEFEATHER,
:PRETTYFEATHER, :RESISTFEATHER, :SWIFTFEATHER,
:CLEVERWING, :GENIUSWING, :HEALTHWING, :MUSCLEWING, :PRETTYWING,
:RESISTWING, :SWIFTWING],
10 => [:AIRBALLOON, :BIGROOT, :BRIGHTPOWDER, :CHOICEBAND, :CHOICESCARF,
:CHOICESPECS, :DESTINYKNOT, :DISCOUNTCOUPON, :EXPERTBELT, :FOCUSBAND,
:FOCUSSASH, :LAGGINGTAIL, :LEFTOVERS, :MENTALHERB, :METALPOWDER,
:MUSCLEBAND, :POWERHERB, :QUICKPOWDER, :REAPERCLOTH, :REDCARD,
:RINGTARGET, :SHEDSHELL, :SILKSCARF, :SILVERPOWDER, :SMOOTHROCK,
:SOFTSAND, :SOOTHEBELL, :WHITEHERB, :WIDELENS, :WISEGLASSES, :ZOOMLENS,
# Terrain seeds
:ELECTRICSEED,:GRASSYSEED,:MISTYSEED,:PSYCHICSEED,
:ELECTRICSEED, :GRASSYSEED, :MISTYSEED, :PSYCHICSEED,
# Nectar
:PINKNECTAR,:PURPLENECTAR,:REDNECTAR,:YELLOWNECTAR,
:PINKNECTAR, :PURPLENECTAR, :REDNECTAR, :YELLOWNECTAR,
# Incenses
:FULLINCENSE,:LAXINCENSE,:LUCKINCENSE,:ODDINCENSE,:PUREINCENSE,
:ROCKINCENSE,:ROSEINCENSE,:SEAINCENSE,:WAVEINCENSE,
:FULLINCENSE, :LAXINCENSE, :LUCKINCENSE, :ODDINCENSE, :PUREINCENSE,
:ROCKINCENSE, :ROSEINCENSE, :SEAINCENSE, :WAVEINCENSE,
# Scarves
:BLUESCARF,:GREENSCARF,:PINKSCARF,:REDSCARF,:YELLOWSCARF,
:BLUESCARF, :GREENSCARF, :PINKSCARF, :REDSCARF, :YELLOWSCARF,
# Mints
:LONELYMINT, :ADAMANTMINT, :NAUGHTYMINT, :BRAVEMINT, :BOLDMINT,
:IMPISHMINT, :LAXMINT, :RELAXEDMINT, :MODESTMINT, :MILDMINT,
@@ -527,7 +527,7 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move
@willFail = true if !flingableItem
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if @willFail
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -539,13 +539,13 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move
super
pbCheckFlingSuccess(user)
if !@willFail
@battle.pbDisplay(_INTL("{1} flung its {2}!",user.pbThis,user.itemName))
@battle.pbDisplay(_INTL("{1} flung its {2}!", user.pbThis, user.itemName))
end
end
def pbNumHits(user,targets); return 1; end
def pbNumHits(user, targets); return 1; end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
return 0 if !user.item
return 10 if user.item.is_berry?
return 80 if user.item.is_mega_stone?
@@ -554,36 +554,36 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move
ret = 10 if ret < 10
return ret
end
@flingPowers.each do |power,items|
@flingPowers.each do |power, items|
return power if items.include?(user.item_id)
end
return 10
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if target.damageState.substitute
return if target.hasActiveAbility?(:SHIELDDUST) && !@battle.moldBreaker
case user.item_id
when :POISONBARB
target.pbPoison(user) if target.pbCanPoison?(user,false,self)
target.pbPoison(user) if target.pbCanPoison?(user, false, self)
when :TOXICORB
target.pbPoison(user,nil,true) if target.pbCanPoison?(user,false,self)
target.pbPoison(user, nil, true) if target.pbCanPoison?(user, false, self)
when :FLAMEORB
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
target.pbBurn(user) if target.pbCanBurn?(user, false, self)
when :LIGHTBALL
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
when :KINGSROCK, :RAZORFANG
target.pbFlinch(user)
else
target.pbHeldItemTriggerCheck(user.item,true)
target.pbHeldItemTriggerCheck(user.item, true)
end
end
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
# NOTE: The item is consumed even if this move was Protected against or it
# missed. The item is not consumed if the target was switched out by
# an effect like a target's Red Card.
# NOTE: There is no item consumption animation.
user.pbConsumeItem(true,true,false) if user.item
user.pbConsumeItem(true, true, false) if user.item
end
end

View File

@@ -6,11 +6,11 @@ class Battle::Move::RedirectAllMovesToUser < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::FollowMe] = 1
user.allAllies.each do |b|
next if b.effects[PBEffects::FollowMe]<user.effects[PBEffects::FollowMe]
user.effects[PBEffects::FollowMe] = b.effects[PBEffects::FollowMe]+1
next if b.effects[PBEffects::FollowMe] < user.effects[PBEffects::FollowMe]
user.effects[PBEffects::FollowMe] = b.effects[PBEffects::FollowMe] + 1
end
user.effects[PBEffects::RagePowder] = true if powderMove?
@battle.pbDisplay(_INTL("{1} became the center of attention!",user.pbThis))
@battle.pbDisplay(_INTL("{1} became the center of attention!", user.pbThis))
end
end
@@ -21,13 +21,13 @@ end
class Battle::Move::RedirectAllMovesToTarget < Battle::Move
def canMagicCoat?; return true; end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Spotlight] = 1
target.allAllies.each do |b|
next if b.effects[PBEffects::Spotlight]<target.effects[PBEffects::Spotlight]
target.effects[PBEffects::Spotlight] = b.effects[PBEffects::Spotlight]+1
next if b.effects[PBEffects::Spotlight] < target.effects[PBEffects::Spotlight]
target.effects[PBEffects::Spotlight] = b.effects[PBEffects::Spotlight] + 1
end
@battle.pbDisplay(_INTL("{1} became the center of attention!",target.pbThis))
@battle.pbDisplay(_INTL("{1} became the center of attention!", target.pbThis))
end
end
@@ -44,20 +44,20 @@ end
# but I think that's silly so I've omitted that effect.
#===============================================================================
class Battle::Move::RandomlyDamageOrHealTarget < Battle::Move
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
@presentDmg = 0 # 0 = heal, >0 = damage
r = @battle.pbRandom(100)
if r<40
if r < 40
@presentDmg = 40
elsif r<70
elsif r < 70
@presentDmg = 80
elsif r<80
elsif r < 80
@presentDmg = 120
end
end
def pbFailsAgainstTarget?(user, target, show_message)
return false if @presentDmg>0
return false if @presentDmg > 0
if !target.canHeal?
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
@@ -66,22 +66,22 @@ class Battle::Move::RandomlyDamageOrHealTarget < Battle::Move
end
def pbDamagingMove?
return false if @presentDmg==0
return false if @presentDmg == 0
return super
end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
return @presentDmg
end
def pbEffectAgainstTarget(user,target)
return if @presentDmg>0
target.pbRecoverHP(target.totalhp/4)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
def pbEffectAgainstTarget(user, target)
return if @presentDmg > 0
target.pbRecoverHP(target.totalhp / 4)
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
hitNum = 1 if @presentDmg==0 # Healing anim
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if @presentDmg == 0 # Healing anim
super
end
end
@@ -92,18 +92,18 @@ end
#===============================================================================
class Battle::Move::HealAllyOrDamageFoe < Battle::Move
def pbTarget(user)
return GameData::Target.get(:NearFoe) if user.effects[PBEffects::HealBlock]>0
return GameData::Target.get(:NearFoe) if user.effects[PBEffects::HealBlock] > 0
return super
end
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
@healing = false
@healing = !user.opposes?(targets[0]) if targets.length>0
@healing = !user.opposes?(targets[0]) if targets.length > 0
end
def pbFailsAgainstTarget?(user, target, show_message)
return false if !@healing
if target.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(user)
if target.effects[PBEffects::Substitute] > 0 && !ignoresSubstitute?(user)
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -119,13 +119,13 @@ class Battle::Move::HealAllyOrDamageFoe < Battle::Move
return super
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if !@healing
target.pbRecoverHP(target.totalhp/2)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
target.pbRecoverHP(target.totalhp / 2)
@battle.pbDisplay(_INTL("{1}'s HP was restored.", target.pbThis))
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if @healing # Healing anim
super
end
@@ -148,11 +148,11 @@ class Battle::Move::CurseTargetOrLowerUserSpd1RaiseUserAtkDef1 < Battle::Move
return super
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
return false if user.pbHasType?(:GHOST)
if !user.pbCanLowerStatStage?(:SPEED,user,self) &&
!user.pbCanRaiseStatStage?(:ATTACK,user,self) &&
!user.pbCanRaiseStatStage?(:DEFENSE,user,self)
if !user.pbCanLowerStatStage?(:SPEED, user, self) &&
!user.pbCanRaiseStatStage?(:ATTACK, user, self) &&
!user.pbCanRaiseStatStage?(:DEFENSE, user, self)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -170,30 +170,30 @@ class Battle::Move::CurseTargetOrLowerUserSpd1RaiseUserAtkDef1 < Battle::Move
def pbEffectGeneral(user)
return if user.pbHasType?(:GHOST)
# Non-Ghost effect
if user.pbCanLowerStatStage?(:SPEED,user,self)
user.pbLowerStatStage(:SPEED,1,user)
if user.pbCanLowerStatStage?(:SPEED, user, self)
user.pbLowerStatStage(:SPEED, 1, user)
end
showAnim = true
if user.pbCanRaiseStatStage?(:ATTACK,user,self)
if user.pbRaiseStatStage(:ATTACK,1,user,showAnim)
if user.pbCanRaiseStatStage?(:ATTACK, user, self)
if user.pbRaiseStatStage(:ATTACK, 1, user, showAnim)
showAnim = false
end
end
if user.pbCanRaiseStatStage?(:DEFENSE,user,self)
user.pbRaiseStatStage(:DEFENSE,1,user,showAnim)
if user.pbCanRaiseStatStage?(:DEFENSE, user, self)
user.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)
end
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if !user.pbHasType?(:GHOST)
# Ghost effect
@battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",user.pbThis,target.pbThis(true)))
@battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!", user.pbThis, target.pbThis(true)))
target.effects[PBEffects::Curse] = true
user.pbReduceHP(user.totalhp/2, false, false)
user.pbReduceHP(user.totalhp / 2, false, false)
user.pbItemHPHealCheck
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if !user.pbHasType?(:GHOST) # Non-Ghost anim
super
end
@@ -203,9 +203,9 @@ end
# Effect depends on the environment. (Secret Power)
#===============================================================================
class Battle::Move::EffectDependsOnEnvironment < Battle::Move
def flinchingMove?; return [6,10,12].include?(@secretPower); end
def flinchingMove?; return [6, 10, 12].include?(@secretPower); end
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
# NOTE: This is Gen 7's list plus some of Gen 6 plus a bit of my own.
@secretPower = 0 # Body Slam, paralysis
case @battle.field.terrain
@@ -249,46 +249,46 @@ class Battle::Move::EffectDependsOnEnvironment < Battle::Move
# method is called per hit and this move's additional effect only occurs
# once per use, after all the hits have happened (two hits are possible
# via Parental Bond).
def pbEffectAfterAllHits(user,target)
def pbEffectAfterAllHits(user, target)
return if target.fainted?
return if target.damageState.unaffected || target.damageState.substitute
chance = pbAdditionalEffectChance(user,target)
return if @battle.pbRandom(100)>=chance
chance = pbAdditionalEffectChance(user, target)
return if @battle.pbRandom(100) >= chance
case @secretPower
when 2
target.pbSleep if target.pbCanSleep?(user,false,self)
target.pbSleep if target.pbCanSleep?(user, false, self)
when 10
target.pbBurn(user) if target.pbCanBurn?(user,false,self)
target.pbBurn(user) if target.pbCanBurn?(user, false, self)
when 0, 1
target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
target.pbParalyze(user) if target.pbCanParalyze?(user, false, self)
when 9
target.pbFreeze if target.pbCanFreeze?(user,false,self)
target.pbFreeze if target.pbCanFreeze?(user, false, self)
when 5
if target.pbCanLowerStatStage?(:ATTACK,user,self)
target.pbLowerStatStage(:ATTACK,1,user)
if target.pbCanLowerStatStage?(:ATTACK, user, self)
target.pbLowerStatStage(:ATTACK, 1, user)
end
when 14
if target.pbCanLowerStatStage?(:DEFENSE,user,self)
target.pbLowerStatStage(:DEFENSE,1,user)
if target.pbCanLowerStatStage?(:DEFENSE, user, self)
target.pbLowerStatStage(:DEFENSE, 1, user)
end
when 3
if target.pbCanLowerStatStage?(:SPECIAL_ATTACK,user,self)
target.pbLowerStatStage(:SPECIAL_ATTACK,1,user)
if target.pbCanLowerStatStage?(:SPECIAL_ATTACK, user, self)
target.pbLowerStatStage(:SPECIAL_ATTACK, 1, user)
end
when 4, 6, 12
if target.pbCanLowerStatStage?(:SPEED,user,self)
target.pbLowerStatStage(:SPEED,1,user)
if target.pbCanLowerStatStage?(:SPEED, user, self)
target.pbLowerStatStage(:SPEED, 1, user)
end
when 8
if target.pbCanLowerStatStage?(:ACCURACY,user,self)
target.pbLowerStatStage(:ACCURACY,1,user)
if target.pbCanLowerStatStage?(:ACCURACY, user, self)
target.pbLowerStatStage(:ACCURACY, 1, user)
end
when 7, 11, 13
target.pbFlinch(user)
end
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
id = :BODYSLAM # Environment-specific anim
case @secretPower
when 1 then id = :THUNDERSHOCK if GameData::Move.exists?(:THUNDERSHOCK)
@@ -347,9 +347,9 @@ class Battle::Move::TargetNextFireMoveDamagesTarget < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Powder] = true
@battle.pbDisplay(_INTL("{1} is covered in powder!",user.pbThis))
@battle.pbDisplay(_INTL("{1} is covered in powder!", user.pbThis))
end
end
@@ -357,12 +357,12 @@ end
# Power is doubled if Fusion Flare has already been used this round. (Fusion Bolt)
#===============================================================================
class Battle::Move::DoublePowerAfterFusionFlare < Battle::Move
def pbChangeUsageCounters(user,specialUsage)
def pbChangeUsageCounters(user, specialUsage)
@doublePower = @battle.field.effects[PBEffects::FusionFlare]
super
end
def pbBaseDamageMultiplier(damageMult,user,target)
def pbBaseDamageMultiplier(damageMult, user, target)
damageMult *= 2 if @doublePower
return damageMult
end
@@ -371,8 +371,8 @@ class Battle::Move::DoublePowerAfterFusionFlare < Battle::Move
@battle.field.effects[PBEffects::FusionBolt] = true
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
hitNum = 1 if (targets.length>0 && targets[0].damageState.critical) ||
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if (targets.length > 0 && targets[0].damageState.critical) ||
@doublePower # Charged anim
super
end
@@ -382,12 +382,12 @@ end
# Power is doubled if Fusion Bolt has already been used this round. (Fusion Flare)
#===============================================================================
class Battle::Move::DoublePowerAfterFusionBolt < Battle::Move
def pbChangeUsageCounters(user,specialUsage)
def pbChangeUsageCounters(user, specialUsage)
@doublePower = @battle.field.effects[PBEffects::FusionBolt]
super
end
def pbBaseDamageMultiplier(damageMult,user,target)
def pbBaseDamageMultiplier(damageMult, user, target)
damageMult *= 2 if @doublePower
return damageMult
end
@@ -396,8 +396,8 @@ class Battle::Move::DoublePowerAfterFusionBolt < Battle::Move
@battle.field.effects[PBEffects::FusionFlare] = true
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
hitNum = 1 if (targets.length>0 && targets[0].damageState.critical) ||
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if (targets.length > 0 && targets[0].damageState.critical) ||
@doublePower # Charged anim
super
end
@@ -418,9 +418,9 @@ class Battle::Move::PowerUpAllyMove < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::HelpingHand] = true
@battle.pbDisplay(_INTL("{1} is ready to help {2}!",user.pbThis,target.pbThis(true)))
@battle.pbDisplay(_INTL("{1} is ready to help {2}!", user.pbThis, target.pbThis(true)))
end
end
@@ -429,23 +429,23 @@ end
# (Counter)
#===============================================================================
class Battle::Move::CounterPhysicalDamage < Battle::Move::FixedDamageMove
def pbAddTarget(targets,user)
def pbAddTarget(targets, user)
t = user.effects[PBEffects::CounterTarget]
return if t<0 || !user.opposes?(t)
user.pbAddTarget(targets,user,@battle.battlers[t],self,false)
return if t < 0 || !user.opposes?(t)
user.pbAddTarget(targets, user, @battle.battlers[t], self, false)
end
def pbMoveFailed?(user,targets)
if targets.length==0
def pbMoveFailed?(user, targets)
if targets.length == 0
@battle.pbDisplay(_INTL("But there was no target..."))
return true
end
return false
end
def pbFixedDamage(user,target)
dmg = user.effects[PBEffects::Counter]*2
dmg = 1 if dmg==0
def pbFixedDamage(user, target)
dmg = user.effects[PBEffects::Counter] * 2
dmg = 1 if dmg == 0
return dmg
end
end
@@ -455,23 +455,23 @@ end
# (Mirror Coat)
#===============================================================================
class Battle::Move::CounterSpecialDamage < Battle::Move::FixedDamageMove
def pbAddTarget(targets,user)
def pbAddTarget(targets, user)
t = user.effects[PBEffects::MirrorCoatTarget]
return if t<0 || !user.opposes?(t)
user.pbAddTarget(targets,user,@battle.battlers[t],self,false)
return if t < 0 || !user.opposes?(t)
user.pbAddTarget(targets, user, @battle.battlers[t], self, false)
end
def pbMoveFailed?(user,targets)
if targets.length==0
def pbMoveFailed?(user, targets)
if targets.length == 0
@battle.pbDisplay(_INTL("But there was no target..."))
return true
end
return false
end
def pbFixedDamage(user,target)
dmg = user.effects[PBEffects::MirrorCoat]*2
dmg = 1 if dmg==0
def pbFixedDamage(user, target)
dmg = user.effects[PBEffects::MirrorCoat] * 2
dmg = 1 if dmg == 0
return dmg
end
end
@@ -481,24 +481,24 @@ end
# the power. (Metal Burst)
#===============================================================================
class Battle::Move::CounterDamagePlusHalf < Battle::Move::FixedDamageMove
def pbAddTarget(targets,user)
return if user.lastFoeAttacker.length==0
def pbAddTarget(targets, user)
return if user.lastFoeAttacker.length == 0
lastAttacker = user.lastFoeAttacker.last
return if lastAttacker<0 || !user.opposes?(lastAttacker)
user.pbAddTarget(targets,user,@battle.battlers[lastAttacker],self,false)
return if lastAttacker < 0 || !user.opposes?(lastAttacker)
user.pbAddTarget(targets, user, @battle.battlers[lastAttacker], self, false)
end
def pbMoveFailed?(user,targets)
if targets.length==0
def pbMoveFailed?(user, targets)
if targets.length == 0
@battle.pbDisplay(_INTL("But there was no target..."))
return true
end
return false
end
def pbFixedDamage(user,target)
dmg = (user.lastHPLostFromFoe*1.5).floor
dmg = 1 if dmg==0
def pbFixedDamage(user, target)
dmg = (user.lastHPLostFromFoe * 1.5).floor
dmg = 1 if dmg == 0
return dmg
end
end
@@ -510,9 +510,9 @@ end
class Battle::Move::UserAddStockpileRaiseDefSpDef1 < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if user.effects[PBEffects::Stockpile]>=3
@battle.pbDisplay(_INTL("{1} can't stockpile any more!",user.pbThis))
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Stockpile] >= 3
@battle.pbDisplay(_INTL("{1} can't stockpile any more!", user.pbThis))
return true
end
return false
@@ -521,16 +521,16 @@ class Battle::Move::UserAddStockpileRaiseDefSpDef1 < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::Stockpile] += 1
@battle.pbDisplay(_INTL("{1} stockpiled {2}!",
user.pbThis,user.effects[PBEffects::Stockpile]))
user.pbThis, user.effects[PBEffects::Stockpile]))
showAnim = true
if user.pbCanRaiseStatStage?(:DEFENSE,user,self)
if user.pbRaiseStatStage(:DEFENSE,1,user,showAnim)
if user.pbCanRaiseStatStage?(:DEFENSE, user, self)
if user.pbRaiseStatStage(:DEFENSE, 1, user, showAnim)
user.effects[PBEffects::StockpileDef] += 1
showAnim = false
end
end
if user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self)
if user.pbRaiseStatStage(:SPECIAL_DEFENSE,1,user,showAnim)
if user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, user, self)
if user.pbRaiseStatStage(:SPECIAL_DEFENSE, 1, user, showAnim)
user.effects[PBEffects::StockpileSpDef] += 1
end
end
@@ -542,33 +542,33 @@ end
# 0. Decreases the user's Defense and Special Defense by X stages each. (Spit Up)
#===============================================================================
class Battle::Move::PowerDependsOnUserStockpile < Battle::Move
def pbMoveFailed?(user,targets)
if user.effects[PBEffects::Stockpile]==0
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Stockpile] == 0
@battle.pbDisplay(_INTL("But it failed to spit up a thing!"))
return true
end
return false
end
def pbBaseDamage(baseDmg,user,target)
return 100*user.effects[PBEffects::Stockpile]
def pbBaseDamage(baseDmg, user, target)
return 100 * user.effects[PBEffects::Stockpile]
end
def pbEffectAfterAllHits(user,target)
return if user.fainted? || user.effects[PBEffects::Stockpile]==0
def pbEffectAfterAllHits(user, target)
return if user.fainted? || user.effects[PBEffects::Stockpile] == 0
return if target.damageState.unaffected
@battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",user.pbThis))
@battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!", user.pbThis))
return if @battle.pbAllFainted?(target.idxOwnSide)
showAnim = true
if user.effects[PBEffects::StockpileDef]>0 &&
user.pbCanLowerStatStage?(:DEFENSE,user,self)
if user.pbLowerStatStage(:DEFENSE,user.effects[PBEffects::StockpileDef],user,showAnim)
if user.effects[PBEffects::StockpileDef] > 0 &&
user.pbCanLowerStatStage?(:DEFENSE, user, self)
if user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim)
showAnim = false
end
end
if user.effects[PBEffects::StockpileSpDef]>0 &&
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE,user,self)
user.pbLowerStatStage(:SPECIAL_DEFENSE,user.effects[PBEffects::StockpileSpDef],user,showAnim)
if user.effects[PBEffects::StockpileSpDef] > 0 &&
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE, user, self)
user.pbLowerStatStage(:SPECIAL_DEFENSE, user.effects[PBEffects::StockpileSpDef], user, showAnim)
end
user.effects[PBEffects::Stockpile] = 0
user.effects[PBEffects::StockpileDef] = 0
@@ -584,14 +584,14 @@ class Battle::Move::HealUserDependingOnUserStockpile < Battle::Move
def healingMove?; return true; end
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
if user.effects[PBEffects::Stockpile]==0
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Stockpile] == 0
@battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
return true
end
if !user.canHeal? &&
user.effects[PBEffects::StockpileDef]==0 &&
user.effects[PBEffects::StockpileSpDef]==0
user.effects[PBEffects::StockpileDef] == 0 &&
user.effects[PBEffects::StockpileSpDef] == 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -600,25 +600,25 @@ class Battle::Move::HealUserDependingOnUserStockpile < Battle::Move
def pbEffectGeneral(user)
hpGain = 0
case [user.effects[PBEffects::Stockpile],1].max
when 1 then hpGain = user.totalhp/4
when 2 then hpGain = user.totalhp/2
case [user.effects[PBEffects::Stockpile], 1].max
when 1 then hpGain = user.totalhp / 4
when 2 then hpGain = user.totalhp / 2
when 3 then hpGain = user.totalhp
end
if user.pbRecoverHP(hpGain)>0
@battle.pbDisplay(_INTL("{1}'s HP was restored.",user.pbThis))
if user.pbRecoverHP(hpGain) > 0
@battle.pbDisplay(_INTL("{1}'s HP was restored.", user.pbThis))
end
@battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",user.pbThis))
@battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!", user.pbThis))
showAnim = true
if user.effects[PBEffects::StockpileDef]>0 &&
user.pbCanLowerStatStage?(:DEFENSE,user,self)
if user.pbLowerStatStage(:DEFENSE,user.effects[PBEffects::StockpileDef],user,showAnim)
if user.effects[PBEffects::StockpileDef] > 0 &&
user.pbCanLowerStatStage?(:DEFENSE, user, self)
if user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim)
showAnim = false
end
end
if user.effects[PBEffects::StockpileSpDef]>0 &&
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE,user,self)
user.pbLowerStatStage(:SPECIAL_DEFENSE,user.effects[PBEffects::StockpileSpDef],user,showAnim)
if user.effects[PBEffects::StockpileSpDef] > 0 &&
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE, user, self)
user.pbLowerStatStage(:SPECIAL_DEFENSE, user.effects[PBEffects::StockpileSpDef], user, showAnim)
end
user.effects[PBEffects::Stockpile] = 0
user.effects[PBEffects::StockpileDef] = 0
@@ -632,7 +632,7 @@ end
# swamp on the opposing side.
#===============================================================================
class Battle::Move::GrassPledge < Battle::Move::PledgeMove
def initialize(battle,move)
def initialize(battle, move)
super
# [Function code to combo with, effect, override type, override animation]
@combos = [["FirePledge", :SeaOfFire, :FIRE, :FIREPLEDGE],
@@ -646,7 +646,7 @@ end
# user's side or a sea of fire on the opposing side.
#===============================================================================
class Battle::Move::FirePledge < Battle::Move::PledgeMove
def initialize(battle,move)
def initialize(battle, move)
super
# [Function code to combo with, effect, override type, override animation]
@combos = [["WaterPledge", :Rainbow, :WATER, :WATERPLEDGE],
@@ -660,7 +660,7 @@ end
# opposing side or a rainbow on the user's side.
#===============================================================================
class Battle::Move::WaterPledge < Battle::Move::PledgeMove
def initialize(battle,move)
def initialize(battle, move)
super
# [Function code to combo with, effect, override type, override animation]
@combos = [["GrassPledge", :Swamp, :GRASS, :GRASSPLEDGE],
@@ -674,7 +674,7 @@ end
class Battle::Move::UseLastMoveUsed < Battle::Move
def callsAnotherMove?; return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
# Struggle, Belch
@@ -738,12 +738,12 @@ class Battle::Move::UseLastMoveUsed < Battle::Move
end
end
def pbChangeUsageCounters(user,specialUsage)
def pbChangeUsageCounters(user, specialUsage)
super
@copied_move = @battle.lastMoveUsed
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !@copied_move ||
@moveBlacklist.include?(GameData::Move.get(@copied_move).function_code)
@battle.pbDisplay(_INTL("But it failed!"))
@@ -773,11 +773,11 @@ class Battle::Move::UseLastMoveUsedByTarget < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
user.pbUseMoveSimple(target.lastRegularMoveUsed,target.index)
def pbEffectAgainstTarget(user, target)
user.pbUseMoveSimple(target.lastRegularMoveUsed, target.index)
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
# No animation
end
end
@@ -790,7 +790,7 @@ class Battle::Move::UseMoveTargetIsAboutToUse < Battle::Move
def ignoresSubstitute?(user); return true; end
def callsAnotherMove?; return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
"UserTakesTargetItem", # Covet, Thief
@@ -818,7 +818,7 @@ class Battle::Move::UseMoveTargetIsAboutToUse < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
user.effects[PBEffects::MeFirst] = true
user.pbUseMoveSimple(@battle.choices[target.index][2].id)
user.effects[PBEffects::MeFirst] = false
@@ -834,7 +834,7 @@ end
class Battle::Move::UseMoveDependingOnEnvironment < Battle::Move
def callsAnotherMove?; return true; end
def pbOnStartUse(user,targets)
def pbOnStartUse(user, targets)
# NOTE: It's possible in theory to not have the move Nature Power wants to
# turn into, but what self-respecting game wouldn't at least have Tri
# Attack in it?
@@ -882,7 +882,7 @@ class Battle::Move::UseMoveDependingOnEnvironment < Battle::Move
end
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
@battle.pbDisplay(_INTL("{1} turned into {2}!", @name, GameData::Move.get(@npMove).name))
user.pbUseMoveSimple(@npMove, target.index)
end
@@ -894,7 +894,7 @@ end
class Battle::Move::UseRandomMove < Battle::Move
def callsAnotherMove?; return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
"FlinchTargetFailsIfUserNotAsleep", # Snore
@@ -977,7 +977,7 @@ class Battle::Move::UseRandomMove < Battle::Move
]
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
@metronomeMove = nil
move_keys = GameData::Move.keys
# NOTE: You could be really unlucky and roll blacklisted moves 1000 times in
@@ -1009,7 +1009,7 @@ end
class Battle::Move::UseRandomMoveFromUserParty < Battle::Move
def callsAnotherMove?; return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
# Struggle, Belch
@@ -1092,11 +1092,11 @@ class Battle::Move::UseRandomMoveFromUserParty < Battle::Move
end
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
@assistMoves = []
# NOTE: This includes the Pokémon of ally trainers in multi battles.
@battle.pbParty(user.index).each_with_index do |pkmn,i|
next if !pkmn || i==user.pokemonIndex
@battle.pbParty(user.index).each_with_index do |pkmn, i|
next if !pkmn || i == user.pokemonIndex
next if Settings::MECHANICS_GENERATION >= 6 && pkmn.egg?
pkmn.moves.each do |move|
next if @moveBlacklist.include?(move.function_code)
@@ -1104,7 +1104,7 @@ class Battle::Move::UseRandomMoveFromUserParty < Battle::Move
@assistMoves.push(move.id)
end
end
if @assistMoves.length==0
if @assistMoves.length == 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1124,7 +1124,7 @@ class Battle::Move::UseRandomUserMoveIfAsleep < Battle::Move
def usableWhenAsleep?; return true; end
def callsAnotherMove?; return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
"MultiTurnAttackPreventSleeping", # Uproar
@@ -1165,14 +1165,14 @@ class Battle::Move::UseRandomUserMoveIfAsleep < Battle::Move
]
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
@sleepTalkMoves = []
user.eachMoveWithIndex do |m,i|
user.eachMoveWithIndex do |m, i|
next if @moveBlacklist.include?(m.function)
next if !@battle.pbCanChooseMove?(user.index,i,false,true)
next if !@battle.pbCanChooseMove?(user.index, i, false, true)
@sleepTalkMoves.push(i)
end
if !user.asleep? || @sleepTalkMoves.length==0
if !user.asleep? || @sleepTalkMoves.length == 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1181,7 +1181,7 @@ class Battle::Move::UseRandomUserMoveIfAsleep < Battle::Move
def pbEffectGeneral(user)
choice = @sleepTalkMoves[@battle.pbRandom(@sleepTalkMoves.length)]
user.pbUseMoveSimple(user.moves[choice].id,user.pbDirectOpposing.index)
user.pbUseMoveSimple(user.moves[choice].id, user.pbDirectOpposing.index)
end
end
@@ -1192,7 +1192,7 @@ end
class Battle::Move::BounceBackProblemCausingStatusMoves < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::MagicCoat] = true
@battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",user.pbThis))
@battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!", user.pbThis))
end
end
@@ -1203,10 +1203,10 @@ class Battle::Move::StealAndUseBeneficialStatusMove < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::Snatch] = 1
@battle.allBattlers.each do |b|
next if b.effects[PBEffects::Snatch]<user.effects[PBEffects::Snatch]
user.effects[PBEffects::Snatch] = b.effects[PBEffects::Snatch]+1
next if b.effects[PBEffects::Snatch] < user.effects[PBEffects::Snatch]
user.effects[PBEffects::Snatch] = b.effects[PBEffects::Snatch] + 1
end
@battle.pbDisplay(_INTL("{1} waits for a target to make a move!",user.pbThis))
@battle.pbDisplay(_INTL("{1} waits for a target to make a move!", user.pbThis))
end
end
@@ -1217,7 +1217,7 @@ end
class Battle::Move::ReplaceMoveThisBattleWithTargetLastMoveUsed < Battle::Move
def ignoresSubstitute?(user); return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
"UseRandomMove", # Metronome
@@ -1230,7 +1230,7 @@ class Battle::Move::ReplaceMoveThisBattleWithTargetLastMoveUsed < Battle::Move
]
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Transform] || !user.pbHasMove?(@id)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -1250,12 +1250,12 @@ class Battle::Move::ReplaceMoveThisBattleWithTargetLastMoveUsed < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
user.eachMoveWithIndex do |m,i|
next if m.id!=@id
def pbEffectAgainstTarget(user, target)
user.eachMoveWithIndex do |m, i|
next if m.id != @id
newMove = Pokemon::Move.new(target.lastRegularMoveUsed)
user.moves[i] = Battle::Move.from_pokemon_move(@battle,newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
user.moves[i] = Battle::Move.from_pokemon_move(@battle, newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!", user.pbThis, newMove.name))
user.pbCheckFormOnMovesetChange
break
end
@@ -1268,7 +1268,7 @@ end
class Battle::Move::ReplaceMoveWithTargetLastMoveUsed < Battle::Move
def ignoresSubstitute?(user); return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
"ReplaceMoveWithTargetLastMoveUsed", # Sketch (this move)
@@ -1277,7 +1277,7 @@ class Battle::Move::ReplaceMoveWithTargetLastMoveUsed < Battle::Move
]
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Transform] || !user.pbHasMove?(@id)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -1297,13 +1297,13 @@ class Battle::Move::ReplaceMoveWithTargetLastMoveUsed < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
user.eachMoveWithIndex do |m,i|
next if m.id!=@id
def pbEffectAgainstTarget(user, target)
user.eachMoveWithIndex do |m, i|
next if m.id != @id
newMove = Pokemon::Move.new(target.lastRegularMoveUsed)
user.pokemon.moves[i] = newMove
user.moves[i] = Battle::Move.from_pokemon_move(@battle,newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
user.moves[i] = Battle::Move.from_pokemon_move(@battle, newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!", user.pbThis, newMove.name))
user.pbCheckFormOnMovesetChange
break
end

View File

@@ -2,7 +2,7 @@
# User flees from battle. (Teleport (Gen 7-))
#===============================================================================
class Battle::Move::FleeFromBattle < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !@battle.pbCanRun?(user.index)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -11,7 +11,7 @@ class Battle::Move::FleeFromBattle < Battle::Move
end
def pbEffectGeneral(user)
@battle.pbDisplay(_INTL("{1} fled from battle!",user.pbThis))
@battle.pbDisplay(_INTL("{1} fled from battle!", user.pbThis))
@battle.decision = 3 # Escaped
end
end
@@ -21,7 +21,7 @@ end
# (Teleport (Gen 8+))
#===============================================================================
class Battle::Move::SwitchOutUserStatusMove < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.wild?
if !@battle.pbCanRun?(user.index)
@battle.pbDisplay(_INTL("But it failed!"))
@@ -34,15 +34,15 @@ class Battle::Move::SwitchOutUserStatusMove < Battle::Move
return false
end
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
return if user.wild?
@battle.pbDisplay(_INTL("{1} went back to {2}!",user.pbThis,
@battle.pbDisplay(_INTL("{1} went back to {2}!", user.pbThis,
@battle.pbGetOwnerName(user.index)))
@battle.pbPursuit(user.index)
return if user.fainted?
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
return if newPkmn<0
@battle.pbRecallAndReplace(user.index,newPkmn)
return if newPkmn < 0
@battle.pbRecallAndReplace(user.index, newPkmn)
@battle.pbClearChoice(user.index) # Replacement Pokémon does nothing this round
@battle.moldBreaker = false
@battle.pbOnBattlerEnteringBattle(user.index)
@@ -51,7 +51,7 @@ class Battle::Move::SwitchOutUserStatusMove < Battle::Move
def pbEffectGeneral(user)
if user.wild?
@battle.pbDisplay(_INTL("{1} fled from battle!",user.pbThis))
@battle.pbDisplay(_INTL("{1} fled from battle!", user.pbThis))
@battle.decision = 3 # Escaped
end
end
@@ -62,21 +62,21 @@ end
# (U-turn, Volt Switch)
#===============================================================================
class Battle::Move::SwitchOutUserDamagingMove < Battle::Move
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
return if user.fainted? || numHits==0 || @battle.pbAllFainted?(user.idxOpposingSide)
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
return if user.fainted? || numHits == 0 || @battle.pbAllFainted?(user.idxOpposingSide)
targetSwitched = true
targets.each do |b|
targetSwitched = false if !switchedBattlers.include?(b.index)
end
return if targetSwitched
return if !@battle.pbCanChooseNonActive?(user.index)
@battle.pbDisplay(_INTL("{1} went back to {2}!",user.pbThis,
@battle.pbDisplay(_INTL("{1} went back to {2}!", user.pbThis,
@battle.pbGetOwnerName(user.index)))
@battle.pbPursuit(user.index)
return if user.fainted?
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
return if newPkmn<0
@battle.pbRecallAndReplace(user.index,newPkmn)
return if newPkmn < 0
@battle.pbRecallAndReplace(user.index, newPkmn)
@battle.pbClearChoice(user.index) # Replacement Pokémon does nothing this round
@battle.moldBreaker = false
@battle.pbOnBattlerEnteringBattle(user.index)
@@ -89,28 +89,28 @@ end
# switches out. Ignores trapping moves. (Parting Shot)
#===============================================================================
class Battle::Move::LowerTargetAtkSpAtk1SwitchOutUser < Battle::Move::TargetMultiStatDownMove
def initialize(battle,move)
def initialize(battle, move)
super
@statDown = [:ATTACK,1,:SPECIAL_ATTACK,1]
@statDown = [:ATTACK, 1, :SPECIAL_ATTACK, 1]
end
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
switcher = user
targets.each do |b|
next if switchedBattlers.include?(b.index)
switcher = b if b.effects[PBEffects::MagicCoat] || b.effects[PBEffects::MagicBounce]
end
return if switcher.fainted? || numHits==0
return if switcher.fainted? || numHits == 0
return if !@battle.pbCanChooseNonActive?(switcher.index)
@battle.pbDisplay(_INTL("{1} went back to {2}!",switcher.pbThis,
@battle.pbDisplay(_INTL("{1} went back to {2}!", switcher.pbThis,
@battle.pbGetOwnerName(switcher.index)))
@battle.pbPursuit(switcher.index)
return if switcher.fainted?
newPkmn = @battle.pbGetReplacementPokemonIndex(switcher.index) # Owner chooses
return if newPkmn<0
@battle.pbRecallAndReplace(switcher.index,newPkmn)
return if newPkmn < 0
@battle.pbRecallAndReplace(switcher.index, newPkmn)
@battle.pbClearChoice(switcher.index) # Replacement Pokémon does nothing this round
@battle.moldBreaker = false if switcher.index==user.index
@battle.moldBreaker = false if switcher.index == user.index
@battle.pbOnBattlerEnteringBattle(switcher.index)
switchedBattlers.push(switcher.index)
end
@@ -121,7 +121,7 @@ end
# replacement. (Baton Pass)
#===============================================================================
class Battle::Move::SwitchOutUserPassOnEffects < Battle::Move
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !@battle.pbCanChooseNonActive?(user.index)
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -129,13 +129,13 @@ class Battle::Move::SwitchOutUserPassOnEffects < Battle::Move
return false
end
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
return if user.fainted? || numHits==0
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)
return if user.fainted? || numHits == 0
return if !@battle.pbCanChooseNonActive?(user.index)
@battle.pbPursuit(user.index)
return if user.fainted?
newPkmn = @battle.pbGetReplacementPokemonIndex(user.index) # Owner chooses
return if newPkmn<0
return if newPkmn < 0
@battle.pbRecallAndReplace(user.index, newPkmn, false, true)
@battle.pbClearChoice(user.index) # Replacement Pokémon does nothing this round
@battle.moldBreaker = false
@@ -175,14 +175,14 @@ class Battle::Move::SwitchOutTargetStatusMove < Battle::Move
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if @battle.wildBattle? && target.level>user.level
if @battle.wildBattle? && target.level > user.level
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
if @battle.trainerBattle?
canSwitch = false
@battle.eachInTeamFromBattlerIndex(target.index) do |_pkmn,i|
next if !@battle.pbCanSwitchLax?(target.index,i)
@battle.eachInTeamFromBattlerIndex(target.index) do |_pkmn, i|
next if !@battle.pbCanSwitchLax?(target.index, i)
canSwitch = true
break
end
@@ -205,10 +205,10 @@ class Battle::Move::SwitchOutTargetStatusMove < Battle::Move
next if b.fainted? || b.damageState.unaffected
next if b.effects[PBEffects::Ingrain]
next if b.hasActiveAbility?(:SUCTIONCUPS) && !@battle.moldBreaker
newPkmn = @battle.pbGetReplacementPokemonIndex(b.index,true) # Random
next if newPkmn<0
newPkmn = @battle.pbGetReplacementPokemonIndex(b.index, true) # Random
next if newPkmn < 0
@battle.pbRecallAndReplace(b.index, newPkmn, true)
@battle.pbDisplay(_INTL("{1} was dragged out!",b.pbThis))
@battle.pbDisplay(_INTL("{1} was dragged out!", b.pbThis))
@battle.pbClearChoice(b.index) # Replacement Pokémon does nothing this round
@battle.pbOnBattlerEnteringBattle(b.index)
switched_battlers.push(b.index)
@@ -224,9 +224,9 @@ end
# For damaging moves. (Circle Throw, Dragon Tail)
#===============================================================================
class Battle::Move::SwitchOutTargetDamagingMove < Battle::Move
def pbEffectAgainstTarget(user,target)
if @battle.wildBattle? && target.level<=user.level && @battle.canRun &&
(target.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(user))
def pbEffectAgainstTarget(user, target)
if @battle.wildBattle? && target.level <= user.level && @battle.canRun &&
(target.effects[PBEffects::Substitute] == 0 || ignoresSubstitute?(user))
@battle.decision = 3
end
end
@@ -238,10 +238,10 @@ class Battle::Move::SwitchOutTargetDamagingMove < Battle::Move
next if b.fainted? || b.damageState.unaffected || b.damageState.substitute
next if b.effects[PBEffects::Ingrain]
next if b.hasActiveAbility?(:SUCTIONCUPS) && !@battle.moldBreaker
newPkmn = @battle.pbGetReplacementPokemonIndex(b.index,true) # Random
next if newPkmn<0
newPkmn = @battle.pbGetReplacementPokemonIndex(b.index, true) # Random
next if newPkmn < 0
@battle.pbRecallAndReplace(b.index, newPkmn, true)
@battle.pbDisplay(_INTL("{1} was dragged out!",b.pbThis))
@battle.pbDisplay(_INTL("{1} was dragged out!", b.pbThis))
@battle.pbClearChoice(b.index) # Replacement Pokémon does nothing this round
@battle.pbOnBattlerEnteringBattle(b.index)
switched_battlers.push(b.index)
@@ -255,36 +255,36 @@ end
# at end of each round.
#===============================================================================
class Battle::Move::BindTarget < Battle::Move
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if target.fainted? || target.damageState.substitute
return if target.effects[PBEffects::Trapping]>0
return if target.effects[PBEffects::Trapping] > 0
# Set trapping effect duration and info
if user.hasActiveItem?(:GRIPCLAW)
target.effects[PBEffects::Trapping] = (Settings::MECHANICS_GENERATION >= 5) ? 8 : 6
else
target.effects[PBEffects::Trapping] = 5+@battle.pbRandom(2)
target.effects[PBEffects::Trapping] = 5 + @battle.pbRandom(2)
end
target.effects[PBEffects::TrappingMove] = @id
target.effects[PBEffects::TrappingUser] = user.index
# Message
msg = _INTL("{1} was trapped in the vortex!",target.pbThis)
msg = _INTL("{1} was trapped in the vortex!", target.pbThis)
case @id
when :BIND
msg = _INTL("{1} was squeezed by {2}!",target.pbThis,user.pbThis(true))
msg = _INTL("{1} was squeezed by {2}!", target.pbThis, user.pbThis(true))
when :CLAMP
msg = _INTL("{1} clamped {2}!",user.pbThis,target.pbThis(true))
msg = _INTL("{1} clamped {2}!", user.pbThis, target.pbThis(true))
when :FIRESPIN
msg = _INTL("{1} was trapped in the fiery vortex!",target.pbThis)
msg = _INTL("{1} was trapped in the fiery vortex!", target.pbThis)
when :INFESTATION
msg = _INTL("{1} has been afflicted with an infestation by {2}!",target.pbThis,user.pbThis(true))
msg = _INTL("{1} has been afflicted with an infestation by {2}!", target.pbThis, user.pbThis(true))
when :MAGMASTORM
msg = _INTL("{1} became trapped by Magma Storm!",target.pbThis)
msg = _INTL("{1} became trapped by Magma Storm!", target.pbThis)
when :SANDTOMB
msg = _INTL("{1} became trapped by Sand Tomb!",target.pbThis)
msg = _INTL("{1} became trapped by Sand Tomb!", target.pbThis)
when :WHIRLPOOL
msg = _INTL("{1} became trapped in the vortex!",target.pbThis)
msg = _INTL("{1} became trapped in the vortex!", target.pbThis)
when :WRAP
msg = _INTL("{1} was wrapped by {2}!",target.pbThis,user.pbThis(true))
msg = _INTL("{1} was wrapped by {2}!", target.pbThis, user.pbThis(true))
end
@battle.pbDisplay(msg)
end
@@ -298,7 +298,7 @@ end
class Battle::Move::BindTargetDoublePowerIfTargetUnderwater < Battle::Move::BindTarget
def hitsDivingTargets?; return true; end
def pbModifyDamage(damageMult,user,target)
def pbModifyDamage(damageMult, user, target)
damageMult *= 2 if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater")
return damageMult
end
@@ -313,7 +313,7 @@ class Battle::Move::TrapTargetInBattle < Battle::Move
def pbFailsAgainstTarget?(user, target, show_message)
return false if damagingMove?
if target.effects[PBEffects::MeanLook]>=0
if target.effects[PBEffects::MeanLook] >= 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -324,18 +324,18 @@ class Battle::Move::TrapTargetInBattle < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
return if damagingMove?
target.effects[PBEffects::MeanLook] = user.index
@battle.pbDisplay(_INTL("{1} can no longer escape!",target.pbThis))
@battle.pbDisplay(_INTL("{1} can no longer escape!", target.pbThis))
end
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.fainted? || target.damageState.substitute
return if target.effects[PBEffects::MeanLook]>=0
return if target.effects[PBEffects::MeanLook] >= 0
return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
target.effects[PBEffects::MeanLook] = user.index
@battle.pbDisplay(_INTL("{1} can no longer escape!",target.pbThis))
@battle.pbDisplay(_INTL("{1} can no longer escape!", target.pbThis))
end
end
@@ -383,8 +383,8 @@ end
# No Pokémon can switch out or flee until the end of the next round. (Fairy Lock)
#===============================================================================
class Battle::Move::TrapAllBattlersInBattleForOneTurn < Battle::Move
def pbMoveFailed?(user,targets)
if @battle.field.effects[PBEffects::FairyLock]>0
def pbMoveFailed?(user, targets)
if @battle.field.effects[PBEffects::FairyLock] > 0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -403,12 +403,12 @@ end
# (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
#===============================================================================
class Battle::Move::PursueSwitchingFoe < Battle::Move
def pbAccuracyCheck(user,target)
def pbAccuracyCheck(user, target)
return true if @battle.switching
return super
end
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
baseDmg *= 2 if @battle.switching
return baseDmg
end
@@ -421,21 +421,21 @@ end
class Battle::Move::UsedAfterUserTakesPhysicalDamage < Battle::Move
def pbDisplayChargeMessage(user)
user.effects[PBEffects::ShellTrap] = true
@battle.pbCommonAnimation("ShellTrap",user)
@battle.pbDisplay(_INTL("{1} set a shell trap!",user.pbThis))
@battle.pbCommonAnimation("ShellTrap", user)
@battle.pbDisplay(_INTL("{1} set a shell trap!", user.pbThis))
end
def pbDisplayUseMessage(user)
super if user.tookPhysicalHit
end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if !user.effects[PBEffects::ShellTrap]
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
if !user.tookPhysicalHit
@battle.pbDisplay(_INTL("{1}'s shell trap didn't work!",user.pbThis))
@battle.pbDisplay(_INTL("{1}'s shell trap didn't work!", user.pbThis))
return true
end
return false
@@ -447,7 +447,7 @@ end
# If an ally is about to use the same move, make it go next, ignoring priority.
#===============================================================================
class Battle::Move::UsedAfterAllyRoundWithDoublePower < Battle::Move
def pbBaseDamage(baseDmg,user,target)
def pbBaseDamage(baseDmg, user, target)
baseDmg *= 2 if user.pbOwnSide.effects[PBEffects::Round]
return baseDmg
end
@@ -455,8 +455,8 @@ class Battle::Move::UsedAfterAllyRoundWithDoublePower < Battle::Move
def pbEffectGeneral(user)
user.pbOwnSide.effects[PBEffects::Round] = true
user.allAllies.each do |b|
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
next if @battle.choices[b.index][2].function!=@function
next if @battle.choices[b.index][0] != :UseMove || b.movedThisRound?
next if @battle.choices[b.index][2].function != @function
b.effects[PBEffects::MoveNext] = true
b.effects[PBEffects::Quash] = 0
break
@@ -487,10 +487,10 @@ class Battle::Move::TargetActsNext < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::MoveNext] = true
target.effects[PBEffects::Quash] = 0
@battle.pbDisplay(_INTL("{1} took the kind offer!",target.pbThis))
@battle.pbDisplay(_INTL("{1} took the kind offer!", target.pbThis))
end
end
@@ -509,30 +509,30 @@ class Battle::Move::TargetActsLast < Battle::Move
# Target is already maximally Quashed and will move last anyway
highestQuash = 0
@battle.allBattlers.each do |b|
next if b.effects[PBEffects::Quash]<=highestQuash
next if b.effects[PBEffects::Quash] <= highestQuash
highestQuash = b.effects[PBEffects::Quash]
end
if highestQuash>0 && target.effects[PBEffects::Quash]==highestQuash
if highestQuash > 0 && target.effects[PBEffects::Quash] == highestQuash
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
# Target was already going to move last
if highestQuash==0 && @battle.pbPriority.last.index==target.index
if highestQuash == 0 && @battle.pbPriority.last.index == target.index
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
highestQuash = 0
@battle.allBattlers.each do |b|
next if b.effects[PBEffects::Quash]<=highestQuash
next if b.effects[PBEffects::Quash] <= highestQuash
highestQuash = b.effects[PBEffects::Quash]
end
target.effects[PBEffects::Quash] = highestQuash+1
target.effects[PBEffects::Quash] = highestQuash + 1
target.effects[PBEffects::MoveNext] = false
@battle.pbDisplay(_INTL("{1}'s move was postponed!",target.pbThis))
@battle.pbDisplay(_INTL("{1}'s move was postponed!", target.pbThis))
end
end
@@ -542,7 +542,7 @@ end
class Battle::Move::TargetUsesItsLastUsedMoveAgain < Battle::Move
def ignoresSubstitute?(user); return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
"MultiTurnAttackBideThenReturnDoubleDamage", # Bide
@@ -596,9 +596,9 @@ class Battle::Move::TargetUsesItsLastUsedMoveAgain < Battle::Move
return true
end
targetMove = @battle.choices[target.index][2]
if targetMove && (targetMove.function=="FailsIfUserDamagedThisTurn" || # Focus Punch
targetMove.function=="UsedAfterUserTakesPhysicalDamage" || # Shell Trap
targetMove.function=="BurnAttackerBeforeUserActs") # Beak Blast
if targetMove && (targetMove.function == "FailsIfUserDamagedThisTurn" || # Focus Punch
targetMove.function == "UsedAfterUserTakesPhysicalDamage" || # Shell Trap
targetMove.function == "BurnAttackerBeforeUserActs") # Beak Blast
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -607,17 +607,17 @@ class Battle::Move::TargetUsesItsLastUsedMoveAgain < Battle::Move
return true
end
idxMove = -1
target.eachMoveWithIndex do |m,i|
idxMove = i if m.id==target.lastRegularMoveUsed
target.eachMoveWithIndex do |m, i|
idxMove = i if m.id == target.lastRegularMoveUsed
end
if target.moves[idxMove].pp==0 && target.moves[idxMove].total_pp>0
if target.moves[idxMove].pp == 0 && target.moves[idxMove].total_pp > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Instruct] = true
end
end
@@ -628,17 +628,17 @@ end
#===============================================================================
class Battle::Move::StartSlowerBattlersActFirst < Battle::Move
def pbEffectGeneral(user)
if @battle.field.effects[PBEffects::TrickRoom]>0
if @battle.field.effects[PBEffects::TrickRoom] > 0
@battle.field.effects[PBEffects::TrickRoom] = 0
@battle.pbDisplay(_INTL("{1} reverted the dimensions!",user.pbThis))
@battle.pbDisplay(_INTL("{1} reverted the dimensions!", user.pbThis))
else
@battle.field.effects[PBEffects::TrickRoom] = 5
@battle.pbDisplay(_INTL("{1} twisted the dimensions!",user.pbThis))
@battle.pbDisplay(_INTL("{1} twisted the dimensions!", user.pbThis))
end
end
def pbShowAnimation(id,user,targets,hitNum = 0,showAnimation = true)
return if @battle.field.effects[PBEffects::TrickRoom]>0 # No animation
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
return if @battle.field.effects[PBEffects::TrickRoom] > 0 # No animation
super
end
end
@@ -710,15 +710,15 @@ class Battle::Move::DisableTargetLastMoveUsed < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Disable]>0 || !target.lastRegularMoveUsed
if target.effects[PBEffects::Disable] > 0 || !target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
return true if pbMoveFailedAromaVeil?(user, target, show_message)
canDisable = false
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed
next if m.pp==0 && m.total_pp>0
next if m.id != target.lastRegularMoveUsed
next if m.pp == 0 && m.total_pp > 0
canDisable = true
break
end
@@ -729,10 +729,10 @@ class Battle::Move::DisableTargetLastMoveUsed < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Disable] = 5
target.effects[PBEffects::DisableMove] = target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!",target.pbThis,
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!", target.pbThis,
GameData::Move.get(target.lastRegularMoveUsed).name))
target.pbItemStatusCureCheck
end
@@ -754,9 +754,9 @@ class Battle::Move::DisableTargetUsingSameMoveConsecutively < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Torment] = true
@battle.pbDisplay(_INTL("{1} was subjected to torment!",target.pbThis))
@battle.pbDisplay(_INTL("{1} was subjected to torment!", target.pbThis))
target.pbItemStatusCureCheck
end
end
@@ -768,7 +768,7 @@ class Battle::Move::DisableTargetUsingDifferentMove < Battle::Move
def ignoresSubstitute?(user); return true; end
def canMagicCoat?; return true; end
def initialize(battle,move)
def initialize(battle, move)
super
@moveBlacklist = [
"DisableTargetUsingDifferentMove", # Encore
@@ -796,7 +796,7 @@ class Battle::Move::DisableTargetUsingDifferentMove < Battle::Move
end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Encore]>0
if target.effects[PBEffects::Encore] > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -812,8 +812,8 @@ class Battle::Move::DisableTargetUsingDifferentMove < Battle::Move
return true if pbMoveFailedAromaVeil?(user, target, show_message)
canEncore = false
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed
next if m.pp==0 && m.total_pp>0
next if m.id != target.lastRegularMoveUsed
next if m.pp == 0 && m.total_pp > 0
canEncore = true
break
end
@@ -824,10 +824,10 @@ class Battle::Move::DisableTargetUsingDifferentMove < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Encore] = 4
target.effects[PBEffects::EncoreMove] = target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("{1} received an encore!",target.pbThis))
@battle.pbDisplay(_INTL("{1} received an encore!", target.pbThis))
target.pbItemStatusCureCheck
end
end
@@ -840,7 +840,7 @@ class Battle::Move::DisableTargetStatusMoves < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::Taunt]>0
if target.effects[PBEffects::Taunt] > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -862,9 +862,9 @@ class Battle::Move::DisableTargetStatusMoves < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::Taunt] = 4
@battle.pbDisplay(_INTL("{1} fell for the taunt!",target.pbThis))
@battle.pbDisplay(_INTL("{1} fell for the taunt!", target.pbThis))
target.pbItemStatusCureCheck
end
end
@@ -876,7 +876,7 @@ class Battle::Move::DisableTargetHealingMoves < Battle::Move
def canMagicCoat?; return true; end
def pbFailsAgainstTarget?(user, target, show_message)
if target.effects[PBEffects::HealBlock]>0
if target.effects[PBEffects::HealBlock] > 0
@battle.pbDisplay(_INTL("But it failed!")) if show_message
return true
end
@@ -884,9 +884,9 @@ class Battle::Move::DisableTargetHealingMoves < Battle::Move
return false
end
def pbEffectAgainstTarget(user,target)
def pbEffectAgainstTarget(user, target)
target.effects[PBEffects::HealBlock] = 5
@battle.pbDisplay(_INTL("{1} was prevented from healing!",target.pbThis))
@battle.pbDisplay(_INTL("{1} was prevented from healing!", target.pbThis))
target.pbItemStatusCureCheck
end
end
@@ -895,10 +895,10 @@ end
# Target cannot use sound-based moves for 2 more rounds. (Throat Chop)
#===============================================================================
class Battle::Move::DisableTargetSoundMoves < Battle::Move
def pbAdditionalEffect(user,target)
def pbAdditionalEffect(user, target)
return if target.fainted? || target.damageState.substitute
@battle.pbDisplay(_INTL("The effects of {1} prevent {2} from using certain moves!",
@name,target.pbThis(true))) if target.effects[PBEffects::ThroatChop]==0
@name, target.pbThis(true))) if target.effects[PBEffects::ThroatChop] == 0
target.effects[PBEffects::ThroatChop] = 3
end
end
@@ -909,7 +909,7 @@ end
class Battle::Move::DisableTargetMovesKnownByUser < Battle::Move
def canSnatch?; return true; end
def pbMoveFailed?(user,targets)
def pbMoveFailed?(user, targets)
if user.effects[PBEffects::Imprison]
@battle.pbDisplay(_INTL("But it failed!"))
return true
@@ -919,6 +919,6 @@ class Battle::Move::DisableTargetMovesKnownByUser < Battle::Move
def pbEffectGeneral(user)
user.effects[PBEffects::Imprison] = true
@battle.pbDisplay(_INTL("{1} sealed any moves its target shares with it!",user.pbThis))
@battle.pbDisplay(_INTL("{1} sealed any moves its target shares with it!", user.pbThis))
end
end