Revamped classes Pokemon, PBMove and PokemonMail

This commit is contained in:
Maruno17
2021-01-21 23:04:51 +00:00
parent 94ce80c183
commit 8a89ef1220
40 changed files with 1016 additions and 1038 deletions

View File

@@ -118,21 +118,20 @@ module GameData
pkmn.forcedForm = pkmn_data[:form] if MultipleForms.hasFunction?(species, "getForm") pkmn.forcedForm = pkmn_data[:form] if MultipleForms.hasFunction?(species, "getForm")
pkmn.formSimple = pkmn_data[:form] pkmn.formSimple = pkmn_data[:form]
end end
pkmn.setItem(pkmn_data[:item]) pkmn.item = pkmn_data[:item]
if pkmn_data[:moves] && pkmn_data[:moves].length > 0 if pkmn_data[:moves] && pkmn_data[:moves].length > 0
pkmn_data[:moves].each { |move| pkmn.pbLearnMove(move) } pkmn_data[:moves].each { |move| pkmn.pbLearnMove(move) }
else else
pkmn.resetMoves pkmn.resetMoves
end end
pkmn.setAbility(pkmn_data[:ability_flag]) pkmn.ability_index = pkmn_data[:ability_flag]
gender = pkmn_data[:gender] || ((trainer.female?) ? 1 : 0) pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
pkmn.setGender(gender) pkmn.shiny = (pkmn_data[:shininess]) ? true : false
(pkmn_data[:shininess]) ? pkmn.makeShiny : pkmn.makeNotShiny
if pkmn_data[:nature] if pkmn_data[:nature]
pkmn.setNature(pkmn_data[:nature]) pkmn.nature = pkmn_data[:nature]
else else
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainertype).id_number nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainertype).id_number
pkmn.setNature(nature % (PBNatures.maxValue + 1)) pkmn.nature = nature % (PBNatures.maxValue + 1)
end end
PBStats.eachStat do |s| PBStats.eachStat do |s|
if pkmn_data[:iv] && pkmn_data[:iv].length > 0 if pkmn_data[:iv] && pkmn_data[:iv].length > 0
@@ -151,7 +150,7 @@ module GameData
if pkmn_data[:shadowness] if pkmn_data[:shadowness]
pkmn.makeShadow pkmn.makeShadow
pkmn.pbUpdateShadowMoves(true) pkmn.pbUpdateShadowMoves(true)
pkmn.makeNotShiny pkmn.shiny = false
end end
pkmn.ballused = pkmn_data[:poke_ball] if pkmn_data[:poke_ball] pkmn.ballused = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
pkmn.calcStats pkmn.calcStats

View File

@@ -76,7 +76,7 @@ class PokeBattle_Battler
def item=(value) def item=(value)
new_item = GameData::Item.try_get(value) new_item = GameData::Item.try_get(value)
@item_id = (new_item) ? new_item.id : nil @item_id = (new_item) ? new_item.id : nil
@pokemon.setItem(@item_id) if @pokemon @pokemon.item = @item_id if @pokemon
end end
def defense def defense

View File

@@ -93,7 +93,7 @@ class PokeBattle_Battler
@participants = [] # Participants earn Exp. if this battler is defeated @participants = [] # Participants earn Exp. if this battler is defeated
@moves = [] @moves = []
pkmn.moves.each_with_index do |m,i| pkmn.moves.each_with_index do |m,i|
@moves[i] = PokeBattle_Move.pbFromPBMove(@battle,m) @moves[i] = PokeBattle_Move.from_pokemon_move(@battle,m)
end end
@iv = pkmn.iv.clone @iv = pkmn.iv.clone
end end

View File

@@ -281,7 +281,7 @@ class PokeBattle_Battler
end end
@moves.clear @moves.clear
target.moves.each_with_index do |m,i| target.moves.each_with_index do |m,i|
@moves[i] = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(m.id)) @moves[i] = PokeBattle_Move.from_pokemon_move(@battle, Pokemon::Move.new(m.id))
@moves[i].pp = 5 @moves[i].pp = 5
@moves[i].total_pp = 5 @moves[i].total_pp = 5
end end

View File

@@ -150,7 +150,7 @@ class PokeBattle_Battler
if idxMove>=0 if idxMove>=0
choice[2] = @moves[idxMove] choice[2] = @moves[idxMove]
else else
choice[2] = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(moveID)) # PokeBattle_Move object choice[2] = PokeBattle_Move.from_pokemon_move(@battle, Pokemon::Move.new(moveID))
choice[2].pp = -1 choice[2].pp = -1
end end
choice[3] = target # Target (-1 means no target yet) choice[3] = target # Target (-1 means no target yet)
@@ -169,7 +169,7 @@ class PokeBattle_Battler
pbBeginTurn(choice) pbBeginTurn(choice)
# Force the use of certain moves if they're already being used # Force the use of certain moves if they're already being used
if usingMultiTurnAttack? if usingMultiTurnAttack?
choice[2] = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(@currentMove)) choice[2] = PokeBattle_Move.from_pokemon_move(@battle, Pokemon::Move.new(@currentMove))
specialUsage = true specialUsage = true
elsif @effects[PBEffects::Encore]>0 && choice[1]>=0 && elsif @effects[PBEffects::Encore]>0 && choice[1]>=0 &&
@battle.pbCanShowCommands?(@index) @battle.pbCanShowCommands?(@index)

View File

@@ -47,8 +47,8 @@ class PokeBattle_Move
# This is the code actually used to generate a PokeBattle_Move object. The # This is the code actually used to generate a PokeBattle_Move object. The
# object generated is a subclass of this one which depends on the move's # object generated is a subclass of this one which depends on the move's
# function code (found in the script section PokeBattle_MoveEffect). # function code (found in the script section PokeBattle_MoveEffect).
def PokeBattle_Move.pbFromPBMove(battle, move) def PokeBattle_Move.from_pokemon_move(battle, move)
validate move => PBMove validate move => Pokemon::Move
moveFunction = move.function_code || "000" moveFunction = move.function_code || "000"
className = sprintf("PokeBattle_Move_%s", moveFunction) className = sprintf("PokeBattle_Move_%s", moveFunction)
if Object.const_defined?(className) if Object.const_defined?(className)

View File

@@ -1720,8 +1720,8 @@ class PokeBattle_Move_05C < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
user.eachMoveWithIndex do |m,i| user.eachMoveWithIndex do |m,i|
next if m.id!=@id next if m.id!=@id
newMove = PBMove.new(target.lastRegularMoveUsed) newMove = Pokemon::Move.new(target.lastRegularMoveUsed)
user.moves[i] = PokeBattle_Move.pbFromPBMove(@battle,newMove) user.moves[i] = PokeBattle_Move.from_pokemon_move(@battle,newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name)) @battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
user.pbCheckFormOnMovesetChange user.pbCheckFormOnMovesetChange
break break
@@ -1770,9 +1770,9 @@ class PokeBattle_Move_05D < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
user.eachMoveWithIndex do |m,i| user.eachMoveWithIndex do |m,i|
next if m.id!=@id next if m.id!=@id
newMove = PBMove.new(target.lastRegularMoveUsed) newMove = Pokemon::Move.new(target.lastRegularMoveUsed)
user.pokemon.moves[i] = newMove user.pokemon.moves[i] = newMove
user.moves[i] = PokeBattle_Move.pbFromPBMove(@battle,newMove) user.moves[i] = PokeBattle_Move.from_pokemon_move(@battle,newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name)) @battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
user.pbCheckFormOnMovesetChange user.pbCheckFormOnMovesetChange
break break

View File

@@ -5,9 +5,9 @@ module PokeBattle_BattleCommon
def pbStorePokemon(pkmn) def pbStorePokemon(pkmn)
# Nickname the Pokémon (unless it's a Shadow Pokémon) # Nickname the Pokémon (unless it's a Shadow Pokémon)
if !pkmn.shadowPokemon? if !pkmn.shadowPokemon?
if pbDisplayConfirm(_INTL("Would you like to give a nickname to {1}?",pkmn.name)) if pbDisplayConfirm(_INTL("Would you like to give a nickname to {1}?", pkmn.name))
nickname = @scene.pbNameEntry(_INTL("{1}'s nickname?",pkmn.speciesName),pkmn) nickname = @scene.pbNameEntry(_INTL("{1}'s nickname?", pkmn.speciesName), pkmn)
pkmn.name = nickname if nickname!="" pkmn.name = nickname
end end
end end
# Store the Pokémon # Store the Pokémon

View File

@@ -161,9 +161,9 @@ class PokeBattle_Battle
@runCommand = 0 @runCommand = 0
@nextPickupUse = 0 @nextPickupUse = 0
if GameData::Move.exists?(:STRUGGLE) if GameData::Move.exists?(:STRUGGLE)
@struggle = PokeBattle_Move.pbFromPBMove(self,PBMove.new(:STRUGGLE)) @struggle = PokeBattle_Move.from_pokemon_move(self, Pokemon::Move.new(:STRUGGLE))
else else
@struggle = PokeBattle_Struggle.new(self,nil) @struggle = PokeBattle_Struggle.new(self, nil)
end end
end end

View File

@@ -478,7 +478,7 @@ class PokeBattle_Battle
pbParty(0).each_with_index do |pkmn,i| pbParty(0).each_with_index do |pkmn,i|
next if !pkmn next if !pkmn
@peer.pbOnLeavingBattle(self,pkmn,@usedInBattle[0][i],true) # Reset form @peer.pbOnLeavingBattle(self,pkmn,@usedInBattle[0][i],true) # Reset form
pkmn.setItem(@initialItems[0][i]) pkmn.item = @initialItems[0][i]
end end
return @decision return @decision
end end

View File

@@ -89,7 +89,7 @@ class PokeBattle_Battle
def pbGainExpOne(idxParty,defeatedBattler,numPartic,expShare,expAll,showMessages=true) def pbGainExpOne(idxParty,defeatedBattler,numPartic,expShare,expAll,showMessages=true)
pkmn = pbParty(0)[idxParty] # The Pokémon gaining EVs from defeatedBattler pkmn = pbParty(0)[idxParty] # The Pokémon gaining EVs from defeatedBattler
growthRate = pkmn.growthrate growthRate = pkmn.growth_rate
# Don't bother calculating if gainer is already at max Exp # Don't bother calculating if gainer is already at max Exp
if pkmn.exp>=PBExperience.pbGetMaxExperience(growthRate) if pkmn.exp>=PBExperience.pbGetMaxExperience(growthRate)
pkmn.calcStats # To ensure new EVs still have an effect pkmn.calcStats # To ensure new EVs still have an effect
@@ -100,7 +100,7 @@ class PokeBattle_Battle
level = defeatedBattler.level level = defeatedBattler.level
# Main Exp calculation # Main Exp calculation
exp = 0 exp = 0
a = level*defeatedBattler.pokemon.baseExp a = level*defeatedBattler.pokemon.base_exp
if expShare.length>0 && (isPartic || hasExpShare) if expShare.length>0 && (isPartic || hasExpShare)
if numPartic==0 # No participants, all Exp goes to Exp Share holders if numPartic==0 # No participants, all Exp goes to Exp Share holders
exp = a/(SPLIT_EXP_BETWEEN_GAINERS ? expShare.length : 1) exp = a/(SPLIT_EXP_BETWEEN_GAINERS ? expShare.length : 1)
@@ -227,8 +227,8 @@ class PokeBattle_Battle
for i in 0...Pokemon::MAX_MOVES for i in 0...Pokemon::MAX_MOVES
m = pkmn.moves[i] m = pkmn.moves[i]
return if m && m.id==newMove # Already knows the new move return if m && m.id==newMove # Already knows the new move
pkmn.moves[i] = PBMove.new(newMove) pkmn.moves[i] = Pokemon::Move.new(newMove)
battler.moves[i] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[i]) if battler battler.moves[i] = PokeBattle_Move.from_pokemon_move(self, pkmn.moves[i]) if battler
pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") } pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") }
battler.pbCheckFormOnMovesetChange if battler battler.pbCheckFormOnMovesetChange if battler
return return
@@ -241,8 +241,8 @@ class PokeBattle_Battle
forgetMove = @scene.pbForgetMove(pkmn,newMove) forgetMove = @scene.pbForgetMove(pkmn,newMove)
if forgetMove>=0 if forgetMove>=0
oldMoveName = pkmn.moves[forgetMove].name oldMoveName = pkmn.moves[forgetMove].name
pkmn.moves[forgetMove] = PBMove.new(newMove) # Replaces current/total PP pkmn.moves[forgetMove] = Pokemon::Move.new(newMove) # Replaces current/total PP
battler.moves[forgetMove] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[forgetMove]) if battler battler.moves[forgetMove] = PokeBattle_Move.from_pokemon_move(self, pkmn.moves[forgetMove]) if battler
pbDisplayPaused(_INTL("1, 2, and... ... ... Ta-da!")) pbDisplayPaused(_INTL("1, 2, and... ... ... Ta-da!"))
pbDisplayPaused(_INTL("{1} forgot how to use {2}. And...",pkmnName,oldMoveName)) pbDisplayPaused(_INTL("{1} forgot how to use {2}. And...",pkmnName,oldMoveName))
pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") } pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") }

View File

@@ -686,17 +686,16 @@ def pbPickup(pkmn)
chances.each_with_index do |c,i| chances.each_with_index do |c,i|
cumul += c cumul += c
next if rnd>=cumul next if rnd>=cumul
pkmn.setItem(items[i]) pkmn.item = items[i]
break break
end end
end end
# Try to gain a Honey item after a battle if a Pokemon has the ability Honey Gather. # Try to gain a Honey item after a battle if a Pokemon has the ability Honey Gather.
def pbHoneyGather(pkmn) def pbHoneyGather(pkmn)
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER)
return if pkmn.hasItem?
return if !GameData::Item.exists?(:HONEY) return if !GameData::Item.exists?(:HONEY)
chance = 5+((pkmn.level-1)/10)*5 return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER) || pkmn.hasItem?
return unless rand(100)<chance chance = 5 + ((pkmn.level - 1) / 10) * 5
pkmn.setItem(:HONEY) return unless rand(100) < chance
pkmn.item = :HONEY
end end

View File

@@ -405,11 +405,11 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
chances = [60,20,5] if firstPkmn && firstPkmn.hasAbility?(:COMPOUNDEYES) chances = [60,20,5] if firstPkmn && firstPkmn.hasAbility?(:COMPOUNDEYES)
itemrnd = rand(100) itemrnd = rand(100)
if (items[0]==items[1] && items[1]==items[2]) || itemrnd<chances[0] if (items[0]==items[1] && items[1]==items[2]) || itemrnd<chances[0]
genwildpoke.setItem(items[0]) genwildpoke.item = items[0]
elsif itemrnd<(chances[0]+chances[1]) elsif itemrnd<(chances[0]+chances[1])
genwildpoke.setItem(items[1]) genwildpoke.item = items[1]
elsif itemrnd<(chances[0]+chances[1]+chances[2]) elsif itemrnd<(chances[0]+chances[1]+chances[2])
genwildpoke.setItem(items[2]) genwildpoke.item = items[2]
end end
# Shiny Charm makes shiny Pokémon more likely to generate # Shiny Charm makes shiny Pokémon more likely to generate
if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM) if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
@@ -432,7 +432,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
(rand(3)<2) ? genwildpoke.makeMale : genwildpoke.makeFemale (rand(3)<2) ? genwildpoke.makeMale : genwildpoke.makeFemale
end end
elsif firstPkmn.hasAbility?(:SYNCHRONIZE) elsif firstPkmn.hasAbility?(:SYNCHRONIZE)
genwildpoke.setNature(firstPkmn.nature) if !isRoamer && rand(100)<50 genwildpoke.nature = firstPkmn.nature if !isRoamer && rand(100)<50
end end
end end
# Trigger events that may alter the generated Pokémon further # Trigger events that may alter the generated Pokémon further

View File

@@ -9,7 +9,7 @@
Events.onWildPokemonCreate += proc { |_sender, e| Events.onWildPokemonCreate += proc { |_sender, e|
pokemon = e[0] pokemon = e[0]
if $game_switches[SHINY_WILD_POKEMON_SWITCH] if $game_switches[SHINY_WILD_POKEMON_SWITCH]
pokemon.makeShiny pokemon.shiny = true
end end
} }

View File

@@ -266,7 +266,7 @@ def pbDayCareGenerateEgg
first_move_index = 0 if first_move_index < 0 first_move_index = 0 if first_move_index < 0
finalmoves = [] finalmoves = []
for i in first_move_index...moves.length for i in first_move_index...moves.length
finalmoves.push(PBMove.new(moves[i])) finalmoves.push(Pokemon::Move.new(moves[i]))
end end
# Inheriting Individual Values # Inheriting Individual Values
ivs = [] ivs = []
@@ -311,7 +311,7 @@ def pbDayCareGenerateEgg
new_natures.push(father.nature) if father.hasItem?(:EVERSTONE) new_natures.push(father.nature) if father.hasItem?(:EVERSTONE)
if new_natures.length > 0 if new_natures.length > 0
new_nature = (new_natures.length == 1) ? new_natures[0] : new_natures[rand(new_natures.length)] new_nature = (new_natures.length == 1) ? new_natures[0] : new_natures[rand(new_natures.length)]
egg.setNature(new_nature) egg.nature = new_nature
end end
# Masuda method and Shiny Charm # Masuda method and Shiny Charm
shinyretries = 0 shinyretries = 0
@@ -327,12 +327,12 @@ def pbDayCareGenerateEgg
if !ditto0 || !ditto1 if !ditto0 || !ditto1
parent = (ditto0) ? father : mother # The non-Ditto parent = (ditto0) ? father : mother # The non-Ditto
if parent.hasHiddenAbility? if parent.hasHiddenAbility?
egg.setAbility(parent.abilityIndex) if rand(100) < 60 egg.ability_index = parent.ability_index if rand(100) < 60
elsif !ditto0 && !ditto1 elsif !ditto0 && !ditto1
if rand(100) < 80 if rand(100) < 80
egg.setAbility(mother.abilityIndex) egg.ability_index = mother.ability_index
else else
egg.setAbility((mother.abilityIndex + 1) % 2) egg.ability_index = (mother.ability_index + 1) % 2
end end
end end
end end
@@ -390,7 +390,7 @@ Events.onStepTaken += proc { |_sender,_e|
for i in 0...2 for i in 0...2
pkmn = $PokemonGlobal.daycare[i][0] pkmn = $PokemonGlobal.daycare[i][0]
next if !pkmn next if !pkmn
maxexp = PBExperience.pbGetMaxExperience(pkmn.growthrate) maxexp = PBExperience.pbGetMaxExperience(pkmn.growth_rate)
next if pkmn.exp>=maxexp next if pkmn.exp>=maxexp
oldlevel = pkmn.level oldlevel = pkmn.level
pkmn.exp += 1 # Gain Exp pkmn.exp += 1 # Gain Exp

View File

@@ -44,7 +44,7 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
trainer = [tr_type, tr_name, [], party, tr_version] trainer = [tr_type, tr_name, [], party, tr_version]
if save_changes if save_changes
trainer_hash = { trainer_hash = {
:id => GameData::Trainer::HASH.keys.length / 2, :id => GameData::Trainer::DATA.keys.length / 2,
:trainer_type => tr_type, :trainer_type => tr_type,
:name => tr_name, :name => tr_name,
:version => tr_version, :version => tr_version,

View File

@@ -431,7 +431,7 @@ def pbLearnMove(pkmn,move,ignoreifknown=false,bymachine=false,&block)
if forgetmove>=0 if forgetmove>=0
oldmovename = pkmn.moves[forgetmove].name oldmovename = pkmn.moves[forgetmove].name
oldmovepp = pkmn.moves[forgetmove].pp oldmovepp = pkmn.moves[forgetmove].pp
pkmn.moves[forgetmove] = PBMove.new(move) # Replaces current/total PP pkmn.moves[forgetmove] = Pokemon::Move.new(move) # Replaces current/total PP
if bymachine && TAUGHT_MACHINES_KEEP_OLD_PP if bymachine && TAUGHT_MACHINES_KEEP_OLD_PP
pkmn.moves[forgetmove].pp = [oldmovepp,pkmn.moves[forgetmove].total_pp].min pkmn.moves[forgetmove].pp = [oldmovepp,pkmn.moves[forgetmove].total_pp].min
end end
@@ -633,7 +633,7 @@ def pbGiveItemToPokemon(item,pkmn,scene,pkmnid=0)
else else
if GameData::Item.get(item).is_mail? if GameData::Item.get(item).is_mail?
if pbWriteMail(item,pkmn,pkmnid,scene) if pbWriteMail(item,pkmn,pkmnid,scene)
pkmn.setItem(item) pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.",olditemname,pkmn.name,newitemname)) scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.",olditemname,pkmn.name,newitemname))
return true return true
else else
@@ -642,7 +642,7 @@ def pbGiveItemToPokemon(item,pkmn,scene,pkmnid=0)
end end
end end
else else
pkmn.setItem(item) pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.",olditemname,pkmn.name,newitemname)) scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.",olditemname,pkmn.name,newitemname))
return true return true
end end
@@ -651,7 +651,7 @@ def pbGiveItemToPokemon(item,pkmn,scene,pkmnid=0)
else else
if !GameData::Item.get(item).is_mail? || pbWriteMail(item,pkmn,pkmnid,scene) if !GameData::Item.get(item).is_mail? || pbWriteMail(item,pkmn,pkmnid,scene)
$PokemonBag.pbDeleteItem(item) $PokemonBag.pbDeleteItem(item)
pkmn.setItem(item) pkmn.item = item
scene.pbDisplay(_INTL("{1} is now holding the {2}.",pkmn.name,newitemname)) scene.pbDisplay(_INTL("{1} is now holding the {2}.",pkmn.name,newitemname))
return true return true
end end
@@ -671,20 +671,20 @@ def pbTakeItemFromPokemon(pkmn,scene)
scene.pbDisplay(_INTL("Your PC's Mailbox is full.")) scene.pbDisplay(_INTL("Your PC's Mailbox is full."))
else else
scene.pbDisplay(_INTL("The mail was saved in your PC.")) scene.pbDisplay(_INTL("The mail was saved in your PC."))
pkmn.setItem(nil) pkmn.item = nil
ret = true ret = true
end end
elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?")) elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?"))
$PokemonBag.pbStoreItem(pkmn.item) $PokemonBag.pbStoreItem(pkmn.item)
scene.pbDisplay(_INTL("Received the {1} from {2}.",pkmn.item.name,pkmn.name)) scene.pbDisplay(_INTL("Received the {1} from {2}.",pkmn.item.name,pkmn.name))
pkmn.setItem(nil) pkmn.item = nil
pkmn.mail = nil pkmn.mail = nil
ret = true ret = true
end end
else else
$PokemonBag.pbStoreItem(pkmn.item) $PokemonBag.pbStoreItem(pkmn.item)
scene.pbDisplay(_INTL("Received the {1} from {2}.",pkmn.item.name,pkmn.name)) scene.pbDisplay(_INTL("Received the {1} from {2}.",pkmn.item.name,pkmn.name))
pkmn.setItem(nil) pkmn.item = nil
ret = true ret = true
end end
return ret return ret

View File

@@ -1107,11 +1107,11 @@ ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc { |item,pkmn,scene|
scene.pbDisplay(_INTL("It won't have any effect.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
newabil = (pkmn.abilityIndex+1)%2 newabil = (pkmn.ability_index + 1) % 2
newabilname = GameData::Ability.get((newabil==0) ? abil1 : abil2).name newabilname = GameData::Ability.get((newabil==0) ? abil1 : abil2).name
if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?", if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
pkmn.name,newabilname)) pkmn.name,newabilname))
pkmn.setAbility(newabil) pkmn.ability_index = newabil
scene.pbRefresh scene.pbRefresh
scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pkmn.name,newabilname)) scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pkmn.name,newabilname))
next true next true

View File

@@ -196,7 +196,7 @@ Events.onWildPokemonCreate += proc { |_sender,e|
next if !grasses next if !grasses
for grass in grasses for grass in grasses
next if $game_player.x!=grass[0] || $game_player.y!=grass[1] next if $game_player.x!=grass[0] || $game_player.y!=grass[1]
pokemon.makeShiny if grass[3]==2 pokemon.shiny = true if grass[3]==2
break break
end end
} }

View File

@@ -1,10 +1,9 @@
# Data structure representing mail that the Pokémon can hold # Data structure representing mail that the Pokémon can hold
class PokemonMail class Mail
attr_accessor :item,:message,:sender,:poke1,:poke2,:poke3 attr_accessor :item, :message, :sender, :poke1, :poke2, :poke3
def initialize(item, message, sender, poke1 = nil, poke2 = nil, poke3 = nil) def initialize(item, message, sender, poke1 = nil, poke2 = nil, poke3 = nil)
item = item.id if !item.is_a?(Symbol) && item.respond_to?("id") @item = GameData::Item.get(item).id # Item represented by this mail
@item = item # Item represented by this mail
@message = message # Message text @message = message # Message text
@sender = sender # Name of the message's sender @sender = sender # Name of the message's sender
@poke1 = poke1 # [species,gender,shininess,form,shadowness,is egg] @poke1 = poke1 # [species,gender,shininess,form,shadowness,is egg]
@@ -15,6 +14,17 @@ end
# @deprecated Use {Mail} instead. PokemonMail is slated to be removed in v20.
class PokemonMail
attr_reader :item, :message, :sender, :poke1, :poke2, :poke3
def self.copy(mail)
return Mail.new(mail.item, item.message, item.sender, item.poke1, item.poke2, item.poke3)
end
end
def pbMoveToMailbox(pokemon) def pbMoveToMailbox(pokemon)
$PokemonGlobal.mailbox = [] if !$PokemonGlobal.mailbox $PokemonGlobal.mailbox = [] if !$PokemonGlobal.mailbox
return false if $PokemonGlobal.mailbox.length>=10 return false if $PokemonGlobal.mailbox.length>=10
@@ -26,7 +36,7 @@ end
def pbStoreMail(pkmn,item,message,poke1=nil,poke2=nil,poke3=nil) def pbStoreMail(pkmn,item,message,poke1=nil,poke2=nil,poke3=nil)
raise _INTL("Pokémon already has mail") if pkmn.mail raise _INTL("Pokémon already has mail") if pkmn.mail
pkmn.mail = PokemonMail.new(item,message,$Trainer.name,poke1,poke2,poke3) pkmn.mail = Mail.new(item,message, $Trainer.name, poke1, poke2, poke3)
end end
def pbDisplayMail(mail,_bearer=nil) def pbDisplayMail(mail,_bearer=nil)
@@ -102,15 +112,15 @@ def pbWriteMail(item,pkmn,pkmnid,scene)
poke1 = poke2 = nil poke1 = poke2 = nil
if $Trainer.party[pkmnid+2] if $Trainer.party[pkmnid+2]
p = $Trainer.party[pkmnid+2] p = $Trainer.party[pkmnid+2]
poke1 = [p.species,p.gender,p.shiny?,(p.form rescue 0),p.shadowPokemon?] poke1 = [p.species,p.gender,p.shiny?,p.form,p.shadowPokemon?]
poke1.push(true) if p.egg? poke1.push(true) if p.egg?
end end
if $Trainer.party[pkmnid+1] if $Trainer.party[pkmnid+1]
p = $Trainer.party[pkmnid+1] p = $Trainer.party[pkmnid+1]
poke2 = [p.species,p.gender,p.shiny?,(p.form rescue 0),p.shadowPokemon?] poke2 = [p.species,p.gender,p.shiny?,p.form,p.shadowPokemon?]
poke2.push(true) if p.egg? poke2.push(true) if p.egg?
end end
poke3 = [pkmn.species,pkmn.gender,pkmn.shiny?,(pkmn.form rescue 0),pkmn.shadowPokemon?] poke3 = [pkmn.species,pkmn.gender,pkmn.shiny?,pkmn.form,pkmn.shadowPokemon?]
poke3.push(true) if pkmn.egg? poke3.push(true) if pkmn.egg?
pbStoreMail(pkmn,item,message,poke1,poke2,poke3) pbStoreMail(pkmn,item,message,poke1,poke2,poke3)
return true return true

File diff suppressed because it is too large Load Diff

View File

@@ -1,43 +0,0 @@
#===============================================================================
# Move objects known by Pokémon.
#===============================================================================
class PBMove
attr_reader :id # This move's ID
attr_accessor :pp # The amount of PP remaining for this move
attr_accessor :ppup # The number of PP Ups used on this move
# Initializes this object to the specified move ID.
def initialize(move_id)
@id = GameData::Move.get(move_id).id
@ppup = 0
@pp = total_pp
end
# Changes this move's ID, and caps the PP amount if it is now greater than the
# new move's total PP.
def id=(value)
old_id = @id
@id = GameData::Move.get(value).id
@pp = [@pp, total_pp].min
end
# Gets the maximum PP for this move.
def total_pp
max_pp = GameData::Move.get(@id).total_pp
return max_pp + max_pp * @ppup / 5
end
alias totalpp total_pp
def function_code; return GameData::Move.get(@id).function_code; end
def base_damage; return GameData::Move.get(@id).base_damage; end
def type; return GameData::Move.get(@id).type; end
def category; return GameData::Move.get(@id).category; end
def accuracy; return GameData::Move.get(@id).accuracy; end
def effect_chance; return GameData::Move.get(@id).effect_chance; end
def target; return GameData::Move.get(@id).target; end
def priority; return GameData::Move.get(@id).priority; end
def flags; return GameData::Move.get(@id).flags; end
def name; return GameData::Move.get(@id).name; end
def description; return GameData::Move.get(@id).description; end
def hidden_move?; return GameData::Move.get(@id).hidden_move?; end
end

View File

@@ -0,0 +1,77 @@
#===============================================================================
# Move objects known by Pokémon.
#===============================================================================
class Pokemon
class Move
# This move's ID.
attr_reader :id
# The amount of PP remaining for this move.
attr_reader :pp
# The number of PP Ups used on this move (each one adds 20% to the total PP).
attr_reader :ppup
# Creates a new Move object.
# @param move_id [Symbol, String, Integer] move ID
def initialize(move_id)
@id = GameData::Move.get(move_id).id
@ppup = 0
@pp = total_pp
end
# Sets this move's ID, and caps the PP amount if it is now greater than this
# move's total PP.
# @param value [Symbol, String, Integer] the new move ID
def id=(value)
@id = GameData::Move.get(value).id
@pp = @pp.clamp(0, total_pp)
end
# Sets this move's PP, capping it at this move's total PP.
# @param value [Integer] the new PP amount
def pp=(value)
@pp = value.clamp(0, total_pp)
end
# Sets this move's PP Up count, and caps the PP if necessary.
# @param value [Integer] the new PP Up value
def ppup=(value)
@ppup = value
@pp = @pp.clamp(0, total_pp)
end
# Returns the total PP of this move, taking PP Ups into account.
# @return [Integer] total PP
def total_pp
max_pp = GameData::Move.get(@id).total_pp
return max_pp + max_pp * @ppup / 5
end
alias totalpp total_pp
def function_code; return GameData::Move.get(@id).function_code; end
def base_damage; return GameData::Move.get(@id).base_damage; end
def type; return GameData::Move.get(@id).type; end
def category; return GameData::Move.get(@id).category; end
def accuracy; return GameData::Move.get(@id).accuracy; end
def effect_chance; return GameData::Move.get(@id).effect_chance; end
def target; return GameData::Move.get(@id).target; end
def priority; return GameData::Move.get(@id).priority; end
def flags; return GameData::Move.get(@id).flags; end
def name; return GameData::Move.get(@id).name; end
def description; return GameData::Move.get(@id).description; end
def hidden_move?; return GameData::Move.get(@id).hidden_move?; end
end
end
#===============================================================================
# Move objects known by Pokémon.
#===============================================================================
class PBMove
attr_reader :id, :pp, :ppup
def self.copy(move)
ret = Pokemon::Move.new(move.id)
ret.ppup = move.ppup
ret.pp = move.pp
return ret
end
end

View File

@@ -36,9 +36,9 @@ def pbPurify(pokemon,scene)
end end
pokemon.savedev = nil pokemon.savedev = nil
end end
newexp = PBExperience.pbAddExperience(pokemon.exp,pokemon.savedexp||0,pokemon.growthrate) newexp = PBExperience.pbAddExperience(pokemon.exp,pokemon.savedexp||0,pokemon.growth_rate)
pokemon.savedexp = nil pokemon.savedexp = nil
newlevel = PBExperience.pbGetLevelFromExperience(newexp,pokemon.growthrate) newlevel = PBExperience.pbGetLevelFromExperience(newexp,pokemon.growth_rate)
curlevel = pokemon.level curlevel = pokemon.level
if newexp!=pokemon.exp if newexp!=pokemon.exp
scene.pbDisplay(_INTL("{1} regained {2} Exp. Points!",pokemon.name,newexp-pokemon.exp)) scene.pbDisplay(_INTL("{1} regained {2} Exp. Points!",pokemon.name,newexp-pokemon.exp))
@@ -53,7 +53,7 @@ def pbPurify(pokemon,scene)
if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?", pokemon.speciesName)) if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?", pokemon.speciesName))
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pokemon.speciesName), newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pokemon.speciesName),
0, Pokemon::MAX_NAME_SIZE, "", pokemon) 0, Pokemon::MAX_NAME_SIZE, "", pokemon)
pokemon.name = newname if newname!="" pokemon.name = newname
end end
end end

View File

@@ -529,7 +529,7 @@ PBEvolution.register(:HappinessHoldItem, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })
@@ -557,7 +557,7 @@ PBEvolution.register(:HoldItem, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })
@@ -570,7 +570,7 @@ PBEvolution.register(:HoldItemMale, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })
@@ -583,7 +583,7 @@ PBEvolution.register(:HoldItemFemale, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })
@@ -596,7 +596,7 @@ PBEvolution.register(:DayHoldItem, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })
@@ -609,7 +609,7 @@ PBEvolution.register(:NightHoldItem, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })
@@ -622,7 +622,7 @@ PBEvolution.register(:HoldItemHappiness, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })
@@ -757,7 +757,7 @@ PBEvolution.register(:TradeItem, {
}, },
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species| "afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
next false if evo_species != new_species || !pkmn.hasItem?(parameter) next false if evo_species != new_species || !pkmn.hasItem?(parameter)
pkmn.setItem(nil) # Item is now consumed pkmn.item = nil # Item is now consumed
next true next true
} }
}) })

View File

@@ -28,49 +28,50 @@ class PokeBattle_Pokemon
def self.copy(pkmn) def self.copy(pkmn)
owner = Pokemon::Owner.new(pkmn.trainerID, pkmn.ot, pkmn.otgender, pkmn.language) owner = Pokemon::Owner.new(pkmn.trainerID, pkmn.ot, pkmn.otgender, pkmn.language)
ret = Pokemon.new(pkmn.species, pkmn.level, owner, false) ret = Pokemon.new(pkmn.species, pkmn.level, owner, false)
ret.name = pkmn.name ret.forcedForm = pkmn.forcedForm if pkmn.forcedForm
ret.exp = pkmn.exp
ret.formTime = pkmn.formTime ret.formTime = pkmn.formTime
ret.forcedForm = pkmn.forcedForm ret.exp = pkmn.exp
ret.hp = pkmn.hp ret.eggsteps = pkmn.eggsteps
ret.abilityflag = pkmn.abilityflag
ret.genderflag = pkmn.genderflag
ret.natureflag = pkmn.natureflag
ret.natureOverride = pkmn.natureOverride
ret.shinyflag = pkmn.shinyflag
ret.item_id = pkmn.item
ret.mail = pkmn.mail
ret.moves = pkmn.moves
ret.firstmoves = pkmn.firstmoves.clone
ret.status = pkmn.status ret.status = pkmn.status
ret.statusCount = pkmn.statusCount ret.statusCount = pkmn.statusCount
ret.iv = pkmn.iv.clone ret.gender = pkmn.genderflag
ret.ev = pkmn.ev.clone ret.shiny = pkmn.shinyflag
ret.ivMaxed = pkmn.ivMaxed if pkmn.ivMaxed ret.ability_index = pkmn.abilityflag
ret.happiness = pkmn.happiness ret.nature = pkmn.natureflag
ret.ballused = pkmn.ballused ret.nature_for_stats = pkmn.natureOverride
ret.eggsteps = pkmn.eggsteps ret.item = pkmn.item
ret.markings = pkmn.markings if pkmn.markings ret.mail = PokemonMail.copy(pkmn.mail) if pkmn.mail
ret.ribbons = pkmn.ribbons.clone pkmn.moves.each { |m| ret.moves.push(PBMove.copy(m)) if m && m.id > 0 }
ret.pokerus = pkmn.pokerus pkmn.firstmoves.each { |m| ret.pbAddFirstMove(m) }
ret.personalID = pkmn.personalID ret.ribbons = pkmn.ribbons.clone if pkmn.ribbons
ret.obtainMode = pkmn.obtainMode
ret.obtainMap = pkmn.obtainMap
ret.obtainText = pkmn.obtainText
ret.obtainLevel = pkmn.obtainLevel if pkmn.obtainLevel
ret.hatchedMap = pkmn.hatchedMap
ret.timeReceived = pkmn.timeReceived
ret.timeEggHatched = pkmn.timeEggHatched
ret.cool = pkmn.cool if pkmn.cool ret.cool = pkmn.cool if pkmn.cool
ret.beauty = pkmn.beauty if pkmn.beauty ret.beauty = pkmn.beauty if pkmn.beauty
ret.cute = pkmn.cute if pkmn.cute ret.cute = pkmn.cute if pkmn.cute
ret.smart = pkmn.smart if pkmn.smart ret.smart = pkmn.smart if pkmn.smart
ret.tough = pkmn.tough if pkmn.tough ret.tough = pkmn.tough if pkmn.tough
ret.sheen = pkmn.sheen if pkmn.sheen ret.sheen = pkmn.sheen if pkmn.sheen
ret.pokerus = pkmn.pokerus if pkmn.pokerus
ret.name = pkmn.name
ret.happiness = pkmn.happiness
ret.ballused = pkmn.ballused
ret.markings = pkmn.markings if pkmn.markings
ret.iv = pkmn.iv.clone
ret.ivMaxed = pkmn.ivMaxed.clone if pkmn.ivMaxed
ret.ev = pkmn.ev.clone
ret.obtain_method = pkmn.obtainMode
ret.obtainMap = pkmn.obtainMap
ret.obtainText = pkmn.obtainText
ret.obtainLevel = pkmn.obtainLevel if pkmn.obtainLevel
ret.hatchedMap = pkmn.hatchedMap
ret.timeReceived = pkmn.timeReceived
ret.timeEggHatched = pkmn.timeEggHatched
if pkmn.fused if pkmn.fused
ret.fused = PokeBattle_Pokemon.copy(pkmn.fused) if pkmn.fused.is_a?(PokeBattle_Pokemon) ret.fused = PokeBattle_Pokemon.copy(pkmn.fused) if pkmn.fused.is_a?(PokeBattle_Pokemon)
ret.fused = pkmn.fused if pkmn.fused.is_a?(Pokemon) ret.fused = pkmn.fused if pkmn.fused.is_a?(Pokemon)
end end
ret.personalID = pkmn.personalID
ret.hp = pkmn.hp
ret.shadow = pkmn.shadow ret.shadow = pkmn.shadow
ret.heartgauge = pkmn.heartgauge ret.heartgauge = pkmn.heartgauge
ret.savedexp = pkmn.savedexp ret.savedexp = pkmn.savedexp
@@ -79,7 +80,8 @@ class PokeBattle_Pokemon
ret.shadowmoves = pkmn.shadowmoves.clone ret.shadowmoves = pkmn.shadowmoves.clone
ret.shadowmovenum = pkmn.shadowmovenum ret.shadowmovenum = pkmn.shadowmovenum
# NOTE: Intentionally set last, as it recalculates stats. # NOTE: Intentionally set last, as it recalculates stats.
ret.formSimple = pkmn.form ret.formSimple = pkmn.form || 0
return ret
end end
end end
@@ -140,6 +142,42 @@ class Pokemon
Deprecation.warn_method('Pokemon#language=', 'v20', 'Pokemon::Owner#language=') Deprecation.warn_method('Pokemon#language=', 'v20', 'Pokemon::Owner#language=')
@owner.language = value @owner.language = value
end end
# @deprecated Use {Pokemon#gender=} instead. This alias is slated to be removed in v20.
def setGender(value)
Deprecation.warn_method('Pokemon#setGender', 'v20', 'Pokemon#gender=')
self.gender = value
end
# @deprecated Use {Pokemon#shiny=} instead. This alias is slated to be removed in v20.
def makeShiny
Deprecation.warn_method('Pokemon#makeShiny', 'v20', 'Pokemon#shiny=true')
self.shiny = true
end
# @deprecated Use {Pokemon#shiny=} instead. This alias is slated to be removed in v20.
def makeNotShiny
Deprecation.warn_method('Pokemon#makeNotShiny', 'v20', 'Pokemon#shiny=false')
self.shiny = false
end
# @deprecated Use {Pokemon#ability_index=} instead. This alias is slated to be removed in v20.
def setAbility(value)
Deprecation.warn_method('Pokemon#setAbility', 'v20', 'Pokemon#ability_index=')
self.ability_index = value
end
# @deprecated Use {Pokemon#nature=} instead. This alias is slated to be removed in v20.
def setNature(value)
Deprecation.warn_method('Pokemon#setNature', 'v20', 'Pokemon#nature=')
self.nature = value
end
# @deprecated Use {Pokemon#item=} instead. This alias is slated to be removed in v20.
def setItem(value)
Deprecation.warn_method('Pokemon#setItem', 'v20', 'Pokemon#item=')
self.item = value
end
end end
# (see Pokemon#initialize) # (see Pokemon#initialize)

View File

@@ -866,7 +866,7 @@ class PokemonPartyScreen
else else
pbDisplay(_INTL("Mail was transferred from the Mailbox.")) pbDisplay(_INTL("Mail was transferred from the Mailbox."))
pkmn.mail = $PokemonGlobal.mailbox[mailIndex] pkmn.mail = $PokemonGlobal.mailbox[mailIndex]
pkmn.setItem(pkmn.mail.item) pkmn.item = pkmn.mail.item
$PokemonGlobal.mailbox.delete_at(mailIndex) $PokemonGlobal.mailbox.delete_at(mailIndex)
pbRefreshSingle(pkmnid) pbRefreshSingle(pkmnid)
end end
@@ -1286,8 +1286,8 @@ class PokemonPartyScreen
if newpkmn.egg? if newpkmn.egg?
pbDisplay(_INTL("Eggs can't hold items.")) pbDisplay(_INTL("Eggs can't hold items."))
elsif !newpkmn.hasItem? elsif !newpkmn.hasItem?
newpkmn.setItem(item) newpkmn.item = item
pkmn.setItem(nil) pkmn.item = nil
@scene.pbClearSwitching @scene.pbClearSwitching
pbRefresh pbRefresh
pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname)) pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname))
@@ -1305,8 +1305,8 @@ class PokemonPartyScreen
pbDisplay(_INTL("{1} is already holding a {2}.\1",newpkmn.name,newitemname)) pbDisplay(_INTL("{1} is already holding a {2}.\1",newpkmn.name,newitemname))
end end
if pbConfirm(_INTL("Would you like to switch the two items?")) if pbConfirm(_INTL("Would you like to switch the two items?"))
newpkmn.setItem(item) newpkmn.item = item
pkmn.setItem(newitem) pkmn.item = newitem
@scene.pbClearSwitching @scene.pbClearSwitching
pbRefresh pbRefresh
pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname)) pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname))

View File

@@ -191,7 +191,7 @@ class PokemonSummary_Scene
@sprites["movesel"].visible = false @sprites["movesel"].visible = false
@sprites["movesel"].visible = true @sprites["movesel"].visible = true
@sprites["movesel"].index = 0 @sprites["movesel"].index = 0
new_move = (move_to_learn) ? PBMove.new(move_to_learn) : nil new_move = (move_to_learn) ? Pokemon::Move.new(move_to_learn) : nil
drawSelectedMove(new_move,@pokemon.moves[0]) drawSelectedMove(new_move,@pokemon.moves[0])
pbFadeInAndShow(@sprites) pbFadeInAndShow(@sprites)
end end
@@ -436,7 +436,7 @@ class PokemonSummary_Scene
memo = sprintf("<c3=404040,B0B0B0>%s\n",heartmessage) memo = sprintf("<c3=404040,B0B0B0>%s\n",heartmessage)
drawFormattedTextEx(overlay,234,304,264,memo) drawFormattedTextEx(overlay,234,304,264,memo)
else else
endexp = PBExperience.pbGetStartExperience(@pokemon.level+1,@pokemon.growthrate) endexp = PBExperience.pbGetStartExperience(@pokemon.level+1,@pokemon.growth_rate)
textpos.push([_INTL("Exp. Points"),238,240,0,base,shadow]) textpos.push([_INTL("Exp. Points"),238,240,0,base,shadow])
textpos.push([@pokemon.exp.to_s_formatted,488,272,1,Color.new(64,64,64),Color.new(176,176,176)]) textpos.push([@pokemon.exp.to_s_formatted,488,272,1,Color.new(64,64,64),Color.new(176,176,176)])
textpos.push([_INTL("To Next Lv."),238,304,0,base,shadow]) textpos.push([_INTL("To Next Lv."),238,304,0,base,shadow])
@@ -554,10 +554,10 @@ class PokemonSummary_Scene
_INTL("Traded at Lv. {1}.",@pokemon.obtainLevel), _INTL("Traded at Lv. {1}.",@pokemon.obtainLevel),
"", "",
_INTL("Had a fateful encounter at Lv. {1}.",@pokemon.obtainLevel) _INTL("Had a fateful encounter at Lv. {1}.",@pokemon.obtainLevel)
][@pokemon.obtainMode] ][@pokemon.obtain_method]
memo += sprintf("<c3=404040,B0B0B0>%s\n",mettext) if mettext && mettext!="" memo += sprintf("<c3=404040,B0B0B0>%s\n",mettext) if mettext && mettext!=""
# If Pokémon was hatched, write when and where it hatched # If Pokémon was hatched, write when and where it hatched
if @pokemon.obtainMode==1 if @pokemon.obtain_method == 1
if @pokemon.timeEggHatched if @pokemon.timeEggHatched
date = @pokemon.timeEggHatched.day date = @pokemon.timeEggHatched.day
month = pbGetMonthName(@pokemon.timeEggHatched.mon) month = pbGetMonthName(@pokemon.timeEggHatched.mon)
@@ -627,8 +627,8 @@ class PokemonSummary_Scene
statshadows = [] statshadows = []
PBStats.eachStat { |s| statshadows[s] = shadow } PBStats.eachStat { |s| statshadows[s] = shadow }
if !@pokemon.shadowPokemon? || @pokemon.heartStage>3 if !@pokemon.shadowPokemon? || @pokemon.heartStage>3
natup = PBNatures.getStatRaised(@pokemon.calcNature) natup = PBNatures.getStatRaised(@pokemon.nature_for_stats)
natdn = PBNatures.getStatLowered(@pokemon.calcNature) natdn = PBNatures.getStatLowered(@pokemon.nature_for_stats)
statshadows[natup] = Color.new(136,96,72) if natup!=natdn statshadows[natup] = Color.new(136,96,72) if natup!=natdn
statshadows[natdn] = Color.new(64,120,152) if natup!=natdn statshadows[natdn] = Color.new(64,120,152) if natup!=natdn
end end
@@ -1202,7 +1202,7 @@ class PokemonSummary_Scene
end end
def pbChooseMoveToForget(move_to_learn) def pbChooseMoveToForget(move_to_learn)
new_move = (move_to_learn) ? PBMove.new(move_to_learn) : nil new_move = (move_to_learn) ? Pokemon::Move.new(move_to_learn) : nil
selmove = 0 selmove = 0
maxmove = (new_move) ? Pokemon::MAX_MOVES : Pokemon::MAX_MOVES - 1 maxmove = (new_move) ? Pokemon::MAX_MOVES : Pokemon::MAX_MOVES - 1
loop do loop do

View File

@@ -489,7 +489,7 @@ class PokemonBagScreen
command = @scene.pbShowCommands(_INTL("{1} is selected.",itemname),commands) command = @scene.pbShowCommands(_INTL("{1} is selected.",itemname),commands)
if cmdRead>=0 && command==cmdRead # Read mail if cmdRead>=0 && command==cmdRead # Read mail
pbFadeOutIn { pbFadeOutIn {
pbDisplayMail(PokemonMail.new(item,"","")) pbDisplayMail(Mail.new(item, "", ""))
} }
elsif cmdUse>=0 && command==cmdUse # Use item elsif cmdUse>=0 && command==cmdUse # Use item
ret = pbUseItem(@bag,item,@scene) ret = pbUseItem(@bag,item,@scene)

View File

@@ -1880,7 +1880,7 @@ class PokemonStorageScreen
pbDisplay(_INTL("Can't store the {1}.",itemname)) pbDisplay(_INTL("Can't store the {1}.",itemname))
else else
pbDisplay(_INTL("Took the {1}.",itemname)) pbDisplay(_INTL("Took the {1}.",itemname))
pokemon.setItem(nil) pokemon.item = nil
@scene.pbHardRefresh @scene.pbHardRefresh
end end
end end
@@ -1888,7 +1888,7 @@ class PokemonStorageScreen
item = scene.pbChooseItem($PokemonBag) item = scene.pbChooseItem($PokemonBag)
if item if item
itemname = GameData::Item.get(item).name itemname = GameData::Item.get(item).name
pokemon.setItem(item) pokemon.item = item
$PokemonBag.pbDeleteItem(item) $PokemonBag.pbDeleteItem(item)
pbDisplay(_INTL("{1} is now being held.",itemname)) pbDisplay(_INTL("{1} is now being held.",itemname))
@scene.pbHardRefresh @scene.pbHardRefresh

View File

@@ -104,13 +104,14 @@ class PokemonEggHatch_Scene
updateScene(frames) updateScene(frames)
pbBGMStop() pbBGMStop()
pbMEPlay("Evolution success") pbMEPlay("Evolution success")
pbMessage(_INTL("\\se[]{1} hatched from the Egg!\\wt[80]",@pokemon.name)) { update } @pokemon.name = nil
pbMessage(_INTL("\\se[]{1} hatched from the Egg!\\wt[80]", @pokemon.name)) { update }
if pbConfirmMessage( if pbConfirmMessage(
_INTL("Would you like to nickname the newly hatched {1}?",@pokemon.name)) { update } _INTL("Would you like to nickname the newly hatched {1}?", @pokemon.name)) { update }
nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",@pokemon.name), nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", @pokemon.name),
0, Pokemon::MAX_NAME_SIZE, "", @pokemon, true) 0, Pokemon::MAX_NAME_SIZE, "", @pokemon, true)
@pokemon.name=nickname if nickname!="" @pokemon.name = nickname
@nicknamed=true @nicknamed = true
end end
end end
@@ -192,11 +193,11 @@ end
def pbHatch(pokemon) def pbHatch(pokemon)
speciesname = pokemon.speciesName speciesname = pokemon.speciesName
pokemon.name = speciesname pokemon.name = nil
pokemon.owner = Pokemon::Owner.new_from_trainer($Trainer) pokemon.owner = Pokemon::Owner.new_from_trainer($Trainer)
pokemon.happiness = 120 pokemon.happiness = 120
pokemon.timeEggHatched = pbGetTimeNow pokemon.timeEggHatched = pbGetTimeNow
pokemon.obtainMode = 1 # hatched from egg pokemon.obtain_method = 1 # hatched from egg
pokemon.hatchedMap = $game_map.map_id pokemon.hatchedMap = $game_map.map_id
$Trainer.seen[pokemon.species] = true $Trainer.seen[pokemon.species] = true
$Trainer.owned[pokemon.species] = true $Trainer.owned[pokemon.species] = true
@@ -206,11 +207,11 @@ def pbHatch(pokemon)
pbMessage(_INTL("Huh?\1")) pbMessage(_INTL("Huh?\1"))
pbMessage(_INTL("...\1")) pbMessage(_INTL("...\1"))
pbMessage(_INTL("... .... .....\1")) pbMessage(_INTL("... .... .....\1"))
pbMessage(_INTL("{1} hatched from the Egg!",speciesname)) pbMessage(_INTL("{1} hatched from the Egg!", speciesname))
if pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",speciesname)) if pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?", speciesname))
nickname = pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname), nickname = pbEnterPokemonName(_INTL("{1}'s nickname?", speciesname),
0, Pokemon::MAX_NAME_SIZE, "", pokemon) 0, Pokemon::MAX_NAME_SIZE, "", pokemon)
pokemon.name = nickname if nickname!="" pokemon.name = nickname
end end
end end
end end

View File

@@ -577,7 +577,6 @@ class PokemonEvolutionScene
# Success jingle/message # Success jingle/message
pbMEPlay("Evolution success") pbMEPlay("Evolution success")
newspeciesname = GameData::Species.get(@newspecies).name newspeciesname = GameData::Species.get(@newspecies).name
is_nicknamed = @pokemon.nicknamed?
pbMessageDisplay(@sprites["msgwindow"], pbMessageDisplay(@sprites["msgwindow"],
_INTL("\\se[]Congratulations! Your {1} evolved into {2}!\\wt[80]", _INTL("\\se[]Congratulations! Your {1} evolved into {2}!\\wt[80]",
@pokemon.name,newspeciesname)) { pbUpdate } @pokemon.name,newspeciesname)) { pbUpdate }
@@ -586,7 +585,6 @@ class PokemonEvolutionScene
pbEvolutionMethodAfterEvolution pbEvolutionMethodAfterEvolution
# Modify Pokémon to make it evolved # Modify Pokémon to make it evolved
@pokemon.species = @newspecies @pokemon.species = @newspecies
@pokemon.name = newspeciesname if !is_nicknamed
@pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM) @pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM)
@pokemon.calcStats @pokemon.calcStats
# See and own evolved species # See and own evolved species
@@ -611,10 +609,10 @@ class PokemonEvolutionScene
def self.pbDuplicatePokemon(pkmn, new_species) def self.pbDuplicatePokemon(pkmn, new_species)
new_pkmn = pkmn.clone new_pkmn = pkmn.clone
new_pkmn.species = new_species new_pkmn.species = new_species
new_pkmn.name = GameData::Species.get(new_species).name new_pkmn.name = nil
new_pkmn.markings = 0 new_pkmn.markings = 0
new_pkmn.ballused = 0 new_pkmn.ballused = 0
new_pkmn.setItem(nil) new_pkmn.item = nil
new_pkmn.clearAllRibbons new_pkmn.clearAllRibbons
new_pkmn.calcStats new_pkmn.calcStats
new_pkmn.heal new_pkmn.heal

View File

@@ -208,8 +208,8 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
raise _INTL("Species does not exist ({1}).", newpoke) if !species_data raise _INTL("Species does not exist ({1}).", newpoke) if !species_data
yourPokemon = Pokemon.new(species_data.id, myPokemon.level, opponent) yourPokemon = Pokemon.new(species_data.id, myPokemon.level, opponent)
end end
yourPokemon.name = nickname yourPokemon.name = nickname
yourPokemon.obtainMode = 2 # traded yourPokemon.obtain_method = 2 # traded
yourPokemon.resetMoves if resetmoves yourPokemon.resetMoves if resetmoves
yourPokemon.pbRecordFirstMoves yourPokemon.pbRecordFirstMoves
$Trainer.seen[yourPokemon.species] = true $Trainer.seen[yourPokemon.species] = true

View File

@@ -383,7 +383,7 @@ def pbReceiveMysteryGift(id)
gift[2].calcStats gift[2].calcStats
time=pbGetTimeNow time=pbGetTimeNow
gift[2].timeReceived=time.getgm.to_i gift[2].timeReceived=time.getgm.to_i
gift[2].obtainMode=4 # Fateful encounter gift[2].obtain_method = 4 # Fateful encounter
gift[2].pbRecordFirstMoves gift[2].pbRecordFirstMoves
if $game_map if $game_map
gift[2].obtainMap=$game_map.map_id gift[2].obtainMap=$game_map.map_id

View File

@@ -154,16 +154,16 @@ class PBPokemon
def createPokemon(level,iv,trainer) def createPokemon(level,iv,trainer)
pokemon=Pokemon.new(@species,level,trainer,false) pokemon=Pokemon.new(@species,level,trainer,false)
pokemon.setItem(@item) pokemon.item = @item
pokemon.personalID = rand(2**16) | rand(2**16) << 16 pokemon.personalID = rand(2**16) | rand(2**16) << 16
pokemon.personalID -= pokemon.personalID % 25 pokemon.personalID -= pokemon.personalID % 25
pokemon.personalID += nature pokemon.personalID += nature
pokemon.personalID &= 0xFFFFFFFF pokemon.personalID &= 0xFFFFFFFF
pokemon.happiness=0 pokemon.happiness=0
pokemon.moves[0]=PBMove.new(self.convertMove(@move1)) pokemon.moves[0] = Pokemon::Move.new(self.convertMove(@move1))
pokemon.moves[1]=PBMove.new(self.convertMove(@move2)) pokemon.moves[1] = Pokemon::Move.new(self.convertMove(@move2))
pokemon.moves[2]=PBMove.new(self.convertMove(@move3)) pokemon.moves[2] = Pokemon::Move.new(self.convertMove(@move3))
pokemon.moves[3]=PBMove.new(self.convertMove(@move4)) pokemon.moves[3] = Pokemon::Move.new(self.convertMove(@move4))
evcount=0 evcount=0
for i in 0...6 for i in 0...6
evcount+=1 if ((@ev&(1<<i))!=0) evcount+=1 if ((@ev&(1<<i))!=0)
@@ -958,13 +958,13 @@ def pbOrganizedBattleEx(opponent,challengedata,endspeech,endspeechwin)
pkmn.heal pkmn.heal
pkmn.makeUnmega pkmn.makeUnmega
pkmn.makeUnprimal pkmn.makeUnprimal
pkmn.setItem(olditems[i]) pkmn.item = olditems[i]
end end
opponent.party.each_with_index do |pkmn,i| opponent.party.each_with_index do |pkmn,i|
pkmn.heal pkmn.heal
pkmn.makeUnmega pkmn.makeUnmega
pkmn.makeUnprimal pkmn.makeUnprimal
pkmn.setItem(olditems2[i]) pkmn.item = olditems2[i]
end end
# Save the record of the battle # Save the record of the battle
$PokemonTemp.lastbattle = nil $PokemonTemp.lastbattle = nil

View File

@@ -872,12 +872,12 @@ def pbRuledBattle(team1,team2,rule)
team1.each_with_index do |p,i| team1.each_with_index do |p,i|
next if !p next if !p
p.heal p.heal
p.setItem(items1[i]) p.item = items1[i]
end end
team2.each_with_index do |p,i| team2.each_with_index do |p,i|
next if !p next if !p
p.heal p.heal
p.setItem(items2[i]) p.item = items2[i]
end end
end end
if decision==1 # Team 1 wins if decision==1 # Team 1 wins

View File

@@ -8,9 +8,8 @@ end
def pbNickname(pkmn) def pbNickname(pkmn)
species_name = pkmn.speciesName species_name = pkmn.speciesName
if pbConfirmMessage(_INTL("Would you like to give a nickname to {1}?", species_name)) if pbConfirmMessage(_INTL("Would you like to give a nickname to {1}?", species_name))
new_name = pbEnterPokemonName(_INTL("{1}'s nickname?", species_name), pkmn.name = pbEnterPokemonName(_INTL("{1}'s nickname?", species_name),
0, Pokemon::MAX_NAME_SIZE, "", pkmn) 0, Pokemon::MAX_NAME_SIZE, "", pkmn)
pkmn.name = new_name if new_name != ""
end end
end end
@@ -123,7 +122,7 @@ def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner
# Set original trainer to a foreign one # Set original trainer to a foreign one
pkmn.owner = Pokemon::Owner.new_foreign(owner_name || "", owner_gender) pkmn.owner = Pokemon::Owner.new_foreign(owner_name || "", owner_gender)
# Set nickname # Set nickname
pkmn.name = nickname[0, Pokemon::MAX_NAME_SIZE] if nickname && nickname!="" pkmn.name = nickname[0, Pokemon::MAX_NAME_SIZE]
# Recalculate stats # Recalculate stats
pkmn.calcStats pkmn.calcStats
if owner_name if owner_name
@@ -244,7 +243,7 @@ end
# player's party. # player's party.
def pbHasFatefulSpecies?(species) def pbHasFatefulSpecies?(species)
$Trainer.pokemonParty.each do |pkmn| $Trainer.pokemonParty.each do |pkmn|
return true if pkmn.isSpecies?(species) && pkmn.obtainMode == 4 return true if pkmn.isSpecies?(species) && pkmn.obtain_method == 4
end end
return false return false
end end

View File

@@ -262,7 +262,7 @@ def pbDebugDayCare
end end
y += 32 y += 32
if pkmn.level<PBExperience.maxLevel if pkmn.level<PBExperience.maxLevel
endexp = PBExperience.pbGetStartExperience(pkmn.level+1,pkmn.growthrate) endexp = PBExperience.pbGetStartExperience(pkmn.level+1,pkmn.growth_rate)
textpos.push(["To next Lv.: #{endexp-pkmn.exp}",8+i*Graphics.width/2,y,0,base,shadow]) textpos.push(["To next Lv.: #{endexp-pkmn.exp}",8+i*Graphics.width/2,y,0,base,shadow])
y += 32 y += 32
end end

View File

@@ -74,7 +74,7 @@ PokemonDebugMenuCommands.register("setstatus", {
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
if pkmn.egg? if pkmn.egg?
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name)) screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
elsif pkmn.hp<=0 elsif pkmn.hp <= 0
screen.pbDisplay(_INTL("{1} is fainted, can't change status.", pkmn.name)) screen.pbDisplay(_INTL("{1} is fainted, can't change status.", pkmn.name))
else else
cmd = 0 cmd = 0
@@ -219,8 +219,8 @@ PokemonDebugMenuCommands.register("setexp", {
if pkmn.egg? if pkmn.egg?
screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name)) screen.pbDisplay(_INTL("{1} is an egg.", pkmn.name))
else else
minxp = PBExperience.pbGetStartExperience(pkmn.level, pkmn.growthrate) minxp = PBExperience.pbGetStartExperience(pkmn.level, pkmn.growth_rate)
maxxp = PBExperience.pbGetStartExperience(pkmn.level + 1, pkmn.growthrate) maxxp = PBExperience.pbGetStartExperience(pkmn.level + 1, pkmn.growth_rate)
if minxp == maxxp if minxp == maxxp
screen.pbDisplay(_INTL("{1} is at the maximum level.", pkmn.name)) screen.pbDisplay(_INTL("{1} is at the maximum level.", pkmn.name))
else else
@@ -228,7 +228,7 @@ PokemonDebugMenuCommands.register("setexp", {
params.setRange(minxp, maxxp - 1) params.setRange(minxp, maxxp - 1)
params.setDefaultValue(pkmn.exp) params.setDefaultValue(pkmn.exp)
newexp = pbMessageChooseNumber( newexp = pbMessageChooseNumber(
_INTL("Set the Pokémon's Exp (range {1}-{2}).",minxp, maxxp - 1), params) { screen.pbUpdate } _INTL("Set the Pokémon's Exp (range {1}-{2}).", minxp, maxxp - 1), params) { screen.pbUpdate }
if newexp != pkmn.exp if newexp != pkmn.exp
pkmn.exp = newexp pkmn.exp = newexp
pkmn.calcStats pkmn.calcStats
@@ -616,15 +616,15 @@ PokemonDebugMenuCommands.register("setability", {
for i in abils for i in abils
commands.push(((i[1] < 2) ? "" : "(H) ") + GameData::Ability.get(i[0]).name) commands.push(((i[1] < 2) ? "" : "(H) ") + GameData::Ability.get(i[0]).name)
end end
commands.push(_INTL("Remove override")) commands.push(_INTL("[Reset]"))
msg = [_INTL("Ability {1} is natural.", oldabil), msg = [_INTL("Ability is {1} (normal).", oldabil),
_INTL("Ability {1} is being forced.", oldabil)][pkmn.abilityflag != nil ? 1 : 0] _INTL("Ability is {1} (hidden).", oldabil)][(pkmn.ability_index < 2) ? 0 : 1]
cmd = screen.pbShowCommands(msg, commands, cmd) cmd = screen.pbShowCommands(msg, commands, cmd)
break if cmd < 0 break if cmd < 0
if cmd >= 0 && cmd < abils.length # Set ability override if cmd >= 0 && cmd < abils.length # Set ability index
pkmn.setAbility(abils[cmd][1]) pkmn.ability_index = abils[cmd][1]
elsif cmd == abils.length # Remove override elsif cmd == abils.length # Reset
pkmn.abilityflag = nil pkmn.ability_index = nil
end end
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
@@ -648,19 +648,17 @@ PokemonDebugMenuCommands.register("setnature", {
end end
commands.push(text) commands.push(text)
end end
commands.push(_INTL("[Remove override]")) commands.push(_INTL("[Reset]"))
cmd = pkmn.nature cmd = pkmn.nature
loop do loop do
oldnature = PBNatures.getName(pkmn.nature) mag = _INTL("Nature is {1}.", PBNatures.getName(pkmn.nature))
msg = [_INTL("Nature {1} is natural.", oldnature), cmd = screen.pbShowCommands(mag, commands, cmd)
_INTL("Nature {1} is being forced.", oldnature)][pkmn.natureflag ? 1 : 0]
cmd = screen.pbShowCommands(msg, commands, cmd)
break if cmd < 0 break if cmd < 0
if cmd >= 0 && cmd < PBNatures.getCount # Set nature override if cmd >= 0 && cmd < PBNatures.getCount # Set nature
pkmn.setNature(cmd) pkmn.nature = cmd
pkmn.calcStats pkmn.calcStats
elsif cmd == PBNatures.getCount # Remove override elsif cmd == PBNatures.getCount # Reset
pkmn.natureflag = nil pkmn.nature = nil
end end
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
@@ -677,13 +675,11 @@ PokemonDebugMenuCommands.register("setgender", {
else else
cmd = 0 cmd = 0
loop do loop do
oldgender = (pkmn.male?) ? _INTL("male") : _INTL("female") msg = [_INTL("Gender is male."), _INTL("Gender is female.")][pkmn.male? ? 0 : 1]
msg = [_INTL("Gender {1} is natural.", oldgender),
_INTL("Gender {1} is being forced.", oldgender)][pkmn.genderflag ? 1 : 0]
cmd = screen.pbShowCommands(msg, [ cmd = screen.pbShowCommands(msg, [
_INTL("Make male"), _INTL("Make male"),
_INTL("Make female"), _INTL("Make female"),
_INTL("Remove override")], cmd) _INTL("Reset")], cmd)
break if cmd < 0 break if cmd < 0
case cmd case cmd
when 0 # Make male when 0 # Make male
@@ -696,8 +692,8 @@ PokemonDebugMenuCommands.register("setgender", {
if !pkmn.female? if !pkmn.female?
screen.pbDisplay(_INTL("{1}'s gender couldn't be changed.", pkmn.name)) screen.pbDisplay(_INTL("{1}'s gender couldn't be changed.", pkmn.name))
end end
when 2 # Remove override when 2 # Reset
pkmn.genderflag = nil pkmn.gender = nil
end end
pbSeenForm(pkmn) if !settingUpBattle pbSeenForm(pkmn) if !settingUpBattle
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
@@ -718,7 +714,7 @@ PokemonDebugMenuCommands.register("speciesform", {
cmd = screen.pbShowCommands(msg, [ cmd = screen.pbShowCommands(msg, [
_INTL("Set species"), _INTL("Set species"),
_INTL("Set form"), _INTL("Set form"),
_INTL("Remove override")], cmd) _INTL("Remove form override")], cmd)
break if cmd < 0 break if cmd < 0
case cmd case cmd
when 0 # Set species when 0 # Set species
@@ -757,7 +753,7 @@ PokemonDebugMenuCommands.register("speciesform", {
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
end end
when 2 # Remove override when 2 # Remove form override
pkmn.forcedForm = nil pkmn.forcedForm = nil
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
@@ -781,21 +777,19 @@ PokemonDebugMenuCommands.register("setshininess", {
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
cmd = 0 cmd = 0
loop do loop do
oldshiny = (pkmn.shiny?) ? _INTL("shiny") : _INTL("normal") msg = [_INTL("Is shiny."), _INTL("Is normal (not shiny).")][pkmn.shiny? ? 0 : 1]
msg = [_INTL("Shininess ({1}) is natural.", oldshiny),
_INTL("Shininess ({1}) is being forced.", oldshiny)][pkmn.shinyflag != nil ? 1 : 0]
cmd = screen.pbShowCommands(msg, [ cmd = screen.pbShowCommands(msg, [
_INTL("Make shiny"), _INTL("Make shiny"),
_INTL("Make normal"), _INTL("Make normal"),
_INTL("Remove override")], cmd) _INTL("Reset")], cmd)
break if cmd < 0 break if cmd < 0
case cmd case cmd
when 0 # Make shiny when 0 # Make shiny
pkmn.makeShiny pkmn.shiny = true
when 1 # Make normal when 1 # Make normal
pkmn.makeNotShiny pkmn.shiny = false
when 2 # Remove override when 2 # Reset
pkmn.shinyflag = nil pkmn.shiny = nil
end end
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
@@ -874,22 +868,20 @@ PokemonDebugMenuCommands.register("setnickname", {
loop do loop do
speciesname = pkmn.speciesName speciesname = pkmn.speciesName
msg = [_INTL("{1} has the nickname {2}.", speciesname, pkmn.name), msg = [_INTL("{1} has the nickname {2}.", speciesname, pkmn.name),
_INTL("{1} has no nickname.", speciesname)][pkmn.name == speciesname ? 1 : 0] _INTL("{1} has no nickname.", speciesname)][pkmn.nicknamed? ? 0 : 1]
cmd = screen.pbShowCommands(msg, [ cmd = screen.pbShowCommands(msg, [
_INTL("Rename"), _INTL("Rename"),
_INTL("Erase name")], cmd) _INTL("Erase name")], cmd)
break if cmd < 0 break if cmd < 0
case cmd case cmd
when 0 # Rename when 0 # Rename
oldname = (pkmn.name && pkmn.name != speciesname) ? pkmn.name : "" oldname = (pkmn.nicknamed?) ? pkmn.name : ""
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", speciesname), newname = pbEnterPokemonName(_INTL("{1}'s nickname?", speciesname),
0, Pokemon::MAX_NAME_SIZE, oldname, pkmn) 0, Pokemon::MAX_NAME_SIZE, oldname, pkmn)
if newname && newname != "" pkmn.name = newname
pkmn.name = newname screen.pbRefreshSingle(pkmnid)
screen.pbRefreshSingle(pkmnid)
end
when 1 # Erase name when 1 # Erase name
pkmn.name = speciesname pkmn.name = nil
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
end end
@@ -958,20 +950,20 @@ PokemonDebugMenuCommands.register("setegg", {
when 0 # Make egg when 0 # Make egg
if !pkmn.egg? && (pbHasEgg?(pkmn.species) || if !pkmn.egg? && (pbHasEgg?(pkmn.species) ||
screen.pbConfirm(_INTL("{1} cannot legally be an egg. Make egg anyway?", pkmn.speciesName))) screen.pbConfirm(_INTL("{1} cannot legally be an egg. Make egg anyway?", pkmn.speciesName)))
pkmn.level = EGG_LEVEL pkmn.level = EGG_LEVEL
pkmn.calcStats pkmn.calcStats
pkmn.name = _INTL("Egg") pkmn.name = _INTL("Egg")
pkmn.eggsteps = pkmn.species_data.hatch_steps pkmn.eggsteps = pkmn.species_data.hatch_steps
pkmn.hatchedMap = 0 pkmn.hatchedMap = 0
pkmn.obtainMode = 1 pkmn.obtain_method = 1
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
when 1 # Make Pokémon when 1 # Make Pokémon
if pkmn.egg? if pkmn.egg?
pkmn.name = pkmn.speciesName pkmn.name = nil
pkmn.eggsteps = 0 pkmn.eggsteps = 0
pkmn.hatchedMap = 0 pkmn.hatchedMap = 0
pkmn.obtainMode = 0 pkmn.obtain_method = 0
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
when 2 # Set eggsteps to 1 when 2 # Set eggsteps to 1

View File

@@ -475,7 +475,7 @@ def pbTrainerBattleEditor
t = pbNewTrainer(tr_type, tr_name, tr_version, false) t = pbNewTrainer(tr_type, tr_name, tr_version, false)
if t if t
trainer_hash = { trainer_hash = {
:id => GameData::Trainer::HASH.keys.length / 2, :id => GameData::Trainer::DATA.keys.length / 2,
:trainer_type => tr_type, :trainer_type => tr_type,
:name => tr_name, :name => tr_name,
:version => tr_version, :version => tr_version,