mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-22 06:06:01 +00:00
Revamped classes Pokemon, PBMove and PokemonMail
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user