Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Dynamax/Gigantamax Script - By #Not Important
- #
- #===============================================================================
- # ~Installation~
- #===============================================================================
- # 1) To install, insert a new section below any other battle edits, and paste
- # this script there.
- #
- # 2) Next, you must add the following to your items PBS file:
- =begin
- XXX,DBAND,Dynamax Band,,1,99999,"A band that allows the holder/'s pokémon to use dynamax",0,0,15,
- These to moves.txt:
- 712,MAXFLARE,Max Flare,POL,110,FIRE,Physical,100,10,0,00,0,,"This is a Fire-type attack Dynamax Pokémon use. The user intensifies the sun for five turns."
- 713,MAXFLUTTERBY,Max Flutterby,LOP,110,BUG,Physical,100,10,0,00,0,,"This is a Bug-type attack Dynamax Pokémon use. This lowers the target's Sp. Atk stat."
- 714,MAXLIGHTNING,Max Lightning,OOO,110,ELECTRIC,Physical,100,10,0,00,0,,"This is an Electric-type attack Dynamax Pokémon use. The user turns the ground into Electric Terrain for five turns."
- 715,MAXSTRIKE,Max Strike,PPP,110,NORMAL,Physical,100,10,0,00,0,,"This is a Normal-type attack Dynamax Pokémon use. This lowers the target's Speed stat."
- 716,MAXKNUCKLE,Max Knuckle,WWW,110,FIGHTING,Physical,100,10,0,00,0,,"This is a Fighting-type attack Dynamax Pokémon use. This raises ally Pokémon's Attack stats."
- 717,MAXPHANTASM,Max Phantasm,RRR,110,GHOST,Physical,100,10,0,00,0,,"This is a Ghost-type attack Dynamax Pokémon use. This lowers the target's Defense stat."
- 718,MAXHAILSTORM,Max Hailstorm,SSS,110,ICE,Physical,100,10,0,00,0,,"This is an Ice-type attack Dynamax Pokémon use. The user summons a hailstorm lasting five turns."
- 719,MAXOOZE,Max Ooze,EEE,110,POISON,Physical,100,10,0,00,0,,"This is a Poison-type attack Dynamax Pokémon use. This raises ally Pokémon's Sp. Atk stats."
- 720,MAXGEYSER,Max Geyser,GGG,110,WATER,Physical,100,10,0,00,0,,"This is a Water-type attack Dynamax Pokémon use. The user summons a heavy rain that falls for five turns."
- 721,MAXAIRSTREAM,Max Airstream,UUU,110,FLYING,Physical,100,10,0,00,0,,"This is a Flying-type attack Dynamax Pokémon use. This raises ally Pokémon's Speed stats."
- 722,MAXSTARFALL,Max Starfall,ÑÑÑ,110,FAIRY,Physical,100,10,0,00,0,,"This is a Fairy-type attack Dynamax Pokémon use. The user turns the ground into Misty Terrain for five turns."
- 723,MAXWYRMWIND,Max Wyrmwind,999,110,DRAGON,Physical,100,10,0,00,0,,"This is a Dragon-type attack Dynamax Pokémon use. This lowers the target's Attack stat."
- 724,MAXMINDSTORM,Max Mindstorm,MMM,110,PSYCHIC,Physical,100,10,0,00,0,,"This is a Psychic-type attack Dynamax Pokémon use. The user turns the ground into Psychic Terrain for five turns."
- 725,MAXROCKFALL,Max Rockfall,XXX,110,ROCK,Physical,100,10,0,00,0,,"This is a Rock-type attack Dynamax Pokémon use. The user summons a sandstorm lasting five turns."
- 726,MAXQUAKE,Max Quake,ZZZ,110,GROUND,Physical,100,10,0,00,0,,"This is a Ground-type attack Dynamax Pokémon use. This raises ally Pokémon's Sp. Def stats."
- 727,MAXDARKNESS,Max Darkness,YYY,110,DARK,Physical,100,10,0,00,0,,"This is a Dark-type attack Dynamax Pokémon use. This lowers the target's Sp. Def stat."
- 728,MAXOVERGROWTH,Max Overgrowth,JJJ,110,GRASS,Physical,100,10,0,00,0,,"This is a Grass-type attack Dynamax Pokémon use. The user turns the ground into Grassy Terrain for five turns."
- 729,MAXSTEELSPIKE,Max Steelspike,LLL,110,STEEL,Physical,100,10,0,00,0,,"This is a Steel-type attack Dynamax Pokémon use. This raises ally Pokémon's Defense stats."
- 730,MAXGUARD,Max Guard,BBB,0,NORMAL,Status,100,10,0,00,0,,"This is a Status category attack Dynamax Pokémon use. Protect against all move, include other Dynamax moves."
- IF YOU WANT GMAXING:
- <add here>
- =end
- #
- # ^MAKE SURE TO ADJUST THE ITEM NUMBER TO MATCH YOUR GAME
- #
- # Everything below is written for Pokémon Essentials v.17.2
- #===============================================================================
- # V SETTINGS V
- ZPOWER=true #Compatiability for Ludicrous89's Zodiac powers script
- ZMOVES=false #Compatiability for the Z-move addon
- SPOWER=true #Compatiability for my spirit powers script
- DYNAMAXBANDS=[:DBAND] #The items that the player can have to trigger the
- #dynamax
- GMAX=true #Allow gigantamaxing
- NO_DYNAMAX=808 #The Switch for no dynamaxing
- MAPS=false #If you want certain maps to have dynamax and gmax only
- maps=[] #Add the map numbers that you want to have dynamax and gmax on
- #Use only if MAPS is set to true
- #------------------------#
- # #
- # Behold the script #
- # </> #
- #------------------------#
- #===============================================================================
- # Defines when a Pokemon has access to dynamax in battle.
- #===============================================================================
- module PBEffects
- Dynamax = 201
- end
- def hasMax?
- return canMax?
- end
- class PokeBattle_Battle
- attr_accessor(:dynamax)
- def canMax?
- for i in DYNAMAXBANDS
- next if !hasConst?(PBItems,i)
- return true if $PokemonBag.pbHasItem?(i)
- end
- end
- end
- class PokeBattle_Pokemon
- def canGmax?
- return false if @effects[PBEffects::Transform]
- if @pokemon && @pokemon.dynamaxlevel==10
- if isConst?(species,PBSpecies,:CHARIZARD) ||
- isConst?(species,PBSpecies,:BUTTERFREE) ||
- isConst?(species,PBSpecies,:PIKACHU) ||
- isConst?(species,PBSpecies,:MEOWTH) ||
- isConst?(species,PBSpecies,:MACHAMP) ||
- isConst?(species,PBSpecies,:GENGAR) ||
- isConst?(species,PBSpecies,:KINGLER) ||
- isConst?(species,PBSpecies,:LAPRAS) ||
- isConst?(species,PBSpecies,:EEVEE) ||
- isConst?(species,PBSpecies,:SNORLAX) ||
- isConst?(species,PBSpecies,:GARBODOR) ||
- isConst?(species,PBSpecies,:MELMETAL) ||
- isConst?(species,PBSpecies,:CORVIKNIGHT) ||
- isConst?(species,PBSpecies,:ORBEETLE) ||
- isConst?(species,PBSpecies,:DREDNAW) ||
- isConst?(species,PBSpecies,:COALOSSAL) ||
- isConst?(species,PBSpecies,:APPLETUN) ||
- isConst?(species,PBSpecies,:FLAPPLE) ||
- isConst?(species,PBSpecies,:SANDACONDA) ||
- isConst?(species,PBSpecies,:TOXTRICITY) ||
- isConst?(species,PBSpecies,:CENTISKORCH) ||
- isConst?(species,PBSpecies,:HATTERENE) ||
- isConst?(species,PBSpecies,:GRIMMSNARL) ||
- isConst?(species,PBSpecies,:ALCREMIE) ||
- isConst?(species,PBSpecies,:COPPERAJAH) ||
- isConst?(species,PBSpecies,:DURALUDON) ||
- isConst?(species,PBSpecies,:ETERNATUS) ||
- isConst?(species,PBSpecies,:CINDERACE) ||
- isConst?(species,PBSpecies,:RILLABOOM) ||
- isConst?(species,PBSpecies,:INTELEON)
- return true
- end
- end
- return false
- end
- def canGmaxNewPokemon?
- return false if @effects[PBEffects::Transform]
- if @pokemon
- if isConst?(species,PBSpecies,:CHARIZARD) ||
- isConst?(species,PBSpecies,:BUTTERFREE) ||
- isConst?(species,PBSpecies,:PIKACHU) ||
- isConst?(species,PBSpecies,:MEOWTH) ||
- isConst?(species,PBSpecies,:MACHAMP) ||
- isConst?(species,PBSpecies,:GENGAR) ||
- isConst?(species,PBSpecies,:KINGLER) ||
- isConst?(species,PBSpecies,:LAPRAS) ||
- isConst?(species,PBSpecies,:EEVEE) ||
- isConst?(species,PBSpecies,:SNORLAX) ||
- isConst?(species,PBSpecies,:GARBODOR) ||
- isConst?(species,PBSpecies,:MELMETAL) ||
- isConst?(species,PBSpecies,:CORVIKNIGHT) ||
- isConst?(species,PBSpecies,:ORBEETLE) ||
- isConst?(species,PBSpecies,:DREDNAW) ||
- isConst?(species,PBSpecies,:COALOSSAL) ||
- isConst?(species,PBSpecies,:APPLETUN) ||
- isConst?(species,PBSpecies,:FLAPPLE) ||
- isConst?(species,PBSpecies,:SANDACONDA) ||
- isConst?(species,PBSpecies,:TOXTRICITY) ||
- isConst?(species,PBSpecies,:CENTISKORCH) ||
- isConst?(species,PBSpecies,:HATTERENE) ||
- isConst?(species,PBSpecies,:GRIMMSNARL) ||
- isConst?(species,PBSpecies,:ALCREMIE) ||
- isConst?(species,PBSpecies,:COPPERAJAH) ||
- isConst?(species,PBSpecies,:DURALUDON) ||
- isConst?(species,PBSpecies,:ETERNATUS) ||
- isConst?(species,PBSpecies,:CINDERACE) ||
- isConst?(species,PBSpecies,:RILLABOOM) ||
- isConst?(species,PBSpecies,:INTELEON)
- return true
- end
- end
- return false
- end
- def pbGetGmaxForm
- if @pokemon
- if isConst?(species,PBSpecies,:CHARIZARD)
- return 3 #Mega Y, Mega X, Gmax
- elsif isConst?(species,PBSpecies,:BUTTERFREE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:PIKACHU)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:EEVEE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:MEOWTH)
- return 3 #Alolan, Galarian, Gmax
- elsif isConst?(species,PBSpecies,:MACHAMP)
- return 2 #Mega, Gmax
- elsif isConst?(species,PBSpecies,:GENGAR)
- return 2 #Mega, Gmax
- elsif isConst?(species,PBSpecies,:KINGLER)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:LAPRAS)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:SNORLAX)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:GARBODOR)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:MELMETAL)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:CORVIKNIGHT)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:ORBEETLE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:DREADNAW)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:COALOSSAL)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:APPLETUN)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:FLAPPLE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:SANDACONDA)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:TOXTRICITY)
- return 2 #Amped (0), Low-key (1), Gmax (2)
- elsif isConst?(species,PBSpecies,:CENTISCORCH)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:HATTERENE) # I DIDN'T EVEN KNOW THIS HAD A GMAX FORM
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:GRIMMSNARL)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:ALCREMIE)
- return 63 #ALL THE OTHER FORMS THAT NO-ONE BOTHERS WITH, Gmax
- elsif isConst?(species,PBSpecies,:COPPERAJAH)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:DURALDON)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:ETERNATUS)
- return 1 #Eternamax
- elsif isConst?(species,PBSpecies,:CINDERACE) ||
- isConst?(species,PBSpecies,:RILLABOOM) ||
- isConst?(species,PBSpecies,:INTELEON)
- return 1 #Gmax
- end
- end
- end
- def pbGetMaxMoves(user)
- imposter=user.isConst?(species,PBSpecies,:DITTO) && user.isConst?(ability,PBAbilities,:LIMBER)
- for i in 0...4
- next if user.moves[i].id==0 && imposter
- #################
- #Stores the moves
- user.oldmoves[i] = user.moves[i]
- ##################
- move = user.moves[i]
- if move.pbIsStatus?
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXGUARD)))
- elsif move.type == PBTypes::NORMAL
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXSTRIKE)))
- elsif move.type == PBTypes::FIGHTING
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXKNUCKLE)))
- elsif move.type == PBTypes::FLYING
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXAIRSTREAM)))
- elsif move.type == PBTypes::POISON
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXOOZE)))
- elsif move.type == PBTypes::GROUND
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXQUAKE)))
- elsif move.type == PBTypes::ROCK
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXROCKFALL)))
- elsif move.type == PBTypes::BUG
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXFLUTTERBY)))
- elsif move.type == PBTypes::GHOST
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXPHANTASM)))
- elsif move.type == PBTypes::STEEL
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXSTEELSPIKE)))
- elsif move.type == PBTypes::FIRE
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXFLARE)))
- elsif move.type == PBTypes::WATER
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXGEYSER)))
- elsif move.type == PBTypes::Grass
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXOVERGROWTH)))
- elsif move.type == PBTypes::ELECTRIC
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXLIGHTNING)))
- elsif move.type == PBTypes::PSYCHIC
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXMINDSTORM)))
- elsif move.type == PBTypes::ICE
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXHAILSTORM)))
- elsif move.type == PBTypes::DRAGON
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXWYRMWIND)))
- elsif move.type == PBTypes::DARK
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXDARKNESS)))
- elsif move.type == PBTypes::FAIRY
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXSTARFALL)))
- end
- if user.canGmax?
- if (user.isConst?(species,PBSpecies,:CHARIZARD)) && (move.type == PBTypes::FIRE)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXWILDFIRE)))
- end
- if (user.isConst?(species,PBSpecies,:BUTTERFREE)) && (move.type == PBTypes::BUG)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXBEFUDDLE)))
- end
- if (user.isConst?(species,PBSpecies,:PIKACHU)) && (move.type == PBTypes::ELECTRIC)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXVOLTCRASH)))
- end
- if (user.isConst?(species,PBSpecies,:MEOWTH)) && (move.type == PBTypes::NORMAL)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXGOLDRUSH)))
- end
- if (user.isConst?(species,PBSpecies,:MACHAMP)) && (move.type == PBTypes::FIGHTING)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXCHISTRIKE)))
- end
- if (user.isConst?(species,PBSpecies,:GENGAR)) && (move.type == PBTypes::GHOST)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXTERROR)))
- end
- if (user.isConst?(species,PBSpecies,:KINGLER)) && (move.type == PBTypes::WATER)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXFOAMBURST)))
- end
- if (user.isConst?(species,PBSpecies,:LAPRAS)) && (move.type == PBTypes::ICE)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXRESONANCE)))
- end
- if (user.isConst?(species,PBSpecies,:EEVEE)) && (move.type == PBTypes::NORMAL)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXCUDDLE)))
- end
- if (user.isConst?(species,PBSpecies,:SNORLAX)) && (move.type == PBTypes::NORMAL)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXREPLENISH)))
- end
- if (user.isConst?(species,PBSpecies,:GARBODOR)) && (move.type == PBTypes::POISON)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXMALODOR)))
- end
- if (user.isConst?(species,PBSpecies,:MELMETAL)) && (move.type == PBTypes::STEEL)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXMELMETAL)))
- end
- if (user.isConst?(species,PBSpecies,:CINDERACE)) && (move.type == PBTypes::FIRE)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXFIREBALL)))
- end
- if (user.isConst?(species,PBSpecies,:RILLABOOM)) && (move.type == PBTypes::GRASS)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXDRUMSOLO)))
- end
- if (user.isConst?(species,PBSpecies,:INTELEON)) && (move.type == PBTypes::WATER)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXHYDROSNIPE)))
- end
- if (user.isConst?(species,PBSpecies,:CORVINIGHT)) && (move.type == PBTypes::FLYING)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXWINDRAGE)))
- end
- if (user.isConst?(species,PBSpecies,:ORBEETLE)) && (move.type == PBTypes::PSYCHIC)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXCHISTRIKE)))
- end
- if (user.isConst?(species,PBSpecies,:DREADNAW)) && (move.type == PBTypes::WATER)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXSTONESURGE)))
- end
- if (user.isConst?(species,PBSpecies,:COALOSSAL)) && (move.type == PBTypes::ROCK)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXVOLCALITH)))
- end
- if (user.isConst?(species,PBSpecies,:FLAPPLE)) && (move.type == PBTypes::GRASS)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXTARTNESS)))
- end
- if (user.isConst?(species,PBSpecies,:APPLETUN)) && (move.type == PBTypes::GRASS)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXSWEETNESS)))
- end
- if (user.isConst?(species,PBSpecies,:SANDACONDA)) && (move.type == PBTypes::GROUND)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXSANDBLAST)))
- end
- if (user.isConst?(species,PBSpecies,:TOXTRICITY)) && (move.type == PBTypes::ELECTRIC)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXSTUNSHOCK)))
- end
- if (user.isConst?(species,PBSpecies,:CENTISCORCH)) && (move.type == PBTypes::FIRE)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXCENTIFERNO)))
- end
- if (user.isConst?(species,PBSpecies,:HATTERENE)) && (move.type == PBTypes::FAIRY)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXSMITE)))
- end
- if (user.isConst?(species,PBSpecies,:GRIMMSNARL)) && (move.type == PBTypes::DARK)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXSNOOZE)))
- end
- if (user.isConst?(species,PBSpecies,:ALCREMIE)) && (move.type == PBTypes::FAIRY)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXFINALE)))
- end
- if (user.isConst?(species,PBSpecies,:COPPERAJAH)) && (move.type == PBTypes::STEEL)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXSTEELSURGE)))
- end
- if (user.isConst?(species,PBSpecies,:DURALUDON)) && (move.type == PBTypes::DRAGON)
- move=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:GMAXDEPLETION)))
- end
- end
- end
- end
- def pbRestoreMoves(user)
- for i in 0...4
- user.moves[i] = user.oldmoves1 if i==1 && user.oldmoves1
- user.moves[i] = user.oldmoves2 if i==2 && user.oldmoves2
- user.moves[i] = user.oldmoves3 if i==3 && user.oldmoves3
- user.moves[i] = user.oldmoves4 if i==4 && user.oldmoves4
- end
- end
- def pbUnMaxMoves
- for i in 0...4
- if @pokemon
- @moves[i] = @oldmoves[i]
- end
- end
- end
- end
- class PokeBattle_Battle
- def hasMax?
- if MAPS
- if @pokemon && ($game_map && maps.include?($game_map.map_id)) &&
- !(self.isConst?(species,PBSpecies,:ZACIAN) ||
- self.isConst?(species,PBSpecies,:ZAMAZENTA) ||
- self.isConst?(species,PBSpecies,:ETERNATUS))
- return (canMax? rescue false)
- end
- else
- if @pokemon &&
- !(self.isConst?(species,PBSpecies,:ZACIAN) ||
- self.isConst?(species,PBSpecies,:ZAMAZENTA) ||
- self.isConst?(species,PBSpecies,:ETERNATUS))
- return (canMax? rescue false)
- end
- end
- end
- end
- class PokeBattle_Pokemon
- attr_accessor(:dynamaxlevel)
- attr_accessor(:oldmoves1)
- attr_accessor(:oldmoves2)
- attr_accessor(:oldmoves3)
- attr_accessor(:oldmoves4)
- end
- class PokeBattle_Battler
- attr_accessor(:dynamaxlevel)
- attr_accessor(:oldmoves1)
- attr_accessor(:oldmoves2)
- attr_accessor(:oldmoves3)
- attr_accessor(:oldmoves4)
- def pbRestoreMoves(user)
- for i in 0...4
- user.moves[i] = user.oldmoves1 if i==1 && user.oldmoves1
- user.moves[i] = user.oldmoves2 if i==2 && user.oldmoves2
- user.moves[i] = user.oldmoves3 if i==3 && user.oldmoves3
- user.moves[i] = user.oldmoves4 if i==4 && user.oldmoves4
- end
- end
- def canGmax?
- return false if @effects[PBEffects::Transform]
- if @pokemon && @pokemon.dynamaxlevel==10
- if isConst?(species,PBSpecies,:CHARIZARD) ||
- isConst?(species,PBSpecies,:BUTTERFREE) ||
- isConst?(species,PBSpecies,:PIKACHU) ||
- isConst?(species,PBSpecies,:MEOWTH) ||
- isConst?(species,PBSpecies,:MACHAMP) ||
- isConst?(species,PBSpecies,:GENGAR) ||
- isConst?(species,PBSpecies,:KINGLER) ||
- isConst?(species,PBSpecies,:LAPRAS) ||
- isConst?(species,PBSpecies,:EEVEE) ||
- isConst?(species,PBSpecies,:SNORLAX) ||
- isConst?(species,PBSpecies,:GARBODOR) ||
- isConst?(species,PBSpecies,:MELMETAL) ||
- isConst?(species,PBSpecies,:CORVIKNIGHT) ||
- isConst?(species,PBSpecies,:ORBEETLE) ||
- isConst?(species,PBSpecies,:DREDNAW) ||
- isConst?(species,PBSpecies,:COALOSSAL) ||
- isConst?(species,PBSpecies,:APPLETUN) ||
- isConst?(species,PBSpecies,:FLAPPLE) ||
- isConst?(species,PBSpecies,:SANDACONDA) ||
- isConst?(species,PBSpecies,:TOXTRICITY) ||
- isConst?(species,PBSpecies,:CENTISKORCH) ||
- isConst?(species,PBSpecies,:HATTERENE) ||
- isConst?(species,PBSpecies,:GRIMMSNARL) ||
- isConst?(species,PBSpecies,:ALCREMIE) ||
- isConst?(species,PBSpecies,:COPPERAJAH) ||
- isConst?(species,PBSpecies,:DURALUDON) ||
- isConst?(species,PBSpecies,:ETERNATUS) ||
- isConst?(species,PBSpecies,:CINDERACE) ||
- isConst?(species,PBSpecies,:RILLABOOM) ||
- isConst?(species,PBSpecies,:INTELEON)
- return true
- end
- end
- return false
- end
- def canGmaxNewPokemon?
- return false if @effects[PBEffects::Transform]
- if @pokemon
- if isConst?(species,PBSpecies,:CHARIZARD) ||
- isConst?(species,PBSpecies,:BUTTERFREE) ||
- isConst?(species,PBSpecies,:PIKACHU) ||
- isConst?(species,PBSpecies,:MEOWTH) ||
- isConst?(species,PBSpecies,:MACHAMP) ||
- isConst?(species,PBSpecies,:GENGAR) ||
- isConst?(species,PBSpecies,:KINGLER) ||
- isConst?(species,PBSpecies,:LAPRAS) ||
- isConst?(species,PBSpecies,:EEVEE) ||
- isConst?(species,PBSpecies,:SNORLAX) ||
- isConst?(species,PBSpecies,:GARBODOR) ||
- isConst?(species,PBSpecies,:MELMETAL) ||
- isConst?(species,PBSpecies,:CORVIKNIGHT) ||
- isConst?(species,PBSpecies,:ORBEETLE) ||
- isConst?(species,PBSpecies,:DREDNAW) ||
- isConst?(species,PBSpecies,:COALOSSAL) ||
- isConst?(species,PBSpecies,:APPLETUN) ||
- isConst?(species,PBSpecies,:FLAPPLE) ||
- isConst?(species,PBSpecies,:SANDACONDA) ||
- isConst?(species,PBSpecies,:TOXTRICITY) ||
- isConst?(species,PBSpecies,:CENTISKORCH) ||
- isConst?(species,PBSpecies,:HATTERENE) ||
- isConst?(species,PBSpecies,:GRIMMSNARL) ||
- isConst?(species,PBSpecies,:ALCREMIE) ||
- isConst?(species,PBSpecies,:COPPERAJAH) ||
- isConst?(species,PBSpecies,:DURALUDON) ||
- isConst?(species,PBSpecies,:ETERNATUS) ||
- isConst?(species,PBSpecies,:CINDERACE) ||
- isConst?(species,PBSpecies,:RILLABOOM) ||
- isConst?(species,PBSpecies,:INTELEON)
- return true
- end
- end
- return false
- end
- def pbGetGmaxForm
- if @pokemon
- if isConst?(species,PBSpecies,:CHARIZARD)
- return 3 #Mega Y, Mega X, Gmax
- elsif isConst?(species,PBSpecies,:BUTTERFREE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:PIKACHU)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:EEVEE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:MEOWTH)
- return 3 #Alolan, Galarian, Gmax
- elsif isConst?(species,PBSpecies,:MACHAMP)
- return 2 #Mega, Gmax
- elsif isConst?(species,PBSpecies,:GENGAR)
- return 2 #Mega, Gmax
- elsif isConst?(species,PBSpecies,:KINGLER)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:LAPRAS)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:SNORLAX)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:GARBODOR)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:MELMETAL)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:CORVIKNIGHT)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:ORBEETLE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:DREADNAW)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:COALOSSAL)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:APPLETUN)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:FLAPPLE)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:SANDACONDA)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:TOXTRICITY)
- return 2 #Amped (0), Low-key (1), Gmax (2)
- elsif isConst?(species,PBSpecies,:CENTISCORCH)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:HATTERENE) # I DIDN'T EVEN KNOW THIS HAD A GMAX FORM
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:GRIMMSNARL)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:ALCREMIE)
- return 63 #ALL THE OTHER FORMS THAT NO-ONE BOTHERS WITH, Gmax
- elsif isConst?(species,PBSpecies,:COPPERAJAH)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:DURALDON)
- return 1 #Gmax
- elsif isConst?(species,PBSpecies,:ETERNATUS)
- return 1 #Eternamax
- elsif isConst?(species,PBSpecies,:CINDERACE) ||
- isConst?(species,PBSpecies,:RILLABOOM) ||
- isConst?(species,PBSpecies,:INTELEON)
- return 1 #Gmax
- end
- end
- end
- end
- class PokeBattle_BattleEffects
- def pbFlinch(attacker=nil)
- return false if @effects[PBEffects::Dynamax]>0
- return false if (!attacker || !attacker.hasMoldBreaker) && hasWorkingAbility(:INNERFOCUS)
- @effects[PBEffects::Flinch]=true
- return true
- end
- end
- #===============================================================================
- # Rewrites the PokeBattle_Battle script.
- #===============================================================================
- class PokeBattle_Battle
- attr_reader(:player) # Player trainer
- attr_reader(:opponent) # Opponent trainer
- attr_accessor(:dynamaxButton) # Dmax Button
- def initialize(scene,p1,p2,player,opponent)
- if p1.length==0
- raise ArgumentError.new(_INTL("Party 1 has no Pokémon."))
- return
- end
- if p2.length==0
- raise ArgumentError.new(_INTL("Party 2 has no Pokémon."))
- return
- end
- if p2.length>2 && !opponent
- raise ArgumentError.new(_INTL("Wild battles with more than two Pokémon are not allowed."))
- return
- end
- @scene = scene
- @decision = 0
- @internalbattle = true
- @doublebattle = false
- @cantescape = false
- @shiftStyle = true
- @battlescene = true
- @debug = false
- @debugupdate = 0
- if opponent && player.is_a?(Array) && player.length==0
- player = player[0]
- end
- if opponent && opponent.is_a?(Array) && opponent.length==0
- opponent = opponent[0]
- end
- @player = player # PokeBattle_Trainer object
- @opponent = opponent # PokeBattle_Trainer object
- @party1 = p1
- @party2 = p2
- @party1order = []
- for i in 0...12; @party1order.push(i); end
- @party2order = []
- for i in 0...12; @party2order.push(i); end
- @fullparty1 = false
- @fullparty2 = false
- @battlers = []
- @items = nil
- @sides = [PokeBattle_ActiveSide.new, # Player's side
- PokeBattle_ActiveSide.new] # Foe's side
- @field = PokeBattle_ActiveField.new # Whole field (gravity/rooms)
- @environment = PBEnvironment::None # e.g. Tall grass, cave, still water
- @weather = 0
- @weatherduration = 0
- @switching = false
- @futuresight = false
- @choices = [ [0,0,nil,-1],[0,0,nil,-1],[0,0,nil,-1],[0,0,nil,-1] ]
- @successStates = []
- for i in 0...4
- @successStates.push(PokeBattle_SuccessState.new)
- end
- @lastMoveUsed = -1
- @lastMoveUser = -1
- @nextPickupUse = 0
- @megaEvolution = []
- if @player.is_a?(Array)
- @megaEvolution[0]=[-1]*@player.length
- else
- @megaEvolution[0]=[-1]
- end
- if @opponent.is_a?(Array)
- @megaEvolution[1]=[-1]*@opponent.length
- else
- @megaEvolution[1]=[-1]
- end
- #===========================================================================
- # Zodiac Powers
- if ZPOWER
- @zodiacPower = []
- if @player.is_a?(Array)
- @zodiacPower[0]=[-1]*@player.length
- else
- @zodiacPower[0]=[-1]
- end
- if @opponent.is_a?(Array)
- @zodiacPower[1]=[-1]*@opponent.length
- else
- @zodiacPower[1]=[-1]
- end
- end
- #===========================================================================
- # Z-Moves
- if ZMOVES
- @zMove = []
- if @player.is_a?(Array)
- @zMove[0]=[-1]*@player.length
- else
- @zMove[0]=[-1]
- end
- if @opponent.is_a?(Array)
- @zMove[1]=[-1]*@opponent.length
- else
- @zMove[1]=[-1]
- end
- end
- #===========================================================================
- # Spirit Power
- if SPOWER
- @spiritPower = []
- if @player.is_a?(Array)
- @spiritPower[0]=[-1]*@player.length
- else
- @spiritPower[0]=[-1]
- end
- if @opponent.is_a?(Array)
- @spiritPower[1]=[-1]*@opponent.length
- else
- @spiritPower[1]=[-1]
- end
- end
- #===========================================================================
- @dynamax = []
- if @player.is_a?(Array)
- @dynamax[0]=[-1]*@player.length
- else
- @dynamax[0]=[-1]
- end
- if @opponent.is_a?(Array)
- @dynamax[1]=[-1]*@opponent.length
- else
- @dynamax[1]=[-1]
- end
- @amuletcoin = false
- @extramoney = 0
- @doublemoney = false
- @endspeech = ""
- @endspeech2 = ""
- @endspeechwin = ""
- @endspeechwin2 = ""
- @rules = {}
- @turncount = 0
- @peer = PokeBattle_BattlePeer.create()
- @priority = []
- @usepriority = false
- @snaggedpokemon = []
- @runCommand = 0
- if hasConst?(PBMoves,:STRUGGLE)
- @struggle = PokeBattle_Move.pbFromPBMove(self,PBMove.new(getConst(PBMoves,:STRUGGLE)))
- else
- @struggle = PokeBattle_Struggle.new(self,nil)
- end
- @struggle.pp = -1
- for i in 0...4
- battlers[i] = PokeBattle_Battler.new(self,i)
- end
- for i in @party1
- next if !i
- i.itemRecycle = 0
- i.itemInitial = i.item
- i.belch = false
- end
- for i in @party2
- next if !i
- i.itemRecycle = 0
- i.itemInitial = i.item
- i.belch = false
- end
- end
- #===============================================================================
- # Dynamax/Gmax a battler
- #===============================================================================
- def pbDynamax(index)
- user=@battlers[index]
- level = user.dynamaxlevel
- user.totalhp = (user.totalhp*2) # HP boost
- user.hp = (user.hp*2) # HP boost
- pbGetMaxMoves(user)
- user.effects[PBEffects::Dynamax]=3
- if user.canGmax? && GMAX
- user.form = user.pbGetGmaxForm
- end
- end
- def pbUndynamax(index)
- user=@battlers[index]
- user.hp = (user.hp)/2
- user.totalhp = (user.totalhp)/2
- user.pbUnMaxMoves
- if user.canGmax?
- user.form = 0
- end
- end
- def pbUndynamaxForFaint
- @hp = (@hp)/2
- @totalhp = (@totalhp)/2
- pbUnMaxMoves
- if canGmax? && GMAX
- @form = 0
- end
- end
- def isMaxed?
- if @pokemon
- return true if @pokemon.effects[PBEffects::Dynamax]>0
- return false
- end
- end
- def pbFaint(showMessage=true)
- unless fainted?
- PBDebug.log("!!!***Can't faint with HP greater than 0")
- return true
- end
- if @fainted
- PBDebug.log("!!!***Can't faint if already fainted")
- return true
- end
- @battle.scene.pbFainted(self)
- pbInitEffects(false)
- # Reset status
- self.status=0
- self.statusCount=0
- if @pokemon && @battle.internalbattle
- @pokemon.changeHappiness("faint")
- end
- @pokemon.makeUnmega if self.isMega?
- @pokemon.makeUnprimal if self.isPrimal?
- @pokemon.pbUndynamaxForFaint if self.isMaxed?
- @fainted=true
- # reset choice
- @battle.choices[@index]=[0,0,nil,-1]
- pbOwnSide.effects[PBEffects::LastRoundFainted]=@battle.turncount
- @battle.pbDisplayPaused(_INTL("{1} fainted!",pbThis)) if showMessage
- PBDebug.log("[Pokémon fainted] #{pbThis}")
- return true
- end
- #===============================================================================
- # More rewrites of PokeBattle_Battle.
- #===============================================================================
- def pbRegisterSwitch(idxPokemon,idxOther)
- return false if !pbCanSwitch?(idxPokemon,idxOther,false)
- @choices[idxPokemon][0]=2 # "Switch Pokémon"
- @choices[idxPokemon][1]=idxOther # Index of other Pokémon to switch with
- @choices[idxPokemon][2]=nil
- side=(pbIsOpposing?(idxPokemon)) ? 1 : 0
- owner=pbGetOwnerIndex(idxPokemon)
- if @megaEvolution[side][owner]==idxPokemon
- @megaEvolution[side][owner]=-1
- end
- #==============================================
- # Zodiac Powers
- if ZPOWER
- if @zodiacPower[side][owner]==idxPokemon
- @zodiacPower[side][owner]=-1
- end
- end
- #==============================================
- # Z-Moves
- if ZMOVES
- if @zMove[side][owner]==idxPokemon
- @zMove[side][owner]=-1
- end
- end
- #==============================================
- if SPOWER
- if @spiritPower[side][owner]==idxPokemon
- @spiritPower[side][owner]=-1
- end
- end
- #==============================================
- if @dynamax[side][owner]==idxPokemon
- @dynamax[side][owner]=-1
- end
- return true
- end
- def pbRegisterItem(idxPokemon,idxItem,idxTarget=nil)
- if idxTarget!=nil && idxTarget>=0
- for i in 0...4
- if !@battlers[i].pbIsOpposing?(idxPokemon) &&
- @battlers[i].pokemonIndex==idxTarget &&
- @battlers[i].effects[PBEffects::Embargo]>0
- pbDisplay(_INTL("Embargo's effect prevents the item's use on {1}!",@battlers[i].pbThis(true)))
- if pbBelongsToPlayer?(@battlers[i].index)
- if $PokemonBag.pbCanStore?(idxItem)
- $PokemonBag.pbStoreItem(idxItem)
- else
- raise _INTL("Couldn't return unused item to Bag somehow.")
- end
- end
- return false
- end
- end
- end
- if ItemHandlers.hasUseInBattle(idxItem)
- if idxPokemon==0 # Player's first Pokémon
- if ItemHandlers.triggerBattleUseOnBattler(idxItem,@battlers[idxPokemon],self)
- # Using Poké Balls or Poké Doll only
- ItemHandlers.triggerUseInBattle(idxItem,@battlers[idxPokemon],self)
- if @doublebattle
- @battlers[idxPokemon].pbPartner.effects[PBEffects::SkipTurn]=true
- end
- else
- if $PokemonBag.pbCanStore?(idxItem)
- $PokemonBag.pbStoreItem(idxItem)
- else
- raise _INTL("Couldn't return unusable item to Bag somehow.")
- end
- return false
- end
- else
- if ItemHandlers.triggerBattleUseOnBattler(idxItem,@battlers[idxPokemon],self)
- pbDisplay(_INTL("It's impossible to aim without being focused!"))
- end
- return false
- end
- end
- @choices[idxPokemon][0]=3 # "Use an item"
- @choices[idxPokemon][1]=idxItem # ID of item to be used
- @choices[idxPokemon][2]=idxTarget # Index of Pokémon to use item on
- side=(pbIsOpposing?(idxPokemon)) ? 1 : 0
- owner=pbGetOwnerIndex(idxPokemon)
- if @megaEvolution[side][owner]==idxPokemon
- @megaEvolution[side][owner]=-1
- end
- #==============================================
- # Zodiac Powers
- if ZPOWER
- if @zodiacPower[side][owner]==idxPokemon
- @zodiacPower[side][owner]=-1
- end
- end
- #==============================================
- # Z-Moves
- if ZMOVES
- if @zMove[side][owner]==idxPokemon
- @zMove[side][owner]=-1
- end
- end
- #==============================================
- if SPOWER
- if @spiritPower[side][owner]==idxPokemon
- @spiritPower[side][owner]=-1
- end
- end
- #==============================================
- if @dynamax[side][owner]==idxPokemon
- @dynamax[side][owner]=-1
- end
- return true
- end
- #===============================================================================
- # Using Dynamax in battle.
- #===============================================================================
- def pbCanUseDynamax?(index)
- return false if pbIsOpposing?(index) && !@opponent
- return true if $DEBUG && Input.press?(Input::CTRL)
- return false if !canMax?
- side=(pbIsOpposing?(index)) ? 1 : 0
- owner=pbGetOwnerIndex(index)
- return false if @dynamax[side][owner]!=-1
- return false if @battlers[index].effects[PBEffects::SkyDrop]
- return false if @battlers[index].effects[PBEffects::Transform]
- return true if canMax?
- return true
- end
- def pbRegisterDynamax(index)
- side=(pbIsOpposing?(index)) ? 1 : 0
- owner=pbGetOwnerIndex(index)
- @dynamax[side][owner]=index
- end
- def pbUseDynamax(index)
- return if !@battlers[index] || !@battlers[index].pokemon
- return if !(@battlers[index].canMax? rescue false)
- pbDynamax(index)
- side=(pbIsOpposing?(index)) ? 1 : 0
- owner=pbGetOwnerIndex(index)
- @dynamax[side][owner]=-2
- end
- #===============================================================================
- # Rewrites to PokeBattle_AI
- # Allows opposing Pokemon to use Zodiac Powers & Spirit powers
- #===============================================================================
- def pbEnemyShouldDynamax?(index)
- return pbCanUseDynamax?(index)
- end
- def pbDefaultChooseEnemyCommand(index)
- if !pbCanShowFightMenu?(index)
- return if pbEnemyShouldUseItem?(index)
- return if pbEnemyShouldWithdraw?(index)
- pbAutoChooseMove(index)
- return
- else
- return if pbEnemyShouldUseItem?(index)
- return if pbEnemyShouldWithdraw?(index)
- return if pbAutoFightMenu(index)
- pbRegisterMegaEvolution(index) if pbEnemyShouldMegaEvolve?(index)
- #=========================================================================
- # Zodiac Powers
- if ZPOWER
- pbRegisterZodiacPower(index) if pbEnemyShouldUseZodiac?(index)
- end
- #=========================================================================
- # Z-Moves
- if ZMOVES
- if pbEnemyShouldZMove?(index)
- return pbChooseEnemyZMove(index)
- end
- end
- #=========================================================================
- if SPOWER
- pbRegisterSpiritPower(index) if pbEnemyShouldUsePower?(index)
- end
- #=========================================================================
- pbRegisterDynamax(index) if pbEnemyShouldDynamax?(index)
- pbChooseMoves(index)
- end
- end
- end
- #===============================================================================
- # More rewrites to PokeBattle_Battle.
- #===============================================================================
- class PokeBattle_Battle
- def pbCommandPhase
- @scene.pbBeginCommandPhase
- # @scene.pbResetCommandIndices
- for i in 0...4 # Reset choices if commands can be shown
- @battlers[i].effects[PBEffects::SkipTurn]=false
- if pbCanShowCommands?(i) || @battlers[i].fainted?
- @choices[i][0]=0
- @choices[i][1]=0
- @choices[i][2]=nil
- @choices[i][3]=-1
- else
- unless !@doublebattle && pbIsDoubleBattler?(i)
- PBDebug.log("[Reusing commands] #{@battlers[i].pbThis(true)}")
- end
- end
- end
- # Reset choices to perform Mega Evolution if it wasn't done somehow
- for i in 0...2
- for j in 0...@megaEvolution[i].length
- @megaEvolution[i][j]=-1 if @megaEvolution[i][j]>=0
- end
- end
- #=======================================================
- # Zodiac Powers
- if ZPOWER
- for i in 0...2
- for j in 0...@zodiacPower[i].length
- @zodiacPower[i][j]=-1 if @zodiacPower[i][j]>=0
- end
- end
- end
- #=======================================================
- # Z-Moves
- if ZMOVES
- for i in 0...@zMove[0].length
- @zMove[0][i]=-1 if @zMove[0][i]>=0
- end
- for i in 0...@zMove[1].length
- @zMove[1][i]=-1 if @zMove[1][i]>=0
- end
- end
- #=======================================================
- if SPOWER
- for i in 0...2
- for j in 0...@spiritPower[i].length
- @spiritPower[i][j]=-1 if @spiritPower[i][j]>=0
- end
- end
- end
- #=======================================================
- for i in 0...2
- for j in 0...@dynamax[i].length
- @dynamax[i][j]=-1 if @dynamax[i][j]>=0
- end
- end
- for i in 0...4
- break if @decision!=0
- next if @choices[i][0]!=0
- if !pbOwnedByPlayer?(i) || @controlPlayer
- if !@battlers[i].fainted? && pbCanShowCommands?(i)
- @scene.pbChooseEnemyCommand(i)
- end
- else
- commandDone=false
- commandEnd=false
- if pbCanShowCommands?(i)
- loop do
- cmd=pbCommandMenu(i)
- if cmd==0 # Fight
- if pbCanShowFightMenu?(i)
- commandDone=true if pbAutoFightMenu(i)
- until commandDone
- index=@scene.pbFightMenu(i)
- if index<0
- side=(pbIsOpposing?(i)) ? 1 : 0
- owner=pbGetOwnerIndex(i)
- if @megaEvolution[side][owner]==i
- @megaEvolution[side][owner]=-1
- end
- #===================================
- # Zodiac Powers
- if ZPOWER
- if @zodiacPower[side][owner]==i
- @zodiacPower[side][owner]=-1
- end
- end
- #===================================
- # Z-Moves
- if ZMOVES
- if @zMove[side][owner]==i
- @zMove[side][owner]=-1
- end
- end
- #===================================
- if SPOWER
- if @spiritPower[side][owner]==i
- @spiritPower[side][owner]=-1
- end
- end
- if @dynamax[side][owner]==i
- @dynamax[side][owner]=-1
- end
- break
- end
- next if !pbRegisterMove(i,index)
- if @doublebattle
- thismove=@battlers[i].moves[index]
- target=@battlers[i].pbTarget(thismove)
- if target==PBTargets::SingleNonUser # single non-user
- target=@scene.pbChooseTarget(i,target)
- next if target<0
- pbRegisterTarget(i,target)
- elsif target==PBTargets::UserOrPartner # Acupressure
- target=@scene.pbChooseTarget(i,target)
- next if target<0 || (target&1)==1
- pbRegisterTarget(i,target)
- end
- end
- commandDone=true
- end
- else
- pbAutoChooseMove(i)
- commandDone=true
- end
- elsif cmd!=0 && @battlers[i].effects[PBEffects::SkyDrop]
- pbDisplay(_INTL("Sky Drop won't let {1} go!",@battlers[i].pbThis(true)))
- elsif cmd==1 # Bag
- if !@internalbattle
- if pbOwnedByPlayer?(i)
- pbDisplay(_INTL("Items can't be used here."))
- end
- else
- item=pbItemMenu(i)
- if item[0]>0
- if pbRegisterItem(i,item[0],item[1])
- commandDone=true
- end
- end
- end
- elsif cmd==2 # Pokémon
- pkmn=pbSwitchPlayer(i,false,true)
- if pkmn>=0
- commandDone=true if pbRegisterSwitch(i,pkmn)
- end
- elsif cmd==3 # Run
- run=pbRun(i)
- if run>0
- commandDone=true
- return
- elsif run<0
- commandDone=true
- side=(pbIsOpposing?(i)) ? 1 : 0
- owner=pbGetOwnerIndex(i)
- if @megaEvolution[side][owner]==i
- @megaEvolution[side][owner]=-1
- end
- #===================================
- # Zodiac Powers
- if ZPOWER
- if @zodiacPower[side][owner]==i
- @zodiacPower[side][owner]=-1
- end
- end
- #===================================
- # Z-Moves
- if ZMOVES
- if @zMove[side][owner]==i
- @zMove[side][owner]=-1
- end
- end
- #===================================
- if SPOWER
- if @spiritPower[side][owner]==i
- @spiritPower[side][owner]=-1
- end
- end
- if @dynamax[side][owner]==i
- @dynamax[side][owner]=-1
- end
- end
- elsif cmd==4 # Call
- thispkmn=@battlers[i]
- @choices[i][0]=4 # "Call Pokémon"
- @choices[i][1]=0
- @choices[i][2]=nil
- side=(pbIsOpposing?(i)) ? 1 : 0
- owner=pbGetOwnerIndex(i)
- if @megaEvolution[side][owner]==i
- @megaEvolution[side][owner]=-1
- end
- #===================================
- # Zodiac Powers
- if INCLUDE_ZPOWER
- if @zodiacPower[side][owner]==i
- @zodiacPower[side][owner]=-1
- end
- end
- #===================================
- # Z-Moves
- if INCLUDE_ZMOVES
- if @zMove[side][owner]==i
- @zMove[side][owner]=-1
- end
- end
- #===================================
- if SPOWER
- if @spiritPower[side][owner]==i
- @spiritPower[side][owner]=-1
- end
- end
- if @dynamax[side][owner]==i
- @dynamax[side][owner]=-1
- end
- commandDone=true
- elsif cmd==-1 # Go back to first battler's choice
- @megaEvolution[0][0]=-1 if @megaEvolution[0][0]>=0
- @megaEvolution[1][0]=-1 if @megaEvolution[1][0]>=0
- #======================================================
- # Zodiac Powers
- if ZPOWER
- @zodiacPower[0][0]=-1 if @zodiacPower[0][0]>=0
- @zodiacPower[1][0]=-1 if @zodiacPower[1][0]>=0
- end
- #======================================================
- # Z-Moves
- if ZMOVES
- @zMove[0][0]=-1 if @zMove[0][0]>=0
- @zMove[1][0]=-1 if @zMove[1][0]>=0
- end
- #======================================================
- if SPOWER
- @spiritPower[0][0]=-1 if @spiritPower[0][0]>=0
- @spiritPower[1][0]=-1 if @spiritPower[1][0]>=0
- end
- @dynamax[0][0]=-1 if @dynamax[0][0]>=0
- @dynamax[1][0]=-1 if @dynamax[1][0]>=0
- # Restore the item the player's first Pokémon was due to use
- if @choices[0][0]==3 && $PokemonBag && $PokemonBag.pbCanStore?(@choices[0][1])
- $PokemonBag.pbStoreItem(@choices[0][1])
- end
- pbCommandPhase
- return
- end
- break if commandDone
- end
- end
- end
- end
- end
- def pbAttackPhase
- @scene.pbBeginAttackPhase
- for i in 0...4
- @successStates[i].clear
- if @choices[i][0]!=1 && @choices[i][0]!=2
- @battlers[i].effects[PBEffects::DestinyBond]=false
- @battlers[i].effects[PBEffects::Grudge]=false
- end
- @battlers[i].turncount+=1 if !@battlers[i].fainted?
- @battlers[i].effects[PBEffects::Rage]=false if !pbChoseMove?(i,:RAGE)
- end
- #===================================
- # Calculate priority at this time
- @usepriority=false
- priority=pbPriority(false,true)
- # Mega Evolution
- megaevolved=[]
- for i in priority
- if @choices[i.index][0]==1 && !i.effects[PBEffects::SkipTurn]
- side=(pbIsOpposing?(i.index)) ? 1 : 0
- owner=pbGetOwnerIndex(i.index)
- if @megaEvolution[side][owner]==i.index
- pbMegaEvolve(i.index)
- megaevolved.push(i.index)
- end
- end
- end
- if megaevolved.length>0
- for i in priority
- i.pbAbilitiesOnSwitchIn(true) if megaevolved.include?(i.index)
- end
- end
- #===========================================================================
- # Zodiac Powers
- if ZPOWER
- zodiacUsed=[]
- for i in priority
- if @choices[i.index][0]==1 && !i.effects[PBEffects::SkipTurn]
- side=(pbIsOpposing?(i.index)) ? 1 : 0
- owner=pbGetOwnerIndex(i.index)
- if @zodiacPower[side][owner]==i.index
- pbUseZodiacPower(i.index)
- zodiacUsed.push(i.index)
- end
- end
- end
- end
- #===========================================================================
- # Spirit powers [8901]
- if SPOWER
- spiritUsed=[]
- for i in priority
- if @choices[i.index][0]==1 && !i.effects[PBEffects::SkipTurn]
- side=(pbIsOpposing?(i.index)) ? 1 : 0
- owner=pbGetOwnerIndex(i.index)
- if @spiritPower[side][owner]==i.index
- pbUseSpiritPower(i.index)
- spiritUsed.push(i.index)
- end
- end
- end
- end
- #===========================================================================
- # Dynamaxing
- dynamaxed = []
- for i in priority
- if @choices[i.index][0]== 1 && !i.effects[PBEffects::SkipTurn]
- side = (pbIsOpposing?(i.index)) ? 1 : 0
- owner = pbGetOwnerIndex (i.index)
- if @dynamax[side][owner]==i.index
- pbDynamax(i.index)
- dynamaxed.push(i.index)
- end
- end
- end
- # Call at Pokémon
- for i in priority
- if @choices[i.index][0]==4 && !i.effects[PBEffects::SkipTurn]
- pbCall(i.index)
- end
- end
- # Switch out Pokémon
- @switching=true
- switched=[]
- for i in priority
- if @choices[i.index][0]==2 && !i.effects[PBEffects::SkipTurn]
- index=@choices[i.index][1] # party position of Pokémon to switch to
- newpokename=index
- if isConst?(pbParty(i.index)[index].ability,PBAbilities,:ILLUSION)
- newpokename=pbGetLastPokeInTeam(i.index)
- end
- self.lastMoveUser=i.index
- if !pbOwnedByPlayer?(i.index)
- owner=pbGetOwner(i.index)
- pbDisplayBrief(_INTL("{1} withdrew {2}!",owner.fullname,i.name))
- PBDebug.log("[Withdrew Pokémon] Opponent withdrew #{i.pbThis(true)}")
- else
- pbDisplayBrief(_INTL("{1}, that's enough!\r\nCome back!",i.name))
- PBDebug.log("[Withdrew Pokémon] Player withdrew #{i.pbThis(true)}")
- end
- for j in priority
- #=====================================================================
- side=(pbIsOpposing?(j.index)) ? 1 : 0
- owner=pbGetOwnerIndex(j.index)
- #=====================================================================
- next if !i.pbIsOpposing?(j.index)
- # if Pursuit and this target ("i") was chosen
- if (pbChoseMoveFunctionCode?(j.index,0x88) && # Pursuit
- !j.hasMovedThisRound?) ||
- #==================================================================
- # Adds the Pursuit effect to 'The Hunter' zodiac power.
- #==================================================================
- if ZPOWER
- (@zodiacPower[side][owner]==j.index && j.ZodiacPursuit?)
- end
- #==================================================================
- if j.status!=PBStatuses::SLEEP && j.status!=PBStatuses::FROZEN &&
- !j.effects[PBEffects::SkyDrop] &&
- (!j.hasWorkingAbility(:TRUANT) || !j.effects[PBEffects::Truant])
- @choices[j.index][3]=i.index # Make sure to target the switching Pokémon
- j.pbUseMove(@choices[j.index]) # This calls pbGainEXP as appropriate
- j.effects[PBEffects::Pursuit]=true
- @switching=false
- return if @decision>0
- end
- end
- break if i.fainted?
- end
- if !pbRecallAndReplace(i.index,index,newpokename)
- # If a forced switch somehow occurs here in single battles
- # the attack phase now ends
- if !@doublebattle
- @switching=false
- return
- end
- else
- switched.push(i.index)
- end
- end
- end
- if switched.length>0
- for i in priority
- i.pbAbilitiesOnSwitchIn(true) if switched.include?(i.index)
- end
- end
- @switching=false
- # Use items
- for i in priority
- if @choices[i.index][0]==3 && !i.effects[PBEffects::SkipTurn]
- if pbIsOpposing?(i.index)
- # Opponent use item
- pbEnemyUseItem(@choices[i.index][1],i)
- else
- # Player use item
- item=@choices[i.index][1]
- if item>0
- usetype=$ItemData[item][ITEMBATTLEUSE]
- if usetype==1 || usetype==3
- if @choices[i.index][2]>=0
- pbUseItemOnPokemon(item,@choices[i.index][2],i,@scene)
- end
- elsif usetype==2 || usetype==4
- if !ItemHandlers.hasUseInBattle(item) # Poké Ball/Poké Doll used already
- pbUseItemOnBattler(item,@choices[i.index][2],i,@scene)
- end
- end
- end
- end
- end
- end
- # Use attacks
- for i in priority
- next if i.effects[PBEffects::SkipTurn]
- if pbChoseMoveFunctionCode?(i.index,0x115) # Focus Punch
- pbCommonAnimation("FocusPunch",i,nil)
- pbDisplay(_INTL("{1} is tightening its focus!",i.pbThis))
- end
- end
- 10.times do
- # Forced to go next
- advance=false
- for i in priority
- next if !i.effects[PBEffects::MoveNext]
- next if i.hasMovedThisRound? || i.effects[PBEffects::SkipTurn]
- advance=i.pbProcessTurn(@choices[i.index])
- break if advance
- end
- return if @decision>0
- next if advance
- # Regular priority order
- for i in priority
- next if i.effects[PBEffects::Quash]
- #=======================================================================
- # Switches out after attacking if Fugitive Zodiac Power is used.
- #=======================================================================
- if ZPOWER
- side=(pbIsOpposing?(i.index)) ? 1 : 0
- owner=pbGetOwnerIndex(i.index)
- if @zodiacPower[side][owner]==i.index
- pbUseSelfSwitchOut(i.index)
- end
- end
- #=======================================================================
- next if i.hasMovedThisRound? || i.effects[PBEffects::SkipTurn]
- advance=i.pbProcessTurn(@choices[i.index])
- #=======================================================================
- # Switches out opponent after attacking if Voyager Zodiac Power is used.
- #=======================================================================
- if ZPOWER
- side=(pbIsOpposing?(i.index)) ? 1 : 0
- owner=pbGetOwnerIndex(i.index)
- if @zodiacPower[side][owner]==i.index
- pbUseOppSwitchOut(i.index)
- end
- end
- #=======================================================================
- break if advance
- end
- return if @decision>0
- next if advance
- # Quashed
- for i in priority
- next if !i.effects[PBEffects::Quash]
- next if i.hasMovedThisRound? || i.effects[PBEffects::SkipTurn]
- advance=i.pbProcessTurn(@choices[i.index])
- break if advance
- end
- return if @decision>0
- next if advance
- # Check for all done
- for i in priority
- advance=true if @choices[i.index][0]==1 && !i.hasMovedThisRound? &&
- !i.effects[PBEffects::SkipTurn]
- break if advance
- end
- next if advance
- break
- end
- 10.times do
- @scene.pbGraphicsUpdate
- @scene.pbInputUpdate
- @scene.pbFrameUpdate
- end
- end
- end
- #===============================================================================
- # Menu Graphic for toggling Zodiac Power.
- #===============================================================================
- class FightMenuDisplay
- attr_reader :battler
- attr_reader :index
- attr_accessor :megaButton
- attr_accessor :zodiacButton
- attr_accessor :zButton
- attr_accessor :spiritButton
- attr_accessor :dynamaxButton
- def initialize(battler,viewport=nil)
- @display=nil
- if PokeBattle_SceneConstants::USEFIGHTBOX
- @display=IconSprite.new(0,Graphics.height-96,viewport)
- @display.setBitmap("Graphics/Pictures/Battle/overlay_fight")
- end
- @window=Window_CommandPokemon.newWithSize([],0,Graphics.height-96,320,96,viewport)
- @window.columns=2
- @window.columnSpacing=4
- @window.ignore_input=true
- pbSetNarrowFont(@window.contents)
- @info=Window_AdvancedTextPokemon.newWithSize(
- "",320,Graphics.height-96,Graphics.width-320,96,viewport)
- pbSetNarrowFont(@info.contents)
- @ctag=shadowctag(PokeBattle_SceneConstants::MENUBASECOLOR,
- PokeBattle_SceneConstants::MENUSHADOWCOLOR)
- @buttons=nil
- @battler=battler
- @index=0
- @megaButton=0 # 0=don't show, 1=show, 2=pressed
- #====================================================
- # Zodiac Powers
- @zodiacButton=0 # 0=don't show, 1=show, 2=pressed
- #====================================================
- # Z-Moves
- @zButton=0 # 0=don't show, 1=show, 2=pressed
- #====================================================
- @spiritButton=0 # 0=don't show, 1=show, 2=pressed
- #====================================================
- @dynamaxButton=0 # 0=don't show, 1=show, 2=pressed
- if PokeBattle_SceneConstants::USEFIGHTBOX
- @window.opacity=0
- @window.x=Graphics.width
- @info.opacity=0
- @info.x=Graphics.width+Graphics.width-96
- @buttons=FightMenuButtons.new(self.index,nil,viewport)
- end
- refresh
- end
- def refresh
- return if !@battler
- commands=[]
- for i in 0...4
- break if @battler.moves[i].id==0
- commands.push(@battler.moves[i].name)
- end
- @window.commands=commands
- selmove=@battler.moves[@index]
- movetype=PBTypes.getName(selmove.type)
- if selmove.totalpp==0
- @info.text=_INTL("{1}PP: ---<br>TYPE/{2}",@ctag,movetype)
- else
- @info.text=_ISPRINTF("{1:s}PP: {2: 2d}/{3: 2d}<br>TYPE/{4:s}",
- @ctag,selmove.pp,selmove.totalpp,movetype)
- end
- #===========================================================================
- @buttons.refresh(self.index,@battler ? @battler.moves : nil,@megaButton,@zodiacButton,@zButton,@spiritButton,@dynamaxButton) if @buttons
- #===========================================================================
- end
- def update
- @info.update
- @window.update
- @display.update if @display
- if @buttons
- moves=@battler ? @battler.moves : nil
- #=========================================================================
- @buttons.update(self.index,moves,@megaButton,@zodiacButton,@zButton,@spiritButton,@dynamaxButton)
- #=========================================================================
- end
- end
- end
- class FightMenuButtons < BitmapSprite
- UPPERGAP=46
- def initialize(index=0,moves=nil,viewport=nil)
- super(Graphics.width,96+UPPERGAP,viewport)
- self.x=0
- self.y=Graphics.height-96-UPPERGAP
- pbSetNarrowFont(self.bitmap)
- @buttonbitmap=AnimatedBitmap.new("Graphics/Pictures/Battle/cursor_fight")
- @typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
- @megaevobitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_mega"))
- #===========================================================================
- @zodiacbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Birthsigns/Other/battlezodiac"))
- #===========================================================================
- @zmovebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/ZMove"))
- #===========================================================================
- @spiritbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/Spirit_Power_Button"))
- #===========================================================================
- @maxbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_dynamax"))
- refresh(index,moves,0,0,0,0,0)
- end
- def dispose
- @buttonbitmap.dispose
- @typebitmap.dispose
- @megaevobitmap.dispose
- #======================
- @zodiacbitmap.dispose
- #======================
- @zmovebitmap.dispose
- #======================
- @spiritbitmap.dispose
- #======================
- @maxbitmap.dispose
- super
- end
- def update(index=0,moves=nil,megaButton=0,zodiacButton=0,zButton=0,spiritButton=0,dynamaxButton=0)
- refresh(index,moves,megaButton,zodiacButton,zButton,spiritButton,dynamaxButton)
- end
- def refresh(index,moves,megaButton,zodiacButton,zButton,spiritButton,dynamaxButton)
- return if !moves
- self.bitmap.clear
- textpos=[]
- for i in 0...4
- next if i==index
- next if moves[i].id==0
- x=((i%2)==0) ? 4 : 192
- y=((i/2)==0) ? 6 : 48
- y+=UPPERGAP
- self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(0,moves[i].type*46,192,46))
- textpos.push([moves[i].name,x+96,y+8,2,
- PokeBattle_SceneConstants::MENUBASECOLOR,PokeBattle_SceneConstants::MENUSHADOWCOLOR])
- end
- ppcolors=[
- PokeBattle_SceneConstants::PPTEXTBASECOLOR,PokeBattle_SceneConstants::PPTEXTSHADOWCOLOR,
- PokeBattle_SceneConstants::PPTEXTBASECOLOR,PokeBattle_SceneConstants::PPTEXTSHADOWCOLOR,
- PokeBattle_SceneConstants::PPTEXTBASECOLORYELLOW,PokeBattle_SceneConstants::PPTEXTSHADOWCOLORYELLOW,
- PokeBattle_SceneConstants::PPTEXTBASECOLORORANGE,PokeBattle_SceneConstants::PPTEXTSHADOWCOLORORANGE,
- PokeBattle_SceneConstants::PPTEXTBASECOLORRED,PokeBattle_SceneConstants::PPTEXTSHADOWCOLORRED
- ]
- for i in 0...4
- next if i!=index
- next if moves[i].id==0
- x=((i%2)==0) ? 4 : 192
- y=((i/2)==0) ? 6 : 48
- y+=UPPERGAP
- self.bitmap.blt(x,y,@buttonbitmap.bitmap,Rect.new(192,moves[i].type*46,192,46))
- self.bitmap.blt(416,20+UPPERGAP,@typebitmap.bitmap,Rect.new(0,moves[i].type*28,64,28))
- textpos.push([moves[i].name,x+96,y+8,2,
- PokeBattle_SceneConstants::MENUBASECOLOR,PokeBattle_SceneConstants::MENUSHADOWCOLOR])
- if moves[i].totalpp>0
- ppfraction=(4.0*moves[i].pp/moves[i].totalpp).ceil
- textpos.push([_INTL("PP: {1}/{2}",moves[i].pp,moves[i].totalpp),
- 448,50+UPPERGAP,2,ppcolors[(4-ppfraction)*2],ppcolors[(4-ppfraction)*2+1]])
- end
- end
- pbDrawTextPositions(self.bitmap,textpos)
- if megaButton>0
- self.bitmap.blt(146,0,@megaevobitmap.bitmap,Rect.new(0,(megaButton-1)*46,96,46))
- end
- #===========================================================================
- # Zodiac Powers
- if zodiacButton>0
- self.bitmap.blt(146,0,@zodiacbitmap.bitmap,Rect.new(0,(zodiacButton-1)*46,96,46))
- end
- #===========================================================================
- # Z-Moves
- if zButton>0
- self.bitmap.blt(146,0,@zmovebitmap.bitmap,Rect.new(0,(zButton-1)*46,96,46))
- end
- #===========================================================================
- # Spirit Powers
- if spiritButton>0
- self.bitmap.blt(146,0,@spiritbitmap.bitmap,Rect.new(0,(spiritButton-1)*46,96,46))
- end
- #===========================================================================
- if dynamaxButton>0
- self.bitmap.blt(146,0,@maxbitmap.bitmap,Rect.new(0,(dynamaxButton-1)*46,96,46))
- end
- end
- end
- class PokeBattle_Scene
- def pbFightMenu(index)
- pbShowWindow(FIGHTBOX)
- cw = @sprites["fightwindow"]
- battler=@battle.battlers[index]
- cw.battler=battler
- lastIndex=@lastmove[index]
- if battler.moves[lastIndex].id!=0
- cw.setIndex(lastIndex)
- else
- cw.setIndex(0)
- end
- cw.megaButton=0
- cw.megaButton=1 if @battle.pbCanMegaEvolve?(index)
- #=====================================================
- cw.zodiacButton=0
- if ZPOWER
- cw.zodiacButton=1 if @battle.pbCanUseZodiacPower?(index)
- end
- #=====================================================
- cw.zButton=0
- if ZMOVES
- cw.zButton=1 if @battle.pbCanZMove?(index)
- end
- #=====================================================
- cw.spiritButton=0
- if SPOWER
- cw.spiritButton=1 if @battle.pbCanUseSpiritPower?(index)
- end
- #=====================================================
- cw.dynamaxButton=0
- cw.dynamaxButton=1 if @battle.pbCanUseDynamax?(index)
- pbSelectBattler(index)
- pbRefresh
- loop do
- pbGraphicsUpdate
- pbInputUpdate
- pbFrameUpdate(cw)
- # Update selected command
- if Input.trigger?(Input::LEFT) && (cw.index&1)==1
- pbPlayCursorSE if cw.setIndex(cw.index-1)
- elsif Input.trigger?(Input::RIGHT) && (cw.index&1)==0
- pbPlayCursorSE if cw.setIndex(cw.index+1)
- elsif Input.trigger?(Input::UP) && (cw.index&2)==2
- pbPlayCursorSE if cw.setIndex(cw.index-2)
- elsif Input.trigger?(Input::DOWN) && (cw.index&2)==0
- pbPlayCursorSE if cw.setIndex(cw.index+2)
- end
- #================I just think this is better than this --> ###############
- if Input.trigger?(Input::C) # Confirm choice
- ret=cw.index
- if cw.zButton==2
- if battler.pbCompatibleZMoveFromIndex?(ret)
- pbPlayDecisionSE()
- @lastmove[index]=ret
- return ret
- else
- @battle.pbDisplay(_INTL("{1} is not compatible with {2}!",PBMoves.getName(battler.moves[ret]),PBItems.getName(battler.item)))
- @lastmove[index]=cw.index
- return -1
- end
- else
- pbPlayDecisionSE
- @lastmove[index]=ret
- return ret
- end
- elsif Input.trigger?(Input::A) # Use Mega Evolution
- if @battle.pbCanMegaEvolve?(index)
- @battle.pbRegisterMegaEvolution(index)
- cw.megaButton=2
- pbPlayDecisionSE
- end
- #=======================================================================
- if ZPOWER
- if @battle.pbCanUseZodiacPower?(index) # Use Zodiac Power
- @battle.pbRegisterZodiacPower(index)
- cw.zodiacButton=2
- pbPlayDecisionSE
- end
- end
- #=======================================================================
- if ZMOVES
- if @battle.pbCanZMove?(index) # Use Z Move
- @battle.pbRegisterZMove(index)
- cw.zButton=2
- pbPlayDecisionSE
- end
- end
- #=======================================================================
- if SPOWER
- if @battle.pbCanUseSpiritPower?(index)
- @battle.pbRegisterSpiritPower(index)
- cw.spiritButton=2
- pbPlayDecisionSE
- end
- end
- #=======================================================================
- if @battle.pbCanUseDynamax?(index)
- @battle.pbRegisterDynamax(index)
- cw.dynamaxButton=2
- pbPlayDecisionSE
- end
- elsif Input.trigger?(Input::B) # Cancel fight menu
- @lastmove[index]=cw.index
- pbPlayCancelSE
- return -1
- end
- end
- end
- end
- class PokeBattle_Battler
- def pbUndynamaxForFaint
- @hp=(@hp)/2
- @totalhp=(@totalhp)/2
- pbRestoreMoves(@pokemon)
- if canGmax?
- @form=0
- end
- end
- end
- class PokeBattle_Battle
- def pbEndOfRoundPhase
- PBDebug.log("[End of round]")
- for i in 0...4
- @battlers[i].effects[PBEffects::Electrify]=false
- @battlers[i].effects[PBEffects::Endure]=false
- @battlers[i].effects[PBEffects::FirstPledge]=0
- @battlers[i].effects[PBEffects::HyperBeam]-=1 if @battlers[i].effects[PBEffects::HyperBeam]>0
- @battlers[i].effects[PBEffects::KingsShield]=false
- @battlers[i].effects[PBEffects::LifeOrb]=false
- @battlers[i].effects[PBEffects::MoveNext]=false
- @battlers[i].effects[PBEffects::Powder]=false
- @battlers[i].effects[PBEffects::Protect]=false
- @battlers[i].effects[PBEffects::ProtectNegation]=false
- @battlers[i].effects[PBEffects::Quash]=false
- @battlers[i].effects[PBEffects::Roost]=false
- @battlers[i].effects[PBEffects::SpikyShield]=false
- end
- @usepriority=false # recalculate priority
- priority=pbPriority(true) # Ignoring Quick Claw here
- # Weather
- case @weather
- when PBWeather::SUNNYDAY
- @weatherduration=@weatherduration-1 if @weatherduration>0
- if @weatherduration==0
- pbDisplay(_INTL("The sunlight faded."))
- @weather=0
- PBDebug.log("[End of effect] Sunlight weather ended")
- else
- pbCommonAnimation("Sunny",nil,nil)
- # pbDisplay(_INTL("The sunlight is strong."))
- if pbWeather==PBWeather::SUNNYDAY
- for i in priority
- if i.hasWorkingAbility(:SOLARPOWER)
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Solar Power")
- @scene.pbDamageAnimation(i,0)
- i.pbReduceHP((i.totalhp/8).floor)
- pbDisplay(_INTL("{1} was hurt by the sunlight!",i.pbThis))
- if i.fainted?
- return if !i.pbFaint
- end
- end
- end
- end
- end
- when PBWeather::RAINDANCE
- @weatherduration=@weatherduration-1 if @weatherduration>0
- if @weatherduration==0
- pbDisplay(_INTL("The rain stopped."))
- @weather=0
- PBDebug.log("[End of effect] Rain weather ended")
- else
- pbCommonAnimation("Rain",nil,nil)
- # pbDisplay(_INTL("Rain continues to fall."))
- end
- when PBWeather::SANDSTORM
- @weatherduration=@weatherduration-1 if @weatherduration>0
- if @weatherduration==0
- pbDisplay(_INTL("The sandstorm subsided."))
- @weather=0
- PBDebug.log("[End of effect] Sandstorm weather ended")
- else
- pbCommonAnimation("Sandstorm",nil,nil)
- # pbDisplay(_INTL("The sandstorm rages."))
- if pbWeather==PBWeather::SANDSTORM
- PBDebug.log("[Lingering effect triggered] Sandstorm weather damage")
- for i in priority
- next if i.fainted?
- if !i.pbHasType?(:GROUND) && !i.pbHasType?(:ROCK) && !i.pbHasType?(:STEEL) &&
- !i.hasWorkingAbility(:SANDVEIL) &&
- !i.hasWorkingAbility(:SANDRUSH) &&
- !i.hasWorkingAbility(:SANDFORCE) &&
- !i.hasWorkingAbility(:MAGICGUARD) &&
- !i.hasWorkingAbility(:OVERCOAT) &&
- !i.hasWorkingItem(:SAFETYGOGGLES) &&
- ![0xCA,0xCB].include?(PBMoveData.new(i.effects[PBEffects::TwoTurnAttack]).function) # Dig, Dive
- @scene.pbDamageAnimation(i,0)
- i.pbReduceHP((i.totalhp/16).floor)
- pbDisplay(_INTL("{1} is buffeted by the sandstorm!",i.pbThis))
- if i.fainted?
- return if !i.pbFaint
- end
- end
- end
- end
- end
- when PBWeather::HAIL
- @weatherduration=@weatherduration-1 if @weatherduration>0
- if @weatherduration==0
- pbDisplay(_INTL("The hail stopped."))
- @weather=0
- PBDebug.log("[End of effect] Hail weather ended")
- else
- pbCommonAnimation("Hail",nil,nil)
- # pbDisplay(_INTL("Hail continues to fall."))
- if pbWeather==PBWeather::HAIL
- PBDebug.log("[Lingering effect triggered] Hail weather damage")
- for i in priority
- next if i.fainted?
- if !i.pbHasType?(:ICE) &&
- !i.hasWorkingAbility(:ICEBODY) &&
- !i.hasWorkingAbility(:SNOWCLOAK) &&
- !i.hasWorkingAbility(:MAGICGUARD) &&
- !i.hasWorkingAbility(:OVERCOAT) &&
- !i.hasWorkingItem(:SAFETYGOGGLES) &&
- ![0xCA,0xCB].include?(PBMoveData.new(i.effects[PBEffects::TwoTurnAttack]).function) # Dig, Dive
- @scene.pbDamageAnimation(i,0)
- i.pbReduceHP((i.totalhp/16).floor)
- pbDisplay(_INTL("{1} is buffeted by the hail!",i.pbThis))
- if i.fainted?
- return if !i.pbFaint
- end
- end
- end
- end
- end
- when PBWeather::HEAVYRAIN
- hasabil=false
- for i in 0...4
- if isConst?(@battlers[i].ability,PBAbilities,:PRIMORDIALSEA) && !@battlers[i].fainted?
- hasabil=true; break
- end
- end
- @weatherduration=0 if !hasabil
- if @weatherduration==0
- pbDisplay(_INTL("The heavy rain stopped."))
- @weather=0
- PBDebug.log("[End of effect] Primordial Sea's rain weather ended")
- else
- pbCommonAnimation("HeavyRain",nil,nil)
- # pbDisplay(_INTL("It is raining heavily."))
- end
- when PBWeather::HARSHSUN
- hasabil=false
- for i in 0...4
- if isConst?(@battlers[i].ability,PBAbilities,:DESOLATELAND) && !@battlers[i].fainted?
- hasabil=true; break
- end
- end
- @weatherduration=0 if !hasabil
- if @weatherduration==0
- pbDisplay(_INTL("The harsh sunlight faded."))
- @weather=0
- PBDebug.log("[End of effect] Desolate Land's sunlight weather ended")
- else
- pbCommonAnimation("HarshSun",nil,nil)
- # pbDisplay(_INTL("The sunlight is extremely harsh."))
- if pbWeather==PBWeather::HARSHSUN
- for i in priority
- if i.hasWorkingAbility(:SOLARPOWER)
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Solar Power")
- @scene.pbDamageAnimation(i,0)
- i.pbReduceHP((i.totalhp/8).floor)
- pbDisplay(_INTL("{1} was hurt by the sunlight!",i.pbThis))
- if i.fainted?
- return if !i.pbFaint
- end
- end
- end
- end
- end
- when PBWeather::STRONGWINDS
- hasabil=false
- for i in 0...4
- if isConst?(@battlers[i].ability,PBAbilities,:DELTASTREAM) && !@battlers[i].fainted?
- hasabil=true; break
- end
- end
- @weatherduration=0 if !hasabil
- if @weatherduration==0
- pbDisplay(_INTL("The air current subsided."))
- @weather=0
- PBDebug.log("[End of effect] Delta Stream's wind weather ended")
- else
- pbCommonAnimation("StrongWinds",nil,nil)
- # pbDisplay(_INTL("The wind is strong."))
- end
- end
- # Shadow Sky weather
- if isConst?(@weather,PBWeather,:SHADOWSKY)
- @weatherduration=@weatherduration-1 if @weatherduration>0
- if @weatherduration==0
- pbDisplay(_INTL("The shadow sky faded."))
- @weather=0
- PBDebug.log("[End of effect] Shadow Sky weather ended")
- else
- pbCommonAnimation("ShadowSky",nil,nil)
- # pbDisplay(_INTL("The shadow sky continues."));
- if isConst?(pbWeather,PBWeather,:SHADOWSKY)
- PBDebug.log("[Lingering effect triggered] Shadow Sky weather damage")
- for i in priority
- next if i.fainted?
- if !i.isShadow?
- @scene.pbDamageAnimation(i,0)
- i.pbReduceHP((i.totalhp/16).floor)
- pbDisplay(_INTL("{1} was hurt by the shadow sky!",i.pbThis))
- if i.fainted?
- return if !i.pbFaint
- end
- end
- end
- end
- end
- end
- # Future Sight/Doom Desire
- for i in battlers # not priority
- next if i.fainted?
- if i.effects[PBEffects::FutureSight]>0
- i.effects[PBEffects::FutureSight]-=1
- if i.effects[PBEffects::FutureSight]==0
- move=i.effects[PBEffects::FutureSightMove]
- PBDebug.log("[Lingering effect triggered] #{PBMoves.getName(move)} struck #{i.pbThis(true)}")
- pbDisplay(_INTL("{1} took the {2} attack!",i.pbThis,PBMoves.getName(move)))
- moveuser=nil
- for j in battlers
- next if j.pbIsOpposing?(i.effects[PBEffects::FutureSightUserPos])
- if j.pokemonIndex==i.effects[PBEffects::FutureSightUser] && !j.fainted?
- moveuser=j; break
- end
- end
- if !moveuser
- party=pbParty(i.effects[PBEffects::FutureSightUserPos])
- if party[i.effects[PBEffects::FutureSightUser]].hp>0
- moveuser=PokeBattle_Battler.new(self,i.effects[PBEffects::FutureSightUserPos])
- moveuser.pbInitDummyPokemon(party[i.effects[PBEffects::FutureSightUser]],
- i.effects[PBEffects::FutureSightUser])
- end
- end
- if !moveuser
- pbDisplay(_INTL("But it failed!"))
- else
- @futuresight=true
- moveuser.pbUseMoveSimple(move,-1,i.index)
- @futuresight=false
- end
- i.effects[PBEffects::FutureSight]=0
- i.effects[PBEffects::FutureSightMove]=0
- i.effects[PBEffects::FutureSightUser]=-1
- i.effects[PBEffects::FutureSightUserPos]=-1
- if i.fainted?
- return if !i.pbFaint
- next
- end
- end
- end
- end
- for i in priority
- next if i.fainted?
- # Rain Dish
- if i.hasWorkingAbility(:RAINDISH) && i.effects[PBEffects::HealBlock]==0 &&
- (pbWeather==PBWeather::RAINDANCE ||
- pbWeather==PBWeather::HEAVYRAIN)
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Rain Dish")
- hpgain=i.pbRecoverHP((i.totalhp/16).floor,true)
- pbDisplay(_INTL("{1}'s {2} restored its HP a little!",i.pbThis,PBAbilities.getName(i.ability))) if hpgain>0
- end
- # Dry Skin
- if i.hasWorkingAbility(:DRYSKIN)
- if (pbWeather==PBWeather::RAINDANCE || pbWeather==PBWeather::HEAVYRAIN) &&
- i.effects[PBEffects::HealBlock]==0
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Dry Skin (in rain)")
- hpgain=i.pbRecoverHP((i.totalhp/8).floor,true)
- pbDisplay(_INTL("{1}'s {2} was healed by the rain!",i.pbThis,PBAbilities.getName(i.ability))) if hpgain>0
- elsif pbWeather==PBWeather::SUNNYDAY ||
- pbWeather==PBWeather::HARSHSUN
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Dry Skin (in sun)")
- @scene.pbDamageAnimation(i,0)
- hploss=i.pbReduceHP((i.totalhp/8).floor)
- pbDisplay(_INTL("{1}'s {2} was hurt by the sunlight!",i.pbThis,PBAbilities.getName(i.ability))) if hploss>0
- end
- end
- # Ice Body
- if i.hasWorkingAbility(:ICEBODY) && pbWeather==PBWeather::HAIL &&
- i.effects[PBEffects::HealBlock]==0
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Ice Body")
- hpgain=i.pbRecoverHP((i.totalhp/16).floor,true)
- pbDisplay(_INTL("{1}'s {2} restored its HP a little!",i.pbThis,PBAbilities.getName(i.ability))) if hpgain>0
- end
- if i.fainted?
- return if !i.pbFaint
- end
- end
- # Wish
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Wish]>0
- i.effects[PBEffects::Wish]-=1
- if i.effects[PBEffects::Wish]==0
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Wish")
- hpgain=i.pbRecoverHP(i.effects[PBEffects::WishAmount],true)
- if hpgain>0
- wishmaker=pbThisEx(i.index,i.effects[PBEffects::WishMaker])
- pbDisplay(_INTL("{1}'s wish came true!",wishmaker))
- end
- end
- end
- end
- # Fire Pledge + Grass Pledge combination damage
- for i in 0...2
- if sides[i].effects[PBEffects::SeaOfFire]>0 &&
- pbWeather!=PBWeather::RAINDANCE &&
- pbWeather!=PBWeather::HEAVYRAIN
- @battle.pbCommonAnimation("SeaOfFire",nil,nil) if i==0
- @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil) if i==1
- for j in priority
- next if (j.index&1)!=i
- next if j.pbHasType?(:FIRE) || j.hasWorkingAbility(:MAGICGUARD)
- @scene.pbDamageAnimation(j,0)
- hploss=j.pbReduceHP((j.totalhp/8).floor)
- pbDisplay(_INTL("{1} is hurt by the sea of fire!",j.pbThis)) if hploss>0
- if j.fainted?
- return if !j.pbFaint
- end
- end
- end
- end
- for i in priority
- next if i.fainted?
- # Shed Skin, Hydration
- if (i.hasWorkingAbility(:SHEDSKIN) && pbRandom(10)<3) ||
- (i.hasWorkingAbility(:HYDRATION) && (pbWeather==PBWeather::RAINDANCE ||
- pbWeather==PBWeather::HEAVYRAIN))
- if i.status>0
- PBDebug.log("[Ability triggered] #{i.pbThis}'s #{PBAbilities.getName(i.ability)}")
- s=i.status
- i.pbCureStatus(false)
- case s
- when PBStatuses::SLEEP
- pbDisplay(_INTL("{1}'s {2} cured its sleep problem!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::POISON
- pbDisplay(_INTL("{1}'s {2} cured its poison problem!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::BURN
- pbDisplay(_INTL("{1}'s {2} healed its burn!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::PARALYSIS
- pbDisplay(_INTL("{1}'s {2} cured its paralysis!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::FROZEN
- pbDisplay(_INTL("{1}'s {2} thawed it out!",i.pbThis,PBAbilities.getName(i.ability)))
- end
- end
- end
- # Healer
- if i.hasWorkingAbility(:HEALER) && pbRandom(10)<3
- partner=i.pbPartner
- if partner && partner.status>0
- PBDebug.log("[Ability triggered] #{i.pbThis}'s #{PBAbilities.getName(i.ability)}")
- s=partner.status
- partner.pbCureStatus(false)
- case s
- when PBStatuses::SLEEP
- pbDisplay(_INTL("{1}'s {2} cured its partner's sleep problem!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::POISON
- pbDisplay(_INTL("{1}'s {2} cured its partner's poison problem!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::BURN
- pbDisplay(_INTL("{1}'s {2} healed its partner's burn!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::PARALYSIS
- pbDisplay(_INTL("{1}'s {2} cured its partner's paralysis!",i.pbThis,PBAbilities.getName(i.ability)))
- when PBStatuses::FROZEN
- pbDisplay(_INTL("{1}'s {2} thawed its partner out!",i.pbThis,PBAbilities.getName(i.ability)))
- end
- end
- end
- end
- for i in priority
- next if i.fainted?
- # Grassy Terrain (healing)
- if @field.effects[PBEffects::GrassyTerrain]>0 && !i.isAirborne?
- if i.effects[PBEffects::HealBlock]==0
- hpgain=i.pbRecoverHP((i.totalhp/16).floor,true)
- pbDisplay(_INTL("{1}'s HP was restored.",i.pbThis)) if hpgain>0
- end
- end
- # Held berries/Leftovers/Black Sludge
- i.pbBerryCureCheck(true)
- if i.fainted?
- return if !i.pbFaint
- end
- end
- # Aqua Ring
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::AquaRing]
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Aqua Ring")
- hpgain=(i.totalhp/16).floor
- hpgain=(hpgain*1.3).floor if i.hasWorkingItem(:BIGROOT)
- hpgain=i.pbRecoverHP(hpgain,true)
- pbDisplay(_INTL("Aqua Ring restored {1}'s HP!",i.pbThis)) if hpgain>0
- end
- end
- # Ingrain
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Ingrain]
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Ingrain")
- hpgain=(i.totalhp/16).floor
- hpgain=(hpgain*1.3).floor if i.hasWorkingItem(:BIGROOT)
- hpgain=i.pbRecoverHP(hpgain,true)
- pbDisplay(_INTL("{1} absorbed nutrients with its roots!",i.pbThis)) if hpgain>0
- end
- end
- # Leech Seed
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::LeechSeed]>=0 && !i.hasWorkingAbility(:MAGICGUARD)
- recipient=@battlers[i.effects[PBEffects::LeechSeed]]
- if recipient && !recipient.fainted?
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Leech Seed")
- pbCommonAnimation("LeechSeed",recipient,i)
- hploss=i.pbReduceHP((i.totalhp/8).floor,true)
- if i.hasWorkingAbility(:LIQUIDOOZE)
- recipient.pbReduceHP(hploss,true)
- pbDisplay(_INTL("{1} sucked up the liquid ooze!",recipient.pbThis))
- else
- if recipient.effects[PBEffects::HealBlock]==0
- hploss=(hploss*1.3).floor if recipient.hasWorkingItem(:BIGROOT)
- recipient.pbRecoverHP(hploss,true)
- end
- pbDisplay(_INTL("{1}'s health was sapped by Leech Seed!",i.pbThis))
- end
- if i.fainted?
- return if !i.pbFaint
- end
- if recipient.fainted?
- return if !recipient.pbFaint
- end
- end
- end
- end
- for i in priority
- next if i.fainted?
- # Poison/Bad poison
- if i.status==PBStatuses::POISON
- if i.statusCount>0
- i.effects[PBEffects::Toxic]+=1
- i.effects[PBEffects::Toxic]=[15,i.effects[PBEffects::Toxic]].min
- end
- if i.hasWorkingAbility(:POISONHEAL)
- pbCommonAnimation("Poison",i,nil)
- if i.effects[PBEffects::HealBlock]==0 && i.hp<i.totalhp
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Poison Heal")
- i.pbRecoverHP((i.totalhp/8).floor,true)
- pbDisplay(_INTL("{1} is healed by poison!",i.pbThis))
- end
- else
- if !i.hasWorkingAbility(:MAGICGUARD)
- PBDebug.log("[Status damage] #{i.pbThis} took damage from poison/toxic")
- if i.statusCount==0
- i.pbReduceHP((i.totalhp/8).floor)
- else
- i.pbReduceHP(((i.totalhp*i.effects[PBEffects::Toxic])/16).floor)
- end
- i.pbContinueStatus
- end
- end
- end
- # Burn
- if i.status==PBStatuses::BURN
- if !i.hasWorkingAbility(:MAGICGUARD)
- PBDebug.log("[Status damage] #{i.pbThis} took damage from burn")
- if i.hasWorkingAbility(:HEATPROOF)
- PBDebug.log("[Ability triggered] #{i.pbThis}'s Heatproof")
- i.pbReduceHP((i.totalhp/16).floor)
- else
- i.pbReduceHP((i.totalhp/8).floor)
- end
- end
- i.pbContinueStatus
- end
- # Nightmare
- if i.effects[PBEffects::Nightmare]
- if i.status==PBStatuses::SLEEP
- if !i.hasWorkingAbility(:MAGICGUARD)
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s nightmare")
- i.pbReduceHP((i.totalhp/4).floor,true)
- pbDisplay(_INTL("{1} is locked in a nightmare!",i.pbThis))
- end
- else
- i.effects[PBEffects::Nightmare]=false
- end
- end
- if i.fainted?
- return if !i.pbFaint
- next
- end
- end
- # Curse
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Curse] && !i.hasWorkingAbility(:MAGICGUARD)
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s curse")
- i.pbReduceHP((i.totalhp/4).floor,true)
- pbDisplay(_INTL("{1} is afflicted by the curse!",i.pbThis))
- end
- if i.fainted?
- return if !i.pbFaint
- next
- end
- end
- # Multi-turn attacks (Bind/Clamp/Fire Spin/Magma Storm/Sand Tomb/Whirlpool/Wrap)
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::MultiTurn]>0
- i.effects[PBEffects::MultiTurn]-=1
- movename=PBMoves.getName(i.effects[PBEffects::MultiTurnAttack])
- if i.effects[PBEffects::MultiTurn]==0
- PBDebug.log("[End of effect] Trapping move #{movename} affecting #{i.pbThis} ended")
- pbDisplay(_INTL("{1} was freed from {2}!",i.pbThis,movename))
- else
- if isConst?(i.effects[PBEffects::MultiTurnAttack],PBMoves,:BIND)
- pbCommonAnimation("Bind",i,nil)
- elsif isConst?(i.effects[PBEffects::MultiTurnAttack],PBMoves,:CLAMP)
- pbCommonAnimation("Clamp",i,nil)
- elsif isConst?(i.effects[PBEffects::MultiTurnAttack],PBMoves,:FIRESPIN)
- pbCommonAnimation("FireSpin",i,nil)
- elsif isConst?(i.effects[PBEffects::MultiTurnAttack],PBMoves,:MAGMASTORM)
- pbCommonAnimation("MagmaStorm",i,nil)
- elsif isConst?(i.effects[PBEffects::MultiTurnAttack],PBMoves,:SANDTOMB)
- pbCommonAnimation("SandTomb",i,nil)
- elsif isConst?(i.effects[PBEffects::MultiTurnAttack],PBMoves,:WRAP)
- pbCommonAnimation("Wrap",i,nil)
- elsif isConst?(i.effects[PBEffects::MultiTurnAttack],PBMoves,:INFESTATION)
- pbCommonAnimation("Infestation",i,nil)
- else
- pbCommonAnimation("Wrap",i,nil)
- end
- if !i.hasWorkingAbility(:MAGICGUARD)
- PBDebug.log("[Lingering effect triggered] #{i.pbThis} took damage from trapping move #{movename}")
- @scene.pbDamageAnimation(i,0)
- amt=(USENEWBATTLEMECHANICS) ? (i.totalhp/8).floor : (i.totalhp/16).floor
- if @battlers[i.effects[PBEffects::MultiTurnUser]].hasWorkingItem(:BINDINGBAND)
- amt=(USENEWBATTLEMECHANICS) ? (i.totalhp/6).floor : (i.totalhp/8).floor
- end
- i.pbReduceHP(amt)
- pbDisplay(_INTL("{1} is hurt by {2}!",i.pbThis,movename))
- end
- end
- end
- if i.fainted?
- return if !i.pbFaint
- end
- end
- # Taunt
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Taunt]>0
- i.effects[PBEffects::Taunt]-=1
- if i.effects[PBEffects::Taunt]==0
- pbDisplay(_INTL("{1}'s taunt wore off!",i.pbThis))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer taunted")
- end
- end
- end
- # Encore
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Encore]>0
- if i.moves[i.effects[PBEffects::EncoreIndex]].id!=i.effects[PBEffects::EncoreMove]
- i.effects[PBEffects::Encore]=0
- i.effects[PBEffects::EncoreIndex]=0
- i.effects[PBEffects::EncoreMove]=0
- PBDebug.log("[End of effect] #{i.pbThis} is no longer encored (encored move was lost)")
- else
- i.effects[PBEffects::Encore]-=1
- if i.effects[PBEffects::Encore]==0 || i.moves[i.effects[PBEffects::EncoreIndex]].pp==0
- i.effects[PBEffects::Encore]=0
- pbDisplay(_INTL("{1}'s encore ended!",i.pbThis))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer encored")
- end
- end
- end
- end
- # Disable/Cursed Body
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Disable]>0
- i.effects[PBEffects::Disable]-=1
- if i.effects[PBEffects::Disable]==0
- i.effects[PBEffects::DisableMove]=0
- pbDisplay(_INTL("{1} is no longer disabled!",i.pbThis))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer disabled")
- end
- end
- end
- # Magnet Rise
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::MagnetRise]>0
- i.effects[PBEffects::MagnetRise]-=1
- if i.effects[PBEffects::MagnetRise]==0
- pbDisplay(_INTL("{1} stopped levitating.",i.pbThis))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer levitating by Magnet Rise")
- end
- end
- end
- # Telekinesis
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Telekinesis]>0
- i.effects[PBEffects::Telekinesis]-=1
- if i.effects[PBEffects::Telekinesis]==0
- pbDisplay(_INTL("{1} stopped levitating.",i.pbThis))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer levitating by Telekinesis")
- end
- end
- end
- # Heal Block
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::HealBlock]>0
- i.effects[PBEffects::HealBlock]-=1
- if i.effects[PBEffects::HealBlock]==0
- pbDisplay(_INTL("{1}'s Heal Block wore off!",i.pbThis))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer Heal Blocked")
- end
- end
- end
- # Embargo
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Embargo]>0
- i.effects[PBEffects::Embargo]-=1
- if i.effects[PBEffects::Embargo]==0
- pbDisplay(_INTL("{1} can use items again!",i.pbThis(true)))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer affected by an embargo")
- end
- end
- end
- # Yawn
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Yawn]>0
- i.effects[PBEffects::Yawn]-=1
- if i.effects[PBEffects::Yawn]==0 && i.pbCanSleepYawn?
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Yawn")
- i.pbSleep
- i.pbBerryCureCheck
- end
- end
- end
- # Perish Song
- perishSongUsers=[]
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::PerishSong]>0
- i.effects[PBEffects::PerishSong]-=1
- pbDisplay(_INTL("{1}'s perish count fell to {2}!",i.pbThis,i.effects[PBEffects::PerishSong]))
- PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Perish Song count dropped to #{i.effects[PBEffects::PerishSong]}")
- if i.effects[PBEffects::PerishSong]==0
- perishSongUsers.push(i.effects[PBEffects::PerishSongUser])
- i.pbReduceHP(i.hp,true)
- end
- end
- if i.fainted?
- return if !i.pbFaint
- end
- end
- if perishSongUsers.length>0
- # If all remaining Pokemon fainted by a Perish Song triggered by a single side
- if (perishSongUsers.find_all{|item| pbIsOpposing?(item) }.length==perishSongUsers.length) ||
- (perishSongUsers.find_all{|item| !pbIsOpposing?(item) }.length==perishSongUsers.length)
- pbJudgeCheckpoint(@battlers[perishSongUsers[0]])
- end
- end
- if @decision>0
- pbGainEXP
- return
- end
- # Reflect
- for i in 0...2
- if sides[i].effects[PBEffects::Reflect]>0
- sides[i].effects[PBEffects::Reflect]-=1
- if sides[i].effects[PBEffects::Reflect]==0
- pbDisplay(_INTL("Your team's Reflect faded!")) if i==0
- pbDisplay(_INTL("The opposing team's Reflect faded!")) if i==1
- PBDebug.log("[End of effect] Reflect ended on the player's side") if i==0
- PBDebug.log("[End of effect] Reflect ended on the opponent's side") if i==1
- end
- end
- end
- # Light Screen
- for i in 0...2
- if sides[i].effects[PBEffects::LightScreen]>0
- sides[i].effects[PBEffects::LightScreen]-=1
- if sides[i].effects[PBEffects::LightScreen]==0
- pbDisplay(_INTL("Your team's Light Screen faded!")) if i==0
- pbDisplay(_INTL("The opposing team's Light Screen faded!")) if i==1
- PBDebug.log("[End of effect] Light Screen ended on the player's side") if i==0
- PBDebug.log("[End of effect] Light Screen ended on the opponent's side") if i==1
- end
- end
- end
- # Safeguard
- for i in 0...2
- if sides[i].effects[PBEffects::Safeguard]>0
- sides[i].effects[PBEffects::Safeguard]-=1
- if sides[i].effects[PBEffects::Safeguard]==0
- pbDisplay(_INTL("Your team is no longer protected by Safeguard!")) if i==0
- pbDisplay(_INTL("The opposing team is no longer protected by Safeguard!")) if i==1
- PBDebug.log("[End of effect] Safeguard ended on the player's side") if i==0
- PBDebug.log("[End of effect] Safeguard ended on the opponent's side") if i==1
- end
- end
- end
- # Mist
- for i in 0...2
- if sides[i].effects[PBEffects::Mist]>0
- sides[i].effects[PBEffects::Mist]-=1
- if sides[i].effects[PBEffects::Mist]==0
- pbDisplay(_INTL("Your team's Mist faded!")) if i==0
- pbDisplay(_INTL("The opposing team's Mist faded!")) if i==1
- PBDebug.log("[End of effect] Mist ended on the player's side") if i==0
- PBDebug.log("[End of effect] Mist ended on the opponent's side") if i==1
- end
- end
- end
- # Tailwind
- for i in 0...2
- if sides[i].effects[PBEffects::Tailwind]>0
- sides[i].effects[PBEffects::Tailwind]-=1
- if sides[i].effects[PBEffects::Tailwind]==0
- pbDisplay(_INTL("Your team's Tailwind petered out!")) if i==0
- pbDisplay(_INTL("The opposing team's Tailwind petered out!")) if i==1
- PBDebug.log("[End of effect] Tailwind ended on the player's side") if i==0
- PBDebug.log("[End of effect] Tailwind ended on the opponent's side") if i==1
- end
- end
- end
- # Lucky Chant
- for i in 0...2
- if sides[i].effects[PBEffects::LuckyChant]>0
- sides[i].effects[PBEffects::LuckyChant]-=1
- if sides[i].effects[PBEffects::LuckyChant]==0
- pbDisplay(_INTL("Your team's Lucky Chant faded!")) if i==0
- pbDisplay(_INTL("The opposing team's Lucky Chant faded!")) if i==1
- PBDebug.log("[End of effect] Lucky Chant ended on the player's side") if i==0
- PBDebug.log("[End of effect] Lucky Chant ended on the opponent's side") if i==1
- end
- end
- end
- # End of Pledge move combinations
- for i in 0...2
- if sides[i].effects[PBEffects::Swamp]>0
- sides[i].effects[PBEffects::Swamp]-=1
- if sides[i].effects[PBEffects::Swamp]==0
- pbDisplay(_INTL("The swamp around your team disappeared!")) if i==0
- pbDisplay(_INTL("The swamp around the opposing team disappeared!")) if i==1
- PBDebug.log("[End of effect] Grass Pledge's swamp ended on the player's side") if i==0
- PBDebug.log("[End of effect] Grass Pledge's swamp ended on the opponent's side") if i==1
- end
- end
- if sides[i].effects[PBEffects::SeaOfFire]>0
- sides[i].effects[PBEffects::SeaOfFire]-=1
- if sides[i].effects[PBEffects::SeaOfFire]==0
- pbDisplay(_INTL("The sea of fire around your team disappeared!")) if i==0
- pbDisplay(_INTL("The sea of fire around the opposing team disappeared!")) if i==1
- PBDebug.log("[End of effect] Fire Pledge's sea of fire ended on the player's side") if i==0
- PBDebug.log("[End of effect] Fire Pledge's sea of fire ended on the opponent's side") if i==1
- end
- end
- if sides[i].effects[PBEffects::Rainbow]>0
- sides[i].effects[PBEffects::Rainbow]-=1
- if sides[i].effects[PBEffects::Rainbow]==0
- pbDisplay(_INTL("The rainbow around your team disappeared!")) if i==0
- pbDisplay(_INTL("The rainbow around the opposing team disappeared!")) if i==1
- PBDebug.log("[End of effect] Water Pledge's rainbow ended on the player's side") if i==0
- PBDebug.log("[End of effect] Water Pledge's rainbow ended on the opponent's side") if i==1
- end
- end
- end
- # Gravity
- if @field.effects[PBEffects::Gravity]>0
- @field.effects[PBEffects::Gravity]-=1
- if @field.effects[PBEffects::Gravity]==0
- pbDisplay(_INTL("Gravity returned to normal."))
- PBDebug.log("[End of effect] Strong gravity ended")
- end
- end
- # Trick Room
- if @field.effects[PBEffects::TrickRoom]>0
- @field.effects[PBEffects::TrickRoom]-=1
- if @field.effects[PBEffects::TrickRoom]==0
- pbDisplay(_INTL("The twisted dimensions returned to normal."))
- PBDebug.log("[End of effect] Trick Room ended")
- end
- end
- # Wonder Room
- if @field.effects[PBEffects::WonderRoom]>0
- @field.effects[PBEffects::WonderRoom]-=1
- if @field.effects[PBEffects::WonderRoom]==0
- pbDisplay(_INTL("Wonder Room wore off, and the Defense and Sp. Def stats returned to normal!"))
- PBDebug.log("[End of effect] Wonder Room ended")
- end
- end
- # Magic Room
- if @field.effects[PBEffects::MagicRoom]>0
- @field.effects[PBEffects::MagicRoom]-=1
- if @field.effects[PBEffects::MagicRoom]==0
- pbDisplay(_INTL("The area returned to normal."))
- PBDebug.log("[End of effect] Magic Room ended")
- end
- end
- # Mud Sport
- if @field.effects[PBEffects::MudSportField]>0
- @field.effects[PBEffects::MudSportField]-=1
- if @field.effects[PBEffects::MudSportField]==0
- pbDisplay(_INTL("The effects of Mud Sport have faded."))
- PBDebug.log("[End of effect] Mud Sport ended")
- end
- end
- # Water Sport
- if @field.effects[PBEffects::WaterSportField]>0
- @field.effects[PBEffects::WaterSportField]-=1
- if @field.effects[PBEffects::WaterSportField]==0
- pbDisplay(_INTL("The effects of Water Sport have faded."))
- PBDebug.log("[End of effect] Water Sport ended")
- end
- end
- # Electric Terrain
- if @field.effects[PBEffects::ElectricTerrain]>0
- @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")
- end
- end
- # Grassy Terrain (counting down)
- if @field.effects[PBEffects::GrassyTerrain]>0
- @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")
- end
- end
- # Misty Terrain
- if @field.effects[PBEffects::MistyTerrain]>0
- @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")
- end
- end
- # Uproar
- for i in priority
- next if i.fainted?
- if i.effects[PBEffects::Uproar]>0
- for j in priority
- if !j.fainted? && j.status==PBStatuses::SLEEP && !j.hasWorkingAbility(:SOUNDPROOF)
- PBDebug.log("[Lingering effect triggered] Uproar woke up #{j.pbThis(true)}")
- j.pbCureStatus(false)
- pbDisplay(_INTL("{1} woke up in the uproar!",j.pbThis))
- end
- end
- i.effects[PBEffects::Uproar]-=1
- if i.effects[PBEffects::Uproar]==0
- pbDisplay(_INTL("{1} calmed down.",i.pbThis))
- PBDebug.log("[End of effect] #{i.pbThis} is no longer uproaring")
- else
- pbDisplay(_INTL("{1} is making an uproar!",i.pbThis))
- end
- end
- end
- for i in priority
- next if i.fainted?
- # Speed Boost
- # A Pokémon's turncount is 0 if it became active after the beginning of a round
- if i.turncount>0 && i.hasWorkingAbility(:SPEEDBOOST)
- if i.pbIncreaseStatWithCause(PBStats::SPEED,1,i,PBAbilities.getName(i.ability))
- PBDebug.log("[Ability triggered] #{i.pbThis}'s #{PBAbilities.getName(i.ability)}")
- end
- end
- # Bad Dreams
- if i.status==PBStatuses::SLEEP && !i.hasWorkingAbility(:MAGICGUARD)
- if i.pbOpposing1.hasWorkingAbility(:BADDREAMS) ||
- i.pbOpposing2.hasWorkingAbility(:BADDREAMS)
- PBDebug.log("[Ability triggered] #{i.pbThis}'s opponent's Bad Dreams")
- hploss=i.pbReduceHP((i.totalhp/8).floor,true)
- pbDisplay(_INTL("{1} is having a bad dream!",i.pbThis)) if hploss>0
- end
- end
- if i.fainted?
- return if !i.pbFaint
- next
- end
- # Pickup
- if i.hasWorkingAbility(:PICKUP) && i.item<=0
- item=0; index=-1; use=0
- for j in 0...4
- next if j==i.index
- if @battlers[j].effects[PBEffects::PickupUse]>use
- item=@battlers[j].effects[PBEffects::PickupItem]
- index=j
- use=@battlers[j].effects[PBEffects::PickupUse]
- end
- end
- if item>0
- i.item=item
- @battlers[index].effects[PBEffects::PickupItem]=0
- @battlers[index].effects[PBEffects::PickupUse]=0
- @battlers[index].pokemon.itemRecycle=0 if @battlers[index].pokemon.itemRecycle==item
- if !@opponent && # In a wild battle
- i.pokemon.itemInitial==0 &&
- @battlers[index].pokemon.itemInitial==item
- i.pokemon.itemInitial=item
- @battlers[index].pokemon.itemInitial=0
- end
- pbDisplay(_INTL("{1} found one {2}!",i.pbThis,PBItems.getName(item)))
- i.pbBerryCureCheck(true)
- end
- end
- # Harvest
- if i.hasWorkingAbility(:HARVEST) && i.item<=0 && i.pokemon.itemRecycle>0
- if pbIsBerry?(i.pokemon.itemRecycle) &&
- (pbWeather==PBWeather::SUNNYDAY ||
- pbWeather==PBWeather::HARSHSUN || pbRandom(10)<5)
- i.item=i.pokemon.itemRecycle
- i.pokemon.itemRecycle=0
- i.pokemon.itemInitial=i.item if i.pokemon.itemInitial==0
- pbDisplay(_INTL("{1} harvested one {2}!",i.pbThis,PBItems.getName(i.item)))
- i.pbBerryCureCheck(true)
- 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
- 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
- if i.hasWorkingItem(:FLAMEORB) && i.status==0 && i.pbCanBurn?(nil,false)
- PBDebug.log("[Item triggered] #{i.pbThis}'s Flame Orb")
- i.pbBurn(nil,_INTL("{1} was burned by its {2}!",i.pbThis,PBItems.getName(i.item)))
- end
- # Sticky Barb
- if i.hasWorkingItem(:STICKYBARB) && !i.hasWorkingAbility(:MAGICGUARD)
- PBDebug.log("[Item triggered] #{i.pbThis}'s Sticky Barb")
- @scene.pbDamageAnimation(i,0)
- i.pbReduceHP((i.totalhp/8).floor)
- pbDisplay(_INTL("{1} is hurt by its {2}!",i.pbThis,PBItems.getName(i.item)))
- end
- if i.fainted?
- return if !i.pbFaint
- end
- end
- # Slow Start's end message
- if i.hasWorkingAbility(:SLOWSTART) && i.turncount==6
- pbDisplay(_INTL("{1} finally got its act together!",i.pbThis))
- end
- # Form checks
- for i in 0...4
- next if @battlers[i].fainted?
- @battlers[i].pbCheckForm
- end
- pbGainEXP
- pbSwitch
- return if @decision>0
- for i in priority
- next if i.fainted?
- i.pbAbilitiesOnSwitchIn(false)
- end
- # Healing Wish/Lunar Dance - should go here
- # Spikes/Toxic Spikes/Stealth Rock - should go here (in order of their 1st use)
- for i in 0...4
- if @battlers[i].turncount>0 && @battlers[i].hasWorkingAbility(:TRUANT)
- @battlers[i].effects[PBEffects::Truant]=!@battlers[i].effects[PBEffects::Truant]
- end
- if @battlers[i].effects[PBEffects::LockOn]>0 # Also Mind Reader
- @battlers[i].effects[PBEffects::LockOn]-=1
- @battlers[i].effects[PBEffects::LockOnPos]=-1 if @battlers[i].effects[PBEffects::LockOn]==0
- end
- @battlers[i].effects[PBEffects::Flinch]=false
- @battlers[i].effects[PBEffects::FollowMe]=0
- @battlers[i].effects[PBEffects::HelpingHand]=false
- @battlers[i].effects[PBEffects::MagicCoat]=false
- @battlers[i].effects[PBEffects::Snatch]=false
- @battlers[i].effects[PBEffects::Charge]-=1 if @battlers[i].effects[PBEffects::Charge]>0
- @battlers[i].lastHPLost=0
- @battlers[i].tookDamage=false
- @battlers[i].lastAttacker.clear
- @battlers[i].effects[PBEffects::Counter]=-1
- @battlers[i].effects[PBEffects::CounterTarget]=-1
- @battlers[i].effects[PBEffects::MirrorCoat]=-1
- @battlers[i].effects[PBEffects::MirrorCoatTarget]=-1
- if SPOWER
- if @battlers[i].effects[PBEffects::Distort] != 0
- @battlers[i].type1=PBTypes::PSYCHIC
- else
- @battlers[i].effects[PBEffects::Distort] -= 1
- end
- end
- if @battlers[i].effects[PBEffects::Dynamax] != 0
- @battlers[i].pbUndynamaxForFaint
- else
- @battlers[i].effects[PBEffects::Dynamax] -= 1
- end
- end
- for i in 0...2
- if !@sides[i].effects[PBEffects::EchoedVoiceUsed]
- @sides[i].effects[PBEffects::EchoedVoiceCounter]=0
- end
- @sides[i].effects[PBEffects::EchoedVoiceUsed]=false
- @sides[i].effects[PBEffects::MatBlock]= false
- @sides[i].effects[PBEffects::QuickGuard]=false
- @sides[i].effects[PBEffects::WideGuard]=false
- @sides[i].effects[PBEffects::CraftyShield]=false
- @sides[i].effects[PBEffects::Round]=0
- end
- @field.effects[PBEffects::FusionBolt]=false
- @field.effects[PBEffects::FusionFlare]=false
- @field.effects[PBEffects::IonDeluge]=false
- @field.effects[PBEffects::FairyLock]-=1 if @field.effects[PBEffects::FairyLock]>0
- # invalidate stored priority
- @usepriority=false
- end
- end
Add Comment
Please, Sign In to add comment