mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Split PokeBattle_Trainer into PlayerTrainer and NPCTrainer
This commit is contained in:
@@ -496,7 +496,7 @@ class Interpreter
|
||||
when 7 # other
|
||||
case @parameters[4]
|
||||
when 0 then value = $game_map.map_id # map ID
|
||||
when 1 then value = $Trainer.pokemonParty.length # party members
|
||||
when 1 then value = $Trainer.pokemon_party.length # party members
|
||||
when 2 then value = $Trainer.money # gold
|
||||
# when 3 # steps
|
||||
when 4 then value = Graphics.frame_count / Graphics.frame_rate # play time
|
||||
@@ -955,7 +955,7 @@ class Interpreter
|
||||
# * Recover All
|
||||
#-----------------------------------------------------------------------------
|
||||
def command_314
|
||||
pbHealAll if @parameters[0] == 0
|
||||
$Trainer.heal_party if @parameters[0] == 0
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
@@ -105,14 +105,15 @@ module GameData
|
||||
break
|
||||
end
|
||||
# Create trainer object
|
||||
trainer = PokeBattle_Trainer.new(tr_name, @trainer_type)
|
||||
trainer.setForeignID($Trainer)
|
||||
party = []
|
||||
trainer = NPCTrainer.new(tr_name, @trainer_type)
|
||||
trainer.id = $Trainer.make_foreign_ID
|
||||
trainer.items = @items.clone
|
||||
trainer.lose_text = self.lose_text
|
||||
# Create each Pokémon owned by the trainer
|
||||
@pokemon.each do |pkmn_data|
|
||||
species = GameData::Species.get(pkmn_data[:species]).species
|
||||
pkmn = Pokemon.new(species, pkmn_data[:level], trainer, false)
|
||||
party.push(pkmn)
|
||||
trainer.party.push(pkmn)
|
||||
# Set Pokémon's properties if defined
|
||||
if pkmn_data[:form]
|
||||
pkmn.forced_form = pkmn_data[:form] if MultipleForms.hasFunction?(species, "getForm")
|
||||
@@ -130,7 +131,7 @@ module GameData
|
||||
if pkmn_data[:nature]
|
||||
pkmn.nature = pkmn_data[:nature]
|
||||
else
|
||||
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainertype).id_number
|
||||
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainer_type).id_number
|
||||
pkmn.nature = nature % (PBNatures.maxValue + 1)
|
||||
end
|
||||
PBStats.eachStat do |s|
|
||||
@@ -155,7 +156,7 @@ module GameData
|
||||
pkmn.poke_ball = pbBallTypeToItem(pkmn_data[:poke_ball]) if pkmn_data[:poke_ball]
|
||||
pkmn.calcStats
|
||||
end
|
||||
return [trainer, @items.clone, party, self.lose_text]
|
||||
return trainer
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -191,7 +191,7 @@ class PokeBattle_Battler
|
||||
|
||||
def owned?
|
||||
return false if !@battle.wildBattle?
|
||||
return $Trainer.owned[displaySpecies]
|
||||
return $Trainer.owned?(displaySpecies)
|
||||
end
|
||||
alias owned owned?
|
||||
|
||||
@@ -259,7 +259,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Badge multiplier
|
||||
if @battle.internalBattle && pbOwnedByPlayer? &&
|
||||
@battle.pbPlayer.numbadges>=NUM_BADGES_BOOST_SPEED
|
||||
@battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPEED
|
||||
speedMult *= 1.1
|
||||
end
|
||||
# Calculation
|
||||
|
||||
@@ -109,8 +109,8 @@ class PokeBattle_Battler
|
||||
return true if !@battle.pbOwnedByPlayer?(@index)
|
||||
disobedient = false
|
||||
# Pokémon may be disobedient; calculate if it is
|
||||
badgeLevel = 10*(@battle.pbPlayer.numbadges+1)
|
||||
badgeLevel = PBExperience.maxLevel if @battle.pbPlayer.numbadges>=8
|
||||
badgeLevel = 10 * (@battle.pbPlayer.badge_count + 1)
|
||||
badgeLevel = PBExperience.maxLevel if @battle.pbPlayer.badge_count >= 8
|
||||
if @pokemon.foreign?(@battle.pbPlayer) && @level>badgeLevel
|
||||
a = ((@level+badgeLevel)*@battle.pbRandom(256)/256).floor
|
||||
disobedient |= (a>=badgeLevel)
|
||||
|
||||
@@ -357,16 +357,16 @@ class PokeBattle_Move
|
||||
# Badge multipliers
|
||||
if @battle.internalBattle
|
||||
if user.pbOwnedByPlayer?
|
||||
if physicalMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_ATTACK
|
||||
if physicalMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_ATTACK
|
||||
multipliers[:attack_multiplier] *= 1.1
|
||||
elsif specialMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_SPATK
|
||||
elsif specialMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPATK
|
||||
multipliers[:attack_multiplier] *= 1.1
|
||||
end
|
||||
end
|
||||
if target.pbOwnedByPlayer?
|
||||
if physicalMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_DEFENSE
|
||||
if physicalMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_DEFENSE
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
elsif specialMove? && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_SPDEF
|
||||
elsif specialMove? && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPDEF
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,7 +45,7 @@ module PokeBattle_BattleCommon
|
||||
pbSeenForm(pkmn) # In case the form changed upon leaving battle
|
||||
# Record the Pokémon's species as owned in the Pokédex
|
||||
if !pbPlayer.hasOwned?(pkmn.species)
|
||||
pbPlayer.setOwned(pkmn.species)
|
||||
pbPlayer.set_owned(pkmn.species)
|
||||
if $Trainer.pokedex
|
||||
pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pkmn.name))
|
||||
@scene.pbShowPokedex(pkmn.species)
|
||||
@@ -53,8 +53,8 @@ module PokeBattle_BattleCommon
|
||||
end
|
||||
# Record a Shadow Pokémon's species as having been caught
|
||||
if pkmn.shadowPokemon?
|
||||
pbPlayer.shadowcaught = {} if !pbPlayer.shadowcaught
|
||||
pbPlayer.shadowcaught[pkmn.species] = true
|
||||
pbPlayer.owned_shadow = {} if !pbPlayer.owned_shadow
|
||||
pbPlayer.owned_shadow[pkmn.species] = true
|
||||
end
|
||||
# Store caught Pokémon
|
||||
pbStorePokemon(pkmn)
|
||||
@@ -194,7 +194,7 @@ module PokeBattle_BattleCommon
|
||||
# Critical capture check
|
||||
if ENABLE_CRITICAL_CAPTURES
|
||||
c = 0
|
||||
numOwned = $Trainer.pokedexOwned
|
||||
numOwned = $Trainer.owned_count
|
||||
if numOwned>600; c = x*5/12
|
||||
elsif numOwned>450; c = x*4/12
|
||||
elsif numOwned>300; c = x*3/12
|
||||
|
||||
@@ -115,8 +115,8 @@ class PokeBattle_Battle
|
||||
@caughtPokemon = []
|
||||
player = [player] if !player.nil? && !player.is_a?(Array)
|
||||
opponent = [opponent] if !opponent.nil? && !opponent.is_a?(Array)
|
||||
@player = player # Array of PokeBattle_Trainer objects, or nil
|
||||
@opponent = opponent # Array of PokeBattle_Trainer objects, or nil
|
||||
@player = player # Array of PlayerTrainer/NPCTrainer objects, or nil
|
||||
@opponent = opponent # Array of NPCTrainer objects, or nil
|
||||
@items = nil
|
||||
@endSpeeches = []
|
||||
@endSpeechesWin = []
|
||||
@@ -249,8 +249,8 @@ class PokeBattle_Battle
|
||||
|
||||
def pbGetOwnerName(idxBattler)
|
||||
idxTrainer = pbGetOwnerIndexFromBattlerIndex(idxBattler)
|
||||
return @opponent[idxTrainer].fullname if opposes?(idxBattler) # Opponent
|
||||
return @player[idxTrainer].fullname if idxTrainer>0 # Ally trainer
|
||||
return @opponent[idxTrainer].full_name if opposes?(idxBattler) # Opponent
|
||||
return @player[idxTrainer].full_name if idxTrainer>0 # Ally trainer
|
||||
return @player[idxTrainer].name # Player
|
||||
end
|
||||
|
||||
@@ -622,7 +622,7 @@ class PokeBattle_Battle
|
||||
|
||||
def pbSetSeen(battler)
|
||||
return if !battler || !@internalBattle
|
||||
pbPlayer.seen[battler.displaySpecies] = true
|
||||
pbPlayer.set_seen(battler.displaySpecies)
|
||||
pbSeenForm(battler.displaySpecies,battler.displayGender,battler.displayForm)
|
||||
end
|
||||
|
||||
|
||||
@@ -174,13 +174,13 @@ class PokeBattle_Battle
|
||||
else # Trainer battle
|
||||
case @opponent.length
|
||||
when 1
|
||||
pbDisplayPaused(_INTL("You are challenged by {1}!",@opponent[0].fullname))
|
||||
pbDisplayPaused(_INTL("You are challenged by {1}!",@opponent[0].full_name))
|
||||
when 2
|
||||
pbDisplayPaused(_INTL("You are challenged by {1} and {2}!",@opponent[0].fullname,
|
||||
@opponent[1].fullname))
|
||||
pbDisplayPaused(_INTL("You are challenged by {1} and {2}!",@opponent[0].full_name,
|
||||
@opponent[1].full_name))
|
||||
when 3
|
||||
pbDisplayPaused(_INTL("You are challenged by {1}, {2} and {3}!",
|
||||
@opponent[0].fullname,@opponent[1].fullname,@opponent[2].fullname))
|
||||
@opponent[0].full_name,@opponent[1].full_name,@opponent[2].full_name))
|
||||
end
|
||||
end
|
||||
# Send out Pokémon (opposing trainers first)
|
||||
@@ -196,12 +196,12 @@ class PokeBattle_Battle
|
||||
sent = sendOuts[side][i]
|
||||
case sent.length
|
||||
when 1
|
||||
msg += _INTL("{1} sent out {2}!",t.fullname,@battlers[sent[0]].name)
|
||||
msg += _INTL("{1} sent out {2}!",t.full_name,@battlers[sent[0]].name)
|
||||
when 2
|
||||
msg += _INTL("{1} sent out {2} and {3}!",t.fullname,
|
||||
msg += _INTL("{1} sent out {2} and {3}!",t.full_name,
|
||||
@battlers[sent[0]].name,@battlers[sent[1]].name)
|
||||
when 3
|
||||
msg += _INTL("{1} sent out {2}, {3} and {4}!",t.fullname,
|
||||
msg += _INTL("{1} sent out {2}, {3} and {4}!",t.full_name,
|
||||
@battlers[sent[0]].name,@battlers[sent[1]].name,@battlers[sent[2]].name)
|
||||
end
|
||||
toSendOut.concat(sent)
|
||||
@@ -339,7 +339,7 @@ class PokeBattle_Battle
|
||||
if trainerBattle?
|
||||
tMoney = 0
|
||||
@opponent.each_with_index do |t,i|
|
||||
tMoney += pbMaxLevelInTeam(1,i)*t.moneyEarned
|
||||
tMoney += pbMaxLevelInTeam(1, i) * t.base_money
|
||||
end
|
||||
tMoney *= 2 if @field.effects[PBEffects::AmuletCoin]
|
||||
tMoney *= 2 if @field.effects[PBEffects::HappyHour]
|
||||
@@ -368,7 +368,7 @@ class PokeBattle_Battle
|
||||
return if $game_switches[NO_MONEY_LOSS]
|
||||
maxLevel = pbMaxLevelInTeam(0,0) # Player's Pokémon only, not partner's
|
||||
multiplier = [8,16,24,36,48,64,80,100,120]
|
||||
idxMultiplier = [pbPlayer.numbadges,multiplier.length-1].min
|
||||
idxMultiplier = [pbPlayer.badge_count, multiplier.length - 1].min
|
||||
tMoney = maxLevel*multiplier[idxMultiplier]
|
||||
tMoney = pbPlayer.money if tMoney>pbPlayer.money
|
||||
oldMoney = pbPlayer.money
|
||||
@@ -395,13 +395,13 @@ class PokeBattle_Battle
|
||||
@scene.pbTrainerBattleSuccess
|
||||
case @opponent.length
|
||||
when 1
|
||||
pbDisplayPaused(_INTL("You defeated {1}!",@opponent[0].fullname))
|
||||
pbDisplayPaused(_INTL("You defeated {1}!",@opponent[0].full_name))
|
||||
when 2
|
||||
pbDisplayPaused(_INTL("You defeated {1} and {2}!",@opponent[0].fullname,
|
||||
@opponent[1].fullname))
|
||||
pbDisplayPaused(_INTL("You defeated {1} and {2}!",@opponent[0].full_name,
|
||||
@opponent[1].full_name))
|
||||
when 3
|
||||
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!",@opponent[0].fullname,
|
||||
@opponent[1].fullname,@opponent[2].fullname))
|
||||
pbDisplayPaused(_INTL("You defeated {1}, {2} and {3}!",@opponent[0].full_name,
|
||||
@opponent[1].full_name,@opponent[2].full_name))
|
||||
end
|
||||
@opponent.each_with_index do |_t,i|
|
||||
@scene.pbShowOpponent(i)
|
||||
@@ -423,13 +423,13 @@ class PokeBattle_Battle
|
||||
if trainerBattle?
|
||||
case @opponent.length
|
||||
when 1
|
||||
pbDisplayPaused(_INTL("You lost against {1}!",@opponent[0].fullname))
|
||||
pbDisplayPaused(_INTL("You lost against {1}!",@opponent[0].full_name))
|
||||
when 2
|
||||
pbDisplayPaused(_INTL("You lost against {1} and {2}!",
|
||||
@opponent[0].fullname,@opponent[1].fullname))
|
||||
@opponent[0].full_name,@opponent[1].full_name))
|
||||
when 3
|
||||
pbDisplayPaused(_INTL("You lost against {1}, {2} and {3}!",
|
||||
@opponent[0].fullname,@opponent[1].fullname,@opponent[2].fullname))
|
||||
@opponent[0].full_name,@opponent[1].full_name,@opponent[2].full_name))
|
||||
end
|
||||
end
|
||||
# Lose money from losing a battle
|
||||
|
||||
@@ -172,7 +172,7 @@ class PokeBattle_Battle
|
||||
idxPartyForName = pbLastInTeam(idxBattler)
|
||||
end
|
||||
if pbDisplayConfirm(_INTL("{1} is about to send in {2}. Will you switch your Pokémon?",
|
||||
opponent.fullname,enemyParty[idxPartyForName].name))
|
||||
opponent.full_name, enemyParty[idxPartyForName].name))
|
||||
idxPlayerPartyNew = pbSwitchInBetween(0,false,true)
|
||||
if idxPlayerPartyNew>=0
|
||||
pbMessageOnRecall(@battlers[0])
|
||||
@@ -270,7 +270,7 @@ class PokeBattle_Battle
|
||||
end
|
||||
else
|
||||
owner = pbGetOwnerFromBattlerIndex(idxBattler)
|
||||
pbDisplayBrief(_INTL("{1} sent out {2}!",owner.fullname,newPkmnName))
|
||||
pbDisplayBrief(_INTL("{1} sent out {2}!",owner.full_name,newPkmnName))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class PokeBattle_Battle
|
||||
end
|
||||
end
|
||||
# NOTE: Add your own Mega objects for particular NPC trainers here.
|
||||
# if pbGetOwnerFromBattlerIndex(idxBattler).trainertype == :BUGCATCHER
|
||||
# if pbGetOwnerFromBattlerIndex(idxBattler).trainer_type == :BUGCATCHER
|
||||
# return _INTL("Mega Net")
|
||||
# end
|
||||
return _INTL("Mega Ring")
|
||||
|
||||
@@ -11,7 +11,7 @@ class PokeBattle_AI
|
||||
shouldSwitch = forceSwitch
|
||||
batonPass = -1
|
||||
moveType = -1
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler).skill || 0
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler).skill_level || 0
|
||||
battler = @battle.battlers[idxBattler]
|
||||
# If Pokémon is within 6 levels of the foe, and foe's last move was
|
||||
# super-effective and powerful
|
||||
|
||||
@@ -8,7 +8,7 @@ class PokeBattle_AI
|
||||
wildBattler = (@battle.wildBattle? && @battle.opposes?(idxBattler))
|
||||
skill = 0
|
||||
if !wildBattler
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(user.index).skill || 0
|
||||
skill = @battle.pbGetOwnerFromBattlerIndex(user.index).skill_level || 0
|
||||
end
|
||||
# Get scores and targets for each move
|
||||
# NOTE: A move is only added to the choices array if it has a non-zero
|
||||
|
||||
@@ -418,9 +418,9 @@ class PokeBattle_AI
|
||||
# Don't need to check the Atk/Sp Atk-boosting badges because the AI
|
||||
# won't control the player's Pokémon.
|
||||
if target.pbOwnedByPlayer?
|
||||
if move.physicalMove?(type) && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_DEFENSE
|
||||
if move.physicalMove?(type) && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_DEFENSE
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
elsif move.specialMove?(type) && @battle.pbPlayer.numbadges >= NUM_BADGES_BOOST_SPDEF
|
||||
elsif move.specialMove?(type) && @battle.pbPlayer.badge_count >= NUM_BADGES_BOOST_SPDEF
|
||||
multipliers[:defense_multiplier] *= 1.1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -109,7 +109,7 @@ module PokeBattle_BallAnimationMixin
|
||||
end
|
||||
# Back sprite is animated, make the Poké Ball track the trainer's hand
|
||||
coordSets = [[traSprite.x-44,traSprite.y-32],[-10,-36],[118,-4]]
|
||||
case @trainer.trainertype
|
||||
case @trainer.trainer_type
|
||||
when :POKEMONTRAINER_Leaf
|
||||
coordSets = [[traSprite.x-30,traSprite.y-30],[-18,-36],[118,-6]]
|
||||
when :POKEMONTRAINER_Brendan
|
||||
|
||||
@@ -65,12 +65,12 @@ class PokeBattle_Scene
|
||||
end
|
||||
# Player's and partner trainer's back sprite
|
||||
@battle.player.each_with_index do |p,i|
|
||||
pbCreateTrainerBackSprite(i,p.trainertype,@battle.player.length)
|
||||
pbCreateTrainerBackSprite(i,p.trainer_type,@battle.player.length)
|
||||
end
|
||||
# Opposing trainer(s) sprites
|
||||
if @battle.trainerBattle?
|
||||
@battle.opponent.each_with_index do |p,i|
|
||||
pbCreateTrainerFrontSprite(i,p.trainertype,@battle.opponent.length)
|
||||
pbCreateTrainerFrontSprite(i,p.trainer_type,@battle.opponent.length)
|
||||
end
|
||||
end
|
||||
# Data boxes and Pokémon sprites
|
||||
|
||||
@@ -43,7 +43,7 @@ class PokeBattle_FakeBattler
|
||||
def captured=(value); end
|
||||
|
||||
def owned?
|
||||
return $Trainer.owned[pokemon.species]
|
||||
return $Trainer.owned?(pokemon.species)
|
||||
end
|
||||
|
||||
def pbThis(lowerCase=false)
|
||||
@@ -421,7 +421,7 @@ class PokeBattle_SafariZone
|
||||
def pbStartBattle
|
||||
begin
|
||||
pkmn = @party2[0]
|
||||
self.pbPlayer.seen[pkmn.species] = true
|
||||
self.pbPlayer.set_seen(pkmn.species)
|
||||
pbSeenForm(pkmn)
|
||||
@scene.pbStartBattle(self)
|
||||
pbDisplayPaused(_INTL("Wild {1} appeared!",pkmn.name))
|
||||
|
||||
@@ -97,7 +97,7 @@ class PokeBattle_BattleArena < PokeBattle_Battle
|
||||
@count += 1
|
||||
# Update skill rating
|
||||
for side in 0...2
|
||||
@skill[side] += self.successStates[side].skill
|
||||
@skill[side] += self.successStates[side].skill_level
|
||||
end
|
||||
# PBDebug.log("[Mind: #{@mind.inspect}, Skill: #{@skill.inspect}]")
|
||||
if @count==3
|
||||
|
||||
@@ -30,12 +30,12 @@ module PokeBattle_RecordedBattleModule
|
||||
if trainer.is_a?(Array)
|
||||
ret = []
|
||||
for i in 0...trainer.length
|
||||
ret.push([trainer[i].trainertype,trainer[i].name.clone,trainer[i].id,trainer[i].badges.clone])
|
||||
ret.push([trainer[i].trainer_type,trainer[i].name.clone,trainer[i].id,trainer[i].badges.clone])
|
||||
end
|
||||
return ret
|
||||
else
|
||||
return [
|
||||
[trainer.trainertype,trainer.name.clone,trainer.id,trainer.badges.clone]
|
||||
[trainer.trainer_type,trainer.name.clone,trainer.id,trainer.badges.clone]
|
||||
]
|
||||
end
|
||||
end
|
||||
@@ -146,15 +146,15 @@ module BattlePlayerHelper
|
||||
return nil if !trainer
|
||||
if trainer.length>1
|
||||
ret = []
|
||||
ret[0]=PokeBattle_Trainer.new(trainer[0][1],trainer[0][0])
|
||||
ret[0]=PlayerTrainer.new(trainer[0][1],trainer[0][0])
|
||||
ret[0].id = trainer[0][2]
|
||||
ret[0].badges = trainer[0][3]
|
||||
ret[1] = PokeBattle_Trainer.new(trainer[1][1],trainer[1][0])
|
||||
ret[1] = PlayerTrainer.new(trainer[1][1],trainer[1][0])
|
||||
ret[1].id = trainer[1][2]
|
||||
ret[1].badges = trainer[1][3]
|
||||
return ret
|
||||
else
|
||||
ret = PokeBattle_Trainer.new(trainer[0][1],trainer[0][0])
|
||||
ret = PlayerTrainer.new(trainer[0][1],trainer[0][0])
|
||||
ret.id = trainer[0][2]
|
||||
ret.badges = trainer[0][3]
|
||||
return ret
|
||||
|
||||
@@ -120,7 +120,7 @@ BallHandlers::ModifyCatchRate.add(:NESTBALL,proc { |ball,catchRate,battle,battle
|
||||
|
||||
BallHandlers::ModifyCatchRate.add(:REPEATBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
|
||||
multiplier = (NEW_POKE_BALL_CATCH_RATES) ? 3.5 : 3
|
||||
catchRate *= multiplier if battle.pbPlayer.owned[battler.species]
|
||||
catchRate *= multiplier if battle.pbPlayer.owned?(battler.species)
|
||||
next catchRate
|
||||
})
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ Events.onMapUpdate += proc { |_sender,_e|
|
||||
last = $PokemonGlobal.pokerusTime
|
||||
now = pbGetTimeNow
|
||||
if !last || last.year!=now.year || last.month!=now.month || last.day!=now.day
|
||||
for i in $Trainer.pokemonParty
|
||||
for i in $Trainer.pokemon_party
|
||||
i.lowerPokerusCount
|
||||
end
|
||||
$PokemonGlobal.pokerusTime = now
|
||||
@@ -263,7 +263,7 @@ Events.onStepTaken += proc {
|
||||
$PokemonGlobal.happinessSteps = 0 if !$PokemonGlobal.happinessSteps
|
||||
$PokemonGlobal.happinessSteps += 1
|
||||
if $PokemonGlobal.happinessSteps>=128
|
||||
for pkmn in $Trainer.ablePokemonParty
|
||||
for pkmn in $Trainer.able_party
|
||||
pkmn.changeHappiness("walking") if rand(2)==0
|
||||
end
|
||||
$PokemonGlobal.happinessSteps = 0
|
||||
@@ -276,7 +276,7 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
|
||||
next if handled[0]
|
||||
if $PokemonGlobal.stepcount%4==0 && POISON_IN_FIELD
|
||||
flashed = false
|
||||
for i in $Trainer.ablePokemonParty
|
||||
for i in $Trainer.able_party
|
||||
if i.status==PBStatuses::POISON && !i.hasAbility?(:IMMUNITY)
|
||||
if !flashed
|
||||
$game_screen.start_flash(Color.new(255,0,0,128), 4)
|
||||
@@ -292,7 +292,7 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
|
||||
i.status = PBStatuses::NONE
|
||||
pbMessage(_INTL("{1} fainted...",i.name))
|
||||
end
|
||||
if pbAllFainted
|
||||
if $Trainer.able_pokemon_count == 0
|
||||
handled[0] = true
|
||||
pbCheckAllFainted
|
||||
end
|
||||
@@ -302,7 +302,7 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
|
||||
}
|
||||
|
||||
def pbCheckAllFainted
|
||||
if pbAllFainted
|
||||
if $Trainer.able_pokemon_count == 0
|
||||
pbMessage(_INTL("You have no more Pokémon that can fight!\1"))
|
||||
pbMessage(_INTL("You blacked out!"))
|
||||
pbBGMFade(1.0)
|
||||
@@ -378,7 +378,7 @@ Events.onChangeDirection += proc {
|
||||
}
|
||||
|
||||
def pbBattleOnStepTaken(repel = false)
|
||||
return if $Trainer.ablePokemonCount == 0
|
||||
return if $Trainer.able_pokemon_count == 0
|
||||
encounterType = $PokemonEncounters.pbEncounterType
|
||||
return if encounterType < 0
|
||||
return if !$PokemonEncounters.isEncounterPossibleHere?
|
||||
@@ -387,7 +387,7 @@ def pbBattleOnStepTaken(repel = false)
|
||||
encounter = EncounterModifier.trigger(encounter)
|
||||
if $PokemonEncounters.pbCanEncounter?(encounter, repel)
|
||||
if !$PokemonTemp.forceSingleBattle && !pbInSafari? && ($PokemonGlobal.partner ||
|
||||
($Trainer.ablePokemonCount > 1 && PBTerrain.isDoubleWildBattle?(pbGetTerrainTag) && rand(100) < 30))
|
||||
($Trainer.able_pokemon_count > 1 && PBTerrain.isDoubleWildBattle?(pbGetTerrainTag) && rand(100) < 30))
|
||||
encounter2 = $PokemonEncounters.pbEncounteredPokemon(encounterType)
|
||||
encounter2 = EncounterModifier.trigger(encounter2)
|
||||
pbDoubleWildBattle(encounter[0], encounter[1], encounter2[0], encounter2[1])
|
||||
@@ -909,7 +909,7 @@ def pbFishingEnd
|
||||
end
|
||||
|
||||
def pbFishing(hasEncounter,rodType=1)
|
||||
speedup = ($Trainer.firstPokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($Trainer.firstPokemon.ability_id))
|
||||
speedup = ($Trainer.first_pokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($Trainer.first_pokemon.ability_id))
|
||||
biteChance = 20+(25*rodType) # 45, 70, 95
|
||||
biteChance *= 1.5 if speedup # 67.5, 100, 100
|
||||
hookChance = 100
|
||||
@@ -1059,13 +1059,11 @@ def pbRegisterPartner(tr_type, tr_name, tr_id = 0)
|
||||
pbCancelVehicles
|
||||
trainer = pbLoadTrainer(tr_type, tr_name, tr_id)
|
||||
Events.onTrainerPartyLoad.trigger(nil, trainer)
|
||||
trainerobject = PokeBattle_Trainer.new(trainer[0].name, tr_type)
|
||||
trainerobject.setForeignID($Trainer)
|
||||
for i in trainer[2]
|
||||
i.owner = Pokemon::Owner.new_from_trainer(trainerobject)
|
||||
for i in trainer.party
|
||||
i.owner = Pokemon::Owner.new_from_trainer(trainer)
|
||||
i.calcStats
|
||||
end
|
||||
$PokemonGlobal.partner = [tr_type, trainerobject.name, trainerobject.id, trainer[2]]
|
||||
$PokemonGlobal.partner = [tr_type, tr_name, trainer.id, trainer.party]
|
||||
end
|
||||
|
||||
def pbDeregisterPartner
|
||||
|
||||
@@ -131,7 +131,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
##### VS. animation, by Luka S.J. #####
|
||||
##### Tweaked by Maruno #####
|
||||
if (battletype==1 || battletype==3) && foe.length==1 # Against single trainer
|
||||
tr_type = foe[0].trainertype
|
||||
tr_type = foe[0].trainer_type
|
||||
tr_type_id = GameData::TrainerType.get(tr_type).id_number
|
||||
if tr_type
|
||||
tbargraphic = sprintf("Graphics/Transitions/vsBar%s", tr_type.to_s) rescue nil
|
||||
@@ -139,7 +139,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
tgraphic = sprintf("Graphics/Transitions/vsTrainer%s", tr_type.to_s) rescue nil
|
||||
tgraphic = sprintf("Graphics/Transitions/vsTrainer%d", tr_type_id) if !pbResolveBitmap(tgraphic)
|
||||
if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic)
|
||||
player_tr_type = $Trainer.trainertype
|
||||
player_tr_type = $Trainer.trainer_type
|
||||
player_tr_type_id = GameData::TrainerType.get(player_tr_type).id_number
|
||||
outfit = $Trainer.outfit
|
||||
# Set up
|
||||
@@ -631,7 +631,7 @@ def pbStartOver(gameover=false)
|
||||
pbBugContestStartOver
|
||||
return
|
||||
end
|
||||
pbHealAll
|
||||
$Trainer.heal_party
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
|
||||
if gameover
|
||||
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center."))
|
||||
@@ -653,7 +653,7 @@ def pbStartOver(gameover=false)
|
||||
if $DEBUG
|
||||
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
|
||||
end
|
||||
pbHealAll
|
||||
$Trainer.heal_party
|
||||
return
|
||||
end
|
||||
if gameover
|
||||
@@ -672,7 +672,7 @@ def pbStartOver(gameover=false)
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
else
|
||||
pbHealAll
|
||||
$Trainer.heal_party
|
||||
end
|
||||
end
|
||||
pbEraseEscapePoint
|
||||
|
||||
@@ -208,12 +208,12 @@ Events.onStartBattle += proc { |_sender|
|
||||
}
|
||||
|
||||
def pbCanDoubleBattle?
|
||||
return $PokemonGlobal.partner || $Trainer.ablePokemonCount>=2
|
||||
return $PokemonGlobal.partner || $Trainer.able_pokemon_count >= 2
|
||||
end
|
||||
|
||||
def pbCanTripleBattle?
|
||||
return true if $Trainer.ablePokemonCount>=3
|
||||
return $PokemonGlobal.partner && $Trainer.ablePokemonCount>=2
|
||||
return true if $Trainer.able_pokemon_count >= 3
|
||||
return $PokemonGlobal.partner && $Trainer.able_pokemon_count >= 2
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
@@ -223,8 +223,8 @@ def pbWildBattleCore(*args)
|
||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
if $Trainer.ablePokemonCount==0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $Trainer.pokemonCount>0
|
||||
if $Trainer.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $Trainer.pokemon_count > 0
|
||||
pbSet(outcomeVar,1) # Treat it as a win
|
||||
$PokemonTemp.clearBattleRules
|
||||
$PokemonGlobal.nextBattleBGM = nil
|
||||
@@ -266,7 +266,7 @@ def pbWildBattleCore(*args)
|
||||
room_for_partner = true
|
||||
end
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
|
||||
ally = PokeBattle_Trainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||
ally = NPCTrainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||
ally.id = $PokemonGlobal.partner[2]
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
playerTrainers.push(ally)
|
||||
@@ -360,16 +360,16 @@ def pbTrainerBattleCore(*args)
|
||||
outcomeVar = $PokemonTemp.battleRules["outcomeVar"] || 1
|
||||
canLose = $PokemonTemp.battleRules["canLose"] || false
|
||||
# Skip battle if the player has no able Pokémon, or if holding Ctrl in Debug mode
|
||||
if $Trainer.ablePokemonCount==0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
if $Trainer.able_pokemon_count == 0 || ($DEBUG && Input.press?(Input::CTRL))
|
||||
pbMessage(_INTL("SKIPPING BATTLE...")) if $DEBUG
|
||||
pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $Trainer.ablePokemonCount>0
|
||||
pbSet(outcomeVar,($Trainer.ablePokemonCount==0) ? 0 : 1) # Treat it as undecided/a win
|
||||
pbMessage(_INTL("AFTER WINNING...")) if $DEBUG && $Trainer.able_pokemon_count > 0
|
||||
pbSet(outcomeVar,($Trainer.able_pokemon_count == 0) ? 0 : 1) # Treat it as undecided/a win
|
||||
$PokemonTemp.clearBattleRules
|
||||
$PokemonGlobal.nextBattleBGM = nil
|
||||
$PokemonGlobal.nextBattleME = nil
|
||||
$PokemonGlobal.nextBattleCaptureME = nil
|
||||
$PokemonGlobal.nextBattleBack = nil
|
||||
return ($Trainer.ablePokemonCount==0) ? 0 : 1 # Treat it as undecided/a win
|
||||
return ($Trainer.able_pokemon_count == 0) ? 0 : 1 # Treat it as undecided/a win
|
||||
end
|
||||
# Record information about party Pokémon to be used at the end of battle (e.g.
|
||||
# comparing levels for an evolution check)
|
||||
@@ -382,24 +382,23 @@ def pbTrainerBattleCore(*args)
|
||||
foePartyStarts = []
|
||||
for arg in args
|
||||
raise _INTL("Expected an array of trainer data, got {1}.",arg) if !arg.is_a?(Array)
|
||||
if arg[0].is_a?(PokeBattle_Trainer)
|
||||
# [trainer object, party, end speech, items]
|
||||
foeTrainers.push(arg[0])
|
||||
if arg.is_a?(NPCTrainer)
|
||||
foeTrainers.push(arg)
|
||||
foePartyStarts.push(foeParty.length)
|
||||
arg[1].each { |pkmn| foeParty.push(pkmn) }
|
||||
foeEndSpeeches.push(arg[2])
|
||||
foeItems.push(arg[3])
|
||||
arg.party.each { |pkmn| foeParty.push(pkmn) }
|
||||
foeEndSpeeches.push(arg.lose_text)
|
||||
foeItems.push(arg.items)
|
||||
else
|
||||
# [trainer type, trainer name, ID, speech (optional)]
|
||||
trainer = pbLoadTrainer(arg[0],arg[1],arg[2])
|
||||
pbMissingTrainer(arg[0],arg[1],arg[2]) if !trainer
|
||||
return 0 if !trainer
|
||||
Events.onTrainerPartyLoad.trigger(nil,trainer)
|
||||
foeTrainers.push(trainer[0])
|
||||
foeTrainers.push(trainer)
|
||||
foePartyStarts.push(foeParty.length)
|
||||
trainer[2].each { |pkmn| foeParty.push(pkmn) }
|
||||
foeEndSpeeches.push(arg[3] || trainer[3])
|
||||
foeItems.push(trainer[1])
|
||||
trainer.party.each { |pkmn| foeParty.push(pkmn) }
|
||||
foeEndSpeeches.push(arg[3] || trainer.lose_text)
|
||||
foeItems.push(trainer.items)
|
||||
end
|
||||
end
|
||||
# Calculate who the player trainer(s) and their party are
|
||||
@@ -412,7 +411,7 @@ def pbTrainerBattleCore(*args)
|
||||
room_for_partner = true
|
||||
end
|
||||
if $PokemonGlobal.partner && !$PokemonTemp.battleRules["noPartner"] && room_for_partner
|
||||
ally = PokeBattle_Trainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
|
||||
ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
|
||||
ally.id = $PokemonGlobal.partner[2]
|
||||
ally.party = $PokemonGlobal.partner[3]
|
||||
playerTrainers.push(ally)
|
||||
@@ -469,8 +468,8 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
||||
# then trigger and cause the battle to happen against this first trainer and
|
||||
# themselves.
|
||||
if !$PokemonTemp.waitingTrainer && pbMapInterpreterRunning? &&
|
||||
($Trainer.ablePokemonCount>1 ||
|
||||
($Trainer.ablePokemonCount>0 && $PokemonGlobal.partner))
|
||||
($Trainer.able_pokemon_count > 1 ||
|
||||
($Trainer.able_pokemon_count > 0 && $PokemonGlobal.partner))
|
||||
thisEvent = pbMapInterpreter.get_character(0)
|
||||
# Find all other triggered trainer events
|
||||
triggeredEvents = $game_player.pbTriggeredTrainerEvents([2],false)
|
||||
@@ -488,8 +487,9 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
||||
# If there is exactly 1 other triggered trainer event, and this trainer has
|
||||
# 6 or fewer Pokémon, record this trainer for a double battle caused by the
|
||||
# other triggered trainer event
|
||||
if otherEvent.length==1 && trainer[2].length<=6
|
||||
$PokemonTemp.waitingTrainer = [trainer,endSpeech || trainer[3],thisEvent.id]
|
||||
if otherEvent.length == 1 && trainer.party.length <= MAX_PARTY_SIZE
|
||||
trainer.lose_text = endSpeech if endSpeech && !endSpeech.empty?
|
||||
$PokemonTemp.waitingTrainer = [trainer, thisEvent.id]
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -500,8 +500,7 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
||||
# Perform the battle
|
||||
if $PokemonTemp.waitingTrainer
|
||||
waitingTrainer = $PokemonTemp.waitingTrainer
|
||||
decision = pbTrainerBattleCore(
|
||||
[waitingTrainer[0][0],waitingTrainer[0][2],waitingTrainer[1],waitingTrainer[0][1]],
|
||||
decision = pbTrainerBattleCore($PokemonTemp.waitingTrainer,
|
||||
[trainerID,trainerName,trainerPartyID,endSpeech]
|
||||
)
|
||||
else
|
||||
@@ -509,7 +508,7 @@ def pbTrainerBattle(trainerID, trainerName, endSpeech=nil,
|
||||
end
|
||||
# Finish off the recorded waiting trainer, because they have now been battled
|
||||
if decision==1 && $PokemonTemp.waitingTrainer # Win
|
||||
pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[2],"A",true)
|
||||
pbMapInterpreter.pbSetSelfSwitch($PokemonTemp.waitingTrainer[1], "A", true)
|
||||
end
|
||||
$PokemonTemp.waitingTrainer = nil
|
||||
# Return true if the player won the battle, and false if any other result
|
||||
@@ -560,7 +559,7 @@ def pbAfterBattle(decision,canLose)
|
||||
pkmn.makeUnprimal
|
||||
end
|
||||
if $PokemonGlobal.partner
|
||||
pbHealAll
|
||||
$Trainer.heal_party
|
||||
$PokemonGlobal.partner[3].each do |pkmn|
|
||||
pkmn.heal
|
||||
pkmn.makeUnmega
|
||||
@@ -588,7 +587,7 @@ Events.onEndBattle += proc { |_sender,e|
|
||||
end
|
||||
case decision
|
||||
when 1, 4 # Win, capture
|
||||
$Trainer.pokemonParty.each do |pkmn|
|
||||
$Trainer.pokemon_party.each do |pkmn|
|
||||
pbPickup(pkmn)
|
||||
pbHoneyGather(pkmn)
|
||||
end
|
||||
|
||||
@@ -240,7 +240,7 @@ class PokemonEncounters
|
||||
# Static/Magnet Pull prefer wild encounters of certain types, if possible.
|
||||
# If they activate, they remove all Pokémon from the encounter table that do
|
||||
# not have the type they favor. If none have that type, nothing is changed.
|
||||
firstPkmn = $Trainer.firstPokemon
|
||||
firstPkmn = $Trainer.first_pokemon
|
||||
if firstPkmn && rand(100)<50 # 50% chance of happening
|
||||
favoredType = nil
|
||||
if firstPkmn.hasAbility?(:STATIC) && GameData::Type.exists?(:ELECTRIC)
|
||||
@@ -336,7 +336,7 @@ class PokemonEncounters
|
||||
encount *= 1.5
|
||||
end
|
||||
end
|
||||
firstPkmn = $Trainer.firstPokemon
|
||||
firstPkmn = $Trainer.first_pokemon
|
||||
if firstPkmn
|
||||
case firstPkmn.item_id
|
||||
when :CLEANSETAG
|
||||
@@ -382,7 +382,7 @@ class PokemonEncounters
|
||||
return false if $DEBUG && Input.press?(Input::CTRL)
|
||||
if !pbPokeRadarOnShakingGrass
|
||||
if $PokemonGlobal.repel>0 || repel
|
||||
firstPkmn = (REPEL_COUNTS_FAINTED_POKEMON) ? $Trainer.firstPokemon : $Trainer.firstAblePokemon
|
||||
firstPkmn = (REPEL_COUNTS_FAINTED_POKEMON) ? $Trainer.first_pokemon : $Trainer.first_able_pokemon
|
||||
return false if firstPkmn && encounter[1]<firstPkmn.level
|
||||
end
|
||||
end
|
||||
@@ -400,7 +400,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
|
||||
genwildpoke = Pokemon.new(species,level)
|
||||
# Give the wild Pokémon a held item
|
||||
items = genwildpoke.wildHoldItems
|
||||
firstPkmn = $Trainer.firstPokemon
|
||||
firstPkmn = $Trainer.first_pokemon
|
||||
chances = [50,5,1]
|
||||
chances = [60,20,5] if firstPkmn && firstPkmn.hasAbility?(:COMPOUNDEYES)
|
||||
itemrnd = rand(100)
|
||||
|
||||
@@ -30,16 +30,13 @@ Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
end
|
||||
}
|
||||
|
||||
# This is the basis of a trainer modifier. It works both for trainers loaded
|
||||
# This is the basis of a trainer modifier. It works both for trainers loaded
|
||||
# when you battle them, and for partner trainers when they are registered.
|
||||
# Note that you can only modify a partner trainer's Pokémon, and not the trainer
|
||||
# themselves nor their items this way, as those are generated from scratch
|
||||
# before each battle.
|
||||
#Events.onTrainerPartyLoad += proc { |_sender, e|
|
||||
# if e[0] # Trainer data should exist to be loaded, but may not exist somehow
|
||||
# trainer = e[0][0] # A PokeBattle_Trainer object of the loaded trainer
|
||||
# items = e[0][1] # An array of the trainer's items they can use
|
||||
# party = e[0][2] # An array of the trainer's Pokémon
|
||||
#Events.onTrainerPartyLoad += proc { |_sender, trainer|
|
||||
# if trainer # An NPCTrainer object containing party/items/lose text, etc.
|
||||
# YOUR CODE HERE
|
||||
# end
|
||||
#}
|
||||
|
||||
@@ -55,7 +55,7 @@ end
|
||||
def pbCheckHiddenMoveBadge(badge=-1,showmsg=true)
|
||||
return true if badge<0 # No badge requirement
|
||||
return true if $DEBUG
|
||||
if (FIELD_MOVES_COUNT_BADGES) ? $Trainer.numbadges>=badge : $Trainer.badges[badge]
|
||||
if (FIELD_MOVES_COUNT_BADGES) ? $Trainer.badge_count >= badge : $Trainer.badges[badge]
|
||||
return true
|
||||
end
|
||||
pbMessage(_INTL("Sorry, a new Badge is required.")) if showmsg
|
||||
@@ -187,7 +187,7 @@ end
|
||||
#===============================================================================
|
||||
def pbCut
|
||||
move = :CUT
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_CUT,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("This tree looks like it can be cut down."))
|
||||
return false
|
||||
@@ -297,7 +297,7 @@ def pbDive
|
||||
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
return false if !map_metadata || !map_metadata.dive_map_id
|
||||
move = :DIVE
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("The sea is deep here. A Pokémon may be able to go underwater."))
|
||||
return false
|
||||
@@ -333,7 +333,7 @@ def pbSurfacing
|
||||
end
|
||||
return if !surface_map_id
|
||||
move = :DIVE
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_DIVE,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
|
||||
return false
|
||||
@@ -536,7 +536,7 @@ def pbHeadbuttEffect(event=nil)
|
||||
event = $game_player.pbFacingEvent(true) if !event
|
||||
a = (event.x+(event.x/24).floor+1)*(event.y+(event.y/24).floor+1)
|
||||
a = (a*2/5)%10 # Even 2x as likely as odd, 0 is 1.5x as likely as odd
|
||||
b = ($Trainer.publicID)%10 # Practically equal odds of each value
|
||||
b = $Trainer.public_ID % 10 # Practically equal odds of each value
|
||||
chance = 1 # ~50%
|
||||
if a==b; chance = 8 # 10%
|
||||
elsif a>b && (a-b).abs<5; chance = 5 # ~30.3%
|
||||
@@ -554,7 +554,7 @@ end
|
||||
|
||||
def pbHeadbutt(event=nil)
|
||||
move = :HEADBUTT
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !$DEBUG && !movefinder
|
||||
pbMessage(_INTL("A Pokémon could be in this tree. Maybe a Pokémon could shake it."))
|
||||
return false
|
||||
@@ -599,7 +599,7 @@ end
|
||||
|
||||
def pbRockSmash
|
||||
move = :ROCKSMASH
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_ROCKSMASH,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("It's a rugged rock, but a Pokémon may be able to smash it."))
|
||||
return false
|
||||
@@ -646,7 +646,7 @@ def pbStrength
|
||||
return false
|
||||
end
|
||||
move = :STRENGTH
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_STRENGTH,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("It's a big boulder, but a Pokémon may be able to push it aside."))
|
||||
return false
|
||||
@@ -695,7 +695,7 @@ def pbSurf
|
||||
return false if $game_player.pbFacingEvent
|
||||
return false if $game_player.pbHasDependentEvents?
|
||||
move = :SURF
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_SURF,false) || (!$DEBUG && !movefinder)
|
||||
return false
|
||||
end
|
||||
@@ -947,7 +947,7 @@ end
|
||||
|
||||
def pbWaterfall
|
||||
move = :WATERFALL
|
||||
movefinder = pbCheckMove(move)
|
||||
movefinder = $Trainer.get_pokemon_with_move(move)
|
||||
if !pbCheckHiddenMoveBadge(BADGE_FOR_WATERFALL,false) || (!$DEBUG && !movefinder)
|
||||
pbMessage(_INTL("A wall of water is crashing down with a mighty roar."))
|
||||
return false
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
class PokeBattle_Trainer
|
||||
attr_accessor :name
|
||||
attr_accessor :id
|
||||
attr_writer :metaID
|
||||
attr_accessor :trainertype
|
||||
attr_writer :outfit
|
||||
attr_accessor :badges
|
||||
attr_reader :money
|
||||
attr_accessor :seen
|
||||
attr_accessor :owned
|
||||
attr_accessor :formseen
|
||||
attr_accessor :formlastseen
|
||||
attr_accessor :shadowcaught
|
||||
attr_accessor :party
|
||||
attr_accessor :pokedex # Whether the Pokédex was obtained
|
||||
attr_accessor :pokegear # Whether the Pokégear was obtained
|
||||
attr_writer :language
|
||||
|
||||
def trainerTypeName; return GameData::TrainerType.get(@trainertype).name; end
|
||||
def moneyEarned; return GameData::TrainerType.get(@trainertype).base_money; end
|
||||
def gender; return GameData::TrainerType.get(@trainertype).gender; end
|
||||
def male?; return GameData::TrainerType.get(@trainertype).male?; end
|
||||
def female?; return GameData::TrainerType.get(@trainertype).female?; end
|
||||
alias isMale? male?
|
||||
alias isFemale? female?
|
||||
def skill; return GameData::TrainerType.get(@trainertype).skill_level; end
|
||||
def skillCode; return GameData::TrainerType.get(@trainertype).skill_code; end
|
||||
|
||||
def hasSkillCode(code)
|
||||
c = skillCode
|
||||
return c && c != "" && c[/#{code}/]
|
||||
end
|
||||
|
||||
def fullname
|
||||
return _INTL("{1} {2}", trainerTypeName, @name)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Unique ID number
|
||||
#=============================================================================
|
||||
def publicID(id = nil) # Portion of the ID which is visible on the Trainer Card
|
||||
return id ? id & 0xFFFF : @id & 0xFFFF
|
||||
end
|
||||
|
||||
def secretID(id = nil) # Other portion of the ID
|
||||
return id ? id >> 16 : @id >> 16
|
||||
end
|
||||
|
||||
def getForeignID # Random ID other than this Trainer's ID
|
||||
fid = 0
|
||||
loop do
|
||||
fid = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
break if fid != @id
|
||||
end
|
||||
return fid
|
||||
end
|
||||
|
||||
def setForeignID(other)
|
||||
@id = other.getForeignID
|
||||
end
|
||||
|
||||
def metaID
|
||||
@metaID = $PokemonGlobal.playerID if !@metaID
|
||||
@metaID = 0 if !@metaID
|
||||
return @metaID
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Other properties
|
||||
#=============================================================================
|
||||
def outfit
|
||||
return @outfit || 0
|
||||
end
|
||||
|
||||
def language
|
||||
return @language || pbGetLanguage
|
||||
end
|
||||
|
||||
def money=(value)
|
||||
@money = [[value, MAX_MONEY].min, 0].max
|
||||
end
|
||||
|
||||
def numbadges # Number of badges
|
||||
ret = 0
|
||||
@badges.each { |b| ret += 1 if b }
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Party
|
||||
#=============================================================================
|
||||
def pokemonParty
|
||||
return @party.find_all { |p| p && !p.egg? }
|
||||
end
|
||||
|
||||
def ablePokemonParty
|
||||
return @party.find_all { |p| p && !p.egg? && !p.fainted? }
|
||||
end
|
||||
|
||||
def partyCount
|
||||
return @party.length
|
||||
end
|
||||
|
||||
def pokemonCount
|
||||
ret = 0
|
||||
@party.each { |p| ret += 1 if p && !p.egg? }
|
||||
return ret
|
||||
end
|
||||
|
||||
def ablePokemonCount
|
||||
ret = 0
|
||||
@party.each { |p| ret += 1 if p && !p.egg? && !p.fainted? }
|
||||
return ret
|
||||
end
|
||||
|
||||
def firstParty
|
||||
return nil if @party.length == 0
|
||||
return @party[0]
|
||||
end
|
||||
|
||||
def firstPokemon
|
||||
p = self.pokemonParty
|
||||
return nil if p.length == 0
|
||||
return p[0]
|
||||
end
|
||||
|
||||
def firstAblePokemon
|
||||
p = self.ablePokemonParty
|
||||
return nil if p.length == 0
|
||||
return p[0]
|
||||
end
|
||||
|
||||
def lastParty
|
||||
return nil if @party.length == 0
|
||||
return @party[@party.length - 1]
|
||||
end
|
||||
|
||||
def lastPokemon
|
||||
p = self.pokemonParty
|
||||
return nil if p.length == 0
|
||||
return p[p.length - 1]
|
||||
end
|
||||
|
||||
def lastAblePokemon
|
||||
p = self.ablePokemonParty
|
||||
return nil if p.length == 0
|
||||
return p[p.length - 1]
|
||||
end
|
||||
|
||||
def party_full?
|
||||
return @party.length >= MAX_PARTY_SIZE
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Pokédex
|
||||
#=============================================================================
|
||||
def pokedexSeen(region = -1) # Number of Pokémon seen
|
||||
ret = 0
|
||||
if region == -1
|
||||
GameData::Species.each { |s| ret += 1 if s.form == 0 && @seen[s.species] }
|
||||
else
|
||||
pbAllRegionalSpecies(region).each { |s| ret += 1 if s && @seen[s] }
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pokedexOwned(region = -1) # Number of Pokémon owned
|
||||
ret = 0
|
||||
if region == -1
|
||||
GameData::Species.each { |s| ret += 1 if s.form == 0 && @owned[s.species] }
|
||||
else
|
||||
pbAllRegionalSpecies(region).each { |s| ret += 1 if s && @owned[s] }
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def numFormsSeen(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
return 0 if !species_data
|
||||
species = species_data.species
|
||||
ret = 0
|
||||
@formseen[species] = [[], []] if !@formseen[species]
|
||||
array = @formseen[species]
|
||||
for i in 0...[array[0].length, array[1].length].max
|
||||
ret += 1 if array[0][i] || array[1][i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def seen?(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
return (species_data) ? @seen[species_data.species] : false
|
||||
end
|
||||
alias hasSeen? seen?
|
||||
|
||||
def owned?(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
return (species_data) ? @owned[species_data.species] : false
|
||||
end
|
||||
alias hasOwned? owned?
|
||||
|
||||
def setSeen(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
@seen[species_data.species] = true if species_data
|
||||
end
|
||||
|
||||
def setOwned(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
@owned[species_data.species] = true if species_data
|
||||
end
|
||||
|
||||
def clearPokedex
|
||||
@seen = {}
|
||||
@owned = {}
|
||||
@formseen = {}
|
||||
@formlastseen = {}
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Initializing
|
||||
#=============================================================================
|
||||
def initialize(name, trainertype)
|
||||
@name = name
|
||||
@language = pbGetLanguage
|
||||
@trainertype = trainertype
|
||||
@id = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
@metaID = 0
|
||||
@outfit = 0
|
||||
@pokegear = false
|
||||
@pokedex = false
|
||||
clearPokedex
|
||||
@shadowcaught = {}
|
||||
@badges = []
|
||||
for i in 0...8
|
||||
@badges[i] = false
|
||||
end
|
||||
@money = INITIAL_MONEY
|
||||
@party = []
|
||||
end
|
||||
end
|
||||
311
Data/Scripts/014_Trainers/001_Trainer.rb
Normal file
311
Data/Scripts/014_Trainers/001_Trainer.rb
Normal file
@@ -0,0 +1,311 @@
|
||||
#===============================================================================
|
||||
# Basic trainer class (use a child class rather than this one)
|
||||
#===============================================================================
|
||||
class Trainer
|
||||
attr_accessor :trainer_type
|
||||
attr_accessor :name
|
||||
attr_accessor :id
|
||||
attr_accessor :language
|
||||
attr_accessor :party
|
||||
|
||||
def full_name
|
||||
return _INTL("{1} {2}", trainer_type_name, @name)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
# Portion of the ID which is visible on the Trainer Card
|
||||
def public_ID(id = nil)
|
||||
return id ? id & 0xFFFF : @id & 0xFFFF
|
||||
end
|
||||
|
||||
# Other portion of the ID
|
||||
def secret_ID(id = nil)
|
||||
return id ? id >> 16 : @id >> 16
|
||||
end
|
||||
|
||||
# Random ID other than this Trainer's ID
|
||||
def make_foreign_ID
|
||||
loop do
|
||||
ret = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
return ret if ret != @id
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def trainer_type_name; return GameData::TrainerType.get(@trainer_type).name; end
|
||||
def base_money; return GameData::TrainerType.get(@trainer_type).base_money; end
|
||||
def gender; return GameData::TrainerType.get(@trainer_type).gender; end
|
||||
def male?; return GameData::TrainerType.get(@trainer_type).male?; end
|
||||
def female?; return GameData::TrainerType.get(@trainer_type).female?; end
|
||||
alias isMale? male?
|
||||
alias isFemale? female?
|
||||
def skill_level; return GameData::TrainerType.get(@trainer_type).skill_level; end
|
||||
def skill_code; return GameData::TrainerType.get(@trainer_type).skill_code; end
|
||||
|
||||
def has_skill_code?(code)
|
||||
c = skill_code
|
||||
return c && c != "" && c[/#{code}/]
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def pokemon_party
|
||||
return @party.find_all { |p| p && !p.egg? }
|
||||
end
|
||||
|
||||
def able_party
|
||||
return @party.find_all { |p| p && !p.egg? && !p.fainted? }
|
||||
end
|
||||
|
||||
def party_count
|
||||
return @party.length
|
||||
end
|
||||
|
||||
def pokemon_count
|
||||
ret = 0
|
||||
@party.each { |p| ret += 1 if p && !p.egg? }
|
||||
return ret
|
||||
end
|
||||
|
||||
def able_pokemon_count
|
||||
ret = 0
|
||||
@party.each { |p| ret += 1 if p && !p.egg? && !p.fainted? }
|
||||
return ret
|
||||
end
|
||||
|
||||
def party_full?
|
||||
return party_count >= MAX_PARTY_SIZE
|
||||
end
|
||||
|
||||
# Returns true if there are no usable Pokémon in the player's party.
|
||||
def all_fainted?
|
||||
return able_pokemon_count == 0
|
||||
end
|
||||
|
||||
def first_party
|
||||
return @party[0]
|
||||
end
|
||||
|
||||
def first_pokemon
|
||||
return pokemon_party[0]
|
||||
end
|
||||
|
||||
def first_able_pokemon
|
||||
return able_party[0]
|
||||
end
|
||||
|
||||
def last_party
|
||||
return (@party.length > 0) ? @party[@party.length - 1] : nil
|
||||
end
|
||||
|
||||
def last_pokemon
|
||||
p = pokemon_party
|
||||
return (p.length > 0) ? p[p.length - 1] : nil
|
||||
end
|
||||
|
||||
def last_able_pokemon
|
||||
p = able_party
|
||||
return (p.length > 0) ? p[p.length - 1] : nil
|
||||
end
|
||||
|
||||
def remove_pokemon_at_index(index)
|
||||
return false if index < 0 || index >= party_count
|
||||
have_able = false
|
||||
@party.each_with_index do |pkmn, i|
|
||||
have_able = true if i != index && pkmn.able?
|
||||
break if have_able
|
||||
end
|
||||
return false if !have_able
|
||||
@party.delete_at(index)
|
||||
return true
|
||||
end
|
||||
|
||||
# Checks whether the trainer would still have an unfainted Pokémon if the
|
||||
# Pokémon given by _index_ were removed from the party.
|
||||
def has_other_able_pokemon?(index)
|
||||
@party.each_with_index { |pkmn, i| return true if i != index && pkmn.able? }
|
||||
return false
|
||||
end
|
||||
|
||||
# Returns true if there is a Pokémon of the given species in the trainer's
|
||||
# party. You may also specify a particular form it should be.
|
||||
def has_species?(species, form = -1)
|
||||
return pokemon_party.any? { |p| p && p.isSpecies?(species) && (form < 0 || p.form == form) }
|
||||
end
|
||||
|
||||
# Returns whether there is a fatefully met Pokémon of the given species in the
|
||||
# trainer's party.
|
||||
def has_fateful_species?(species)
|
||||
return pokemon_party.any? { |p| p && p.isSpecies?(species) && p.obtain_method == 4 }
|
||||
end
|
||||
|
||||
# Returns whether there is a Pokémon with the given type in the trainer's
|
||||
# party.
|
||||
def has_pokemon_of_type?(type)
|
||||
return false if !GameData::Type.exists?(type)
|
||||
type = GameData::Type.get(type).id
|
||||
return pokemon_party.any? { |p| p && p.hasType(type) }
|
||||
end
|
||||
|
||||
# Checks whether any Pokémon in the party knows the given move, and returns
|
||||
# the first Pokémon it finds with that move, or nil if no Pokémon has that move.
|
||||
def get_pokemon_with_move(move)
|
||||
pokemon_party.each { |pkmn| return pkmn if pkmn.hasMove?(move) }
|
||||
return nil
|
||||
end
|
||||
|
||||
# Fully heal all Pokémon in the party.
|
||||
def heal_party
|
||||
@party.each { |pkmn| pkmn.heal }
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def initialize(name, trainer_type)
|
||||
@trainer_type = trainer_type
|
||||
@name = name
|
||||
@id = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
@language = pbGetLanguage
|
||||
@party = []
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Trainer class for NPC trainers
|
||||
#===============================================================================
|
||||
class NPCTrainer < Trainer
|
||||
attr_accessor :items
|
||||
attr_accessor :lose_text
|
||||
|
||||
def initialize(name, trainer_type)
|
||||
super
|
||||
@items = []
|
||||
@lose_text = GameData::TrainerType.get(@trainer_type).lose_text
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Trainer class for the player
|
||||
#===============================================================================
|
||||
class PlayerTrainer < Trainer
|
||||
attr_writer :character_ID
|
||||
attr_accessor :outfit
|
||||
attr_accessor :badges
|
||||
attr_reader :money
|
||||
attr_accessor :seen
|
||||
attr_accessor :owned
|
||||
attr_accessor :seen_forms
|
||||
attr_accessor :last_seen_forms
|
||||
attr_accessor :owned_shadow
|
||||
attr_accessor :pokedex # Whether the Pokédex was obtained
|
||||
attr_accessor :pokegear # Whether the Pokégear was obtained
|
||||
attr_accessor :mystery_gift_unlocked # Whether MG can be used from load screen
|
||||
attr_accessor :mystery_gifts # Variable that stores downloaded MG data
|
||||
|
||||
def character_ID
|
||||
@character_ID = $PokemonGlobal.playerID || 0 if !@character_ID
|
||||
return @character_ID
|
||||
end
|
||||
|
||||
def money=(value)
|
||||
@money = value.clamp(0, MAX_MONEY)
|
||||
end
|
||||
|
||||
def badge_count
|
||||
ret = 0
|
||||
@badges.each { |b| ret += 1 if b }
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def seen?(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
return (species_data) ? @seen[species_data.species] : false
|
||||
end
|
||||
alias hasSeen? seen?
|
||||
|
||||
def owned?(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
return (species_data) ? @owned[species_data.species] : false
|
||||
end
|
||||
alias hasOwned? owned?
|
||||
|
||||
def set_seen(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
@seen[species_data.species] = true if species_data
|
||||
end
|
||||
|
||||
def set_owned(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
@owned[species_data.species] = true if species_data
|
||||
end
|
||||
|
||||
def seen_count(region = -1)
|
||||
ret = 0
|
||||
if region == -1
|
||||
GameData::Species.each { |s| ret += 1 if s.form == 0 && @seen[s.species] }
|
||||
else
|
||||
pbAllRegionalSpecies(region).each { |s| ret += 1 if s && @seen[s] }
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def seen_any?(region = -1)
|
||||
if region == -1
|
||||
GameData::Species.each { |s| return true if s.form == 0 && @seen[s.species] }
|
||||
else
|
||||
pbAllRegionalSpecies(region).each { |s| return true if s && @seen[s] }
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def owned_count(region = -1)
|
||||
ret = 0
|
||||
if region == -1
|
||||
GameData::Species.each { |s| ret += 1 if s.form == 0 && @owned[s.species] }
|
||||
else
|
||||
pbAllRegionalSpecies(region).each { |s| ret += 1 if s && @owned[s] }
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def seen_forms_count(species)
|
||||
species_data = GameData::Species.try_get(species)
|
||||
return 0 if !species_data
|
||||
species = species_data.species
|
||||
ret = 0
|
||||
@seen_forms[species] = [[], []] if !@seen_forms[species]
|
||||
array = @seen_forms[species]
|
||||
for i in 0...[array[0].length, array[1].length].max
|
||||
ret += 1 if array[0][i] || array[1][i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def clear_pokedex
|
||||
@seen = {}
|
||||
@owned = {}
|
||||
@seen_forms = {}
|
||||
@last_seen_forms = {}
|
||||
@owned_shadow = {}
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
def initialize(name, trainer_type)
|
||||
super
|
||||
@character_ID = nil
|
||||
@outfit = 0
|
||||
@badges = [false] * 8
|
||||
@money = INITIAL_MONEY
|
||||
clear_pokedex
|
||||
@pokegear = false
|
||||
@pokedex = false
|
||||
@mystery_gift_unlocked = false
|
||||
@mystery_gifts = []
|
||||
end
|
||||
end
|
||||
125
Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb
Normal file
125
Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb
Normal file
@@ -0,0 +1,125 @@
|
||||
#===============================================================================
|
||||
# Deprecated
|
||||
#===============================================================================
|
||||
class PlayerTrainer
|
||||
alias fullname full_name
|
||||
alias publicID public_ID
|
||||
alias secretID secret_ID
|
||||
alias getForeignID make_foreign_ID
|
||||
alias trainerTypeName trainer_type_name
|
||||
alias moneyEarned base_money
|
||||
alias skill skill_level
|
||||
alias skillCode skill_code
|
||||
alias hasSkillCode has_skill_code?
|
||||
alias pokemonParty pokemon_party
|
||||
alias ablePokemonParty able_party
|
||||
alias partyCount party_count
|
||||
alias pokemonCount pokemon_count
|
||||
alias ablePokemonCount able_pokemon_count
|
||||
alias firstParty first_party
|
||||
alias firstPokemon first_pokemon
|
||||
alias firstAblePokemon first_able_pokemon
|
||||
alias lastParty last_party
|
||||
alias lastPokemon last_pokemon
|
||||
alias lastAblePokemon last_able_pokemon
|
||||
alias formseen seen_forms
|
||||
alias formlastseen last_seen_forms
|
||||
alias shadowcaught owned_shadow
|
||||
alias numbadges badge_count
|
||||
alias pokedexSeen seen_count
|
||||
alias pokedexOwned owned_count
|
||||
alias numFormsSeen seen_forms_count
|
||||
alias clearPokedex clear_pokedex
|
||||
alias metaID character_ID
|
||||
alias mysterygiftaccess mystery_gift_unlocked
|
||||
alias mysterygift mystery_gifts
|
||||
alias setSeen set_seen
|
||||
alias setOwned set_owned
|
||||
end
|
||||
|
||||
class PokeBattle_Trainer
|
||||
attr_reader :trainertype, :name, :id, :metaID, :outfit, :language
|
||||
attr_reader :party, :badges, :money
|
||||
attr_reader :seen, :owned, :formseen, :formlastseen, :shadowcaught
|
||||
attr_reader :pokedex, :pokegear
|
||||
attr_reader :mysterygiftaccess, :mysterygift
|
||||
|
||||
def self.copy(trainer)
|
||||
ret = PlayerTrainer.new
|
||||
ret.trainer_type = trainer.trainertype
|
||||
ret.name = trainer.name
|
||||
ret.id = trainer.id
|
||||
ret.character_ID = trainer.metaID if trainer.metaID
|
||||
ret.outfit = trainer.outfit if trainer.outfit
|
||||
ret.language = trainer.language if trainer.language
|
||||
trainer.party.each { |p| ret.party.push(Pokemon.copy(p)) }
|
||||
ret.badges = trainer.badges.clone
|
||||
ret.money = trainer.money
|
||||
trainer.seen.each_with_index { |value, i| ret.set_seen(i) if value }
|
||||
trainer.owned.each_with_index { |value, i| ret.set_owned(i) if value }
|
||||
ret.formseen.each_with_index do |value, i|
|
||||
ret.seen_forms[GameData::Species.get(i).species] = [value[0].clone, value[1].clone] if value
|
||||
end
|
||||
trainer.formlastseen.each_with_index do |value, i|
|
||||
ret.last_seen_forms[GameData::Species.get(i).species] = value.clone if value
|
||||
end
|
||||
if trainer.shadowcaught
|
||||
trainer.shadowcaught.each_with_index do |value, i|
|
||||
ret.owned_shadow[GameData::Species.get(i).species] = true if value
|
||||
end
|
||||
end
|
||||
ret.pokedex = trainer.pokedex
|
||||
ret.pokegear = trainer.pokegear
|
||||
ret.mystery_gift_unlocked = trainer.mysterygiftaccess if trainer.mysterygiftaccess
|
||||
ret.mystery_gifts = trainer.mysterygift.clone if trainer.mysterygift
|
||||
return ret
|
||||
end
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#remove_pokemon_at_index} instead. This alias is slated to be removed in v20.
|
||||
def pbRemovePokemonAt(index)
|
||||
Deprecation.warn_method('pbRemovePokemonAt', 'v20', 'PlayerTrainer#remove_pokemon_at_index')
|
||||
return $Trainer.remove_pokemon_at_index(index)
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#has_other_able_pokemon?} instead. This alias is slated to be removed in v20.
|
||||
def pbCheckAble(index)
|
||||
Deprecation.warn_method('pbCheckAble', 'v20', 'PlayerTrainer#has_other_able_pokemon?')
|
||||
return $Trainer.has_other_able_pokemon?(index)
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#all_fainted?} instead. This alias is slated to be removed in v20.
|
||||
def pbAllFainted
|
||||
Deprecation.warn_method('pbAllFainted', 'v20', 'PlayerTrainer#all_fainted?')
|
||||
return $Trainer.all_fainted?
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#has_species?} instead. This alias is slated to be removed in v20.
|
||||
def pbHasSpecies?(species, form = -1)
|
||||
Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_species?')
|
||||
return $Trainer.has_species?(species, form)
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#has_fateful_species?} instead. This alias is slated to be removed in v20.
|
||||
def pbHasFatefulSpecies?(species)
|
||||
Deprecation.warn_method('pbHasSpecies?', 'v20', 'PlayerTrainer#has_fateful_species?')
|
||||
return $Trainer.has_fateful_species?(species)
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#has_pokemon_of_type?} instead. This alias is slated to be removed in v20.
|
||||
def pbHasType?(type)
|
||||
Deprecation.warn_method('pbHasType?', 'v20', 'PlayerTrainer#has_pokemon_of_type?')
|
||||
return $Trainer.has_pokemon_of_type?(type)
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#get_pokemon_with_move} instead. This alias is slated to be removed in v20.
|
||||
def pbCheckMove(move)
|
||||
Deprecation.warn_method('pbCheckMove', 'v20', 'PlayerTrainer#get_pokemon_with_move')
|
||||
return $Trainer.get_pokemon_with_move(move)
|
||||
end
|
||||
|
||||
# @deprecated Use {PlayerTrainer#heal_party} instead. This alias is slated to be removed in v20.
|
||||
def pbHealAll
|
||||
Deprecation.warn_method('pbHealAll', 'v20', 'PlayerTrainer#heal_party')
|
||||
$Trainer.heal_party
|
||||
end
|
||||
@@ -465,7 +465,7 @@ def pbUseItem(bag,item,bagscene=nil)
|
||||
itm = GameData::Item.get(item)
|
||||
useType = itm.field_use
|
||||
if itm.is_machine? # TM or HM
|
||||
if $Trainer.pokemonCount==0
|
||||
if $Trainer.pokemon_count == 0
|
||||
pbMessage(_INTL("There is no Pokémon."))
|
||||
return 0
|
||||
end
|
||||
@@ -481,7 +481,7 @@ def pbUseItem(bag,item,bagscene=nil)
|
||||
end
|
||||
return 0
|
||||
elsif useType==1 || useType==5 # Item is usable on a Pokémon
|
||||
if $Trainer.pokemonCount==0
|
||||
if $Trainer.pokemon_count == 0
|
||||
pbMessage(_INTL("There is no Pokémon."))
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -187,12 +187,12 @@ ItemHandlers::UseInField.add(:ESCAPEROPE,proc { |item|
|
||||
})
|
||||
|
||||
ItemHandlers::UseInField.add(:SACREDASH,proc { |item|
|
||||
if $Trainer.pokemonCount==0
|
||||
if $Trainer.pokemon_count == 0
|
||||
pbMessage(_INTL("There is no Pokémon."))
|
||||
next 0
|
||||
end
|
||||
canrevive = false
|
||||
for i in $Trainer.pokemonParty
|
||||
for i in $Trainer.pokemon_party
|
||||
next if !i.fainted?
|
||||
canrevive = true; break
|
||||
end
|
||||
@@ -978,7 +978,7 @@ ItemHandlers::UseOnPokemon.add(:DNASPLICERS,proc { |item,pkmn,scene|
|
||||
newForm = 2 if poke2.isSpecies?(:ZEKROM)
|
||||
pkmn.setForm(newForm) {
|
||||
pkmn.fused = poke2
|
||||
pbRemovePokemonAt(chosen)
|
||||
$Trainer.remove_pokemon_at_index(chosen)
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name))
|
||||
}
|
||||
@@ -1027,7 +1027,7 @@ ItemHandlers::UseOnPokemon.add(:NSOLARIZER,proc { |item,pkmn,scene|
|
||||
end
|
||||
pkmn.setForm(1) {
|
||||
pkmn.fused = poke2
|
||||
pbRemovePokemonAt(chosen)
|
||||
$Trainer.remove_pokemon_at_index(chosen)
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name))
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene|
|
||||
end
|
||||
pkmn.setForm(2) {
|
||||
pkmn.fused = poke2
|
||||
pbRemovePokemonAt(chosen)
|
||||
$Trainer.remove_pokemon_at_index(chosen)
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name))
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ MultipleForms.register(:GRENINJA,{
|
||||
|
||||
MultipleForms.register(:SCATTERBUG,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next $Trainer.secretID%18
|
||||
next $Trainer.secret_ID % 18
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -501,7 +501,7 @@ Events.onEndBattle += proc { |_sender,_e|
|
||||
}
|
||||
|
||||
Events.onStepTaken += proc {
|
||||
for pkmn in $Trainer.ablePokemonParty
|
||||
for pkmn in $Trainer.able_party
|
||||
next if pkmn.heart_gauge == 0
|
||||
stage = pkmn.heartStage
|
||||
pkmn.adjustHeart(-1)
|
||||
|
||||
@@ -408,9 +408,7 @@ PBEvolution.register(:LevelDarkness, {
|
||||
|
||||
PBEvolution.register(:LevelDarkInParty, {
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
if pkmn.level >= parameter
|
||||
next $Trainer.pokemonParty.any? { |p| p && p.hasType(:DARK) }
|
||||
end
|
||||
next $Trainer.has_pokemon_of_type?(:DARK) if pkmn.level >= parameter
|
||||
}
|
||||
})
|
||||
|
||||
@@ -647,7 +645,7 @@ PBEvolution.register(:HasInParty, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"parameterType" => :Species,
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
next pbHasSpecies?(parameter)
|
||||
next $Trainer.has_species?(parameter)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -752,7 +752,7 @@ class Pokemon
|
||||
@owner = new_owner
|
||||
end
|
||||
|
||||
# @param trainer [PokeBattle_Trainer] the trainer to compare to the original trainer
|
||||
# @param trainer [PlayerTrainer, NPCTrainer] the trainer to compare to the original trainer
|
||||
# @return [Boolean] whether the given trainer is not this Pokémon's original trainer
|
||||
def foreign?(trainer)
|
||||
return @owner.id != trainer.id || @owner.name != trainer.name
|
||||
@@ -787,7 +787,7 @@ class Pokemon
|
||||
|
||||
# @return [String] the name of this Pokémon
|
||||
def name
|
||||
return (nicknamed?) ? @name || speciesName
|
||||
return (nicknamed?) ? @name : speciesName
|
||||
end
|
||||
|
||||
# @param value [String] the nickname of this Pokémon
|
||||
@@ -942,7 +942,7 @@ class Pokemon
|
||||
# Creates a new Pokémon object.
|
||||
# @param species [Symbol, String, Integer] Pokémon species
|
||||
# @param level [Integer] Pokémon level
|
||||
# @param owner [Owner, PokeBattle_Trainer] Pokémon owner (the player by default)
|
||||
# @param owner [Owner, PlayerTrainer, NPCTrainer] Pokémon owner (the player by default)
|
||||
# @param withMoves [Boolean] whether the Pokémon should have moves
|
||||
def initialize(species, level, owner = $Trainer, withMoves = true)
|
||||
species_data = GameData::Species.get(species)
|
||||
@@ -985,7 +985,7 @@ class Pokemon
|
||||
end
|
||||
if owner.is_a?(Owner)
|
||||
@owner = owner
|
||||
elsif owner.is_a?(PokeBattle_Trainer)
|
||||
elsif owner.is_a?(PlayerTrainer) || owner.is_a?(NPCTrainer)
|
||||
@owner = Owner.new_from_trainer(owner)
|
||||
else
|
||||
@owner = Owner.new(0, '', 2, 2)
|
||||
|
||||
@@ -25,10 +25,10 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Returns a new Owner object populated with values taken from +trainer+.
|
||||
# @param trainer [PokeBattle_Trainer] trainer object to read data from
|
||||
# @param trainer [PlayerTrainer, NPCTrainer] trainer object to read data from
|
||||
# @return [Owner] new Owner object
|
||||
def self.new_from_trainer(trainer)
|
||||
validate trainer => PokeBattle_Trainer
|
||||
validate trainer => [PlayerTrainer, NPCTrainer]
|
||||
return new(trainer.id, trainer.name, trainer.gender, trainer.language)
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ class Pokemon
|
||||
# @param language [Integer] owner language
|
||||
# @return [Owner] foreign Owner object
|
||||
def self.new_foreign(name = '', gender = 2, language = 2)
|
||||
return new($Trainer.getForeignID, name, gender, language)
|
||||
return new($Trainer.make_foreign_ID, name, gender, language)
|
||||
end
|
||||
|
||||
# @param new_id [Integer] new owner ID
|
||||
|
||||
@@ -106,8 +106,8 @@ class PokemonPokedexMenuScreen
|
||||
end
|
||||
end
|
||||
index = -1 if index >= $PokemonGlobal.pokedexUnlocked.length - 1
|
||||
commands2[i] = [$Trainer.pokedexSeen(index),
|
||||
$Trainer.pokedexOwned(index),
|
||||
commands2[i] = [$Trainer.seen_count(index),
|
||||
$Trainer.owned_count(index),
|
||||
pbGetRegionalDexLength(index)]
|
||||
end
|
||||
commands.push(_INTL("Exit"))
|
||||
|
||||
@@ -38,8 +38,8 @@ class Window_Pokedex < Window_DrawableCommand
|
||||
species = @commands[index][0]
|
||||
indexNumber = @commands[index][4]
|
||||
indexNumber -= 1 if @commands[index][5]
|
||||
if $Trainer.seen[species]
|
||||
if $Trainer.owned[species]
|
||||
if $Trainer.seen?(species)
|
||||
if $Trainer.owned?(species)
|
||||
pbCopyBitmap(self.contents,@pokeballOwn.bitmap,rect.x-6,rect.y+8)
|
||||
else
|
||||
pbCopyBitmap(self.contents,@pokeballSeen.bitmap,rect.x-6,rect.y+8)
|
||||
@@ -305,9 +305,9 @@ class PokemonPokedex_Scene
|
||||
def pbCanAddForModeList?(mode, species)
|
||||
case mode
|
||||
when MODEATOZ
|
||||
return $Trainer.seen[species]
|
||||
return $Trainer.seen?(species)
|
||||
when MODEHEAVIEST, MODELIGHTEST, MODETALLEST, MODESMALLEST
|
||||
return $Trainer.owned[species]
|
||||
return $Trainer.owned?(species)
|
||||
end
|
||||
return true # For MODENUMERICAL
|
||||
end
|
||||
@@ -342,11 +342,11 @@ class PokemonPokedex_Scene
|
||||
case $PokemonGlobal.pokedexMode
|
||||
when MODENUMERICAL
|
||||
# Hide the Dex number 0 species if unseen
|
||||
dexlist[0] = nil if dexlist[0][5] && !$Trainer.seen[dexlist[0][0]]
|
||||
dexlist[0] = nil if dexlist[0][5] && !$Trainer.seen?(dexlist[0][0])
|
||||
# Remove unseen species from the end of the list
|
||||
i = dexlist.length-1
|
||||
loop do break unless i>=0
|
||||
break if !dexlist[i] || $Trainer.seen[dexlist[i][0]]
|
||||
break if !dexlist[i] || $Trainer.seen?(dexlist[i][0])
|
||||
dexlist[i] = nil
|
||||
i -= 1
|
||||
end
|
||||
@@ -382,7 +382,7 @@ class PokemonPokedex_Scene
|
||||
base = Color.new(88,88,80)
|
||||
shadow = Color.new(168,184,184)
|
||||
iconspecies = @sprites["pokedex"].species
|
||||
iconspecies = nil if !$Trainer.seen[iconspecies]
|
||||
iconspecies = nil if !$Trainer.seen?(iconspecies)
|
||||
# Write various bits of text
|
||||
dexname = _INTL("Pokédex")
|
||||
if $PokemonGlobal.pokedexUnlocked.length>1
|
||||
@@ -400,9 +400,9 @@ class PokemonPokedex_Scene
|
||||
textpos.push([@dexlist.length.to_s,112,340,2,base,shadow])
|
||||
else
|
||||
textpos.push([_INTL("Seen:"),42,308,0,base,shadow])
|
||||
textpos.push([$Trainer.pokedexSeen(pbGetPokedexRegion).to_s,182,308,1,base,shadow])
|
||||
textpos.push([$Trainer.seen_count(pbGetPokedexRegion).to_s,182,308,1,base,shadow])
|
||||
textpos.push([_INTL("Owned:"),42,340,0,base,shadow])
|
||||
textpos.push([$Trainer.pokedexOwned(pbGetPokedexRegion).to_s,182,340,1,base,shadow])
|
||||
textpos.push([$Trainer.owned_count(pbGetPokedexRegion).to_s,182,340,1,base,shadow])
|
||||
end
|
||||
# Draw all text
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
@@ -675,10 +675,10 @@ class PokemonPokedex_Scene
|
||||
end
|
||||
|
||||
def setIconBitmap(species)
|
||||
$Trainer.formlastseen = {} if !$Trainer.formlastseen
|
||||
$Trainer.formlastseen[species] = [] if !$Trainer.formlastseen[species]
|
||||
gender = $Trainer.formlastseen[species][0] || 0
|
||||
form = $Trainer.formlastseen[species][1] || 0
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
$Trainer.last_seen_forms[species] = [] if !$Trainer.last_seen_forms[species]
|
||||
gender = $Trainer.last_seen_forms[species][0] || 0
|
||||
form = $Trainer.last_seen_forms[species][1] || 0
|
||||
@sprites["icon"].setSpeciesBitmap(species, gender, form)
|
||||
end
|
||||
|
||||
@@ -689,7 +689,7 @@ class PokemonPokedex_Scene
|
||||
if params[1]>=0
|
||||
scanNameCommand = @nameCommands[params[1]].scan(/./)
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$Trainer.seen[item[0]]
|
||||
next false if !$Trainer.seen?(item[0])
|
||||
firstChar = item[1][0,1]
|
||||
next scanNameCommand.any? { |v| v==firstChar }
|
||||
}
|
||||
@@ -699,7 +699,7 @@ class PokemonPokedex_Scene
|
||||
stype1 = (params[2]>=0) ? @typeCommands[params[2]].id : nil
|
||||
stype2 = (params[3]>=0) ? @typeCommands[params[3]].id : nil
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$Trainer.owned[item[0]]
|
||||
next false if !$Trainer.owned?(item[0])
|
||||
type1 = item[6]
|
||||
type2 = item[7]
|
||||
if stype1 && stype2
|
||||
@@ -721,7 +721,7 @@ class PokemonPokedex_Scene
|
||||
minh = (params[4]<0) ? 0 : (params[4]>=@heightCommands.length) ? 999 : @heightCommands[params[4]]
|
||||
maxh = (params[5]<0) ? 999 : (params[5]>=@heightCommands.length) ? 0 : @heightCommands[params[5]]
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$Trainer.owned[item[0]]
|
||||
next false if !$Trainer.owned?(item[0])
|
||||
height = item[2]
|
||||
next height>=minh && height<=maxh
|
||||
}
|
||||
@@ -731,7 +731,7 @@ class PokemonPokedex_Scene
|
||||
minw = (params[6]<0) ? 0 : (params[6]>=@weightCommands.length) ? 9999 : @weightCommands[params[6]]
|
||||
maxw = (params[7]<0) ? 9999 : (params[7]>=@weightCommands.length) ? 0 : @weightCommands[params[7]]
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$Trainer.owned[item[0]]
|
||||
next false if !$Trainer.owned?(item[0])
|
||||
weight = item[3]
|
||||
next weight>=minw && weight<=maxw
|
||||
}
|
||||
@@ -745,7 +745,7 @@ class PokemonPokedex_Scene
|
||||
end
|
||||
scolor = colorCommands[params[8]]
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$Trainer.seen[item[0]]
|
||||
next false if !$Trainer.seen?(item[0])
|
||||
color = item[8]
|
||||
next color==scolor
|
||||
}
|
||||
@@ -754,13 +754,13 @@ class PokemonPokedex_Scene
|
||||
if params[9]>=0
|
||||
sshape = @shapeCommands[params[9]]+1
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$Trainer.seen[item[0]]
|
||||
next false if !$Trainer.seen?(item[0])
|
||||
shape = item[9]
|
||||
next shape==sshape
|
||||
}
|
||||
end
|
||||
# Remove all unseen species from the results
|
||||
dexlist = dexlist.find_all { |item| next $Trainer.seen[item[0]] }
|
||||
dexlist = dexlist.find_all { |item| next $Trainer.seen?(item[0]) }
|
||||
case $PokemonGlobal.pokedexMode
|
||||
when MODENUMERICAL then dexlist.sort! { |a,b| a[4]<=>b[4] }
|
||||
when MODEATOZ then dexlist.sort! { |a,b| a[1]<=>b[1] }
|
||||
@@ -1166,7 +1166,7 @@ class PokemonPokedex_Scene
|
||||
break
|
||||
end
|
||||
elsif Input.trigger?(Input::C)
|
||||
if $Trainer.seen[@sprites["pokedex"].species]
|
||||
if $Trainer.seen?(@sprites["pokedex"].species)
|
||||
pbPlayDecisionSE
|
||||
pbDexEntry(@sprites["pokedex"].index)
|
||||
end
|
||||
|
||||
@@ -121,10 +121,10 @@ class PokemonPokedexInfo_Scene
|
||||
|
||||
def pbUpdateDummyPokemon
|
||||
@species = @dexlist[@index][0]
|
||||
$Trainer.formlastseen = {} if !$Trainer.formlastseen
|
||||
$Trainer.formlastseen[@species] = [] if !$Trainer.formlastseen[@species]
|
||||
@gender = $Trainer.formlastseen[@species][0] || 0
|
||||
@form = $Trainer.formlastseen[@species][1] || 0
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
$Trainer.last_seen_forms[@species] = [] if !$Trainer.last_seen_forms[@species]
|
||||
@gender = $Trainer.last_seen_forms[@species][0] || 0
|
||||
@form = $Trainer.last_seen_forms[@species][1] || 0
|
||||
species_data = GameData::Species.get_species_form(@species, @form)
|
||||
@sprites["infosprite"].setSpeciesBitmap(@species,@gender,@form)
|
||||
if @sprites["formfront"]
|
||||
@@ -149,16 +149,16 @@ class PokemonPokedexInfo_Scene
|
||||
next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?)
|
||||
next if sp.pokedex_form != sp.form
|
||||
multiple_forms = true if sp.form > 0
|
||||
$Trainer.formseen[@species] = [[], []] if !$Trainer.formseen[@species]
|
||||
$Trainer.seen_forms[@species] = [[], []] if !$Trainer.seen_forms[@species]
|
||||
case sp.gender_rate
|
||||
when PBGenderRates::AlwaysMale, PBGenderRates::AlwaysFemale, PBGenderRates::Genderless
|
||||
real_gender = (sp.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0
|
||||
next if !$Trainer.formseen[@species][real_gender][sp.form] && !DEX_SHOWS_ALL_FORMS
|
||||
next if !$Trainer.seen_forms[@species][real_gender][sp.form] && !DEX_SHOWS_ALL_FORMS
|
||||
real_gender = 2 if sp.gender_rate == PBGenderRates::Genderless
|
||||
ret.push([sp.form_name, real_gender, sp.form])
|
||||
else # Both male and female
|
||||
for real_gender in 0...2
|
||||
next if !$Trainer.formseen[@species][real_gender][sp.form] && !DEX_SHOWS_ALL_FORMS
|
||||
next if !$Trainer.seen_forms[@species][real_gender][sp.form] && !DEX_SHOWS_ALL_FORMS
|
||||
ret.push([sp.form_name, real_gender, sp.form])
|
||||
break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
|
||||
end
|
||||
@@ -223,7 +223,7 @@ class PokemonPokedexInfo_Scene
|
||||
[_INTL("Height"), 314, 158, 0, base, shadow],
|
||||
[_INTL("Weight"), 314, 190, 0, base, shadow]
|
||||
]
|
||||
if $Trainer.owned[@species]
|
||||
if $Trainer.owned?(@species)
|
||||
# Write the category
|
||||
textpos.push([_INTL("{1} Pokémon", species_data.category), 246, 74, 0, base, shadow])
|
||||
# Write the height and weight
|
||||
@@ -390,7 +390,7 @@ class PokemonPokedexInfo_Scene
|
||||
newindex = @index
|
||||
while newindex>0
|
||||
newindex -= 1
|
||||
if $Trainer.seen[@dexlist[newindex][0]]
|
||||
if $Trainer.seen?(@dexlist[newindex][0])
|
||||
@index = newindex
|
||||
break
|
||||
end
|
||||
@@ -401,7 +401,7 @@ class PokemonPokedexInfo_Scene
|
||||
newindex = @index
|
||||
while newindex<@dexlist.length-1
|
||||
newindex += 1
|
||||
if $Trainer.seen[@dexlist[newindex][0]]
|
||||
if $Trainer.seen?(@dexlist[newindex][0])
|
||||
@index = newindex
|
||||
break
|
||||
end
|
||||
@@ -419,10 +419,10 @@ class PokemonPokedexInfo_Scene
|
||||
oldindex = -1
|
||||
loop do
|
||||
if oldindex!=index
|
||||
$Trainer.formlastseen = {} if !$Trainer.formlastseen
|
||||
$Trainer.formlastseen[@species] = [] if !$Trainer.formlastseen
|
||||
$Trainer.formlastseen[@species][0] = @available[index][1]
|
||||
$Trainer.formlastseen[@species][1] = @available[index][2]
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
$Trainer.last_seen_forms[@species] = [] if !$Trainer.last_seen_forms
|
||||
$Trainer.last_seen_forms[@species][0] = @available[index][1]
|
||||
$Trainer.last_seen_forms[@species][1] = @available[index][2]
|
||||
pbUpdateDummyPokemon
|
||||
drawPage(@page)
|
||||
@sprites["uparrow"].visible = (index>0)
|
||||
|
||||
@@ -475,7 +475,7 @@ class PokemonBagScreen
|
||||
commands[cmdUse = commands.length] = _INTL("Use")
|
||||
end
|
||||
end
|
||||
commands[cmdGive = commands.length] = _INTL("Give") if $Trainer.pokemonParty.length>0 && itm.can_hold?
|
||||
commands[cmdGive = commands.length] = _INTL("Give") if $Trainer.pokemon_party.length > 0 && itm.can_hold?
|
||||
commands[cmdToss = commands.length] = _INTL("Toss") if !itm.is_important? || $DEBUG
|
||||
if @bag.pbIsRegistered?(item)
|
||||
commands[cmdRegister = commands.length] = _INTL("Deselect")
|
||||
@@ -498,7 +498,7 @@ class PokemonBagScreen
|
||||
@scene.pbRefresh
|
||||
next
|
||||
elsif cmdGive>=0 && command==cmdGive # Give item to Pokémon
|
||||
if $Trainer.pokemonCount==0
|
||||
if $Trainer.pokemon_count == 0
|
||||
@scene.pbDisplay(_INTL("There is no Pokémon."))
|
||||
elsif itm.is_important?
|
||||
@scene.pbDisplay(_INTL("The {1} can't be held.",itemname))
|
||||
|
||||
@@ -138,7 +138,7 @@ class PokemonRegionMap_Scene
|
||||
@sprites["mapbottom"].mapdetails = pbGetMapDetails(@mapX,@mapY)
|
||||
if playerpos && mapindex==playerpos[0]
|
||||
@sprites["player"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["player"].setBitmap(GameData::TrainerType.player_map_icon_filename($Trainer.trainertype))
|
||||
@sprites["player"].setBitmap(GameData::TrainerType.player_map_icon_filename($Trainer.trainer_type))
|
||||
@sprites["player"].x = -SQUAREWIDTH/2+(@mapX*SQUAREWIDTH)+(Graphics.width-@sprites["map"].bitmap.width)/2
|
||||
@sprites["player"].y = -SQUAREHEIGHT/2+(@mapY*SQUAREHEIGHT)+(Graphics.height-@sprites["map"].bitmap.height)/2
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class PokemonTrainerCard_Scene
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
@sprites["trainer"] = IconSprite.new(336,112,@viewport)
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.player_front_sprite_filename($Trainer.trainertype))
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.player_front_sprite_filename($Trainer.trainer_type))
|
||||
@sprites["trainer"].x -= (@sprites["trainer"].bitmap.width-128)/2
|
||||
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height-128)
|
||||
@sprites["trainer"].z = 2
|
||||
@@ -52,11 +52,11 @@ class PokemonTrainerCard_Scene
|
||||
[_INTL("Name"),34,64,0,baseColor,shadowColor],
|
||||
[$Trainer.name,302,64,1,baseColor,shadowColor],
|
||||
[_INTL("ID No."),332,64,0,baseColor,shadowColor],
|
||||
[sprintf("%05d",$Trainer.publicID($Trainer.id)),468,64,1,baseColor,shadowColor],
|
||||
[sprintf("%05d",$Trainer.public_ID),468,64,1,baseColor,shadowColor],
|
||||
[_INTL("Money"),34,112,0,baseColor,shadowColor],
|
||||
[_INTL("${1}",$Trainer.money.to_s_formatted),302,112,1,baseColor,shadowColor],
|
||||
[_INTL("Pokédex"),34,160,0,baseColor,shadowColor],
|
||||
[sprintf("%d/%d",$Trainer.pokedexOwned,$Trainer.pokedexSeen),302,160,1,baseColor,shadowColor],
|
||||
[sprintf("%d/%d",$Trainer.owned_count,$Trainer.seen_count),302,160,1,baseColor,shadowColor],
|
||||
[_INTL("Time"),34,208,0,baseColor,shadowColor],
|
||||
[time,302,208,1,baseColor,shadowColor],
|
||||
[_INTL("Started"),34,256,0,baseColor,shadowColor],
|
||||
|
||||
@@ -64,9 +64,9 @@ class PokemonLoadPanel < SpriteWrapper
|
||||
if @isContinue
|
||||
textpos.push([@title,16*2,5*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Badges:"),16*2,56*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.numbadges.to_s,103*2,56*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.badge_count.to_s,103*2,56*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Pokédex:"),16*2,72*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.pokedexSeen.to_s,103*2,72*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.seen_count.to_s,103*2,72*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Time:"),16*2,88*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
hour = @totalsec / 60 / 60
|
||||
min = @totalsec / 60 % 60
|
||||
@@ -163,7 +163,7 @@ class PokemonLoad_Scene
|
||||
|
||||
def pbSetParty(trainer)
|
||||
return if !trainer || !trainer.party
|
||||
meta = GameData::Metadata.get_player(trainer.metaID)
|
||||
meta = GameData::Metadata.get_player(trainer.character_ID)
|
||||
if meta
|
||||
filename = pbGetPlayerCharset(meta,1,trainer,true)
|
||||
@sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport)
|
||||
@@ -227,7 +227,7 @@ class PokemonLoadScreen
|
||||
pokemonSystem = Marshal.load(f)
|
||||
mapid = Marshal.load(f)
|
||||
}
|
||||
raise "Corrupted file" if !trainer.is_a?(PokeBattle_Trainer)
|
||||
raise "Corrupted file" if !trainer.is_a?(PlayerTrainer)
|
||||
raise "Corrupted file" if !framecount.is_a?(Numeric)
|
||||
raise "Corrupted file" if !game_system.is_a?(Game_System)
|
||||
raise "Corrupted file" if !pokemonSystem.is_a?(PokemonSystem)
|
||||
@@ -318,7 +318,7 @@ class PokemonLoadScreen
|
||||
end
|
||||
commands[cmdContinue = commands.length] = _INTL("Continue") if showContinue
|
||||
commands[cmdNewGame = commands.length] = _INTL("New Game")
|
||||
commands[cmdMysteryGift = commands.length] = _INTL("Mystery Gift") if (trainer.mysterygiftaccess rescue false)
|
||||
commands[cmdMysteryGift = commands.length] = _INTL("Mystery Gift") if trainer.mystery_gift_unlocked
|
||||
else
|
||||
commands[cmdNewGame = commands.length] = _INTL("New Game")
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#
|
||||
#===============================================================================
|
||||
def pbSave(safesave=false)
|
||||
$Trainer.metaID=$PokemonGlobal.playerID
|
||||
begin
|
||||
File.open(RTP.getSaveFileName("Game.rxdata"),"wb") { |f|
|
||||
Marshal.dump($Trainer,f)
|
||||
@@ -79,9 +78,9 @@ class PokemonSave_Scene
|
||||
else
|
||||
loctext+=_INTL("Time<r><c3={1}>{2}m</c3><br>",textColor,min)
|
||||
end
|
||||
loctext+=_INTL("Badges<r><c3={1}>{2}</c3><br>",textColor,$Trainer.numbadges)
|
||||
loctext+=_INTL("Badges<r><c3={1}>{2}</c3><br>",textColor,$Trainer.badge_count)
|
||||
if $Trainer.pokedex
|
||||
loctext+=_INTL("Pokédex<r><c3={1}>{2}/{3}</c3>",textColor,$Trainer.pokedexOwned,$Trainer.pokedexSeen)
|
||||
loctext+=_INTL("Pokédex<r><c3={1}>{2}/{3}</c3>",textColor,$Trainer.owned_count,$Trainer.seen_count)
|
||||
end
|
||||
@sprites["locwindow"]=Window_AdvancedTextPokemon.new(loctext)
|
||||
@sprites["locwindow"].viewport=@viewport
|
||||
|
||||
@@ -304,7 +304,7 @@ def pbUseKeyItem
|
||||
:WATERFALL, :WHIRLPOOL]
|
||||
real_moves = []
|
||||
moves.each do |move|
|
||||
$Trainer.pokemonParty.each_with_index do |pkmn, i|
|
||||
$Trainer.pokemon_party.each_with_index do |pkmn, i|
|
||||
next if !pkmn.hasMove?(move)
|
||||
real_moves.push([move, i]) if pbCanUseHiddenMove?(pkmn, move, false)
|
||||
end
|
||||
|
||||
@@ -199,8 +199,8 @@ def pbHatch(pokemon)
|
||||
pokemon.timeEggHatched = pbGetTimeNow
|
||||
pokemon.obtain_method = 1 # hatched from egg
|
||||
pokemon.hatched_map = $game_map.map_id
|
||||
$Trainer.seen[pokemon.species] = true
|
||||
$Trainer.owned[pokemon.species] = true
|
||||
$Trainer.set_seen(pokemon.species)
|
||||
$Trainer.set_owned(pokemon.species)
|
||||
pbSeenForm(pokemon)
|
||||
pokemon.record_first_moves
|
||||
if !pbHatchAnimation(pokemon)
|
||||
@@ -220,7 +220,7 @@ Events.onStepTaken += proc { |_sender,_e|
|
||||
for egg in $Trainer.party
|
||||
next if egg.steps_to_hatch <= 0
|
||||
egg.steps_to_hatch -= 1
|
||||
for i in $Trainer.pokemonParty
|
||||
for i in $Trainer.pokemon_party
|
||||
next if !i.hasAbility?(:FLAMEBODY) && !i.hasAbility?(:MAGMAARMOR)
|
||||
egg.steps_to_hatch -= 1
|
||||
break
|
||||
|
||||
@@ -588,8 +588,8 @@ class PokemonEvolutionScene
|
||||
@pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM)
|
||||
@pokemon.calcStats
|
||||
# See and own evolved species
|
||||
$Trainer.seen[@newspecies] = true
|
||||
$Trainer.owned[@newspecies] = true
|
||||
$Trainer.set_seen(@newspecies)
|
||||
$Trainer.set_owned(@newspecies)
|
||||
pbSeenForm(@pokemon)
|
||||
# Learn moves upon evolution for evolved species
|
||||
movelist = @pokemon.getMoveList
|
||||
@@ -619,8 +619,8 @@ class PokemonEvolutionScene
|
||||
# Add duplicate Pokémon to party
|
||||
$Trainer.party.push(new_pkmn)
|
||||
# See and own duplicate Pokémon
|
||||
$Trainer.seen[new_species] = true
|
||||
$Trainer.owned[new_species] = true
|
||||
$Trainer.set_seen(new_species)
|
||||
$Trainer.set_owned(new_species)
|
||||
pbSeenForm(new_pkmn)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -211,8 +211,8 @@ end
|
||||
#===============================================================================
|
||||
def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
|
||||
myPokemon = $Trainer.party[pokemonIndex]
|
||||
opponent = PokeBattle_Trainer.new(trainerName,trainerGender)
|
||||
opponent.setForeignID($Trainer)
|
||||
opponent = NPCTrainer.new(trainerName,trainerGender)
|
||||
opponent.id = $Trainer.make_foreign_ID
|
||||
yourPokemon = nil
|
||||
resetmoves = true
|
||||
if newpoke.is_a?(Pokemon)
|
||||
@@ -228,8 +228,8 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
|
||||
yourPokemon.obtain_method = 2 # traded
|
||||
yourPokemon.resetMoves if resetmoves
|
||||
yourPokemon.record_first_moves
|
||||
$Trainer.seen[yourPokemon.species] = true
|
||||
$Trainer.owned[yourPokemon.species] = true
|
||||
$Trainer.set_seen(yourPokemon.species)
|
||||
$Trainer.set_owned(yourPokemon.species)
|
||||
pbSeenForm(yourPokemon)
|
||||
pbFadeOutInWithMusic {
|
||||
evo = PokemonTrade_Scene.new
|
||||
|
||||
@@ -9,22 +9,6 @@
|
||||
MYSTERY_GIFT_URL = "http://images1.wikia.nocookie.net/pokemonessentials/images/e/e7/MysteryGift.txt"
|
||||
# MYSTERY_GIFT_URL = "http://pastebin.com/raw/w6BqqUsm"
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokeBattle_Trainer
|
||||
attr_writer :mysterygiftaccess # Whether MG can be used from load screen
|
||||
attr_writer :mysterygift # Variable that stores downloaded MG data
|
||||
|
||||
def mysterygiftaccess
|
||||
return @mysterygiftaccess || false
|
||||
end
|
||||
|
||||
def mysterygift
|
||||
return @mysterygift || []
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Creating a new Mystery Gift for the Master file, and editing an existing one.
|
||||
#===============================================================================
|
||||
@@ -211,12 +195,12 @@ def pbManageMysteryGifts
|
||||
master[command]=newgift if newgift
|
||||
elsif cmd==2 # Receive
|
||||
replaced=false
|
||||
for i in 0...$Trainer.mysterygift.length
|
||||
if $Trainer.mysterygift[i][0]==gift[0]
|
||||
$Trainer.mysterygift[i]=gift; replaced=true
|
||||
for i in 0...$Trainer.mystery_gifts.length
|
||||
if $Trainer.mystery_gifts[i][0]==gift[0]
|
||||
$Trainer.mystery_gifts[i]=gift; replaced=true
|
||||
end
|
||||
end
|
||||
$Trainer.mysterygift.push(gift) if !replaced
|
||||
$Trainer.mystery_gifts.push(gift) if !replaced
|
||||
pbReceiveMysteryGift(gift[0])
|
||||
elsif cmd==3 # Delete
|
||||
if pbConfirmMessage(_INTL("Are you sure you want to delete this gift?"))
|
||||
@@ -267,7 +251,7 @@ def pbDownloadMysteryGift(trainer)
|
||||
pending=[]
|
||||
for gift in online
|
||||
notgot=true
|
||||
for j in trainer.mysterygift
|
||||
for j in trainer.mystery_gifts
|
||||
notgot=false if j[0]==gift[0]
|
||||
end
|
||||
pending.push(gift) if notgot
|
||||
@@ -315,7 +299,7 @@ def pbDownloadMysteryGift(trainer)
|
||||
sprites["msgwindow"].visible=true
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("The gift has been received!")) { sprite.update }
|
||||
pbMessageDisplay(sprites["msgwindow"],_INTL("Please pick up your gift from the deliveryman in any Poké Mart.")) { sprite.update }
|
||||
trainer.mysterygift.push(gift)
|
||||
trainer.mystery_gifts.push(gift)
|
||||
pending[command]=nil; pending.compact!
|
||||
opacityDiff = 16*20/Graphics.frame_rate
|
||||
loop do
|
||||
@@ -359,7 +343,7 @@ end
|
||||
# Collecting a Mystery Gift from the deliveryman.
|
||||
#===============================================================================
|
||||
def pbNextMysteryGiftID
|
||||
for i in $Trainer.mysterygift
|
||||
for i in $Trainer.mystery_gifts
|
||||
return i[0] if i.length>1
|
||||
end
|
||||
return 0
|
||||
@@ -367,8 +351,8 @@ end
|
||||
|
||||
def pbReceiveMysteryGift(id)
|
||||
index=-1
|
||||
for i in 0...$Trainer.mysterygift.length
|
||||
if $Trainer.mysterygift[i][0]==id && $Trainer.mysterygift[i].length>1
|
||||
for i in 0...$Trainer.mystery_gifts.length
|
||||
if $Trainer.mystery_gifts[i][0]==id && $Trainer.mystery_gifts[i].length>1
|
||||
index=i
|
||||
break
|
||||
end
|
||||
@@ -377,7 +361,7 @@ def pbReceiveMysteryGift(id)
|
||||
pbMessage(_INTL("Couldn't find an unclaimed Mystery Gift with ID {1}.",id))
|
||||
return false
|
||||
end
|
||||
gift=$Trainer.mysterygift[index]
|
||||
gift=$Trainer.mystery_gifts[index]
|
||||
if gift[1]==0 # Pokémon
|
||||
gift[2].personalID = rand(2**16) | rand(2**16) << 16
|
||||
gift[2].calcStats
|
||||
@@ -394,7 +378,7 @@ def pbReceiveMysteryGift(id)
|
||||
end
|
||||
if pbAddPokemonSilent(gift[2])
|
||||
pbMessage(_INTL("\\me[Pkmn get]{1} received {2}!",$Trainer.name,gift[2].name))
|
||||
$Trainer.mysterygift[index]=[id]
|
||||
$Trainer.mystery_gifts[index]=[id]
|
||||
return true
|
||||
end
|
||||
elsif gift[1]>0 # Item
|
||||
@@ -416,7 +400,7 @@ def pbReceiveMysteryGift(id)
|
||||
else
|
||||
pbMessage(_INTL("\\me[Item get]You obtained a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
|
||||
end
|
||||
$Trainer.mysterygift[index]=[id]
|
||||
$Trainer.mystery_gifts[index]=[id]
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -241,7 +241,7 @@ class HallOfFame_Scene
|
||||
|
||||
def createTrainerBattler
|
||||
@sprites["trainer"]=IconSprite.new(@viewport)
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.front_sprite_filename($Trainer.trainertype))
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.front_sprite_filename($Trainer.trainer_type))
|
||||
if !SINGLEROW
|
||||
@sprites["trainer"].x=Graphics.width-96
|
||||
@sprites["trainer"].y=160
|
||||
@@ -276,12 +276,12 @@ class HallOfFame_Scene
|
||||
totalsec = Graphics.frame_count / Graphics.frame_rate
|
||||
hour = totalsec / 60 / 60
|
||||
min = totalsec / 60 % 60
|
||||
pubid=sprintf("%05d",$Trainer.publicID($Trainer.id))
|
||||
pubid=sprintf("%05d",$Trainer.public_ID)
|
||||
lefttext= _INTL("Name<r>{1}<br>",$Trainer.name)
|
||||
lefttext+=_INTL("IDNo.<r>{1}<br>",pubid)
|
||||
lefttext+=_ISPRINTF("Time<r>{1:02d}:{2:02d}<br>",hour,min)
|
||||
lefttext+=_INTL("Pokédex<r>{1}/{2}<br>",
|
||||
$Trainer.pokedexOwned,$Trainer.pokedexSeen)
|
||||
$Trainer.owned_count,$Trainer.seen_count)
|
||||
@sprites["messagebox"]=Window_AdvancedTextPokemon.new(lefttext)
|
||||
@sprites["messagebox"].viewport=@viewport
|
||||
@sprites["messagebox"].width=192 if @sprites["messagebox"].width<192
|
||||
|
||||
@@ -49,9 +49,9 @@ class PokemonDuel
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@sprites["player"] = IconSprite.new(-128 - 32, 96, @viewport)
|
||||
@sprites["player"].setBitmap(GameData::TrainerType.front_sprite_filename($Trainer.trainertype))
|
||||
@sprites["player"].setBitmap(GameData::TrainerType.front_sprite_filename($Trainer.trainer_type))
|
||||
@sprites["opponent"] = IconSprite.new(Graphics.width + 32, 96, @viewport)
|
||||
@sprites["opponent"].setBitmap(GameData::TrainerType.front_sprite_filename(opponent.trainertype))
|
||||
@sprites["opponent"].setBitmap(GameData::TrainerType.front_sprite_filename(opponent.trainer_type))
|
||||
@sprites["playerwindow"] = DuelWindow.new($Trainer.name, false)
|
||||
@sprites["playerwindow"].x = -@sprites["playerwindow"].width
|
||||
@sprites["playerwindow"].viewport = @viewport
|
||||
@@ -381,7 +381,7 @@ end
|
||||
def pbDuel(trainer_id, trainer_name, event, speeches)
|
||||
trainer_id = GameData::TrainerType.get(trainer_id).id
|
||||
duel = PokemonDuel.new
|
||||
opponent = PokeBattle_Trainer.new(
|
||||
opponent = NPCTrainer.new(
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames,trainer_name), trainer_id)
|
||||
speech_texts = []
|
||||
for i in 0...12
|
||||
|
||||
@@ -769,12 +769,13 @@ class TriadScreen
|
||||
candidates = []
|
||||
while candidates.length < 200
|
||||
card = species_keys[rand(species_keys.length)]
|
||||
card = GameData::Species.get(card).id # Make sure it's a symbol
|
||||
card_data = GameData::Species.get(card)
|
||||
card = card_data.id # Make sure it's a symbol
|
||||
triad = TriadCard.new(card)
|
||||
total = triad.north + triad.south + triad.east + triad.west
|
||||
# Add random species and its total point count
|
||||
candidates.push([card, total])
|
||||
if candidates.length < 200 && $Trainer.owned[card]
|
||||
if candidates.length < 200 && $Trainer.owned?(card_data.species)
|
||||
# Add again if player owns the species
|
||||
candidates.push([card, total])
|
||||
end
|
||||
@@ -1048,7 +1049,7 @@ def pbBuyTriads
|
||||
realcommands = []
|
||||
GameData::Species.each do |s|
|
||||
next if s.form != 0
|
||||
next if !$Trainer.owned[s.id]
|
||||
next if !$Trainer.owned?(s.species)
|
||||
price = TriadCard.new(i).price
|
||||
commands.push([price, s.name, _INTL("{1} - ${2}", s.name, price.to_s_formatted), s.id])
|
||||
end
|
||||
|
||||
@@ -739,7 +739,7 @@ class BattleFactoryData
|
||||
@trainerid=@bcdata.nextTrainer
|
||||
bttrainers=pbGetBTTrainers(@bcdata.currentChallenge)
|
||||
trainerdata=bttrainers[@trainerid]
|
||||
@opponent=PokeBattle_Trainer.new(
|
||||
@opponent=NPCTrainer.new(
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerdata[1]),
|
||||
trainerdata[0])
|
||||
opponentPkmn=pbBattleFactoryPokemon(1,@bcdata.wins,@bcdata.swaps,@rentals)
|
||||
@@ -769,7 +769,7 @@ class BattleFactoryData
|
||||
trainerid=@bcdata.nextTrainer
|
||||
bttrainers=pbGetBTTrainers(@bcdata.currentChallenge)
|
||||
trainerdata=bttrainers[trainerid]
|
||||
@opponent=PokeBattle_Trainer.new(
|
||||
@opponent=NPCTrainer.new(
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerdata[1]),
|
||||
trainerdata[0])
|
||||
opponentPkmn=pbBattleFactoryPokemon(
|
||||
@@ -882,7 +882,7 @@ end
|
||||
def pbGenerateBattleTrainer(trainerid,rule)
|
||||
bttrainers=pbGetBTTrainers(pbBattleChallenge.currentChallenge)
|
||||
trainerdata=bttrainers[trainerid]
|
||||
opponent=PokeBattle_Trainer.new(
|
||||
opponent=NPCTrainer.new(
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerdata[1]),
|
||||
trainerdata[0])
|
||||
btpokemon=pbGetBTPokemon(pbBattleChallenge.currentChallenge)
|
||||
@@ -928,7 +928,7 @@ def pbOrganizedBattleEx(opponent,challengedata,endspeech,endspeechwin)
|
||||
$PokemonTemp.lastbattle = nil
|
||||
return true
|
||||
end
|
||||
pbHealAll
|
||||
$Trainer.heal_party
|
||||
# Remember original data, to be restored after battle
|
||||
challengedata = PokemonChallengeRules.new if !challengedata
|
||||
oldlevels = challengedata.adjustLevels($Trainer.party,opponent.party)
|
||||
|
||||
@@ -840,8 +840,8 @@ def pbRuledBattle(team1,team2,rule)
|
||||
decision=pbDecideWinner(party1,party2,team1.rating,team2.rating)
|
||||
else
|
||||
level=rule.ruleset.suggestedLevel
|
||||
trainer1=PokeBattle_Trainer.new("PLAYER1",1)
|
||||
trainer2=PokeBattle_Trainer.new("PLAYER2",1)
|
||||
trainer1=NPCTrainer.new("PLAYER1",1)
|
||||
trainer2=NPCTrainer.new("PLAYER2",1)
|
||||
items1=[]
|
||||
items2=[]
|
||||
team1.each_with_index do |p,i|
|
||||
|
||||
@@ -30,7 +30,7 @@ def pbSetUpSystem
|
||||
game_system = Marshal.load(f)
|
||||
pokemonSystem = Marshal.load(f)
|
||||
}
|
||||
raise "Corrupted file" if !trainer.is_a?(PokeBattle_Trainer)
|
||||
raise "Corrupted file" if !trainer.is_a?(PlayerTrainer)
|
||||
raise "Corrupted file" if !framecount.is_a?(Numeric)
|
||||
raise "Corrupted file" if !game_system.is_a?(Game_System)
|
||||
raise "Corrupted file" if !pokemonSystem.is_a?(PokemonSystem)
|
||||
|
||||
@@ -73,7 +73,7 @@ def pbPlayTrainerIntroME(trainer_type)
|
||||
pbMEPlay(bgm)
|
||||
end
|
||||
|
||||
def pbGetTrainerBattleBGM(trainer) # can be a PokeBattle_Trainer or an array of them
|
||||
def pbGetTrainerBattleBGM(trainer) # can be a PlayerTrainer, NPCTrainer or an array of them
|
||||
if $PokemonGlobal.nextBattleBGM
|
||||
return $PokemonGlobal.nextBattleBGM.clone
|
||||
end
|
||||
@@ -81,7 +81,7 @@ def pbGetTrainerBattleBGM(trainer) # can be a PokeBattle_Trainer or an array o
|
||||
music = nil
|
||||
trainerarray = (trainer.is_a?(Array)) ? trainer : [trainer]
|
||||
trainerarray.each do |t|
|
||||
trainer_type_data = GameData::TrainerType.get(t.trainertype)
|
||||
trainer_type_data = GameData::TrainerType.get(t.trainer_type)
|
||||
music = trainer_type_data.battle_BGM if trainer_type_data.battle_BGM
|
||||
end
|
||||
ret = pbStringToAudioFile(music) if music && music!=""
|
||||
@@ -123,14 +123,14 @@ def pbGetTrainerBattleBGMFromType(trainertype)
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGetTrainerVictoryME(trainer) # can be a PokeBattle_Trainer or an array of them
|
||||
def pbGetTrainerVictoryME(trainer) # can be a PlayerTrainer, NPCTrainer or an array of them
|
||||
if $PokemonGlobal.nextBattleME
|
||||
return $PokemonGlobal.nextBattleME.clone
|
||||
end
|
||||
music = nil
|
||||
trainerarray = (trainer.is_a?(Array)) ? trainer : [trainer]
|
||||
trainerarray.each do |t|
|
||||
trainer_type_data = GameData::TrainerType.get(t.trainertype)
|
||||
trainer_type_data = GameData::TrainerType.get(t.trainer_type)
|
||||
music = trainer_type_data.victory_ME if trainer_type_data.victory_ME
|
||||
end
|
||||
ret = nil
|
||||
|
||||
@@ -53,8 +53,8 @@ def pbNicknameAndStore(pkmn)
|
||||
pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
|
||||
return
|
||||
end
|
||||
$Trainer.seen[pkmn.species] = true
|
||||
$Trainer.owned[pkmn.species] = true
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
pbNickname(pkmn)
|
||||
pbStorePokemon(pkmn)
|
||||
end
|
||||
@@ -80,8 +80,8 @@ end
|
||||
def pbAddPokemonSilent(pkmn, level = 1, see_form = true)
|
||||
return false if !pkmn || pbBoxesFull?
|
||||
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||
$Trainer.seen[pkmn.species] = true
|
||||
$Trainer.owned[pkmn.species] = true
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
pkmn.record_first_moves
|
||||
if $Trainer.party_full?
|
||||
@@ -108,8 +108,8 @@ end
|
||||
def pbAddToPartySilent(pkmn, level = nil, see_form = true)
|
||||
return false if !pkmn || $Trainer.party_full?
|
||||
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||
$Trainer.seen[pkmn.species] = true
|
||||
$Trainer.owned[pkmn.species] = true
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
pkmn.record_first_moves
|
||||
$Trainer.party[$Trainer.party.length] = pkmn
|
||||
@@ -131,8 +131,8 @@ def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner
|
||||
pbMessage(_INTL("\\me[Pkmn get]{1} received a Pokémon.\1", $Trainer.name))
|
||||
end
|
||||
pbStorePokemon(pkmn)
|
||||
$Trainer.seen[pkmn.species] = true
|
||||
$Trainer.owned[pkmn.species] = true
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
return true
|
||||
end
|
||||
@@ -152,27 +152,12 @@ end
|
||||
alias pbAddEgg pbGenerateEgg
|
||||
alias pbGenEgg pbGenerateEgg
|
||||
|
||||
#===============================================================================
|
||||
# Removing Pokémon from the party (fails if trying to remove last able Pokémon)
|
||||
#===============================================================================
|
||||
def pbRemovePokemonAt(index)
|
||||
return false if index < 0 || index >= $Trainer.party.length
|
||||
have_able = false
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
have_able = true if i != index && !pkmn.egg? && pkmn.hp > 0
|
||||
break if have_able
|
||||
end
|
||||
return false if !have_able
|
||||
$Trainer.party.delete_at(index)
|
||||
return true
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Recording Pokémon forms as seen
|
||||
#===============================================================================
|
||||
def pbSeenForm(species, gender = 0, form = 0)
|
||||
$Trainer.formseen = {} if !$Trainer.formseen
|
||||
$Trainer.formlastseen = {} if !$Trainer.formlastseen
|
||||
$Trainer.seen_forms = {} if !$Trainer.seen_forms
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
if species.is_a?(Pokemon)
|
||||
species_data = species.species_data
|
||||
gender = species.gender
|
||||
@@ -188,87 +173,34 @@ def pbSeenForm(species, gender = 0, form = 0)
|
||||
form = species_data.form
|
||||
end
|
||||
form = 0 if species_data.form_name.nil? || species_data.form_name.empty?
|
||||
$Trainer.formseen[species] = [[], []] if !$Trainer.formseen[species]
|
||||
$Trainer.formseen[species][gender][form] = true
|
||||
$Trainer.formlastseen[species] = [] if !$Trainer.formlastseen[species]
|
||||
$Trainer.formlastseen[species] = [gender, form] if $Trainer.formlastseen[species] == []
|
||||
$Trainer.seen_forms[species] = [[], []] if !$Trainer.seen_forms[species]
|
||||
$Trainer.seen_forms[species][gender][form] = true
|
||||
$Trainer.last_seen_forms[species] = [] if !$Trainer.last_seen_forms[species]
|
||||
$Trainer.last_seen_forms[species] = [gender, form] if $Trainer.last_seen_forms[species] == []
|
||||
end
|
||||
|
||||
def pbUpdateLastSeenForm(pkmn)
|
||||
$Trainer.formlastseen = {} if !$Trainer.formlastseen
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
species_data = pkmn.species_data
|
||||
form = species_data.pokedex_form
|
||||
form = 0 if species_data.form_name.nil? || species_data.form_name.empty?
|
||||
$Trainer.formlastseen[pkmn.species] = [pkmn.gender, form]
|
||||
$Trainer.last_seen_forms[pkmn.species] = [pkmn.gender, form]
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Analyse Pokémon in the party
|
||||
#===============================================================================
|
||||
# Returns the first unfainted, non-egg Pokémon in the player's party.
|
||||
def pbFirstAblePokemon(variableNumber)
|
||||
def pbFirstAblePokemon(variable_ID)
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
next if pkmn.egg? || pkmn.hp == 0
|
||||
pbSet(variableNumber, i)
|
||||
next if !pkmn.able?
|
||||
pbSet(variable_ID, i)
|
||||
return pkmn
|
||||
end
|
||||
pbSet(variableNumber, -1)
|
||||
pbSet(variable_ID, -1)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Checks whether the player would still have an unfainted Pokémon if the
|
||||
# Pokémon given by _index_ were removed from the party.
|
||||
def pbCheckAble(index)
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
return true if i != index && !pkmn.egg? && pkmn.hp > 0
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# Returns true if there are no usable Pokémon in the player's party.
|
||||
def pbAllFainted
|
||||
return $Trainer.ablePokemonCount == 0
|
||||
end
|
||||
|
||||
# Returns true if there is a Pokémon of the given species in the player's party.
|
||||
# You may also specify a particular form it should be.
|
||||
def pbHasSpecies?(species, form = -1)
|
||||
$Trainer.pokemonParty.each do |pkmn|
|
||||
return true if pkmn.isSpecies?(species) && (form < 0 || pkmn.form == form)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# Returns true if there is a fatefully met Pokémon of the given species in the
|
||||
# player's party.
|
||||
def pbHasFatefulSpecies?(species)
|
||||
$Trainer.pokemonParty.each do |pkmn|
|
||||
return true if pkmn.isSpecies?(species) && pkmn.obtain_method == 4
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# Returns true if there is a Pokémon with the given type in the player's party.
|
||||
def pbHasType?(type)
|
||||
type = GameData::Type.get(type).id
|
||||
$Trainer.pokemonParty.each { |pkmn| return true if pkmn.hasType?(type) }
|
||||
return false
|
||||
end
|
||||
|
||||
# Checks whether any Pokémon in the party knows the given move, and returns
|
||||
# the first Pokémon it finds with that move, or nil if no Pokémon has that move.
|
||||
def pbCheckMove(move)
|
||||
$Trainer.pokemonParty.each { |pkmn| return pkmn if pkmn.hasMove?(move) }
|
||||
return nil
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Fully heal all Pokémon in the party
|
||||
#===============================================================================
|
||||
def pbHealAll
|
||||
$Trainer.party.each { |pkmn| pkmn.heal }
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Return a level value based on Pokémon in a party
|
||||
#===============================================================================
|
||||
|
||||
@@ -223,48 +223,43 @@ end
|
||||
#===============================================================================
|
||||
# Player-related utilities, random name generator
|
||||
#===============================================================================
|
||||
def pbChangePlayer(id)
|
||||
return false if id<0 || id>=8
|
||||
meta = GameData::Metadata.get_player(id)
|
||||
return false if !meta
|
||||
$Trainer.trainertype = meta[0] if $Trainer
|
||||
$game_player.character_name = meta[1]
|
||||
$game_player.character_hue = 0
|
||||
$PokemonGlobal.playerID = id
|
||||
$Trainer.metaID = id if $Trainer
|
||||
end
|
||||
|
||||
def pbGetPlayerGraphic
|
||||
id = $PokemonGlobal.playerID
|
||||
return "" if id<0 || id>=8
|
||||
return "" if id < 0 || id >= 8
|
||||
meta = GameData::Metadata.get_player(id)
|
||||
return "" if !meta
|
||||
return GameData::TrainerType.player_front_sprite_filename(meta[0])
|
||||
end
|
||||
|
||||
def pbGetPlayerTrainerType
|
||||
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
return (meta) ? meta[0] : nil
|
||||
end
|
||||
|
||||
def pbGetTrainerTypeGender(trainer_type)
|
||||
return GameData::TrainerType.get(trainer_type).gender
|
||||
end
|
||||
|
||||
def pbTrainerName(name=nil,outfit=0)
|
||||
pbChangePlayer(0) if $PokemonGlobal.playerID<0
|
||||
trainertype = pbGetPlayerTrainerType
|
||||
trname = name
|
||||
$Trainer = PokeBattle_Trainer.new(trname,trainertype)
|
||||
$Trainer.outfit = outfit
|
||||
if trname==nil
|
||||
trname = pbEnterPlayerName(_INTL("Your name?"),0,MAX_PLAYER_NAME_SIZE)
|
||||
if trname==""
|
||||
gender = pbGetTrainerTypeGender(trainertype)
|
||||
trname = pbSuggestTrainerName(gender)
|
||||
def pbChangePlayer(id)
|
||||
return false if id < 0 || id >= 8
|
||||
meta = GameData::Metadata.get_player(id)
|
||||
return false if !meta
|
||||
$Trainer.trainer_type = meta[0] if $Trainer
|
||||
$game_player.character_name = meta[1]
|
||||
$PokemonGlobal.playerID = id
|
||||
$Trainer.character_ID = id if $Trainer
|
||||
end
|
||||
|
||||
def pbTrainerName(name = nil, outfit = 0)
|
||||
pbChangePlayer(0) if $PokemonGlobal.playerID < 0
|
||||
player_metadata = GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
trainer_type = (player_metadata) ? player_metadata[0] : nil
|
||||
$Trainer = PlayerTrainer.new(name, trainer_type)
|
||||
$Trainer.outfit = outfit
|
||||
$Trainer.character_ID = $PokemonGlobal.playerID
|
||||
if name.nil?
|
||||
name = pbEnterPlayerName(_INTL("Your name?"), 0, MAX_PLAYER_NAME_SIZE)
|
||||
if name.nil? || name.empty?
|
||||
gender = pbGetTrainerTypeGender(trainer_type)
|
||||
name = pbSuggestTrainerName(gender)
|
||||
end
|
||||
end
|
||||
$Trainer.name = trname
|
||||
$Trainer.name = name
|
||||
$PokemonBag = PokemonBag.new
|
||||
$PokemonTemp.begunNewGame = true
|
||||
end
|
||||
@@ -444,18 +439,18 @@ def pbSetViableDexes
|
||||
if USE_CURRENT_REGION_DEX
|
||||
region = pbGetCurrentRegion
|
||||
region = -1 if region>=$PokemonGlobal.pokedexUnlocked.length-1
|
||||
$PokemonGlobal.pokedexViable[0] = region if $Trainer.pokedexSeen(region)>0
|
||||
$PokemonGlobal.pokedexViable[0] = region if $Trainer.seen_any?(region)
|
||||
else
|
||||
numDexes = $PokemonGlobal.pokedexUnlocked.length
|
||||
if numDexes==1 # National Dex only
|
||||
if numDexes==1 # National Dex only
|
||||
if $PokemonGlobal.pokedexUnlocked[0]
|
||||
$PokemonGlobal.pokedexViable.push(0) if $Trainer.pokedexSeen>0
|
||||
$PokemonGlobal.pokedexViable.push(0) if $Trainer.seen_any?
|
||||
end
|
||||
else # Regional dexes + National Dex
|
||||
else # Regional dexes + National Dex
|
||||
for i in 0...numDexes
|
||||
regionToCheck = (i==numDexes-1) ? -1 : i
|
||||
if $PokemonGlobal.pokedexUnlocked[i]
|
||||
$PokemonGlobal.pokedexViable.push(i) if $Trainer.pokedexSeen(regionToCheck)>0
|
||||
$PokemonGlobal.pokedexViable.push(i) if $Trainer.seen_any?(regionToCheck)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -279,7 +279,7 @@ DebugMenuCommands.register("testtrainerbattle", {
|
||||
battle = pbListScreen(_INTL("SINGLE TRAINER"), TrainerBattleLister.new(0, false))
|
||||
if battle
|
||||
trainerdata = battle[1]
|
||||
pbTrainerBattle(trainerdata[0], trainerdata[1], nil, false, trainerdata[4], true)
|
||||
pbTrainerBattle(trainerdata[0], trainerdata[1], nil, false, trainerdata[2], true)
|
||||
end
|
||||
}
|
||||
})
|
||||
@@ -295,7 +295,7 @@ DebugMenuCommands.register("testtrainerbattleadvanced", {
|
||||
trainerCmd = 0
|
||||
loop do
|
||||
trainerCmds = []
|
||||
trainers.each { |t| trainerCmds.push(sprintf("%s x%d", t[1][0].fullname, t[1][2].length)) }
|
||||
trainers.each { |t| trainerCmds.push(sprintf("%s x%d", t[1].full_name, t[1].party_count)) }
|
||||
trainerCmds.push(_INTL("[Add trainer]"))
|
||||
trainerCmds.push(_INTL("[Set player side size]"))
|
||||
trainerCmds.push(_INTL("[Set opponent side size]"))
|
||||
@@ -309,7 +309,7 @@ DebugMenuCommands.register("testtrainerbattleadvanced", {
|
||||
elsif size1 < trainers.length
|
||||
pbMessage(_INTL("Opposing side size is invalid. It should be at least {1}", trainers.length))
|
||||
next
|
||||
elsif size1 > trainers.length && trainers[0][1][2].length == 1
|
||||
elsif size1 > trainers.length && trainers[0][1].party_count == 1
|
||||
pbMessage(
|
||||
_INTL("Opposing side size cannot be {1}, as that requires the first trainer to have 2 or more Pokémon, which they don't.",
|
||||
size1))
|
||||
@@ -317,18 +317,18 @@ DebugMenuCommands.register("testtrainerbattleadvanced", {
|
||||
end
|
||||
setBattleRule(sprintf("%dv%d", size0, size1))
|
||||
battleArgs = []
|
||||
trainers.each { |t| battleArgs.push([t[1][0], t[1][2], t[1][3], t[1][1]]) }
|
||||
trainers.each { |t| battleArgs.push(t[1]) }
|
||||
pbTrainerBattleCore(*battleArgs)
|
||||
break
|
||||
elsif trainerCmd == trainerCmds.length - 2 # Set opponent side size
|
||||
if trainers.length == 0 || (trainers.length == 1 && trainers[0][1][2].length == 1)
|
||||
if trainers.length == 0 || (trainers.length == 1 && trainers[0][1].party_count == 1)
|
||||
pbMessage(_INTL("No trainers were chosen or trainer only has one Pokémon."))
|
||||
next
|
||||
end
|
||||
maxVal = 2
|
||||
maxVal = 3 if trainers.length >= 3 ||
|
||||
(trainers.length == 2 && trainers[0][1][2].length >= 2) ||
|
||||
trainers[0][1][2].length >= 3
|
||||
(trainers.length == 2 && trainers[0][1].party_count >= 2) ||
|
||||
trainers[0][1].party_count >= 3
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(1, maxVal)
|
||||
params.setInitialValue(size1)
|
||||
@@ -353,7 +353,7 @@ DebugMenuCommands.register("testtrainerbattleadvanced", {
|
||||
battle = pbListScreen(_INTL("CHOOSE A TRAINER"), TrainerBattleLister.new(0, false))
|
||||
if battle
|
||||
trainerdata = battle[1]
|
||||
tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[4])
|
||||
tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2])
|
||||
trainers.push([battle[0], tr])
|
||||
end
|
||||
else # Edit a trainer
|
||||
@@ -362,7 +362,7 @@ DebugMenuCommands.register("testtrainerbattleadvanced", {
|
||||
TrainerBattleLister.new(trainers[trainerCmd][0], false))
|
||||
if battle
|
||||
trainerdata = battle[1]
|
||||
tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[4])
|
||||
tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2])
|
||||
trainers[trainerCmd] = [battle[0], tr]
|
||||
end
|
||||
elsif pbConfirmMessage(_INTL("Delete this trainer?"))
|
||||
@@ -530,8 +530,8 @@ DebugMenuCommands.register("demoparty", {
|
||||
party.each do |species|
|
||||
pkmn = Pokemon.new(species, 20)
|
||||
$Trainer.party.push(pkmn)
|
||||
$Trainer.seen[species] = true
|
||||
$Trainer.owned[species] = true
|
||||
$Trainer.set_seen(species)
|
||||
$Trainer.set_owned(species)
|
||||
pbSeenForm(pkmn)
|
||||
case species
|
||||
when :PIDGEOTTO
|
||||
@@ -584,8 +584,8 @@ DebugMenuCommands.register("fillboxes", {
|
||||
"name" => _INTL("Fill Storage Boxes"),
|
||||
"description" => _INTL("Add one Pokémon of each species (at Level 50) to storage."),
|
||||
"effect" => proc {
|
||||
$Trainer.formseen = {} if !$Trainer.formseen
|
||||
$Trainer.formlastseen = {} if !$Trainer.formlastseen
|
||||
$Trainer.seen_forms = {} if !$Trainer.seen_forms
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
added = 0
|
||||
box_qty = $PokemonStorage.maxPokemon(0)
|
||||
completed = true
|
||||
@@ -593,23 +593,23 @@ DebugMenuCommands.register("fillboxes", {
|
||||
sp = species_data.species
|
||||
f = species_data.form
|
||||
# Record each form of each species as seen and owned
|
||||
$Trainer.formseen[sp] = [[], []] if !$Trainer.formseen[sp]
|
||||
$Trainer.seen_forms[sp] = [[], []] if !$Trainer.seen_forms[sp]
|
||||
if f == 0
|
||||
$Trainer.seen[sp] = true
|
||||
$Trainer.owned[sp] = true
|
||||
$Trainer.set_seen(sp)
|
||||
$Trainer.set_owned(sp)
|
||||
if [PBGenderRates::AlwaysMale, PBGenderRates::AlwaysFemale,
|
||||
PBGenderRates::Genderless].include?(species_data.gender_rate)
|
||||
g = (species_data.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0
|
||||
$Trainer.formseen[sp][g][f] = true
|
||||
$Trainer.formlastseen[sp] = [g, f] if f == 0
|
||||
$Trainer.seen_forms[sp][g][f] = true
|
||||
$Trainer.last_seen_forms[sp] = [g, f] if f == 0
|
||||
else # Both male and female
|
||||
$Trainer.formseen[sp][0][f] = true
|
||||
$Trainer.formseen[sp][1][f] = true
|
||||
$Trainer.formlastseen[sp] = [0, f] if f == 0
|
||||
$Trainer.seen_forms[sp][0][f] = true
|
||||
$Trainer.seen_forms[sp][1][f] = true
|
||||
$Trainer.last_seen_forms[sp] = [0, f] if f == 0
|
||||
end
|
||||
elsif species_data.real_form_name && !species_data.real_form_name.empty?
|
||||
g = (species_data.gender_rate == PBGenderRates::AlwaysFemale) ? 1 : 0
|
||||
$Trainer.formseen[sp][g][f] = true
|
||||
$Trainer.seen_forms[sp][g][f] = true
|
||||
end
|
||||
# Add Pokémon (if form 0)
|
||||
next if f != 0
|
||||
@@ -818,7 +818,7 @@ DebugMenuCommands.register("renameplayer", {
|
||||
"effect" => proc {
|
||||
trname = pbEnterPlayerName("Your name?", 0, MAX_PLAYER_NAME_SIZE, $Trainer.name)
|
||||
if trname == "" && pbConfirmMessage(_INTL("Give yourself a default name?"))
|
||||
trainertype = pbGetPlayerTrainerType
|
||||
trainertype = $Trainer.trainer_type
|
||||
gender = pbGetTrainerTypeGender(trainertype)
|
||||
trname = pbSuggestTrainerName(gender)
|
||||
end
|
||||
@@ -837,7 +837,7 @@ DebugMenuCommands.register("randomid", {
|
||||
"description" => _INTL("Generate a random new ID for the player."),
|
||||
"effect" => proc {
|
||||
$Trainer.id = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
pbMessage(_INTL("The player's ID was changed to {1} (full ID: {2}).", $Trainer.publicID, $Trainer.id))
|
||||
pbMessage(_INTL("The player's ID was changed to {1} (full ID: {2}).", $Trainer.public_ID, $Trainer.id))
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ def pbDebugDayCare
|
||||
pbDayCareGenerateEgg
|
||||
$PokemonGlobal.daycareEgg = 0
|
||||
$PokemonGlobal.daycareEggSteps = 0
|
||||
pbMessage(_INTL("Collected the {1} egg.", $Trainer.lastParty.speciesName))
|
||||
pbMessage(_INTL("Collected the {1} egg.", $Trainer.last_party.speciesName))
|
||||
refresh = true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -916,7 +916,7 @@ PokemonDebugMenuCommands.register("ownership", {
|
||||
[_INTL("Male"), _INTL("Female"), _INTL("Unknown")], pkmn.owner.gender)
|
||||
pkmn.owner.gender = cmd2 if cmd2 >= 0
|
||||
when 3 # Random foreign ID
|
||||
pkmn.owner.id = $Trainer.getForeignID
|
||||
pkmn.owner.id = $Trainer.make_foreign_ID
|
||||
when 4 # Set foreign ID
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, 65535)
|
||||
|
||||
Reference in New Issue
Block a user