def pbMegaEvolve(index)
return if !@battlers[index] || !@battlers[index].pokemon
return if !(@battlers[index].hasMega? rescue false)
return if (@battlers[index].isMega? rescue true)[COLOR="red"]
if pbGetOwner(index)==nil
case (@battlers[index].pokemon.megaMessage rescue 0)
when 1 # Rayquaza
pbDisplay(_INTL("{1}'s fervent wish is reacting to its body!",@battlers[index].pbThis))
else
pbDisplay(_INTL("{1}'s {2} is reacting to its inner power!",
@battlers[index].pbThis,PBItems.getName(@battlers[index].item)))
end
else[/COLOR]
ownername=pbGetOwner(index).fullname
ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
case (@battlers[index].pokemon.megaMessage rescue 0)
when 1 # Rayquaza
pbDisplay(_INTL("{1}'s fervent wish has reached {2}!",ownername,@battlers[index].pbThis))
else
pbDisplay(_INTL("{1}'s {2} is reacting to {3}'s {4}!",
@battlers[index].pbThis,PBItems.getName(@battlers[index].item),
ownername,pbGetMegaRingName(index)))
end[COLOR="Red"]
end[/COLOR]
pbCommonAnimation("MegaEvolution",@battlers[index],nil)
@battlers[index].pokemon.makeMega
@battlers[index].form=@battlers[index].pokemon.form
@battlers[index].pbUpdate(true)
@scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
pbCommonAnimation("MegaEvolution2",@battlers[index],nil)
meganame=(@battlers[index].pokemon.megaName rescue nil)
if !meganame || meganame==""
meganame=_INTL("Mega {1}",PBSpecies.getName(@battlers[index].pokemon.species))
end
pbDisplay(_INTL("{1} has Mega Evolved into {2}!",@battlers[index].pbThis,meganame))
PBDebug.log("[Mega Evolution] #{@battlers[index].pbThis} Mega Evolved")
side=(pbIsOpposing?(index)) ? 1 : 0
owner=pbGetOwnerIndex(index)
@megaEvolution[side][owner]=-2
end