- 465
- Posts
- 8
- Years
- Seen Jun 17, 2024
Not seen anything about it; but anyone know the way/how to make the change between iron head and behemoth blade/behemoth shield when entering battle? doesnt seem to work the same way as rotoms form moves.
LevelRain = 29
HappinessMoveType = 30
PotItem = 31
Custom2 = 32
EVONAMES=["Unknown",
"Happiness","HappinessDay","HappinessNight","Level","Trade",
"TradeItem","Item","AttackGreater","AtkDefEqual","DefenseGreater",
"Silcoon","Cascoon","Ninjask","Shedinja","Beauty",
"ItemMale","ItemFemale","DayHoldItem","NightHoldItem","HasMove",
"HasInParty","LevelMale","LevelFemale","Location","TradeSpecies",
"LevelDay","LevelNight","LevelDarkInParty","LevelRain","HappinessMoveType",
"PotItem","Custom2","Custom3","Custom4","Custom5"
]
EVOPARAM=[0, # Unknown (do not use)
0,0,0,1,0, # Happiness, HappinessDay, HappinessNight, Level, Trade
2,2,1,1,1, # TradeItem, Item, AttackGreater, AtkDefEqual, DefenseGreater
1,1,1,1,1, # Silcoon, Cascoon, Ninjask, Shedinja, Beauty
2,2,2,2,3, # ItemMale, ItemFemale, DayHoldItem, NightHoldItem, HasMove
4,1,1,1,4, # HasInParty, LevelMale, LevelFemale, Location, TradeSpecies
1,1,1,1,5, # LevelDay, LevelNight, LevelDarkInParty, LevelRain, HappinessMoveType
0,1,1,1,1 # PotItem, Custom 2-5
]
def pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item)
# Checks for when an item is used on the Pokémon (e.g. an evolution stone)
case evonib
when PBEvolution::Item
return poke if level==item
when PBEvolution::ItemMale
return poke if level==item && pokemon.isMale?
when PBEvolution::ItemFemale
return poke if level==item && pokemon.isFemale?
when PBEvolution::PotItem
return poke if isConst?(item,PBItems,:CRACKEDPOT) && pokemon.form==0
return poke if isConst?(item,PBItems,:CHIPPEDPOT) && pokemon.form==1
end
return -1
end
Pokedex=The teacup in which this Pokémon makes its home is a famous piece of antique tableware. Many forgeries are in circulation.
FormName=Phony Form
BattlerPlayerY=24
BattlerEnemyY=34
BattlerAltitude=10
Evolutions=POLTEAGEIST,PotItem
#-------------------------------
[SINISTEA-1]
FormName=Antique Form
Pokedex=It absorbs the life-force of those who drink it. It waits patiently, but opportunities are fleeting—it tastes so bad that it gets spat out immediately.
#-------------------------------
[POLTEAGEIST-1]
FormName=Antique Form
Pokedex=Trainers Polteageist trusts will be allowed to experience its distinctive flavor and aroma firsthand by sampling just a tiny bit of its tea.
#-------------------------------
Sinistea's evo method, where we have two differents form: Phony and Antique.
Spoiler:
Let's make a new method. Inside 'Pokemon_Evolution' script, create 'PotItem':
Code:LevelRain = 29 HappinessMoveType = 30 PotItem = 31 Custom2 = 32
Add '"PotItem"' inside 'EVONAMES':
Code:EVONAMES=["Unknown", "Happiness","HappinessDay","HappinessNight","Level","Trade", "TradeItem","Item","AttackGreater","AtkDefEqual","DefenseGreater", "Silcoon","Cascoon","Ninjask","Shedinja","Beauty", "ItemMale","ItemFemale","DayHoldItem","NightHoldItem","HasMove", "HasInParty","LevelMale","LevelFemale","Location","TradeSpecies", "LevelDay","LevelNight","LevelDarkInParty","LevelRain","HappinessMoveType", "PotItem","Custom2","Custom3","Custom4","Custom5" ]
Now, in 'EVOPARAM' put '0':
Code:EVOPARAM=[0, # Unknown (do not use) 0,0,0,1,0, # Happiness, HappinessDay, HappinessNight, Level, Trade 2,2,1,1,1, # TradeItem, Item, AttackGreater, AtkDefEqual, DefenseGreater 1,1,1,1,1, # Silcoon, Cascoon, Ninjask, Shedinja, Beauty 2,2,2,2,3, # ItemMale, ItemFemale, DayHoldItem, NightHoldItem, HasMove 4,1,1,1,4, # HasInParty, LevelMale, LevelFemale, Location, TradeSpecies 1,1,1,1,5, # LevelDay, LevelNight, LevelDarkInParty, LevelRain, HappinessMoveType 0,1,1,1,1 # PotItem, Custom 2-5 ]
Then, find 'def pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item)' and add a new code for 'PotItem':
Code:def pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item) # Checks for when an item is used on the Pokémon (e.g. an evolution stone) case evonib when PBEvolution::Item return poke if level==item when PBEvolution::ItemMale return poke if level==item && pokemon.isMale? when PBEvolution::ItemFemale return poke if level==item && pokemon.isFemale? when PBEvolution::PotItem return poke if isConst?(item,PBItems,:CRACKEDPOT) && pokemon.form==0 return poke if isConst?(item,PBItems,:CHIPPEDPOT) && pokemon.form==1 end return -1 end
Finally, inside pokemon.txt, add the method in 'Evolutions=':
Code:Pokedex=The teacup in which this Pokémon makes its home is a famous piece of antique tableware. Many forgeries are in circulation. FormName=Phony Form BattlerPlayerY=24 BattlerEnemyY=34 BattlerAltitude=10 Evolutions=POLTEAGEIST,PotItem
Also, add Antique form inside 'pokemonforms.txt':
Code:#------------------------------- [SINISTEA-1] FormName=Antique Form Pokedex=It absorbs the life-force of those who drink it. It waits patiently, but opportunities are fleeting—it tastes so bad that it gets spat out immediately. #------------------------------- [POLTEAGEIST-1] FormName=Antique Form Pokedex=Trainers Polteageist trusts will be allowed to experience its distinctive flavor and aroma firsthand by sampling just a tiny bit of its tea. #-------------------------------
# Trace
if self.hasWorkingAbility(:TRACE)
choices=[]
for i in 0...4
[email protected][i]
if pbIsOpposing?(i) && !foe.fainted?
abil=foe.ability
if abil>0 &&
!isConst?(abil,PBAbilities,:TRACE) && !isConst?(abil,PBAbilities,:MULTITYPE) &&
!isConst?(abil,PBAbilities,:ILLUSION) && !isConst?(abil,PBAbilities,:FLOWERGIFT) &&
!isConst?(abil,PBAbilities,:IMPOSTER) && !isConst?(abil,PBAbilities,:STANCECHANGE) &&
!isConst?(abil,PBAbilities,:COMATOSE) && !isConst?(abil,PBAbilities,:BATTLEBOND) &&
!isConst?(abil,PBAbilities,:POWERCONSTRUCT) && !isConst?(abil,PBAbilities,:DISGUISE) &&
!isConst?(abil,PBAbilities,:POWEROFALCHEMY) && !isConst?(abil,PBAbilities,:RECEIVER) &&
!isConst?(abil,PBAbilities,:RKSSYSTEM) && !isConst?(abil,PBAbilities,:SCHOOLING) &&
!isConst?(abil,PBAbilities,:SHIELDSDOWN) && !isConst?(abil,PBAbilities,:GULPMISSILE)
choices.push(i)
end
end
end
if choices.length>0
choice=choices[@battle.pbRandom(choices.length)]
[email protected][choice].pbThis(true)
[email protected][choice].ability
@ability=battlerability
abilityname=PBAbilities.getName(battlerability)
@battle.pbDisplay(_INTL("{1} traced {2}'s {3}!",pbThis,battlername,abilityname))
PBDebug.log("[Ability triggered] #{pbThis}'s Trace turned into #{abilityname} from #{battlername}")
end
end
if target.hasWorkingAbility(:ANGERPOINT)
if target.damagestate.critical && !target.damagestate.substitute &&
target.pbCanIncreaseStatStage?(PBStats::ATTACK,target)
PBDebug.log("[Ability triggered] #{target.pbThis}'s Anger Point")
target.stages[PBStats::ATTACK]=6
@battle.pbCommonAnimation("StatUp",target,nil)
@battle.pbDisplay(_INTL("{1}'s {2} maxed its {3}!",
target.pbThis,PBAbilities.getName(target.ability),PBStats.getName(PBStats::ATTACK)))
end
end
if target.hasWorkingAbility(:GULPMISSILE,true) && isConst?(target.species,PBSpecies,:CRAMORANT) &&
target.form!=0
PBDebug.log("[Ability triggered] #{target.pbThis}'s Gulp Missile")
gulpform=target.form; target.form=0
#@battle.pbCommonAnimation("Gulping",target,nil) if gulpform==1 # Need an animation
#@battle.pbCommonAnimation("Gorging",target,nil) if gulpform==2 # Need an animation
@battle.scene.pbChangePokemon(target,target.pokemon)
if !user.hasWorkingAbility(:MAGICGUARD)
damage=(user.totalhp/4).floor
if damage>0
@battle.scene.pbDamageAnimation(user,0)
user.pbReduceHP(damage)
end
user.pbFaint if user.fainted?
end
if gulpform==1; user.pbReduceStat(PBStats::DEFENSE,1,nil,false) # Gulping Form
elsif gulpform==2; user.pbParalyze(target) # Gorging Form
end
end
end
def pbResetForm
if !@effects[PBEffects::Transform]
if isConst?(self.species,PBSpecies,:CASTFORM) ||
isConst?(self.species,PBSpecies,:CHERRIM) ||
isConst?(self.species,PBSpecies,:DARMANITAN) ||
isConst?(self.species,PBSpecies,:MELOETTA) ||
isConst?(self.species,PBSpecies,:AEGISLASH) ||
isConst?(self.species,PBSpecies,:XERNEAS) ||
isConst?(self.species,PBSpecies,:WISHIWASHI) ||
isConst?(self.species,PBSpecies,:CRAMORANT)
self.form=0
end
end
pbUpdate(true)
end
################################################################################
# Power is doubled if the target is using Dive. (Surf)
# (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
################################################################################
class PokeBattle_Move_075 < PokeBattle_Move
def pbModifyDamage(damagemult,attacker,opponent)
if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
return (damagemult*2.0).round
end
return damagemult
end
def pbEffectAfterHit(attacker,opponent,turneffects)
if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
if isConst?(attacker.species,PBSpecies,:CRAMORANT) &&
attacker.hasWorkingAbility(:GULPMISSILE) && attacker.form==0
attacker.form=2
attacker.form=1 if attacker.hp>(attacker.totalhp/2)
@battle.scene.pbChangePokemon(attacker,attacker.pokemon)
end
end
end
end
################################################################################
# Two turn attack. Skips first turn, attacks second turn. (Dive)
# (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
################################################################################
class PokeBattle_Move_0CB < PokeBattle_Move
def pbTwoTurnAttack(attacker)
@immediate=false
if !@immediate && attacker.hasWorkingItem(:POWERHERB)
@immediate=true
end
return false if @immediate
return attacker.effects[PBEffects::TwoTurnAttack]==0
end
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
@battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
if isConst?(attacker.species,PBSpecies,:CRAMORANT) &&
attacker.hasWorkingAbility(:GULPMISSILE) && attacker.form==0
attacker.form=2
attacker.form=1 if attacker.hp>(attacker.totalhp/2)
@battle.scene.pbChangePokemon(attacker,attacker.pokemon)
end
end
if @immediate
@battle.pbCommonAnimation("UseItem",attacker,nil)
@battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
attacker.pbConsumeItem
end
return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
return super(attacker,opponent,hitnum,alltargets,showanimation)
end
end
when you think you have everything finished with gen 8 for essentials.
Here we can see the ability only will trigger into the end of turn (if Yamper hp>0 of course): https://youtu.be/AmULLkvD55c
How can we code it?
Yawn = 108
BallFetch = 109
@effects[PBEffects::Yawn] = 0
@effects[PBEffects::BallFetch] = 0
def pbBallFetch(ball)
return if isConst?(ball,PBItems,:SAFARIBALL)
for i in 0...4
if self.battlers[i].hasWorkingAbility(:BALLFETCH) && self.battlers[i].item==0
self.battlers[i].effects[PBEffects::BallFetch]=ball
end
end
end
def pbThrowPokeBall(idxPokemon,ball,rareness=nil,showplayer=false)
itemname=PBItems.getName(ball)
battler=nil
if pbIsOpposing?(idxPokemon)
battler=self.battlers[idxPokemon]
else
battler=self.battlers[idxPokemon].pbOppositeOpposing
end
if battler.fainted?
battler=battler.pbPartner
end
pbDisplayBrief(_INTL("{1} threw one {2}!",self.pbPlayer.name,itemname))
if battler.fainted?
pbDisplay(_INTL("But there was no target..."))
pbBallFetch(ball)
return
end
if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?)
@scene.pbThrowAndDeflect(ball,1)
pbDisplay(_INTL("The Trainer blocked the Ball!\nDon't be a thief!"))
pbBallFetch(ball)
else
pokemon=battler.pokemon
species=pokemon.species
if $DEBUG && Input.press?(Input::CTRL)
shakes=4
else
if !rareness
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,pokemon.fSpecies,16)
rareness=dexdata.fgetb # Get rareness from dexdata file
dexdata.close
end
a=battler.totalhp
b=battler.hp
rareness=BallHandlers.modifyCatchRate(ball,rareness,self,battler)
x=(((a*3-b*2)*rareness)/(a*3)).floor
if battler.status==PBStatuses::SLEEP || battler.status==PBStatuses::FROZEN ||
battler.status==PBStatuses::PARALYSIS
x=(x*2.5).floor
elsif battler.status!=0
x=(x*1.5).floor
end
c=0
if $Trainer
if $Trainer.pokedexOwned>600
c=(x*2.5/6).floor
elsif $Trainer.pokedexOwned>450
c=(x*2/6).floor
elsif $Trainer.pokedexOwned>300
c=(x*1.5/6).floor
elsif $Trainer.pokedexOwned>150
c=(x*1/6).floor
elsif $Trainer.pokedexOwned>30
c=(x*0.5/6).floor
end
end
shakes=0; critical=false
if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
shakes=4
else
x=1 if x<1
y = ( 65536 / ((255.0/x)**0.1875) ).floor
if USECRITICALCAPTURE && pbRandom(256)<c
critical=true
shakes=4 if pbRandom(65536)<y
else
shakes+=1 if pbRandom(65536)<y
shakes+=1 if pbRandom(65536)<y && shakes==1
shakes+=1 if pbRandom(65536)<y && shakes==2
shakes+=1 if pbRandom(65536)<y && shakes==3
end
end
end
PBDebug.log("[Threw Poké Ball] #{itemname}, #{shakes} shakes (4=capture)")
@scene.pbThrow(ball,shakes,critical,battler.index,showplayer)
case shakes
when 0
pbDisplay(_INTL("Oh no! The Pokémon broke free!"))
BallHandlers.onFailCatch(ball,self,battler)
pbBallFetch(ball)
when 1
pbDisplay(_INTL("Aww... It appeared to be caught!"))
BallHandlers.onFailCatch(ball,self,battler)
pbBallFetch(ball)
when 2
pbDisplay(_INTL("Aargh! Almost had it!"))
BallHandlers.onFailCatch(ball,self,battler)
pbBallFetch(ball)
when 3
pbDisplay(_INTL("Gah! It was so close, too!"))
BallHandlers.onFailCatch(ball,self,battler)
pbBallFetch(ball)
when 4
pbDisplayBrief(_INTL("Gotcha! {1} was caught!",pokemon.name))
@scene.pbThrowSuccess
if pbIsSnagBall?(ball) && @opponent
pbRemoveFromParty(battler.index,battler.pokemonIndex)
battler.pbReset
battler.participants=[]
else
@decision=4
end
if pbIsSnagBall?(ball)
pokemon.ot=self.pbPlayer.name
pokemon.trainerID=self.pbPlayer.id
end
BallHandlers.onCatch(ball,self,pokemon)
pokemon.ballused=pbGetBallType(ball)
((pokemon.makeUnmega if pokemon.isMega?) rescue nil)
pokemon.makeUnprimal rescue nil
pokemon.pbRecordFirstMoves
if GAINEXPFORCAPTURE
battler.captured=true
pbGainEXP
battler.captured=false
end
if !self.pbPlayer.hasOwned?(species)
self.pbPlayer.setOwned(species)
if $Trainer.pokedex
pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pokemon.name))
@scene.pbShowPokedex(species)
end
end
pokemon.forcedForm = nil if MultipleForms.hasFunction?(pokemon.species,"getForm")
@scene.pbHideCaptureBall
if pbIsSnagBall?(ball) && @opponent
pokemon.pbUpdateShadowMoves rescue nil
@snaggedpokemon.push(pokemon)
else
pbStorePokemon(pokemon)
end
end
end
end
# Moody
if i.hasWorkingAbility(:MOODY)
randomup=[]; randomdown=[]
for j in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,PBStats::SPATK,
PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
randomup.push(j) if i.pbCanIncreaseStatStage?(j,i)
randomdown.push(j) if i.pbCanReduceStatStage?(j,i)
end
if randomup.length>0
PBDebug.log("[Ability triggered] #{i.pbThis}'s Moody (raise stat)")
r=pbRandom(randomup.length)
i.pbIncreaseStatWithCause(randomup[r],2,i,PBAbilities.getName(i.ability))
for j in 0...randomdown.length
if randomdown[j]==randomup[r]
randomdown[j]=nil; randomdown.compact!
break
end
end
end
if randomdown.length>0
PBDebug.log("[Ability triggered] #{i.pbThis}'s Moody (lower stat)")
r=pbRandom(randomdown.length)
i.pbReduceStatWithCause(randomdown[r],1,i,PBAbilities.getName(i.ability))
end
end
# Ball Fetch
if i.hasWorkingAbility(:BALLFETCH) && i.effects[PBEffects::BallFetch]!=0 && i.item<=0
ball=i.effects[PBEffects::BallFetch]
i.item=ball
i.pokemon.itemInitial=i.item
PBDebug.log("[Ability triggered] #{i.pbThis}'s Ball Fetch found #{PBItems.getName(ball)}")
pbDisplay(_INTL("{1} found a {2}!",i.pbThis,PBItems.getName(ball)))
i.pbPartner.effects[PBEffects::BallFetch]=0 if i.pbPartner.hasWorkingAbility(:BALLFETCH)
end
end
for i in priority
next if i.fainted?
# Toxic Orb
if i.hasWorkingItem(:TOXICORB) && i.status==0 && i.pbCanPoison?(nil,false)
PBDebug.log("[Item triggered] #{i.pbThis}'s Toxic Orb")
i.pbPoison(nil,_INTL("{1} was badly poisoned by its {2}!",i.pbThis,
PBItems.getName(i.item)),true)
end
# Flame Orb
Ripen Ability
Replace (or adapt) the defs pbConfusionBerry, pbStatIncreasingBerry and pbActivateBerryEffect with the following codes
Spoiler:
Code:def pbConfusionBerry(flavor,message1,message2) if hasWorkingAbility(:RIPEN) amt=self.pbRecoverHP((self.totalhp/4).floor,true) else amt=self.pbRecoverHP((self.totalhp/8).floor,true) end if amt>0 @battle.pbDisplay(message1) if (self.nature%5)==flavor && (self.nature/5).floor!=(self.nature%5) @battle.pbDisplay(message2) pbConfuseSelf end return true end return false end
Code:def pbStatIncreasingBerry(stat,berryname) if hasWorkingAbility(:RIPEN) return pbIncreaseStatWithCause(stat,2,self,berryname) else return pbIncreaseStatWithCause(stat,1,self,berryname) end end
Spoiler:
Code:def pbActivateBerryEffect(berry=0,consume=true) berry=self.item if berry==0 berryname=(berry==0) ? "" : PBItems.getName(berry) PBDebug.log("[Item triggered] #{pbThis}'s #{berryname}") consumed=false if isConst?(berry,PBItems,:ORANBERRY) if hasWorkingAbility(:RIPEN) amt=self.pbRecoverHP(20,true) else amt=self.pbRecoverHP(10,true) end if amt>0 @battle.pbDisplay(_INTL("{1} restored its health using its {2}!",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:SITRUSBERRY) || isConst?(berry,PBItems,:ENIGMABERRY) if hasWorkingAbility(:RIPEN) amt=self.pbRecoverHP((self.totalhp/2).floor,true) else amt=self.pbRecoverHP((self.totalhp/4).floor,true) end if amt>0 @battle.pbDisplay(_INTL("{1} restored its health using its {2}!",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:CHESTOBERRY) if self.status==PBStatuses::SLEEP pbCureStatus(false) @battle.pbDisplay(_INTL("{1}'s {2} cured its sleep problem.",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:PECHABERRY) if self.status==PBStatuses::POISON pbCureStatus(false) @battle.pbDisplay(_INTL("{1}'s {2} cured its poisoning.",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:RAWSTBERRY) if self.status==PBStatuses::BURN pbCureStatus(false) @battle.pbDisplay(_INTL("{1}'s {2} healed its burn.",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:CHERIBERRY) if self.status==PBStatuses::PARALYSIS pbCureStatus(false) @battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis.",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:ASPEARBERRY) if self.status==PBStatuses::FROZEN pbCureStatus(false) @battle.pbDisplay(_INTL("{1}'s {2} thawed it out.",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:LEPPABERRY) found=[] for i in [email protected] if @pokemon.moves[i].id!=0 if (consume && @pokemon.moves[i].pp==0) || (!consume && @pokemon.moves[i].pp<@pokemon.moves[i].totalpp) found.push(i) end end end if found.length>0 choice=(consume) ? found[0] : found[@battle.pbRandom(found.length)] [email protected][choice] if hasWorkingAbility(:RIPEN) pokemove.pp+=20 else pokemove.pp+=10 end pokemove.pp=pokemove.totalpp if pokemove.pp>pokemove.totalpp self.moves[choice].pp=pokemove.pp movename=PBMoves.getName(pokemove.id) @battle.pbDisplay(_INTL("{1}'s {2} restored {3}'s PP!",pbThis,berryname,movename)) consumed=true end elsif isConst?(berry,PBItems,:PERSIMBERRY) if @effects[PBEffects::Confusion]>0 pbCureConfusion(false) @battle.pbDisplay(_INTL("{1}'s {2} snapped it out of its confusion!",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:LUMBERRY) if self.status>0 || @effects[PBEffects::Confusion]>0 st=self.status; conf=(@effects[PBEffects::Confusion]>0) pbCureStatus(false) pbCureConfusion(false) case st when PBStatuses::SLEEP @battle.pbDisplay(_INTL("{1}'s {2} woke it up!",pbThis,berryname)) when PBStatuses::POISON @battle.pbDisplay(_INTL("{1}'s {2} cured its poisoning!",pbThis,berryname)) when PBStatuses::BURN @battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",pbThis,berryname)) when PBStatuses::PARALYSIS @battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",pbThis,berryname)) when PBStatuses::FROZEN @battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",pbThis,berryname)) end if conf @battle.pbDisplay(_INTL("{1}'s {2} snapped it out of its confusion!",pbThis,berryname)) end consumed=true end elsif isConst?(berry,PBItems,:FIGYBERRY) consumed=pbConfusionBerry(0, _INTL("{1}'s {2} restored health!",pbThis,berryname), _INTL("For {1}, the {2} was too spicy!",pbThis(true),berryname)) elsif isConst?(berry,PBItems,:WIKIBERRY) consumed=pbConfusionBerry(3, _INTL("{1}'s {2} restored health!",pbThis,berryname), _INTL("For {1}, the {2} was too dry!",pbThis(true),berryname)) elsif isConst?(berry,PBItems,:MAGOBERRY) consumed=pbConfusionBerry(2, _INTL("{1}'s {2} restored health!",pbThis,berryname), _INTL("For {1}, the {2} was too sweet!",pbThis(true),berryname)) elsif isConst?(berry,PBItems,:AGUAVBERRY) consumed=pbConfusionBerry(4, _INTL("{1}'s {2} restored health!",pbThis,berryname), _INTL("For {1}, the {2} was too bitter!",pbThis(true),berryname)) elsif isConst?(berry,PBItems,:IAPAPABERRY) consumed=pbConfusionBerry(1, _INTL("{1}'s {2} restored health!",pbThis,berryname), _INTL("For {1}, the {2} was too sour!",pbThis(true),berryname)) elsif isConst?(berry,PBItems,:LIECHIBERRY) consumed=pbStatIncreasingBerry(PBStats::ATTACK,berryname) elsif isConst?(berry,PBItems,:GANLONBERRY) || isConst?(berry,PBItems,:KEEBERRY) consumed=pbStatIncreasingBerry(PBStats::DEFENSE,berryname) elsif isConst?(berry,PBItems,:SALACBERRY) consumed=pbStatIncreasingBerry(PBStats::SPEED,berryname) elsif isConst?(berry,PBItems,:PETAYABERRY) consumed=pbStatIncreasingBerry(PBStats::SPATK,berryname) elsif isConst?(berry,PBItems,:APICOTBERRY) || isConst?(berry,PBItems,:MARANGABERRY) consumed=pbStatIncreasingBerry(PBStats::SPDEF,berryname) elsif isConst?(berry,PBItems,:LANSATBERRY) if @effects[PBEffects::FocusEnergy]<2 @effects[PBEffects::FocusEnergy]=2 @battle.pbDisplay(_INTL("{1} used its {2} to get pumped!",pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:MICLEBERRY) if !@effects[PBEffects::MicleBerry] @effects[PBEffects::MicleBerry]=true @battle.pbDisplay(_INTL("{1} boosted the accuracy of its next move using its {2}!", pbThis,berryname)) consumed=true end elsif isConst?(berry,PBItems,:STARFBERRY) stats=[] for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPATK,PBStats::SPDEF,PBStats::SPEED] stats.push(i) if pbCanIncreaseStatStage?(i,self) end if stats.length>0 stat=stats[@battle.pbRandom(stats.length)] if hasWorkingAbility(:RIPEN) consumed=pbIncreaseStatWithCause(stat,4,self,berryname) else consumed=pbIncreaseStatWithCause(stat,2,self,berryname) end end end # if consumed # Cheek Pouch if hasWorkingAbility(:CHEEKPOUCH) amt=self.pbRecoverHP((@totalhp/3).floor,true) if amt>0 @battle.pbDisplay(_INTL("{1}'s {2} restored its health!", pbThis,PBAbilities.getName(ability))) end end pbConsumeItem if consume self.pokemon.belch=true if self.pokemon end end
You have successfully implemented the ability!!!!
def pbConfusionBerry(flavor,message1,message2)
return false if @effects[PBEffects::HealBlock]>0
ripen=(hasWorkingAbility(:RIPEN)) ? 4 : 8
amt=self.pbRecoverHP((self.totalhp/ripen).floor,true)
if amt>0
@battle.pbDisplay(message1)
if (self.nature%5)==flavor && (self.nature/5).floor!=(self.nature%5)
@battle.pbDisplay(message2)
pbConfuseSelf
end
return true
end
return false
end
def pbStatIncreasingBerry(stat,berryname)
ripen=(hasWorkingAbility(:RIPEN)) ? 2 : 1
return pbIncreaseStatWithCause(stat,ripen,self,berryname)
end
def pbActivateBerryEffect(berry=0,consume=true)
berry=self.item if berry==0
berryname=(berry==0) ? "" : PBItems.getName(berry)
PBDebug.log("[Item triggered] #{pbThis}'s #{berryname}")
consumed=false
if isConst?(berry,PBItems,:ORANBERRY)
if @effects[PBEffects::HealBlock]==0
amt=(hasWorkingAbility(:RIPEN)) ? self.pbRecoverHP(20,true) : self.pbRecoverHP(10,true)
if amt>0
@battle.pbDisplay(_INTL("{1} restored its health using its {2}!",pbThis,berryname))
consumed=true
end
end
elsif isConst?(berry,PBItems,:SITRUSBERRY) ||
isConst?(berry,PBItems,:ENIGMABERRY)
if @effects[PBEffects::HealBlock]==0
ripen=(hasWorkingAbility(:RIPEN)) ? 2 : 4
amt=self.pbRecoverHP((self.totalhp/ripen).floor,true)
if amt>0
@battle.pbDisplay(_INTL("{1} restored its health using its {2}!",pbThis,berryname))
consumed=true
end
end
elsif isConst?(berry,PBItems,:CHESTOBERRY)
if self.status==PBStatuses::SLEEP
pbCureStatus(false)
@battle.pbDisplay(_INTL("{1}'s {2} cured its sleep problem.",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:PECHABERRY)
if self.status==PBStatuses::POISON
pbCureStatus(false)
@battle.pbDisplay(_INTL("{1}'s {2} cured its poisoning.",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:RAWSTBERRY)
if self.status==PBStatuses::BURN
pbCureStatus(false)
@battle.pbDisplay(_INTL("{1}'s {2} healed its burn.",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:CHERIBERRY)
if self.status==PBStatuses::PARALYSIS
pbCureStatus(false)
@battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis.",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:ASPEARBERRY)
if self.status==PBStatuses::FROZEN
pbCureStatus(false)
@battle.pbDisplay(_INTL("{1}'s {2} thawed it out.",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:LEPPABERRY)
found=[]
for i in [email protected]
if @pokemon.moves[i].id!=0
if (consume && @pokemon.moves[i].pp==0) ||
(!consume && @pokemon.moves[i].pp<@pokemon.moves[i].totalpp)
found.push(i)
end
end
end
if found.length>0
choice=(consume) ? found[0] : found[@battle.pbRandom(found.length)]
[email protected][choice]
pokemove.pp+=(hasWorkingAbility(:RIPEN)) ? 20 : 10
pokemove.pp=pokemove.totalpp if pokemove.pp>pokemove.totalpp
self.moves[choice].pp=pokemove.pp
movename=PBMoves.getName(pokemove.id)
@battle.pbDisplay(_INTL("{1}'s {2} restored {3}'s PP!",pbThis,berryname,movename))
consumed=true
end
elsif isConst?(berry,PBItems,:PERSIMBERRY)
if @effects[PBEffects::Confusion]>0
pbCureConfusion(false)
@battle.pbDisplay(_INTL("{1}'s {2} snapped it out of its confusion!",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:LUMBERRY)
if self.status>0 || @effects[PBEffects::Confusion]>0
st=self.status; conf=(@effects[PBEffects::Confusion]>0)
pbCureStatus(false)
pbCureConfusion(false)
case st
when PBStatuses::SLEEP
@battle.pbDisplay(_INTL("{1}'s {2} woke it up!",pbThis,berryname))
when PBStatuses::POISON
@battle.pbDisplay(_INTL("{1}'s {2} cured its poisoning!",pbThis,berryname))
when PBStatuses::BURN
@battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",pbThis,berryname))
when PBStatuses::PARALYSIS
@battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",pbThis,berryname))
when PBStatuses::FROZEN
@battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",pbThis,berryname))
end
if conf
@battle.pbDisplay(_INTL("{1}'s {2} snapped it out of its confusion!",pbThis,berryname))
end
consumed=true
end
elsif isConst?(berry,PBItems,:FIGYBERRY)
consumed=pbConfusionBerry(0,
_INTL("{1}'s {2} restored health!",pbThis,berryname),
_INTL("For {1}, the {2} was too spicy!",pbThis(true),berryname))
elsif isConst?(berry,PBItems,:WIKIBERRY)
consumed=pbConfusionBerry(3,
_INTL("{1}'s {2} restored health!",pbThis,berryname),
_INTL("For {1}, the {2} was too dry!",pbThis(true),berryname))
elsif isConst?(berry,PBItems,:MAGOBERRY)
consumed=pbConfusionBerry(2,
_INTL("{1}'s {2} restored health!",pbThis,berryname),
_INTL("For {1}, the {2} was too sweet!",pbThis(true),berryname))
elsif isConst?(berry,PBItems,:AGUAVBERRY)
consumed=pbConfusionBerry(4,
_INTL("{1}'s {2} restored health!",pbThis,berryname),
_INTL("For {1}, the {2} was too bitter!",pbThis(true),berryname))
elsif isConst?(berry,PBItems,:IAPAPABERRY)
consumed=pbConfusionBerry(1,
_INTL("{1}'s {2} restored health!",pbThis,berryname),
_INTL("For {1}, the {2} was too sour!",pbThis(true),berryname))
elsif isConst?(berry,PBItems,:LIECHIBERRY)
consumed=pbStatIncreasingBerry(PBStats::ATTACK,berryname)
elsif isConst?(berry,PBItems,:GANLONBERRY) ||
isConst?(berry,PBItems,:KEEBERRY)
consumed=pbStatIncreasingBerry(PBStats::DEFENSE,berryname)
elsif isConst?(berry,PBItems,:SALACBERRY)
consumed=pbStatIncreasingBerry(PBStats::SPEED,berryname)
elsif isConst?(berry,PBItems,:PETAYABERRY)
consumed=pbStatIncreasingBerry(PBStats::SPATK,berryname)
elsif isConst?(berry,PBItems,:APICOTBERRY) ||
isConst?(berry,PBItems,:MARANGABERRY)
consumed=pbStatIncreasingBerry(PBStats::SPDEF,berryname)
elsif isConst?(berry,PBItems,:LANSATBERRY)
if @effects[PBEffects::FocusEnergy]<2
@effects[PBEffects::FocusEnergy]=2
@battle.pbDisplay(_INTL("{1} used its {2} to get pumped!",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:MICLEBERRY)
if !@effects[PBEffects::MicleBerry]
@effects[PBEffects::MicleBerry]=true
@battle.pbDisplay(_INTL("{1} boosted the accuracy of its next move using its {2}!",pbThis,berryname))
consumed=true
end
elsif isConst?(berry,PBItems,:STARFBERRY)
stats=[]
for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPATK,PBStats::SPDEF,PBStats::SPEED]
stats.push(i) if pbCanIncreaseStatStage?(i,self)
end
if stats.length>0
stat=stats[@battle.pbRandom(stats.length)]
ripen=(hasWorkingAbility(:RIPEN)) ? 4 : 2
consumed=pbIncreaseStatWithCause(stat,ripen,self,berryname)
end
end
if consumed
# Cheek Pouch
if hasWorkingAbility(:CHEEKPOUCH) && @effects[PBEffects::HealBlock]==0
amt=self.pbRecoverHP((@totalhp/3).floor,true)
if amt>0
@battle.pbDisplay(_INTL("{1}'s {2} restored its health!",
pbThis,PBAbilities.getName(ability)))
end
end
pbConsumeItem if consume
self.pokemon.belch=true if self.pokemon
end
end
Mimicry = XXX
############################################################################
# These effects apply to a side
CraftyShield = 0
@effects[PBEffects::Yawn] = 0
@effects[PBEffects::Mimicry] = false
end
def pbUpdate(fullchange=false)
# Ability effects
pbEffectsOnDealingDamage(thismove,user,target,damage)
# Grudge
if !user.fainted? && target.fainted?
if target.effects[PBEffects::Grudge] && target.pbIsOpposing?(user.index)
thismove.pp=0
@battle.pbDisplay(_INTL("{1}'s {2} lost all its PP due to the grudge!",
user.pbThis,thismove.name))
PBDebug.log("[Lingering effect triggered] #{target.pbThis}'s Grudge made #{thismove.name} lose all its PP")
end
end
# Mimicry
if isConst?(thismove.id,PBMoves,:SOAK) || isConst?(thismove.id,PBMoves,:MAGICPOWDER) &&
target.hasWorkingAbility(:MIMICRY) && !target.fainted?
if @battle.field.effects[PBEffects::ElectricTerrain]>0
target.type1=getConst(PBTypes,:ELECTRIC); target.type2=getConst(PBTypes,:ELECTRIC)
target.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:ELECTRIC))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",target.pbThis,typename))
elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
target.type1=getConst(PBTypes,:GRASS); target.type2=getConst(PBTypes,:GRASS)
target.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:GRASS))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",target.pbThis,typename))
elsif @battle.field.effects[PBEffects::MistyTerrain]>0
target.type1=getConst(PBTypes,:FAIRY); target.type2=getConst(PBTypes,:FAIRY)
target.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:FAIRY))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",target.pbThis,typename))
elsif @battle.field.effects[PBEffects::PsychicTerrain]>0
target.type1=getConst(PBTypes,:PSYCHIC); target.type2=getConst(PBTypes,:PSYCHIC)
target.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:PSYCHIC))
@battle.pbDisplay(_INTL("{1}'s type changed to {2}!",target.pbThis,typename))
end
end
if target.fainted?
destinybond=destinybond || target.effects[PBEffects::DestinyBond]
end
user.pbFaint if user.fainted? # no return
# Electric Terrain
if @field.effects[PBEffects::ElectricTerrain]>0
for i in 0...4; user=@battlers[i]
if user.hasWorkingItem(:ELECTRICSEED)
if user.pbIncreaseStatWithCause(PBStats::DEFENSE,1,user,PBItems.getName(user.item))
user.pbConsumeItem
end
end
if user.hasWorkingAbility(:MIMICRY) && !user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=true
user.type1=getConst(PBTypes,:ELECTRIC)
user.type2=getConst(PBTypes,:ELECTRIC)
user.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:ELECTRIC))
pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typename))
end
end
@field.effects[PBEffects::ElectricTerrain]-=1
if @field.effects[PBEffects::ElectricTerrain]==0
pbDisplay(_INTL("The electric current disappeared from the battlefield."))
PBDebug.log("[End of effect] Electric Terrain ended")
for i in 0...4; user=@battlers[i]
if user.hasWorkingAbility(:MIMICRY) && user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=false
user.type1=getConst(PBTypes,:GROUND)
user.type2=getConst(PBTypes,:STEEL)
user.effects[PBEffects::Type3]=-1
pbDisplay(_INTL("{1}'s type changed to normal!",user.pbThis,typename))
end
end
end
end
# Grassy Terrain
if @field.effects[PBEffects::GrassyTerrain]>0
for i in 0...4; user=@battlers[i]
if user.hasWorkingItem(:GRASSYSEED)
if user.pbIncreaseStatWithCause(PBStats::DEFENSE,1,user,PBItems.getName(user.item))
user.pbConsumeItem
end
end
if user.hasWorkingAbility(:MIMICRY) && !user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=true
user.type1=getConst(PBTypes,:GRASS)
user.type2=getConst(PBTypes,:GRASS)
user.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:GRASS))
pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typename))
end
end
@field.effects[PBEffects::GrassyTerrain]-=1
if @field.effects[PBEffects::GrassyTerrain]==0
pbDisplay(_INTL("The grass disappeared from the battlefield."))
PBDebug.log("[End of effect] Grassy Terrain ended")
for i in 0...4; user=@battlers[i]
if user.hasWorkingAbility(:MIMICRY) && user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=false
user.type1=getConst(PBTypes,:GROUND)
user.type2=getConst(PBTypes,:STEEL)
user.effects[PBEffects::Type3]=-1
pbDisplay(_INTL("{1}'s type changed to normal!",user.pbThis,typename))
end
end
end
end
# Misty Terrain
if @field.effects[PBEffects::MistyTerrain]>0
for i in 0...4; user=@battlers[i]
if user.hasWorkingItem(:MISTYSEED)
if user.pbIncreaseStatWithCause(PBStats::SPDEF,1,user,PBItems.getName(user.item))
user.pbConsumeItem
end
end
if user.hasWorkingAbility(:MIMICRY) && !user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=true
user.type1=getConst(PBTypes,:FAIRY)
user.type2=getConst(PBTypes,:FAIRY)
user.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:FAIRY))
pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typename))
end
end
@field.effects[PBEffects::MistyTerrain]-=1
if @field.effects[PBEffects::MistyTerrain]==0
pbDisplay(_INTL("The mist disappeared from the battlefield."))
PBDebug.log("[End of effect] Misty Terrain ended")
for i in 0...4; user=@battlers[i]
if user.hasWorkingAbility(:MIMICRY) && user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=false
user.type1=getConst(PBTypes,:GROUND)
user.type2=getConst(PBTypes,:STEEL)
user.effects[PBEffects::Type3]=-1
pbDisplay(_INTL("{1}'s type changed to normal!",user.pbThis,typename))
end
end
end
end
# Psychic Terrain
if @field.effects[PBEffects::PsychicTerrain]>0
for i in 0...4; user=@battlers[i]
if user.hasWorkingItem(:PSYCHICSEED)
if user.pbIncreaseStatWithCause(PBStats::SPDEF,1,user,PBItems.getName(user.item))
user.pbConsumeItem
end
end
if user.hasWorkingAbility(:MIMICRY) && !user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=true
user.type1=getConst(PBTypes,:PSYCHIC)
user.type2=getConst(PBTypes,:PSYCHIC)
user.effects[PBEffects::Type3]=-1
typename=PBTypes.getName(getConst(PBTypes,:PSYCHIC))
pbDisplay(_INTL("{1}'s type changed to {2}!",user.pbThis,typename))
end
end
@field.effects[PBEffects::PsychicTerrain]-=1
if @field.effects[PBEffects::PsychicTerrain]==0
pbDisplay(_INTL("The mist disappeared from the battlefield."))
PBDebug.log("[End of effect] Psychic Terrain ended")
for i in 0...4; user=@battlers[i]
if user.hasWorkingAbility(:MIMICRY) && user.effects[PBEffects::Mimicry]
user.effects[PBEffects::Mimicry]=false
user.type1=getConst(PBTypes,:GROUND)
user.type2=getConst(PBTypes,:STEEL)
user.effects[PBEffects::Type3]=-1
pbDisplay(_INTL("{1}'s type changed to normal!",user.pbThis,typename))
end
end
end
end
# Uproar
Rare candies can now evolve Pokémon if they're level 100.
For example, using a Rare candy on a level 100 Magikarp won't level it up but it will still cause it to evolve.
Has anyone made a script for this yet?
Rare candies can now evolve Pokémon if they're level 100.
For example, using a Rare candy on a level 100 Magikarp won't level it up but it will still cause it to evolve.
Has anyone made a script for this yet?
ItemHandlers::UseOnPokemon.add(:RARECANDY,proc{|item,pokemon,scene|
if pokemon.level==PBExperience::MAXLEVEL
for form in pbGetEvolvedFormData(pokemon.species)
newspecies=form[2]
end
return if !newspecies
if newspecies>0
evo=PokemonEvolutionScene.new
evo.pbStartScreen(pokemon,newspecies)
evo.pbEvolution
evo.pbEndScreen
end
# next true
# scene.pbDisplay(_INTL("It won't have any effect."))
# next false
else
pbChangeLevel(pokemon,pokemon.level+1,scene)
scene.pbHardRefresh
next true
end
})
def pbChangeTarget(thismove,userandtarget,targets)
[email protected]
changeeffect=0
user=userandtarget[0]
target=userandtarget[1]
# Snipe Shot/ Stalwart/ Propeller Tail
if !isConst?(thismove.id,PBMoves,:SNIPESHOT) &&
!user.hasWorkingAbility(:STALWART) && !user.hasWorkingAbility(:PROPELLERTAIL)
# Lightningrod
if targets.length==1 && isConst?(thismove.pbType(thismove.type,user,target),PBTypes,:ELECTRIC) &&
!target.hasWorkingAbility(:LIGHTNINGROD)
for i in priority # use Pokémon earliest in priority
next if user.index==i.index || target.index==i.index
if i.hasWorkingAbility(:LIGHTNINGROD)
PBDebug.log("[Ability triggered] #{i.pbThis}'s Lightningrod (change target)")
target=i # X's Lightningrod took the attack!
changeeffect=1
break
end
end
end
# Storm Drain
if targets.length==1 && isConst?(thismove.pbType(thismove.type,user,target),PBTypes,:WATER) &&
!target.hasWorkingAbility(:STORMDRAIN)
for i in priority # use Pokémon earliest in priority
next if user.index==i.index || target.index==i.index
if i.hasWorkingAbility(:STORMDRAIN)
PBDebug.log("[Ability triggered] #{i.pbThis}'s Storm Drain (change target)")
target=i # X's Storm Drain took the attack!
changeeffect=1
break
end
end
end
# Change target to user of Follow Me/Rage Powder (overrides Magic Coat
# because check for Magic Coat below uses this target)
if PBTargets.targetsOneOpponent?(thismove)
newtarget=nil; strength=100
for i in priority # use Pokémon latest in priority
next if !user.pbIsOpposing?(i.index)
if !i.fainted? && [email protected] && !target.switching && !i.effects[PBEffects::SkyDrop]
if i.effects[PBEffects::FollowMe]>0 && i.effects[PBEffects::FollowMe]<strength
PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Follow Me")
newtarget=i; strength=i.effects[PBEffects::FollowMe]; changeeffect=0
elsif i.effects[PBEffects::RagePowder]>0 && i.effects[PBEffects::RagePowder]<strength &&
!(user.hasWorkingItem(:SAFETYGOGGLES) || user.pbHasType?(:GRASS) || user.hasWorkingAbility(:OVERCOAT))
PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Rage Powder")
newtarget=i; strength=i.effects[PBEffects::RagePowder]; changeeffect=0
end
end
end
target=newtarget if newtarget
end
# Change target to target of Spotlight (overrides Magic Coat
# because check for Magic Coat below uses this target)
if PBTargets.targetsOneOpponent?(thismove)
newtarget=nil
for i in priority # use Pokémon latest in priority
next if !user.pbIsOpposing?(i.index)
if i.effects[PBEffects::Spotlight] && !i.fainted?
PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Spotlight")
newtarget=i
changeeffect=0
end
end
target=newtarget if newtarget
end
end
# Galarian Farfetch'd evo method
if target.damagestate.critical && isConst?(user.species,PBSpecies,:FARFETCHD) && user.form==1
user.pokemon.landCritical+=1 if user.pokemon
PBDebug.log("[Evolution method]#{user.pbThis} hits #{user.pokemon.landCritical} land critical(s).")
end
if target.fainted?
destinybond=destinybond || target.effects[PBEffects::DestinyBond]
end
user.pbFaint if user.fainted? # no return
break if user.fainted?
break if target.fainted?
# Make the target flinch
for i in @party1
next if !i
i.itemRecycle = 0
i.itemInitial = i.item
i.belch = false
i.landCritical=0
end
for i in @party2
next if !i
i.itemRecycle = 0
i.itemInitial = i.item
i.belch = false
i.landCritical=0
end
def pbRecallAndReplace(index,newpoke,newpokename=-1,batonpass=false,moldbreaker=false)
@battlers[index].pbResetForm
if !@battlers[index].fainted?
@scene.pbRecall(index)
@battlers[index].pokemon.landCritical=0
end
pbMessagesOnReplace(index,newpoke,newpokename)
pbReplace(index,newpoke,batonpass)
return pbOnActiveOne(@battlers[index],false,moldbreaker)
end
class PokemonTemp
attr_accessor :encounterType
attr_accessor :evolutionLevels
attr_accessor :evolutionLandCritical
end
Events.onStartBattle+=proc {|sender,e|
$PokemonTemp.evolutionLevels = []
$PokemonTemp.evolutionLandCritical = []
for i in 0...$Trainer.party.length
$PokemonTemp.evolutionLevels[i] = $Trainer.party[i].level
$PokemonTemp.evolutionLandCritical[i] = $Trainer.party[i].landCritical
end
}
Events.onEndBattle+=proc {|sender,e|
decision = e[0]
canlose = e[1]
if USENEWBATTLEMECHANICS || (decision!=2 && decision!=5) # not a loss or a draw
if $PokemonTemp.evolutionLevels
pbEvolutionCheck($PokemonTemp.evolutionLevels)
$PokemonTemp.evolutionLevels = nil
end
if $PokemonTemp.evolutionLandCritical
for i in 0...$PokemonTemp.evolutionLandCritical.length
poke = $Trainer.party[i]
next if poke.hp==0 && !USENEWBATTLEMECHANICS
next if !(isConst?(poke.species,PBSpecies,:FARFETCHD) && poke.form==1)
next if poke.landCritical<3
if poke && (!$PokemonTemp.evolutionLandCritical[i] || poke.landCritical!=$PokemonTemp.evolutionLandCritical[i])
newspecies = Kernel.pbCheckEvolution(poke)
if newspecies>0
evo = PokemonEvolutionScene.new
evo.pbStartScreen(poke,newspecies)
evo.pbEvolution
evo.pbEndScreen
end
end
end
$PokemonTemp.evolutionLandCritical = nil
end
end
if decision==1
for pkmn in $Trainer.pokemonParty
Kernel.pbPickup(pkmn)
if isConst?(pkmn.ability,PBAbilities,:HONEYGATHER) && !pkmn.hasItem?
if hasConst?(PBItems,:HONEY)
chance = 5+((pkmn.level-1)/10).floor*5
pkmn.setItem(:HONEY) if rand(100)<chance
end
end
end
end
if (decision==2 || decision==5) && !canlose
$game_system.bgm_unpause
$game_system.bgs_unpause
Kernel.pbStartOver
end
}
attr_reader(:hp) # Current HP
attr_writer(:pokerus) # Pokérus strain and infection time
attr_accessor(:item) # Held item
attr_accessor(:itemRecycle) # Consumed held item (used in battle only)
attr_accessor(:itemInitial) # Resulting held item (used in battle only)
attr_accessor(:belch) # Whether Pokémon can use Belch (used in battle only)
attr_accessor(:landCritical)# Galarian Farfetch'd evo method (used in battle only)
attr_accessor(:mail) # Mail
LevelDay = 26
LevelNight = 27
LevelDarkInParty = 28
LevelRain = 29
HappinessMoveType = 30
LandCritical = 31
"LevelDay","LevelNight","LevelDarkInParty","LevelRain","HappinessMoveType",
"LandCritical","Custom2","Custom3","Custom4","Custom5"
EVOPARAM=[0, # Unknown (do not use)
0,0,0,1,0, # Happiness, HappinessDay, HappinessNight, Level, Trade
2,2,1,1,1, # TradeItem, Item, AttackGreater, AtkDefEqual, DefenseGreater
1,1,1,1,1, # Silcoon, Cascoon, Ninjask, Shedinja, Beauty
2,2,2,2,3, # ItemMale, ItemFemale, DayHoldItem, NightHoldItem, HasMove
4,1,1,1,4, # HasInParty, LevelMale, LevelFemale, Location, TradeSpecies
1,1,1,1,5, # LevelDay, LevelNight, LevelDarkInParty, LevelRain, HappinessMoveType
0,0,0,0,0 # LandCritical, Custom 2-5
]
when PBEvolution::Trade, PBEvolution::TradeItem, PBEvolution::TradeSpecies
return -1
when PBEvolution::LandCritical
return poke if pokemon.landCritical>=level
#-------------------------------
[FARFETCHD-1]
FormName=Galarian Form
Type1=FIGHTING
BaseStats=52,95,55,55,58,62
Abilities=STEADFAST
HiddenAbility=SCRAPPY
Moves=1,PECK,1,SANDATTACK,5,LEER,10,FURYCUTTER,15,ROCKSMASH,20,BRUTALSWING,25,DETECT,30,KNOCKOFF,35,DEFOG,40,BRICKBREAK,45,SWORDSDANCE,50,SLAM,55,LEAFBLADE,60,FINALGAMBIT,65,BRAVEBIRD
StepsToHatch=5396
Weight=42.0
Pokedex=The stalks of leeks are thicker and longer in the Galar region. Farfetch'd that adapted to these stalks took on a unique form.
WildItemCommon=STICK
BattlerEnemyY=26
Evolutions=SIRFETCHD,LandCritical,3
#-------------------------------
if attacker.hasWorkingItem(:STICK) &&
(isConst?(attacker.species,PBSpecies,:FARFETCHD) ||
isConst?(attacker.species,PBSpecies,:SIRFETCHD))
c+=2
end
if attacker.hasWorkingItem(:LUCKYPUNCH) &&
def pbChangeLevel(pokemon,newlevel,scene)
newlevel=1 if newlevel<1
newlevel=PBExperience::MAXLEVEL if newlevel>PBExperience::MAXLEVEL
if pokemon.level>newlevel
attackdiff=pokemon.attack
defensediff=pokemon.defense
speeddiff=pokemon.speed
spatkdiff=pokemon.spatk
spdefdiff=pokemon.spdef
totalhpdiff=pokemon.totalhp
pokemon.level=newlevel
pokemon.calcStats
scene.pbRefresh
Kernel.pbMessage(_INTL("{1} was downgraded to Level {2}!",pokemon.name,pokemon.level))
attackdiff=pokemon.attack-attackdiff
defensediff=pokemon.defense-defensediff
speeddiff=pokemon.speed-speeddiff
spatkdiff=pokemon.spatk-spatkdiff
spdefdiff=pokemon.spdef-spdefdiff
totalhpdiff=pokemon.totalhp-totalhpdiff
pbTopRightWindow(_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
pbTopRightWindow(_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
elsif pokemon.level==newlevel
Kernel.pbMessage(_INTL("{1}'s level remained unchanged.",pokemon.name))
else
attackdiff=pokemon.attack
defensediff=pokemon.defense
speeddiff=pokemon.speed
spatkdiff=pokemon.spatk
spdefdiff=pokemon.spdef
totalhpdiff=pokemon.totalhp
oldlevel=pokemon.level
pokemon.level=newlevel
pokemon.changeHappiness("levelup")
pokemon.calcStats
scene.pbRefresh
Kernel.pbMessage(_INTL("\\se[Pkmn level up]{1} was elevated to Level {2}!",pokemon.name,pokemon.level))
attackdiff=pokemon.attack-attackdiff
defensediff=pokemon.defense-defensediff
speeddiff=pokemon.speed-speeddiff
spatkdiff=pokemon.spatk-spatkdiff
spdefdiff=pokemon.spdef-spdefdiff
totalhpdiff=pokemon.totalhp-totalhpdiff
pbTopRightWindow(_INTL("Max. HP<r>+{1}\r\nAttack<r>+{2}\r\nDefense<r>+{3}\r\nSp. Atk<r>+{4}\r\nSp. Def<r>+{5}\r\nSpeed<r>+{6}",
totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff))
pbTopRightWindow(_INTL("Max. HP<r>{1}\r\nAttack<r>{2}\r\nDefense<r>{3}\r\nSp. Atk<r>{4}\r\nSp. Def<r>{5}\r\nSpeed<r>{6}",
pokemon.totalhp,pokemon.attack,pokemon.defense,pokemon.spatk,pokemon.spdef,pokemon.speed))
movelist=pokemon.getMoveList
for i in movelist
if i[0]==pokemon.level # Learned a new move
pbLearnMove(pokemon,i[1],true)
end
end
return if (isConst?(pokemon.species,PBSpecies,:FARFETCHD) && pokemon.form==1) ||
(isConst?(pokemon.species,PBSpecies,:YAMASK) && pokemon.form==1) ||
isConst?(pokemon.species,PBSpecies,:MILCERY)
newspecies=pbCheckEvolution(pokemon)
if newspecies>0 &&
pbFadeOutInWithMusic(99999){
evo=PokemonEvolutionScene.new
evo.pbStartScreen(pokemon,newspecies)
evo.pbEvolution
evo.pbEndScreen
}
end
end
end