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.formSimple = pkmn_data[:form]
end
pkmn.setItem(pkmn_data[:item])
pkmn.item = pkmn_data[:item]
if pkmn_data[:moves] && pkmn_data[:moves].length > 0
pkmn_data[:moves].each { |move| pkmn.pbLearnMove(move) }
else
pkmn.resetMoves
end
pkmn.setAbility(pkmn_data[:ability_flag])
gender = pkmn_data[:gender] || ((trainer.female?) ? 1 : 0)
pkmn.setGender(gender)
(pkmn_data[:shininess]) ? pkmn.makeShiny : pkmn.makeNotShiny
pkmn.ability_index = pkmn_data[:ability_flag]
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
if pkmn_data[:nature]
pkmn.setNature(pkmn_data[:nature])
pkmn.nature = pkmn_data[:nature]
else
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
PBStats.eachStat do |s|
if pkmn_data[:iv] && pkmn_data[:iv].length > 0
@@ -151,7 +150,7 @@ module GameData
if pkmn_data[:shadowness]
pkmn.makeShadow
pkmn.pbUpdateShadowMoves(true)
pkmn.makeNotShiny
pkmn.shiny = false
end
pkmn.ballused = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
pkmn.calcStats

View File

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

View File

@@ -93,7 +93,7 @@ class PokeBattle_Battler
@participants = [] # Participants earn Exp. if this battler is defeated
@moves = []
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
@iv = pkmn.iv.clone
end

View File

@@ -281,7 +281,7 @@ class PokeBattle_Battler
end
@moves.clear
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].total_pp = 5
end

View File

@@ -150,7 +150,7 @@ class PokeBattle_Battler
if idxMove>=0
choice[2] = @moves[idxMove]
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
end
choice[3] = target # Target (-1 means no target yet)
@@ -169,7 +169,7 @@ class PokeBattle_Battler
pbBeginTurn(choice)
# Force the use of certain moves if they're already being used
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
elsif @effects[PBEffects::Encore]>0 && choice[1]>=0 &&
@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
# object generated is a subclass of this one which depends on the move's
# function code (found in the script section PokeBattle_MoveEffect).
def PokeBattle_Move.pbFromPBMove(battle, move)
validate move => PBMove
def PokeBattle_Move.from_pokemon_move(battle, move)
validate move => Pokemon::Move
moveFunction = move.function_code || "000"
className = sprintf("PokeBattle_Move_%s", moveFunction)
if Object.const_defined?(className)

View File

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

View File

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

View File

@@ -161,9 +161,9 @@ class PokeBattle_Battle
@runCommand = 0
@nextPickupUse = 0
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
@struggle = PokeBattle_Struggle.new(self,nil)
@struggle = PokeBattle_Struggle.new(self, nil)
end
end

View File

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

View File

@@ -89,7 +89,7 @@ class PokeBattle_Battle
def pbGainExpOne(idxParty,defeatedBattler,numPartic,expShare,expAll,showMessages=true)
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
if pkmn.exp>=PBExperience.pbGetMaxExperience(growthRate)
pkmn.calcStats # To ensure new EVs still have an effect
@@ -100,7 +100,7 @@ class PokeBattle_Battle
level = defeatedBattler.level
# Main Exp calculation
exp = 0
a = level*defeatedBattler.pokemon.baseExp
a = level*defeatedBattler.pokemon.base_exp
if expShare.length>0 && (isPartic || hasExpShare)
if numPartic==0 # No participants, all Exp goes to Exp Share holders
exp = a/(SPLIT_EXP_BETWEEN_GAINERS ? expShare.length : 1)
@@ -227,8 +227,8 @@ class PokeBattle_Battle
for i in 0...Pokemon::MAX_MOVES
m = pkmn.moves[i]
return if m && m.id==newMove # Already knows the new move
pkmn.moves[i] = PBMove.new(newMove)
battler.moves[i] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[i]) if battler
pkmn.moves[i] = Pokemon::Move.new(newMove)
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") }
battler.pbCheckFormOnMovesetChange if battler
return
@@ -241,8 +241,8 @@ class PokeBattle_Battle
forgetMove = @scene.pbForgetMove(pkmn,newMove)
if forgetMove>=0
oldMoveName = pkmn.moves[forgetMove].name
pkmn.moves[forgetMove] = PBMove.new(newMove) # Replaces current/total PP
battler.moves[forgetMove] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[forgetMove]) if battler
pkmn.moves[forgetMove] = Pokemon::Move.new(newMove) # Replaces current/total PP
battler.moves[forgetMove] = PokeBattle_Move.from_pokemon_move(self, pkmn.moves[forgetMove]) if battler
pbDisplayPaused(_INTL("1, 2, and... ... ... Ta-da!"))
pbDisplayPaused(_INTL("{1} forgot how to use {2}. And...",pkmnName,oldMoveName))
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|
cumul += c
next if rnd>=cumul
pkmn.setItem(items[i])
pkmn.item = items[i]
break
end
end
# Try to gain a Honey item after a battle if a Pokemon has the ability Honey Gather.
def pbHoneyGather(pkmn)
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER)
return if pkmn.hasItem?
return if !GameData::Item.exists?(:HONEY)
chance = 5+((pkmn.level-1)/10)*5
return unless rand(100)<chance
pkmn.setItem(:HONEY)
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER) || pkmn.hasItem?
chance = 5 + ((pkmn.level - 1) / 10) * 5
return unless rand(100) < chance
pkmn.item = :HONEY
end

View File

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

View File

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

View File

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

View File

@@ -431,7 +431,7 @@ def pbLearnMove(pkmn,move,ignoreifknown=false,bymachine=false,&block)
if forgetmove>=0
oldmovename = pkmn.moves[forgetmove].name
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
pkmn.moves[forgetmove].pp = [oldmovepp,pkmn.moves[forgetmove].total_pp].min
end
@@ -633,7 +633,7 @@ def pbGiveItemToPokemon(item,pkmn,scene,pkmnid=0)
else
if GameData::Item.get(item).is_mail?
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))
return true
else
@@ -642,7 +642,7 @@ def pbGiveItemToPokemon(item,pkmn,scene,pkmnid=0)
end
end
else
pkmn.setItem(item)
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.",olditemname,pkmn.name,newitemname))
return true
end
@@ -651,7 +651,7 @@ def pbGiveItemToPokemon(item,pkmn,scene,pkmnid=0)
else
if !GameData::Item.get(item).is_mail? || pbWriteMail(item,pkmn,pkmnid,scene)
$PokemonBag.pbDeleteItem(item)
pkmn.setItem(item)
pkmn.item = item
scene.pbDisplay(_INTL("{1} is now holding the {2}.",pkmn.name,newitemname))
return true
end
@@ -671,20 +671,20 @@ def pbTakeItemFromPokemon(pkmn,scene)
scene.pbDisplay(_INTL("Your PC's Mailbox is full."))
else
scene.pbDisplay(_INTL("The mail was saved in your PC."))
pkmn.setItem(nil)
pkmn.item = nil
ret = true
end
elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?"))
$PokemonBag.pbStoreItem(pkmn.item)
scene.pbDisplay(_INTL("Received the {1} from {2}.",pkmn.item.name,pkmn.name))
pkmn.setItem(nil)
pkmn.item = nil
pkmn.mail = nil
ret = true
end
else
$PokemonBag.pbStoreItem(pkmn.item)
scene.pbDisplay(_INTL("Received the {1} from {2}.",pkmn.item.name,pkmn.name))
pkmn.setItem(nil)
pkmn.item = nil
ret = true
end
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."))
next false
end
newabil = (pkmn.abilityIndex+1)%2
newabil = (pkmn.ability_index + 1) % 2
newabilname = GameData::Ability.get((newabil==0) ? abil1 : abil2).name
if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
pkmn.name,newabilname))
pkmn.setAbility(newabil)
pkmn.ability_index = newabil
scene.pbRefresh
scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pkmn.name,newabilname))
next true

View File

@@ -196,7 +196,7 @@ Events.onWildPokemonCreate += proc { |_sender,e|
next if !grasses
for grass in grasses
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
end
}

View File

@@ -1,10 +1,9 @@
# Data structure representing mail that the Pokémon can hold
class PokemonMail
attr_accessor :item,:message,:sender,:poke1,:poke2,:poke3
class Mail
attr_accessor :item, :message, :sender, :poke1, :poke2, :poke3
def initialize(item, message, sender, poke1 = nil, poke2 = nil, poke3 = nil)
item = item.id if !item.is_a?(Symbol) && item.respond_to?("id")
@item = item # Item represented by this mail
@item = GameData::Item.get(item).id # Item represented by this mail
@message = message # Message text
@sender = sender # Name of the message's sender
@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)
$PokemonGlobal.mailbox = [] if !$PokemonGlobal.mailbox
return false if $PokemonGlobal.mailbox.length>=10
@@ -26,7 +36,7 @@ end
def pbStoreMail(pkmn,item,message,poke1=nil,poke2=nil,poke3=nil)
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
def pbDisplayMail(mail,_bearer=nil)
@@ -102,15 +112,15 @@ def pbWriteMail(item,pkmn,pkmnid,scene)
poke1 = poke2 = nil
if $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?
end
if $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?
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?
pbStoreMail(pkmn,item,message,poke1,poke2,poke3)
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
pokemon.savedev = nil
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
newlevel = PBExperience.pbGetLevelFromExperience(newexp,pokemon.growthrate)
newlevel = PBExperience.pbGetLevelFromExperience(newexp,pokemon.growth_rate)
curlevel = pokemon.level
if 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))
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pokemon.speciesName),
0, Pokemon::MAX_NAME_SIZE, "", pokemon)
pokemon.name = newname if newname!=""
pokemon.name = newname
end
end

View File

@@ -529,7 +529,7 @@ PBEvolution.register(:HappinessHoldItem, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})
@@ -557,7 +557,7 @@ PBEvolution.register(:HoldItem, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})
@@ -570,7 +570,7 @@ PBEvolution.register(:HoldItemMale, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})
@@ -583,7 +583,7 @@ PBEvolution.register(:HoldItemFemale, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})
@@ -596,7 +596,7 @@ PBEvolution.register(:DayHoldItem, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})
@@ -609,7 +609,7 @@ PBEvolution.register(:NightHoldItem, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})
@@ -622,7 +622,7 @@ PBEvolution.register(:HoldItemHappiness, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})
@@ -757,7 +757,7 @@ PBEvolution.register(:TradeItem, {
},
"afterEvolution" => proc { |pkmn, new_species, parameter, evo_species|
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
}
})

View File

@@ -28,49 +28,50 @@ class PokeBattle_Pokemon
def self.copy(pkmn)
owner = Pokemon::Owner.new(pkmn.trainerID, pkmn.ot, pkmn.otgender, pkmn.language)
ret = Pokemon.new(pkmn.species, pkmn.level, owner, false)
ret.name = pkmn.name
ret.exp = pkmn.exp
ret.forcedForm = pkmn.forcedForm if pkmn.forcedForm
ret.formTime = pkmn.formTime
ret.forcedForm = pkmn.forcedForm
ret.hp = pkmn.hp
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.exp = pkmn.exp
ret.eggsteps = pkmn.eggsteps
ret.status = pkmn.status
ret.statusCount = pkmn.statusCount
ret.iv = pkmn.iv.clone
ret.ev = pkmn.ev.clone
ret.ivMaxed = pkmn.ivMaxed if pkmn.ivMaxed
ret.happiness = pkmn.happiness
ret.ballused = pkmn.ballused
ret.eggsteps = pkmn.eggsteps
ret.markings = pkmn.markings if pkmn.markings
ret.ribbons = pkmn.ribbons.clone
ret.pokerus = pkmn.pokerus
ret.personalID = pkmn.personalID
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.gender = pkmn.genderflag
ret.shiny = pkmn.shinyflag
ret.ability_index = pkmn.abilityflag
ret.nature = pkmn.natureflag
ret.nature_for_stats = pkmn.natureOverride
ret.item = pkmn.item
ret.mail = PokemonMail.copy(pkmn.mail) if pkmn.mail
pkmn.moves.each { |m| ret.moves.push(PBMove.copy(m)) if m && m.id > 0 }
pkmn.firstmoves.each { |m| ret.pbAddFirstMove(m) }
ret.ribbons = pkmn.ribbons.clone if pkmn.ribbons
ret.cool = pkmn.cool if pkmn.cool
ret.beauty = pkmn.beauty if pkmn.beauty
ret.cute = pkmn.cute if pkmn.cute
ret.smart = pkmn.smart if pkmn.smart
ret.tough = pkmn.tough if pkmn.tough
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
ret.fused = PokeBattle_Pokemon.copy(pkmn.fused) if pkmn.fused.is_a?(PokeBattle_Pokemon)
ret.fused = pkmn.fused if pkmn.fused.is_a?(Pokemon)
end
ret.personalID = pkmn.personalID
ret.hp = pkmn.hp
ret.shadow = pkmn.shadow
ret.heartgauge = pkmn.heartgauge
ret.savedexp = pkmn.savedexp
@@ -79,7 +80,8 @@ class PokeBattle_Pokemon
ret.shadowmoves = pkmn.shadowmoves.clone
ret.shadowmovenum = pkmn.shadowmovenum
# NOTE: Intentionally set last, as it recalculates stats.
ret.formSimple = pkmn.form
ret.formSimple = pkmn.form || 0
return ret
end
end
@@ -140,6 +142,42 @@ class Pokemon
Deprecation.warn_method('Pokemon#language=', 'v20', 'Pokemon::Owner#language=')
@owner.language = value
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
# (see Pokemon#initialize)

View File

@@ -866,7 +866,7 @@ class PokemonPartyScreen
else
pbDisplay(_INTL("Mail was transferred from the Mailbox."))
pkmn.mail = $PokemonGlobal.mailbox[mailIndex]
pkmn.setItem(pkmn.mail.item)
pkmn.item = pkmn.mail.item
$PokemonGlobal.mailbox.delete_at(mailIndex)
pbRefreshSingle(pkmnid)
end
@@ -1286,8 +1286,8 @@ class PokemonPartyScreen
if newpkmn.egg?
pbDisplay(_INTL("Eggs can't hold items."))
elsif !newpkmn.hasItem?
newpkmn.setItem(item)
pkmn.setItem(nil)
newpkmn.item = item
pkmn.item = nil
@scene.pbClearSwitching
pbRefresh
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))
end
if pbConfirm(_INTL("Would you like to switch the two items?"))
newpkmn.setItem(item)
pkmn.setItem(newitem)
newpkmn.item = item
pkmn.item = newitem
@scene.pbClearSwitching
pbRefresh
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 = true
@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])
pbFadeInAndShow(@sprites)
end
@@ -436,7 +436,7 @@ class PokemonSummary_Scene
memo = sprintf("<c3=404040,B0B0B0>%s\n",heartmessage)
drawFormattedTextEx(overlay,234,304,264,memo)
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([@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])
@@ -554,10 +554,10 @@ class PokemonSummary_Scene
_INTL("Traded 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!=""
# If Pokémon was hatched, write when and where it hatched
if @pokemon.obtainMode==1
if @pokemon.obtain_method == 1
if @pokemon.timeEggHatched
date = @pokemon.timeEggHatched.day
month = pbGetMonthName(@pokemon.timeEggHatched.mon)
@@ -627,8 +627,8 @@ class PokemonSummary_Scene
statshadows = []
PBStats.eachStat { |s| statshadows[s] = shadow }
if !@pokemon.shadowPokemon? || @pokemon.heartStage>3
natup = PBNatures.getStatRaised(@pokemon.calcNature)
natdn = PBNatures.getStatLowered(@pokemon.calcNature)
natup = PBNatures.getStatRaised(@pokemon.nature_for_stats)
natdn = PBNatures.getStatLowered(@pokemon.nature_for_stats)
statshadows[natup] = Color.new(136,96,72) if natup!=natdn
statshadows[natdn] = Color.new(64,120,152) if natup!=natdn
end
@@ -1202,7 +1202,7 @@ class PokemonSummary_Scene
end
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
maxmove = (new_move) ? Pokemon::MAX_MOVES : Pokemon::MAX_MOVES - 1
loop do

View File

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

View File

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

View File

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

View File

@@ -577,7 +577,6 @@ class PokemonEvolutionScene
# Success jingle/message
pbMEPlay("Evolution success")
newspeciesname = GameData::Species.get(@newspecies).name
is_nicknamed = @pokemon.nicknamed?
pbMessageDisplay(@sprites["msgwindow"],
_INTL("\\se[]Congratulations! Your {1} evolved into {2}!\\wt[80]",
@pokemon.name,newspeciesname)) { pbUpdate }
@@ -586,7 +585,6 @@ class PokemonEvolutionScene
pbEvolutionMethodAfterEvolution
# Modify Pokémon to make it evolved
@pokemon.species = @newspecies
@pokemon.name = newspeciesname if !is_nicknamed
@pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM)
@pokemon.calcStats
# See and own evolved species
@@ -611,10 +609,10 @@ class PokemonEvolutionScene
def self.pbDuplicatePokemon(pkmn, new_species)
new_pkmn = pkmn.clone
new_pkmn.species = new_species
new_pkmn.name = GameData::Species.get(new_species).name
new_pkmn.name = nil
new_pkmn.markings = 0
new_pkmn.ballused = 0
new_pkmn.setItem(nil)
new_pkmn.item = nil
new_pkmn.clearAllRibbons
new_pkmn.calcStats
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
yourPokemon = Pokemon.new(species_data.id, myPokemon.level, opponent)
end
yourPokemon.name = nickname
yourPokemon.obtainMode = 2 # traded
yourPokemon.name = nickname
yourPokemon.obtain_method = 2 # traded
yourPokemon.resetMoves if resetmoves
yourPokemon.pbRecordFirstMoves
$Trainer.seen[yourPokemon.species] = true

View File

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

View File

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

View File

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

View File

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

View File

@@ -262,7 +262,7 @@ def pbDebugDayCare
end
y += 32
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])
y += 32
end

View File

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

View File

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