class PokeBattle_Pokemon
def form
v=MultipleForms.call("getForm",self)
return v if v!=nil
return @form || 0
end
def form=(value)
@form=value
self.calcStats
MultipleForms.call("onSetForm",self,value)
end
alias __mf_baseStats baseStats
alias __mf_initialize initialize
alias __mf_ability ability
alias __mf_type1 type1
alias __mf_type2 type2
def baseStats
v=MultipleForms.call("getBaseStats",self)
return v if v!=nil
return self.__mf_baseStats
end
def ability
v=MultipleForms.call("ability",self)
return v if v!=nil
return self.__mf_ability
end
def type1
v=MultipleForms.call("type1",self)
return v if v!=nil
return self.__mf_type1
end
def type2
v=MultipleForms.call("type2",self)
return v if v!=nil
return self.__mf_type2
end
def initialize(*args)
__mf_initialize(*args)
f=MultipleForms.call("getFormOnCreation",self)
if f
self.form=f
end
end
end
class PokeBattle_RealBattlePeer
def pbOnEnteringBattle(battle,pokemon)
f=MultipleForms.call("getFormOnEnteringBattle",pokemon)
if f
pokemon.form=f
end
end
end
module MultipleForms
@@formSpecies=HandlerHash.new(:PBSpecies)
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?(pokemon,func)
spec=(pokemon.is_a?(Numeric)) ? pokemon : pokemon.species
sp=@@formSpecies[spec]
return sp && sp[func]
end
def self.getFunction(pokemon,func)
spec=(pokemon.is_a?(Numeric)) ? pokemon : pokemon.species
sp=@@formSpecies[spec]
return (sp && sp[func]) ? sp[func] : nil
end
def self.call(func,pokemon,*args)
sp=@@formSpecies[pokemon.species]
return nil if !sp || !sp[func]
return sp[func].call(pokemon,*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(pokemon,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,1,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],
[1,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,0,1,1,1,1,0,0,0]
]
id=pokemon.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 pokemon.isShiny?
drawSpot(bitmap,spot1,b+33,a+25,-100,30,-100)
drawSpot(bitmap,spot2,d+21,c+24,-100,30,-100)
drawSpot(bitmap,spot3,f+39,e+7,-100,30,-100)
drawSpot(bitmap,spot4,h+15,g+6,-100,30,-100)
else
drawSpot(bitmap,spot1,b+33,a+25,30,-100,-100)
drawSpot(bitmap,spot2,d+21,c+24,30,-100,-100)
drawSpot(bitmap,spot3,f+39,e+7,30,-100,-100)
drawSpot(bitmap,spot4,h+15,g+6,30,-100,-100)
end
end
MultipleForms.register(:SHELLOS,{
"getFormOnCreation"=>proc{|pokemon|
maps=[] # Map IDs for second form
if $game_map && maps.include?($game_map.map_id)
next 1
else
next 0
end
}
})
MultipleForms.copy(:SHELLOS,:GASTRODON)
MultipleForms.register(:SPINDA,{
"alterBitmap"=>proc{|pokemon,bitmap|
pbSpindaSpots(pokemon,bitmap)
}
})
MultipleForms.register(:UNOWN,{
"getForm"=>proc{|pokemon|
d=pokemon.personalID&3
d|=((pokemon.personalID>>8)&3)<<2
d|=((pokemon.personalID>>16)&3)<<4
d|=((pokemon.personalID>>24)&3)<<6
d%=28 # index of letter : ABCDEFGHIJKLMNOPQRSTUVWXYZ!?
next d
}
})
MultipleForms.register(:ROTOM,{
"getBaseStats"=>proc{|pokemon|
case pokemon.form
# Normal Form
when 0; next [50,50,77,91,95,77]
# Alternate Form
else; next [50,65,107,86,105,107]
end
},
"onSetForm"=>proc{|pokemon,form|
moves=[
:OVERHEAT, # Heat, Microwave
:HYDROPUMP, # Wash, Washing Machine
:BLIZZARD, # Frost, Refrigerator
:AIRSLASH, # Fan
:LEAFSTORM # Mow, Lawnmower
]
moves.each{|move|
pbDeleteMoveByID(pokemon,getID(PBMoves,move))
}
if pokemon.moves.find_all{|i| i.id!=0}.length==0
pbAutoLearnMove(pokemon,getID(PBMoves,:THUNDERSHOCK))
end
if form>0
pbAutoLearnMove(pokemon,getID(PBMoves,moves[form-1]))
end
}
})
MultipleForms.register(:DEOXYS,{
"getBaseStats"=>proc{|pokemon|
case pokemon.form
# Attack Forme
when 2; next [50,180,20,150,180,20]
# Defense Forme
when 3; next [50,70 ,160,90,70,160]
# Speed Forme
when 4; next [50,95, 90, 180,95,90]
# Normal Forme
else; next [50,150,50,150,150,50]
end
}
})
MultipleForms.register(:SHAYMIN,{
"type2"=>proc{|pokemon|
case pokemon.form
# Sky Forme
when 1; next getID(PBTypes,:FLYING)
# Land Forme
else; next getID(PBTypes,:GRASS)
end
},
"ability"=>proc{|pokemon|
if pokemon.form==0
next getID(PBAbilities,:NATURALCURE)
else
next getID(PBAbilities,:SERENEGRACE)
end
},
"getBaseStats"=>proc{|pokemon|
case pokemon.form
# Sky Forme
when 1; next [100,103,75,127,120,75]
# Land Forme
else; next [100,100,100,100,100,100]
end
},
"getForm"=>proc{|pokemon|
case pokemon.form
# Sky Forme
when 1; next 1
# Land Forme
else; next 0
end
}
})
MultipleForms.register(:BURMY,{
"getFormOnCreation"=>proc{|pokemon|
env=pbGetEnvironment()
if env==PBEnvironment::Grass ||
env==PBEnvironment::TallGrass
next 0 # Plant Cloak
elsif env==PBEnvironment::Sand ||
env==PBEnvironment::Rock ||
env==PBEnvironment::Cave
next 1 # Sandy Cloak
else
next 2 # Trash Cloak
end
},
"getFormOnEnteringBattle"=>proc{|pokemon|
env=pbGetEnvironment()
if env==PBEnvironment::Grass ||
env==PBEnvironment::TallGrass
next 0 # Plant Cloak
elsif env==PBEnvironment::Sand ||
env==PBEnvironment::Rock ||
env==PBEnvironment::Cave
next 1 # Sandy Cloak
else
next 2 # Trash Cloak
end
}
})
MultipleForms.register(:WORMADAM,{
"type2"=>proc{|pokemon|
case pokemon.form
# Sandy Cloak
when 1; next getID(PBTypes,:GROUND)
# Trash Cloak
when 2; next getID(PBTypes,:STEEL)
# Plant Cloak
else; next getID(PBTypes,:GRASS)
end
},
"getBaseStats"=>proc{|pokemon|
case pokemon.form
# Sandy Cloak
when 1; next [60,79,105,36,59,85]
# Trash Cloak
when 2; next [60,69,95,36,69,95]
# Plant Cloak
else; next [60,59,85,36,79,105]
end
}
})
MultipleForms.register(:GIRATINA,{
"ability"=>proc{|pokemon|
if pokemon.form==0
next getID(PBAbilities,:PRESSURE)
else
next getID(PBAbilities,:LEVITATE)
end
},
"getForm"=>proc{|pokemon|
if isConst?(pokemon.item,PBItems,:GRISEOUSORB)
next 1
end
# Note: Also depends on location
next 0
},
"getBaseStats"=>proc{|pokemon|
case pokemon.form
# Origin Forme
when 1; next [150,120,100,90,120,100]
# Normal Forme
else; next [150,100,120,90,100,120]
end
}
})
MultipleForms.register(:ARCEUS,{
"type1"=>proc{|pokemon|
types=[:NORMAL,:FIGHTING,:FLYING,
:POISON,:GROUND,:ROCK,:BUG,:GHOST,:STEEL,
:QMARKS,:FIRE,:WATER,:GRASS,:ELECTRIC,
:PSYCHIC,:ICE,:DRAGON,:DARK]
next getID(PBTypes,types[pokemon.form])
},
"type2"=>proc{|pokemon|
types=[:NORMAL,:FIGHTING,:FLYING,
:POISON,:GROUND,:ROCK,:BUG,:GHOST,:STEEL,
:QMARKS,:FIRE,:WATER,:GRASS,:ELECTRIC,
:PSYCHIC,:ICE,:DRAGON,:DARK]
next getID(PBTypes,types[pokemon.form])
},
"getForm"=>proc{|pokemon|
next 1 if isConst?(pokemon.item,PBItems,:FISTPLATE)
next 2 if isConst?(pokemon.item,PBItems,:SKYPLATE)
next 3 if isConst?(pokemon.item,PBItems,:TOXICPLATE)
next 4 if isConst?(pokemon.item,PBItems,:EARTHPLATE)
next 5 if isConst?(pokemon.item,PBItems,:STONEPLATE)
next 6 if isConst?(pokemon.item,PBItems,:INSECTPLATE)
next 7 if isConst?(pokemon.item,PBItems,:SPOOKYPLATE)
next 8 if isConst?(pokemon.item,PBItems,:IRONPLATE)
next 10 if isConst?(pokemon.item,PBItems,:FLAMEPLATE)
next 11 if isConst?(pokemon.item,PBItems,:SPLASHPLATE)
next 12 if isConst?(pokemon.item,PBItems,:MEADOWPLATE)
next 13 if isConst?(pokemon.item,PBItems,:GRASSPLATE)
next 14 if isConst?(pokemon.item,PBItems,:MINDPLATE)
next 15 if isConst?(pokemon.item,PBItems,:ICICLEPLATE)
next 16 if isConst?(pokemon.item,PBItems,:DRACOPLATE)
next 17 if isConst?(pokemon.item,PBItems,:DREADPLATE)
next 0
}
})