mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-11 15:15:00 +00:00
game data
This commit is contained in:
@@ -0,0 +1,609 @@
|
||||
module MultipleForms
|
||||
@@formSpecies = SpeciesHandlerHash.new
|
||||
|
||||
def self.copy(sym,*syms)
|
||||
@@formSpecies.copy(sym,*syms)
|
||||
end
|
||||
|
||||
def self.register(sym,hash)
|
||||
@@formSpecies.add(sym,hash)
|
||||
end
|
||||
|
||||
def self.registerIf(cond,hash)
|
||||
@@formSpecies.addIf(cond,hash)
|
||||
end
|
||||
|
||||
def self.hasFunction?(pkmn,func)
|
||||
spec = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn
|
||||
sp = @@formSpecies[spec]
|
||||
return sp && sp[func]
|
||||
end
|
||||
|
||||
def self.getFunction(pkmn,func)
|
||||
spec = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn
|
||||
sp = @@formSpecies[spec]
|
||||
return (sp && sp[func]) ? sp[func] : nil
|
||||
end
|
||||
|
||||
def self.call(func,pkmn,*args)
|
||||
sp = @@formSpecies[pkmn.species]
|
||||
return nil if !sp || !sp[func]
|
||||
return sp[func].call(pkmn,*args)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def drawSpot(bitmap,spotpattern,x,y,red,green,blue)
|
||||
height = spotpattern.length
|
||||
width = spotpattern[0].length
|
||||
for yy in 0...height
|
||||
spot = spotpattern[yy]
|
||||
for xx in 0...width
|
||||
if spot[xx]==1
|
||||
xOrg = (x+xx)<<1
|
||||
yOrg = (y+yy)<<1
|
||||
color = bitmap.get_pixel(xOrg,yOrg)
|
||||
r = color.red+red
|
||||
g = color.green+green
|
||||
b = color.blue+blue
|
||||
color.red = [[r,0].max,255].min
|
||||
color.green = [[g,0].max,255].min
|
||||
color.blue = [[b,0].max,255].min
|
||||
bitmap.set_pixel(xOrg,yOrg,color)
|
||||
bitmap.set_pixel(xOrg+1,yOrg,color)
|
||||
bitmap.set_pixel(xOrg,yOrg+1,color)
|
||||
bitmap.set_pixel(xOrg+1,yOrg+1,color)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def pbSpindaSpots(pkmn,bitmap)
|
||||
spot1 = [
|
||||
[0,0,1,1,1,1,0,0],
|
||||
[0,1,1,1,1,1,1,0],
|
||||
[1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1],
|
||||
[0,1,1,1,1,1,1,0],
|
||||
[0,0,1,1,1,1,0,0]
|
||||
]
|
||||
spot2 = [
|
||||
[0,0,1,1,1,0,0],
|
||||
[0,1,1,1,1,1,0],
|
||||
[1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1],
|
||||
[0,1,1,1,1,1,0],
|
||||
[0,0,1,1,1,0,0]
|
||||
]
|
||||
spot3 = [
|
||||
[0,0,0,0,0,1,1,1,1,0,0,0,0],
|
||||
[0,0,0,1,1,1,1,1,1,1,0,0,0],
|
||||
[0,0,1,1,1,1,1,1,1,1,1,0,0],
|
||||
[0,1,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[0,1,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,1,1],
|
||||
[0,1,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[0,1,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[0,0,1,1,1,1,1,1,1,1,1,0,0],
|
||||
[0,0,0,1,1,1,1,1,1,1,0,0,0],
|
||||
[0,0,0,0,0,1,1,1,0,0,0,0,0]
|
||||
]
|
||||
spot4 = [
|
||||
[0,0,0,0,1,1,1,0,0,0,0,0],
|
||||
[0,0,1,1,1,1,1,1,1,0,0,0],
|
||||
[0,1,1,1,1,1,1,1,1,1,0,0],
|
||||
[0,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,1],
|
||||
[1,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[0,1,1,1,1,1,1,1,1,1,1,0],
|
||||
[0,0,1,1,1,1,1,1,1,1,0,0],
|
||||
[0,0,0,0,1,1,1,1,1,0,0,0]
|
||||
]
|
||||
id = pkmn.personalID
|
||||
h = (id>>28)&15
|
||||
g = (id>>24)&15
|
||||
f = (id>>20)&15
|
||||
e = (id>>16)&15
|
||||
d = (id>>12)&15
|
||||
c = (id>>8)&15
|
||||
b = (id>>4)&15
|
||||
a = (id)&15
|
||||
if pkmn.shiny?
|
||||
drawSpot(bitmap,spot1,b+33,a+25,-75,-10,-150)
|
||||
drawSpot(bitmap,spot2,d+21,c+24,-75,-10,-150)
|
||||
drawSpot(bitmap,spot3,f+39,e+7,-75,-10,-150)
|
||||
drawSpot(bitmap,spot4,h+15,g+6,-75,-10,-150)
|
||||
else
|
||||
drawSpot(bitmap,spot1,b+33,a+25,0,-115,-75)
|
||||
drawSpot(bitmap,spot2,d+21,c+24,0,-115,-75)
|
||||
drawSpot(bitmap,spot3,f+39,e+7,0,-115,-75)
|
||||
drawSpot(bitmap,spot4,h+15,g+6,0,-115,-75)
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Regular form differences
|
||||
#===============================================================================
|
||||
|
||||
MultipleForms.register(:UNOWN,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next rand(28)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SPINDA,{
|
||||
"alterBitmap" => proc { |pkmn,bitmap|
|
||||
pbSpindaSpots(pkmn,bitmap)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:CASTFORM,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GROUDON,{
|
||||
"getPrimalForm" => proc { |pkmn|
|
||||
next 1 if pkmn.hasItem?(:REDORB)
|
||||
next
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:KYOGRE,{
|
||||
"getPrimalForm" => proc { |pkmn|
|
||||
next 1 if pkmn.hasItem?(:BLUEORB)
|
||||
next
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:BURMY,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
case pbGetEnvironment
|
||||
when :Rock, :Sand, :Cave
|
||||
next 1 # Sandy Cloak
|
||||
when :None
|
||||
next 2 # Trash Cloak
|
||||
else
|
||||
next 0 # Plant Cloak
|
||||
end
|
||||
},
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next if !endBattle || !usedInBattle
|
||||
case battle.environment
|
||||
when :Rock, :Sand, :Cave
|
||||
next 1 # Sandy Cloak
|
||||
when :None
|
||||
next 2 # Trash Cloak
|
||||
else
|
||||
next 0 # Plant Cloak
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:WORMADAM,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
case pbGetEnvironment
|
||||
when :Rock, :Sand, :Cave
|
||||
next 1 # Sandy Cloak
|
||||
when :None
|
||||
next 2 # Trash Cloak
|
||||
else
|
||||
next 0 # Plant Cloak
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:CHERRIM,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ROTOM,{
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
form_moves = [
|
||||
:OVERHEAT, # Heat, Microwave
|
||||
:HYDROPUMP, # Wash, Washing Machine
|
||||
:BLIZZARD, # Frost, Refrigerator
|
||||
:AIRSLASH, # Fan
|
||||
:LEAFSTORM # Mow, Lawnmower
|
||||
]
|
||||
move_index = -1
|
||||
pkmn.moves.each_with_index do |move, i|
|
||||
next if !form_moves.any? { |m| m == move.id }
|
||||
move_index = i
|
||||
break
|
||||
end
|
||||
if form == 0
|
||||
# Turned back into the base form; forget form-specific moves
|
||||
if move_index >= 0
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.forget_move_at_index(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
new_move_id = form_moves[form - 1]
|
||||
if move_index >= 0
|
||||
# Knows another form's unique move; replace it
|
||||
old_move_name = pkmn.moves[move_index].name
|
||||
if GameData::Move.exists?(new_move_id)
|
||||
pkmn.moves[move_index].id = new_move_id
|
||||
new_move_name = pkmn.moves[move_index].name
|
||||
pbMessage(_INTL("1,\\wt[16] 2, and\\wt[16]...\\wt[16] ...\\wt[16] ... Ta-da!\\se[Battle ball drop]\1"))
|
||||
pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1", pkmn.name, old_move_name))
|
||||
pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]", pkmn.name, new_move_name))
|
||||
else
|
||||
pkmn.forget_move_at_index(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, old_move_name))
|
||||
pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
# Just try to learn this form's unique move
|
||||
pbLearnMove(pkmn, new_move_id, true)
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GIRATINA,{
|
||||
"getForm" => proc { |pkmn|
|
||||
maps = [49,50,51,72,73] # Map IDs for Origin Forme
|
||||
if pkmn.hasItem?(:GRISEOUSORB) || ($game_map && maps.include?($game_map.map_id))
|
||||
next 1
|
||||
end
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SHAYMIN,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next 0 if pkmn.fainted? || pkmn.status == :FROZEN || PBDayNight.isNight?
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ARCEUS,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next nil if !pkmn.hasAbility?(:MULTITYPE)
|
||||
typeArray = {
|
||||
1 => [:FISTPLATE, :FIGHTINIUMZ],
|
||||
2 => [:SKYPLATE, :FLYINIUMZ],
|
||||
3 => [:TOXICPLATE, :POISONIUMZ],
|
||||
4 => [:EARTHPLATE, :GROUNDIUMZ],
|
||||
5 => [:STONEPLATE, :ROCKIUMZ],
|
||||
6 => [:INSECTPLATE, :BUGINIUMZ],
|
||||
7 => [:SPOOKYPLATE, :GHOSTIUMZ],
|
||||
8 => [:IRONPLATE, :STEELIUMZ],
|
||||
10 => [:FLAMEPLATE, :FIRIUMZ],
|
||||
11 => [:SPLASHPLATE, :WATERIUMZ],
|
||||
12 => [:MEADOWPLATE, :GRASSIUMZ],
|
||||
13 => [:ZAPPLATE, :ELECTRIUMZ],
|
||||
14 => [:MINDPLATE, :PSYCHIUMZ],
|
||||
15 => [:ICICLEPLATE, :ICIUMZ],
|
||||
16 => [:DRACOPLATE, :DRAGONIUMZ],
|
||||
17 => [:DREADPLATE, :DARKINIUMZ],
|
||||
18 => [:PIXIEPLATE, :FAIRIUMZ]
|
||||
}
|
||||
ret = 0
|
||||
typeArray.each do |f, items|
|
||||
for item in items
|
||||
next if !pkmn.hasItem?(item)
|
||||
ret = f
|
||||
break
|
||||
end
|
||||
break if ret > 0
|
||||
end
|
||||
next ret
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:BASCULIN,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next rand(2)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:DARMANITAN,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:DEERLING,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next pbGetSeason
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:DEERLING,:SAWSBUCK)
|
||||
|
||||
MultipleForms.register(:KYUREM,{
|
||||
"getFormOnEnteringBattle" => proc { |pkmn,wild|
|
||||
next pkmn.form+2 if pkmn.form==1 || pkmn.form==2
|
||||
},
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next pkmn.form-2 if pkmn.form>=3 # Fused forms stop glowing
|
||||
},
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
case form
|
||||
when 0 # Normal
|
||||
pkmn.moves.each do |move|
|
||||
if [:ICEBURN, :FREEZESHOCK].include?(move.id)
|
||||
move.id = :GLACIATE if GameData::Move.exists?(:GLACIATE)
|
||||
end
|
||||
if [:FUSIONFLARE, :FUSIONBOLT].include?(move.id)
|
||||
move.id = :SCARYFACE if GameData::Move.exists?(:SCARYFACE)
|
||||
end
|
||||
end
|
||||
when 1 # White
|
||||
pkmn.moves.each do |move|
|
||||
move.id = :ICEBURN if move.id == :GLACIATE && GameData::Move.exists?(:ICEBURN)
|
||||
move.id = :FUSIONFLARE if move.id == :SCARYFACE && GameData::Move.exists?(:FUSIONFLARE)
|
||||
end
|
||||
when 2 # Black
|
||||
pkmn.moves.each do |move|
|
||||
move.id = :FREEZESHOCK if move.id == :GLACIATE && GameData::Move.exists?(:FREEZESHOCK)
|
||||
move.id = :FUSIONBOLT if move.id == :SCARYFACE && GameData::Move.exists?(:FUSIONBOLT)
|
||||
end
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:KELDEO,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next 1 if pkmn.hasMove?(:SECRETSWORD) # Resolute Form
|
||||
next 0 # Ordinary Form
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:MELOETTA,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GENESECT,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next 1 if pkmn.hasItem?(:SHOCKDRIVE)
|
||||
next 2 if pkmn.hasItem?(:BURNDRIVE)
|
||||
next 3 if pkmn.hasItem?(:CHILLDRIVE)
|
||||
next 4 if pkmn.hasItem?(:DOUSEDRIVE)
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GRENINJA,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 1 if pkmn.form == 2 && (pkmn.fainted? || endBattle)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SCATTERBUG,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next $Trainer.secret_ID % 18
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:SCATTERBUG,:SPEWPA,:VIVILLON)
|
||||
|
||||
MultipleForms.register(:FLABEBE,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next rand(5)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:FLABEBE,:FLOETTE,:FLORGES)
|
||||
|
||||
MultipleForms.register(:FURFROU,{
|
||||
"getForm" => proc { |pkmn|
|
||||
if !pkmn.time_form_set ||
|
||||
pbGetTimeNow.to_i > pkmn.time_form_set.to_i + 60 * 60 * 24 * 5 # 5 days
|
||||
next 0
|
||||
end
|
||||
},
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
pkmn.time_form_set = (form > 0) ? pbGetTimeNow.to_i : nil
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ESPURR,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next pkmn.gender
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:ESPURR,:MEOWSTIC)
|
||||
|
||||
MultipleForms.register(:AEGISLASH,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:PUMPKABOO,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
r = rand(100)
|
||||
if r<5; next 3 # Super Size (5%)
|
||||
elsif r<20; next 2 # Large (15%)
|
||||
elsif r<65; next 1 # Average (45%)
|
||||
end
|
||||
next 0 # Small (35%)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:PUMPKABOO,:GOURGEIST)
|
||||
|
||||
MultipleForms.register(:XERNEAS,{
|
||||
"getFormOnEnteringBattle" => proc { |pkmn,wild|
|
||||
next 1
|
||||
},
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ZYGARDE,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next pkmn.form-2 if pkmn.form>=2 && (pkmn.fainted? || endBattle)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:HOOPA,{
|
||||
"getForm" => proc { |pkmn|
|
||||
if !pkmn.time_form_set ||
|
||||
pbGetTimeNow.to_i > pkmn.time_form_set.to_i + 60 * 60 * 24 * 3 # 3 days
|
||||
next 0
|
||||
end
|
||||
},
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
pkmn.time_form_set = (form>0) ? pbGetTimeNow.to_i : nil
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ORICORIO,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next rand(4) # 0=red, 1=yellow, 2=pink, 3=purple
|
||||
},
|
||||
})
|
||||
|
||||
MultipleForms.register(:ROCKRUFF,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next if pkmn.form_simple >= 2 # Own Tempo Rockruff cannot become another form
|
||||
next 1 if PBDayNight.isNight?
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:LYCANROC,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next 2 if PBDayNight.isEvening? # Dusk
|
||||
next 1 if PBDayNight.isNight? # Midnight
|
||||
next 0 # Midday
|
||||
},
|
||||
})
|
||||
|
||||
MultipleForms.register(:WISHIWASHI,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SILVALLY,{
|
||||
"getForm" => proc { |pkmn|
|
||||
next nil if !pkmn.hasAbility?(:RKSSYSTEM)
|
||||
typeArray = {
|
||||
1 => [:FIGHTINGMEMORY],
|
||||
2 => [:FLYINGMEMORY],
|
||||
3 => [:POISONMEMORY],
|
||||
4 => [:GROUNDMEMORY],
|
||||
5 => [:ROCKMEMORY],
|
||||
6 => [:BUGMEMORY],
|
||||
7 => [:GHOSTMEMORY],
|
||||
8 => [:STEELMEMORY],
|
||||
10 => [:FIREMEMORY],
|
||||
11 => [:WATERMEMORY],
|
||||
12 => [:GRASSMEMORY],
|
||||
13 => [:ELECTRICMEMORY],
|
||||
14 => [:PSYCHICMEMORY],
|
||||
15 => [:ICEMEMORY],
|
||||
16 => [:DRAGONMEMORY],
|
||||
17 => [:DARKMEMORY],
|
||||
18 => [:FAIRYMEMORY]
|
||||
}
|
||||
ret = 0
|
||||
typeArray.each do |f, items|
|
||||
for item in items
|
||||
next if !pkmn.hasItem?(item)
|
||||
ret = f
|
||||
break
|
||||
end
|
||||
break if ret>0
|
||||
end
|
||||
next ret
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:MINIOR,{
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next 7+rand(7) # Meteor forms are 0-6, Core forms are 7-13
|
||||
},
|
||||
"getFormOnEnteringBattle" => proc { |pkmn,wild|
|
||||
next pkmn.form-7 if pkmn.form>=7 && wild # Wild Minior always appear in Meteor form
|
||||
},
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next pkmn.form+7 if pkmn.form<7
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:MIMIKYU,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next 0 if pkmn.fainted? || endBattle
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:NECROZMA,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
# Fused forms are 1 and 2, Ultra form is 3 or 4 depending on which fusion
|
||||
next pkmn.form-2 if pkmn.form>=3 && (pkmn.fainted? || endBattle)
|
||||
},
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
next if form > 2 || oldForm > 2 # Ultra form changes don't affect moveset
|
||||
form_moves = [
|
||||
:SUNSTEELSTRIKE, # Dusk Mane (with Solgaleo) (form 1)
|
||||
:MOONGEISTBEAM # Dawn Wings (with Lunala) (form 2)
|
||||
]
|
||||
if form == 0
|
||||
# Turned back into the base form; forget form-specific moves
|
||||
move_index = -1
|
||||
pkmn.moves.each_with_index do |move, i|
|
||||
next if !form_moves.any? { |m| m == move.id }
|
||||
move_index = i
|
||||
break
|
||||
end
|
||||
if move_index >= 0
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.forget_move_at_index(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pbLearnMove(:CONFUSION) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
new_move_id = form_moves[form - 1]
|
||||
pbLearnMove(pkmn, new_move_id, true)
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
#===============================================================================
|
||||
# Alolan forms
|
||||
#===============================================================================
|
||||
|
||||
# These species don't have visually different Alolan forms, but they need to
|
||||
# evolve into different forms depending on the location where they evolved.
|
||||
MultipleForms.register(:PIKACHU, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next if pkmn.form_simple >= 2
|
||||
if $game_map
|
||||
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
next 1 if map_metadata && map_metadata.town_map_position &&
|
||||
map_metadata.town_map_position[0] == 1 # Tiall region
|
||||
end
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:PIKACHU, :EXEGGCUTE, :CUBONE)
|
||||
@@ -0,0 +1,526 @@
|
||||
=begin
|
||||
All types except Shadow have Shadow as a weakness.
|
||||
Shadow has Shadow as a resistance.
|
||||
On a side note, the Shadow moves in Colosseum will not be affected by Weaknesses
|
||||
or Resistances, while in XD the Shadow-type is Super-Effective against all other
|
||||
types.
|
||||
2/5 - display nature
|
||||
|
||||
XD - Shadow Rush -- 55, 100 - Deals damage.
|
||||
Colosseum - Shadow Rush -- 90, 100
|
||||
If this attack is successful, user loses half of HP lost by opponent due to this
|
||||
attack (recoil). If user is in Hyper Mode, this attack has a good chance for a
|
||||
critical hit.
|
||||
=end
|
||||
|
||||
#===============================================================================
|
||||
# Purify a Shadow Pokémon.
|
||||
#===============================================================================
|
||||
def pbPurify(pkmn, scene)
|
||||
return if !pkmn.shadowPokemon? || pkmn.heart_gauge != 0
|
||||
pkmn.shadow = false
|
||||
pkmn.giveRibbon(:NATIONAL)
|
||||
scene.pbDisplay(_INTL("{1} opened the door to its heart!", pkmn.name))
|
||||
old_moves = []
|
||||
pkmn.moves.each { |m| old_moves.push(m.id) }
|
||||
pkmn.update_shadow_moves
|
||||
pkmn.moves.each_with_index do |m, i|
|
||||
next if m.id == old_moves[i]
|
||||
scene.pbDisplay(_INTL("{1} regained the move {2}!", pkmn.name, m.name))
|
||||
end
|
||||
pkmn.record_first_moves
|
||||
if pkmn.saved_ev
|
||||
pkmn.add_evs(pkmn.saved_ev)
|
||||
pkmn.saved_ev = nil
|
||||
end
|
||||
if pkmn.saved_exp
|
||||
newexp = pkmn.growth_rate.add_exp(pkmn.exp, pkmn.saved_exp || 0)
|
||||
pkmn.saved_exp = nil
|
||||
newlevel = pkmn.growth_rate.level_from_exp(newexp)
|
||||
curlevel = pkmn.level
|
||||
if newexp != pkmn.exp
|
||||
scene.pbDisplay(_INTL("{1} regained {2} Exp. Points!", pkmn.name, newexp - pkmn.exp))
|
||||
end
|
||||
if newlevel == curlevel
|
||||
pkmn.exp = newexp
|
||||
pkmn.calc_stats
|
||||
else
|
||||
pbChangeLevel(pkmn, newlevel, scene) # for convenience
|
||||
pkmn.exp = newexp
|
||||
end
|
||||
end
|
||||
if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?", pkmn.speciesName))
|
||||
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", pkmn.speciesName),
|
||||
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
|
||||
pkmn.name = newname
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Relic Stone scene.
|
||||
#===============================================================================
|
||||
class RelicStoneScene
|
||||
def pbPurify
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
end
|
||||
|
||||
def pbEndScene
|
||||
pbFadeOutAndHide(@sprites) { pbUpdate }
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbDisplay(msg,brief=false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"],msg,brief) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbConfirm(msg)
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"],msg) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbStartScene(pokemon)
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@pokemon = pokemon
|
||||
addBackgroundPlane(@sprites,"bg","relicstonebg",@viewport)
|
||||
@sprites["msgwindow"] = Window_AdvancedTextPokemon.new("")
|
||||
@sprites["msgwindow"].viewport = @viewport
|
||||
@sprites["msgwindow"].x = 0
|
||||
@sprites["msgwindow"].y = Graphics.height-96
|
||||
@sprites["msgwindow"].width = Graphics.width
|
||||
@sprites["msgwindow"].height = 96
|
||||
@sprites["msgwindow"].text = ""
|
||||
@sprites["msgwindow"].visible = true
|
||||
pbDeactivateWindows(@sprites)
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class RelicStoneScreen
|
||||
def initialize(scene)
|
||||
@scene = scene
|
||||
end
|
||||
|
||||
def pbDisplay(x)
|
||||
@scene.pbDisplay(x)
|
||||
end
|
||||
|
||||
def pbConfirm(x)
|
||||
@scene.pbConfirm(x)
|
||||
end
|
||||
|
||||
def pbUpdate; end
|
||||
|
||||
def pbRefresh; end
|
||||
|
||||
def pbStartScreen(pokemon)
|
||||
@scene.pbStartScene(pokemon)
|
||||
@scene.pbPurify
|
||||
pbPurify(pokemon,self)
|
||||
@scene.pbEndScene
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbRelicStoneScreen(pkmn)
|
||||
retval = true
|
||||
pbFadeOutIn {
|
||||
scene = RelicStoneScene.new
|
||||
screen = RelicStoneScreen.new(scene)
|
||||
retval = screen.pbStartScreen(pkmn)
|
||||
}
|
||||
return retval
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbRelicStone
|
||||
if !$Trainer.party.any? { |pkmn| pkmn.purifiable? }
|
||||
pbMessage(_INTL("You have no Pokémon that can be purified."))
|
||||
return
|
||||
end
|
||||
pbMessage(_INTL("There's a Pokémon that may open the door to its heart!"))
|
||||
# Choose a purifiable Pokemon
|
||||
pbChoosePokemon(1, 2,proc { |pkmn|
|
||||
pkmn.able? && pkmn.shadowPokemon? && pkmn.heart_gauge == 0
|
||||
})
|
||||
if $game_variables[1] >= 0
|
||||
pbRelicStoneScreen($Trainer.party[$game_variables[1]])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shadow Pokémon in battle.
|
||||
#===============================================================================
|
||||
class PokeBattle_Battle
|
||||
alias __shadow__pbCanUseItemOnPokemon? pbCanUseItemOnPokemon?
|
||||
|
||||
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages=true)
|
||||
ret = __shadow__pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages)
|
||||
if ret && pkmn.hyper_mode && ![:JOYSCENT, :EXCITESCENT, :VIVIDSCENT].include?(item)
|
||||
scene.pbDisplay(_INTL("This item can't be used on that Pokémon."))
|
||||
return false
|
||||
end
|
||||
return ret
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PokeBattle_Battler
|
||||
alias __shadow__pbInitPokemon pbInitPokemon
|
||||
|
||||
def pbInitPokemon(*arg)
|
||||
if self.pokemonIndex>0 && inHyperMode?
|
||||
# Called out of Hyper Mode
|
||||
self.pokemon.hyper_mode = false
|
||||
self.pokemon.adjustHeart(-50)
|
||||
end
|
||||
__shadow__pbInitPokemon(*arg)
|
||||
# Called into battle
|
||||
if shadowPokemon?
|
||||
if GameData::Type.exists?(:SHADOW)
|
||||
self.type1 = :SHADOW
|
||||
self.type2 = :SHADOW
|
||||
end
|
||||
self.pokemon.adjustHeart(-30) if pbOwnedByPlayer?
|
||||
end
|
||||
end
|
||||
|
||||
def shadowPokemon?
|
||||
p = self.pokemon
|
||||
return p && p.shadowPokemon?
|
||||
end
|
||||
alias isShadow? shadowPokemon?
|
||||
|
||||
def inHyperMode?
|
||||
return false if fainted?
|
||||
p = self.pokemon
|
||||
return p && p.hyper_mode
|
||||
end
|
||||
|
||||
def pbHyperMode
|
||||
return if fainted? || !shadowPokemon? || inHyperMode?
|
||||
p = self.pokemon
|
||||
if @battle.pbRandom(p.heart_gauge) <= Pokemon::HEART_GAUGE_SIZE / 4
|
||||
p.hyper_mode = true
|
||||
@battle.pbDisplay(_INTL("{1}'s emotions rose to a fever pitch!\nIt entered Hyper Mode!",self.pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
def pbHyperModeObedience(move)
|
||||
return true if !inHyperMode?
|
||||
return true if !move || move.type == :SHADOW
|
||||
return rand(100)<20
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Shadow item effects.
|
||||
#===============================================================================
|
||||
def pbRaiseHappinessAndReduceHeart(pkmn, scene, heart_amount)
|
||||
if !pkmn.shadowPokemon? || (pkmn.happiness == 255 && pkmn.heart_gauge == 0)
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
return false
|
||||
end
|
||||
if pkmn.happiness == 255
|
||||
stage = pkmn.heart_gauge
|
||||
pkmn.adjustHeart(-heart_amount)
|
||||
scene.pbDisplay(_INTL("{1} adores you!\nThe door to its heart opened a little.", pkmn.name))
|
||||
pkmn.check_ready_to_purify if pkmn.heart_gauge != stage
|
||||
elsif pkmn.heart_gauge == 0
|
||||
pkmn.changeHappiness("vitamin")
|
||||
scene.pbDisplay(_INTL("{1} turned friendly.", pkmn.name))
|
||||
else
|
||||
stage = pkmn.heart_gauge
|
||||
pkmn.changeHappiness("vitamin")
|
||||
pkmn.adjustHeart(-heart_amount)
|
||||
scene.pbDisplay(_INTL("{1} turned friendly.\nThe door to its heart opened a little.", pkmn.name))
|
||||
pkmn.check_ready_to_purify if pkmn.heart_gauge != stage
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:JOYSCENT,proc { |item,pokemon,scene|
|
||||
pbRaiseHappinessAndReduceHeart(pokemon,scene,500)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXCITESCENT,proc { |item,pokemon,scene|
|
||||
pbRaiseHappinessAndReduceHeart(pokemon,scene,1000)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:VIVIDSCENT,proc { |item,pokemon,scene|
|
||||
pbRaiseHappinessAndReduceHeart(pokemon,scene,2000)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:TIMEFLUTE,proc { |item,pokemon,scene|
|
||||
if !pokemon.shadowPokemon? || pokemon.heart_gauge == 0
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
pokemon.heart_gauge = 0
|
||||
pokemon.check_ready_to_purify
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::CanUseInBattle.add(:JOYSCENT,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
|
||||
if !battler || !battler.shadowPokemon? || !battler.inHyperMode?
|
||||
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
|
||||
next false
|
||||
end
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::CanUseInBattle.copy(:JOYSCENT,:EXCITESCENT,:VIVIDSCENT)
|
||||
|
||||
ItemHandlers::BattleUseOnBattler.add(:JOYSCENT,proc { |item,battler,scene|
|
||||
battler.pokemon.hyper_mode = false
|
||||
battler.pokemon.adjustHeart(-100)
|
||||
scene.pbDisplay(_INTL("{1} came to its senses from the {2}!",battler.pbThis,GameData::Item.get(item).name))
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::BattleUseOnBattler.add(:EXCITESCENT,proc { |item,battler,scene|
|
||||
battler.pokemon.hyper_mode = false
|
||||
battler.pokemon.adjustHeart(-200)
|
||||
scene.pbDisplay(_INTL("{1} came to its senses from the {2}!",battler.pbThis,GameData::Item.get(item).name))
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::BattleUseOnBattler.add(:VIVIDSCENT,proc { |item,battler,scene|
|
||||
battler.pokemon.hyper_mode = false
|
||||
battler.pokemon.adjustHeart(-300)
|
||||
scene.pbDisplay(_INTL("{1} came to its senses from the {2}!",battler.pbThis,GameData::Item.get(item).name))
|
||||
next true
|
||||
})
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# No additional effect. (Shadow Blast, Shadow Blitz, Shadow Break, Shadow Rave,
|
||||
# Shadow Rush, Shadow Wave)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_126 < PokeBattle_Move_000
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Paralyzes the target. (Shadow Bolt)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_127 < PokeBattle_Move_007
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Burns the target. (Shadow Fire)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_128 < PokeBattle_Move_00A
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Freezes the target. (Shadow Chill)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_129 < PokeBattle_Move_00C
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Confuses the target. (Shadow Panic)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12A < PokeBattle_Move_013
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's Defense by 2 stages. (Shadow Down)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12B < PokeBattle_Move_04C
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Decreases the target's evasion by 2 stages. (Shadow Mist)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12C < PokeBattle_TargetStatDownMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@statDown = [:EVASION,2]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Power is doubled if the target is using Dive. (Shadow Storm)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12D < PokeBattle_Move_075
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Two turn attack. On first turn, halves the HP of all active Pokémon.
|
||||
# Skips second turn (if successful). (Shadow Half)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12E < PokeBattle_Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
failed = true
|
||||
@battle.eachBattler do |b|
|
||||
next if b.hp==1
|
||||
failed = false
|
||||
break
|
||||
end
|
||||
if failed
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
@battle.eachBattler do |b|
|
||||
next if b.hp==1
|
||||
b.pbReduceHP(i.hp/2,false)
|
||||
end
|
||||
@battle.pbDisplay(_INTL("Each Pokémon's HP was halved!"))
|
||||
@battle.eachBattler { |b| b.pbItemHPHealCheck }
|
||||
user.effects[PBEffects::HyperBeam] = 2
|
||||
user.currentMove = @id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Target can no longer switch out or flee, as long as the user remains active.
|
||||
# (Shadow Hold)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_12F < PokeBattle_Move_0EF
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# User takes recoil damage equal to 1/2 of its current HP. (Shadow End)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_130 < PokeBattle_RecoilMove
|
||||
def pbRecoilDamage(user,target)
|
||||
return (target.damageState.totalHPLost/2.0).round
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
return if user.fainted? || target.damageState.unaffected
|
||||
# NOTE: This move's recoil is not prevented by Rock Head/Magic Guard.
|
||||
amt = pbRecoilDamage(user,target)
|
||||
amt = 1 if amt<1
|
||||
user.pbReduceHP(amt,false)
|
||||
@battle.pbDisplay(_INTL("{1} is damaged by recoil!",user.pbThis))
|
||||
user.pbItemHPHealCheck
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Starts shadow weather. (Shadow Sky)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_131 < PokeBattle_WeatherMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
@weatherType = :ShadowSky
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Ends the effects of Light Screen, Reflect and Safeguard on both sides.
|
||||
# (Shadow Shed)
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_132 < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
for i in @battle.sides
|
||||
i.effects[PBEffects::AuroraVeil] = 0
|
||||
i.effects[PBEffects::Reflect] = 0
|
||||
i.effects[PBEffects::LightScreen] = 0
|
||||
i.effects[PBEffects::Safeguard] = 0
|
||||
end
|
||||
@battle.pbDisplay(_INTL("It broke all barriers!"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonTemp
|
||||
attr_accessor :heart_gauges
|
||||
end
|
||||
|
||||
|
||||
|
||||
# Record current heart gauges of Pokémon in party, to see if they drop to zero
|
||||
# during battle and need to say they're ready to be purified afterwards
|
||||
Events.onStartBattle += proc { |_sender|
|
||||
$PokemonTemp.heart_gauges = []
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
$PokemonTemp.heart_gauges[i] = pkmn.heart_gauge
|
||||
end
|
||||
}
|
||||
|
||||
Events.onEndBattle += proc { |_sender,_e|
|
||||
$PokemonTemp.heart_gauges.each_with_index do |value, i|
|
||||
pkmn = $Trainer.party[i]
|
||||
next if !pkmn || !value || value == 0
|
||||
pkmn.check_ready_to_purify if pkmn.heart_gauge == 0
|
||||
end
|
||||
}
|
||||
|
||||
Events.onStepTaken += proc {
|
||||
for pkmn in $Trainer.able_party
|
||||
next if pkmn.heart_gauge == 0
|
||||
stage = pkmn.heartStage
|
||||
pkmn.adjustHeart(-1)
|
||||
case pkmn.heartStage
|
||||
when 0
|
||||
pkmn.check_ready_to_purify
|
||||
when stage
|
||||
else
|
||||
pkmn.update_shadow_moves
|
||||
end
|
||||
end
|
||||
if ($PokemonGlobal.purifyChamber rescue nil)
|
||||
$PokemonGlobal.purifyChamber.update
|
||||
end
|
||||
for i in 0...2
|
||||
pkmn = $PokemonGlobal.daycare[i][0]
|
||||
next if !pkmn
|
||||
stage = pkmn.heartStage
|
||||
pkmn.adjustHeart(-1)
|
||||
pkmn.update_shadow_moves if pkmn.heartStage != stage
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
#===============================================================================
|
||||
# Pokémon sprite (used out of battle)
|
||||
#===============================================================================
|
||||
class PokemonSprite < SpriteWrapper
|
||||
def initialize(viewport=nil)
|
||||
super(viewport)
|
||||
@_iconbitmap = nil
|
||||
end
|
||||
|
||||
def dispose
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = nil
|
||||
self.bitmap = nil if !self.disposed?
|
||||
super
|
||||
end
|
||||
|
||||
def clearBitmap
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = nil
|
||||
self.bitmap = nil
|
||||
end
|
||||
|
||||
def setOffset(offset=PictureOrigin::Center)
|
||||
@offset = offset
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def changeOrigin
|
||||
return if !self.bitmap
|
||||
@offset = PictureOrigin::Center if !@offset
|
||||
case @offset
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.bitmap.width/2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.bitmap.width
|
||||
end
|
||||
case @offset
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight
|
||||
self.oy = 0
|
||||
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
|
||||
self.oy = self.bitmap.height/2
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.bitmap.height
|
||||
end
|
||||
end
|
||||
|
||||
def setPokemonBitmap(pokemon,back=false)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back) : nil
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
self.color = Color.new(0,0,0,0)
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def setPokemonBitmapSpecies(pokemon,species,back=false)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back, species) : nil
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
self.mirror if back
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def setSpeciesBitmap(species, gender = 0, form = 0, shiny = false, shadow = false, back = false, egg = false)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = GameData::Species.sprite_bitmap(species, form, gender, shiny, shadow, back, egg)
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def update
|
||||
super
|
||||
if @_iconbitmap
|
||||
@_iconbitmap.update
|
||||
self.bitmap = @_iconbitmap.bitmap
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Pokémon icon (for defined Pokémon)
|
||||
#===============================================================================
|
||||
class PokemonIconSprite < SpriteWrapper
|
||||
attr_accessor :selected
|
||||
attr_accessor :active
|
||||
attr_reader :pokemon
|
||||
|
||||
def initialize(pokemon,viewport=nil)
|
||||
super(viewport)
|
||||
@selected = false
|
||||
@active = false
|
||||
@numFrames = 0
|
||||
@currentFrame = 0
|
||||
@counter = 0
|
||||
self.pokemon = pokemon
|
||||
@logical_x = 0 # Actual x coordinate
|
||||
@logical_y = 0 # Actual y coordinate
|
||||
@adjusted_x = 0 # Offset due to "jumping" animation in party screen
|
||||
@adjusted_y = 0 # Offset due to "jumping" animation in party screen
|
||||
end
|
||||
|
||||
def dispose
|
||||
@animBitmap.dispose if @animBitmap
|
||||
super
|
||||
end
|
||||
|
||||
def x; return @logical_x; end
|
||||
def y; return @logical_y; end
|
||||
|
||||
def x=(value)
|
||||
@logical_x = value
|
||||
super(@logical_x+@adjusted_x)
|
||||
end
|
||||
|
||||
def y=(value)
|
||||
@logical_y = value
|
||||
super(@logical_y+@adjusted_y)
|
||||
end
|
||||
|
||||
def pokemon=(value)
|
||||
@pokemon = value
|
||||
@animBitmap.dispose if @animBitmap
|
||||
@animBitmap = nil
|
||||
if !@pokemon
|
||||
self.bitmap = nil
|
||||
@currentFrame = 0
|
||||
@counter = 0
|
||||
return
|
||||
end
|
||||
@animBitmap = AnimatedBitmap.new(GameData::Species.icon_filename_from_pokemon(value))
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
self.src_rect.width = @animBitmap.height
|
||||
self.src_rect.height = @animBitmap.height
|
||||
@numFrames = @animBitmap.width/@animBitmap.height
|
||||
@currentFrame = 0 if @currentFrame>=@numFrames
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def setOffset(offset=PictureOrigin::Center)
|
||||
@offset = offset
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def changeOrigin
|
||||
return if !self.bitmap
|
||||
@offset = PictureOrigin::TopLeft if !@offset
|
||||
case @offset
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.src_rect.width/2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.src_rect.width
|
||||
end
|
||||
case @offset
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight
|
||||
self.oy = 0
|
||||
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
|
||||
# NOTE: This assumes the top quarter of the icon is blank, so oy is placed
|
||||
# in the middle of the lower three quarters of the image.
|
||||
self.oy = self.src_rect.height*5/8
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.src_rect.height
|
||||
end
|
||||
end
|
||||
|
||||
# How long to show each frame of the icon for
|
||||
def counterLimit
|
||||
return 0 if @pokemon.fainted? # Fainted - no animation
|
||||
# ret is initially the time a whole animation cycle lasts. It is divided by
|
||||
# the number of frames in that cycle at the end.
|
||||
ret = Graphics.frame_rate/4 # Green HP - 0.25 seconds
|
||||
if @pokemon.hp<=@pokemon.totalhp/4; ret *= 4 # Red HP - 1 second
|
||||
elsif @pokemon.hp<=@pokemon.totalhp/2; ret *= 2 # Yellow HP - 0.5 seconds
|
||||
end
|
||||
ret /= @numFrames
|
||||
ret = 1 if ret<1
|
||||
return ret
|
||||
end
|
||||
|
||||
def update
|
||||
return if !@animBitmap
|
||||
super
|
||||
@animBitmap.update
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
# Update animation
|
||||
cl = self.counterLimit
|
||||
if cl==0
|
||||
@currentFrame = 0
|
||||
else
|
||||
@counter += 1
|
||||
if @counter>=cl
|
||||
@currentFrame = (@currentFrame+1)%@numFrames
|
||||
@counter = 0
|
||||
end
|
||||
end
|
||||
self.src_rect.x = self.src_rect.width*@currentFrame
|
||||
# Update "jumping" animation (used in party screen)
|
||||
if @selected
|
||||
@adjusted_x = 4
|
||||
@adjusted_y = (@currentFrame>=@numFrames/2) ? -2 : 6
|
||||
else
|
||||
@adjusted_x = 0
|
||||
@adjusted_y = 0
|
||||
end
|
||||
self.x = self.x
|
||||
self.y = self.y
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Pokémon icon (for species)
|
||||
#===============================================================================
|
||||
class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
attr_reader :species
|
||||
attr_reader :gender
|
||||
attr_reader :form
|
||||
attr_reader :shiny
|
||||
|
||||
def initialize(species,viewport=nil)
|
||||
super(viewport)
|
||||
@species = species
|
||||
@gender = 0
|
||||
@form = 0
|
||||
@shiny = 0
|
||||
@numFrames = 0
|
||||
@currentFrame = 0
|
||||
@counter = 0
|
||||
refresh
|
||||
end
|
||||
|
||||
def dispose
|
||||
@animBitmap.dispose if @animBitmap
|
||||
super
|
||||
end
|
||||
|
||||
def species=(value)
|
||||
@species = value
|
||||
refresh
|
||||
end
|
||||
|
||||
def gender=(value)
|
||||
@gender = value
|
||||
refresh
|
||||
end
|
||||
|
||||
def form=(value)
|
||||
@form = value
|
||||
refresh
|
||||
end
|
||||
|
||||
def shiny=(value)
|
||||
@shiny = value
|
||||
refresh
|
||||
end
|
||||
|
||||
def pbSetParams(species,gender,form,shiny=false)
|
||||
@species = species
|
||||
@gender = gender
|
||||
@form = form
|
||||
@shiny = shiny
|
||||
refresh
|
||||
end
|
||||
|
||||
def setOffset(offset=PictureOrigin::Center)
|
||||
@offset = offset
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def changeOrigin
|
||||
return if !self.bitmap
|
||||
@offset = PictureOrigin::TopLeft if !@offset
|
||||
case @offset
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.src_rect.width/2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.src_rect.width
|
||||
end
|
||||
case @offset
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight
|
||||
self.oy = 0
|
||||
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
|
||||
# NOTE: This assumes the top quarter of the icon is blank, so oy is placed
|
||||
# in the middle of the lower three quarters of the image.
|
||||
self.oy = self.src_rect.height*5/8
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.src_rect.height
|
||||
end
|
||||
end
|
||||
|
||||
# How long to show each frame of the icon for
|
||||
def counterLimit
|
||||
# ret is initially the time a whole animation cycle lasts. It is divided by
|
||||
# the number of frames in that cycle at the end.
|
||||
ret = Graphics.frame_rate/4 # 0.25 seconds
|
||||
ret /= @numFrames
|
||||
ret = 1 if ret<1
|
||||
return ret
|
||||
end
|
||||
|
||||
def refresh
|
||||
@animBitmap.dispose if @animBitmap
|
||||
@animBitmap = nil
|
||||
bitmapFileName = GameData::Species.icon_filename(@species, @form, @gender, @shiny)
|
||||
return if !bitmapFileName
|
||||
@animBitmap = AnimatedBitmap.new(bitmapFileName)
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
self.src_rect.width = @animBitmap.height
|
||||
self.src_rect.height = @animBitmap.height
|
||||
@numFrames = @animBitmap.width / @animBitmap.height
|
||||
@currentFrame = 0 if @currentFrame>=@numFrames
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def update
|
||||
return if !@animBitmap
|
||||
super
|
||||
@animBitmap.update
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
# Update animation
|
||||
@counter += 1
|
||||
if @counter>=self.counterLimit
|
||||
@currentFrame = (@currentFrame+1)%@numFrames
|
||||
@counter = 0
|
||||
end
|
||||
self.src_rect.x = self.src_rect.width*@currentFrame
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,403 @@
|
||||
class PokemonBox
|
||||
attr_reader :pokemon
|
||||
attr_accessor :name
|
||||
attr_accessor :background
|
||||
|
||||
BOX_WIDTH = 6
|
||||
BOX_HEIGHT = 5
|
||||
BOX_SIZE = BOX_WIDTH * BOX_HEIGHT
|
||||
|
||||
def initialize(name, maxPokemon = BOX_SIZE)
|
||||
@pokemon = []
|
||||
@name = name
|
||||
@background = 0
|
||||
for i in 0...maxPokemon
|
||||
@pokemon[i] = nil
|
||||
end
|
||||
end
|
||||
|
||||
def length
|
||||
return @pokemon.length
|
||||
end
|
||||
|
||||
def nitems
|
||||
ret = 0
|
||||
@pokemon.each { |pkmn| ret += 1 if !pkmn.nil? }
|
||||
return ret
|
||||
end
|
||||
|
||||
def full?
|
||||
return nitems == self.length
|
||||
end
|
||||
|
||||
def empty?
|
||||
return nitems == 0
|
||||
end
|
||||
|
||||
def [](i)
|
||||
return @pokemon[i]
|
||||
end
|
||||
|
||||
def []=(i,value)
|
||||
@pokemon[i] = value
|
||||
end
|
||||
|
||||
def each
|
||||
@pokemon.each { |item| yield item }
|
||||
end
|
||||
|
||||
def clear
|
||||
@pokemon.clear
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PokemonStorage
|
||||
attr_reader :boxes
|
||||
attr_accessor :currentBox
|
||||
attr_writer :unlockedWallpapers
|
||||
BASICWALLPAPERQTY = 16
|
||||
|
||||
def initialize(maxBoxes = Settings::NUM_STORAGE_BOXES, maxPokemon = PokemonBox::BOX_SIZE)
|
||||
@boxes = []
|
||||
for i in 0...maxBoxes
|
||||
@boxes[i] = PokemonBox.new(_INTL("Box {1}",i+1),maxPokemon)
|
||||
@boxes[i].background = i % BASICWALLPAPERQTY
|
||||
end
|
||||
@currentBox = 0
|
||||
@boxmode = -1
|
||||
@unlockedWallpapers = []
|
||||
for i in 0...allWallpapers.length
|
||||
@unlockedWallpapers[i] = false
|
||||
end
|
||||
end
|
||||
|
||||
def allWallpapers
|
||||
return [
|
||||
# Basic wallpapers
|
||||
_INTL("Forest"),_INTL("City"),_INTL("Desert"),_INTL("Savanna"),
|
||||
_INTL("Crag"),_INTL("Volcano"),_INTL("Snow"),_INTL("Cave"),
|
||||
_INTL("Beach"),_INTL("Seafloor"),_INTL("River"),_INTL("Sky"),
|
||||
_INTL("Poké Center"),_INTL("Machine"),_INTL("Checks"),_INTL("Simple"),
|
||||
# Special wallpapers
|
||||
_INTL("Space"),_INTL("Backyard"),_INTL("Nostalgic 1"),_INTL("Torchic"),
|
||||
_INTL("Trio 1"),_INTL("PikaPika 1"),_INTL("Legend 1"),_INTL("Team Galactic 1"),
|
||||
_INTL("Distortion"),_INTL("Contest"),_INTL("Nostalgic 2"),_INTL("Croagunk"),
|
||||
_INTL("Trio 2"),_INTL("PikaPika 2"),_INTL("Legend 2"),_INTL("Team Galactic 2"),
|
||||
_INTL("Heart"),_INTL("Soul"),_INTL("Big Brother"),_INTL("Pokéathlon"),
|
||||
_INTL("Trio 3"),_INTL("Spiky Pika"),_INTL("Kimono Girl"),_INTL("Revival")
|
||||
]
|
||||
end
|
||||
|
||||
def unlockedWallpapers
|
||||
@unlockedWallpapers = [] if !@unlockedWallpapers
|
||||
return @unlockedWallpapers
|
||||
end
|
||||
|
||||
def isAvailableWallpaper?(i)
|
||||
@unlockedWallpapers = [] if !@unlockedWallpapers
|
||||
return true if i<BASICWALLPAPERQTY
|
||||
return true if @unlockedWallpapers[i]
|
||||
return false
|
||||
end
|
||||
|
||||
def availableWallpapers
|
||||
ret = [[],[]] # Names, IDs
|
||||
papers = allWallpapers
|
||||
@unlockedWallpapers = [] if !@unlockedWallpapers
|
||||
for i in 0...papers.length
|
||||
next if !isAvailableWallpaper?(i)
|
||||
ret[0].push(papers[i]); ret[1].push(i)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def party
|
||||
$Trainer.party
|
||||
end
|
||||
|
||||
def party=(_value)
|
||||
raise ArgumentError.new("Not supported")
|
||||
end
|
||||
|
||||
def party_full?
|
||||
return $Trainer.party_full?
|
||||
end
|
||||
|
||||
def maxBoxes
|
||||
return @boxes.length
|
||||
end
|
||||
|
||||
def maxPokemon(box)
|
||||
return 0 if box >= self.maxBoxes
|
||||
return (box < 0) ? Settings::MAX_PARTY_SIZE : self[box].length
|
||||
end
|
||||
|
||||
def full?
|
||||
for i in 0...self.maxBoxes
|
||||
return false if !@boxes[i].full?
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbFirstFreePos(box)
|
||||
if box==-1
|
||||
ret = self.party.length
|
||||
return (ret >= Settings::MAX_PARTY_SIZE) ? -1 : ret
|
||||
end
|
||||
for i in 0...maxPokemon(box)
|
||||
return i if !self[box,i]
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
def [](x,y=nil)
|
||||
if y==nil
|
||||
return (x==-1) ? self.party : @boxes[x]
|
||||
else
|
||||
for i in @boxes
|
||||
raise "Box is a Pokémon, not a box" if i.is_a?(Pokemon)
|
||||
end
|
||||
return (x==-1) ? self.party[y] : @boxes[x][y]
|
||||
end
|
||||
end
|
||||
|
||||
def []=(x,y,value)
|
||||
if x==-1
|
||||
self.party[y] = value
|
||||
else
|
||||
@boxes[x][y] = value
|
||||
end
|
||||
end
|
||||
|
||||
def pbCopy(boxDst,indexDst,boxSrc,indexSrc)
|
||||
if indexDst<0 && boxDst<self.maxBoxes
|
||||
found = false
|
||||
for i in 0...maxPokemon(boxDst)
|
||||
next if self[boxDst,i]
|
||||
found = true
|
||||
indexDst = i
|
||||
break
|
||||
end
|
||||
return false if !found
|
||||
end
|
||||
if boxDst==-1 # Copying into party
|
||||
return false if party_full?
|
||||
self.party[self.party.length] = self[boxSrc,indexSrc]
|
||||
self.party.compact!
|
||||
else # Copying into box
|
||||
pkmn = self[boxSrc,indexSrc]
|
||||
raise "Trying to copy nil to storage" if !pkmn
|
||||
pkmn.time_form_set = nil
|
||||
pkmn.form = 0 if pkmn.isSpecies?(:SHAYMIN)
|
||||
pkmn.heal
|
||||
self[boxDst,indexDst] = pkmn
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def pbMove(boxDst,indexDst,boxSrc,indexSrc)
|
||||
return false if !pbCopy(boxDst,indexDst,boxSrc,indexSrc)
|
||||
pbDelete(boxSrc,indexSrc)
|
||||
return true
|
||||
end
|
||||
|
||||
def pbMoveCaughtToParty(pkmn)
|
||||
return false if party_full?
|
||||
self.party[self.party.length] = pkmn
|
||||
end
|
||||
|
||||
def pbMoveCaughtToBox(pkmn,box)
|
||||
for i in 0...maxPokemon(box)
|
||||
if self[box,i]==nil
|
||||
if box>=0
|
||||
pkmn.time_form_set = nil if pkmn.time_form_set
|
||||
pkmn.form = 0 if pkmn.isSpecies?(:SHAYMIN)
|
||||
pkmn.heal
|
||||
end
|
||||
self[box,i] = pkmn
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbStoreCaught(pkmn)
|
||||
if @currentBox>=0
|
||||
pkmn.time_form_set = nil
|
||||
pkmn.form = 0 if pkmn.isSpecies?(:SHAYMIN)
|
||||
pkmn.heal
|
||||
end
|
||||
for i in 0...maxPokemon(@currentBox)
|
||||
if self[@currentBox,i]==nil
|
||||
self[@currentBox,i] = pkmn
|
||||
return @currentBox
|
||||
end
|
||||
end
|
||||
for j in 0...self.maxBoxes
|
||||
for i in 0...maxPokemon(j)
|
||||
if self[j,i]==nil
|
||||
self[j,i] = pkmn
|
||||
@currentBox = j
|
||||
return @currentBox
|
||||
end
|
||||
end
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
def pbDelete(box,index)
|
||||
if self[box,index]
|
||||
self[box,index] = nil
|
||||
self.party.compact! if box==-1
|
||||
end
|
||||
end
|
||||
|
||||
def clear
|
||||
for i in 0...self.maxBoxes
|
||||
@boxes[i].clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Regional Storage scripts
|
||||
#===============================================================================
|
||||
class RegionalStorage
|
||||
def initialize
|
||||
@storages = []
|
||||
@lastmap = -1
|
||||
@rgnmap = -1
|
||||
end
|
||||
|
||||
def getCurrentStorage
|
||||
if !$game_map
|
||||
raise _INTL("The player is not on a map, so the region could not be determined.")
|
||||
end
|
||||
if @lastmap!=$game_map.map_id
|
||||
@rgnmap = pbGetCurrentRegion # may access file IO, so caching result
|
||||
@lastmap = $game_map.map_id
|
||||
end
|
||||
if @rgnmap<0
|
||||
raise _INTL("The current map has no region set. Please set the MapPosition metadata setting for this map.")
|
||||
end
|
||||
if !@storages[@rgnmap]
|
||||
@storages[@rgnmap] = PokemonStorage.new
|
||||
end
|
||||
return @storages[@rgnmap]
|
||||
end
|
||||
|
||||
def allWallpapers
|
||||
return getCurrentStorage.allWallpapers
|
||||
end
|
||||
|
||||
def availableWallpapers
|
||||
return getCurrentStorage.availableWallpapers
|
||||
end
|
||||
|
||||
def unlockWallpaper(index)
|
||||
getCurrentStorage.unlockWallpaper(index)
|
||||
end
|
||||
|
||||
def boxes
|
||||
return getCurrentStorage.boxes
|
||||
end
|
||||
|
||||
def party
|
||||
return getCurrentStorage.party
|
||||
end
|
||||
|
||||
def party_full?
|
||||
return getCurrentStorage.party_full?
|
||||
end
|
||||
|
||||
def maxBoxes
|
||||
return getCurrentStorage.maxBoxes
|
||||
end
|
||||
|
||||
def maxPokemon(box)
|
||||
return getCurrentStorage.maxPokemon(box)
|
||||
end
|
||||
|
||||
def full?
|
||||
getCurrentStorage.full?
|
||||
end
|
||||
|
||||
def currentBox
|
||||
return getCurrentStorage.currentBox
|
||||
end
|
||||
|
||||
def currentBox=(value)
|
||||
getCurrentStorage.currentBox = value
|
||||
end
|
||||
|
||||
def [](x,y=nil)
|
||||
getCurrentStorage[x,y]
|
||||
end
|
||||
|
||||
def []=(x,y,value)
|
||||
getCurrentStorage[x,y] = value
|
||||
end
|
||||
|
||||
def pbFirstFreePos(box)
|
||||
getCurrentStorage.pbFirstFreePos(box)
|
||||
end
|
||||
|
||||
def pbCopy(boxDst,indexDst,boxSrc,indexSrc)
|
||||
getCurrentStorage.pbCopy(boxDst,indexDst,boxSrc,indexSrc)
|
||||
end
|
||||
|
||||
def pbMove(boxDst,indexDst,boxSrc,indexSrc)
|
||||
getCurrentStorage.pbCopy(boxDst,indexDst,boxSrc,indexSrc)
|
||||
end
|
||||
|
||||
def pbMoveCaughtToParty(pkmn)
|
||||
getCurrentStorage.pbMoveCaughtToParty(pkmn)
|
||||
end
|
||||
|
||||
def pbMoveCaughtToBox(pkmn,box)
|
||||
getCurrentStorage.pbMoveCaughtToBox(pkmn,box)
|
||||
end
|
||||
|
||||
def pbStoreCaught(pkmn)
|
||||
getCurrentStorage.pbStoreCaught(pkmn)
|
||||
end
|
||||
|
||||
def pbDelete(box,index)
|
||||
getCurrentStorage.pbDelete(pkmn)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbUnlockWallpaper(index)
|
||||
$PokemonStorage.unlockedWallpapers[index] = true
|
||||
end
|
||||
|
||||
def pbLockWallpaper(index) # Don't know why you'd want to do this
|
||||
$PokemonStorage.unlockedWallpapers[index] = false
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Look through Pokémon in storage
|
||||
#===============================================================================
|
||||
# Yields every Pokémon/egg in storage in turn.
|
||||
def pbEachPokemon
|
||||
for i in -1...$PokemonStorage.maxBoxes
|
||||
for j in 0...$PokemonStorage.maxPokemon(i)
|
||||
pkmn = $PokemonStorage[i][j]
|
||||
yield(pkmn,i) if pkmn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Yields every Pokémon in storage in turn.
|
||||
def pbEachNonEggPokemon
|
||||
pbEachPokemon { |pkmn,box| yield(pkmn,box) if !pkmn.egg? }
|
||||
end
|
||||
Reference in New Issue
Block a user