Merge branch 'dev' into ai

This commit is contained in:
Maruno17
2023-02-05 19:10:25 +00:00
208 changed files with 3123 additions and 3331 deletions

View File

@@ -166,11 +166,11 @@ class Battle
@runCommand = 0
@nextPickupUse = 0
if GameData::Move.exists?(:STRUGGLE)
@struggle = Move.from_pokemon_move(self, Pokemon::Move.new(:STRUGGLE))
@struggle = Move.from_pokemon_move(self, Pokemon::Move.new(:STRUGGLE))
else
@struggle = Move::Struggle.new(self, nil)
@struggle = Move::Struggle.new(self, nil)
end
@mega_rings = []
@mega_rings = []
GameData::Item.each { |item| @mega_rings.push(item.id) if item.has_flag?("MegaRing") }
@battleAI = AI.new(self)
end

View File

@@ -211,9 +211,7 @@ class Battle
oldSpAtk = pkmn.spatk
oldSpDef = pkmn.spdef
oldSpeed = pkmn.speed
if battler&.pokemon
battler.pokemon.changeHappiness("levelup")
end
battler.pokemon.changeHappiness("levelup") if battler&.pokemon
pkmn.calc_stats
battler&.pbUpdate(false)
@scene.pbRefreshOne(battler.index) if battler

View File

@@ -227,7 +227,7 @@ class Battle
end
# Reorder the priority array
if needRearranging
@priority.sort! { |a, b|
@priority.sort! do |a, b|
if a[5] != b[5]
# Sort by priority (highest value first)
b[5] <=> a[5]
@@ -241,7 +241,7 @@ class Battle
# Sort by speed (highest first), and use tie-breaker if necessary
(a[1] == b[1]) ? b[6] <=> a[6] : b[1] <=> a[1]
end
}
end
# Write the priority order to the debug log
if fullCalc && $INTERNAL
logMsg = "[Round order] "

View File

@@ -111,7 +111,7 @@ class Battle
# all instances where the party screen is opened.
def pbPartyScreen(idxBattler, checkLaxOnly = false, canCancel = false, shouldRegister = false)
ret = -1
@scene.pbPartyScreen(idxBattler, canCancel) { |idxParty, partyScene|
@scene.pbPartyScreen(idxBattler, canCancel) do |idxParty, partyScene|
if checkLaxOnly
next false if !pbCanSwitchLax?(idxBattler, idxParty, partyScene)
elsif !pbCanSwitch?(idxBattler, idxParty, partyScene)
@@ -122,7 +122,7 @@ class Battle
end
ret = idxParty
next true
}
end
return ret
end

View File

@@ -64,7 +64,7 @@ class Battle
return true if pbAutoFightMenu(idxBattler)
# Regular move selection
ret = false
@scene.pbFightMenu(idxBattler, pbCanMegaEvolve?(idxBattler)) { |cmd|
@scene.pbFightMenu(idxBattler, pbCanMegaEvolve?(idxBattler)) do |cmd|
case cmd
when -1 # Cancel
when -2 # Toggle Mega Evolution
@@ -83,7 +83,7 @@ class Battle
ret = true
end
next true
}
end
return ret
end
@@ -103,7 +103,7 @@ class Battle
return false
end
ret = false
@scene.pbItemMenu(idxBattler, firstAction) { |item, useType, idxPkmn, idxMove, itemScene|
@scene.pbItemMenu(idxBattler, firstAction) do |item, useType, idxPkmn, idxMove, itemScene|
next false if !item
battler = pkmn = nil
case useType
@@ -133,7 +133,7 @@ class Battle
next false if !pbRegisterItem(idxBattler, item, idxPkmn, idxMove)
ret = true
next true
}
end
return ret
end

View File

@@ -57,9 +57,9 @@ class Battle
pbPursuit(b.index)
return if @decision > 0
# Switch Pokémon
allBattlers.each do |b|
b.droppedBelowHalfHP = false
b.statsDropped = false
allBattlers.each do |b2|
b2.droppedBelowHalfHP = false
b2.statsDropped = false
end
pbRecallAndReplace(b.index, idxNewPkmn)
pbOnBattlerEnteringBattle(b.index, true)

View File

@@ -143,9 +143,9 @@ class Battle
next if battler.opposes?(side)
next if !battler.takesIndirectDamage? || battler.pbHasType?(:FIRE)
@scene.pbDamageAnimation(battler)
battler.pbTakeEffectDamage(battler.totalhp / 8, false) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8, false) do |hp_lost|
pbDisplay(_INTL("{1} is hurt by the sea of fire!", battler.pbThis))
}
end
end
end
end
@@ -192,11 +192,11 @@ class Battle
recipient = @battlers[battler.effects[PBEffects::LeechSeed]]
next if !recipient || recipient.fainted?
pbCommonAnimation("LeechSeed", recipient, battler)
battler.pbTakeEffectDamage(battler.totalhp / 8) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8) do |hp_lost|
recipient.pbRecoverHPFromDrain(hp_lost, battler,
_INTL("{1}'s health is sapped by Leech Seed!", battler.pbThis))
recipient.pbAbilitiesOnDamageTaken
}
end
recipient.pbFaint if recipient.fainted?
end
end
@@ -259,16 +259,16 @@ class Battle
priority.each do |battler|
battler.effects[PBEffects::Nightmare] = false if !battler.asleep?
next if !battler.effects[PBEffects::Nightmare] || !battler.takesIndirectDamage?
battler.pbTakeEffectDamage(battler.totalhp / 4) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 4) do |hp_lost|
pbDisplay(_INTL("{1} is locked in a nightmare!", battler.pbThis))
}
end
end
# Curse
priority.each do |battler|
next if !battler.effects[PBEffects::Curse] || !battler.takesIndirectDamage?
battler.pbTakeEffectDamage(battler.totalhp / 4) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 4) do |hp_lost|
pbDisplay(_INTL("{1} is afflicted by the curse!", battler.pbThis))
}
end
end
end
@@ -301,9 +301,9 @@ class Battle
hpLoss = (Settings::MECHANICS_GENERATION >= 6) ? battler.totalhp / 6 : battler.totalhp / 8
end
@scene.pbDamageAnimation(battler)
battler.pbTakeEffectDamage(hpLoss, false) { |hp_lost|
battler.pbTakeEffectDamage(hpLoss, false) do |hp_lost|
pbDisplay(_INTL("{1} is hurt by {2}!", battler.pbThis, move_name))
}
end
end
#=============================================================================
@@ -319,9 +319,9 @@ class Battle
def pbEOREndBattlerEffects(priority)
# Taunt
pbEORCountDownBattlerEffect(priority, PBEffects::Taunt) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Taunt) do |battler|
pbDisplay(_INTL("{1}'s taunt wore off!", battler.pbThis))
}
end
# Encore
priority.each do |battler|
next if battler.fainted? || battler.effects[PBEffects::Encore] == 0
@@ -339,34 +339,34 @@ class Battle
end
end
# Disable/Cursed Body
pbEORCountDownBattlerEffect(priority, PBEffects::Disable) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Disable) do |battler|
battler.effects[PBEffects::DisableMove] = nil
pbDisplay(_INTL("{1} is no longer disabled!", battler.pbThis))
}
end
# Magnet Rise
pbEORCountDownBattlerEffect(priority, PBEffects::MagnetRise) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::MagnetRise) do |battler|
pbDisplay(_INTL("{1}'s electromagnetism wore off!", battler.pbThis))
}
end
# Telekinesis
pbEORCountDownBattlerEffect(priority, PBEffects::Telekinesis) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Telekinesis) do |battler|
pbDisplay(_INTL("{1} was freed from the telekinesis!", battler.pbThis))
}
end
# Heal Block
pbEORCountDownBattlerEffect(priority, PBEffects::HealBlock) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::HealBlock) do |battler|
pbDisplay(_INTL("{1}'s Heal Block wore off!", battler.pbThis))
}
end
# Embargo
pbEORCountDownBattlerEffect(priority, PBEffects::Embargo) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Embargo) do |battler|
pbDisplay(_INTL("{1} can use items again!", battler.pbThis))
battler.pbItemTerrainStatBoostCheck
}
end
# Yawn
pbEORCountDownBattlerEffect(priority, PBEffects::Yawn) { |battler|
pbEORCountDownBattlerEffect(priority, PBEffects::Yawn) do |battler|
if battler.pbCanSleepYawn?
PBDebug.log("[Lingering effect] #{battler.pbThis} fell asleep because of Yawn")
battler.pbSleep
end
}
end
# Perish Song
perishSongUsers = []
priority.each do |battler|

View File

@@ -145,7 +145,7 @@ class Battle::Battler
def pbResetTypes
@types = @pokemon.types
@effects[PBEffects::ExtraType] = nil
@effects[PBEffects::ExtraType] = nil
@effects[PBEffects::BurnUp] = false
@effects[PBEffects::Roost] = false
end

View File

@@ -72,10 +72,10 @@ class Battle::Battler
# in and not at any later times, even if a traceable ability turns
# up later. Essentials ignores this, and allows Trace to trigger
# whenever it can even in Gen 5 battle mechanics.
choices = @battle.allOtherSideBattlers(@index).select { |b|
choices = @battle.allOtherSideBattlers(@index).select do |b|
next !b.ungainableAbility? &&
![:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(b.ability_id)
}
end
if choices.length > 0
choice = choices[@battle.pbRandom(choices.length)]
@battle.pbShowAbilitySplash(self)

View File

@@ -48,9 +48,7 @@ class Battle::Battler
end
# Use the move
PBDebug.log("[Use move] #{pbThis} (#{@index}) used #{choice[2].name}")
PBDebug.logonerr {
pbUseMove(choice, choice[2] == @battle.struggle)
}
PBDebug.logonerr { pbUseMove(choice, choice[2] == @battle.struggle) }
@battle.pbJudge
# Update priority order
@battle.pbCalculatePriority if Settings::RECALCULATE_TURN_ORDER_AFTER_SPEED_CHANGES
@@ -315,9 +313,9 @@ class Battle::Battler
@battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
user.lastMoveFailed = true
if ![:Rain, :HeavyRain].include?(user.effectiveWeather) && user.takesIndirectDamage?
user.pbTakeEffectDamage((user.totalhp / 4.0).round, false) { |hp_lost|
user.pbTakeEffectDamage((user.totalhp / 4.0).round, false) do |hp_lost|
@battle.pbDisplay(_INTL("{1} is hurt by its {2}!", battler.pbThis, battler.itemName))
}
end
@battle.pbGainExp # In case user is KO'd by this
end
pbCancelMoves
@@ -531,9 +529,9 @@ class Battle::Battler
@battle.pbDisplay(_INTL("{1} used the move instructed by {2}!", b.pbThis, user.pbThis(true)))
b.effects[PBEffects::Instructed] = true
if b.pbCanChooseMove?(@moves[idxMove], false)
PBDebug.logonerr {
PBDebug.logonerr do
b.pbUseMoveSimple(b.lastMoveUsed, b.lastRegularMoveTarget, idxMove, false)
}
end
b.lastRoundMoved = oldLastRoundMoved
@battle.pbJudge
return if @battle.decision > 0
@@ -567,9 +565,7 @@ class Battle::Battler
end
nextUser.effects[PBEffects::Dancer] = true
if nextUser.pbCanChooseMove?(move, false)
PBDebug.logonerr {
nextUser.pbUseMoveSimple(move.id, preTarget)
}
PBDebug.logonerr { nextUser.pbUseMoveSimple(move.id, preTarget) }
nextUser.lastRoundMoved = oldLastRoundMoved
nextUser.effects[PBEffects::Outrage] = oldOutrage
nextUser.currentMove = oldCurrentMove
@@ -716,9 +712,7 @@ class Battle::Battler
next if b.damageState.calcDamage == 0
chance = move.pbAdditionalEffectChance(user, b)
next if chance <= 0
if @battle.pbRandom(100) < chance
move.pbAdditionalEffect(user, b)
end
move.pbAdditionalEffect(user, b) if @battle.pbRandom(100) < chance
end
end
# Make the target flinch (because of an item/ability)

View File

@@ -104,11 +104,11 @@ class Battle::Move
def pbFailsAgainstTarget?(user, target, show_message); return false; end
def pbMoveFailedLastInRound?(user, showMessage = true)
unmoved = @battle.allBattlers.any? { |b|
unmoved = @battle.allBattlers.any? do |b|
next b.index != user.index &&
[:UseMove, :Shift].include?(@battle.choices[b.index][0]) &&
!b.movedThisRound?
}
end
if !unmoved
@battle.pbDisplay(_INTL("But it failed!")) if showMessage
return true

View File

@@ -226,16 +226,12 @@ class Battle::Move
def pbModifyDamage(damageMult, user, target); return damageMult; end
def pbGetAttackStats(user, target)
if specialMove?
return user.spatk, user.stages[:SPECIAL_ATTACK] + 6
end
return user.spatk, user.stages[:SPECIAL_ATTACK] + 6 if specialMove?
return user.attack, user.stages[:ATTACK] + 6
end
def pbGetDefenseStats(user, target)
if specialMove?
return target.spdef, target.stages[:SPECIAL_DEFENSE] + 6
end
return target.spdef, target.stages[:SPECIAL_DEFENSE] + 6 if specialMove?
return target.defense, target.stages[:DEFENSE] + 6
end
@@ -400,9 +396,7 @@ class Battle::Move
end
end
# Multi-targeting attacks
if numTargets > 1
multipliers[:final_damage_multiplier] *= 0.75
end
multipliers[:final_damage_multiplier] *= 0.75 if numTargets > 1
# Weather
case user.effectiveWeather
when :Sun, :HarshSun

View File

@@ -366,8 +366,7 @@ class Battle::Move::TwoTurnMove < Battle::Move
@battle.pbDisplay(_INTL("{1} began charging up!", user.pbThis))
end
def pbAttackingTurnMessage(user, targets)
end
def pbAttackingTurnMessage(user, targets); end
def pbEffectAgainstTarget(user, target)
if @damagingTurn
@@ -382,8 +381,7 @@ class Battle::Move::TwoTurnMove < Battle::Move
# the latter just records the target is being Sky Dropped
end
def pbAttackingTurnEffect(user, target)
end
def pbAttackingTurnEffect(user, target); end
def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
hitNum = 1 if @chargingTurn && !@damagingTurn # Charging anim

View File

@@ -100,9 +100,7 @@ class Battle::Move::OHKO < Battle::Move::FixedDamageMove
def pbHitEffectivenessMessages(user, target, numTargets = 1)
super
if target.fainted?
@battle.pbDisplay(_INTL("It's a one-hit KO!"))
end
@battle.pbDisplay(_INTL("It's a one-hit KO!")) if target.fainted?
end
end
@@ -1211,9 +1209,7 @@ end
#===============================================================================
class Battle::Move::UseTargetAttackInsteadOfUserAttack < Battle::Move
def pbGetAttackStats(user, target)
if specialMove?
return target.spatk, target.stages[:SPECIAL_ATTACK] + 6
end
return target.spatk, target.stages[:SPECIAL_ATTACK] + 6 if specialMove?
return target.attack, target.stages[:ATTACK] + 6
end
end

View File

@@ -328,7 +328,7 @@ class Battle::Move::UserConsumeBerryRaiseDefense2 < Battle::Move::StatUpMove
@battle.pbDisplay(_INTL("{1} ate its {2}!", user.pbThis, user.itemName))
item = user.item
user.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
user.pbHeldItemTriggerCheck(item, false)
user.pbHeldItemTriggerCheck(item.id, false)
end
end
@@ -370,7 +370,7 @@ class Battle::Move::AllBattlersConsumeBerry < Battle::Move
@battle.pbCommonAnimation("EatBerry", target)
item = target.item
target.pbConsumeItem(true, false) # Don't trigger Symbiosis yet
target.pbHeldItemTriggerCheck(item, false)
target.pbHeldItemTriggerCheck(item.id, false)
end
end
@@ -385,9 +385,11 @@ class Battle::Move::UserConsumeTargetBerry < Battle::Move
return if target.hasActiveAbility?(:STICKYHOLD) && !@battle.moldBreaker
item = target.item
itemName = target.itemName
user.setBelched
target.pbRemoveItem
@battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!", user.pbThis, itemName))
user.pbHeldItemTriggerCheck(item, false)
user.pbHeldItemTriggerCheck(item.id, false)
user.pbSymbiosis
end
end
@@ -445,8 +447,13 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move
when :KINGSROCK, :RAZORFANG
target.pbFlinch(user)
else
target.pbHeldItemTriggerCheck(user.item, true)
target.pbHeldItemTriggerCheck(user.item_id, true)
end
# NOTE: The official games only let the target use Belch if the berry flung
# at it has some kind of effect (i.e. it isn't an effectless berry). I
# think this isn't in the spirit of "consuming a berry", so I've said
# that Belch is usable after having any kind of berry flung at you.
target.setBelched if user.item.is_berry?
end
def pbEndOfMoveUsageEffect(user, targets, numHits, switchedBattlers)

View File

@@ -363,8 +363,7 @@ class Battle::Scene
pbShowWindow(MESSAGE_BOX)
end
def pbBeginEndOfRoundPhase
end
def pbBeginEndOfRoundPhase; end
def pbEndBattle(_result)
@abortable = false

View File

@@ -98,15 +98,11 @@ class Battle::Scene
if Input.trigger?(Input::LEFT)
cw.index -= 1 if (cw.index & 1) == 1
elsif Input.trigger?(Input::RIGHT)
if battler.moves[cw.index + 1]&.id && (cw.index & 1) == 0
cw.index += 1
end
cw.index += 1 if battler.moves[cw.index + 1]&.id && (cw.index & 1) == 0
elsif Input.trigger?(Input::UP)
cw.index -= 2 if (cw.index & 2) == 2
elsif Input.trigger?(Input::DOWN)
if battler.moves[cw.index + 2]&.id && (cw.index & 2) == 0
cw.index += 2
end
cw.index += 2 if battler.moves[cw.index + 2]&.id && (cw.index & 2) == 0
end
pbPlayCursorSE if cw.index != oldIndex
# Actions
@@ -449,11 +445,11 @@ class Battle::Scene
# not allow HM moves to be forgotten.
def pbForgetMove(pkmn, moveToLearn)
ret = -1
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
ret = screen.pbStartForgetScreen([pkmn], 0, moveToLearn)
}
end
return ret
end
@@ -468,10 +464,10 @@ class Battle::Scene
# Shows the Pokédex entry screen for a newly caught Pokémon
#=============================================================================
def pbShowPokedex(species)
pbFadeOutIn {
pbFadeOutIn do
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)
screen.pbDexEntry(species)
}
end
end
end

View File

@@ -137,9 +137,7 @@ class Battle::Scene
a[2] = true if a[1].animDone?
end
pbUpdate
if !inPartyAnimation? && sendOutAnims.none? { |a| !a[2] }
break
end
break if !inPartyAnimation? && sendOutAnims.none? { |a| !a[2] }
end
fadeAnim.dispose
sendOutAnims.each do |a|
@@ -498,13 +496,13 @@ class Battle::Scene
target = (targets.is_a?(Array)) ? targets[0] : targets
animations = pbLoadBattleAnimations
return if !animations
pbSaveShadows {
pbSaveShadows do
if animID[1] # On opposing side and using OppMove animation
pbAnimationCore(animations[anim], target, user, true)
else # On player's side, and/or using Move animation
pbAnimationCore(animations[anim], user, target)
end
}
end
end
# Plays a common animation.

View File

@@ -91,8 +91,6 @@ class Battle::Scene::MenuBase
end
end
#===============================================================================
# Command menu (Fight/Pokémon/Bag/Run)
#===============================================================================
@@ -194,8 +192,6 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
end
end
#===============================================================================
# Fight menu (choose a move)
#===============================================================================
@@ -440,8 +436,6 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
end
end
#===============================================================================
# Target menu (choose a move's target)
# NOTE: Unlike the command and fight menus, this one doesn't have a textbox-only

View File

@@ -402,8 +402,6 @@ class Battle::Scene::PokemonDataBox < Sprite
end
end
#===============================================================================
# Splash bar to announce a triggered ability
#===============================================================================
@@ -496,8 +494,6 @@ class Battle::Scene::AbilitySplashBar < Sprite
end
end
#===============================================================================
# Pokémon sprite (used in battle)
#===============================================================================
@@ -624,8 +620,6 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
end
end
#===============================================================================
# Shadow sprite for Pokémon (used in battle)
#===============================================================================

View File

@@ -401,8 +401,8 @@ module Battle::Scene::Animation::BallAnimationMixin
angle = rand(360)
radian = (angle + 90) * Math::PI / 180
start_zoom = rand(50...100)
ray = addNewSprite(ballX + ray_min_radius * Math.cos(radian),
ballY - ray_min_radius * Math.sin(radian),
ray = addNewSprite(ballX + (ray_min_radius * Math.cos(radian)),
ballY - (ray_min_radius * Math.sin(radian)),
"Graphics/Battle animations/ballBurst_ray", PictureOrigin::BOTTOM)
ray.setZ(0, 100)
ray.setZoomXY(0, 200, start_zoom)
@@ -411,7 +411,7 @@ module Battle::Scene::Animation::BallAnimationMixin
ray.setVisible(0, false)
ray.setAngle(0, angle)
# Animate ray
start = delay + i / 2
start = delay + (i / 2)
ray.setVisible(start, true)
ray.moveZoomXY(start, ray_lifetime, 200, start_zoom * 6)
ray.moveOpacity(start, 2, 255) # Quickly fade in
@@ -437,7 +437,7 @@ module Battle::Scene::Animation::BallAnimationMixin
particle.setVisible(0, false)
end
# Animate particles
start = delay + i / 4
start = delay + (i / 4)
max_radius = rand(256...384)
angle = rand(360)
radian = angle * Math::PI / 180
@@ -596,7 +596,7 @@ module Battle::Scene::Animation::BallAnimationMixin
else
glare1.moveZoom(delay, particle_duration, 600)
end
glare1.moveOpacity(delay + particle_duration / 2, particle_duration / 2, 0)
glare1.moveOpacity(delay + (particle_duration / 2), particle_duration / 2, 0)
[glare1, glare2, glare3].each_with_index do |particle, num|
particle.moveTone(delay, particle_duration, variances[8 - (3 * num)])
end
@@ -604,13 +604,13 @@ module Battle::Scene::Animation::BallAnimationMixin
glare2.moveZoom(delay, particle_duration, 350)
glare3.moveZoom(delay, particle_duration, 500)
[glare2, glare3].each_with_index do |particle, num|
particle.moveOpacity(delay + particle_duration / 2, particle_duration / 2, 0)
particle.moveOpacity(delay + (particle_duration / 2), particle_duration / 2, 0)
end
else
glare2.moveZoom(delay, particle_duration, (poke_ball == :MASTERBALL) ? 400 : 250)
glare2.moveOpacity(delay + particle_duration / 2, particle_duration / 3, 0)
glare2.moveOpacity(delay + (particle_duration / 2), particle_duration / 3, 0)
glare3.moveZoom(delay, particle_duration, (poke_ball == :MASTERBALL) ? 800 : 500)
glare3.moveOpacity(delay + particle_duration / 2, particle_duration / 3, 0)
glare3.moveOpacity(delay + (particle_duration / 2), particle_duration / 3, 0)
end
[glare1, glare2, glare3].each { |p| p.setVisible(delay + particle_duration, false) }
# Burst particles
@@ -647,12 +647,12 @@ module Battle::Scene::Animation::BallAnimationMixin
prop = 2 - prop if index > particle_duration / 2
radius *= prop
particle1.moveXY(delay + j, 1,
ballX + p1_x_offset * index * 2 / particle_duration,
ballY - p1_y_offset * index * 2 / particle_duration)
ballX + (p1_x_offset * index * 2 / particle_duration),
ballY - (p1_y_offset * index * 2 / particle_duration))
[particle2, particle3].each do |particle|
particle.moveXY(delay + j, 1,
ballX + radius * Math.cos(radian),
ballY - radius * Math.sin(radian))
ballX + (radius * Math.cos(radian)),
ballY - (radius * Math.sin(radian)))
end
end
particle1.moveZoom(delay, particle_duration, 0)
@@ -674,14 +674,14 @@ module Battle::Scene::Animation::BallAnimationMixin
end
# Zoom out
if ["particle", "dazzle", "ring3", "ring4", "diamond"].include?(variances[12 - (3 * num)])
particle.moveZoom(delay + particle_duration * 2 / 3, particle_duration / 3, 10)
particle.moveZoom(delay + (particle_duration * 2 / 3), particle_duration / 3, 10)
else
particle.moveZoom(delay + particle_duration * 2 / 3, particle_duration / 3, 25)
particle.moveZoom(delay + (particle_duration * 2 / 3), particle_duration / 3, 25)
end
# Rotate (for Premier Ball)
particle.moveAngle(delay, particle_duration, -180) if poke_ball == :PREMIERBALL
# Change tone, fade out
particle.moveTone(delay + particle_duration / 3, (particle_duration.to_f / 3).ceil, variances[14 - (3 * num)])
particle.moveTone(delay + (particle_duration / 3), (particle_duration.to_f / 3).ceil, variances[14 - (3 * num)])
particle.moveOpacity(delay + particle_duration - 3, 3, 128) # Fade out at end
end
[particle1, particle2, particle3].each { |p| p.setVisible(delay + particle_duration, false) }
@@ -702,7 +702,7 @@ module Battle::Scene::Animation::BallAnimationMixin
web.moveZoom(delay + start + (i * 4), 2, 150)
web.moveZoom(delay + start + (i * 4) + 2, 2, 120)
end
now = start + (web_duration / 4) * 4
now = start + ((web_duration / 4) * 4)
web.moveZoom(delay + now, particle_duration + ring_duration - now, 150)
web.moveOpacity(delay + particle_duration, ring_duration, 0)
web.setVisible(delay + particle_duration + ring_duration, false)
@@ -747,10 +747,10 @@ module Battle::Scene::Animation::BallAnimationMixin
index = j + 1
x = 72 * index / star_duration
proportion = index.to_f / star_duration
a = (2 * y_pos[2]) - 4 * y_pos[1]
a = (2 * y_pos[2]) - (4 * y_pos[1])
b = y_pos[2] - a
y = ((a * proportion) + b) * proportion
star.moveXY(delay + j, 1, ballX + [-1, 0, 1][i] * x, ballY - y)
star.moveXY(delay + j, 1, ballX + ([-1, 0, 1][i] * x), ballY - y)
end
star.moveAngle(delay, star_duration, start_angle + [144, 0, 45][i]) if i.even?
star.moveOpacity(delay, 4, 255) # Fade in
@@ -789,17 +789,17 @@ module Battle::Scene::Animation::BallAnimationMixin
prop = j.to_f / (color_duration / 3)
radius *= 0.75 + (prop / 4)
elsif j >= burst_duration / 2
prop = (j.to_f - burst_duration / 2) / (burst_duration / 2)
prop = (j.to_f - (burst_duration / 2)) / (burst_duration / 2)
radius *= 1 - prop
end
if j == 0
particle.setXY(delay + j, ballX + radius * Math.cos(radian), ballY - radius * Math.sin(radian))
particle.setXY(delay + j, ballX + (radius * Math.cos(radian)), ballY - (radius * Math.sin(radian)))
else
particle.moveXY(delay + j, 1, ballX + radius * Math.cos(radian), ballY - radius * Math.sin(radian))
particle.moveXY(delay + j, 1, ballX + (radius * Math.cos(radian)), ballY - (radius * Math.sin(radian)))
end
end
particle.moveZoom(delay, burst_duration, 0)
particle.moveTone(delay + color_duration / 2, color_duration / 2, Tone.new(0, 0, -192)) # Yellow
particle.moveTone(delay + (color_duration / 2), color_duration / 2, Tone.new(0, 0, -192)) # Yellow
particle.moveTone(delay + color_duration, shrink_duration, Tone.new(0, -128, -248)) # Dark orange
particle.moveOpacity(delay + color_duration, shrink_duration, 0) # Fade out at end
particle.setVisible(delay + burst_duration, false)

View File

@@ -57,8 +57,6 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
end
end
#===============================================================================
# Shows wild Pokémon fading back to their normal color, and triggers their intro
# animations
@@ -80,8 +78,6 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation
end
end
#===============================================================================
# Makes a side's party bar and balls appear
#===============================================================================
@@ -181,8 +177,6 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
end
end
#===============================================================================
# Makes a Pokémon's data box appear
#===============================================================================
@@ -202,8 +196,6 @@ class Battle::Scene::Animation::DataBoxAppear < Battle::Scene::Animation
end
end
#===============================================================================
# Makes a Pokémon's data box disappear
#===============================================================================
@@ -222,8 +214,6 @@ class Battle::Scene::Animation::DataBoxDisappear < Battle::Scene::Animation
end
end
#===============================================================================
# Makes a Pokémon's ability bar appear
#===============================================================================
@@ -242,8 +232,6 @@ class Battle::Scene::Animation::AbilitySplashAppear < Battle::Scene::Animation
end
end
#===============================================================================
# Makes a Pokémon's ability bar disappear
#===============================================================================
@@ -262,8 +250,6 @@ class Battle::Scene::Animation::AbilitySplashDisappear < Battle::Scene::Animatio
end
end
#===============================================================================
# Make an enemy trainer slide on-screen from the right. Makes the previous
# trainer slide off to the right first if it is on-screen.
@@ -296,8 +282,6 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation
end
end
#===============================================================================
# Shows the player (and partner) and the player party lineup sliding off screen.
# Shows the player's/partner's throwing animation (if they have one).
@@ -339,10 +323,10 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
partyBar.setVisible(delay + 12, false)
partyBar.setOpacity(delay + 12, 255)
end
Battle::Scene::NUM_BALLS.times do |i|
next if !@sprites["partyBall_0_#{i}"] || !@sprites["partyBall_0_#{i}"].visible
partyBall = addSprite(@sprites["partyBall_0_#{i}"])
partyBall.moveDelta(delay + (2 * i), 16, -Graphics.width, 0) if @fullAnim
Battle::Scene::NUM_BALLS.times do |j|
next if !@sprites["partyBall_0_#{j}"] || !@sprites["partyBall_0_#{j}"].visible
partyBall = addSprite(@sprites["partyBall_0_#{j}"])
partyBall.moveDelta(delay + (2 * j), 16, -Graphics.width, 0) if @fullAnim
partyBall.moveOpacity(delay, 12, 0)
partyBall.setVisible(delay + 12, false)
partyBall.setOpacity(delay + 12, 255)
@@ -350,8 +334,6 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
end
end
#===============================================================================
# Shows the enemy trainer(s) and the enemy party lineup sliding off screen.
# Doesn't show the ball thrown or the Pokémon.
@@ -384,10 +366,10 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
partyBar.setVisible(delay + 12, false)
partyBar.setOpacity(delay + 12, 255)
end
Battle::Scene::NUM_BALLS.times do |i|
next if !@sprites["partyBall_1_#{i}"] || !@sprites["partyBall_1_#{i}"].visible
partyBall = addSprite(@sprites["partyBall_1_#{i}"])
partyBall.moveDelta(delay + (2 * i), 16, Graphics.width, 0) if @fullAnim
Battle::Scene::NUM_BALLS.times do |j|
next if !@sprites["partyBall_1_#{j}"] || !@sprites["partyBall_1_#{j}"].visible
partyBall = addSprite(@sprites["partyBall_1_#{j}"])
partyBall.moveDelta(delay + (2 * j), 16, Graphics.width, 0) if @fullAnim
partyBall.moveOpacity(delay, 12, 0)
partyBall.setVisible(delay + 12, false)
partyBall.setOpacity(delay + 12, 255)
@@ -395,8 +377,6 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
end
end
#===============================================================================
# Shows a Pokémon being sent out on the player's side (including by a partner).
# Includes the Poké Ball being thrown.
@@ -473,8 +453,6 @@ class Battle::Scene::Animation::PokeballPlayerSendOut < Battle::Scene::Animation
end
end
#===============================================================================
# Shows a Pokémon being sent out on the opposing side.
# Includes the Poké Ball being "thrown" (although here the Poké Ball just
@@ -544,8 +522,6 @@ class Battle::Scene::Animation::PokeballTrainerSendOut < Battle::Scene::Animatio
end
end
#===============================================================================
# Shows a Pokémon being recalled into its Poké Ball
#===============================================================================
@@ -594,8 +570,6 @@ class Battle::Scene::Animation::BattlerRecall < Battle::Scene::Animation
end
end
#===============================================================================
# Shows a Pokémon flashing after taking damage
#===============================================================================
@@ -632,8 +606,6 @@ class Battle::Scene::Animation::BattlerDamage < Battle::Scene::Animation
end
end
#===============================================================================
# Shows a Pokémon fainting
#===============================================================================
@@ -682,8 +654,6 @@ class Battle::Scene::Animation::BattlerFaint < Battle::Scene::Animation
end
end
#===============================================================================
# Shows the player's Poké Ball being thrown to capture a Pokémon
#===============================================================================
@@ -836,8 +806,6 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
end
end
#===============================================================================
# Shows the player throwing a Poké Ball and it being deflected
#===============================================================================

View File

@@ -71,8 +71,7 @@ class Battle::DebugSceneNoVisuals
def pbChangePokemon(idxBattler, pkmn); end
def pbFaintBattler(battler); end
def pbEXPBar(battler, startExp, endExp, tempExp1, tempExp2); end
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,
oldSpAtk, oldSpDef, oldSpeed); end
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense, oldSpAtk, oldSpDef, oldSpeed); end
def pbForgetMove(pkmn, moveToLearn); return 0; end # Always forget first move
def pbCommandMenu(idxBattler, firstAction)

View File

@@ -26,10 +26,10 @@ module Battle::CatchAndStoreMixin
when 0 # Add to your party
pbDisplay(_INTL("Choose a Pokémon in your party to send to your Boxes."))
party_index = -1
@scene.pbPartyScreen(0, (@sendToBoxes != 2), 1) { |idxParty, _partyScene|
@scene.pbPartyScreen(0, (@sendToBoxes != 2), 1) do |idxParty, _partyScene|
party_index = idxParty
next true
}
end
next if party_index < 0 # Cancelled
party_size = pbPlayer.party.length
# Send chosen Pokémon to storage
@@ -56,11 +56,11 @@ module Battle::CatchAndStoreMixin
when 1 # Send to a Box
break
when 2 # See X's summary
pbFadeOutIn {
pbFadeOutIn do
summary_scene = PokemonSummary_Scene.new
summary_screen = PokemonSummaryScreen.new(summary_scene, true)
summary_screen.pbStartScreen([pkmn], 0)
}
end
when 3 # Check party
@scene.pbPartyScreen(0, true, 2)
end

View File

@@ -51,8 +51,9 @@ class Battle
end
end
#===============================================================================
#
#===============================================================================
class Battle::Battler
unless @__clauses__aliased
alias __clauses__pbCanSleep? pbCanSleep?
@@ -100,9 +101,10 @@ class Battle::Battler
end
end
class Battle::Move::RaiseUserEvasion1 # Double Team
#===============================================================================
# Double Team
#===============================================================================
class Battle::Move::RaiseUserEvasion1
unless method_defined?(:__clauses__pbMoveFailed?)
alias __clauses__pbMoveFailed? pbMoveFailed?
end
@@ -116,9 +118,10 @@ class Battle::Move::RaiseUserEvasion1 # Double Team
end
end
class Battle::Move::RaiseUserEvasion2MinimizeUser # Minimize
#===============================================================================
# Minimize
#===============================================================================
class Battle::Move::RaiseUserEvasion2MinimizeUser
unless method_defined?(:__clauses__pbMoveFailed?)
alias __clauses__pbMoveFailed? pbMoveFailed?
end
@@ -132,9 +135,10 @@ class Battle::Move::RaiseUserEvasion2MinimizeUser # Minimize
end
end
class Battle::Move::UserTargetSwapAbilities # Skill Swap
#===============================================================================
# Skill Swap
#===============================================================================
class Battle::Move::UserTargetSwapAbilities
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
end
@@ -148,9 +152,10 @@ class Battle::Move::UserTargetSwapAbilities # Skill Swap
end
end
class Battle::Move::FixedDamage20 # Sonic Boom
#===============================================================================
# Sonic Boom
#===============================================================================
class Battle::Move::FixedDamage20
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
end
@@ -164,9 +169,10 @@ class Battle::Move::FixedDamage20 # Sonic Boom
end
end
class Battle::Move::FixedDamage40 # Dragon Rage
#===============================================================================
# Dragon Rage
#===============================================================================
class Battle::Move::FixedDamage40
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
end
@@ -180,8 +186,9 @@ class Battle::Move::FixedDamage40 # Dragon Rage
end
end
#===============================================================================
#
#===============================================================================
class Battle::Move::OHKO
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
@@ -196,8 +203,9 @@ class Battle::Move::OHKO
end
end
#===============================================================================
#
#===============================================================================
class Battle::Move::OHKOIce
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
@@ -212,8 +220,9 @@ class Battle::Move::OHKOIce
end
end
#===============================================================================
#
#===============================================================================
class Battle::Move::OHKOHitsUndergroundTarget
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
@@ -228,9 +237,10 @@ class Battle::Move::OHKOHitsUndergroundTarget
end
end
class Battle::Move::UserFaintsExplosive # Self-Destruct
#===============================================================================
# Self-Destruct
#===============================================================================
class Battle::Move::UserFaintsExplosive
unless method_defined?(:__clauses__pbMoveFailed?)
alias __clauses__pbMoveFailed? pbMoveFailed?
end
@@ -259,9 +269,10 @@ class Battle::Move::UserFaintsExplosive # Self-Destruct
end
end
class Battle::Move::StartPerishCountsForAllBattlers # Perish Song
#===============================================================================
# Perish Song
#===============================================================================
class Battle::Move::StartPerishCountsForAllBattlers
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
end
@@ -276,9 +287,10 @@ class Battle::Move::StartPerishCountsForAllBattlers # Perish Song
end
end
class Battle::Move::AttackerFaintsIfUserFaints # Destiny Bond
#===============================================================================
# Destiny Bond
#===============================================================================
class Battle::Move::AttackerFaintsIfUserFaints
unless method_defined?(:__clauses__pbFailsAgainstTarget?)
alias __clauses__pbFailsAgainstTarget? pbFailsAgainstTarget?
end

View File

@@ -29,8 +29,6 @@ class AnimFrame
FOCUS = 26
end
#===============================================================================
#
#===============================================================================
@@ -166,8 +164,6 @@ def pbConvertRPGAnimation(animation)
return pbAnim
end
#===============================================================================
#
#===============================================================================
@@ -230,8 +226,6 @@ class RPG::Animation
end
end
#===============================================================================
#
#===============================================================================
@@ -310,7 +304,7 @@ class PBAnimTiming
text = sprintf("[%d] Set FG: \"%s\"", @frame + 1, name)
text += sprintf(" (color=%s,%s,%s,%s)",
@colorRed || "-",
@colorGreen | "-",
@colorGreen || "-",
@colorBlue || "-",
@colorAlpha || "-")
text += sprintf(" (opacity=%d)", @opacity)
@@ -333,8 +327,6 @@ class PBAnimTiming
end
end
#===============================================================================
#
#===============================================================================
@@ -397,8 +389,6 @@ class PBAnimations < Array
end
end
#===============================================================================
#
#===============================================================================
@@ -598,8 +588,6 @@ class PBAnimation < Array
end
end
#===============================================================================
#
#===============================================================================
@@ -678,8 +666,6 @@ def pbSpriteSetAnimFrame(sprite, frame, user = nil, target = nil, inEditor = fal
end
end
#===============================================================================
# Animation player
#===============================================================================

View File

@@ -888,10 +888,7 @@ Battle::AbilityEffects::MoveBlocking.add(:DAZZLING,
next false if battle.choices[user.index][4] <= 0
next false if !bearer.opposes?(user)
ret = false
targets.each do |b|
next if !b.opposes?(user)
ret = true
end
targets.each { |b| ret = true if b.opposes?(user) }
next ret
}
)
@@ -1243,9 +1240,7 @@ Battle::AbilityEffects::DamageCalcFromUser.add(:DRAGONSMAW,
Battle::AbilityEffects::DamageCalcFromUser.add(:FLAREBOOST,
proc { |ability, user, target, move, mults, baseDmg, type|
if user.burned? && move.specialMove?
mults[:base_damage_multiplier] *= 1.5
end
mults[:base_damage_multiplier] *= 1.5 if user.burned? && move.specialMove?
}
)
@@ -1387,9 +1382,7 @@ Battle::AbilityEffects::DamageCalcFromUser.add(:SOLARPOWER,
Battle::AbilityEffects::DamageCalcFromUser.add(:SNIPER,
proc { |ability, user, target, move, mults, baseDmg, type|
if target.damageState.critical
mults[:final_damage_multiplier] *= 1.5
end
mults[:final_damage_multiplier] *= 1.5 if target.damageState.critical
}
)
@@ -1549,9 +1542,7 @@ Battle::AbilityEffects::DamageCalcFromTarget.add(:FURCOAT,
Battle::AbilityEffects::DamageCalcFromTarget.add(:GRASSPELT,
proc { |ability, user, target, move, mults, baseDmg, type|
if user.battle.field.terrain == :Grassy
mults[:defense_multiplier] *= 1.5
end
mults[:defense_multiplier] *= 1.5 if user.battle.field.terrain == :Grassy
}
)
@@ -1613,9 +1604,7 @@ Battle::AbilityEffects::DamageCalcFromTargetNonIgnorable.add(:PRISMARMOR,
Battle::AbilityEffects::DamageCalcFromTargetNonIgnorable.add(:SHADOWSHIELD,
proc { |ability, user, target, move, mults, baseDmg, type|
if target.hp == target.totalhp
mults[:final_damage_multiplier] /= 2
end
mults[:final_damage_multiplier] /= 2 if target.hp == target.totalhp
}
)
@@ -2428,7 +2417,7 @@ Battle::AbilityEffects::EndOfRoundEffect.add(:BADDREAMS,
next if !b.near?(battler) || !b.asleep?
battle.pbShowAbilitySplash(battler)
next if !b.takesIndirectDamage?(Battle::Scene::USE_ABILITY_SPLASH)
b.pbTakeEffectDamage(b.totalhp / 8) { |hp_lost|
b.pbTakeEffectDamage(b.totalhp / 8) do |hp_lost|
if Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1} is tormented!", b.pbThis))
else
@@ -2436,7 +2425,7 @@ Battle::AbilityEffects::EndOfRoundEffect.add(:BADDREAMS,
b.pbThis, battler.pbThis(true), battler.abilityName))
end
battle.pbHideAbilitySplash(battler)
}
end
end
}
)

View File

@@ -889,9 +889,7 @@ Battle::ItemEffects::DamageCalcFromUser.add(:LIFEORB,
Battle::ItemEffects::DamageCalcFromUser.add(:LIGHTBALL,
proc { |item, user, target, move, mults, baseDmg, type|
if user.isSpecies?(:PIKACHU)
mults[:attack_multiplier] *= 2
end
mults[:attack_multiplier] *= 2 if user.isSpecies?(:PIKACHU)
}
)
@@ -1844,9 +1842,9 @@ Battle::ItemEffects::EndOfRoundHealing.add(:BLACKSLUDGE,
battler.pbThis, battler.itemName))
elsif battler.takesIndirectDamage?
battle.pbCommonAnimation("UseItem", battler)
battler.pbTakeEffectDamage(battler.totalhp / 8) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8) do |hp_lost|
battle.pbDisplay(_INTL("{1} is hurt by its {2}!", battler.pbThis, battler.itemName))
}
end
end
}
)
@@ -1876,9 +1874,9 @@ Battle::ItemEffects::EndOfRoundEffect.add(:STICKYBARB,
proc { |item, battler, battle|
next if !battler.takesIndirectDamage?
battle.scene.pbDamageAnimation(battler)
battler.pbTakeEffectDamage(battler.totalhp / 8, false) { |hp_lost|
battler.pbTakeEffectDamage(battler.totalhp / 8, false) do |hp_lost|
battle.pbDisplay(_INTL("{1} is hurt by its {2}!", battler.pbThis, battler.itemName))
}
end
}
)

View File

@@ -54,8 +54,6 @@ class Battle::FakeBattler
def pbReset; end
end
#===============================================================================
# Data box for safari battles
#===============================================================================
@@ -93,8 +91,6 @@ class Battle::Scene::SafariDataBox < Sprite
end
end
#===============================================================================
# Shows the player throwing bait at a wild Pokémon in a Safari battle.
#===============================================================================
@@ -159,8 +155,6 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation
end
end
#===============================================================================
# Shows the player throwing a rock at a wild Pokémon in a Safari battle.
#===============================================================================
@@ -222,8 +216,6 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation
end
end
#===============================================================================
# Safari Zone battle scene (the visuals of the battle)
#===============================================================================
@@ -280,8 +272,6 @@ class Battle::Scene
end
end
#===============================================================================
# Safari Zone battle class
#===============================================================================
@@ -308,9 +298,9 @@ class SafariBattle
def pbRandom(x); return rand(x); end
#=============================================================================
#-----------------------------------------------------------------------------
# Initialize the battle class
#=============================================================================
#-----------------------------------------------------------------------------
def initialize(scene, player, party2)
@scene = scene
@peer = Battle::Peer.new
@@ -335,9 +325,9 @@ class SafariBattle
def defaultWeather=(value); @weather = value; end
def defaultTerrain=(value); end
#=============================================================================
#-----------------------------------------------------------------------------
# Information about the type and size of the battle
#=============================================================================
#-----------------------------------------------------------------------------
def wildBattle?; return true; end
def trainerBattle?; return false; end
@@ -347,9 +337,9 @@ class SafariBattle
return @sideSizes[index % 2]
end
#=============================================================================
#-----------------------------------------------------------------------------
# Trainers and owner-related
#=============================================================================
#-----------------------------------------------------------------------------
def pbPlayer; return @player[0]; end
def opponent; return nil; end
@@ -374,18 +364,18 @@ class SafariBattle
end
end
#=============================================================================
#-----------------------------------------------------------------------------
# Get party info (counts all teams on the same side)
#=============================================================================
#-----------------------------------------------------------------------------
def pbParty(idxBattler)
return (opposes?(idxBattler)) ? @party2 : nil
end
def pbAllFainted?(idxBattler = 0); return false; end
#=============================================================================
#-----------------------------------------------------------------------------
# Battler-related
#=============================================================================
#-----------------------------------------------------------------------------
def opposes?(idxBattler1, idxBattler2 = 0)
idxBattler1 = idxBattler1.index if idxBattler1.respond_to?("index")
idxBattler2 = idxBattler2.index if idxBattler2.respond_to?("index")
@@ -395,9 +385,9 @@ class SafariBattle
def pbRemoveFromParty(idxBattler, idxParty); end
def pbGainExp; end
#=============================================================================
#-----------------------------------------------------------------------------
# Messages and animations
#=============================================================================
#-----------------------------------------------------------------------------
def pbDisplay(msg, &block)
@scene.pbDisplayMessage(msg, &block)
end
@@ -414,17 +404,15 @@ class SafariBattle
return @scene.pbDisplayConfirmMessage(msg)
end
class BattleAbortedException < Exception; end
def pbAbort
raise BattleAbortedException.new("Battle aborted")
end
#=============================================================================
#-----------------------------------------------------------------------------
# Safari battle-specific methods
#=============================================================================
#-----------------------------------------------------------------------------
def pbEscapeRate(catch_rate)
return 125 if catch_rate <= 45 # Escape factor 9 (45%)
return 100 if catch_rate <= 60 # Escape factor 7 (35%)

View File

@@ -26,8 +26,6 @@ class Battle::Scene
end
end
#===============================================================================
# Bug Catching Contest battle class
#===============================================================================

View File

@@ -164,8 +164,6 @@ class BattlePalaceBattle < Battle
end
end
#===============================================================================
#
#===============================================================================

View File

@@ -35,8 +35,6 @@ class Battle::SuccessState
end
end
#===============================================================================
#
#===============================================================================
@@ -203,8 +201,6 @@ class BattleArenaBattle < Battle
end
end
#===============================================================================
#
#===============================================================================
@@ -221,8 +217,6 @@ class Battle::AI
end
end
#===============================================================================
#
#===============================================================================
@@ -277,10 +271,10 @@ class Battle::Scene
msgwindow = pbCreateMessageWindow
dimmingvp = Viewport.new(0, 0, Graphics.width, Graphics.height - msgwindow.height)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!\\wtnp[20]")) {
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!\\wtnp[20]")) do
pbBattleArenaUpdate
dimmingvp.update
}
end
dimmingvp.z = 99999
infowindow = SpriteWindow_Base.new(80, 0, 320, 224)
infowindow.contents = Bitmap.new(infowindow.width - infowindow.borderX,
@@ -305,25 +299,25 @@ class Battle::Scene
end
updateJudgment(infowindow, 1, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!\\wtnp[40]")) {
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!\\wtnp[40]")) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
updateJudgment(infowindow, 2, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!\\wtnp[40]")) {
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!\\wtnp[40]")) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
updateJudgment(infowindow, 3, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!\\wtnp[40]")) {
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!\\wtnp[40]")) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
total1 = 0
total2 = 0
3.times do |i|
@@ -332,27 +326,27 @@ class Battle::Scene
end
if total1 == total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!\\wtnp[40]", total1, total2)) {
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!\\wtnp[40]", total1, total2)) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
elsif total1 > total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}'s {4}!\\wtnp[40]",
total1, total2, @battle.pbGetOwnerName(battler1.index), battler1.name)) {
total1, total2, @battle.pbGetOwnerName(battler1.index), battler1.name)) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
else
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}!\\wtnp[40]",
total1, total2, battler2.name)) {
total1, total2, battler2.name)) do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
}
end
end
infowindow.visible = false
msgwindow.visible = false