More Rubocop

This commit is contained in:
Maruno17
2021-12-27 00:26:45 +00:00
parent 4a6324389b
commit aa643a6049
51 changed files with 346 additions and 323 deletions

View File

@@ -60,10 +60,13 @@ class Battle
end
sideCounts.each_with_index do |_count, i|
if !requireds[i] || requireds[i] == 0
raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
i + 1, @sideSizes[0], @sideSizes[1]) if side == 0
raise _INTL("Opposing trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
i + 1, @sideSizes[0], @sideSizes[1]) if side == 1
if side == 0
raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
i + 1, @sideSizes[0], @sideSizes[1])
elsif side == 1
raise _INTL("Opposing trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
i + 1, @sideSizes[0], @sideSizes[1])
end
end
next if requireds[i] <= sideCounts[i] # Trainer has enough Pokémon to fill their positions
if requireds[i] == 1

View File

@@ -9,8 +9,10 @@ class Battle
end
# Embargo
if battler && battler.effects[PBEffects::Embargo] > 0
scene.pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!",
battler.pbThis(true))) if showMessages
if showMessages
scene.pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!",
battler.pbThis(true)))
end
return false
end
return true

View File

@@ -61,8 +61,9 @@ class Battle::Battler
case @battle.field.terrain
when :Electric
if newStatus == :SLEEP
@battle.pbDisplay(_INTL("{1} surrounds itself with electrified terrain!",
pbThis(true))) if showMessages
if showMessages
@battle.pbDisplay(_INTL("{1} surrounds itself with electrified terrain!", pbThis(true)))
end
return false
end
when :Misty

View File

@@ -14,8 +14,10 @@ class Battle::Battler
end
# Check the stat stage
if statStageAtMax?(stat)
@battle.pbDisplay(_INTL("{1}'s {2} won't go any higher!",
pbThis, GameData::Stat.get(stat).name)) if showFailMsg
if showFailMsg
@battle.pbDisplay(_INTL("{1}'s {2} won't go any higher!",
pbThis, GameData::Stat.get(stat).name))
end
return false
end
return true
@@ -162,8 +164,10 @@ class Battle::Battler
end
# Check the stat stage
if statStageAtMin?(stat)
@battle.pbDisplay(_INTL("{1}'s {2} won't go any lower!",
pbThis, GameData::Stat.get(stat).name)) if showFailMsg
if showFailMsg
@battle.pbDisplay(_INTL("{1}'s {2} won't go any lower!",
pbThis, GameData::Stat.get(stat).name))
end
return false
end
return true

View File

@@ -468,7 +468,7 @@ class Battle::Battler
@battle.pbHideAbilitySplash(b) if b.damageState.magicBounce
newChoice = choice.clone
newChoice[3] = user.index
newTargets = pbFindTargets(newChoice ,move, b)
newTargets = pbFindTargets(newChoice, move, b)
newTargets = pbChangeTargets(move, b, newTargets)
success = false
if !move.pbMoveFailed?(b, newTargets)

View File

@@ -1358,8 +1358,9 @@ class Battle::Move::StartGravity < Battle::Move
b.effects[PBEffects::SkyDrop] = -1
showMessage = true
end
@battle.pbDisplay(_INTL("{1} couldn't stay airborne because of gravity!",
b.pbThis)) if showMessage
if showMessage
@battle.pbDisplay(_INTL("{1} couldn't stay airborne because of gravity!", b.pbThis))
end
end
end
end

View File

@@ -607,9 +607,11 @@ class Battle::Move::HealUserDependingOnUserStockpile < Battle::Move
@battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!", user.pbThis))
showAnim = true
if user.effects[PBEffects::StockpileDef] > 0 &&
user.pbCanLowerStatStage?(:DEFENSE, user, self) && user.pbLowerStatStage(:DEFENSE, user.effects[PBEffects::StockpileDef], user, showAnim)
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)

View File

@@ -255,8 +255,10 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
else
s = GameData::Status.get(@battler.status).icon_position
end
imagePos.push(["Graphics/Pictures/Battle/icon_statuses", @spriteBaseX + 24, 36,
0, s * STATUS_ICON_HEIGHT, -1, STATUS_ICON_HEIGHT]) if s >= 0
if s >= 0
imagePos.push(["Graphics/Pictures/Battle/icon_statuses", @spriteBaseX + 24, 36,
0, s * STATUS_ICON_HEIGHT, -1, STATUS_ICON_HEIGHT])
end
end
pbDrawImagePositions(self.bitmap, imagePos)
refreshHP

View File

@@ -17,7 +17,7 @@ class Battle::Scene::Animation
def empty?; return @pictureEx.length == 0; end
def animDone?; return @animDone; end
def addSprite(s, origin = PictureOrigin::TopLeft)
def addSprite(s, origin = PictureOrigin::TOP_LEFT)
num = @pictureEx.length
picture = PictureEx.new(s.z)
picture.x = s.x
@@ -31,7 +31,7 @@ class Battle::Scene::Animation
return picture
end
def addNewSprite(x, y, name, origin = PictureOrigin::TopLeft)
def addNewSprite(x, y, name, origin = PictureOrigin::TOP_LEFT)
num = @pictureEx.length
picture = PictureEx.new(num)
picture.setXY(0, x, y)
@@ -87,7 +87,7 @@ module Battle::Scene::Animation::BallAnimationMixin
def addBallSprite(ballX, ballY, poke_ball)
file_path = sprintf("Graphics/Battle animations/ball_%s", poke_ball)
ball = addNewSprite(ballX, ballY, file_path, PictureOrigin::Center)
ball = addNewSprite(ballX, ballY, file_path, PictureOrigin::CENTER)
@ballSprite = @pictureSprites.last
if @ballSprite.bitmap.width >= @ballSprite.bitmap.height
@ballSprite.src_rect.width = @ballSprite.bitmap.height / 2

View File

@@ -15,26 +15,26 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
makeSlideSprite("battle_bg2", 0.5, appearTime)
end
# Bases
makeSlideSprite("base_0", 1, appearTime, PictureOrigin::Bottom)
makeSlideSprite("base_1", -1, appearTime, PictureOrigin::Center)
makeSlideSprite("base_0", 1, appearTime, PictureOrigin::BOTTOM)
makeSlideSprite("base_1", -1, appearTime, PictureOrigin::CENTER)
# Player sprite, partner trainer sprite
@battle.player.each_with_index do |_p, i|
makeSlideSprite("player_#{i + 1}", 1, appearTime, PictureOrigin::Bottom)
makeSlideSprite("player_#{i + 1}", 1, appearTime, PictureOrigin::BOTTOM)
end
# Opposing trainer sprite(s) or wild Pokémon sprite(s)
if @battle.trainerBattle?
@battle.opponent.each_with_index do |_p, i|
makeSlideSprite("trainer_#{i + 1}", -1, appearTime, PictureOrigin::Bottom)
makeSlideSprite("trainer_#{i + 1}", -1, appearTime, PictureOrigin::BOTTOM)
end
else # Wild battle
@battle.pbParty(1).each_with_index do |_pkmn, i|
idxBattler = (2 * i) + 1
makeSlideSprite("pokemon_#{idxBattler}", -1, appearTime, PictureOrigin::Bottom)
makeSlideSprite("pokemon_#{idxBattler}", -1, appearTime, PictureOrigin::BOTTOM)
end
end
# Shadows
@battle.battlers.length.times do |i|
makeSlideSprite("shadow_#{i}", (i.even?) ? 1 : -1, appearTime, PictureOrigin::Center)
makeSlideSprite("shadow_#{i}", (i.even?) ? 1 : -1, appearTime, PictureOrigin::CENTER)
end
# Fading blackness over whole screen
blackScreen = addNewSprite(0, 0, "Graphics/Battle animations/black_screen")
@@ -73,7 +73,7 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation
@sideSize.times do |i|
idxBattler = (2 * i) + 1
next if !@sprites["pokemon_#{idxBattler}"]
battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::Bottom)
battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::BOTTOM)
battler.moveTone(0, 4, Tone.new(0, 0, 0, 0))
battler.setCallback(10 * i, [@sprites["pokemon_#{idxBattler}"], :pbPlayIntroAnimation])
end
@@ -279,7 +279,7 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation
delay = 0
# Make old trainer sprite move off-screen first if necessary
if @idxTrainer > 0 && @sprites["trainer_#{@idxTrainer}"].visible
oldTrainer = addSprite(@sprites["trainer_#{@idxTrainer}"], PictureOrigin::Bottom)
oldTrainer = addSprite(@sprites["trainer_#{@idxTrainer}"], PictureOrigin::BOTTOM)
oldTrainer.moveDelta(delay, 8, Graphics.width / 4, 0)
oldTrainer.setVisible(delay + 8, false)
delay = oldTrainer.totalDuration
@@ -288,7 +288,7 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation
if @sprites["trainer_#{@idxTrainer + 1}"]
trainerX, trainerY = Battle::Scene.pbTrainerPosition(1)
trainerX += 64 + (Graphics.width / 4)
newTrainer = addSprite(@sprites["trainer_#{@idxTrainer + 1}"], PictureOrigin::Bottom)
newTrainer = addSprite(@sprites["trainer_#{@idxTrainer + 1}"], PictureOrigin::BOTTOM)
newTrainer.setVisible(delay, true)
newTrainer.setXY(delay, trainerX, trainerY)
newTrainer.moveDelta(delay, 8, -Graphics.width / 4, 0)
@@ -318,7 +318,7 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
pl = @sprites[spriteNameBase + "_#{i}"]
i += 1
next if !pl.visible || pl.x < 0
trainer = addSprite(pl, PictureOrigin::Bottom)
trainer = addSprite(pl, PictureOrigin::BOTTOM)
trainer.moveDelta(0, 16, -Graphics.width / 2, 0)
# Animate trainer sprite(s) if they have multiple frames
if pl.bitmap && !pl.bitmap.disposed? && pl.bitmap.width >= pl.bitmap.height * 2
@@ -371,7 +371,7 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
trSprite = @sprites[spriteNameBase + "_#{i}"]
i += 1
next if !trSprite.visible || trSprite.x > Graphics.width
trainer = addSprite(trSprite, PictureOrigin::Bottom)
trainer = addSprite(trSprite, PictureOrigin::BOTTOM)
trainer.moveDelta(0, 16, Graphics.width / 2, 0)
trainer.setVisible(16, false)
end
@@ -456,7 +456,7 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
ballBurst(delay, battlerStartX, battlerStartY - 18, poke_ball)
ball.moveOpacity(delay + 2, 2, 0)
# Set up battler sprite
battler = addSprite(batSprite, PictureOrigin::Bottom)
battler = addSprite(batSprite, PictureOrigin::BOTTOM)
battler.setXY(0, battlerStartX, battlerStartY)
battler.setZoom(0, 0)
battler.setColor(0, col)
@@ -464,7 +464,7 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
battlerAppear(battler, delay, battlerEndX, battlerEndY, batSprite, col)
if @shadowVisible
# Set up shadow sprite
shadow = addSprite(shaSprite, PictureOrigin::Center)
shadow = addSprite(shaSprite, PictureOrigin::CENTER)
shadow.setOpacity(0, 0)
# Shadow animation
shadow.setVisible(delay, @shadowVisible)
@@ -520,7 +520,7 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio
ballBurst(delay, battlerStartX, battlerStartY - 18, poke_ball)
ball.moveOpacity(delay + 2, 2, 0)
# Set up battler sprite
battler = addSprite(batSprite, PictureOrigin::Bottom)
battler = addSprite(batSprite, PictureOrigin::BOTTOM)
battler.setXY(0, battlerStartX, battlerStartY)
battler.setZoom(0, 0)
battler.setColor(0, col)
@@ -528,7 +528,7 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio
battlerAppear(battler, delay, battlerEndX, battlerEndY, batSprite, col)
if @shadowVisible
# Set up shadow sprite
shadow = addSprite(shaSprite, PictureOrigin::Center)
shadow = addSprite(shaSprite, PictureOrigin::CENTER)
shadow.setOpacity(0, 0)
# Shadow animation
shadow.setVisible(delay, @shadowVisible)
@@ -570,7 +570,7 @@ class Battle::Scene::Animation::BattlerRecall < Battle::Scene::Animation
battlerEndX = ballPos[0]
battlerEndY = ballPos[1]
# Set up battler sprite
battler = addSprite(batSprite, PictureOrigin::Bottom)
battler = addSprite(batSprite, PictureOrigin::BOTTOM)
battler.setVisible(0, true)
battler.setColor(0, col)
# Set up Poké Ball sprite
@@ -585,7 +585,7 @@ class Battle::Scene::Animation::BattlerRecall < Battle::Scene::Animation
battlerAbsorb(battler, delay, battlerEndX, battlerEndY, col)
if shaSprite.visible
# Set up shadow sprite
shadow = addSprite(shaSprite, PictureOrigin::Center)
shadow = addSprite(shaSprite, PictureOrigin::CENTER)
# Shadow animation
shadow.moveOpacity(0, 10, 0)
shadow.setVisible(delay, false)
@@ -609,8 +609,8 @@ class Battle::Scene::Animation::BattlerDamage < Battle::Scene::Animation
batSprite = @sprites["pokemon_#{@idxBattler}"]
shaSprite = @sprites["shadow_#{@idxBattler}"]
# Set up battler/shadow sprite
battler = addSprite(batSprite, PictureOrigin::Bottom)
shadow = addSprite(shaSprite, PictureOrigin::Center)
battler = addSprite(batSprite, PictureOrigin::BOTTOM)
shadow = addSprite(shaSprite, PictureOrigin::CENTER)
# Animation
delay = 0
case @effectiveness
@@ -647,8 +647,8 @@ class Battle::Scene::Animation::BattlerFaint < Battle::Scene::Animation
batSprite = @sprites["pokemon_#{@idxBattler}"]
shaSprite = @sprites["shadow_#{@idxBattler}"]
# Set up battler/shadow sprite
battler = addSprite(batSprite, PictureOrigin::Bottom)
shadow = addSprite(shaSprite, PictureOrigin::Center)
battler = addSprite(batSprite, PictureOrigin::BOTTOM)
shadow = addSprite(shaSprite, PictureOrigin::CENTER)
# Get approx duration depending on sprite's position/size. Min 20 frames.
battlerTop = batSprite.y - batSprite.height
cropY = Battle::Scene.pbBattlerPosition(@idxBattler, @battle.pbSideSize(@idxBattler))[1]
@@ -723,7 +723,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
@ballSpriteIndex = (@success) ? @tempSprites.length - 1 : -1
# Set up trainer sprite (only visible in Safari Zone battles)
if @showingTrainer && traSprite && traSprite.bitmap.width >= traSprite.bitmap.height * 2
trainer = addSprite(traSprite, PictureOrigin::Bottom)
trainer = addSprite(traSprite, PictureOrigin::BOTTOM)
# Trainer animation
ballStartX, ballStartY = trainerThrowingFrames(ball, trainer, traSprite)
end
@@ -738,7 +738,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
delay = ball.totalDuration + 6
ballOpenUp(ball, delay, @poke_ball, true, false)
# Set up battler sprite
battler = addSprite(batSprite, PictureOrigin::Bottom)
battler = addSprite(batSprite, PictureOrigin::BOTTOM)
# Poké Ball absorbs battler
delay = ball.totalDuration
ballBurstCapture(delay, ballEndX, ballEndY, @poke_ball)
@@ -751,7 +751,7 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
battler.setVisible(delay + 5, false)
if @shadowVisible
# Set up shadow sprite
shadow = addSprite(shaSprite, PictureOrigin::Center)
shadow = addSprite(shaSprite, PictureOrigin::CENTER)
# Shadow animation
shadow.moveOpacity(delay, 5, 0)
shadow.moveZoom(delay, 5, 0)

View File

@@ -391,20 +391,22 @@ class Battle::AI
)
end
end
if skill >= PBTrainerAI.bestSkill && target.itemActive? && (target.item && !target.item.is_berry?)
Battle::ItemEffects.triggerDamageCalcFromTarget(
target.item, user, target, move, multipliers, baseDmg, type
)
end
if skill >= PBTrainerAI.bestSkill &&
target.itemActive? && target.item && !target.item.is_berry?
Battle::ItemEffects.triggerDamageCalcFromTarget(
target.item, user, target, move, multipliers, baseDmg, type
)
end
# Global abilities
if skill >= PBTrainerAI.mediumSkill && ((@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY))
if @battle.pbCheckGlobalAbility(:AURABREAK)
multipliers[:base_damage_multiplier] *= 2 / 3.0
else
multipliers[:base_damage_multiplier] *= 4 / 3.0
end
if skill >= PBTrainerAI.mediumSkill &&
((@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY))
if @battle.pbCheckGlobalAbility(:AURABREAK)
multipliers[:base_damage_multiplier] *= 2 / 3.0
else
multipliers[:base_damage_multiplier] *= 4 / 3.0
end
end
# Parental Bond
if skill >= PBTrainerAI.mediumSkill && user.hasActiveAbility?(:PARENTALBOND)
multipliers[:base_damage_multiplier] *= 1.25
@@ -413,9 +415,10 @@ class Battle::AI
# TODO
# Helping Hand - n/a
# Charge
if skill >= PBTrainerAI.mediumSkill && (user.effects[PBEffects::Charge] > 0 && type == :ELECTRIC)
multipliers[:base_damage_multiplier] *= 2
end
if skill >= PBTrainerAI.mediumSkill &&
user.effects[PBEffects::Charge] > 0 && type == :ELECTRIC
multipliers[:base_damage_multiplier] *= 2
end
# Mud Sport and Water Sport
if skill >= PBTrainerAI.mediumSkill
if type == :ELECTRIC
@@ -450,16 +453,16 @@ class Battle::AI
end
# Badge multipliers
if skill >= PBTrainerAI.highSkill && @battle.internalBattle && target.pbOwnedByPlayer?
if move.physicalMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_DEFENSE
multipliers[:defense_multiplier] *= 1.1
elsif move.specialMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_SPDEF
multipliers[:defense_multiplier] *= 1.1
end
end
if move.physicalMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_DEFENSE
multipliers[:defense_multiplier] *= 1.1
elsif move.specialMove?(type) && @battle.pbPlayer.badge_count >= Settings::NUM_BADGES_BOOST_SPDEF
multipliers[:defense_multiplier] *= 1.1
end
end
# Multi-targeting attacks
if skill >= PBTrainerAI.highSkill && pbTargetsMultiple?(move, user)
multipliers[:final_damage_multiplier] *= 0.75
end
multipliers[:final_damage_multiplier] *= 0.75
end
# Weather
if skill >= PBTrainerAI.mediumSkill
case user.effectiveWeather
@@ -487,50 +490,51 @@ class Battle::AI
# Critical hits - n/a
# Random variance - n/a
# STAB
if skill >= PBTrainerAI.mediumSkill && (type && user.pbHasType?(type))
if user.hasActiveAbility?(:ADAPTABILITY)
multipliers[:final_damage_multiplier] *= 2
else
multipliers[:final_damage_multiplier] *= 1.5
end
if skill >= PBTrainerAI.mediumSkill && type && user.pbHasType?(type)
if user.hasActiveAbility?(:ADAPTABILITY)
multipliers[:final_damage_multiplier] *= 2
else
multipliers[:final_damage_multiplier] *= 1.5
end
end
# Type effectiveness
if skill >= PBTrainerAI.mediumSkill
typemod = pbCalcTypeMod(type, user, target)
multipliers[:final_damage_multiplier] *= typemod.to_f / Effectiveness::NORMAL_EFFECTIVE
end
# Burn
if skill >= PBTrainerAI.highSkill && (user.status == :BURN && move.physicalMove?(type) &&
!user.hasActiveAbility?(:GUTS) &&
!(Settings::MECHANICS_GENERATION >= 6 && move.function == "DoublePowerIfUserPoisonedBurnedParalyzed")) # Facade
multipliers[:final_damage_multiplier] /= 2
end
if skill >= PBTrainerAI.highSkill && move.physicalMove?(type) &&
user.status == :BURN && !user.hasActiveAbility?(:GUTS) &&
!(Settings::MECHANICS_GENERATION >= 6 &&
move.function == "DoublePowerIfUserPoisonedBurnedParalyzed") # Facade
multipliers[:final_damage_multiplier] /= 2
end
# Aurora Veil, Reflect, Light Screen
if skill >= PBTrainerAI.highSkill && (!move.ignoresReflect? && !user.hasActiveAbility?(:INFILTRATOR))
if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
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 && move.physicalMove?(type)
if @battle.pbSideBattlerCount(target) > 1
multipliers[:final_damage_multiplier] *= 2 / 3.0
else
multipliers[:final_damage_multiplier] /= 2
end
elsif target.pbOwnSide.effects[PBEffects::LightScreen] > 0 && move.specialMove?(type)
if @battle.pbSideBattlerCount(target) > 1
multipliers[:final_damage_multiplier] *= 2 / 3.0
else
multipliers[:final_damage_multiplier] /= 2
end
if skill >= PBTrainerAI.highSkill && !move.ignoresReflect? && !user.hasActiveAbility?(:INFILTRATOR)
if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0
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 && move.physicalMove?(type)
if @battle.pbSideBattlerCount(target) > 1
multipliers[:final_damage_multiplier] *= 2 / 3.0
else
multipliers[:final_damage_multiplier] /= 2
end
elsif target.pbOwnSide.effects[PBEffects::LightScreen] > 0 && move.specialMove?(type)
if @battle.pbSideBattlerCount(target) > 1
multipliers[:final_damage_multiplier] *= 2 / 3.0
else
multipliers[:final_damage_multiplier] /= 2
end
end
end
# Minimize
if skill >= PBTrainerAI.highSkill && (target.effects[PBEffects::Minimize] && move.tramplesMinimize?(2))
multipliers[:final_damage_multiplier] *= 2
end
multipliers[:final_damage_multiplier] *= 2
end
# Move-specific base damage modifiers
# TODO
# Move-specific final damage modifiers
@@ -549,16 +553,16 @@ class Battle::AI
if c >= 0 && user.abilityActive?
c = Battle::AbilityEffects.triggerCriticalCalcFromUser(user.ability, user, target, c)
end
if skill >= PBTrainerAI.bestSkill && (c >= 0 && !moldBreaker && target.abilityActive?)
c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c)
end
if skill >= PBTrainerAI.bestSkill && c >= 0 && !moldBreaker && target.abilityActive?
c = Battle::AbilityEffects.triggerCriticalCalcFromTarget(target.ability, user, target, c)
end
# Item effects that alter critical hit rate
if c >= 0 && user.itemActive?
c = Battle::ItemEffects.triggerCriticalCalcFromUser(user.item, user, target, c)
end
if skill >= PBTrainerAI.bestSkill && (c >= 0 && target.itemActive?)
c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c)
end
if skill >= PBTrainerAI.bestSkill && c >= 0 && target.itemActive?
c = Battle::ItemEffects.triggerCriticalCalcFromTarget(target.item, user, target, c)
end
# Other efffects
c = -1 if target.pbOwnSide.effects[PBEffects::LuckyChant] > 0
if c >= 0
@@ -632,22 +636,22 @@ class Battle::AI
)
end
end
if skill >= PBTrainerAI.bestSkill && (target.abilityActive? && !moldBreaker)
Battle::AbilityEffects.triggerAccuracyCalcFromTarget(
target.ability, modifiers, user, target, move, type
)
end
if skill >= PBTrainerAI.bestSkill && target.abilityActive? && !moldBreaker
Battle::AbilityEffects.triggerAccuracyCalcFromTarget(
target.ability, modifiers, user, target, move, type
)
end
# Item effects that alter accuracy calculation
if skill >= PBTrainerAI.mediumSkill && user.itemActive?
Battle::ItemEffects.triggerAccuracyCalcFromUser(
user.item, modifiers, user, target, move, type
)
end
Battle::ItemEffects.triggerAccuracyCalcFromUser(
user.item, modifiers, user, target, move, type
)
end
if skill >= PBTrainerAI.bestSkill && target.itemActive?
Battle::ItemEffects.triggerAccuracyCalcFromTarget(
target.item, modifiers, user, target, move, type
)
end
Battle::ItemEffects.triggerAccuracyCalcFromTarget(
target.item, modifiers, user, target, move, type
)
end
# Other effects, inc. ones that set accuracy_multiplier or evasion_stage to specific values
if skill >= PBTrainerAI.mediumSkill
if @battle.field.effects[PBEffects::Gravity] > 0
@@ -666,8 +670,8 @@ class Battle::AI
user.effects[PBEffects::LockOnPos] == target.index
end
if skill >= PBTrainerAI.highSkill
if move.function == "BadPoisonTarget" && (Settings::MORE_TYPE_EFFECTS && move.statusMove? &&
user.pbHasType?(:POISON)) # Toxic
if move.function == "BadPoisonTarget" && # Toxic
Settings::MORE_TYPE_EFFECTS && move.statusMove? && user.pbHasType?(:POISON)
modifiers[:base_accuracy] = 0
end
if ["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(move.function)

View File

@@ -499,8 +499,8 @@ class PBAnimation < Array
pbSEPlay(name, i.volume, i.pitch) if name
end
# if sprite
# sprite.flash(i.flashColor,i.flashDuration*2) if i.flashScope==1
# sprite.flash(nil,i.flashDuration*2) if i.flashScope==3
# sprite.flash(i.flashColor, i.flashDuration * 2) if i.flashScope == 1
# sprite.flash(nil, i.flashDuration * 2) if i.flashScope == 3
# end
when 1 # Set background graphic (immediate)
if i.name && i.name != ""
@@ -509,12 +509,12 @@ class PBAnimation < Array
bgGraphic.oy = -i.bgY || 0
bgGraphic.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0)
bgGraphic.opacity = i.opacity || 0
bgColor.opacity = 0
bgColor.opacity = 0
else
bgGraphic.setBitmap(nil)
bgGraphic.opacity = 0
bgColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0)
bgColor.opacity = i.opacity || 0
bgColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0)
bgColor.opacity = i.opacity || 0
end
when 2 # Move/recolour background graphic
if bgGraphic.bitmap.nil?
@@ -535,12 +535,12 @@ class PBAnimation < Array
foGraphic.oy = -i.bgY || 0
foGraphic.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0)
foGraphic.opacity = i.opacity || 0
foColor.opacity = 0
foColor.opacity = 0
else
foGraphic.setBitmap(nil)
foGraphic.opacity = 0
foColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0)
foColor.opacity = i.opacity || 0
foColor.color = Color.new(i.colorRed || 0, i.colorGreen || 0, i.colorBlue || 0, i.colorAlpha || 0)
foColor.opacity = i.opacity || 0
end
when 4 # Move/recolour foreground graphic
if foGraphic.bitmap.nil?
@@ -563,12 +563,12 @@ class PBAnimation < Array
next if frame < i.frame || frame > i.frame + i.duration
fraction = (frame - i.frame).to_f / i.duration
if bgGraphic.bitmap.nil?
bgColor.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity != nil
bgColor.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity != nil
cr = (i.colorRed != nil) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red
cg = (i.colorGreen != nil) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
cb = (i.colorBlue != nil) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
ca = (i.colorAlpha != nil) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
bgColor.color = Color.new(cr, cg, cb, ca)
bgColor.color = Color.new(cr, cg, cb, ca)
else
bgGraphic.ox = oldbg[0] - ((i.bgX - oldbg[0]) * fraction) if i.bgX != nil
bgGraphic.oy = oldbg[1] - ((i.bgY - oldbg[1]) * fraction) if i.bgY != nil
@@ -577,14 +577,14 @@ class PBAnimation < Array
cg = (i.colorGreen != nil) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
cb = (i.colorBlue != nil) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
ca = (i.colorAlpha != nil) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
bgGraphic.color = Color.new(cr, cg, cb, ca)
bgGraphic.color = Color.new(cr, cg, cb, ca)
end
when 4
next if !i.duration || i.duration <= 0
next if frame < i.frame || frame > i.frame + i.duration
fraction = (frame - i.frame).to_f / i.duration
if foGraphic.bitmap.nil?
foColor.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity != nil
foColor.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity != nil
cr = (i.colorRed != nil) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red
cg = (i.colorGreen != nil) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
cb = (i.colorBlue != nil) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
@@ -598,7 +598,7 @@ class PBAnimation < Array
cg = (i.colorGreen != nil) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
cb = (i.colorBlue != nil) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
ca = (i.colorAlpha != nil) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha
foGraphic.color = Color.new(cr, cg, cb, ca)
foGraphic.color = Color.new(cr, cg, cb, ca)
end
end
end

View File

@@ -119,10 +119,10 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation
ballEndX = ballPos[0] - 40
ballEndY = ballPos[1] - 4
# Set up trainer sprite
trainer = addSprite(traSprite, PictureOrigin::Bottom)
trainer = addSprite(traSprite, PictureOrigin::BOTTOM)
# Set up bait sprite
ball = addNewSprite(ballStartX, ballStartY,
"Graphics/Battle animations/safari_bait", PictureOrigin::Center)
"Graphics/Battle animations/safari_bait", PictureOrigin::CENTER)
ball.setZ(0, batSprite.z + 1)
# Trainer animation
if traSprite.bitmap.width >= traSprite.bitmap.height * 2
@@ -138,7 +138,7 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation
ball.moveOpacity(delay + 8, 2, 0)
ball.setVisible(delay + 10, false)
# Set up battler sprite
battler = addSprite(batSprite, PictureOrigin::Bottom)
battler = addSprite(batSprite, PictureOrigin::BOTTOM)
# Show Pokémon jumping before eating the bait
delay = ball.totalDuration + 3
2.times do
@@ -184,10 +184,10 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation
ballEndX = batSprite.x
ballEndY = batSprite.y - (batSprite.bitmap.height / 2)
# Set up trainer sprite
trainer = addSprite(traSprite, PictureOrigin::Bottom)
trainer = addSprite(traSprite, PictureOrigin::BOTTOM)
# Set up bait sprite
ball = addNewSprite(ballStartX, ballStartY,
"Graphics/Battle animations/safari_rock", PictureOrigin::Center)
"Graphics/Battle animations/safari_rock", PictureOrigin::CENTER)
ball.setZ(0, batSprite.z + 1)
# Trainer animation
if traSprite.bitmap.width >= traSprite.bitmap.height * 2
@@ -205,7 +205,7 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation
ball.setVisible(delay + 4, false)
# Set up anger sprite
anger = addNewSprite(ballEndX - 42, ballEndY - 36,
"Graphics/Battle animations/safari_anger", PictureOrigin::Center)
"Graphics/Battle animations/safari_anger", PictureOrigin::CENTER)
anger.setVisible(0, false)
anger.setZ(0, batSprite.z + 1)
# Show anger appearing