mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -1,135 +1,135 @@
|
||||
module MultipleForms
|
||||
@@formSpecies = SpeciesHandlerHash.new
|
||||
|
||||
def self.copy(sym,*syms)
|
||||
@@formSpecies.copy(sym,*syms)
|
||||
def self.copy(sym, *syms)
|
||||
@@formSpecies.copy(sym, *syms)
|
||||
end
|
||||
|
||||
def self.register(sym,hash)
|
||||
@@formSpecies.add(sym,hash)
|
||||
def self.register(sym, hash)
|
||||
@@formSpecies.add(sym, hash)
|
||||
end
|
||||
|
||||
def self.registerIf(cond,hash)
|
||||
@@formSpecies.addIf(cond,hash)
|
||||
def self.registerIf(cond, hash)
|
||||
@@formSpecies.addIf(cond, hash)
|
||||
end
|
||||
|
||||
def self.hasFunction?(pkmn,func)
|
||||
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)
|
||||
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)
|
||||
def self.call(func, pkmn, *args)
|
||||
sp = @@formSpecies[pkmn.species]
|
||||
return nil if !sp || !sp[func]
|
||||
return sp[func].call(pkmn,*args)
|
||||
return sp[func].call(pkmn, *args)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def drawSpot(bitmap,spotpattern,x,y,red,green,blue)
|
||||
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)
|
||||
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)
|
||||
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]
|
||||
[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]
|
||||
[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]
|
||||
[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]
|
||||
[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
|
||||
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)
|
||||
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)
|
||||
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
|
||||
|
||||
@@ -137,39 +137,39 @@ end
|
||||
# Regular form differences
|
||||
#===============================================================================
|
||||
|
||||
MultipleForms.register(:UNOWN,{
|
||||
MultipleForms.register(:UNOWN, {
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next rand(28)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SPINDA,{
|
||||
"alterBitmap" => proc { |pkmn,bitmap|
|
||||
pbSpindaSpots(pkmn,bitmap)
|
||||
MultipleForms.register(:SPINDA, {
|
||||
"alterBitmap" => proc { |pkmn, bitmap|
|
||||
pbSpindaSpots(pkmn, bitmap)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:CASTFORM,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
MultipleForms.register(:CASTFORM, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GROUDON,{
|
||||
MultipleForms.register(:GROUDON, {
|
||||
"getPrimalForm" => proc { |pkmn|
|
||||
next 1 if pkmn.hasItem?(:REDORB)
|
||||
next
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:KYOGRE,{
|
||||
MultipleForms.register(:KYOGRE, {
|
||||
"getPrimalForm" => proc { |pkmn|
|
||||
next 1 if pkmn.hasItem?(:BLUEORB)
|
||||
next
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:BURMY,{
|
||||
MultipleForms.register(:BURMY, {
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
case pbGetEnvironment
|
||||
when :Rock, :Sand, :Cave
|
||||
@@ -180,7 +180,7 @@ MultipleForms.register(:BURMY,{
|
||||
next 0 # Plant Cloak
|
||||
end
|
||||
},
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next if !endBattle || !usedInBattle
|
||||
case battle.environment
|
||||
when :Rock, :Sand, :Cave
|
||||
@@ -193,7 +193,7 @@ MultipleForms.register(:BURMY,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:WORMADAM,{
|
||||
MultipleForms.register(:WORMADAM, {
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
case pbGetEnvironment
|
||||
when :Rock, :Sand, :Cave
|
||||
@@ -206,8 +206,8 @@ MultipleForms.register(:WORMADAM,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:CHERRIM,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
MultipleForms.register(:CHERRIM, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
@@ -257,9 +257,9 @@ MultipleForms.register(:ROTOM, {
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GIRATINA,{
|
||||
MultipleForms.register(:GIRATINA, {
|
||||
"getForm" => proc { |pkmn|
|
||||
maps = [49,50,51,72,73] # Map IDs for Origin Forme
|
||||
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
|
||||
@@ -267,13 +267,13 @@ MultipleForms.register(:GIRATINA,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SHAYMIN,{
|
||||
MultipleForms.register(:SHAYMIN, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next 0 if pkmn.fainted? || pkmn.status == :FROZEN || PBDayNight.isNight?
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ARCEUS,{
|
||||
MultipleForms.register(:ARCEUS, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next nil if !pkmn.hasAbility?(:MULTITYPE)
|
||||
typeArray = {
|
||||
@@ -308,26 +308,26 @@ MultipleForms.register(:ARCEUS,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:DARMANITAN,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
MultipleForms.register(:DARMANITAN, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 2 * (pkmn.form / 2)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:DEERLING,{
|
||||
MultipleForms.register(:DEERLING, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next pbGetSeason
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:DEERLING,:SAWSBUCK)
|
||||
MultipleForms.copy(:DEERLING, :SAWSBUCK)
|
||||
|
||||
MultipleForms.register(:KYUREM,{
|
||||
"getFormOnEnteringBattle" => proc { |pkmn,wild|
|
||||
next pkmn.form+2 if pkmn.form==1 || pkmn.form==2
|
||||
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
|
||||
"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
|
||||
@@ -354,20 +354,20 @@ MultipleForms.register(:KYUREM,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:KELDEO,{
|
||||
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|
|
||||
MultipleForms.register(:MELOETTA, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GENESECT,{
|
||||
MultipleForms.register(:GENESECT, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next 1 if pkmn.hasItem?(:SHOCKDRIVE)
|
||||
next 2 if pkmn.hasItem?(:BURNDRIVE)
|
||||
@@ -377,47 +377,47 @@ MultipleForms.register(:GENESECT,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:GRENINJA,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
MultipleForms.register(:GRENINJA, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 1 if pkmn.form == 2 && (pkmn.fainted? || endBattle)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SCATTERBUG,{
|
||||
MultipleForms.register(:SCATTERBUG, {
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next $player.secret_ID % 18
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:SCATTERBUG,:SPEWPA,:VIVILLON)
|
||||
MultipleForms.copy(:SCATTERBUG, :SPEWPA, :VIVILLON)
|
||||
|
||||
MultipleForms.register(:FURFROU,{
|
||||
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|
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
pkmn.time_form_set = (form > 0) ? pbGetTimeNow.to_i : nil
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ESPURR,{
|
||||
MultipleForms.register(:ESPURR, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next pkmn.gender
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:ESPURR,:MEOWSTIC)
|
||||
MultipleForms.copy(:ESPURR, :MEOWSTIC)
|
||||
|
||||
MultipleForms.register(:AEGISLASH,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
MultipleForms.register(:AEGISLASH, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:PUMPKABOO,{
|
||||
MultipleForms.register(:PUMPKABOO, {
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
r = rand(100)
|
||||
next 3 if r < 5 # Super Size (5%)
|
||||
@@ -427,36 +427,36 @@ MultipleForms.register(:PUMPKABOO,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.copy(:PUMPKABOO,:GOURGEIST)
|
||||
MultipleForms.copy(:PUMPKABOO, :GOURGEIST)
|
||||
|
||||
MultipleForms.register(:XERNEAS,{
|
||||
"getFormOnEnteringBattle" => proc { |pkmn,wild|
|
||||
MultipleForms.register(:XERNEAS, {
|
||||
"getFormOnEnteringBattle" => proc { |pkmn, wild|
|
||||
next 1
|
||||
},
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
"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(:ZYGARDE, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next pkmn.form - 2 if pkmn.form >= 2 && (pkmn.fainted? || endBattle)
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:HOOPA,{
|
||||
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
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
pkmn.time_form_set = (form > 0) ? pbGetTimeNow.to_i : nil
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:ROCKRUFF,{
|
||||
MultipleForms.register(:ROCKRUFF, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next if pkmn.form_simple >= 2 # Own Tempo Rockruff cannot become another form
|
||||
next 1 if PBDayNight.isNight?
|
||||
@@ -464,7 +464,7 @@ MultipleForms.register(:ROCKRUFF,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:LYCANROC,{
|
||||
MultipleForms.register(:LYCANROC, {
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next 2 if PBDayNight.isEvening? # Dusk
|
||||
next 1 if PBDayNight.isNight? # Midnight
|
||||
@@ -472,13 +472,13 @@ MultipleForms.register(:LYCANROC,{
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:WISHIWASHI,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
MultipleForms.register(:WISHIWASHI, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 0
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:SILVALLY,{
|
||||
MultipleForms.register(:SILVALLY, {
|
||||
"getForm" => proc { |pkmn|
|
||||
next nil if !pkmn.hasAbility?(:RKSSYSTEM)
|
||||
typeArray = {
|
||||
@@ -507,34 +507,34 @@ MultipleForms.register(:SILVALLY,{
|
||||
ret = f
|
||||
break
|
||||
end
|
||||
break if ret>0
|
||||
break if ret > 0
|
||||
end
|
||||
next ret
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:MINIOR,{
|
||||
MultipleForms.register(:MINIOR, {
|
||||
"getFormOnCreation" => proc { |pkmn|
|
||||
next 7+rand(7) # Meteor forms are 0-6, Core forms are 7-13
|
||||
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
|
||||
"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
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next pkmn.form + 7 if pkmn.form < 7
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:MIMIKYU,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
MultipleForms.register(:MIMIKYU, {
|
||||
"getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle|
|
||||
next 0 if pkmn.fainted? || endBattle
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:NECROZMA,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,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)
|
||||
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
|
||||
|
||||
@@ -76,24 +76,24 @@ class RelicStoneScene
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbDisplay(msg,brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"],msg,brief) { pbUpdate }
|
||||
def pbDisplay(msg, brief = false)
|
||||
UIHelper.pbDisplay(@sprites["msgwindow"], msg, brief) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbConfirm(msg)
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"],msg) { pbUpdate }
|
||||
UIHelper.pbConfirm(@sprites["msgwindow"], msg) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbStartScene(pokemon)
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@pokemon = pokemon
|
||||
addBackgroundPlane(@sprites,"bg","relicstonebg",@viewport)
|
||||
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"].y = Graphics.height - 96
|
||||
@sprites["msgwindow"].width = Graphics.width
|
||||
@sprites["msgwindow"].height = 96
|
||||
@sprites["msgwindow"].text = ""
|
||||
@@ -125,7 +125,7 @@ class RelicStoneScreen
|
||||
def pbStartScreen(pokemon)
|
||||
@scene.pbStartScene(pokemon)
|
||||
@scene.pbPurify
|
||||
pbPurify(pokemon,self)
|
||||
pbPurify(pokemon, self)
|
||||
@scene.pbEndScene
|
||||
end
|
||||
end
|
||||
@@ -154,7 +154,7 @@ def pbRelicStone
|
||||
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|
|
||||
pbChoosePokemon(1, 2, proc { |pkmn|
|
||||
pkmn.able? && pkmn.shadowPokemon? && pkmn.heart_gauge == 0
|
||||
})
|
||||
if $game_variables[1] >= 0
|
||||
@@ -170,8 +170,8 @@ end
|
||||
class Battle
|
||||
alias __shadow__pbCanUseItemOnPokemon? pbCanUseItemOnPokemon?
|
||||
|
||||
def pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages = true)
|
||||
ret = __shadow__pbCanUseItemOnPokemon?(item,pkmn,battler,scene,showMessages)
|
||||
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
|
||||
@@ -186,7 +186,7 @@ class Battle::Battler
|
||||
alias __shadow__pbInitPokemon pbInitPokemon
|
||||
|
||||
def pbInitPokemon(*arg)
|
||||
if self.pokemonIndex>0 && inHyperMode?
|
||||
if self.pokemonIndex > 0 && inHyperMode?
|
||||
self.pokemon.hyper_mode = false
|
||||
end
|
||||
__shadow__pbInitPokemon(*arg)
|
||||
@@ -213,14 +213,14 @@ class Battle::Battler
|
||||
p = self.pokemon
|
||||
if @battle.pbRandom(p.heart_gauge) <= p.max_gauge_size / 4
|
||||
p.hyper_mode = true
|
||||
@battle.pbDisplay(_INTL("{1}'s emotions rose to a fever pitch!\nIt entered Hyper Mode!",self.pbThis))
|
||||
@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
|
||||
return rand(100) < 20
|
||||
end
|
||||
end
|
||||
|
||||
@@ -250,19 +250,19 @@ def pbRaiseHappinessAndReduceHeart(pkmn, scene, multiplier)
|
||||
return true
|
||||
end
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:JOYSCENT,proc { |item,pokemon,scene|
|
||||
ItemHandlers::UseOnPokemon.add(:JOYSCENT, proc { |item, pokemon, scene|
|
||||
pbRaiseHappinessAndReduceHeart(pokemon, scene, 1)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:EXCITESCENT,proc { |item,pokemon,scene|
|
||||
ItemHandlers::UseOnPokemon.add(:EXCITESCENT, proc { |item, pokemon, scene|
|
||||
pbRaiseHappinessAndReduceHeart(pokemon, scene, 2)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:VIVIDSCENT,proc { |item,pokemon,scene|
|
||||
ItemHandlers::UseOnPokemon.add(:VIVIDSCENT, proc { |item, pokemon, scene|
|
||||
pbRaiseHappinessAndReduceHeart(pokemon, scene, 3)
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:TIMEFLUTE,proc { |item,pokemon,scene|
|
||||
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
|
||||
@@ -272,7 +272,7 @@ ItemHandlers::UseOnPokemon.add(:TIMEFLUTE,proc { |item,pokemon,scene|
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::CanUseInBattle.add(:JOYSCENT,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
|
||||
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
|
||||
@@ -280,26 +280,26 @@ ItemHandlers::CanUseInBattle.add(:JOYSCENT,proc { |item,pokemon,battler,move,fir
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::CanUseInBattle.copy(:JOYSCENT,:EXCITESCENT,:VIVIDSCENT)
|
||||
ItemHandlers::CanUseInBattle.copy(:JOYSCENT, :EXCITESCENT, :VIVIDSCENT)
|
||||
|
||||
ItemHandlers::BattleUseOnBattler.add(:JOYSCENT,proc { |item,battler,scene|
|
||||
ItemHandlers::BattleUseOnBattler.add(:JOYSCENT, proc { |item, battler, scene|
|
||||
battler.pokemon.hyper_mode = false
|
||||
battler.pokemon.change_heart_gauge("scent", 1)
|
||||
scene.pbDisplay(_INTL("{1} came to its senses from the {2}!",battler.pbThis,GameData::Item.get(item).name))
|
||||
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|
|
||||
ItemHandlers::BattleUseOnBattler.add(:EXCITESCENT, proc { |item, battler, scene|
|
||||
battler.pokemon.hyper_mode = false
|
||||
battler.pokemon.change_heart_gauge("scent", 2)
|
||||
scene.pbDisplay(_INTL("{1} came to its senses from the {2}!",battler.pbThis,GameData::Item.get(item).name))
|
||||
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|
|
||||
ItemHandlers::BattleUseOnBattler.add(:VIVIDSCENT, proc { |item, battler, scene|
|
||||
battler.pokemon.hyper_mode = false
|
||||
battler.pokemon.change_heart_gauge("scent", 3)
|
||||
scene.pbDisplay(_INTL("{1} came to its senses from the {2}!",battler.pbThis,GameData::Item.get(item).name))
|
||||
scene.pbDisplay(_INTL("{1} came to its senses from the {2}!", battler.pbThis, GameData::Item.get(item).name))
|
||||
next true
|
||||
})
|
||||
|
||||
@@ -310,7 +310,7 @@ ItemHandlers::BattleUseOnBattler.add(:VIVIDSCENT,proc { |item,battler,scene|
|
||||
# Skips second turn (if successful). (Shadow Half)
|
||||
#===============================================================================
|
||||
class Battle::Move::AllBattlersLoseHalfHPUserSkipsNextTurn < Battle::Move
|
||||
def pbMoveFailed?(user,targets)
|
||||
def pbMoveFailed?(user, targets)
|
||||
if @battle.allBattlers.none? { |b| b.hp > 1 }
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
@@ -335,17 +335,17 @@ end
|
||||
# User takes recoil damage equal to 1/2 of its current HP. (Shadow End)
|
||||
#===============================================================================
|
||||
class Battle::Move::UserLosesHalfHP < Battle::Move::RecoilMove
|
||||
def pbRecoilDamage(user,target)
|
||||
return (target.damageState.totalHPLost/2.0).round
|
||||
def pbRecoilDamage(user, target)
|
||||
return (target.damageState.totalHPLost / 2.0).round
|
||||
end
|
||||
|
||||
def pbEffectAfterAllHits(user,target)
|
||||
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))
|
||||
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
|
||||
@@ -356,7 +356,7 @@ end
|
||||
# Starts shadow weather. (Shadow Sky)
|
||||
#===============================================================================
|
||||
class Battle::Move::StartShadowSkyWeather < Battle::Move::WeatherMove
|
||||
def initialize(battle,move)
|
||||
def initialize(battle, move)
|
||||
super
|
||||
@weatherType = :ShadowSky
|
||||
end
|
||||
@@ -400,7 +400,7 @@ Events.onStartBattle += proc { |_sender|
|
||||
end
|
||||
}
|
||||
|
||||
Events.onEndBattle += proc { |_sender,_e|
|
||||
Events.onEndBattle += proc { |_sender, _e|
|
||||
$game_temp.party_heart_gauges_before_battle.each_with_index do |value, i|
|
||||
pkmn = $player.party[i]
|
||||
next if !pkmn || !value || value == 0
|
||||
|
||||
@@ -32,7 +32,7 @@ class PokemonSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.bitmap.width/2
|
||||
self.ox = self.bitmap.width / 2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.bitmap.width
|
||||
end
|
||||
@@ -40,21 +40,21 @@ class PokemonSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Top, PictureOrigin::TopRight
|
||||
self.oy = 0
|
||||
when PictureOrigin::Left, PictureOrigin::Center, PictureOrigin::Right
|
||||
self.oy = self.bitmap.height/2
|
||||
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)
|
||||
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)
|
||||
self.color = Color.new(0, 0, 0, 0)
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def setPokemonBitmapSpecies(pokemon,species,back = false)
|
||||
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
|
||||
@@ -87,7 +87,7 @@ class PokemonIconSprite < SpriteWrapper
|
||||
attr_accessor :active
|
||||
attr_reader :pokemon
|
||||
|
||||
def initialize(pokemon,viewport = nil)
|
||||
def initialize(pokemon, viewport = nil)
|
||||
super(viewport)
|
||||
@selected = false
|
||||
@active = false
|
||||
@@ -111,12 +111,12 @@ class PokemonIconSprite < SpriteWrapper
|
||||
|
||||
def x=(value)
|
||||
@logical_x = value
|
||||
super(@logical_x+@adjusted_x)
|
||||
super(@logical_x + @adjusted_x)
|
||||
end
|
||||
|
||||
def y=(value)
|
||||
@logical_y = value
|
||||
super(@logical_y+@adjusted_y)
|
||||
super(@logical_y + @adjusted_y)
|
||||
end
|
||||
|
||||
def pokemon=(value)
|
||||
@@ -133,8 +133,8 @@ class PokemonIconSprite < SpriteWrapper
|
||||
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
|
||||
@numFrames = @animBitmap.width / @animBitmap.height
|
||||
@currentFrame = 0 if @currentFrame >= @numFrames
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
@@ -150,7 +150,7 @@ class PokemonIconSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.src_rect.width/2
|
||||
self.ox = self.src_rect.width / 2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.src_rect.width
|
||||
end
|
||||
@@ -160,7 +160,7 @@ class PokemonIconSprite < SpriteWrapper
|
||||
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
|
||||
self.oy = self.src_rect.height * 5 / 8
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.src_rect.height
|
||||
end
|
||||
@@ -171,14 +171,14 @@ class PokemonIconSprite < SpriteWrapper
|
||||
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 # Red HP - 1 second
|
||||
ret = Graphics.frame_rate / 4 # Green HP - 0.25 seconds
|
||||
if @pokemon.hp <= @pokemon.totalhp / 4 # Red HP - 1 second
|
||||
ret *= 4
|
||||
elsif @pokemon.hp<=@pokemon.totalhp/2 # Yellow HP - 0.5 seconds
|
||||
elsif @pokemon.hp <= @pokemon.totalhp / 2 # Yellow HP - 0.5 seconds
|
||||
ret *= 2
|
||||
end
|
||||
ret /= @numFrames
|
||||
ret = 1 if ret<1
|
||||
ret = 1 if ret < 1
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -189,20 +189,20 @@ class PokemonIconSprite < SpriteWrapper
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
# Update animation
|
||||
cl = self.counterLimit
|
||||
if cl==0
|
||||
if cl == 0
|
||||
@currentFrame = 0
|
||||
else
|
||||
@counter += 1
|
||||
if @counter>=cl
|
||||
@currentFrame = (@currentFrame+1)%@numFrames
|
||||
if @counter >= cl
|
||||
@currentFrame = (@currentFrame + 1) % @numFrames
|
||||
@counter = 0
|
||||
end
|
||||
end
|
||||
self.src_rect.x = self.src_rect.width*@currentFrame
|
||||
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
|
||||
@adjusted_y = (@currentFrame >= @numFrames / 2) ? -2 : 6
|
||||
else
|
||||
@adjusted_x = 0
|
||||
@adjusted_y = 0
|
||||
@@ -223,7 +223,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
attr_reader :form
|
||||
attr_reader :shiny
|
||||
|
||||
def initialize(species,viewport = nil)
|
||||
def initialize(species, viewport = nil)
|
||||
super(viewport)
|
||||
@species = species
|
||||
@gender = 0
|
||||
@@ -260,7 +260,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
refresh
|
||||
end
|
||||
|
||||
def pbSetParams(species,gender,form,shiny = false)
|
||||
def pbSetParams(species, gender, form, shiny = false)
|
||||
@species = species
|
||||
@gender = gender
|
||||
@form = form
|
||||
@@ -280,7 +280,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
when PictureOrigin::TopLeft, PictureOrigin::Left, PictureOrigin::BottomLeft
|
||||
self.ox = 0
|
||||
when PictureOrigin::Top, PictureOrigin::Center, PictureOrigin::Bottom
|
||||
self.ox = self.src_rect.width/2
|
||||
self.ox = self.src_rect.width / 2
|
||||
when PictureOrigin::TopRight, PictureOrigin::Right, PictureOrigin::BottomRight
|
||||
self.ox = self.src_rect.width
|
||||
end
|
||||
@@ -290,7 +290,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
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
|
||||
self.oy = self.src_rect.height * 5 / 8
|
||||
when PictureOrigin::BottomLeft, PictureOrigin::Bottom, PictureOrigin::BottomRight
|
||||
self.oy = self.src_rect.height
|
||||
end
|
||||
@@ -300,9 +300,9 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
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 = Graphics.frame_rate / 4 # 0.25 seconds
|
||||
ret /= @numFrames
|
||||
ret = 1 if ret<1
|
||||
ret = 1 if ret < 1
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -316,7 +316,7 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
self.src_rect.width = @animBitmap.height
|
||||
self.src_rect.height = @animBitmap.height
|
||||
@numFrames = @animBitmap.width / @animBitmap.height
|
||||
@currentFrame = 0 if @currentFrame>=@numFrames
|
||||
@currentFrame = 0 if @currentFrame >= @numFrames
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
@@ -327,10 +327,10 @@ class PokemonSpeciesIconSprite < SpriteWrapper
|
||||
self.bitmap = @animBitmap.bitmap
|
||||
# Update animation
|
||||
@counter += 1
|
||||
if @counter>=self.counterLimit
|
||||
@currentFrame = (@currentFrame+1)%@numFrames
|
||||
if @counter >= self.counterLimit
|
||||
@currentFrame = (@currentFrame + 1) % @numFrames
|
||||
@counter = 0
|
||||
end
|
||||
self.src_rect.x = self.src_rect.width*@currentFrame
|
||||
self.src_rect.x = self.src_rect.width * @currentFrame
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ class PokemonBox
|
||||
return @pokemon[i]
|
||||
end
|
||||
|
||||
def []=(i,value)
|
||||
def []=(i, value)
|
||||
@pokemon[i] = value
|
||||
end
|
||||
|
||||
@@ -63,7 +63,7 @@ class PokemonStorage
|
||||
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] = PokemonBox.new(_INTL("Box {1}", i + 1), maxPokemon)
|
||||
@boxes[i].background = i % BASICWALLPAPERQTY
|
||||
end
|
||||
@currentBox = 0
|
||||
@@ -77,17 +77,17 @@ class PokemonStorage
|
||||
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"),
|
||||
_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")
|
||||
_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
|
||||
|
||||
@@ -98,13 +98,13 @@ class PokemonStorage
|
||||
|
||||
def isAvailableWallpaper?(i)
|
||||
@unlockedWallpapers = [] if !@unlockedWallpapers
|
||||
return true if i<BASICWALLPAPERQTY
|
||||
return true if i < BASICWALLPAPERQTY
|
||||
return true if @unlockedWallpapers[i]
|
||||
return false
|
||||
end
|
||||
|
||||
def availableWallpapers
|
||||
ret = [[],[]] # Names, IDs
|
||||
ret = [[], []] # Names, IDs
|
||||
papers = allWallpapers
|
||||
@unlockedWallpapers = [] if !@unlockedWallpapers
|
||||
for i in 0...papers.length
|
||||
@@ -144,66 +144,66 @@ class PokemonStorage
|
||||
end
|
||||
|
||||
def pbFirstFreePos(box)
|
||||
if box==-1
|
||||
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]
|
||||
return i if !self[box, i]
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
def [](x,y = nil)
|
||||
if y==nil
|
||||
return (x==-1) ? self.party : @boxes[x]
|
||||
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]
|
||||
return (x == -1) ? self.party[y] : @boxes[x][y]
|
||||
end
|
||||
end
|
||||
|
||||
def []=(x,y,value)
|
||||
if x==-1
|
||||
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
|
||||
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]
|
||||
next if self[boxDst, i]
|
||||
found = true
|
||||
indexDst = i
|
||||
break
|
||||
end
|
||||
return false if !found
|
||||
end
|
||||
if boxDst==-1 # Copying into party
|
||||
if boxDst == -1 # Copying into party
|
||||
return false if party_full?
|
||||
self.party[self.party.length] = self[boxSrc,indexSrc]
|
||||
self.party[self.party.length] = self[boxSrc, indexSrc]
|
||||
self.party.compact!
|
||||
else # Copying into box
|
||||
pkmn = self[boxSrc,indexSrc]
|
||||
pkmn = self[boxSrc, indexSrc]
|
||||
raise "Trying to copy nil to storage" if !pkmn
|
||||
if Settings::HEAL_STORED_POKEMON
|
||||
old_ready_evo = pkmn.ready_to_evolve
|
||||
pkmn.heal
|
||||
pkmn.ready_to_evolve = old_ready_evo
|
||||
end
|
||||
self[boxDst,indexDst] = pkmn
|
||||
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)
|
||||
def pbMove(boxDst, indexDst, boxSrc, indexSrc)
|
||||
return false if !pbCopy(boxDst, indexDst, boxSrc, indexSrc)
|
||||
pbDelete(boxSrc, indexSrc)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -212,15 +212,15 @@ class PokemonStorage
|
||||
self.party[self.party.length] = pkmn
|
||||
end
|
||||
|
||||
def pbMoveCaughtToBox(pkmn,box)
|
||||
def pbMoveCaughtToBox(pkmn, box)
|
||||
for i in 0...maxPokemon(box)
|
||||
if self[box,i]==nil
|
||||
if self[box, i] == nil
|
||||
if Settings::HEAL_STORED_POKEMON && box >= 0
|
||||
old_ready_evo = pkmn.ready_to_evolve
|
||||
pkmn.heal
|
||||
pkmn.ready_to_evolve = old_ready_evo
|
||||
end
|
||||
self[box,i] = pkmn
|
||||
self[box, i] = pkmn
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -234,15 +234,15 @@ class PokemonStorage
|
||||
pkmn.ready_to_evolve = old_ready_evo
|
||||
end
|
||||
for i in 0...maxPokemon(@currentBox)
|
||||
if self[@currentBox,i]==nil
|
||||
self[@currentBox,i] = pkmn
|
||||
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
|
||||
if self[j, i] == nil
|
||||
self[j, i] = pkmn
|
||||
@currentBox = j
|
||||
return @currentBox
|
||||
end
|
||||
@@ -251,10 +251,10 @@ class PokemonStorage
|
||||
return -1
|
||||
end
|
||||
|
||||
def pbDelete(box,index)
|
||||
if self[box,index]
|
||||
self[box,index] = nil
|
||||
self.party.compact! if box==-1
|
||||
def pbDelete(box, index)
|
||||
if self[box, index]
|
||||
self[box, index] = nil
|
||||
self.party.compact! if box == -1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -281,11 +281,11 @@ class RegionalStorage
|
||||
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
|
||||
if @lastmap != $game_map.map_id
|
||||
@rgnmap = pbGetCurrentRegion # may access file IO, so caching result
|
||||
@lastmap = $game_map.map_id
|
||||
end
|
||||
if @rgnmap<0
|
||||
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]
|
||||
@@ -338,39 +338,39 @@ class RegionalStorage
|
||||
getCurrentStorage.currentBox = value
|
||||
end
|
||||
|
||||
def [](x,y = nil)
|
||||
getCurrentStorage[x,y]
|
||||
def [](x, y = nil)
|
||||
getCurrentStorage[x, y]
|
||||
end
|
||||
|
||||
def []=(x,y,value)
|
||||
getCurrentStorage[x,y] = value
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
def pbMoveCaughtToBox(pkmn, box)
|
||||
getCurrentStorage.pbMoveCaughtToBox(pkmn, box)
|
||||
end
|
||||
|
||||
def pbStoreCaught(pkmn)
|
||||
getCurrentStorage.pbStoreCaught(pkmn)
|
||||
end
|
||||
|
||||
def pbDelete(box,index)
|
||||
def pbDelete(box, index)
|
||||
getCurrentStorage.pbDelete(pkmn)
|
||||
end
|
||||
end
|
||||
@@ -396,12 +396,12 @@ def pbEachPokemon
|
||||
for i in -1...$PokemonStorage.maxBoxes
|
||||
for j in 0...$PokemonStorage.maxPokemon(i)
|
||||
pkmn = $PokemonStorage[i][j]
|
||||
yield(pkmn,i) if pkmn
|
||||
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? }
|
||||
pbEachPokemon { |pkmn, box| yield(pkmn, box) if !pkmn.egg? }
|
||||
end
|
||||
|
||||
@@ -1195,7 +1195,7 @@ class Pokemon
|
||||
@timeReceived = pbGetTimeNow.to_i
|
||||
@timeEggHatched = nil
|
||||
@fused = nil
|
||||
@personalID = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
@personalID = rand(2**16) | rand(2**16) << 16
|
||||
@hp = 1
|
||||
@totalhp = 1
|
||||
calc_stats
|
||||
|
||||
Reference in New Issue
Block a user