Advertisement
Guest User

Efectos de Movimientos (Pokemon Essentials)

a guest
Nov 30th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 367.95 KB | None | 0 0
  1. ################################################################################
  2. # Superclass that handles moves using a non-existent function code.
  3. # Damaging moves just do damage with no additional effect.
  4. # Non-damaging moves always fail.
  5. ################################################################################
  6. class PokeBattle_UnimplementedMove < PokeBattle_Move
  7.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8.     if pbIsDamaging?
  9.       return super(attacker,opponent,hitnum,alltargets,showanimation)
  10.     else
  11.       @battle.pbDisplay("But it failed!")
  12.       return -1
  13.     end
  14.   end
  15. end
  16.  
  17.  
  18.  
  19. ################################################################################
  20. # Superclass for a failed move. Always fails.
  21. # This class is unused.
  22. ################################################################################
  23. class PokeBattle_FailedMove < PokeBattle_Move
  24.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  25.     @battle.pbDisplay("But it failed!")
  26.     return -1
  27.   end
  28. end
  29.  
  30.  
  31.  
  32. ################################################################################
  33. # Pseudomove for confusion damage.
  34. ################################################################################
  35. class PokeBattle_Confusion < PokeBattle_Move
  36.   def initialize(battle,move)
  37.     @battle     = battle
  38.     @basedamage = 40
  39.     @type       = -1
  40.     @accuracy   = 100
  41.     @pp         = -1
  42.     @addlEffect = 0
  43.     @target     = 0
  44.     @priority   = 0
  45.     @flags      = 0
  46.     @thismove   = move
  47.     @name       = ""
  48.     @id         = 0
  49.   end
  50.  
  51.   def pbIsPhysical?(type); return true; end
  52.   def pbIsSpecial?(type); return false; end
  53.  
  54.   def pbCalcDamage(attacker,opponent)
  55.     return super(attacker,opponent,
  56.        PokeBattle_Move::NOCRITICAL|PokeBattle_Move::SELFCONFUSE|PokeBattle_Move::NOTYPE|PokeBattle_Move::NOWEIGHTING)
  57.   end
  58.  
  59.   def pbEffectMessages(attacker,opponent,ignoretype=false)
  60.     return super(attacker,opponent,true)
  61.   end
  62. end
  63.  
  64.  
  65.  
  66. ################################################################################
  67. # Implements the move Struggle.
  68. # For cases where the real move named Struggle is not defined.
  69. ################################################################################
  70. class PokeBattle_Struggle < PokeBattle_Move
  71.   def initialize(battle,move)
  72.     @id         = -1    # doesn't work if 0
  73.     @battle     = battle
  74.     @name       = _INTL("Struggle")
  75.     @basedamage = 50
  76.     @type       = -1
  77.     @accuracy   = 0
  78.     @addlEffect = 0
  79.     @target     = 0
  80.     @priority   = 0
  81.     @flags      = 0
  82.     @thismove   = nil   # not associated with a move
  83.     @pp         = -1
  84.     @totalpp    = 0
  85.     if move
  86.       @id = move.id
  87.       @name = PBMoves.getName(id)
  88.     end
  89.   end
  90.  
  91.   def pbIsPhysical?(type); return true; end
  92.   def pbIsSpecial?(type); return false; end
  93.  
  94.   def pbEffectAfterHit(attacker,opponent,turneffects)
  95.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  96.       attacker.pbReduceHP((attacker.totalhp/4.0).round)
  97.       @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  98.     end
  99.   end
  100.  
  101.   def pbCalcDamage(attacker,opponent)
  102.     return super(attacker,opponent,PokeBattle_Move::IGNOREPKMNTYPES)
  103.   end
  104. end
  105.  
  106.  
  107.  
  108. ################################################################################
  109. # No additional effect.
  110. ################################################################################
  111. class PokeBattle_Move_000 < PokeBattle_Move
  112. end
  113.  
  114.  
  115.  
  116. ################################################################################
  117. # Does absolutely nothing. (Splash)
  118. ################################################################################
  119. class PokeBattle_Move_001 < PokeBattle_Move
  120.   def unusableInGravity?
  121.     return true
  122.   end
  123.  
  124.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  125.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  126.     @battle.pbDisplay(_INTL("But nothing happened!"))
  127.     return 0
  128.   end
  129. end
  130.  
  131.  
  132.  
  133. ################################################################################
  134. # Struggle. Overrides the default Struggle effect above.
  135. ################################################################################
  136. class PokeBattle_Move_002 < PokeBattle_Struggle
  137. end
  138.  
  139.  
  140.  
  141. ################################################################################
  142. # Puts the target to sleep.
  143. ################################################################################
  144. class PokeBattle_Move_003 < PokeBattle_Move
  145.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  146.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  147.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  148.     if opponent.pbCanSleep?(attacker,true,self)
  149.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  150.       opponent.pbSleep
  151.       return 0
  152.     end
  153.     return -1
  154.   end
  155.  
  156.   def pbAdditionalEffect(attacker,opponent)
  157.     return if opponent.damagestate.substitute
  158.     if opponent.pbCanSleep?(attacker,false,self)
  159.       opponent.pbSleep
  160.     end
  161.   end
  162.  
  163.   def pbEffectAfterHit(attacker,opponent,turneffects)
  164.     if isConst?(@id,PBMoves,:RELICSONG)
  165.       if isConst?(attacker.species,PBSpecies,:MELOETTA) &&
  166.          !attacker.effects[PBEffects::Transform] &&
  167.          !(attacker.hasWorkingAbility(:SHEERFORCE) && self.addlEffect>0) &&
  168.          !attacker.fainted?
  169.         attacker.form=(attacker.form+1)%2
  170.         attacker.pbUpdate(true)
  171.         @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  172.         @battle.pbDisplay(_INTL("{1} transformed!",attacker.pbThis))
  173.         PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
  174.       end
  175.     end
  176.   end
  177. end
  178.  
  179.  
  180.  
  181. ################################################################################
  182. # Makes the target drowsy; it will fall asleep at the end of the next turn. (Yawn)
  183. ################################################################################
  184. class PokeBattle_Move_004 < PokeBattle_Move
  185.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  186.     return -1 if !opponent.pbCanSleep?(attacker,true,self)
  187.     if opponent.effects[PBEffects::Yawn]>0
  188.       @battle.pbDisplay(_INTL("But it failed!"))
  189.       return -1
  190.     end
  191.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  192.     opponent.effects[PBEffects::Yawn]=2
  193.     @battle.pbDisplay(_INTL("{1} made {2} drowsy!",attacker.pbThis,opponent.pbThis(true)))
  194.     return 0
  195.   end
  196. end
  197.  
  198.  
  199.  
  200. ################################################################################
  201. # Poisons the target.
  202. ################################################################################
  203. class PokeBattle_Move_005 < PokeBattle_Move
  204.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  205.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  206.     return -1 if !opponent.pbCanPoison?(attacker,true,self)
  207.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  208.     opponent.pbPoison(attacker)
  209.     return 0
  210.   end
  211.  
  212.   def pbAdditionalEffect(attacker,opponent)
  213.     return if opponent.damagestate.substitute
  214.     if opponent.pbCanPoison?(attacker,false,self)
  215.       opponent.pbPoison(attacker)
  216.     end
  217.   end
  218. end
  219.  
  220.  
  221.  
  222. ################################################################################
  223. # Badly poisons the target. (Poison Fang, Toxic)
  224. # (Handled in Battler's pbSuccessCheck): Hits semi-invulnerable targets if user
  225. # is Poison-type and move is status move.
  226. ################################################################################
  227. class PokeBattle_Move_006 < PokeBattle_Move
  228.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  229.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  230.     return -1 if !opponent.pbCanPoison?(attacker,true,self)
  231.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  232.     opponent.pbPoison(attacker,nil,true)
  233.     return 0
  234.   end
  235.  
  236.   def pbAdditionalEffect(attacker,opponent)
  237.     return if opponent.damagestate.substitute
  238.     if opponent.pbCanPoison?(attacker,false,self)
  239.       opponent.pbPoison(attacker,nil,true)
  240.     end
  241.   end
  242. end
  243.  
  244.  
  245.  
  246. ################################################################################
  247. # Paralyzes the target.
  248. # Thunder Wave: Doesn't affect target if move's type has no effect on it.
  249. # Bolt Strike: Powers up the next Fusion Flare used this round.
  250. ################################################################################
  251. class PokeBattle_Move_007 < PokeBattle_Move
  252.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  253.     if pbIsDamaging?
  254.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  255.       if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BOLTSTRIKE)
  256.         @battle.field.effects[PBEffects::FusionFlare]=true
  257.       end
  258.       return ret
  259.     else
  260.       if isConst?(@id,PBMoves,:THUNDERWAVE)
  261.         if pbTypeModifier(type,attacker,opponent)==0
  262.           @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  263.           return -1
  264.         end
  265.       end
  266.       return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  267.       return -1 if !opponent.pbCanParalyze?(attacker,true,self)
  268.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  269.       opponent.pbParalyze(attacker)
  270.       return 0
  271.     end
  272.     return -1
  273.   end
  274.  
  275.   def pbAdditionalEffect(attacker,opponent)
  276.     return if opponent.damagestate.substitute
  277.     if opponent.pbCanParalyze?(attacker,false,self)
  278.       opponent.pbParalyze(attacker)
  279.     end
  280.   end
  281. end
  282.  
  283.  
  284.  
  285. ################################################################################
  286. # Paralyzes the target. Accuracy perfect in rain, 50% in sunshine. (Thunder)
  287. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  288. ################################################################################
  289. class PokeBattle_Move_008 < PokeBattle_Move
  290.   def pbAdditionalEffect(attacker,opponent)
  291.     return if opponent.damagestate.substitute
  292.     if opponent.pbCanParalyze?(attacker,false,self)
  293.       opponent.pbParalyze(attacker)
  294.     end
  295.   end
  296.  
  297.   def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  298.     case @battle.pbWeather
  299.     when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  300.       return 0
  301.     when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  302.       return 50
  303.     end
  304.     return baseaccuracy
  305.   end
  306. end
  307.  
  308.  
  309.  
  310. ################################################################################
  311. # Paralyzes the target. May cause the target to flinch. (Thunder Fang)
  312. ################################################################################
  313. class PokeBattle_Move_009 < PokeBattle_Move
  314.   def pbAdditionalEffect(attacker,opponent)
  315.     return if opponent.damagestate.substitute
  316.     if @battle.pbRandom(10)==0
  317.       if opponent.pbCanParalyze?(attacker,false,self)
  318.         opponent.pbParalyze(attacker)
  319.       end
  320.     end
  321.     if @battle.pbRandom(10)==0
  322.       opponent.pbFlinch(attacker)
  323.     end
  324.   end
  325. end
  326.  
  327.  
  328.  
  329. ################################################################################
  330. # Burns the target.
  331. # Blue Flare: Powers up the next Fusion Bolt used this round.
  332. ################################################################################
  333. class PokeBattle_Move_00A < PokeBattle_Move
  334.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  335.     if pbIsDamaging?
  336.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  337.       if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BLUEFLARE)
  338.         @battle.field.effects[PBEffects::FusionBolt]=true
  339.       end
  340.       return ret
  341.     else
  342.       return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  343.       return -1 if !opponent.pbCanBurn?(attacker,true,self)
  344.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  345.       opponent.pbBurn(attacker)
  346.       return 0
  347.     end
  348.     return -1
  349.   end
  350.  
  351.   def pbAdditionalEffect(attacker,opponent)
  352.     return if opponent.damagestate.substitute
  353.     if opponent.pbCanBurn?(attacker,false,self)
  354.       opponent.pbBurn(attacker)
  355.     end
  356.   end
  357. end
  358.  
  359.  
  360.  
  361. ################################################################################
  362. # Burns the target. May cause the target to flinch. (Fire Fang)
  363. ################################################################################
  364. class PokeBattle_Move_00B < PokeBattle_Move
  365.   def pbAdditionalEffect(attacker,opponent)
  366.     return if opponent.damagestate.substitute
  367.     if @battle.pbRandom(10)==0
  368.       if opponent.pbCanBurn?(attacker,false,self)
  369.         opponent.pbBurn(attacker)
  370.       end
  371.     end
  372.     if @battle.pbRandom(10)==0
  373.       opponent.pbFlinch(attacker)
  374.     end
  375.   end
  376. end
  377.  
  378.  
  379.  
  380. ################################################################################
  381. # Freezes the target.
  382. ################################################################################
  383. class PokeBattle_Move_00C < PokeBattle_Move
  384.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  385.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  386.     return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  387.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  388.     opponent.pbFreeze
  389.     return 0
  390.   end
  391.  
  392.   def pbAdditionalEffect(attacker,opponent)
  393.     return if opponent.damagestate.substitute
  394.     if opponent.pbCanFreeze?(attacker,false,self)
  395.       opponent.pbFreeze
  396.     end
  397.   end
  398. end
  399.  
  400.  
  401.  
  402. ################################################################################
  403. # Freezes the target. Accuracy perfect in hail. (Blizzard)
  404. ################################################################################
  405. class PokeBattle_Move_00D < PokeBattle_Move
  406.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  407.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  408.     return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  409.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  410.     opponent.pbFreeze
  411.     return 0
  412.   end
  413.  
  414.   def pbAdditionalEffect(attacker,opponent)
  415.     return if opponent.damagestate.substitute
  416.     if opponent.pbCanFreeze?(attacker,false,self)
  417.       opponent.pbFreeze
  418.     end
  419.   end
  420.  
  421.   def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  422.     if @battle.pbWeather==PBWeather::HAIL
  423.       return 0
  424.     end
  425.     return baseaccuracy
  426.   end
  427. end
  428.  
  429.  
  430.  
  431. ################################################################################
  432. # Freezes the target. May cause the target to flinch. (Ice Fang)
  433. ################################################################################
  434. class PokeBattle_Move_00E < PokeBattle_Move
  435.   def pbAdditionalEffect(attacker,opponent)
  436.     return if opponent.damagestate.substitute
  437.     if @battle.pbRandom(10)==0
  438.       if opponent.pbCanFreeze?(attacker,false,self)
  439.         opponent.pbFreeze
  440.       end
  441.     end
  442.     if @battle.pbRandom(10)==0
  443.       opponent.pbFlinch(attacker)
  444.     end
  445.   end
  446. end
  447.  
  448.  
  449.  
  450. ################################################################################
  451. # Causes the target to flinch.
  452. ################################################################################
  453. class PokeBattle_Move_00F < PokeBattle_Move
  454.   def pbAdditionalEffect(attacker,opponent)
  455.     return if opponent.damagestate.substitute
  456.     opponent.pbFlinch(attacker)
  457.   end
  458. end
  459.  
  460.  
  461.  
  462. ################################################################################
  463. # Causes the target to flinch. Does double damage and has perfect accuracy if
  464. # the target is Minimized.
  465. ################################################################################
  466. class PokeBattle_Move_010 < PokeBattle_Move
  467.   def pbAdditionalEffect(attacker,opponent)
  468.     return if opponent.damagestate.substitute
  469.     opponent.pbFlinch(attacker)
  470.   end
  471.  
  472.   def tramplesMinimize?(param=1)
  473.     return false if isConst?(@id,PBMoves,:DRAGONRUSH) && !USENEWBATTLEMECHANICS
  474.     return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  475.     return true if param==2 # Double damage
  476.     return false
  477.   end
  478. end
  479.  
  480.  
  481.  
  482. ################################################################################
  483. # Causes the target to flinch. Fails if the user is not asleep. (Snore)
  484. ################################################################################
  485. class PokeBattle_Move_011 < PokeBattle_Move
  486.   def pbCanUseWhileAsleep?
  487.     return true
  488.   end
  489.  
  490.   def pbMoveFailed(attacker,opponent)
  491.     return (attacker.status!=PBStatuses::SLEEP)
  492.   end
  493.  
  494.   def pbAdditionalEffect(attacker,opponent)
  495.     return if opponent.damagestate.substitute
  496.     opponent.pbFlinch(attacker)
  497.   end
  498. end
  499.  
  500.  
  501.  
  502. ################################################################################
  503. # Causes the target to flinch. Fails if this isn't the user's first turn. (Fake Out)
  504. ################################################################################
  505. class PokeBattle_Move_012 < PokeBattle_Move
  506.   def pbMoveFailed(attacker,opponent)
  507.     return (attacker.turncount>1)
  508.   end
  509.  
  510.   def pbAdditionalEffect(attacker,opponent)
  511.     return if opponent.damagestate.substitute
  512.     opponent.pbFlinch(attacker)
  513.   end
  514. end
  515.  
  516.  
  517.  
  518. ################################################################################
  519. # Confuses the target.
  520. ################################################################################
  521. class PokeBattle_Move_013 < PokeBattle_Move
  522.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  523.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  524.     if opponent.pbCanConfuse?(attacker,true,self)
  525.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  526.       opponent.pbConfuse
  527.       @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  528.       return 0
  529.     end
  530.     return -1
  531.   end
  532.  
  533.   def pbAdditionalEffect(attacker,opponent)
  534.     return if opponent.damagestate.substitute
  535.     if opponent.pbCanConfuse?(attacker,false,self)
  536.       opponent.pbConfuse
  537.       @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  538.     end
  539.   end
  540. end
  541.  
  542.  
  543.  
  544. ################################################################################
  545. # Confuses the target. Chance of causing confusion depends on the cry's volume.
  546. # Confusion chance is 0% if user doesn't have a recorded cry. (Chatter)
  547. # TODO: Play the actual chatter cry as part of the move animation
  548. #       @battle.scene.pbChatter(attacker,opponent) # Just plays cry
  549. ################################################################################
  550. class PokeBattle_Move_014 < PokeBattle_Move
  551.   def addlEffect
  552.     return 100 if USENEWBATTLEMECHANICS
  553.     if attacker.pokemon && attacker.pokemon.chatter
  554.       return attacker.pokemon.chatter.intensity*10/127
  555.     end
  556.     return 0
  557.   end
  558.  
  559.   def pbAdditionalEffect(attacker,opponent)
  560.     return if opponent.damagestate.substitute
  561.     if opponent.pbCanConfuse?(attacker,false,self)
  562.       opponent.pbConfuse
  563.       @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  564.     end
  565.   end
  566. end
  567.  
  568.  
  569.  
  570. ################################################################################
  571. # Confuses the target. Accuracy perfect in rain, 50% in sunshine. (Hurricane)
  572. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  573. ################################################################################
  574. class PokeBattle_Move_015 < PokeBattle_Move
  575.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  576.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  577.     if opponent.pbCanConfuse?(attacker,true,self)
  578.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  579.       opponent.pbConfuse
  580.       @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  581.       return 0
  582.     end
  583.     return -1
  584.   end
  585.  
  586.   def pbAdditionalEffect(attacker,opponent)
  587.     return if opponent.damagestate.substitute
  588.     if opponent.pbCanConfuse?(attacker,false,self)
  589.       opponent.pbConfuse
  590.       @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  591.     end
  592.   end
  593.  
  594.   def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  595.     case @battle.pbWeather
  596.     when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  597.       return 0
  598.     when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  599.       return 50
  600.     end
  601.     return baseaccuracy
  602.   end
  603. end
  604.  
  605.  
  606.  
  607. ################################################################################
  608. # Attracts the target. (Attract)
  609. ################################################################################
  610. class PokeBattle_Move_016 < PokeBattle_Move
  611.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  612.     if !opponent.pbCanAttract?(attacker)
  613.       return -1
  614.     end
  615.     if !attacker.hasMoldBreaker
  616.       if opponent.hasWorkingAbility(:AROMAVEIL)
  617.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  618.            opponent.pbThis,PBAbilities.getName(opponent.ability)))
  619.         return -1
  620.       elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  621.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  622.            opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  623.         return -1
  624.       end
  625.     end
  626.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  627.     opponent.pbAttract(attacker)
  628.     return 0
  629.   end
  630. end
  631.  
  632.  
  633.  
  634. ################################################################################
  635. # Burns, freezes or paralyzes the target. (Tri Attack)
  636. ################################################################################
  637. class PokeBattle_Move_017 < PokeBattle_Move
  638.   def pbAdditionalEffect(attacker,opponent)
  639.     return if opponent.damagestate.substitute
  640.     case @battle.pbRandom(3)
  641.     when 0
  642.       if opponent.pbCanBurn?(attacker,false,self)
  643.         opponent.pbBurn(attacker)
  644.       end
  645.     when 1
  646.       if opponent.pbCanFreeze?(attacker,false,self)
  647.         opponent.pbFreeze
  648.       end
  649.     when 2
  650.       if opponent.pbCanParalyze?(attacker,false,self)
  651.         opponent.pbParalyze(attacker)
  652.       end
  653.     end
  654.   end
  655. end
  656.  
  657.  
  658.  
  659. ################################################################################
  660. # Cures user of burn, poison and paralysis. (Refresh)
  661. ################################################################################
  662. class PokeBattle_Move_018 < PokeBattle_Move
  663.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  664.     if attacker.status!=PBStatuses::BURN &&
  665.        attacker.status!=PBStatuses::POISON &&
  666.        attacker.status!=PBStatuses::PARALYSIS
  667.       @battle.pbDisplay(_INTL("But it failed!"))
  668.       return -1
  669.     else
  670.       t=attacker.status
  671.       attacker.pbCureStatus(false)
  672.       pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  673.       if t==PBStatuses::BURN
  674.         @battle.pbDisplay(_INTL("{1} healed its burn!",attacker.pbThis))  
  675.       elsif t==PBStatuses::POISON
  676.         @battle.pbDisplay(_INTL("{1} cured its poisoning!",attacker.pbThis))  
  677.       elsif t==PBStatuses::PARALYSIS
  678.         @battle.pbDisplay(_INTL("{1} cured its paralysis!",attacker.pbThis))  
  679.       end
  680.       return 0
  681.     end
  682.   end
  683. end
  684.  
  685.  
  686.  
  687. ################################################################################
  688. # Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
  689. ################################################################################
  690. class PokeBattle_Move_019 < PokeBattle_Move
  691.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  692.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  693.     if isConst?(@id,PBMoves,:AROMATHERAPY)
  694.       @battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
  695.     else
  696.       @battle.pbDisplay(_INTL("A bell chimed!"))
  697.     end
  698.     activepkmn=[]
  699.     for i in @battle.battlers
  700.       next if attacker.pbIsOpposing?(i.index) || i.fainted?
  701.       activepkmn.push(i.pokemonIndex)
  702.       next if USENEWBATTLEMECHANICS && i.index!=attacker.index &&
  703.          pbTypeImmunityByAbility(pbType(@type,attacker,i),attacker,i)
  704.       case i.status
  705.       when PBStatuses::PARALYSIS
  706.         @battle.pbDisplay(_INTL("{1} was cured of paralysis.",i.pbThis))
  707.       when PBStatuses::SLEEP
  708.         @battle.pbDisplay(_INTL("{1}'s sleep was woken.",i.pbThis))
  709.       when PBStatuses::POISON
  710.         @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",i.pbThis))
  711.       when PBStatuses::BURN
  712.         @battle.pbDisplay(_INTL("{1}'s burn was healed.",i.pbThis))
  713.       when PBStatuses::FROZEN
  714.         @battle.pbDisplay(_INTL("{1} was thawed out.",i.pbThis))
  715.       end
  716.       i.pbCureStatus(false)
  717.     end
  718.     party=@battle.pbParty(attacker.index) # NOTE: Considers both parties in multi battles
  719.     for i in 0...party.length
  720.       next if activepkmn.include?(i)
  721.       next if !party[i] || party[i].egg? || party[i].hp<=0
  722.       case party[i].status
  723.       when PBStatuses::PARALYSIS
  724.         @battle.pbDisplay(_INTL("{1} was cured of paralysis.",party[i].name))
  725.       when PBStatuses::SLEEP
  726.         @battle.pbDisplay(_INTL("{1} was woken from its sleep.",party[i].name))
  727.       when PBStatuses::POISON
  728.         @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",party[i].name))
  729.       when PBStatuses::BURN
  730.         @battle.pbDisplay(_INTL("{1}'s burn was healed.",party[i].name))
  731.       when PBStatuses::FROZEN
  732.         @battle.pbDisplay(_INTL("{1} was thawed out.",party[i].name))
  733.       end
  734.       party[i].status=0
  735.       party[i].statusCount=0
  736.     end
  737.     return 0
  738.   end
  739. end
  740.  
  741.  
  742.  
  743. ################################################################################
  744. # Safeguards the user's side from being inflicted with status problems. (Safeguard)
  745. ################################################################################
  746. class PokeBattle_Move_01A < PokeBattle_Move
  747.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  748.     if attacker.pbOwnSide.effects[PBEffects::Safeguard]>0
  749.       @battle.pbDisplay(_INTL("But it failed!"))
  750.       return -1
  751.     end
  752.     attacker.pbOwnSide.effects[PBEffects::Safeguard]=5
  753.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  754.     if !@battle.pbIsOpposing?(attacker.index)
  755.       @battle.pbDisplay(_INTL("Your team became cloaked in a mystical veil!"))
  756.     else
  757.       @battle.pbDisplay(_INTL("The opposing team became cloaked in a mystical veil!"))
  758.     end
  759.     return 0
  760.   end
  761. end
  762.  
  763.  
  764.  
  765. ################################################################################
  766. # User passes its status problem to the target. (Psycho Shift)
  767. ################################################################################
  768. class PokeBattle_Move_01B < PokeBattle_Move
  769.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  770.     if attacker.status==0 ||
  771.       (attacker.status==PBStatuses::PARALYSIS && !opponent.pbCanParalyze?(attacker,false,self)) ||
  772.       (attacker.status==PBStatuses::SLEEP && !opponent.pbCanSleep?(attacker,false,self)) ||
  773.       (attacker.status==PBStatuses::POISON && !opponent.pbCanPoison?(attacker,false,self)) ||
  774.       (attacker.status==PBStatuses::BURN && !opponent.pbCanBurn?(attacker,false,self)) ||
  775.       (attacker.status==PBStatuses::FROZEN && !opponent.pbCanFreeze?(attacker,false,self))
  776.       @battle.pbDisplay(_INTL("But it failed!"))
  777.       return -1
  778.     end
  779.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  780.     case attacker.status
  781.     when PBStatuses::PARALYSIS
  782.       opponent.pbParalyze(attacker)
  783.       opponent.pbAbilityCureCheck
  784.       attacker.pbCureStatus(false)
  785.       @battle.pbDisplay(_INTL("{1} was cured of paralysis.",attacker.pbThis))
  786.     when PBStatuses::SLEEP
  787.       opponent.pbSleep
  788.       opponent.pbAbilityCureCheck
  789.       attacker.pbCureStatus(false)
  790.       @battle.pbDisplay(_INTL("{1} woke up.",attacker.pbThis))
  791.     when PBStatuses::POISON
  792.       opponent.pbPoison(attacker,nil,attacker.statusCount!=0)
  793.       opponent.pbAbilityCureCheck
  794.       attacker.pbCureStatus(false)
  795.       @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  796.     when PBStatuses::BURN
  797.       opponent.pbBurn(attacker)
  798.       opponent.pbAbilityCureCheck
  799.       attacker.pbCureStatus(false)
  800.       @battle.pbDisplay(_INTL("{1}'s burn was healed.",attacker.pbThis))
  801.     when PBStatuses::FROZEN
  802.       opponent.pbFreeze
  803.       opponent.pbAbilityCureCheck
  804.       attacker.pbCureStatus(false)
  805.       @battle.pbDisplay(_INTL("{1} was thawed out.",attacker.pbThis))
  806.     end
  807.     return 0
  808.   end
  809. end
  810.  
  811.  
  812.  
  813. ################################################################################
  814. # Increases the user's Attack by 1 stage.
  815. ################################################################################
  816. class PokeBattle_Move_01C < PokeBattle_Move
  817.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  818.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  819.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  820.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  821.     ret=attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  822.     return ret ? 0 : -1
  823.   end
  824.  
  825.   def pbAdditionalEffect(attacker,opponent)
  826.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  827.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  828.     end
  829.   end
  830. end
  831.  
  832.  
  833.  
  834. ################################################################################
  835. # Increases the user's Defense by 1 stage.
  836. ################################################################################
  837. class PokeBattle_Move_01D < PokeBattle_Move
  838.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  839.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  840.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  841.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  842.     ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  843.     return ret ? 0 : -1
  844.   end
  845.  
  846.   def pbAdditionalEffect(attacker,opponent)
  847.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  848.       attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  849.     end
  850.   end
  851. end
  852.  
  853.  
  854.  
  855. ################################################################################
  856. # Increases the user's Defense by 1 stage. User curls up. (Defense Curl)
  857. ################################################################################
  858. class PokeBattle_Move_01E < PokeBattle_Move
  859.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  860.     attacker.effects[PBEffects::DefenseCurl]=true
  861.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  862.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  863.     ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  864.     return ret ? 0 : -1
  865.   end
  866. end
  867.  
  868.  
  869.  
  870. ################################################################################
  871. # Increases the user's Speed by 1 stage.
  872. ################################################################################
  873. class PokeBattle_Move_01F < PokeBattle_Move
  874.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  875.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  876.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  877.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  878.     ret=attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  879.     return ret ? 0 : -1
  880.   end
  881.  
  882.   def pbAdditionalEffect(attacker,opponent)
  883.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  884.       attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  885.     end
  886.   end
  887. end
  888.  
  889.  
  890.  
  891. ################################################################################
  892. # Increases the user's Special Attack by 1 stage.
  893. ################################################################################
  894. class PokeBattle_Move_020 < PokeBattle_Move
  895.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  896.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  897.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  898.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  899.     ret=attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  900.     return ret ? 0 : -1
  901.   end
  902.  
  903.   def pbAdditionalEffect(attacker,opponent)
  904.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  905.       attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  906.     end
  907.   end
  908. end
  909.  
  910.  
  911.  
  912. ################################################################################
  913. # Increases the user's Special Defense by 1 stage.
  914. # Charges up user's next attack if it is Electric-type. (Charge)
  915. ################################################################################
  916. class PokeBattle_Move_021 < PokeBattle_Move
  917.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  918.     attacker.effects[PBEffects::Charge]=2
  919.     @battle.pbDisplay(_INTL("{1} began charging power!",attacker.pbThis))
  920.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  921.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  922.       attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  923.     end
  924.     return 0
  925.   end
  926. end
  927.  
  928.  
  929.  
  930. ################################################################################
  931. # Increases the user's evasion by 1 stage.
  932. ################################################################################
  933. class PokeBattle_Move_022 < PokeBattle_Move
  934.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  935.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  936.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  937.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  938.     ret=attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  939.     return ret ? 0 : -1
  940.   end
  941.  
  942.   def pbAdditionalEffect(attacker,opponent)
  943.     if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  944.       attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  945.     end
  946.   end
  947. end
  948.  
  949.  
  950.  
  951. ################################################################################
  952. # Increases the user's critical hit rate. (Focus Energy)
  953. ################################################################################
  954. class PokeBattle_Move_023 < PokeBattle_Move
  955.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  956.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  957.     if attacker.effects[PBEffects::FocusEnergy]>=2
  958.       @battle.pbDisplay(_INTL("¡Pero falló!"))
  959.       return -1
  960.     end
  961.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  962.     attacker.effects[PBEffects::FocusEnergy]=2
  963.     @battle.pbDisplay(_INTL("¡{1} se está preparando para luchar!",attacker.pbThis))
  964.     return 0
  965.   end
  966.  
  967.   def pbAdditionalEffect(attacker,opponent)
  968.     if attacker.effects[PBEffects::FocusEnergy]<2
  969.       attacker.effects[PBEffects::FocusEnergy]=2
  970.       @battle.pbDisplay(_INTL("¡{1} se está preparando para luchar!",attacker.pbThis))
  971.     end
  972.   end
  973. end
  974.  
  975.  
  976.  
  977. ################################################################################
  978. # Increases the user's Attack and Defense by 1 stage each. (Bulk Up)
  979. ################################################################################
  980. class PokeBattle_Move_024 < PokeBattle_Move
  981.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  982.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  983.        !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  984.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  985.       return -1
  986.     end
  987.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  988.     showanim=true
  989.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  990.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  991.       showanim=false
  992.     end
  993.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  994.       attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  995.       showanim=false
  996.     end
  997.     return 0
  998.   end
  999. end
  1000.  
  1001.  
  1002.  
  1003. ################################################################################
  1004. # Increases the user's Attack, Defense and accuracy by 1 stage each. (Coil)
  1005. ################################################################################
  1006. class PokeBattle_Move_025 < PokeBattle_Move
  1007.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1008.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1009.        !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1010.        !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1011.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1012.       return -1
  1013.     end
  1014.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1015.     showanim=true
  1016.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1017.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1018.       showanim=false
  1019.     end
  1020.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1021.       attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1022.       showanim=false
  1023.     end
  1024.     if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1025.       attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1026.       showanim=false
  1027.     end
  1028.     return 0
  1029.   end
  1030. end
  1031.  
  1032.  
  1033.  
  1034. ################################################################################
  1035. # Increases the user's Attack and Speed by 1 stage each. (Dragon Dance)
  1036. ################################################################################
  1037. class PokeBattle_Move_026 < PokeBattle_Move
  1038.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1039.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1040.        !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1041.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1042.       return -1
  1043.     end
  1044.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1045.     showanim=true
  1046.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1047.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1048.       showanim=false
  1049.     end
  1050.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1051.       attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1052.       showanim=false
  1053.     end
  1054.     return 0
  1055.   end
  1056. end
  1057.  
  1058.  
  1059.  
  1060. ################################################################################
  1061. # Increases the user's Attack and Special Attack by 1 stage each. (Work Up)
  1062. ################################################################################
  1063. class PokeBattle_Move_027 < PokeBattle_Move
  1064.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1065.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1066.        !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1067.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1068.       return -1
  1069.     end
  1070.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1071.     showanim=true
  1072.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1073.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1074.       showanim=false
  1075.     end
  1076.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1077.       attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1078.       showanim=false
  1079.     end
  1080.     return 0
  1081.   end
  1082. end
  1083.  
  1084.  
  1085.  
  1086. ################################################################################
  1087. # Increases the user's Attack and Sp. Attack by 1 stage each.
  1088. # In sunny weather, increase is 2 stages each instead. (Growth)
  1089. ################################################################################
  1090. class PokeBattle_Move_028 < PokeBattle_Move
  1091.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1092.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1093.        !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1094.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1095.       return -1
  1096.     end
  1097.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1098.     showanim=true
  1099.     increment=1
  1100.     if @battle.pbWeather==PBWeather::SUNNYDAY ||
  1101.        @battle.pbWeather==PBWeather::HARSHSUN
  1102.       increment=2
  1103.     end
  1104.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1105.       attacker.pbIncreaseStat(PBStats::ATTACK,increment,attacker,false,self,showanim)
  1106.       showanim=false
  1107.     end
  1108.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1109.       attacker.pbIncreaseStat(PBStats::SPATK,increment,attacker,false,self,showanim)
  1110.       showanim=false
  1111.     end
  1112.     return 0
  1113.   end
  1114. end
  1115.  
  1116.  
  1117.  
  1118. ################################################################################
  1119. # Increases the user's Attack and accuracy by 1 stage each. (Hone Claws)
  1120. ################################################################################
  1121. class PokeBattle_Move_029 < PokeBattle_Move
  1122.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1123.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1124.        !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1125.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1126.       return -1
  1127.     end
  1128.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1129.     showanim=true
  1130.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1131.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1132.       showanim=false
  1133.     end
  1134.     if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1135.       attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1136.       showanim=false
  1137.     end
  1138.     return 0
  1139.   end
  1140. end
  1141.  
  1142.  
  1143.  
  1144. ################################################################################
  1145. # Increases the user's Defense and Special Defense by 1 stage each. (Cosmic Power)
  1146. ################################################################################
  1147. class PokeBattle_Move_02A < PokeBattle_Move
  1148.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1149.     if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1150.        !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1151.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1152.       return -1
  1153.     end
  1154.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1155.     showanim=true
  1156.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1157.       attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1158.       showanim=false
  1159.     end
  1160.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1161.       attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1162.       showanim=false
  1163.     end
  1164.     return 0
  1165.   end
  1166. end
  1167.  
  1168.  
  1169.  
  1170. ################################################################################
  1171. # Increases the user's Sp. Attack, Sp. Defense and Speed by 1 stage each. (Quiver Dance)
  1172. ################################################################################
  1173. class PokeBattle_Move_02B < PokeBattle_Move
  1174.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1175.     if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1176.        !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  1177.        !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1178.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1179.       return -1
  1180.     end
  1181.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1182.     showanim=true
  1183.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1184.       attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1185.       showanim=false
  1186.     end
  1187.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1188.       attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1189.       showanim=false
  1190.     end
  1191.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1192.       attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1193.       showanim=false
  1194.     end
  1195.     return 0
  1196.   end
  1197. end
  1198.  
  1199.  
  1200.  
  1201. ################################################################################
  1202. # Increases the user's Sp. Attack and Sp. Defense by 1 stage each. (Calm Mind)
  1203. ################################################################################
  1204. class PokeBattle_Move_02C < PokeBattle_Move
  1205.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1206.     if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1207.        !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1208.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1209.       return -1
  1210.     end
  1211.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1212.     showanim=true
  1213.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1214.       attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1215.       showanim=false
  1216.     end
  1217.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1218.       attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1219.       showanim=false
  1220.     end
  1221.     return 0
  1222.   end
  1223. end
  1224.  
  1225.  
  1226.  
  1227. ################################################################################
  1228. # Increases the user's Attack, Defense, Speed, Special Attack and Special Defense
  1229. # by 1 stage each. (AncientPower, Ominous Wind, Silver Wind)
  1230. ################################################################################
  1231. class PokeBattle_Move_02D < PokeBattle_Move
  1232.   def pbAdditionalEffect(attacker,opponent)
  1233.     showanim=true
  1234.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1235.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1236.       showanim=false
  1237.     end
  1238.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1239.       attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1240.       showanim=false
  1241.     end
  1242.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1243.       attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1244.       showanim=false
  1245.     end
  1246.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1247.       attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1248.       showanim=false
  1249.     end
  1250.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1251.       attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1252.       showanim=false
  1253.     end
  1254.   end
  1255. end
  1256.  
  1257.  
  1258.  
  1259. ################################################################################
  1260. # Increases the user's Attack by 2 stages.
  1261. ################################################################################
  1262. class PokeBattle_Move_02E < PokeBattle_Move
  1263.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1264.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1265.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  1266.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1267.     ret=attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1268.     return ret ? 0 : -1
  1269.   end
  1270.  
  1271.   def pbAdditionalEffect(attacker,opponent)
  1272.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1273.       attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1274.     end
  1275.   end
  1276. end
  1277.  
  1278.  
  1279.  
  1280. ################################################################################
  1281. # Increases the user's Defense by 2 stages.
  1282. ################################################################################
  1283. class PokeBattle_Move_02F < PokeBattle_Move
  1284.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1285.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1286.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1287.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1288.     ret=attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1289.     return ret ? 0 : -1
  1290.   end
  1291.  
  1292.   def pbAdditionalEffect(attacker,opponent)
  1293.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1294.       attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1295.     end
  1296.   end
  1297. end
  1298.  
  1299.  
  1300.  
  1301. ################################################################################
  1302. # Increases the user's Speed by 2 stages.
  1303. ################################################################################
  1304. class PokeBattle_Move_030 < PokeBattle_Move
  1305.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1306.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1307.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1308.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1309.     ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1310.     return ret ? 0 : -1
  1311.   end
  1312.  
  1313.   def pbAdditionalEffect(attacker,opponent)
  1314.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1315.       attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1316.     end
  1317.   end
  1318. end
  1319.  
  1320.  
  1321.  
  1322. ################################################################################
  1323. # Increases the user's Speed by 2 stages. Lowers user's weight by 100kg. (Autotomize)
  1324. ################################################################################
  1325. class PokeBattle_Move_031 < PokeBattle_Move
  1326.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1327.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1328.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1329.     ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1330.     if ret
  1331.       attacker.effects[PBEffects::WeightChange]-=1000
  1332.       @battle.pbDisplay(_INTL("{1} became nimble!",attacker.pbThis))
  1333.     end
  1334.     return ret ? 0 : -1
  1335.   end
  1336. end
  1337.  
  1338.  
  1339.  
  1340. ################################################################################
  1341. # Increases the user's Special Attack by 2 stages.
  1342. ################################################################################
  1343. class PokeBattle_Move_032 < PokeBattle_Move
  1344.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1345.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1346.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1347.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1348.     ret=attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1349.     return ret ? 0 : -1
  1350.   end
  1351.  
  1352.   def pbAdditionalEffect(attacker,opponent)
  1353.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1354.       attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1355.     end
  1356.   end
  1357. end
  1358.  
  1359.  
  1360.  
  1361. ################################################################################
  1362. # Increases the user's Special Defense by 2 stages.
  1363. ################################################################################
  1364. class PokeBattle_Move_033 < PokeBattle_Move
  1365.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1366.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1367.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  1368.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1369.     ret=attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1370.     return ret ? 0 : -1
  1371.   end
  1372.  
  1373.   def pbAdditionalEffect(attacker,opponent)
  1374.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1375.       attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1376.     end
  1377.   end
  1378. end
  1379.  
  1380.  
  1381.  
  1382. ################################################################################
  1383. # Increases the user's evasion by 2 stages. Minimizes the user. (Minimize)
  1384. ################################################################################
  1385. class PokeBattle_Move_034 < PokeBattle_Move
  1386.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1387.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1388.     attacker.effects[PBEffects::Minimize]=true
  1389.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  1390.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1391.     ret=attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1392.     return ret ? 0 : -1
  1393.   end
  1394.  
  1395.   def pbAdditionalEffect(attacker,opponent)
  1396.     attacker.effects[PBEffects::Minimize]=true
  1397.     if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  1398.       attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1399.     end
  1400.   end
  1401. end
  1402.  
  1403.  
  1404.  
  1405. ################################################################################
  1406. # Decreases the user's Defense and Special Defense by 1 stage each. (Shell Smash)
  1407. # Increases the user's Attack, Speed and Special Attack by 2 stages each.
  1408. ################################################################################
  1409. class PokeBattle_Move_035 < PokeBattle_Move
  1410.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1411.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1412.        !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1413.        !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1414.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1415.       return -1
  1416.     end
  1417.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1418.     showanim=true
  1419.     if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1420.       attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1421.       showanim=false
  1422.     end
  1423.     if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1424.       attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1425.       showanim=false
  1426.     end
  1427.     showanim=true
  1428.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1429.       attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  1430.       showanim=false
  1431.     end
  1432.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1433.       attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  1434.       showanim=false
  1435.     end
  1436.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1437.       attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1438.       showanim=false
  1439.     end
  1440.     return 0
  1441.   end
  1442. end
  1443.  
  1444.  
  1445.  
  1446. ################################################################################
  1447. # Increases the user's Speed by 2 stages, and its Attack by 1 stage. (Shift Gear)
  1448. ################################################################################
  1449. class PokeBattle_Move_036 < PokeBattle_Move
  1450.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1451.     if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1452.        !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1453.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1454.       return -1
  1455.     end
  1456.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1457.     showanim=true
  1458.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1459.       attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1460.       showanim=false
  1461.     end
  1462.     if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1463.       attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1464.       showanim=false
  1465.     end
  1466.     return 0
  1467.   end
  1468. end
  1469.  
  1470.  
  1471.  
  1472. ################################################################################
  1473. # Increases one random stat of the user by 2 stages (except HP). (Acupressure)
  1474. ################################################################################
  1475. class PokeBattle_Move_037 < PokeBattle_Move
  1476.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1477.     if attacker.index!=opponent.index
  1478.       if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  1479.          opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1480.         @battle.pbDisplay(_INTL("But it failed!"))
  1481.         return -1
  1482.       end
  1483.     end
  1484.     array=[]
  1485.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1486.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1487.       array.push(i) if opponent.pbCanIncreaseStatStage?(i,attacker,false,self)
  1488.     end
  1489.     if array.length==0
  1490.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",opponent.pbThis))
  1491.       return -1
  1492.     end
  1493.     stat=array[@battle.pbRandom(array.length)]
  1494.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1495.     ret=opponent.pbIncreaseStat(stat,2,attacker,false,self)
  1496.     return 0
  1497.   end
  1498. end
  1499.  
  1500.  
  1501.  
  1502. ################################################################################
  1503. # Increases the user's Defense by 3 stages.
  1504. ################################################################################
  1505. class PokeBattle_Move_038 < PokeBattle_Move
  1506.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1507.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1508.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1509.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1510.     ret=attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1511.     return ret ? 0 : -1
  1512.   end
  1513.  
  1514.   def pbAdditionalEffect(attacker,opponent)
  1515.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1516.       attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1517.     end
  1518.   end
  1519. end
  1520.  
  1521.  
  1522.  
  1523. ################################################################################
  1524. # Increases the user's Special Attack by 3 stages.
  1525. ################################################################################
  1526. class PokeBattle_Move_039 < PokeBattle_Move
  1527.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1528.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1529.     return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1530.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1531.     ret=attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1532.     return ret ? 0 : -1
  1533.   end
  1534.  
  1535.   def pbAdditionalEffect(attacker,opponent)
  1536.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1537.       attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1538.     end
  1539.   end
  1540. end
  1541.  
  1542.  
  1543.  
  1544. ################################################################################
  1545. # Reduces the user's HP by half of max, and sets its Attack to maximum. (Belly Drum)
  1546. ################################################################################
  1547. class PokeBattle_Move_03A < PokeBattle_Move
  1548.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1549.     if attacker.hp<=(attacker.totalhp/2).floor ||
  1550.        !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1551.       @battle.pbDisplay(_INTL("But it failed!"))
  1552.       return -1
  1553.     end
  1554.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1555.     attacker.pbReduceHP((attacker.totalhp/2).floor)
  1556.     if attacker.hasWorkingAbility(:CONTRARY)
  1557.       attacker.stages[PBStats::ATTACK]=-6
  1558.       @battle.pbCommonAnimation("StatDown",attacker,nil)
  1559.       @battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",attacker.pbThis))
  1560.     else
  1561.       attacker.stages[PBStats::ATTACK]=6
  1562.       @battle.pbCommonAnimation("StatUp",attacker,nil)
  1563.       @battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",attacker.pbThis))
  1564.     end
  1565.     return 0
  1566.   end
  1567. end
  1568.  
  1569.  
  1570.  
  1571. ################################################################################
  1572. # Decreases the user's Attack and Defense by 1 stage each. (Superpower)
  1573. ################################################################################
  1574. class PokeBattle_Move_03B < PokeBattle_Move
  1575.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1576.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1577.     if opponent.damagestate.calcdamage>0
  1578.       showanim=true
  1579.       if attacker.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1580.         attacker.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1581.         showanim=false
  1582.       end
  1583.       if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1584.         attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1585.         showanim=false
  1586.       end
  1587.     end
  1588.     return ret
  1589.   end
  1590. end
  1591.  
  1592.  
  1593.  
  1594. ################################################################################
  1595. # Decreases the user's Defense and Special Defense by 1 stage each. (Close Combat)
  1596. ################################################################################
  1597. class PokeBattle_Move_03C < PokeBattle_Move
  1598.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1599.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1600.     if opponent.damagestate.calcdamage>0
  1601.       showanim=true
  1602.       if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1603.         attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1604.         showanim=false
  1605.       end
  1606.       if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1607.         attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1608.         showanim=false
  1609.       end
  1610.     end
  1611.     return ret
  1612.   end
  1613. end
  1614.  
  1615.  
  1616.  
  1617. ################################################################################
  1618. # Decreases the user's Defense, Special Defense and Speed by 1 stage each.
  1619. # User's ally loses 1/16 of its total HP. (V-create)
  1620. ################################################################################
  1621. class PokeBattle_Move_03D < PokeBattle_Move
  1622.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1623.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1624.     if opponent.damagestate.calcdamage>0
  1625.       if attacker.pbPartner && !attacker.pbPartner.fainted?
  1626.         attacker.pbPartner.pbReduceHP((attacker.pbPartner.totalhp/16).floor,true)
  1627.       end
  1628.       showanim=true
  1629.       if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1630.         attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1631.         showanim=false
  1632.       end
  1633.       if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1634.         attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1635.         showanim=false
  1636.       end
  1637.       if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1638.         attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1639.         showanim=false
  1640.       end
  1641.     end
  1642.     return ret
  1643.   end
  1644. end
  1645.  
  1646.  
  1647.  
  1648. ################################################################################
  1649. # Decreases the user's Speed by 1 stage.
  1650. ################################################################################
  1651. class PokeBattle_Move_03E < PokeBattle_Move
  1652.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1653.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1654.     if opponent.damagestate.calcdamage>0
  1655.       if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1656.         attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1657.       end
  1658.     end
  1659.     return ret
  1660.   end
  1661. end
  1662.  
  1663.  
  1664.  
  1665. ################################################################################
  1666. # Decreases the user's Special Attack by 2 stages.
  1667. ################################################################################
  1668. class PokeBattle_Move_03F < PokeBattle_Move
  1669.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1670.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1671.     if opponent.damagestate.calcdamage>0
  1672.       if attacker.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1673.         attacker.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  1674.       end
  1675.     end
  1676.     return ret
  1677.   end
  1678. end
  1679.  
  1680.  
  1681.  
  1682. ################################################################################
  1683. # Increases the target's Special Attack by 1 stage. Confuses the target. (Flatter)
  1684. ################################################################################
  1685. class PokeBattle_Move_040 < PokeBattle_Move
  1686.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1687.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1688.       @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1689.       return -1
  1690.     end
  1691.     ret=-1
  1692.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1693.     if opponent.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1694.       opponent.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  1695.       ret=0
  1696.     end
  1697.     if opponent.pbCanConfuse?(attacker,true,self)
  1698.       opponent.pbConfuse
  1699.       @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1700.       ret=0
  1701.     end
  1702.     return ret
  1703.   end
  1704. end
  1705.  
  1706.  
  1707.  
  1708. ################################################################################
  1709. # Increases the target's Attack by 2 stages. Confuses the target. (Swagger)
  1710. ################################################################################
  1711. class PokeBattle_Move_041 < PokeBattle_Move
  1712.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1713.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1714.       @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1715.       return -1
  1716.     end
  1717.     ret=-1
  1718.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1719.     if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1720.       opponent.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1721.       ret=0
  1722.     end
  1723.     if opponent.pbCanConfuse?(attacker,true,self)
  1724.       opponent.pbConfuse
  1725.       @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1726.       ret=0
  1727.     end
  1728.     return ret
  1729.   end
  1730. end
  1731.  
  1732.  
  1733.  
  1734. ################################################################################
  1735. # Decreases the target's Attack by 1 stage.
  1736. ################################################################################
  1737. class PokeBattle_Move_042 < PokeBattle_Move
  1738.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1739.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1740.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  1741.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1742.     ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1743.     return ret ? 0 : -1
  1744.   end
  1745.  
  1746.   def pbAdditionalEffect(attacker,opponent)
  1747.     return if opponent.damagestate.substitute
  1748.     if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1749.       opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1750.     end
  1751.   end
  1752. end
  1753.  
  1754.  
  1755.  
  1756. ################################################################################
  1757. # Decreases the target's Defense by 1 stage.
  1758. ################################################################################
  1759. class PokeBattle_Move_043 < PokeBattle_Move
  1760.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1761.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1762.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  1763.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1764.     ret=opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1765.     return ret ? 0 : -1
  1766.   end
  1767.  
  1768.   def pbAdditionalEffect(attacker,opponent)
  1769.     return if opponent.damagestate.substitute
  1770.     if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1771.       opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1772.     end
  1773.   end
  1774. end
  1775.  
  1776.  
  1777.  
  1778. ################################################################################
  1779. # Decreases the target's Speed by 1 stage.
  1780. ################################################################################
  1781. class PokeBattle_Move_044 < PokeBattle_Move
  1782.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1783.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1784.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  1785.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1786.     ret=opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1787.     return ret ? 0 : -1
  1788.   end
  1789.  
  1790.   def pbAdditionalEffect(attacker,opponent)
  1791.     return if opponent.damagestate.substitute
  1792.     if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1793.       opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1794.     end
  1795.   end
  1796.  
  1797.   def pbModifyDamage(damagemult,attacker,opponent)
  1798.     if isConst?(@id,PBMoves,:BULLDOZE) &&
  1799.        @battle.field.effects[PBEffects::GrassyTerrain]>0
  1800.       return (damagemult/2.0).round
  1801.     end
  1802.     return damagemult
  1803.   end
  1804. end
  1805.  
  1806.  
  1807.  
  1808. ################################################################################
  1809. # Decreases the target's Special Attack by 1 stage.
  1810. ################################################################################
  1811. class PokeBattle_Move_045 < PokeBattle_Move
  1812.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1813.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1814.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  1815.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1816.     ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1817.     return ret ? 0 : -1
  1818.   end
  1819.  
  1820.   def pbAdditionalEffect(attacker,opponent)
  1821.     return if opponent.damagestate.substitute
  1822.     if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1823.       opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1824.     end
  1825.   end
  1826. end
  1827.  
  1828.  
  1829.  
  1830. ################################################################################
  1831. # Decreases the target's Special Defense by 1 stage.
  1832. ################################################################################
  1833. class PokeBattle_Move_046 < PokeBattle_Move
  1834.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1835.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1836.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  1837.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1838.     ret=opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1839.     return ret ? 0 : -1
  1840.   end
  1841.  
  1842.   def pbAdditionalEffect(attacker,opponent)
  1843.     return if opponent.damagestate.substitute
  1844.     if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1845.       opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1846.     end
  1847.   end
  1848. end
  1849.  
  1850.  
  1851.  
  1852. ################################################################################
  1853. # Decreases the target's accuracy by 1 stage.
  1854. ################################################################################
  1855. class PokeBattle_Move_047 < PokeBattle_Move
  1856.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1857.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1858.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,true,self)
  1859.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1860.     ret=opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1861.     return ret ? 0 : -1
  1862.   end
  1863.  
  1864.   def pbAdditionalEffect(attacker,opponent)
  1865.     return if opponent.damagestate.substitute
  1866.     if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  1867.       opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1868.     end
  1869.   end
  1870. end
  1871.  
  1872.  
  1873.  
  1874. ################################################################################
  1875. # Decreases the target's evasion by 1 stage OR 2 stages. (Sweet Scent)
  1876. ################################################################################
  1877. class PokeBattle_Move_048 < PokeBattle_Move
  1878.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1879.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1880.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,true,self)
  1881.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1882.     increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1883.     ret=opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1884.     return ret ? 0 : -1
  1885.   end
  1886.  
  1887.   def pbAdditionalEffect(attacker,opponent)
  1888.     return if opponent.damagestate.substitute
  1889.     if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1890.       increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1891.       opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1892.     end
  1893.   end
  1894. end
  1895.  
  1896.  
  1897.  
  1898. ################################################################################
  1899. # Decreases the target's evasion by 1 stage. Ends all barriers and entry
  1900. # hazards for the target's side OR on both sides. (Defog)
  1901. ################################################################################
  1902. class PokeBattle_Move_049 < PokeBattle_Move
  1903.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1904.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1905.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1906.     opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1907.     opponent.pbOwnSide.effects[PBEffects::Reflect]     = 0
  1908.     opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1909.     opponent.pbOwnSide.effects[PBEffects::Mist]        = 0
  1910.     opponent.pbOwnSide.effects[PBEffects::Safeguard]   = 0
  1911.     opponent.pbOwnSide.effects[PBEffects::Spikes]      = 0
  1912.     opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1913.     opponent.pbOwnSide.effects[PBEffects::StickyWeb]   = false
  1914.     opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1915.     if USENEWBATTLEMECHANICS
  1916.       opponent.pbOpposingSide.effects[PBEffects::Reflect]     = 0
  1917.       opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1918.       opponent.pbOpposingSide.effects[PBEffects::Mist]        = 0
  1919.       opponent.pbOpposingSide.effects[PBEffects::Safeguard]   = 0
  1920.       opponent.pbOpposingSide.effects[PBEffects::Spikes]      = 0
  1921.       opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1922.       opponent.pbOpposingSide.effects[PBEffects::StickyWeb]   = false
  1923.       opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1924.     end
  1925.     return 0
  1926.   end
  1927.  
  1928.   def pbAdditionalEffect(attacker,opponent)
  1929.     if !opponent.damagestate.substitute
  1930.       if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1931.         opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1932.       end
  1933.     end
  1934.     opponent.pbOwnSide.effects[PBEffects::Reflect]     = 0
  1935.     opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1936.     opponent.pbOwnSide.effects[PBEffects::Mist]        = 0
  1937.     opponent.pbOwnSide.effects[PBEffects::Safeguard]   = 0
  1938.     opponent.pbOwnSide.effects[PBEffects::Spikes]      = 0
  1939.     opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1940.     opponent.pbOwnSide.effects[PBEffects::StickyWeb]   = false
  1941.     opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1942.     if USENEWBATTLEMECHANICS
  1943.       opponent.pbOpposingSide.effects[PBEffects::Reflect]     = 0
  1944.       opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1945.       opponent.pbOpposingSide.effects[PBEffects::Mist]        = 0
  1946.       opponent.pbOpposingSide.effects[PBEffects::Safeguard]   = 0
  1947.       opponent.pbOpposingSide.effects[PBEffects::Spikes]      = 0
  1948.       opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1949.       opponent.pbOpposingSide.effects[PBEffects::StickyWeb]   = false
  1950.       opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1951.     end
  1952.   end
  1953. end
  1954.  
  1955.  
  1956.  
  1957. ################################################################################
  1958. # Decreases the target's Attack and Defense by 1 stage each. (Tickle)
  1959. ################################################################################
  1960. class PokeBattle_Move_04A < PokeBattle_Move
  1961.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1962.     # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  1963.     # multiple times
  1964.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1965.       @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1966.       return -1
  1967.     end
  1968.     if opponent.pbTooLow?(PBStats::ATTACK) &&
  1969.        opponent.pbTooLow?(PBStats::DEFENSE)
  1970.       @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  1971.       return -1
  1972.     end
  1973.     if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  1974.       @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  1975.       return -1
  1976.     end
  1977.     if !attacker.hasMoldBreaker
  1978.       if opponent.hasWorkingAbility(:CLEARBODY) ||
  1979.          opponent.hasWorkingAbility(:WHITESMOKE)
  1980.         @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  1981.            PBAbilities.getName(opponent.ability)))
  1982.         return -1
  1983.       end
  1984.     end
  1985.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1986.     ret=-1; showanim=true
  1987.     if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER) &&
  1988.        !opponent.pbTooLow?(PBStats::ATTACK)
  1989.       abilityname=PBAbilities.getName(opponent.ability)
  1990.       @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  1991.     elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1992.       ret=0; showanim=false
  1993.     end
  1994.     if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:BIGPECKS) &&
  1995.        !opponent.pbTooLow?(PBStats::DEFENSE)
  1996.       abilityname=PBAbilities.getName(opponent.ability)
  1997.       @battle.pbDisplay(_INTL("{1}'s {2} prevents Defense loss!",opponent.pbThis,abilityname))
  1998.     elsif opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1999.       ret=0; showanim=false
  2000.     end
  2001.     return ret
  2002.   end
  2003. end
  2004.  
  2005.  
  2006.  
  2007. ################################################################################
  2008. # Decreases the target's Attack by 2 stages.
  2009. ################################################################################
  2010. class PokeBattle_Move_04B < PokeBattle_Move
  2011.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2012.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2013.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  2014.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2015.     ret=opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2016.     return ret ? 0 : -1
  2017.   end
  2018.  
  2019.   def pbAdditionalEffect(attacker,opponent)
  2020.     return if opponent.damagestate.substitute
  2021.     if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  2022.       opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2023.     end
  2024.   end
  2025. end
  2026.  
  2027.  
  2028.  
  2029. ################################################################################
  2030. # Decreases the target's Defense by 2 stages. (Screech)
  2031. ################################################################################
  2032. class PokeBattle_Move_04C < PokeBattle_Move
  2033.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2034.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2035.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  2036.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2037.     ret=opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2038.     return ret ? 0 : -1
  2039.   end
  2040.  
  2041.   def pbAdditionalEffect(attacker,opponent)
  2042.     return if opponent.damagestate.substitute
  2043.     if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  2044.       opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2045.     end
  2046.   end
  2047. end
  2048.  
  2049.  
  2050.  
  2051. ################################################################################
  2052. # Decreases the target's Speed by 2 stages. (Cotton Spore, Scary Face, String Shot)
  2053. ################################################################################
  2054. class PokeBattle_Move_04D < PokeBattle_Move
  2055.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2056.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2057.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2058.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  2059.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2060.     increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2061.     ret=opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2062.     return ret ? 0 : -1
  2063.   end
  2064.  
  2065.   def pbAdditionalEffect(attacker,opponent)
  2066.     return if opponent.damagestate.substitute
  2067.     if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  2068.       increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2069.       opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2070.     end
  2071.   end
  2072. end
  2073.  
  2074.  
  2075.  
  2076. ################################################################################
  2077. # Decreases the target's Special Attack by 2 stages. Only works on the opposite
  2078. # gender. (Captivate)
  2079. ################################################################################
  2080. class PokeBattle_Move_04E < PokeBattle_Move
  2081.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2082.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2083.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  2084.     if attacker.gender==2 || opponent.gender==2 || attacker.gender==opponent.gender
  2085.       @battle.pbDisplay(_INTL("But it failed!"))
  2086.       return -1
  2087.     end
  2088.     if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS)
  2089.       @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",opponent.pbThis,
  2090.          PBAbilities.getName(opponent.ability)))
  2091.       return -1
  2092.     end
  2093.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2094.     ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2095.     return ret ? 0 : -1
  2096.   end
  2097.  
  2098.   def pbAdditionalEffect(attacker,opponent)
  2099.     return if opponent.damagestate.substitute
  2100.     if attacker.gender!=2 && opponent.gender!=2 && attacker.gender!=opponent.gender
  2101.       if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:OBLIVIOUS)
  2102.         if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  2103.           opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2104.         end
  2105.       end
  2106.     end
  2107.   end
  2108. end
  2109.  
  2110.  
  2111.  
  2112. ################################################################################
  2113. # Decreases the target's Special Defense by 2 stages.
  2114. ################################################################################
  2115. class PokeBattle_Move_04F < PokeBattle_Move
  2116.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2117.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2118.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  2119.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2120.     ret=opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2121.     return ret ? 0 : -1
  2122.   end
  2123.  
  2124.   def pbAdditionalEffect(attacker,opponent)
  2125.     return if opponent.damagestate.substitute
  2126.     if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  2127.       opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2128.     end
  2129.   end
  2130. end
  2131.  
  2132.  
  2133.  
  2134. ################################################################################
  2135. # Resets all target's stat stages to 0. (Clear Smog)
  2136. ################################################################################
  2137. class PokeBattle_Move_050 < PokeBattle_Move
  2138.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2139.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  2140.     if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  2141.       opponent.stages[PBStats::ATTACK]   = 0
  2142.       opponent.stages[PBStats::DEFENSE]  = 0
  2143.       opponent.stages[PBStats::SPEED]    = 0
  2144.       opponent.stages[PBStats::SPATK]    = 0
  2145.       opponent.stages[PBStats::SPDEF]    = 0
  2146.       opponent.stages[PBStats::ACCURACY] = 0
  2147.       opponent.stages[PBStats::EVASION]  = 0
  2148.       @battle.pbDisplay(_INTL("{1}'s stat changes were removed!",opponent.pbThis))
  2149.     end
  2150.     return ret
  2151.   end
  2152. end
  2153.  
  2154.  
  2155.  
  2156. ################################################################################
  2157. # Resets all stat stages for all battlers to 0. (Haze)
  2158. ################################################################################
  2159. class PokeBattle_Move_051 < PokeBattle_Move
  2160.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2161.     for i in 0...4
  2162.       @battle.battlers[i].stages[PBStats::ATTACK]   = 0
  2163.       @battle.battlers[i].stages[PBStats::DEFENSE]  = 0
  2164.       @battle.battlers[i].stages[PBStats::SPEED]    = 0
  2165.       @battle.battlers[i].stages[PBStats::SPATK]    = 0
  2166.       @battle.battlers[i].stages[PBStats::SPDEF]    = 0
  2167.       @battle.battlers[i].stages[PBStats::ACCURACY] = 0
  2168.       @battle.battlers[i].stages[PBStats::EVASION]  = 0
  2169.     end
  2170.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2171.     @battle.pbDisplay(_INTL("All stat changes were eliminated!"))
  2172.     return 0
  2173.   end
  2174. end
  2175.  
  2176.  
  2177.  
  2178. ################################################################################
  2179. # User and target swap their Attack and Special Attack stat stages. (Power Swap)
  2180. ################################################################################
  2181. class PokeBattle_Move_052 < PokeBattle_Move
  2182.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2183.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2184.     astage=attacker.stages
  2185.     ostage=opponent.stages
  2186.     astage[PBStats::ATTACK],ostage[PBStats::ATTACK]=ostage[PBStats::ATTACK],astage[PBStats::ATTACK]
  2187.     astage[PBStats::SPATK],ostage[PBStats::SPATK]=ostage[PBStats::SPATK],astage[PBStats::SPATK]
  2188.     @battle.pbDisplay(_INTL("{1} switched all changes to its Attack and Sp. Atk with the target!",attacker.pbThis))
  2189.     return 0
  2190.   end
  2191. end
  2192.  
  2193.  
  2194.  
  2195. ################################################################################
  2196. # User and target swap their Defense and Special Defense stat stages. (Guard Swap)
  2197. ################################################################################
  2198. class PokeBattle_Move_053 < PokeBattle_Move
  2199.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2200.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2201.     astage=attacker.stages
  2202.     ostage=opponent.stages
  2203.     astage[PBStats::DEFENSE],ostage[PBStats::DEFENSE]=ostage[PBStats::DEFENSE],astage[PBStats::DEFENSE]
  2204.     astage[PBStats::SPDEF],ostage[PBStats::SPDEF]=ostage[PBStats::SPDEF],astage[PBStats::SPDEF]
  2205.     @battle.pbDisplay(_INTL("{1} switched all changes to its Defense and Sp. Def with the target!",attacker.pbThis))
  2206.     return 0
  2207.   end
  2208. end
  2209.  
  2210.  
  2211.  
  2212. ################################################################################
  2213. # User and target swap all their stat stages. (Heart Swap)
  2214. ################################################################################
  2215. class PokeBattle_Move_054 < PokeBattle_Move
  2216.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2217.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2218.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2219.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2220.       attacker.stages[i],opponent.stages[i]=opponent.stages[i],attacker.stages[i]
  2221.     end
  2222.     @battle.pbDisplay(_INTL("{1} switched stat changes with the target!",attacker.pbThis))
  2223.     return 0
  2224.   end
  2225. end
  2226.  
  2227.  
  2228.  
  2229. ################################################################################
  2230. # User copies the target's stat stages. (Psych Up)
  2231. ################################################################################
  2232. class PokeBattle_Move_055 < PokeBattle_Move
  2233.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2234.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2235.       @battle.pbDisplay(_INTL("But it failed!"))
  2236.       return -1
  2237.     end
  2238.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2239.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2240.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2241.       attacker.stages[i]=opponent.stages[i]
  2242.     end
  2243.     @battle.pbDisplay(_INTL("{1} copied {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  2244.     return 0
  2245.   end
  2246. end
  2247.  
  2248.  
  2249.  
  2250. ################################################################################
  2251. # For 5 rounds, user's and ally's stat stages cannot be lowered by foes. (Mist)
  2252. ################################################################################
  2253. class PokeBattle_Move_056 < PokeBattle_Move
  2254.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2255.     if attacker.pbOwnSide.effects[PBEffects::Mist]>0
  2256.       @battle.pbDisplay(_INTL("But it failed!"))
  2257.       return -1
  2258.     end
  2259.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2260.     attacker.pbOwnSide.effects[PBEffects::Mist]=5
  2261.     if !@battle.pbIsOpposing?(attacker.index)
  2262.       @battle.pbDisplay(_INTL("Your team became shrouded in mist!"))
  2263.     else
  2264.       @battle.pbDisplay(_INTL("The opposing team became shrouded in mist!"))
  2265.     end
  2266.     return 0
  2267.   end
  2268. end
  2269.  
  2270.  
  2271.  
  2272. ################################################################################
  2273. # Swaps the user's Attack and Defense stats. (Power Trick)
  2274. ################################################################################
  2275. class PokeBattle_Move_057 < PokeBattle_Move
  2276.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2277.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2278.     attacker.attack,attacker.defense=attacker.defense,attacker.attack
  2279.     attacker.effects[PBEffects::PowerTrick]=!attacker.effects[PBEffects::PowerTrick]
  2280.     @battle.pbDisplay(_INTL("{1} switched its Attack and Defense!",attacker.pbThis))
  2281.     return 0
  2282.   end
  2283. end
  2284.  
  2285.  
  2286.  
  2287. ################################################################################
  2288. # Averages the user's and target's Attack.
  2289. # Averages the user's and target's Special Attack. (Power Split)
  2290. ################################################################################
  2291. class PokeBattle_Move_058 < PokeBattle_Move
  2292.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2293.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2294.       @battle.pbDisplay(_INTL("But it failed!"))  
  2295.       return -1
  2296.     end
  2297.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2298.     avatk=((attacker.attack+opponent.attack)/2).floor
  2299.     avspatk=((attacker.spatk+opponent.spatk)/2).floor
  2300.     attacker.attack=opponent.attack=avatk
  2301.     attacker.spatk=opponent.spatk=avspatk
  2302.     @battle.pbDisplay(_INTL("{1} shared its power with the target!",attacker.pbThis))
  2303.     return 0
  2304.   end
  2305. end
  2306.  
  2307.  
  2308.  
  2309. ################################################################################
  2310. # Averages the user's and target's Defense.
  2311. # Averages the user's and target's Special Defense. (Guard Split)
  2312. ################################################################################
  2313. class PokeBattle_Move_059 < PokeBattle_Move
  2314.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2315.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2316.       @battle.pbDisplay(_INTL("But it failed!"))  
  2317.       return -1
  2318.     end
  2319.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2320.     avdef=((attacker.defense+opponent.defense)/2).floor
  2321.     avspdef=((attacker.spdef+opponent.spdef)/2).floor
  2322.     attacker.defense=opponent.defense=avdef
  2323.     attacker.spdef=opponent.spdef=avspdef
  2324.     @battle.pbDisplay(_INTL("{1} shared its guard with the target!",attacker.pbThis))
  2325.     return 0
  2326.   end
  2327. end
  2328.  
  2329.  
  2330.  
  2331. ################################################################################
  2332. # Averages the user's and target's current HP. (Pain Split)
  2333. ################################################################################
  2334. class PokeBattle_Move_05A < PokeBattle_Move
  2335.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2336.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2337.       @battle.pbDisplay(_INTL("But it failed!"))  
  2338.       return -1
  2339.     end
  2340.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2341.     olda=attacker.hp
  2342.     oldo=opponent.hp
  2343.     avhp=((attacker.hp+opponent.hp)/2).floor
  2344.     attacker.hp=[avhp,attacker.totalhp].min
  2345.     opponent.hp=[avhp,opponent.totalhp].min
  2346.     @battle.scene.pbHPChanged(attacker,olda)
  2347.     @battle.scene.pbHPChanged(opponent,oldo)
  2348.     @battle.pbDisplay(_INTL("The battlers shared their pain!"))
  2349.     return 0
  2350.   end
  2351. end
  2352.  
  2353.  
  2354.  
  2355. ################################################################################
  2356. # For 4 rounds, doubles the Speed of all battlers on the user's side. (Tailwind)
  2357. ################################################################################
  2358. class PokeBattle_Move_05B < PokeBattle_Move
  2359.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2360.     if attacker.pbOwnSide.effects[PBEffects::Tailwind]>0
  2361.       @battle.pbDisplay(_INTL("But it failed!"))
  2362.       return -1
  2363.     end
  2364.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2365.     attacker.pbOwnSide.effects[PBEffects::Tailwind]=4
  2366.     if !@battle.pbIsOpposing?(attacker.index)
  2367.       @battle.pbDisplay(_INTL("The tailwind blew from behind your team!"))
  2368.     else
  2369.       @battle.pbDisplay(_INTL("The tailwind blew from behind the opposing team!"))
  2370.     end
  2371.     return 0
  2372.   end
  2373. end
  2374.  
  2375.  
  2376.  
  2377. ################################################################################
  2378. # This move turns into the last move used by the target, until user switches
  2379. # out. (Mimic)
  2380. ################################################################################
  2381. class PokeBattle_Move_05C < PokeBattle_Move
  2382.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2383.     blacklist=[
  2384.        0x02,   # Struggle
  2385.        0x14,   # Chatter
  2386.        0x5C,   # Mimic
  2387.        0x5D,   # Sketch
  2388.        0xB6    # Metronome
  2389.     ]
  2390.     if attacker.effects[PBEffects::Transform] ||
  2391.        opponent.lastMoveUsed<=0 ||
  2392.        isConst?(PBMoveData.new(opponent.lastMoveUsed).type,PBTypes,:SHADOW) ||
  2393.        blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  2394.       @battle.pbDisplay(_INTL("But it failed!"))
  2395.       return -1
  2396.     end
  2397.     for i in attacker.moves
  2398.       if i.id==opponent.lastMoveUsed
  2399.         @battle.pbDisplay(_INTL("But it failed!"))
  2400.         return -1
  2401.       end
  2402.     end
  2403.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2404.     for i in 0...attacker.moves.length
  2405.       if attacker.moves[i].id==@id
  2406.         newmove=PBMove.new(opponent.lastMoveUsed)
  2407.         attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2408.         movename=PBMoves.getName(opponent.lastMoveUsed)
  2409.         @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2410.         return 0
  2411.       end
  2412.     end
  2413.     @battle.pbDisplay(_INTL("But it failed!"))
  2414.     return -1
  2415.   end
  2416. end
  2417.  
  2418.  
  2419.  
  2420. ################################################################################
  2421. # This move permanently turns into the last move used by the target. (Sketch)
  2422. ################################################################################
  2423. class PokeBattle_Move_05D < PokeBattle_Move
  2424.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2425.     blacklist=[
  2426.        0x02,   # Struggle
  2427.        0x14,   # Chatter
  2428.        0x5D    # Sketch
  2429.     ]
  2430.     if attacker.effects[PBEffects::Transform] ||
  2431.        opponent.lastMoveUsedSketch<=0 ||
  2432.        isConst?(PBMoveData.new(opponent.lastMoveUsedSketch).type,PBTypes,:SHADOW) ||
  2433.        blacklist.include?(PBMoveData.new(opponent.lastMoveUsedSketch).function)
  2434.       @battle.pbDisplay(_INTL("But it failed!"))
  2435.       return -1
  2436.     end
  2437.     for i in attacker.moves
  2438.       if i.id==opponent.lastMoveUsedSketch
  2439.         @battle.pbDisplay(_INTL("But it failed!"))
  2440.         return -1
  2441.       end
  2442.     end
  2443.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2444.       @battle.pbDisplay(_INTL("But it failed!"))
  2445.       return -1
  2446.     end
  2447.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2448.     for i in 0...attacker.moves.length
  2449.       if attacker.moves[i].id==@id
  2450.         newmove=PBMove.new(opponent.lastMoveUsedSketch)
  2451.         attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2452.         party=@battle.pbParty(attacker.index)
  2453.         party[attacker.pokemonIndex].moves[i]=newmove
  2454.         movename=PBMoves.getName(opponent.lastMoveUsedSketch)
  2455.         @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2456.         return 0
  2457.       end
  2458.     end
  2459.     @battle.pbDisplay(_INTL("But it failed!"))
  2460.     return -1
  2461.   end
  2462. end
  2463.  
  2464.  
  2465.  
  2466. ################################################################################
  2467. # Changes user's type to that of a random user's move, except this one, OR the
  2468. # user's first move's type. (Conversion)
  2469. ################################################################################
  2470. class PokeBattle_Move_05E < PokeBattle_Move
  2471.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2472.     if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2473.       @battle.pbDisplay(_INTL("But it failed!"))
  2474.       return -1
  2475.     end
  2476.     types=[]
  2477.     for i in attacker.moves
  2478.       next if i.id==@id
  2479.       next if PBTypes.isPseudoType?(i.type)
  2480.       next if attacker.pbHasType?(i.type)
  2481.       if !types.include?(i.type)
  2482.         types.push(i.type)
  2483.         break if USENEWBATTLEMECHANICS
  2484.       end
  2485.     end
  2486.     if types.length==0
  2487.       @battle.pbDisplay(_INTL("But it failed!"))
  2488.       return -1
  2489.     end
  2490.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2491.     newtype=types[@battle.pbRandom(types.length)]
  2492.     attacker.type1=newtype
  2493.     attacker.type2=newtype
  2494.     attacker.effects[PBEffects::Type3]=-1
  2495.     typename=PBTypes.getName(newtype)
  2496.     @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2497.   end
  2498. end
  2499.  
  2500.  
  2501.  
  2502. ################################################################################
  2503. # Changes user's type to a random one that resists/is immune to the last move
  2504. # used by the target. (Conversion 2)
  2505. ################################################################################
  2506. class PokeBattle_Move_05F < PokeBattle_Move
  2507.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2508.     if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2509.       @battle.pbDisplay(_INTL("But it failed!"))
  2510.       return -1
  2511.     end
  2512.     if opponent.lastMoveUsed<=0 ||
  2513.        PBTypes.isPseudoType?(PBMoveData.new(opponent.lastMoveUsed).type)
  2514.       @battle.pbDisplay(_INTL("But it failed!"))
  2515.       return -1
  2516.     end
  2517.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2518.       @battle.pbDisplay(_INTL("But it failed!"))
  2519.       return -1
  2520.     end
  2521.     types=[]
  2522.     atype=opponent.lastMoveUsedType
  2523.     if atype<0
  2524.       @battle.pbDisplay(_INTL("But it failed!"))
  2525.       return -1
  2526.     end
  2527.     for i in 0..PBTypes.maxValue
  2528.       next if PBTypes.isPseudoType?(i)
  2529.       next if attacker.pbHasType?(i)
  2530.       types.push(i) if PBTypes.getEffectiveness(atype,i)<2
  2531.     end
  2532.     if types.length==0
  2533.       @battle.pbDisplay(_INTL("But it failed!"))
  2534.       return -1
  2535.     end
  2536.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2537.     newtype=types[@battle.pbRandom(types.length)]
  2538.     attacker.type1=newtype
  2539.     attacker.type2=newtype
  2540.     attacker.effects[PBEffects::Type3]=-1
  2541.     typename=PBTypes.getName(newtype)
  2542.     @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2543.     return 0
  2544.   end
  2545. end
  2546.  
  2547.  
  2548.  
  2549. ################################################################################
  2550. # Changes user's type depending on the environment. (Camouflage)
  2551. ################################################################################
  2552. class PokeBattle_Move_060 < PokeBattle_Move
  2553.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2554.     if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2555.       @battle.pbDisplay(_INTL("But it failed!"))
  2556.       return -1
  2557.     end
  2558.     type=getConst(PBTypes,:NORMAL) || 0
  2559.     case @battle.environment
  2560.     when PBEnvironment::None;        type=getConst(PBTypes,:NORMAL) || 0
  2561.     when PBEnvironment::Grass;       type=getConst(PBTypes,:GRASS) || 0
  2562.     when PBEnvironment::TallGrass;   type=getConst(PBTypes,:GRASS) || 0
  2563.     when PBEnvironment::MovingWater; type=getConst(PBTypes,:WATER) || 0
  2564.     when PBEnvironment::StillWater;  type=getConst(PBTypes,:WATER) || 0
  2565.     when PBEnvironment::Underwater;  type=getConst(PBTypes,:WATER) || 0
  2566.     when PBEnvironment::Cave;        type=getConst(PBTypes,:ROCK) || 0
  2567.     when PBEnvironment::Rock;        type=getConst(PBTypes,:GROUND) || 0
  2568.     when PBEnvironment::Sand;        type=getConst(PBTypes,:GROUND) || 0
  2569.     when PBEnvironment::Forest;      type=getConst(PBTypes,:BUG) || 0
  2570.     when PBEnvironment::Snow;        type=getConst(PBTypes,:ICE) || 0
  2571.     when PBEnvironment::Volcano;     type=getConst(PBTypes,:FIRE) || 0
  2572.     when PBEnvironment::Graveyard;   type=getConst(PBTypes,:GHOST) || 0
  2573.     when PBEnvironment::Sky;         type=getConst(PBTypes,:FLYING) || 0
  2574.     when PBEnvironment::Space;       type=getConst(PBTypes,:DRAGON) || 0
  2575.     end
  2576.     if @battle.field.effects[PBEffects::ElectricTerrain]>0
  2577.       type=getConst(PBTypes,:ELECTRIC) if hasConst?(PBTypes,:ELECTRIC)
  2578.     elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  2579.       type=getConst(PBTypes,:GRASS) if hasConst?(PBTypes,:GRASS)
  2580.     elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  2581.       type=getConst(PBTypes,:FAIRY) if hasConst?(PBTypes,:FAIRY)
  2582.     end
  2583.     if attacker.pbHasType?(type)
  2584.       @battle.pbDisplay(_INTL("But it failed!"))
  2585.       return -1  
  2586.     end
  2587.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2588.     attacker.type1=type
  2589.     attacker.type2=type
  2590.     attacker.effects[PBEffects::Type3]=-1
  2591.     typename=PBTypes.getName(type)
  2592.     @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))  
  2593.     return 0
  2594.   end
  2595. end
  2596.  
  2597.  
  2598.  
  2599. ################################################################################
  2600. # Target becomes Water type. (Soak)
  2601. ################################################################################
  2602. class PokeBattle_Move_061 < PokeBattle_Move
  2603.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2604.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2605.       @battle.pbDisplay(_INTL("But it failed!"))  
  2606.       return -1
  2607.     end
  2608.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2609.     if isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  2610.       @battle.pbDisplay(_INTL("But it failed!"))
  2611.       return -1
  2612.     end
  2613.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2614.     if opponent.type1==getConst(PBTypes,:WATER) &&
  2615.        opponent.type2==getConst(PBTypes,:WATER) &&
  2616.        (opponent.effects[PBEffects::Type3]<0 ||
  2617.        opponent.effects[PBEffects::Type3]==getConst(PBTypes,:WATER))
  2618.       @battle.pbDisplay(_INTL("But it failed!"))
  2619.       return -1
  2620.     end
  2621.     opponent.type1=getConst(PBTypes,:WATER)
  2622.     opponent.type2=getConst(PBTypes,:WATER)
  2623.     opponent.effects[PBEffects::Type3]=-1
  2624.     typename=PBTypes.getName(getConst(PBTypes,:WATER))
  2625.     @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  2626.     return 0
  2627.   end
  2628. end
  2629.  
  2630.  
  2631.  
  2632. ################################################################################
  2633. # User copes target's types. (Reflect Type)
  2634. ################################################################################
  2635. class PokeBattle_Move_062 < PokeBattle_Move
  2636.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2637.     if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2638.       @battle.pbDisplay(_INTL("But it failed!"))
  2639.       return -1
  2640.     end
  2641.     if attacker.pbHasType?(opponent.type1) &&
  2642.        attacker.pbHasType?(opponent.type2) &&
  2643.        attacker.pbHasType?(opponent.effects[PBEffects::Type3]) &&
  2644.        opponent.pbHasType?(attacker.type1) &&
  2645.        opponent.pbHasType?(attacker.type2) &&
  2646.        opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  2647.       @battle.pbDisplay(_INTL("But it failed!"))
  2648.       return -1
  2649.     end
  2650.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2651.     attacker.type1=opponent.type1
  2652.     attacker.type2=opponent.type2
  2653.     attacker.effects[PBEffects::Type3]=-1
  2654.     @battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",attacker.pbThis,opponent.pbThis(true)))
  2655.     return 0
  2656.   end
  2657. end
  2658.  
  2659.  
  2660.  
  2661. ################################################################################
  2662. # Target's ability becomes Simple. (Simple Beam)
  2663. ################################################################################
  2664. class PokeBattle_Move_063 < PokeBattle_Move
  2665.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2666.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2667.       @battle.pbDisplay(_INTL("But it failed!"))  
  2668.       return -1
  2669.     end
  2670.     if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2671.        isConst?(opponent.ability,PBAbilities,:SIMPLE) ||
  2672.        isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2673.        isConst?(opponent.ability,PBAbilities,:TRUANT)
  2674.       @battle.pbDisplay(_INTL("But it failed!"))
  2675.       return -1
  2676.     end
  2677.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2678.     oldabil=opponent.ability
  2679.     opponent.ability=getConst(PBAbilities,:SIMPLE) || 0
  2680.     abilityname=PBAbilities.getName(getConst(PBAbilities,:SIMPLE))
  2681.     @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2682.     if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2683.       PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")    
  2684.       opponent.effects[PBEffects::Illusion]=nil
  2685.       @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2686.       @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2687.     end
  2688.     return 0
  2689.   end
  2690. end
  2691.  
  2692.  
  2693.  
  2694. ################################################################################
  2695. # Target's ability becomes Insomnia. (Worry Seed)
  2696. ################################################################################
  2697. class PokeBattle_Move_064 < PokeBattle_Move
  2698.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2699.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2700.       @battle.pbDisplay(_INTL("But it failed!"))  
  2701.       return -1
  2702.     end
  2703.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2704.     if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2705.        isConst?(opponent.ability,PBAbilities,:INSOMNIA) ||
  2706.        isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2707.        isConst?(opponent.ability,PBAbilities,:TRUANT)
  2708.       @battle.pbDisplay(_INTL("But it failed!"))
  2709.       return -1
  2710.     end
  2711.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2712.     oldabil=opponent.ability
  2713.     opponent.ability=getConst(PBAbilities,:INSOMNIA) || 0
  2714.     abilityname=PBAbilities.getName(getConst(PBAbilities,:INSOMNIA))
  2715.     @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2716.     if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2717.       PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")    
  2718.       opponent.effects[PBEffects::Illusion]=nil
  2719.       @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2720.       @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2721.     end
  2722.     return 0
  2723.   end
  2724. end
  2725.  
  2726.  
  2727.  
  2728. ################################################################################
  2729. # User copies target's ability. (Role Play)
  2730. ################################################################################
  2731. class PokeBattle_Move_065 < PokeBattle_Move
  2732.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2733.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2734.       @battle.pbDisplay(_INTL("But it failed!"))
  2735.       return -1
  2736.     end
  2737.     if opponent.ability==0 ||
  2738.        attacker.ability==opponent.ability ||
  2739.        isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2740.        isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2741.        isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2742.        isConst?(opponent.ability,PBAbilities,:FORECAST) ||
  2743.        isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2744.        isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2745.        isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2746.        isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2747.        isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2748.        isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2749.        isConst?(opponent.ability,PBAbilities,:ZENMODE)
  2750.       @battle.pbDisplay(_INTL("But it failed!"))
  2751.       return -1
  2752.     end
  2753.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2754.     oldabil=attacker.ability
  2755.     attacker.ability=opponent.ability
  2756.     abilityname=PBAbilities.getName(opponent.ability)
  2757.     @battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),abilityname))
  2758.     if attacker.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2759.       PBDebug.log("[Ability triggered] #{attacker.pbThis}'s Illusion ended")    
  2760.       attacker.effects[PBEffects::Illusion]=nil
  2761.       @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  2762.       @battle.pbDisplay(_INTL("{1}'s {2} wore off!",attacker.pbThis,PBAbilities.getName(oldabil)))
  2763.     end
  2764.     return 0
  2765.   end
  2766. end
  2767.  
  2768.  
  2769.  
  2770. ################################################################################
  2771. # Target copies user's ability. (Entrainment)
  2772. ################################################################################
  2773. class PokeBattle_Move_066 < PokeBattle_Move
  2774.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2775.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2776.       @battle.pbDisplay(_INTL("But it failed!"))  
  2777.       return -1
  2778.     end
  2779.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2780.       @battle.pbDisplay(_INTL("But it failed!"))
  2781.       return -1
  2782.     end
  2783.     if attacker.ability==0 ||
  2784.        attacker.ability==opponent.ability ||
  2785.        isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2786.        isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2787.        isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2788.        isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2789.        isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2790.        isConst?(opponent.ability,PBAbilities,:TRUANT) ||
  2791.        isConst?(opponent.ability,PBAbilities,:ZENMODE) ||
  2792.        isConst?(attacker.ability,PBAbilities,:FLOWERGIFT) ||
  2793.        isConst?(attacker.ability,PBAbilities,:FORECAST) ||
  2794.        isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2795.        isConst?(attacker.ability,PBAbilities,:IMPOSTER) ||
  2796.        isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2797.        isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2798.        isConst?(attacker.ability,PBAbilities,:TRACE) ||
  2799.        isConst?(attacker.ability,PBAbilities,:ZENMODE)
  2800.       @battle.pbDisplay(_INTL("But it failed!"))
  2801.       return -1
  2802.     end
  2803.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2804.     oldabil=opponent.ability
  2805.     opponent.ability=attacker.ability
  2806.     abilityname=PBAbilities.getName(attacker.ability)
  2807.     @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2808.     if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2809.       PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")    
  2810.       opponent.effects[PBEffects::Illusion]=nil
  2811.       @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2812.       @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2813.     end
  2814.     return 0
  2815.   end
  2816. end
  2817.  
  2818.  
  2819.  
  2820. ################################################################################
  2821. # User and target swap abilities. (Skill Swap)
  2822. ################################################################################
  2823. class PokeBattle_Move_067 < PokeBattle_Move
  2824.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2825.     if (attacker.ability==0 && opponent.ability==0) ||
  2826.        (attacker.ability==opponent.ability && !USENEWBATTLEMECHANICS) ||
  2827.        isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2828.        isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2829.        isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2830.        isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2831.        isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2832.        isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2833.        isConst?(attacker.ability,PBAbilities,:WONDERGUARD) ||
  2834.        isConst?(opponent.ability,PBAbilities,:WONDERGUARD)
  2835.       @battle.pbDisplay(_INTL("But it failed!"))
  2836.       return -1
  2837.     end
  2838.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2839.     tmp=attacker.ability
  2840.     attacker.ability=opponent.ability
  2841.     opponent.ability=tmp
  2842.     @battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
  2843.        attacker.pbThis,PBAbilities.getName(opponent.ability),
  2844.        PBAbilities.getName(attacker.ability)))
  2845.     attacker.pbAbilitiesOnSwitchIn(true)
  2846.     opponent.pbAbilitiesOnSwitchIn(true)
  2847.     return 0
  2848.   end
  2849. end
  2850.  
  2851.  
  2852.  
  2853. ################################################################################
  2854. # Target's ability is negated. (Gastro Acid)
  2855. ################################################################################
  2856. class PokeBattle_Move_068 < PokeBattle_Move
  2857.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2858.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2859.       @battle.pbDisplay(_INTL("But it failed!"))  
  2860.       return -1
  2861.     end
  2862.     if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2863.        isConst?(opponent.ability,PBAbilities,:STANCECHANGE)
  2864.       @battle.pbDisplay(_INTL("But it failed!"))
  2865.       return -1
  2866.     end
  2867.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2868.     oldabil=opponent.ability
  2869.     opponent.effects[PBEffects::GastroAcid]=true
  2870.     opponent.effects[PBEffects::Truant]=false
  2871.     @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis))
  2872.     if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2873.       PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")    
  2874.       opponent.effects[PBEffects::Illusion]=nil
  2875.       @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2876.       @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2877.     end
  2878.     return 0
  2879.   end
  2880. end
  2881.  
  2882.  
  2883.  
  2884. ################################################################################
  2885. # User transforms into the target. (Transform)
  2886. ################################################################################
  2887. class PokeBattle_Move_069 < PokeBattle_Move
  2888.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2889.     blacklist=[
  2890.        0xC9,   # Fly
  2891.        0xCA,   # Dig
  2892.        0xCB,   # Dive
  2893.        0xCC,   # Bounce
  2894.        0xCD,   # Shadow Force
  2895.        0xCE,   # Sky Drop
  2896.        0x14D   # Phantom Force
  2897.     ]
  2898.     if attacker.effects[PBEffects::Transform] ||
  2899.        opponent.effects[PBEffects::Transform] ||
  2900.        opponent.effects[PBEffects::Illusion] ||
  2901.        (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  2902.        opponent.effects[PBEffects::SkyDrop] ||
  2903.        blacklist.include?(PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function)
  2904.       @battle.pbDisplay(_INTL("But it failed!"))
  2905.       return -1
  2906.     end
  2907.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2908.       @battle.pbDisplay(_INTL("But it failed!"))
  2909.       return -1
  2910.     end
  2911.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2912.     attacker.effects[PBEffects::Transform]=true
  2913.     attacker.type1=opponent.type1
  2914.     attacker.type2=opponent.type2
  2915.     attacker.effects[PBEffects::Type3]=-1
  2916.     attacker.ability=opponent.ability
  2917.     attacker.attack=opponent.attack
  2918.     attacker.defense=opponent.defense
  2919.     attacker.speed=opponent.speed
  2920.     attacker.spatk=opponent.spatk
  2921.     attacker.spdef=opponent.spdef
  2922.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2923.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2924.       attacker.stages[i]=opponent.stages[i]
  2925.     end
  2926.     for i in 0...4
  2927.       attacker.moves[i]=PokeBattle_Move.pbFromPBMove(
  2928.          @battle,PBMove.new(opponent.moves[i].id))
  2929.       attacker.moves[i].pp=5
  2930.       attacker.moves[i].totalpp=5
  2931.     end
  2932.     attacker.effects[PBEffects::Disable]=0
  2933.     attacker.effects[PBEffects::DisableMove]=0
  2934.     @battle.pbDisplay(_INTL("{1} transformed into {2}!",attacker.pbThis,opponent.pbThis(true)))
  2935.     return 0
  2936.   end
  2937. end
  2938.  
  2939.  
  2940.  
  2941. ################################################################################
  2942. # Inflicts a fixed 20HP damage. (SonicBoom)
  2943. ################################################################################
  2944. class PokeBattle_Move_06A < PokeBattle_Move
  2945.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2946.     return pbEffectFixedDamage(20,attacker,opponent,hitnum,alltargets,showanimation)
  2947.   end
  2948. end
  2949.  
  2950.  
  2951.  
  2952. ################################################################################
  2953. # Inflicts a fixed 40HP damage. (Dragon Rage)
  2954. ################################################################################
  2955. class PokeBattle_Move_06B < PokeBattle_Move
  2956.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2957.     return pbEffectFixedDamage(40,attacker,opponent,hitnum,alltargets,showanimation)
  2958.   end
  2959. end
  2960.  
  2961.  
  2962.  
  2963. ################################################################################
  2964. # Halves the target's current HP. (Super Fang)
  2965. ################################################################################
  2966. class PokeBattle_Move_06C < PokeBattle_Move
  2967.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2968.     return pbEffectFixedDamage([(opponent.hp/2).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2969.   end
  2970. end
  2971.  
  2972.  
  2973.  
  2974. ################################################################################
  2975. # Inflicts damage equal to the user's level. (Night Shade, Seismic Toss)
  2976. ################################################################################
  2977. class PokeBattle_Move_06D < PokeBattle_Move
  2978.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2979.     return pbEffectFixedDamage(attacker.level,attacker,opponent,hitnum,alltargets,showanimation)
  2980.   end
  2981. end
  2982.  
  2983.  
  2984.  
  2985. ################################################################################
  2986. # Inflicts damage to bring the target's HP down to equal the user's HP. (Endeavor)
  2987. ################################################################################
  2988. class PokeBattle_Move_06E < PokeBattle_Move
  2989.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2990.     if attacker.hp>=opponent.hp
  2991.       @battle.pbDisplay(_INTL("But it failed!"))
  2992.       return -1
  2993.     end
  2994.     return pbEffectFixedDamage(opponent.hp-attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  2995.   end
  2996. end
  2997.  
  2998.  
  2999.  
  3000. ################################################################################
  3001. # Inflicts damage between 0.5 and 1.5 times the user's level. (Psywave)
  3002. ################################################################################
  3003. class PokeBattle_Move_06F < PokeBattle_Move
  3004.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3005.     dmg=[(attacker.level*(@battle.pbRandom(101)+50)/100).floor,1].max
  3006.     return pbEffectFixedDamage(dmg,attacker,opponent,hitnum,alltargets,showanimation)
  3007.   end
  3008. end
  3009.  
  3010.  
  3011.  
  3012. ################################################################################
  3013. # OHKO. Accuracy increases by difference between levels of user and target.
  3014. ################################################################################
  3015. class PokeBattle_Move_070 < PokeBattle_Move
  3016.   def pbAccuracyCheck(attacker,opponent)
  3017.     if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STURDY)
  3018.       @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))  
  3019.       return false
  3020.     end
  3021.     if opponent.level>attacker.level
  3022.       @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
  3023.       return false
  3024.     end
  3025.     acc=@accuracy+attacker.level-opponent.level
  3026.     return @battle.pbRandom(100)<acc
  3027.   end
  3028.  
  3029.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3030.     damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
  3031.     if opponent.fainted?
  3032.       @battle.pbDisplay(_INTL("It's a one-hit KO!"))
  3033.     end
  3034.     return damage
  3035.   end
  3036. end
  3037.  
  3038.  
  3039. ################################################################################
  3040. # Counters a physical move used against the user this round, with 2x the power. (Counter)
  3041. ################################################################################
  3042. class PokeBattle_Move_071 < PokeBattle_Move
  3043.   def pbAddTarget(targets,attacker)
  3044.     if attacker.effects[PBEffects::CounterTarget]>=0 &&
  3045.        attacker.pbIsOpposing?(attacker.effects[PBEffects::CounterTarget])
  3046.       if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::CounterTarget]])
  3047.         attacker.pbRandomTarget(targets)
  3048.       end
  3049.     end
  3050.   end
  3051.  
  3052.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3053.     if attacker.effects[PBEffects::Counter]<0 || !opponent
  3054.       @battle.pbDisplay(_INTL("But it failed!"))
  3055.       return -1
  3056.     end
  3057.     ret=pbEffectFixedDamage([attacker.effects[PBEffects::Counter]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3058.     return ret
  3059.   end
  3060. end
  3061.  
  3062.  
  3063.  
  3064. ################################################################################
  3065. # Counters a specical move used against the user this round, with 2x the power. (Mirror Coat)
  3066. ################################################################################
  3067. class PokeBattle_Move_072 < PokeBattle_Move
  3068.   def pbAddTarget(targets,attacker)
  3069.     if attacker.effects[PBEffects::MirrorCoatTarget]>=0 &&
  3070.        attacker.pbIsOpposing?(attacker.effects[PBEffects::MirrorCoatTarget])
  3071.       if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::MirrorCoatTarget]])
  3072.         attacker.pbRandomTarget(targets)
  3073.       end
  3074.     end
  3075.   end
  3076.  
  3077.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3078.     if attacker.effects[PBEffects::MirrorCoat]<0 || !opponent
  3079.       @battle.pbDisplay(_INTL("But it failed!"))
  3080.       return -1
  3081.     end
  3082.     ret=pbEffectFixedDamage([attacker.effects[PBEffects::MirrorCoat]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3083.     return ret
  3084.   end
  3085. end
  3086.  
  3087.  
  3088.  
  3089. ################################################################################
  3090. # Counters the last damaging move used against the user this round, with 1.5x
  3091. # the power. (Metal Burst)
  3092. ################################################################################
  3093. class PokeBattle_Move_073 < PokeBattle_Move
  3094.   def pbAddTarget(targets,attacker)
  3095.     if attacker.lastAttacker.length>0
  3096.       lastattacker=attacker.lastAttacker[attacker.lastAttacker.length-1]
  3097.       if lastattacker>=0 && attacker.pbIsOpposing?(lastattacker)
  3098.         if !attacker.pbAddTarget(targets,@battle.battlers[lastattacker])
  3099.           attacker.pbRandomTarget(targets)
  3100.         end
  3101.       end
  3102.     end
  3103.   end
  3104.  
  3105.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3106.     if attacker.lastHPLost==0 || !opponent
  3107.       @battle.pbDisplay(_INTL("But it failed!"))
  3108.       return -1
  3109.     end
  3110.     ret=pbEffectFixedDamage([(attacker.lastHPLost*1.5).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3111.     return ret
  3112.   end
  3113. end
  3114.  
  3115.  
  3116.  
  3117. ################################################################################
  3118. # The target's ally loses 1/16 of its max HP. (Flame Burst)
  3119. ################################################################################
  3120. class PokeBattle_Move_074 < PokeBattle_Move
  3121.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3122.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3123.     if opponent.damagestate.calcdamage>0
  3124.       if opponent.pbPartner && !opponent.pbPartner.fainted? &&
  3125.          !opponent.pbPartner.hasWorkingAbility(:MAGICGUARD)
  3126.         opponent.pbPartner.pbReduceHP((opponent.pbPartner.totalhp/16).floor)
  3127.         @battle.pbDisplay(_INTL("The bursting flame hit {1}!",opponent.pbPartner.pbThis(true)))
  3128.       end
  3129.     end
  3130.     return ret
  3131.   end
  3132. end
  3133.  
  3134.  
  3135.  
  3136. ################################################################################
  3137. # Power is doubled if the target is using Dive. (Surf)
  3138. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3139. ################################################################################
  3140. class PokeBattle_Move_075 < PokeBattle_Move
  3141.   def pbModifyDamage(damagemult,attacker,opponent)
  3142.     if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  3143.       return (damagemult*2.0).round
  3144.     end
  3145.     return damagemult
  3146.   end
  3147. end
  3148.  
  3149.  
  3150.  
  3151. ################################################################################
  3152. # Power is doubled if the target is using Dig. Power is halved if Grassy Terrain
  3153. # is in effect. (Earthquake)
  3154. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3155. ################################################################################
  3156. class PokeBattle_Move_076 < PokeBattle_Move
  3157.   def pbModifyDamage(damagemult,attacker,opponent)
  3158.     ret=damagemult
  3159.     if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3160.       ret=(damagemult*2.0).round
  3161.     end
  3162.     if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3163.       ret=(damagemult/2.0).round
  3164.     end
  3165.     return ret
  3166.   end
  3167. end
  3168.  
  3169.  
  3170.  
  3171. ################################################################################
  3172. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Gust)
  3173. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3174. ################################################################################
  3175. class PokeBattle_Move_077 < PokeBattle_Move
  3176.   def pbBaseDamage(basedmg,attacker,opponent)
  3177.     if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3178.        PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3179.        PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3180.        opponent.effects[PBEffects::SkyDrop]
  3181.       return basedmg*2
  3182.     end
  3183.     return basedmg
  3184.   end
  3185. end
  3186.  
  3187.  
  3188.  
  3189. ################################################################################
  3190. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Twister)
  3191. # May make the target flinch.
  3192. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3193. ################################################################################
  3194. class PokeBattle_Move_078 < PokeBattle_Move
  3195.   def pbBaseDamage(basedmg,attacker,opponent)
  3196.     if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3197.        PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3198.        PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3199.        opponent.effects[PBEffects::SkyDrop]
  3200.       return basedmg*2
  3201.     end
  3202.     return basedmg
  3203.   end
  3204.  
  3205.   def pbAdditionalEffect(attacker,opponent)
  3206.     return if opponent.damagestate.substitute
  3207.     opponent.pbFlinch(attacker)
  3208.   end
  3209. end
  3210.  
  3211.  
  3212.  
  3213. ################################################################################
  3214. # Power is doubled if Fusion Flare has already been used this round. (Fusion Bolt)
  3215. ################################################################################
  3216. class PokeBattle_Move_079 < PokeBattle_Move
  3217.   def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3218.     if @battle.field.effects[PBEffects::FusionBolt]
  3219.       @battle.field.effects[PBEffects::FusionBolt]=false
  3220.       @doubled=true
  3221.       return (damagemult*2.0).round
  3222.     end
  3223.     return damagemult
  3224.   end
  3225.  
  3226.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3227.     @doubled=false
  3228.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3229.     if opponent.damagestate.calcdamage>0
  3230.       @battle.field.effects[PBEffects::FusionFlare]=true
  3231.     end
  3232.     return ret
  3233.   end
  3234.  
  3235.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3236.     if opponent.damagestate.critical || @doubled
  3237.       return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3238.     end
  3239.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3240.   end
  3241. end
  3242.  
  3243.  
  3244.  
  3245. ################################################################################
  3246. # Power is doubled if Fusion Bolt has already been used this round. (Fusion Flare)
  3247. ################################################################################
  3248. class PokeBattle_Move_07A < PokeBattle_Move
  3249.   def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3250.     if @battle.field.effects[PBEffects::FusionFlare]
  3251.       @battle.field.effects[PBEffects::FusionFlare]=false
  3252.       return (damagemult*2.0).round
  3253.     end
  3254.     return damagemult
  3255.   end
  3256.  
  3257.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3258.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3259.     if opponent.damagestate.calcdamage>0
  3260.       @battle.field.effects[PBEffects::FusionBolt]=true
  3261.     end
  3262.     return ret
  3263.   end
  3264.  
  3265.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3266.     if opponent.damagestate.critical || @doubled
  3267.       return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3268.     end
  3269.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3270.   end
  3271. end
  3272.  
  3273.  
  3274.  
  3275. ################################################################################
  3276. # Power is doubled if the target is poisoned. (Venoshock)
  3277. ################################################################################
  3278. class PokeBattle_Move_07B < PokeBattle_Move
  3279.   def pbBaseDamage(basedmg,attacker,opponent)
  3280.     if opponent.status==PBStatuses::POISON &&
  3281.        (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3282.       return basedmg*2
  3283.     end
  3284.     return basedmg
  3285.   end
  3286. end
  3287.  
  3288.  
  3289.  
  3290. ################################################################################
  3291. # Power is doubled if the target is paralyzed. Cures the target of paralysis.
  3292. # (SmellingSalt)
  3293. ################################################################################
  3294. class PokeBattle_Move_07C < PokeBattle_Move
  3295.   def pbBaseDamage(basedmg,attacker,opponent)
  3296.     if opponent.status==PBStatuses::PARALYSIS &&
  3297.        (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3298.       return basedmg*2
  3299.     end
  3300.     return basedmg
  3301.   end
  3302.  
  3303.   def pbEffectAfterHit(attacker,opponent,turneffects)
  3304.     if !opponent.fainted? && opponent.damagestate.calcdamage>0 &&
  3305.        !opponent.damagestate.substitute && opponent.status==PBStatuses::PARALYSIS
  3306.       opponent.pbCureStatus
  3307.     end
  3308.   end
  3309. end
  3310.  
  3311.  
  3312.  
  3313. ################################################################################
  3314. # Power is doubled if the target is asleep. Wakes the target up. (Wake-Up Slap)
  3315. ################################################################################
  3316. class PokeBattle_Move_07D < PokeBattle_Move
  3317.   def pbBaseDamage(basedmg,attacker,opponent)
  3318.     if opponent.status==PBStatuses::SLEEP &&
  3319.        (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3320.       return basedmg*2
  3321.     end
  3322.     return basedmg
  3323.   end
  3324.  
  3325.   def pbEffectAfterHit(attacker,opponent,turneffects)
  3326.     if !opponent.fainted? && opponent.damagestate.calcdamage>0 &&
  3327.        !opponent.damagestate.substitute && opponent.status==PBStatuses::SLEEP
  3328.       opponent.pbCureStatus
  3329.     end
  3330.   end
  3331. end
  3332.  
  3333.  
  3334.  
  3335. ################################################################################
  3336. # Power is doubled if the user is burned, poisoned or paralyzed. (Facade)
  3337. ################################################################################
  3338. class PokeBattle_Move_07E < PokeBattle_Move
  3339.   def pbBaseDamage(basedmg,attacker,opponent)
  3340.     if attacker.status==PBStatuses::POISON ||
  3341.        attacker.status==PBStatuses::BURN ||
  3342.        attacker.status==PBStatuses::PARALYSIS
  3343.       return basedmg*2
  3344.     end
  3345.     return basedmg
  3346.   end
  3347. end
  3348.  
  3349.  
  3350.  
  3351. ################################################################################
  3352. # Power is doubled if the target has a status problem. (Hex)
  3353. ################################################################################
  3354. class PokeBattle_Move_07F < PokeBattle_Move
  3355.   def pbBaseDamage(basedmg,attacker,opponent)
  3356.     if opponent.status>0 &&
  3357.        (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3358.       return basedmg*2
  3359.     end
  3360.     return basedmg
  3361.   end
  3362. end
  3363.  
  3364.  
  3365.  
  3366. ################################################################################
  3367. # Power is doubled if the target's HP is down to 1/2 or less. (Brine)
  3368. ################################################################################
  3369. class PokeBattle_Move_080 < PokeBattle_Move
  3370.   def pbBaseDamage(basedmg,attacker,opponent)
  3371.     if opponent.hp<=opponent.totalhp/2
  3372.       return basedmg*2
  3373.     end
  3374.     return basedmg
  3375.   end
  3376. end
  3377.  
  3378.  
  3379.  
  3380. ################################################################################
  3381. # Power is doubled if the user has lost HP due to the target's move this round.
  3382. # (Revenge, Avalanche)
  3383. ################################################################################
  3384. class PokeBattle_Move_081 < PokeBattle_Move
  3385.   def pbBaseDamage(basedmg,attacker,opponent)
  3386.     if attacker.lastHPLost>0 && attacker.lastAttacker.include?(opponent.index)
  3387.       return basedmg*2
  3388.     end
  3389.     return basedmg
  3390.   end
  3391. end
  3392.  
  3393.  
  3394.  
  3395. ################################################################################
  3396. # Power is doubled if the target has already lost HP this round. (Assurance)
  3397. ################################################################################
  3398. class PokeBattle_Move_082 < PokeBattle_Move
  3399.   def pbBaseDamage(basedmg,attacker,opponent)
  3400.     if opponent.tookDamage
  3401.       return basedmg*2
  3402.     end
  3403.     return basedmg
  3404.   end
  3405. end
  3406.  
  3407.  
  3408.  
  3409. ################################################################################
  3410. # Power is doubled if a user's ally has already used this move this round. (Round)
  3411. # If an ally is about to use the same move, make it go next, ignoring priority.
  3412. ################################################################################
  3413. class PokeBattle_Move_083 < PokeBattle_Move
  3414.   def pbBaseDamage(basedmg,attacker,opponent)
  3415.     ret=basedmg
  3416.     attacker.pbOwnSide.effects[PBEffects::Round].times do
  3417.       ret*=2
  3418.     end
  3419.     return ret
  3420.   end
  3421.  
  3422.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3423.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3424.     if opponent.damagestate.calcdamage>0
  3425.       attacker.pbOwnSide.effects[PBEffects::Round]+=1
  3426.       if attacker.pbPartner && !attacker.pbPartner.hasMovedThisRound?
  3427.         if @battle.choices[attacker.pbPartner.index][0]==1 # Will use a move
  3428.           partnermove=@battle.choices[attacker.pbPartner.index][2]
  3429.           if partnermove.function==@function
  3430.             attacker.pbPartner.effects[PBEffects::MoveNext]=true
  3431.             attacker.pbPartner.effects[PBEffects::Quash]=false
  3432.           end
  3433.         end
  3434.       end
  3435.     end
  3436.     return ret
  3437.   end
  3438. end
  3439.  
  3440.  
  3441.  
  3442. ################################################################################
  3443. # Power is doubled if the target has already moved this round. (Payback)
  3444. ################################################################################
  3445. class PokeBattle_Move_084 < PokeBattle_Move
  3446.   def pbBaseDamage(basedmg,attacker,opponent)
  3447.     if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3448.        opponent.hasMovedThisRound? # Used a move already
  3449.       return basedmg*2
  3450.     end
  3451.     return basedmg
  3452.   end
  3453. end
  3454.  
  3455.  
  3456.  
  3457. ################################################################################
  3458. # Power is doubled if a user's teammate fainted last round. (Retaliate)
  3459. ################################################################################
  3460. class PokeBattle_Move_085 < PokeBattle_Move
  3461.   def pbBaseDamage(basedmg,attacker,opponent)
  3462.     if attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]>=0 &&
  3463.        attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]==@battle.turncount-1
  3464.       return basedmg*2
  3465.     end
  3466.     return basedmg
  3467.   end
  3468. end
  3469.  
  3470.  
  3471.  
  3472. ################################################################################
  3473. # Power is doubled if the user has no held item. (Acrobatics)
  3474. ################################################################################
  3475. class PokeBattle_Move_086 < PokeBattle_Move
  3476.   def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3477.     if attacker.item==0
  3478.       return (damagemult*2.0).round
  3479.     end
  3480.     return damagemult
  3481.   end
  3482. end
  3483.  
  3484.  
  3485.  
  3486. ################################################################################
  3487. # Power is doubled in weather. Type changes depending on the weather. (Weather Ball)
  3488. ################################################################################
  3489. class PokeBattle_Move_087 < PokeBattle_Move
  3490.   def pbBaseDamage(basedmg,attacker,opponent)
  3491.     if @battle.pbWeather!=0
  3492.       return basedmg*2
  3493.     end
  3494.     return basedmg
  3495.   end
  3496.  
  3497.   def pbModifyType(type,attacker,opponent)
  3498.     type=getConst(PBTypes,:NORMAL) || 0
  3499.     case @battle.pbWeather
  3500.     when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  3501.       type=(getConst(PBTypes,:FIRE) || type)
  3502.     when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  3503.       type=(getConst(PBTypes,:WATER) || type)
  3504.     when PBWeather::SANDSTORM
  3505.       type=(getConst(PBTypes,:ROCK) || type)
  3506.     when PBWeather::HAIL
  3507.       type=(getConst(PBTypes,:ICE) || type)
  3508.     end
  3509.     return type
  3510.   end
  3511. end
  3512.  
  3513.  
  3514.  
  3515. ################################################################################
  3516. # Power is doubled if a foe tries to switch out or use U-turn/Volt Switch/
  3517. # Parting Shot. (Pursuit)
  3518. # (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
  3519. ################################################################################
  3520. class PokeBattle_Move_088 < PokeBattle_Move
  3521.   def pbBaseDamage(basedmg,attacker,opponent)
  3522.     if @battle.switching
  3523.       return basedmg*2
  3524.     end
  3525.     return basedmg
  3526.   end
  3527.  
  3528.   def pbAccuracyCheck(attacker,opponent)
  3529.     return true if @battle.switching
  3530.     return super(attacker,opponent)
  3531.   end
  3532. end
  3533.  
  3534.  
  3535.  
  3536. ################################################################################
  3537. # Power increases with the user's happiness. (Return)
  3538. ################################################################################
  3539. class PokeBattle_Move_089 < PokeBattle_Move
  3540.   def pbBaseDamage(basedmg,attacker,opponent)
  3541.     return [(attacker.happiness*2/5).floor,1].max
  3542.   end
  3543. end
  3544.  
  3545.  
  3546.  
  3547. ################################################################################
  3548. # Power decreases with the user's happiness. (Frustration)
  3549. ################################################################################
  3550. class PokeBattle_Move_08A < PokeBattle_Move
  3551.   def pbBaseDamage(basedmg,attacker,opponent)
  3552.     return [((255-attacker.happiness)*2/5).floor,1].max
  3553.   end
  3554. end
  3555.  
  3556.  
  3557.  
  3558. ################################################################################
  3559. # Power increases with the user's HP. (Eruption, Water Spout)
  3560. ################################################################################
  3561. class PokeBattle_Move_08B < PokeBattle_Move
  3562.   def pbBaseDamage(basedmg,attacker,opponent)
  3563.     return [(150*attacker.hp/attacker.totalhp).floor,1].max
  3564.   end
  3565. end
  3566.  
  3567.  
  3568.  
  3569. ################################################################################
  3570. # Power increases with the target's HP. (Crush Grip, Wring Out)
  3571. ################################################################################
  3572. class PokeBattle_Move_08C < PokeBattle_Move
  3573.   def pbBaseDamage(basedmg,attacker,opponent)
  3574.     return [(120*opponent.hp/opponent.totalhp).floor,1].max
  3575.   end
  3576. end
  3577.  
  3578.  
  3579.  
  3580. ################################################################################
  3581. # Power increases the quicker the target is than the user. (Gyro Ball)
  3582. ################################################################################
  3583. class PokeBattle_Move_08D < PokeBattle_Move
  3584.   def pbBaseDamage(basedmg,attacker,opponent)
  3585.     return [[(25*opponent.pbSpeed/attacker.pbSpeed).floor,150].min,1].max
  3586.   end
  3587. end
  3588.  
  3589.  
  3590.  
  3591. ################################################################################
  3592. # Power increases with the user's positive stat changes (ignores negative ones).
  3593. # (Stored Power)
  3594. ################################################################################
  3595. class PokeBattle_Move_08E < PokeBattle_Move
  3596.   def pbBaseDamage(basedmg,attacker,opponent)
  3597.     mult=1
  3598.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3599.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3600.       mult+=attacker.stages[i] if attacker.stages[i]>0
  3601.     end
  3602.     return 20*mult
  3603.   end
  3604. end
  3605.  
  3606.  
  3607.  
  3608. ################################################################################
  3609. # Power increases with the target's positive stat changes (ignores negative ones).
  3610. # (Punishment)
  3611. ################################################################################
  3612. class PokeBattle_Move_08F < PokeBattle_Move
  3613.   def pbBaseDamage(basedmg,attacker,opponent)
  3614.     mult=3
  3615.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3616.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3617.       mult+=opponent.stages[i] if opponent.stages[i]>0
  3618.     end
  3619.     return [20*mult,200].min
  3620.   end
  3621. end
  3622.  
  3623.  
  3624.  
  3625. ################################################################################
  3626. # Power and type depends on the user's IVs. (Hidden Power)
  3627. ################################################################################
  3628. class PokeBattle_Move_090 < PokeBattle_Move
  3629.   def pbModifyType(type,attacker,opponent)
  3630.     hp=pbHiddenPower(attacker.iv)
  3631.     type=hp[0]
  3632.     return type
  3633.   end
  3634.  
  3635.   def pbBaseDamage(basedmg,attacker,opponent)
  3636.     return 60 if USENEWBATTLEMECHANICS
  3637.     hp=pbHiddenPower(attacker.iv)
  3638.     return hp[1]
  3639.   end
  3640. end
  3641.  
  3642. def pbHiddenPower(iv)
  3643.   powermin=30
  3644.   powermax=70
  3645.   type=0; base=0
  3646.   types=[]
  3647.   for i in 0..PBTypes.maxValue
  3648.     types.push(i) if !PBTypes.isPseudoType?(i) &&
  3649.                      !isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
  3650.   end
  3651.   type|=(iv[PBStats::HP]&1)
  3652.   type|=(iv[PBStats::ATTACK]&1)<<1
  3653.   type|=(iv[PBStats::DEFENSE]&1)<<2
  3654.   type|=(iv[PBStats::SPEED]&1)<<3
  3655.   type|=(iv[PBStats::SPATK]&1)<<4
  3656.   type|=(iv[PBStats::SPDEF]&1)<<5
  3657.   type=(type*(types.length-1)/63).floor
  3658.   hptype=types[type]
  3659.   base|=(iv[PBStats::HP]&2)>>1
  3660.   base|=(iv[PBStats::ATTACK]&2)
  3661.   base|=(iv[PBStats::DEFENSE]&2)<<1
  3662.   base|=(iv[PBStats::SPEED]&2)<<2
  3663.   base|=(iv[PBStats::SPATK]&2)<<3
  3664.   base|=(iv[PBStats::SPDEF]&2)<<4
  3665.   base=(base*(powermax-powermin)/63).floor+powermin
  3666.   return [hptype,base]
  3667. end
  3668.  
  3669. ################################################################################
  3670. # Power doubles for each consecutive use. (Fury Cutter)
  3671. ################################################################################
  3672. class PokeBattle_Move_091 < PokeBattle_Move
  3673.   def pbBaseDamage(basedmg,attacker,opponent)
  3674.     basedmg=basedmg<<(attacker.effects[PBEffects::FuryCutter]-1) # can be 1 to 4
  3675.     return basedmg
  3676.   end
  3677. end
  3678.  
  3679.  
  3680.  
  3681. ################################################################################
  3682. # Power is multiplied by the number of consecutive rounds in which this move was
  3683. # used by any Pokémon on the user's side. (Echoed Voice)
  3684. ################################################################################
  3685. class PokeBattle_Move_092 < PokeBattle_Move
  3686.   def pbBaseDamage(basedmg,attacker,opponent)
  3687.     basedmg*=attacker.pbOwnSide.effects[PBEffects::EchoedVoiceCounter] # can be 1 to 5
  3688.     return basedmg
  3689.   end
  3690. end
  3691.  
  3692.  
  3693.  
  3694. ################################################################################
  3695. # User rages until the start of a round in which they don't use this move. (Rage)
  3696. # (Handled in Battler's pbProcessMoveAgainstTarget): Ups rager's Attack by 1
  3697. # stage each time it loses HP due to a move.
  3698. ################################################################################
  3699. class PokeBattle_Move_093 < PokeBattle_Move
  3700.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3701.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3702.     attacker.effects[PBEffects::Rage]=true if ret>0
  3703.     return ret
  3704.   end
  3705. end
  3706.  
  3707.  
  3708.  
  3709. ################################################################################
  3710. # Randomly damages or heals the target. (Present)
  3711. ################################################################################
  3712. class PokeBattle_Move_094 < PokeBattle_Move
  3713.   def pbOnStartUse(attacker)
  3714.     # Just to ensure that Parental Bond's second hit damages if the first hit does
  3715.     @forcedamage=false
  3716.     return true
  3717.   end
  3718.  
  3719.   def pbBaseDamage(basedmg,attacker,opponent)
  3720.     @forcedamage=true
  3721.     return @calcbasedmg
  3722.   end
  3723.  
  3724.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3725.     @calcbasedmg=1
  3726.     r=@battle.pbRandom((@forcedamage) ? 8 : 10)
  3727.     if r<4
  3728.       @calcbasedmg=40
  3729.     elsif r<7
  3730.       @calcbasedmg=80
  3731.     elsif r<8
  3732.       @calcbasedmg=120
  3733.     else
  3734.       if pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)==0
  3735.         @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  3736.         return -1
  3737.       end
  3738.       if opponent.hp==opponent.totalhp
  3739.         @battle.pbDisplay(_INTL("But it failed!"))
  3740.         return -1
  3741.       end
  3742.       damage=pbCalcDamage(attacker,opponent) # Consumes Gems even if it will heal
  3743.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Healing animation
  3744.       opponent.pbRecoverHP((opponent.totalhp/4).floor,true)
  3745.       @battle.pbDisplay(_INTL("{1} had its HP restored.",opponent.pbThis))  
  3746.       return 0
  3747.     end
  3748.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  3749.   end
  3750. end
  3751.  
  3752.  
  3753.  
  3754. ################################################################################
  3755. # Power is chosen at random. Power is doubled if the target is using Dig. (Magnitude)
  3756. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3757. ################################################################################
  3758. class PokeBattle_Move_095 < PokeBattle_Move
  3759.   def pbOnStartUse(attacker)
  3760.     basedmg=[10,30,50,70,90,110,150]
  3761.     magnitudes=[
  3762.        4,
  3763.        5,5,
  3764.        6,6,6,6,
  3765.        7,7,7,7,7,7,
  3766.        8,8,8,8,
  3767.        9,9,
  3768.        10
  3769.     ]
  3770.     magni=magnitudes[@battle.pbRandom(magnitudes.length)]
  3771.     @calcbasedmg=basedmg[magni-4]
  3772.     @battle.pbDisplay(_INTL("Magnitude {1}!",magni))
  3773.     return true
  3774.   end
  3775.  
  3776.   def pbBaseDamage(basedmg,attacker,opponent)
  3777.     ret=@calcbasedmg
  3778.     if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3779.       ret*=2
  3780.     end
  3781.     if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3782.       ret=(ret/2.0).round
  3783.     end
  3784.     return ret
  3785.   end
  3786. end
  3787.  
  3788.  
  3789.  
  3790. ################################################################################
  3791. # Power and type depend on the user's held berry. Destroys the berry. (Natural Gift)
  3792. ################################################################################
  3793. class PokeBattle_Move_096 < PokeBattle_Move
  3794.   def pbOnStartUse(attacker)
  3795.     if !pbIsBerry?(attacker.item) ||
  3796.        attacker.effects[PBEffects::Embargo]>0 ||
  3797.        @battle.field.effects[PBEffects::MagicRoom]>0 ||
  3798.        attacker.hasWorkingAbility(:KLUTZ) ||
  3799.        attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) ||
  3800.        attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  3801.       @battle.pbDisplay(_INTL("But it failed!"))
  3802.       return false
  3803.     end
  3804.     @berry=attacker.item
  3805.     return true
  3806.   end
  3807.  
  3808.   def pbBaseDamage(basedmg,attacker,opponent)
  3809.     damagearray={
  3810.        60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
  3811.               :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
  3812.               :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
  3813.               :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
  3814.               :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
  3815.               :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
  3816.               :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY,:ROSELIBERRY],
  3817.        70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
  3818.               :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
  3819.               :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
  3820.               :PAMTREBERRY],
  3821.        80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
  3822.               :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
  3823.               :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JABOCABERRY,:ROWAPBERRY,
  3824.               :KEEBERRY,:MARANGABERRY]
  3825.     }
  3826.     for i in damagearray.keys
  3827.       data=damagearray[i]
  3828.       if data
  3829.         for j in data
  3830.           if isConst?(@berry,PBItems,j)
  3831.             ret=i
  3832.             ret+=20 if USENEWBATTLEMECHANICS
  3833.             return ret
  3834.           end
  3835.         end
  3836.       end
  3837.     end
  3838.     return 1
  3839.   end
  3840.  
  3841.   def pbModifyType(type,attacker,opponent)
  3842.     type=getConst(PBTypes,:NORMAL) || 0
  3843.     typearray={
  3844.        :NORMAL   => [:CHILANBERRY],
  3845.        :FIRE     => [:CHERIBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
  3846.        :WATER    => [:CHESTOBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
  3847.        :ELECTRIC => [:PECHABERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
  3848.        :GRASS    => [:RAWSTBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
  3849.        :ICE      => [:ASPEARBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
  3850.        :FIGHTING => [:LEPPABERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
  3851.        :POISON   => [:ORANBERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
  3852.        :GROUND   => [:PERSIMBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
  3853.        :FLYING   => [:LUMBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
  3854.        :PSYCHIC  => [:SITRUSBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
  3855.        :BUG      => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
  3856.        :ROCK     => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
  3857.        :GHOST    => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
  3858.        :DRAGON   => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JABOCABERRY],
  3859.        :DARK     => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY,:MARANGABERRY],
  3860.        :STEEL    => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY],
  3861.        :FAIRY    => [:ROSELIBERRY,:KEEBERRY]
  3862.     }
  3863.     for i in typearray.keys
  3864.       data=typearray[i]
  3865.       if data
  3866.         for j in data
  3867.           if isConst?(@berry,PBItems,j)
  3868.             type=getConst(PBTypes,i) || type
  3869.           end
  3870.         end
  3871.       end
  3872.     end
  3873.     return type
  3874.   end
  3875.  
  3876.   def pbEffectAfterHit(attacker,opponent,turneffects)
  3877.     if turneffects[PBEffects::TotalDamage]>0
  3878.       attacker.pbConsumeItem
  3879.     end
  3880.   end
  3881. end
  3882.  
  3883.  
  3884.  
  3885. ################################################################################
  3886. # Power increases the less PP this move has. (Trump Card)
  3887. ################################################################################
  3888. class PokeBattle_Move_097 < PokeBattle_Move
  3889.   def pbBaseDamage(basedmg,attacker,opponent)
  3890.     dmgs=[200,80,60,50,40]
  3891.     ppleft=[@pp,4].min   # PP is reduced before the move is used
  3892.     basedmg=dmgs[ppleft]
  3893.     return basedmg
  3894.   end
  3895. end
  3896.  
  3897.  
  3898.  
  3899. ################################################################################
  3900. # Power increases the less HP the user has. (Flail, Reversal)
  3901. ################################################################################
  3902. class PokeBattle_Move_098 < PokeBattle_Move
  3903.   def pbBaseDamage(basedmg,attacker,opponent)
  3904.     n=(48*attacker.hp/attacker.totalhp).floor
  3905.     ret=20
  3906.     ret=40 if n<33
  3907.     ret=80 if n<17
  3908.     ret=100 if n<10
  3909.     ret=150 if n<5
  3910.     ret=200 if n<2
  3911.     return ret
  3912.   end
  3913. end
  3914.  
  3915.  
  3916.  
  3917. ################################################################################
  3918. # Power increases the quicker the user is than the target. (Electro Ball)
  3919. ################################################################################
  3920. class PokeBattle_Move_099 < PokeBattle_Move
  3921.   def pbBaseDamage(basedmg,attacker,opponent)
  3922.     n=([attacker.pbSpeed,1].max/[opponent.pbSpeed,1].max).floor
  3923.     ret=60
  3924.     ret=80 if n>=2
  3925.     ret=120 if n>=3
  3926.     ret=150 if n>=4
  3927.     return ret
  3928.   end
  3929. end
  3930.  
  3931.  
  3932.  
  3933. ################################################################################
  3934. # Power increases the heavier the target is. (Grass Knot, Low Kick)
  3935. ################################################################################
  3936. class PokeBattle_Move_09A < PokeBattle_Move
  3937.   def pbBaseDamage(basedmg,attacker,opponent)
  3938.     weight=opponent.weight(attacker)
  3939.     ret=20
  3940.     ret=40 if weight>=100
  3941.     ret=60 if weight>=250
  3942.     ret=80 if weight>=500
  3943.     ret=100 if weight>=1000
  3944.     ret=120 if weight>=2000
  3945.     return ret
  3946.   end
  3947. end
  3948.  
  3949.  
  3950.  
  3951. ################################################################################
  3952. # Power increases the heavier the user is than the target. (Heat Crash, Heavy Slam)
  3953. ################################################################################
  3954. class PokeBattle_Move_09B < PokeBattle_Move
  3955.   def pbBaseDamage(basedmg,attacker,opponent)
  3956.     n=(attacker.weight/opponent.weight(attacker)).floor
  3957.     ret=40
  3958.     ret=60 if n>=2
  3959.     ret=80 if n>=3
  3960.     ret=100 if n>=4
  3961.     ret=120 if n>=5
  3962.     return ret
  3963.   end
  3964. end
  3965.  
  3966.  
  3967.  
  3968. ################################################################################
  3969. # Powers up the ally's attack this round by 1.5. (Helping Hand)
  3970. ################################################################################
  3971. class PokeBattle_Move_09C < PokeBattle_Move
  3972.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3973.     if !@battle.doublebattle || opponent.fainted? ||
  3974.        @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3975.        opponent.hasMovedThisRound? ||
  3976.        opponent.effects[PBEffects::HelpingHand]
  3977.       @battle.pbDisplay(_INTL("But it failed!"))  
  3978.       return -1
  3979.     end
  3980.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3981.     opponent.effects[PBEffects::HelpingHand]=true
  3982.     @battle.pbDisplay(_INTL("{1} is ready to help {2}!",attacker.pbThis,opponent.pbThis(true)))
  3983.     return 0
  3984.   end
  3985. end
  3986.  
  3987.  
  3988.  
  3989. ################################################################################
  3990. # Weakens Electric attacks. (Mud Sport)
  3991. ################################################################################
  3992. class PokeBattle_Move_09D < PokeBattle_Move
  3993.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3994.     if USENEWBATTLEMECHANICS
  3995.       if @battle.field.effects[PBEffects::MudSportField]>0
  3996.         @battle.pbDisplay(_INTL("But it failed!"))
  3997.         return -1
  3998.       end
  3999.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4000.       @battle.field.effects[PBEffects::MudSportField]=5
  4001.       @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4002.       return 0
  4003.     else
  4004.       for i in 0...4
  4005.         if attacker.battle.battlers[i].effects[PBEffects::MudSport]
  4006.           @battle.pbDisplay(_INTL("But it failed!"))
  4007.           return -1
  4008.         end
  4009.       end
  4010.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4011.       attacker.effects[PBEffects::MudSport]=true
  4012.       @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4013.       return 0
  4014.     end
  4015.     return -1
  4016.   end
  4017. end
  4018.  
  4019.  
  4020.  
  4021. ################################################################################
  4022. # Weakens Fire attacks. (Water Sport)
  4023. ################################################################################
  4024. class PokeBattle_Move_09E < PokeBattle_Move
  4025.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4026.     if USENEWBATTLEMECHANICS
  4027.       if @battle.field.effects[PBEffects::WaterSportField]>0
  4028.         @battle.pbDisplay(_INTL("But it failed!"))
  4029.         return -1
  4030.       end
  4031.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4032.       @battle.field.effects[PBEffects::WaterSportField]=5
  4033.       @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4034.       return 0
  4035.     else
  4036.       for i in 0...4
  4037.         if attacker.battle.battlers[i].effects[PBEffects::WaterSport]
  4038.           @battle.pbDisplay(_INTL("But it failed!"))
  4039.           return -1
  4040.         end
  4041.       end
  4042.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4043.       attacker.effects[PBEffects::WaterSport]=true
  4044.       @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4045.       return 0
  4046.     end
  4047.   end
  4048. end
  4049.  
  4050.  
  4051.  
  4052. ################################################################################
  4053. # Type depends on the user's held item. (Judgment, Techno Blast)
  4054. ################################################################################
  4055. class PokeBattle_Move_09F < PokeBattle_Move
  4056.   def pbModifyType(type,attacker,opponent)
  4057.     if isConst?(@id,PBMoves,:JUDGMENT)
  4058.       return (getConst(PBTypes,:FIGHTING) || 0) if isConst?(attacker.item,PBItems,:FISTPLATE)
  4059.       return (getConst(PBTypes,:FLYING) || 0)   if isConst?(attacker.item,PBItems,:SKYPLATE)
  4060.       return (getConst(PBTypes,:POISON) || 0)   if isConst?(attacker.item,PBItems,:TOXICPLATE)
  4061.       return (getConst(PBTypes,:GROUND) || 0)   if isConst?(attacker.item,PBItems,:EARTHPLATE)
  4062.       return (getConst(PBTypes,:ROCK) || 0)     if isConst?(attacker.item,PBItems,:STONEPLATE)
  4063.       return (getConst(PBTypes,:BUG) || 0)      if isConst?(attacker.item,PBItems,:INSECTPLATE)
  4064.       return (getConst(PBTypes,:GHOST) || 0)    if isConst?(attacker.item,PBItems,:SPOOKYPLATE)
  4065.       return (getConst(PBTypes,:STEEL) || 0)    if isConst?(attacker.item,PBItems,:IRONPLATE)
  4066.       return (getConst(PBTypes,:FIRE) || 0)     if isConst?(attacker.item,PBItems,:FLAMEPLATE)
  4067.       return (getConst(PBTypes,:WATER) || 0)    if isConst?(attacker.item,PBItems,:SPLASHPLATE)
  4068.       return (getConst(PBTypes,:GRASS) || 0)    if isConst?(attacker.item,PBItems,:MEADOWPLATE)
  4069.       return (getConst(PBTypes,:ELECTRIC) || 0) if isConst?(attacker.item,PBItems,:ZAPPLATE)
  4070.       return (getConst(PBTypes,:PSYCHIC) || 0)  if isConst?(attacker.item,PBItems,:MINDPLATE)
  4071.       return (getConst(PBTypes,:ICE) || 0)      if isConst?(attacker.item,PBItems,:ICICLEPLATE)
  4072.       return (getConst(PBTypes,:DRAGON) || 0)   if isConst?(attacker.item,PBItems,:DRACOPLATE)
  4073.       return (getConst(PBTypes,:DARK) || 0)     if isConst?(attacker.item,PBItems,:DREADPLATE)
  4074.       return (getConst(PBTypes,:FAIRY) || 0)    if isConst?(attacker.item,PBItems,:PIXIEPLATE)
  4075.     elsif isConst?(@id,PBMoves,:TECHNOBLAST)
  4076.       return getConst(PBTypes,:ELECTRIC) if isConst?(attacker.item,PBItems,:SHOCKDRIVE)
  4077.       return getConst(PBTypes,:FIRE)     if isConst?(attacker.item,PBItems,:BURNDRIVE)
  4078.       return getConst(PBTypes,:ICE)      if isConst?(attacker.item,PBItems,:CHILLDRIVE)
  4079.       return getConst(PBTypes,:WATER)    if isConst?(attacker.item,PBItems,:DOUSEDRIVE)
  4080.     end
  4081.     return (getConst(PBTypes,:NORMAL) || 0)
  4082.   end
  4083.  
  4084.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4085.     if isConst?(@id,PBMoves,:TECHNOBLAST)
  4086.       anim = 0
  4087.       anim = 1 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ELECTRIC)
  4088.       anim = 2 if isConst?(pbType(@type,attacker,opponent),PBTypes,:FIRE)
  4089.       anim = 3 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ICE)
  4090.       anim = 4 if isConst?(pbType(@type,attacker,opponent),PBTypes,:WATER)
  4091.       return super(id,attacker,opponent,anim,alltargets,showanimation) # Type-specific anim
  4092.     end
  4093.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  4094.   end
  4095. end
  4096.  
  4097.  
  4098.  
  4099. ################################################################################
  4100. # This attack is always a critical hit. (Frost Breath, Storm Throw)
  4101. ################################################################################
  4102. class PokeBattle_Move_0A0 < PokeBattle_Move
  4103.   def pbCritialOverride(attacker,opponent)
  4104.     return true
  4105.   end
  4106. end
  4107.  
  4108.  
  4109.  
  4110. ################################################################################
  4111. # For 5 rounds, foes' attacks cannot become critical hits. (Lucky Chant)
  4112. ################################################################################
  4113. class PokeBattle_Move_0A1 < PokeBattle_Move
  4114.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4115.     if attacker.pbOwnSide.effects[PBEffects::LuckyChant]>0
  4116.       @battle.pbDisplay(_INTL("But it failed!"))
  4117.       return -1
  4118.     end
  4119.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4120.     attacker.pbOwnSide.effects[PBEffects::LuckyChant]=5
  4121.     if !@battle.pbIsOpposing?(attacker.index)
  4122.       @battle.pbDisplay(_INTL("The Lucky Chant shielded your team from critical hits!"))
  4123.     else
  4124.       @battle.pbDisplay(_INTL("The Lucky Chant shielded the opposing team from critical hits!"))
  4125.     end  
  4126.     return 0
  4127.   end
  4128. end
  4129.  
  4130.  
  4131.  
  4132. ################################################################################
  4133. # For 5 rounds, lowers power of physical attacks against the user's side. (Reflect)
  4134. ################################################################################
  4135. class PokeBattle_Move_0A2 < PokeBattle_Move
  4136.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4137.     if attacker.pbOwnSide.effects[PBEffects::Reflect]>0
  4138.       @battle.pbDisplay(_INTL("But it failed!"))
  4139.       return -1
  4140.     end
  4141.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4142.     attacker.pbOwnSide.effects[PBEffects::Reflect]=5
  4143.     attacker.pbOwnSide.effects[PBEffects::Reflect]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4144.     if !@battle.pbIsOpposing?(attacker.index)
  4145.       @battle.pbDisplay(_INTL("Reflect raised your team's Defense!"))
  4146.     else
  4147.       @battle.pbDisplay(_INTL("Reflect raised the opposing team's Defense!"))
  4148.     end  
  4149.     return 0
  4150.   end
  4151. end
  4152.  
  4153.  
  4154.  
  4155. ################################################################################
  4156. # For 5 rounds, lowers power of special attacks against the user's side. (Light Screen)
  4157. ################################################################################
  4158. class PokeBattle_Move_0A3 < PokeBattle_Move
  4159.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4160.     if attacker.pbOwnSide.effects[PBEffects::LightScreen]>0
  4161.       @battle.pbDisplay(_INTL("But it failed!"))
  4162.       return -1
  4163.     end
  4164.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4165.     attacker.pbOwnSide.effects[PBEffects::LightScreen]=5
  4166.     attacker.pbOwnSide.effects[PBEffects::LightScreen]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4167.     if !@battle.pbIsOpposing?(attacker.index)
  4168.       @battle.pbDisplay(_INTL("Light Screen raised your team's Special Defense!"))
  4169.     else
  4170.       @battle.pbDisplay(_INTL("Light Screen raised the opposing team's Special Defense!"))
  4171.     end
  4172.     return 0
  4173.   end
  4174. end
  4175.  
  4176.  
  4177.  
  4178. ################################################################################
  4179. # Effect depends on the environment. (Secret Power)
  4180. ################################################################################
  4181. class PokeBattle_Move_0A4 < PokeBattle_Move
  4182.   def pbAdditionalEffect(attacker,opponent)
  4183.     return if opponent.damagestate.substitute
  4184.     if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4185.       if opponent.pbCanParalyze?(attacker,false,self)
  4186.         opponent.pbParalyze(attacker)
  4187.       end
  4188.       return
  4189.     elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4190.       if opponent.pbCanSleep?(attacker,false,self)
  4191.         opponent.pbSleep
  4192.       end
  4193.       return
  4194.     elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4195.       if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  4196.         opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  4197.       end
  4198.       return
  4199.     end
  4200.     case @battle.environment
  4201.     when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4202.       if opponent.pbCanSleep?(attacker,false,self)
  4203.         opponent.pbSleep
  4204.       end
  4205.     when PBEnvironment::MovingWater, PBEnvironment::Underwater
  4206.       if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  4207.         opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  4208.       end
  4209.     when PBEnvironment::StillWater, PBEnvironment::Sky
  4210.       if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  4211.         opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  4212.       end
  4213.     when PBEnvironment::Sand
  4214.       if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4215.         opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4216.       end
  4217.     when PBEnvironment::Rock
  4218.       if USENEWBATTLEMECHANICS
  4219.         if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4220.           opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4221.         end
  4222.       else
  4223.         if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4224.           opponent.pbFlinch(attacker)
  4225.         end
  4226.       end
  4227.     when PBEnvironment::Cave, PBEnvironment::Graveyard, PBEnvironment::Space
  4228.       if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4229.         opponent.pbFlinch(attacker)
  4230.       end
  4231.     when PBEnvironment::Snow
  4232.       if opponent.pbCanFreeze?(attacker,false,self)
  4233.         opponent.pbFreeze
  4234.       end
  4235.     when PBEnvironment::Volcano
  4236.       if opponent.pbCanBurn?(attacker,false,self)
  4237.         opponent.pbBurn(attacker)
  4238.       end
  4239.     else
  4240.       if opponent.pbCanParalyze?(attacker,false,self)
  4241.         opponent.pbParalyze(attacker)
  4242.       end
  4243.     end
  4244.   end
  4245.  
  4246.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4247.     id=getConst(PBMoves,:BODYSLAM)
  4248.     if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4249.       id=getConst(PBMoves,:THUNDERSHOCK) || id
  4250.     elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4251.       id=getConst(PBMoves,:VINEWHIP) || id
  4252.     elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4253.       id=getConst(PBMoves,:FAIRYWIND) || id
  4254.     else
  4255.       case @battle.environment
  4256.       when PBEnvironment::Grass, PBEnvironment::TallGrass
  4257.         id=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)) || id
  4258.       when PBEnvironment::MovingWater; id=getConst(PBMoves,:WATERPULSE) || id
  4259.       when PBEnvironment::StillWater;  id=getConst(PBMoves,:MUDSHOT) || id
  4260.       when PBEnvironment::Underwater;  id=getConst(PBMoves,:WATERPULSE) || id
  4261.       when PBEnvironment::Cave;        id=getConst(PBMoves,:ROCKTHROW) || id
  4262.       when PBEnvironment::Rock;        id=getConst(PBMoves,:MUDSLAP) || id
  4263.       when PBEnvironment::Sand;        id=getConst(PBMoves,:MUDSLAP) || id
  4264.       when PBEnvironment::Forest;      id=getConst(PBMoves,:RAZORLEAF) || id
  4265.       # Ice tiles in Gen 6 should be Ice Shard
  4266.       when PBEnvironment::Snow;        id=getConst(PBMoves,:AVALANCHE) || id
  4267.       when PBEnvironment::Volcano;     id=getConst(PBMoves,:INCINERATE) || id
  4268.       when PBEnvironment::Graveyard;   id=getConst(PBMoves,:SHADOWSNEAK) || id
  4269.       when PBEnvironment::Sky;         id=getConst(PBMoves,:GUST) || id
  4270.       when PBEnvironment::Space;       id=getConst(PBMoves,:SWIFT) || id
  4271.       end
  4272.     end
  4273.     return super(id,attacker,opponent,hitnum,alltargets,showanimation) # Environment-specific anim
  4274.   end
  4275. end
  4276.  
  4277.  
  4278.  
  4279. ################################################################################
  4280. # Always hits.
  4281. ################################################################################
  4282. class PokeBattle_Move_0A5 < PokeBattle_Move
  4283.   def pbAccuracyCheck(attacker,opponent)
  4284.     return true
  4285.   end
  4286. end
  4287.  
  4288.  
  4289.  
  4290. ################################################################################
  4291. # User's attack next round against the target will definitely hit. (Lock-On, Mind Reader)
  4292. ################################################################################
  4293. class PokeBattle_Move_0A6 < PokeBattle_Move
  4294.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4295.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  4296.       @battle.pbDisplay(_INTL("But it failed!"))  
  4297.       return -1
  4298.     end
  4299.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4300.     opponent.effects[PBEffects::LockOn]=2
  4301.     opponent.effects[PBEffects::LockOnPos]=attacker.index
  4302.     @battle.pbDisplay(_INTL("{1} took aim at {2}!",attacker.pbThis,opponent.pbThis(true)))
  4303.     return 0
  4304.   end
  4305. end
  4306.  
  4307.  
  4308.  
  4309. ################################################################################
  4310. # Target's evasion stat changes are ignored from now on. (Foresight, Odor Sleuth)
  4311. # Normal and Fighting moves have normal effectiveness against the Ghost-type target.
  4312. ################################################################################
  4313. class PokeBattle_Move_0A7 < PokeBattle_Move
  4314.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4315.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4316.       @battle.pbDisplay(_INTL("But it failed!"))  
  4317.       return -1
  4318.     end
  4319.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4320.     opponent.effects[PBEffects::Foresight]=true
  4321.     @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4322.     return 0
  4323.   end
  4324. end
  4325.  
  4326.  
  4327.  
  4328. ################################################################################
  4329. # Target's evasion stat changes are ignored from now on. (Miracle Eye)
  4330. # Psychic moves have normal effectiveness against the Dark-type target.
  4331. ################################################################################
  4332. class PokeBattle_Move_0A8 < PokeBattle_Move
  4333.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4334.     if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4335.       @battle.pbDisplay(_INTL("But it failed!"))  
  4336.       return -1
  4337.     end
  4338.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4339.     opponent.effects[PBEffects::MiracleEye]=true
  4340.     @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4341.     return 0
  4342.   end
  4343. end
  4344.  
  4345.  
  4346.  
  4347. ################################################################################
  4348. # This move ignores target's Defense, Special Defense and evasion stat changes.
  4349. # (Chip Away, Sacred Sword)
  4350. ################################################################################
  4351. class PokeBattle_Move_0A9 < PokeBattle_Move
  4352. # Handled in superclass def pbAccuracyCheck and def pbCalcDamage, do not edit!
  4353. end
  4354.  
  4355.  
  4356.  
  4357. ################################################################################
  4358. # User is protected against moves with the "B" flag this round. (Detect, Protect)
  4359. ################################################################################
  4360. class PokeBattle_Move_0AA < PokeBattle_Move
  4361.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4362.     ratesharers=[
  4363.        0xAA,   # Detect, Protect
  4364.        0xAB,   # Quick Guard
  4365.        0xAC,   # Wide Guard
  4366.        0xE8,   # Endure
  4367.        0x14B,  # King's Shield
  4368.        0x14C   # Spiky Shield
  4369.     ]
  4370.     if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4371.       attacker.effects[PBEffects::ProtectRate]=1
  4372.     end
  4373.     unmoved=false
  4374.     for poke in @battle.battlers
  4375.       next if poke.index==attacker.index
  4376.       if @battle.choices[poke.index][0]==1 && # Chose a move
  4377.          !poke.hasMovedThisRound?
  4378.         unmoved=true; break
  4379.       end
  4380.     end
  4381.     if !unmoved ||
  4382.        @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  4383.       attacker.effects[PBEffects::ProtectRate]=1
  4384.       @battle.pbDisplay(_INTL("But it failed!"))
  4385.       return -1
  4386.     end
  4387.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4388.     attacker.effects[PBEffects::Protect]=true
  4389.     attacker.effects[PBEffects::ProtectRate]*=2
  4390.     @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  4391.     return 0
  4392.   end
  4393. end
  4394.  
  4395.  
  4396.  
  4397. ################################################################################
  4398. # User's side is protected against moves with priority greater than 0 this round.
  4399. # (Quick Guard)
  4400. ################################################################################
  4401. class PokeBattle_Move_0AB < PokeBattle_Move
  4402.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4403.     if attacker.pbOwnSide.effects[PBEffects::QuickGuard]
  4404.       @battle.pbDisplay(_INTL("But it failed!"))
  4405.       return -1
  4406.     end
  4407.     ratesharers=[
  4408.        0xAA,   # Detect, Protect
  4409.        0xAB,   # Quick Guard
  4410.        0xAC,   # Wide Guard
  4411.        0xE8,   # Endure
  4412.        0x14B,  # King's Shield
  4413.        0x14C   # Spiky Shield
  4414.     ]
  4415.     if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4416.       attacker.effects[PBEffects::ProtectRate]=1
  4417.     end
  4418.     unmoved=false
  4419.     for poke in @battle.battlers
  4420.       next if poke.index==attacker.index
  4421.       if @battle.choices[poke.index][0]==1 && # Chose a move
  4422.          !poke.hasMovedThisRound?
  4423.         unmoved=true; break
  4424.       end
  4425.     end
  4426.     if !unmoved ||
  4427.        (!USENEWBATTLEMECHANICS &&
  4428.        @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4429.       attacker.effects[PBEffects::ProtectRate]=1
  4430.       @battle.pbDisplay(_INTL("But it failed!"))
  4431.       return -1
  4432.     end
  4433.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4434.     attacker.pbOwnSide.effects[PBEffects::QuickGuard]=true
  4435.     attacker.effects[PBEffects::ProtectRate]*=2
  4436.     if !@battle.pbIsOpposing?(attacker.index)
  4437.       @battle.pbDisplay(_INTL("Quick Guard protected your team!"))
  4438.     else
  4439.       @battle.pbDisplay(_INTL("Quick Guard protected the opposing team!"))
  4440.     end
  4441.     return 0
  4442.   end
  4443. end
  4444.  
  4445.  
  4446.  
  4447. ################################################################################
  4448. # User's side is protected against moves that target multiple battlers this round.
  4449. # (Wide Guard)
  4450. ################################################################################
  4451. class PokeBattle_Move_0AC < PokeBattle_Move
  4452.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4453.     if attacker.pbOwnSide.effects[PBEffects::WideGuard]
  4454.       @battle.pbDisplay(_INTL("But it failed!"))
  4455.       return -1
  4456.     end
  4457.     ratesharers=[
  4458.        0xAA,   # Detect, Protect
  4459.        0xAB,   # Quick Guard
  4460.        0xAC,   # Wide Guard
  4461.        0xE8,   # Endure
  4462.        0x14B,  # King's Shield
  4463.        0x14C   # Spiky Shield
  4464.     ]
  4465.     if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4466.       attacker.effects[PBEffects::ProtectRate]=1
  4467.     end
  4468.     unmoved=false
  4469.     for poke in @battle.battlers
  4470.       next if poke.index==attacker.index
  4471.       if @battle.choices[poke.index][0]==1 && # Chose a move
  4472.          !poke.hasMovedThisRound?
  4473.         unmoved=true; break
  4474.       end
  4475.     end
  4476.     if !unmoved ||
  4477.        (!USENEWBATTLEMECHANICS &&
  4478.        @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4479.       attacker.effects[PBEffects::ProtectRate]=1
  4480.       @battle.pbDisplay(_INTL("But it failed!"))
  4481.       return -1
  4482.     end
  4483.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4484.     attacker.pbOwnSide.effects[PBEffects::WideGuard]=true
  4485.     attacker.effects[PBEffects::ProtectRate]*=2
  4486.     if !@battle.pbIsOpposing?(attacker.index)
  4487.       @battle.pbDisplay(_INTL("Wide Guard protected your team!"))
  4488.     else
  4489.       @battle.pbDisplay(_INTL("Wide Guard protected the opposing team!"))
  4490.     end
  4491.     return 0
  4492.   end
  4493. end
  4494.  
  4495.  
  4496.  
  4497. ################################################################################
  4498. # Ignores target's protections. If successful, all other moves this round
  4499. # ignore them too. (Feint)
  4500. ################################################################################
  4501. class PokeBattle_Move_0AD < PokeBattle_Move
  4502.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4503.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4504.     if ret>0
  4505.       opponent.effects[PBEffects::ProtectNegation]=true
  4506.       opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  4507.     end
  4508.     return ret
  4509.   end
  4510. end
  4511.  
  4512.  
  4513.  
  4514. ################################################################################
  4515. # Uses the last move that the target used. (Mirror Move)
  4516. ################################################################################
  4517. class PokeBattle_Move_0AE < PokeBattle_Move
  4518.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4519.     if opponent.lastMoveUsed<=0 ||
  4520.        (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
  4521.       @battle.pbDisplay(_INTL("The mirror move failed!"))
  4522.       return -1
  4523.     end
  4524.     attacker.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
  4525.     return 0
  4526.   end
  4527. end
  4528.  
  4529.  
  4530.  
  4531. ################################################################################
  4532. # Uses the last move that was used. (Copycat)
  4533. ################################################################################
  4534. class PokeBattle_Move_0AF < PokeBattle_Move
  4535.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4536.     blacklist=[
  4537.        0x02,    # Struggle
  4538.        0x69,    # Transform
  4539.        0x71,    # Counter
  4540.        0x72,    # Mirror Coat
  4541.        0x73,    # Metal Burst
  4542.        0x9C,    # Helping Hand
  4543.        0xAA,    # Detect, Protect
  4544.        0xAD,    # Feint
  4545.        0xAE,    # Mirror Move
  4546.        0xAF,    # Copycat
  4547.        0xB2,    # Snatch
  4548.        0xE7,    # Destiny Bond
  4549.        0xE8,    # Endure
  4550.        0xEC,    # Circle Throw, Dragon Tail
  4551.        0xF1,    # Covet, Thief
  4552.        0xF2,    # Switcheroo, Trick
  4553.        0xF3,    # Bestow
  4554.        0x115,   # Focus Punch
  4555.        0x117,   # Follow Me, Rage Powder
  4556.        0x158    # Belch
  4557.     ]
  4558.     if USENEWBATTLEMECHANICS
  4559.       blacklist+=[
  4560.          0xEB,    # Roar, Whirlwind
  4561.          # Two-turn attacks
  4562.          0xC3,    # Razor Wind
  4563.          0xC4,    # SolarBeam
  4564.          0xC5,    # Freeze Shock
  4565.          0xC6,    # Ice Burn
  4566.          0xC7,    # Sky Attack
  4567.          0xC8,    # Skull Bash
  4568.          0xC9,    # Fly
  4569.          0xCA,    # Dig
  4570.          0xCB,    # Dive
  4571.          0xCC,    # Bounce
  4572.          0xCD,    # Shadow Force
  4573.          0xCE,    # Sky Drop
  4574.          0x14D,   # Phantom Force
  4575.          0x14E    # Geomancy
  4576.       ]
  4577.     end
  4578.     if @battle.lastMoveUsed<=0 ||
  4579.        blacklist.include?(PBMoveData.new(@battle.lastMoveUsed).function)
  4580.       @battle.pbDisplay(_INTL("But it failed!"))
  4581.       return -1
  4582.     end
  4583.     attacker.pbUseMoveSimple(@battle.lastMoveUsed)
  4584.     return 0
  4585.   end
  4586. end
  4587.  
  4588.  
  4589.  
  4590. ################################################################################
  4591. # Uses the move the target was about to use this round, with 1.5x power. (Me First)
  4592. ################################################################################
  4593. class PokeBattle_Move_0B0 < PokeBattle_Move
  4594.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4595.     blacklist=[
  4596.        0x02,    # Struggle
  4597.        0x14,    # Chatter
  4598.        0x71,    # Counter
  4599.        0x72,    # Mirror Coat
  4600.        0x73,    # Metal Burst
  4601.        0xB0,    # Me First
  4602.        0xF1,    # Covet, Thief
  4603.        0x115,   # Focus Punch
  4604.        0x158    # Belch
  4605.     ]
  4606.     oppmove=@battle.choices[opponent.index][2]
  4607.     if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  4608.        opponent.hasMovedThisRound? ||
  4609.        !oppmove || oppmove.id<=0 ||
  4610.        oppmove.pbIsStatus? ||
  4611.        blacklist.include?(oppmove.function)
  4612.       @battle.pbDisplay(_INTL("But it failed!"))
  4613.       return -1
  4614.     end
  4615.     attacker.effects[PBEffects::MeFirst]=true
  4616.     attacker.pbUseMoveSimple(oppmove.id)
  4617.     attacker.effects[PBEffects::MeFirst]=false
  4618.     return 0
  4619.   end
  4620. end
  4621.  
  4622.  
  4623.  
  4624. ################################################################################
  4625. # This round, reflects all moves with the "C" flag targeting the user back at
  4626. # their origin. (Magic Coat)
  4627. ################################################################################
  4628. class PokeBattle_Move_0B1 < PokeBattle_Move
  4629.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4630.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4631.     attacker.effects[PBEffects::MagicCoat]=true
  4632.     @battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",attacker.pbThis))
  4633.     return 0
  4634.   end
  4635. end
  4636.  
  4637.  
  4638.  
  4639. ################################################################################
  4640. # This round, snatches all used moves with the "D" flag. (Snatch)
  4641. ################################################################################
  4642. class PokeBattle_Move_0B2 < PokeBattle_Move
  4643.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4644.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4645.     attacker.effects[PBEffects::Snatch]=true
  4646.     @battle.pbDisplay(_INTL("{1} waits for a target to make a move!",attacker.pbThis))
  4647.     return 0
  4648.   end
  4649. end
  4650.  
  4651.  
  4652.  
  4653. ################################################################################
  4654. # Uses a different move depending on the environment. (Nature Power)
  4655. ################################################################################
  4656. class PokeBattle_Move_0B3 < PokeBattle_Move
  4657.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4658.     move=getConst(PBMoves,:TRIATTACK) || 0
  4659.     case @battle.environment
  4660.     when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4661.       move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:ENERGYBALL) : getConst(PBMoves,:SEEDBOMB)) || move
  4662.     when PBEnvironment::MovingWater; move=getConst(PBMoves,:HYDROPUMP) || move
  4663.     when PBEnvironment::StillWater;  move=getConst(PBMoves,:MUDBOMB) || move
  4664.     when PBEnvironment::Underwater;  move=getConst(PBMoves,:HYDROPUMP) || move
  4665.     when PBEnvironment::Cave
  4666.       move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:POWERGEM) : getConst(PBMoves,:ROCKSLIDE)) || move
  4667.     when PBEnvironment::Rock
  4668.       move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:ROCKSLIDE)) || move
  4669.     when PBEnvironment::Sand
  4670.       move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:EARTHQUAKE)) || move
  4671.     # Ice tiles in Gen 6 should be Ice Beam
  4672.     when PBEnvironment::Snow
  4673.       move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:FROSTBREATH) : getConst(PBMoves,:ICEBEAM)) || move
  4674.     when PBEnvironment::Volcano;     move=getConst(PBMoves,:LAVAPLUME) || move
  4675.     when PBEnvironment::Graveyard;   move=getConst(PBMoves,:SHADOWBALL) || move
  4676.     when PBEnvironment::Sky;         move=getConst(PBMoves,:AIRSLASH) || move
  4677.     when PBEnvironment::Space;       move=getConst(PBMoves,:DRACOMETEOR) || move
  4678.     end
  4679.     if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4680.       move=getConst(PBMoves,:THUNDERBOLT) || move
  4681.     elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4682.       move=getConst(PBMoves,:ENERGYBALL) || move
  4683.     elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4684.       move=getConst(PBMoves,:MOONBLAST) || move
  4685.     end
  4686.     if move==0
  4687.       @battle.pbDisplay(_INTL("But it failed!"))
  4688.       return -1
  4689.     end
  4690.     thismovename=PBMoves.getName(@id)
  4691.     movename=PBMoves.getName(move)
  4692.     @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
  4693.     target=(USENEWBATTLEMECHANICS && opponent) ? opponent.index : -1
  4694.     attacker.pbUseMoveSimple(move,-1,target)
  4695.     return 0
  4696.   end
  4697. end
  4698.  
  4699.  
  4700.  
  4701. ################################################################################
  4702. # Uses a random move the user knows. Fails if user is not asleep. (Sleep Talk)
  4703. ################################################################################
  4704. class PokeBattle_Move_0B4 < PokeBattle_Move
  4705.   def pbCanUseWhileAsleep?
  4706.     return true
  4707.   end
  4708.  
  4709.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4710.     if attacker.status!=PBStatuses::SLEEP
  4711.       @battle.pbDisplay(_INTL("But it failed!"))
  4712.       return -1
  4713.     end
  4714.     blacklist=[
  4715.        0x02,    # Struggle
  4716.        0x14,    # Chatter
  4717.        0x5C,    # Mimic
  4718.        0x5D,    # Sketch
  4719.        0xAE,    # Mirror Move
  4720.        0xAF,    # Copycat
  4721.        0xB0,    # Me First
  4722.        0xB3,    # Nature Power
  4723.        0xB4,    # Sleep Talk
  4724.        0xB5,    # Assist
  4725.        0xB6,    # Metronome
  4726.        0xD1,    # Uproar
  4727.        0xD4,    # Bide
  4728.        0x115,   # Focus Punch
  4729. # Two-turn attacks
  4730.        0xC3,    # Razor Wind
  4731.        0xC4,    # SolarBeam
  4732.        0xC5,    # Freeze Shock
  4733.        0xC6,    # Ice Burn
  4734.        0xC7,    # Sky Attack
  4735.        0xC8,    # Skull Bash
  4736.        0xC9,    # Fly
  4737.        0xCA,    # Dig
  4738.        0xCB,    # Dive
  4739.        0xCC,    # Bounce
  4740.        0xCD,    # Shadow Force
  4741.        0xCE,    # Sky Drop
  4742.        0x14D,   # Phantom Force
  4743.        0x14E,   # Geomancy
  4744.     ]
  4745.     choices=[]
  4746.     for i in 0...4
  4747.       found=false
  4748.       next if attacker.moves[i].id==0
  4749.       found=true if blacklist.include?(attacker.moves[i].function)
  4750.       next if found
  4751.       choices.push(i) if @battle.pbCanChooseMove?(attacker.index,i,false,true)
  4752.     end
  4753.     if choices.length==0
  4754.       @battle.pbDisplay(_INTL("But it failed!"))
  4755.       return -1
  4756.     end
  4757.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4758.     choice=choices[@battle.pbRandom(choices.length)]
  4759.     attacker.pbUseMoveSimple(attacker.moves[choice].id,-1,attacker.pbOppositeOpposing.index)
  4760.     return 0
  4761.   end
  4762. end
  4763.  
  4764.  
  4765.  
  4766. ################################################################################
  4767. # Uses a random move known by any non-user Pokémon in the user's party. (Assist)
  4768. ################################################################################
  4769. class PokeBattle_Move_0B5 < PokeBattle_Move
  4770.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4771.     blacklist=[
  4772.        0x02,    # Struggle
  4773.        0x14,    # Chatter
  4774.        0x5C,    # Mimic
  4775.        0x5D,    # Sketch
  4776.        0x69,    # Transform
  4777.        0x71,    # Counter
  4778.        0x72,    # Mirror Coat
  4779.        0x73,    # Metal Burst
  4780.        0x9C,    # Helping Hand
  4781.        0xAA,    # Detect, Protect
  4782.        0xAD,    # Feint
  4783.        0xAE,    # Mirror Move
  4784.        0xAF,    # Copycat
  4785.        0xB0,    # Me First
  4786.        0xB2,    # Snatch
  4787.        0xB3,    # Nature Power
  4788.        0xB4,    # Sleep Talk
  4789.        0xB5,    # Assist
  4790.        0xB6,    # Metronome
  4791.        0xCD,    # Shadow Force
  4792.        0xE7,    # Destiny Bond
  4793.        0xE8,    # Endure
  4794.        0xEB,    # Roar, Whirlwind
  4795.        0xEC,    # Circle Throw, Dragon Tail
  4796.        0xF1,    # Covet, Thief
  4797.        0xF2,    # Switcheroo, Trick
  4798.        0xF3,    # Bestow
  4799.        0x115,   # Focus Punch
  4800.        0x117,   # Follow Me, Rage Powder
  4801.        0x149,   # Mat Block
  4802.        0x14B,   # King's Shield
  4803.        0x14C,   # Spiky Shield
  4804.        0x14D,   # Phantom Force
  4805.        0x158    # Belch
  4806.     ]
  4807.     if USENEWBATTLEMECHANICS
  4808.       blacklist+=[
  4809.          # Two-turn attacks
  4810.          0xC3,    # Razor Wind
  4811.          0xC4,    # SolarBeam
  4812.          0xC5,    # Freeze Shock
  4813.          0xC6,    # Ice Burn
  4814.          0xC7,    # Sky Attack
  4815.          0xC8,    # Skull Bash
  4816.          0xC9,    # Fly
  4817.          0xCA,    # Dig
  4818.          0xCB,    # Dive
  4819.          0xCC,    # Bounce
  4820.          0xCD,    # Shadow Force
  4821.          0xCE,    # Sky Drop
  4822.          0x14D,   # Phantom Force
  4823.          0x14E    # Geomancy
  4824.       ]
  4825.     end
  4826.     moves=[]
  4827.     party=@battle.pbParty(attacker.index) # NOTE: pbParty is common to both allies in multi battles
  4828.     for i in 0...party.length
  4829.       if i!=attacker.pokemonIndex && party[i] && !(USENEWBATTLEMECHANICS && party[i].egg?)
  4830.         for j in party[i].moves
  4831.           next if isConst?(j.type,PBTypes,:SHADOW)
  4832.           next if j.id==0
  4833.           found=false
  4834.           moves.push(j.id) if !blacklist.include?(PBMoveData.new(j.id).function)
  4835.         end
  4836.       end
  4837.     end
  4838.     if moves.length==0
  4839.       @battle.pbDisplay(_INTL("But it failed!"))
  4840.       return -1
  4841.     end
  4842.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4843.     move=moves[@battle.pbRandom(moves.length)]
  4844.     attacker.pbUseMoveSimple(move)
  4845.     return 0
  4846.   end
  4847. end
  4848.  
  4849.  
  4850.  
  4851. ################################################################################
  4852. # Uses a random move that exists. (Metronome)
  4853. ################################################################################
  4854. class PokeBattle_Move_0B6 < PokeBattle_Move
  4855.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4856.     blacklist=[
  4857.        0x02,    # Struggle
  4858.        0x11,    # Snore
  4859.        0x14,    # Chatter
  4860.        0x5C,    # Mimic
  4861.        0x5D,    # Sketch
  4862.        0x69,    # Transform
  4863.        0x71,    # Counter
  4864.        0x72,    # Mirror Coat
  4865.        0x73,    # Metal Burst
  4866.        0x9C,    # Helping Hand
  4867.        0xAA,    # Detect, Protect
  4868.        0xAB,    # Quick Guard
  4869.        0xAC,    # Wide Guard
  4870.        0xAD,    # Feint
  4871.        0xAE,    # Mirror Move
  4872.        0xAF,    # Copycat
  4873.        0xB0,    # Me First
  4874.        0xB2,    # Snatch
  4875.        0xB3,    # Nature Power
  4876.        0xB4,    # Sleep Talk
  4877.        0xB5,    # Assist
  4878.        0xB6,    # Metronome
  4879.        0xE7,    # Destiny Bond
  4880.        0xE8,    # Endure
  4881.        0xF1,    # Covet, Thief
  4882.        0xF2,    # Switcheroo, Trick
  4883.        0xF3,    # Bestow
  4884.        0x115,   # Focus Punch
  4885.        0x117,   # Follow Me, Rage Powder
  4886.        0x11D,   # After You
  4887.        0x11E    # Quash
  4888.     ]
  4889.     blacklistmoves=[
  4890.        :FREEZESHOCK,
  4891.        :ICEBURN,
  4892.        :RELICSONG,
  4893.        :SECRETSWORD,
  4894.        :SNARL,
  4895.        :TECHNOBLAST,
  4896.        :VCREATE,
  4897.        :GEOMANCY
  4898.     ]
  4899.     i=0; loop do break unless i<1000
  4900.       move=@battle.pbRandom(PBMoves.maxValue)+1
  4901.       next if isConst?(PBMoveData.new(move).type,PBTypes,:SHADOW)
  4902.       found=false
  4903.       if blacklist.include?(PBMoveData.new(move).function)
  4904.         found=true
  4905.       else
  4906.         for j in blacklistmoves
  4907.           if isConst?(move,PBMoves,j)
  4908.             found=true
  4909.             break
  4910.           end
  4911.         end
  4912.       end
  4913.       if !found
  4914.         pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4915.         attacker.pbUseMoveSimple(move)
  4916.         return 0
  4917.       end
  4918.       i+=1
  4919.     end
  4920.     @battle.pbDisplay(_INTL("But it failed!"))
  4921.     return -1
  4922.   end
  4923. end
  4924.  
  4925.  
  4926.  
  4927. ################################################################################
  4928. # The target can no longer use the same move twice in a row. (Torment)
  4929. ################################################################################
  4930. class PokeBattle_Move_0B7 < PokeBattle_Move
  4931.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4932.     if opponent.effects[PBEffects::Torment]
  4933.       @battle.pbDisplay(_INTL("But it failed!"))
  4934.       return -1
  4935.     end
  4936.     if !attacker.hasMoldBreaker
  4937.       if opponent.hasWorkingAbility(:AROMAVEIL)
  4938.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4939.            opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4940.         return -1
  4941.       elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  4942.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4943.            opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  4944.         return -1
  4945.       end
  4946.     end
  4947.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4948.     opponent.effects[PBEffects::Torment]=true
  4949.     @battle.pbDisplay(_INTL("{1} was subjected to torment!",opponent.pbThis))
  4950.     return 0
  4951.   end
  4952. end
  4953.  
  4954.  
  4955.  
  4956. ################################################################################
  4957. # Disables all target's moves that the user also knows. (Imprison)
  4958. ################################################################################
  4959. class PokeBattle_Move_0B8 < PokeBattle_Move
  4960.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4961.     if attacker.effects[PBEffects::Imprison]
  4962.       @battle.pbDisplay(_INTL("But it failed!"))
  4963.       return -1  
  4964.     end
  4965.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4966.     attacker.effects[PBEffects::Imprison]=true
  4967.     @battle.pbDisplay(_INTL("{1} sealed the opponent's move(s)!",attacker.pbThis))
  4968.     return 0
  4969.   end
  4970. end
  4971.  
  4972.  
  4973.  
  4974. ################################################################################
  4975. # For 5 rounds, disables the last move the target used. (Disable)
  4976. ################################################################################
  4977. class PokeBattle_Move_0B9 < PokeBattle_Move
  4978.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4979.     if opponent.effects[PBEffects::Disable]>0
  4980.       @battle.pbDisplay(_INTL("But it failed!"))
  4981.       return -1
  4982.     end
  4983.     if !attacker.hasMoldBreaker
  4984.       if opponent.hasWorkingAbility(:AROMAVEIL)
  4985.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4986.            opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4987.         return -1
  4988.       elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  4989.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4990.            opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  4991.         return -1
  4992.       end
  4993.     end
  4994.     for i in opponent.moves
  4995.       if i.id>0 && i.id==opponent.lastMoveUsed && (i.pp>0 || i.totalpp==0)
  4996.         pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4997.         opponent.effects[PBEffects::Disable]=5
  4998.         opponent.effects[PBEffects::DisableMove]=opponent.lastMoveUsed
  4999.         @battle.pbDisplay(_INTL("{1}'s {2} was disabled!",opponent.pbThis,i.name))
  5000.         return 0
  5001.       end
  5002.     end
  5003.     @battle.pbDisplay(_INTL("But it failed!"))
  5004.     return -1
  5005.   end
  5006. end
  5007.  
  5008.  
  5009.  
  5010. ################################################################################
  5011. # For 4 rounds, disables the target's non-damaging moves. (Taunt)
  5012. ################################################################################
  5013. class PokeBattle_Move_0BA < PokeBattle_Move
  5014.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5015.     if opponent.effects[PBEffects::Taunt]>0 ||
  5016.        (USENEWBATTLEMECHANICS &&
  5017.        !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS))
  5018.       @battle.pbDisplay(_INTL("But it failed!"))
  5019.       return -1
  5020.     end
  5021.     if !attacker.hasMoldBreaker
  5022.       if opponent.hasWorkingAbility(:AROMAVEIL)
  5023.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5024.            opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5025.         return -1
  5026.       elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5027.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5028.            opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5029.         return -1
  5030.       end
  5031.     end
  5032.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5033.     opponent.effects[PBEffects::Taunt]=4
  5034.     @battle.pbDisplay(_INTL("{1} fell for the taunt!",opponent.pbThis))
  5035.     return 0
  5036.   end
  5037. end
  5038.  
  5039.  
  5040.  
  5041. ################################################################################
  5042. # For 5 rounds, disables the target's healing moves. (Heal Block)
  5043. ################################################################################
  5044. class PokeBattle_Move_0BB < PokeBattle_Move
  5045.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5046.     if opponent.effects[PBEffects::HealBlock]>0
  5047.       @battle.pbDisplay(_INTL("But it failed!"))
  5048.       return -1
  5049.     end
  5050.     if !attacker.hasMoldBreaker
  5051.       if opponent.hasWorkingAbility(:AROMAVEIL)
  5052.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5053.            opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5054.         return -1
  5055.       elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5056.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5057.            opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5058.         return -1
  5059.       end
  5060.     end
  5061.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5062.     opponent.effects[PBEffects::HealBlock]=5
  5063.     @battle.pbDisplay(_INTL("{1} was prevented from healing!",opponent.pbThis))
  5064.     return 0
  5065.   end
  5066. end
  5067.  
  5068.  
  5069.  
  5070. ################################################################################
  5071. # For 4 rounds, the target must use the same move each round. (Encore)
  5072. ################################################################################
  5073. class PokeBattle_Move_0BC < PokeBattle_Move
  5074.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5075.     blacklist=[
  5076.        0x02,    # Struggle
  5077.        0x5C,    # Mimic
  5078.        0x5D,    # Sketch
  5079.        0x69,    # Transform
  5080.        0xAE,    # Mirror Move
  5081.        0xBC     # Encore
  5082.     ]
  5083.     if opponent.effects[PBEffects::Encore]>0
  5084.       @battle.pbDisplay(_INTL("But it failed!"))
  5085.       return -1
  5086.     end
  5087.     if opponent.lastMoveUsed<=0 ||
  5088.        blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  5089.       @battle.pbDisplay(_INTL("But it failed!"))
  5090.       return -1
  5091.     end
  5092.     if !attacker.hasMoldBreaker
  5093.       if opponent.hasWorkingAbility(:AROMAVEIL)
  5094.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5095.            opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5096.         return -1
  5097.       elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5098.         @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5099.            opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5100.         return -1
  5101.       end
  5102.     end
  5103.     for i in 0...4
  5104.       if opponent.lastMoveUsed==opponent.moves[i].id &&
  5105.          (opponent.moves[i].pp>0 || opponent.moves[i].totalpp==0)
  5106.         pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5107.         opponent.effects[PBEffects::Encore]=4
  5108.         opponent.effects[PBEffects::EncoreIndex]=i
  5109.         opponent.effects[PBEffects::EncoreMove]=opponent.moves[i].id
  5110.         @battle.pbDisplay(_INTL("{1} received an encore!",opponent.pbThis))
  5111.         return 0
  5112.       end
  5113.     end
  5114.     @battle.pbDisplay(_INTL("But it failed!"))
  5115.     return -1
  5116.   end
  5117. end
  5118.  
  5119.  
  5120.  
  5121. ################################################################################
  5122. # Hits twice.
  5123. ################################################################################
  5124. class PokeBattle_Move_0BD < PokeBattle_Move
  5125.   def pbIsMultiHit
  5126.     return true
  5127.   end
  5128.  
  5129.   def pbNumHits(attacker)
  5130.     return 2
  5131.   end
  5132. end
  5133.  
  5134.  
  5135.  
  5136. ################################################################################
  5137. # Hits twice. May poison the target on each hit. (Twineedle)
  5138. ################################################################################
  5139. class PokeBattle_Move_0BE < PokeBattle_Move
  5140.   def pbIsMultiHit
  5141.     return true
  5142.   end
  5143.  
  5144.   def pbNumHits(attacker)
  5145.     return 2
  5146.   end
  5147.  
  5148.   def pbAdditionalEffect(attacker,opponent)
  5149.     return if opponent.damagestate.substitute
  5150.     if opponent.pbCanPoison?(attacker,false,self)
  5151.       opponent.pbPoison(attacker)
  5152.     end
  5153.   end
  5154. end
  5155.  
  5156.  
  5157.  
  5158. ################################################################################
  5159. # Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
  5160. # An accuracy check is performed for each hit.
  5161. ################################################################################
  5162. class PokeBattle_Move_0BF < PokeBattle_Move
  5163.   def pbIsMultiHit
  5164.     return true
  5165.   end
  5166.  
  5167.   def pbNumHits(attacker)
  5168.     return 3
  5169.   end
  5170.  
  5171.   def successCheckPerHit?
  5172.     return @checks
  5173.   end
  5174.  
  5175.   def pbOnStartUse(attacker)
  5176.     @calcbasedmg=@basedamage
  5177.     @checks=!attacker.hasWorkingAbility(:SKILLLINK)
  5178.     return true
  5179.   end
  5180.  
  5181.   def pbBaseDamage(basedmg,attacker,opponent)
  5182.     ret=@calcbasedmg
  5183.     @calcbasedmg+=basedmg
  5184.     return ret
  5185.   end
  5186. end
  5187.  
  5188.  
  5189.  
  5190. ################################################################################
  5191. # Hits 2-5 times.
  5192. ################################################################################
  5193. class PokeBattle_Move_0C0 < PokeBattle_Move
  5194.   def pbIsMultiHit
  5195.     return true
  5196.   end
  5197.  
  5198.   def pbNumHits(attacker)
  5199.     hitchances=[2,2,3,3,4,5]
  5200.     ret=hitchances[@battle.pbRandom(hitchances.length)]
  5201.     ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  5202.     return ret
  5203.   end
  5204. end
  5205.  
  5206.  
  5207.  
  5208. ################################################################################
  5209. # Hits X times, where X is 1 (the user) plus the number of non-user unfainted
  5210. # status-free Pokémon in the user's party (the participants). Fails if X is 0.
  5211. # Base power of each hit depends on the base Attack stat for the species of that
  5212. # hit's participant. (Beat Up)
  5213. ################################################################################
  5214. class PokeBattle_Move_0C1 < PokeBattle_Move
  5215.   def pbIsMultiHit
  5216.     return true
  5217.   end
  5218.  
  5219.   def pbNumHits(attacker)
  5220.     return @participants.length
  5221.   end
  5222.  
  5223.   def pbOnStartUse(attacker)
  5224.     party=@battle.pbParty(attacker.index)
  5225.     @participants=[]
  5226.     for i in 0...party.length
  5227.       if attacker.pokemonIndex==i
  5228.         @participants.push(i)
  5229.       elsif party[i] && !party[i].egg? && party[i].hp>0 && party[i].status==0
  5230.         @participants.push(i)
  5231.       end
  5232.     end
  5233.     if @participants.length==0
  5234.       @battle.pbDisplay(_INTL("But it failed!"))
  5235.       return false
  5236.     end
  5237.     return true
  5238.   end
  5239.  
  5240.   def pbBaseDamage(basedmg,attacker,opponent)
  5241.     party=@battle.pbParty(attacker.index)
  5242.     atk=party[@participants[0]].baseStats[1]
  5243.     @participants[0]=nil; @participants.compact!
  5244.     return 5+(atk/10)
  5245.   end
  5246. end
  5247.  
  5248.  
  5249.  
  5250. ################################################################################
  5251. # Two turn attack. Attacks first turn, skips second turn (if successful).
  5252. ################################################################################
  5253. class PokeBattle_Move_0C2 < PokeBattle_Move
  5254.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5255.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5256.     if opponent.damagestate.calcdamage>0
  5257.       attacker.effects[PBEffects::HyperBeam]=2
  5258.       attacker.currentMove=@id
  5259.     end
  5260.     return ret
  5261.   end
  5262. end
  5263.  
  5264.  
  5265.  
  5266. ################################################################################
  5267. # Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
  5268. ################################################################################
  5269. class PokeBattle_Move_0C3 < PokeBattle_Move
  5270.   def pbTwoTurnAttack(attacker)
  5271.     @immediate=false
  5272.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5273.       @immediate=true
  5274.     end
  5275.     return false if @immediate
  5276.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5277.   end
  5278.  
  5279.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5280.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5281.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5282.       @battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",attacker.pbThis))
  5283.     end
  5284.     if @immediate
  5285.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5286.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5287.       attacker.pbConsumeItem
  5288.     end
  5289.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5290.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5291.   end
  5292. end
  5293.  
  5294.  
  5295.  
  5296. ################################################################################
  5297. # Two turn attack. Skips first turn, attacks second turn. (SolarBeam)
  5298. # Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
  5299. ################################################################################
  5300. class PokeBattle_Move_0C4 < PokeBattle_Move
  5301.   def pbTwoTurnAttack(attacker)
  5302.     @immediate=false; @sunny=false
  5303.     if attacker.effects[PBEffects::TwoTurnAttack]==0
  5304.       if @battle.pbWeather==PBWeather::SUNNYDAY ||
  5305.          @battle.pbWeather==PBWeather::HARSHSUN
  5306.         @immediate=true; @sunny=true
  5307.       end
  5308.     end
  5309.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5310.       @immediate=true
  5311.     end
  5312.     return false if @immediate
  5313.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5314.   end
  5315.  
  5316.   def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  5317.     if @battle.pbWeather!=0 &&
  5318.        @battle.pbWeather!=PBWeather::SUNNYDAY &&
  5319.        @battle.pbWeather!=PBWeather::HARSHSUN
  5320.       return (damagemult*0.5).round
  5321.     end
  5322.     return damagemult
  5323.   end
  5324.  
  5325.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5326.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5327.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5328.       @battle.pbDisplay(_INTL("{1} took in sunlight!",attacker.pbThis))
  5329.     end
  5330.     if @immediate && !@sunny
  5331.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5332.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5333.       attacker.pbConsumeItem
  5334.     end
  5335.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5336.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5337.   end
  5338. end
  5339.  
  5340.  
  5341.  
  5342.  
  5343. ################################################################################
  5344. # Two turn attack. Skips first turn, attacks second turn. (Freeze Shock)
  5345. # May paralyze the target.
  5346. ################################################################################
  5347. class PokeBattle_Move_0C5 < PokeBattle_Move
  5348.   def pbTwoTurnAttack(attacker)
  5349.     @immediate=false
  5350.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5351.       @immediate=true
  5352.     end
  5353.     return false if @immediate
  5354.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5355.   end
  5356.  
  5357.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5358.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5359.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5360.       @battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",attacker.pbThis))
  5361.     end
  5362.     if @immediate
  5363.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5364.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5365.       attacker.pbConsumeItem
  5366.     end
  5367.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5368.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5369.   end
  5370.  
  5371.   def pbAdditionalEffect(attacker,opponent)
  5372.     return if opponent.damagestate.substitute
  5373.     if opponent.pbCanParalyze?(attacker,false,self)
  5374.       opponent.pbParalyze(attacker)
  5375.     end
  5376.   end
  5377. end
  5378.  
  5379.  
  5380.  
  5381. ################################################################################
  5382. # Two turn attack. Skips first turn, attacks second turn. (Ice Burn)
  5383. # May burn the target.
  5384. ################################################################################
  5385. class PokeBattle_Move_0C6 < PokeBattle_Move
  5386.   def pbTwoTurnAttack(attacker)
  5387.     @immediate=false
  5388.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5389.       @immediate=true
  5390.     end
  5391.     return false if @immediate
  5392.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5393.   end
  5394.  
  5395.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5396.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5397.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5398.       @battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",attacker.pbThis))
  5399.     end
  5400.     if @immediate
  5401.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5402.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5403.       attacker.pbConsumeItem
  5404.     end
  5405.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5406.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5407.   end
  5408.  
  5409.   def pbAdditionalEffect(attacker,opponent)
  5410.     return if opponent.damagestate.substitute
  5411.     if opponent.pbCanBurn?(attacker,false,self)
  5412.       opponent.pbBurn(attacker)
  5413.     end
  5414.   end
  5415. end
  5416.  
  5417.  
  5418.  
  5419. ################################################################################
  5420. # Two turn attack. Skips first turn, attacks second turn. (Sky Attack)
  5421. # May make the target flinch.
  5422. ################################################################################
  5423. class PokeBattle_Move_0C7 < PokeBattle_Move
  5424.   def pbTwoTurnAttack(attacker)
  5425.     @immediate=false
  5426.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5427.       @immediate=true
  5428.     end
  5429.     return false if @immediate
  5430.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5431.   end
  5432.  
  5433.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5434.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5435.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5436.       @battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",attacker.pbThis))
  5437.     end
  5438.     if @immediate
  5439.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5440.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5441.       attacker.pbConsumeItem
  5442.     end
  5443.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5444.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5445.   end
  5446.  
  5447.   def pbAdditionalEffect(attacker,opponent)
  5448.     return if opponent.damagestate.substitute
  5449.     opponent.pbFlinch(attacker)
  5450.   end
  5451. end
  5452.  
  5453.  
  5454.  
  5455. ################################################################################
  5456. # Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
  5457. # (Skull Bash)
  5458. ################################################################################
  5459. class PokeBattle_Move_0C8 < PokeBattle_Move
  5460.   def pbTwoTurnAttack(attacker)
  5461.     @immediate=false
  5462.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5463.       @immediate=true
  5464.     end
  5465.     return false if @immediate
  5466.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5467.   end
  5468.  
  5469.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5470.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5471.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5472.       @battle.pbDisplay(_INTL("{1} tucked in its head!",attacker.pbThis))
  5473.       if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5474.         attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  5475.       end
  5476.     end
  5477.     if @immediate
  5478.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5479.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5480.       attacker.pbConsumeItem
  5481.     end
  5482.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5483.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5484.   end
  5485. end
  5486.  
  5487.  
  5488.  
  5489. ################################################################################
  5490. # Two turn attack. Skips first turn, attacks second turn. (Fly)
  5491. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5492. ################################################################################
  5493. class PokeBattle_Move_0C9 < PokeBattle_Move
  5494.   def unusableInGravity?
  5495.     return true
  5496.   end
  5497.  
  5498.   def pbTwoTurnAttack(attacker)
  5499.     @immediate=false
  5500.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5501.       @immediate=true
  5502.     end
  5503.     return false if @immediate
  5504.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5505.   end
  5506.  
  5507.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5508.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5509.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5510.       @battle.pbDisplay(_INTL("{1} flew up high!",attacker.pbThis))
  5511.     end
  5512.     if @immediate
  5513.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5514.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5515.       attacker.pbConsumeItem
  5516.     end
  5517.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5518.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5519.   end
  5520. end
  5521.  
  5522.  
  5523.  
  5524. ################################################################################
  5525. # Two turn attack. Skips first turn, attacks second turn. (Dig)
  5526. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5527. ################################################################################
  5528. class PokeBattle_Move_0CA < PokeBattle_Move
  5529.   def pbTwoTurnAttack(attacker)
  5530.     @immediate=false
  5531.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5532.       @immediate=true
  5533.     end
  5534.     return false if @immediate
  5535.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5536.   end
  5537.  
  5538.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5539.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5540.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5541.       @battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",attacker.pbThis))
  5542.     end
  5543.     if @immediate
  5544.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5545.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5546.       attacker.pbConsumeItem
  5547.     end
  5548.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5549.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5550.   end
  5551. end
  5552.  
  5553.  
  5554.  
  5555. ################################################################################
  5556. # Two turn attack. Skips first turn, attacks second turn. (Dive)
  5557. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5558. ################################################################################
  5559. class PokeBattle_Move_0CB < PokeBattle_Move
  5560.   def pbTwoTurnAttack(attacker)
  5561.     @immediate=false
  5562.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5563.       @immediate=true
  5564.     end
  5565.     return false if @immediate
  5566.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5567.   end
  5568.  
  5569.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5570.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5571.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5572.       @battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
  5573.     end
  5574.     if @immediate
  5575.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5576.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5577.       attacker.pbConsumeItem
  5578.     end
  5579.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5580.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5581.   end
  5582. end
  5583.  
  5584.  
  5585.  
  5586. ################################################################################
  5587. # Two turn attack. Skips first turn, attacks second turn. (Bounce)
  5588. # May paralyze the target.
  5589. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5590. ################################################################################
  5591. class PokeBattle_Move_0CC < PokeBattle_Move
  5592.   def unusableInGravity?
  5593.     return true
  5594.   end
  5595.  
  5596.   def pbTwoTurnAttack(attacker)
  5597.     @immediate=false
  5598.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5599.       @immediate=true
  5600.     end
  5601.     return false if @immediate
  5602.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5603.   end
  5604.  
  5605.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5606.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5607.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5608.       @battle.pbDisplay(_INTL("{1} sprang up!",attacker.pbThis))
  5609.     end
  5610.     if @immediate
  5611.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5612.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5613.       attacker.pbConsumeItem
  5614.     end
  5615.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5616.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  5617.   end
  5618.  
  5619.   def pbAdditionalEffect(attacker,opponent)
  5620.     return if opponent.damagestate.substitute
  5621.     if opponent.pbCanParalyze?(attacker,false,self)
  5622.       opponent.pbParalyze(attacker)
  5623.     end
  5624.   end
  5625. end
  5626.  
  5627.  
  5628.  
  5629. ################################################################################
  5630. # Two turn attack. Skips first turn, attacks second turn. (Shadow Force)
  5631. # Is invulnerable during use.
  5632. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  5633. # this round. If successful, negates them this round.
  5634. ################################################################################
  5635. class PokeBattle_Move_0CD < PokeBattle_Move
  5636.   def pbTwoTurnAttack(attacker)
  5637.     @immediate=false
  5638.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5639.       @immediate=true
  5640.     end
  5641.     return false if @immediate
  5642.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5643.   end
  5644.  
  5645.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5646.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5647.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5648.       @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  5649.     end
  5650.     if @immediate
  5651.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  5652.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5653.       attacker.pbConsumeItem
  5654.     end
  5655.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5656.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5657.     if ret>0
  5658.       opponent.effects[PBEffects::ProtectNegation]=true
  5659.       opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  5660.     end
  5661.     return ret
  5662.   end
  5663. end
  5664.  
  5665.  
  5666.  
  5667. ################################################################################
  5668. # Two turn attack. Skips first turn, attacks second turn. (Sky Drop)
  5669. # (Handled in Battler's pbSuccessCheck):  Is semi-invulnerable during use.
  5670. # Target is also semi-invulnerable during use, and can't take any action.
  5671. # Doesn't damage airborne Pokémon (but still makes them unable to move during).
  5672. ################################################################################
  5673. class PokeBattle_Move_0CE < PokeBattle_Move
  5674.   def unusableInGravity?
  5675.     return true
  5676.   end
  5677.  
  5678.   def pbMoveFailed(attacker,opponent)
  5679.     ret=false
  5680.     ret=true if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  5681.     ret=true if opponent.effects[PBEffects::TwoTurnAttack]>0
  5682.     ret=true if opponent.effects[PBEffects::SkyDrop] && attacker.effects[PBEffects::TwoTurnAttack]>0
  5683.     ret=true if !opponent.pbIsOpposing?(attacker.index)
  5684.     ret=true if USENEWBATTLEMECHANICS && opponent.weight(attacker)>=2000
  5685.     return ret
  5686.   end
  5687.  
  5688.   def pbTwoTurnAttack(attacker)
  5689.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  5690.   end
  5691.  
  5692.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5693.     if attacker.effects[PBEffects::TwoTurnAttack]>0
  5694.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5695.       @battle.pbDisplay(_INTL("{1} took {2} into the sky!",attacker.pbThis,opponent.pbThis(true)))
  5696.       opponent.effects[PBEffects::SkyDrop]=true
  5697.     end
  5698.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5699.     ret=super
  5700.     @battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",opponent.pbThis))
  5701.     opponent.effects[PBEffects::SkyDrop]=false
  5702.     return ret
  5703.   end
  5704.  
  5705.   def pbTypeModifier(type,attacker,opponent)
  5706.     return 0 if opponent.pbHasType?(:FLYING)
  5707.     return 0 if !attacker.hasMoldBreaker &&
  5708.        opponent.hasWorkingAbility(:LEVITATE) && !opponent.effects[PBEffects::SmackDown]
  5709.     return super
  5710.   end
  5711. end
  5712.  
  5713.  
  5714.  
  5715. ################################################################################
  5716. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5717. # at end of each round.
  5718. ################################################################################
  5719. class PokeBattle_Move_0CF < PokeBattle_Move
  5720.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5721.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5722.     if opponent.damagestate.calcdamage>0 && !opponent.fainted? &&
  5723.        !opponent.damagestate.substitute
  5724.       if opponent.effects[PBEffects::MultiTurn]==0
  5725.         opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5726.         if attacker.hasWorkingItem(:GRIPCLAW)
  5727.           opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5728.         end
  5729.         opponent.effects[PBEffects::MultiTurnAttack]=@id
  5730.         opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5731.         if isConst?(@id,PBMoves,:BIND)
  5732.           @battle.pbDisplay(_INTL("{1} was squeezed by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5733.         elsif isConst?(@id,PBMoves,:CLAMP)
  5734.           @battle.pbDisplay(_INTL("{1} clamped {2}!",attacker.pbThis,opponent.pbThis(true)))
  5735.         elsif isConst?(@id,PBMoves,:FIRESPIN)
  5736.           @battle.pbDisplay(_INTL("{1} was trapped in the fiery vortex!",opponent.pbThis))
  5737.         elsif isConst?(@id,PBMoves,:MAGMASTORM)
  5738.           @battle.pbDisplay(_INTL("{1} became trapped by Magma Storm!",opponent.pbThis))
  5739.         elsif isConst?(@id,PBMoves,:SANDTOMB)
  5740.           @battle.pbDisplay(_INTL("{1} became trapped by Sand Tomb!",opponent.pbThis))
  5741.         elsif isConst?(@id,PBMoves,:WRAP)
  5742.           @battle.pbDisplay(_INTL("{1} was wrapped by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5743.         elsif isConst?(@id,PBMoves,:INFESTATION)
  5744.           @battle.pbDisplay(_INTL("{1} has been afflicted with an infestation by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5745.         else
  5746.           @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5747.         end
  5748.       end
  5749.     end
  5750.     return ret
  5751.   end
  5752. end
  5753.  
  5754.  
  5755.  
  5756. ################################################################################
  5757. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5758. # at end of each round. (Whirlpool)
  5759. # Power is doubled if target is using Dive.
  5760. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  5761. ################################################################################
  5762. class PokeBattle_Move_0D0 < PokeBattle_Move
  5763.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5764.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5765.     if opponent.damagestate.calcdamage>0 && !opponent.fainted? &&
  5766.        !opponent.damagestate.substitute
  5767.       if opponent.effects[PBEffects::MultiTurn]==0
  5768.         opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5769.         if attacker.hasWorkingItem(:GRIPCLAW)
  5770.           opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5771.         end
  5772.         opponent.effects[PBEffects::MultiTurnAttack]=@id
  5773.         opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5774.         @battle.pbDisplay(_INTL("{1} became trapped in the vortex!",opponent.pbThis))
  5775.       end
  5776.     end
  5777.     return ret
  5778.   end
  5779.  
  5780.   def pbModifyDamage(damagemult,attacker,opponent)
  5781.     if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  5782.       return (damagemult*2.0).round
  5783.     end
  5784.     return damagemult
  5785.   end
  5786. end
  5787.  
  5788.  
  5789.  
  5790. ################################################################################
  5791. # User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
  5792. ################################################################################
  5793. class PokeBattle_Move_0D1 < PokeBattle_Move
  5794.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5795.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5796.     if opponent.damagestate.calcdamage>0
  5797.       if attacker.effects[PBEffects::Uproar]==0
  5798.         attacker.effects[PBEffects::Uproar]=3
  5799.         @battle.pbDisplay(_INTL("{1} caused an uproar!",attacker.pbThis))
  5800.         attacker.currentMove=@id
  5801.       end
  5802.     end
  5803.     return ret
  5804.   end
  5805. end
  5806.  
  5807.  
  5808.  
  5809. ################################################################################
  5810. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  5811. # (Outrage, Petal Dange, Thrash)
  5812. ################################################################################
  5813. class PokeBattle_Move_0D2 < PokeBattle_Move
  5814.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5815.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5816.     if opponent.damagestate.calcdamage>0 &&
  5817.        attacker.effects[PBEffects::Outrage]==0 &&
  5818.        attacker.status!=PBStatuses::SLEEP
  5819.       attacker.effects[PBEffects::Outrage]=2+@battle.pbRandom(2)
  5820.       attacker.currentMove=@id
  5821.     elsif pbTypeModifier(@type,attacker,opponent)==0
  5822.       # Cancel effect if attack is ineffective
  5823.       attacker.effects[PBEffects::Outrage]=0
  5824.     end
  5825.     if attacker.effects[PBEffects::Outrage]>0
  5826.       attacker.effects[PBEffects::Outrage]-=1
  5827.       if attacker.effects[PBEffects::Outrage]==0 && attacker.pbCanConfuseSelf?(false)
  5828.         attacker.pbConfuse
  5829.         @battle.pbDisplay(_INTL("{1} became confused due to fatigue!",attacker.pbThis))
  5830.       end
  5831.     end
  5832.     return ret
  5833.   end
  5834. end
  5835.  
  5836.  
  5837.  
  5838. ################################################################################
  5839. # User must use this move for 4 more rounds. Power doubles each round.
  5840. # Power is also doubled if user has curled up. (Ice Ball, Rollout)
  5841. ################################################################################
  5842. class PokeBattle_Move_0D3 < PokeBattle_Move
  5843.   def pbBaseDamage(basedmg,attacker,opponent)
  5844.     shift=(4-attacker.effects[PBEffects::Rollout]) # from 0 through 4, 0 is most powerful
  5845.     shift+=1 if attacker.effects[PBEffects::DefenseCurl]
  5846.     basedmg=basedmg<<shift
  5847.     return basedmg
  5848.   end
  5849.  
  5850.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5851.     attacker.effects[PBEffects::Rollout]=5 if attacker.effects[PBEffects::Rollout]==0
  5852.     attacker.effects[PBEffects::Rollout]-=1
  5853.     attacker.currentMove=thismove.id
  5854.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5855.     if opponent.damagestate.calcdamage==0 ||
  5856.        pbTypeModifier(@type,attacker,opponent)==0 ||
  5857.        attacker.status==PBStatuses::SLEEP
  5858.       # Cancel effect if attack is ineffective
  5859.       attacker.effects[PBEffects::Rollout]=0
  5860.     end
  5861.     return ret
  5862.   end
  5863. end
  5864.  
  5865.  
  5866.  
  5867. ################################################################################
  5868. # User bides its time this round and next round. The round after, deals 2x the
  5869. # total damage it took while biding to the last battler that damaged it. (Bide)
  5870. ################################################################################
  5871. class PokeBattle_Move_0D4 < PokeBattle_Move
  5872.   def pbDisplayUseMessage(attacker)
  5873.     if attacker.effects[PBEffects::Bide]==0
  5874.       @battle.pbDisplayBrief(_INTL("{1} used\r\n{2}!",attacker.pbThis,name))
  5875.       attacker.effects[PBEffects::Bide]=2
  5876.       attacker.effects[PBEffects::BideDamage]=0
  5877.       attacker.effects[PBEffects::BideTarget]=-1
  5878.       attacker.currentMove=@id
  5879.       pbShowAnimation(@id,attacker,nil)
  5880.       return 1
  5881.     else
  5882.       attacker.effects[PBEffects::Bide]-=1
  5883.       if attacker.effects[PBEffects::Bide]==0
  5884.         @battle.pbDisplayBrief(_INTL("{1} unleashed energy!",attacker.pbThis))
  5885.         return 0
  5886.       else
  5887.         @battle.pbDisplayBrief(_INTL("{1} is storing energy!",attacker.pbThis))
  5888.         return 2
  5889.       end
  5890.     end
  5891.   end
  5892.  
  5893.   def pbAddTarget(targets,attacker)
  5894.     if attacker.effects[PBEffects::BideTarget]>=0
  5895.       if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::BideTarget]])
  5896.         attacker.pbRandomTarget(targets)
  5897.       end
  5898.     else
  5899.       attacker.pbRandomTarget(targets)
  5900.     end
  5901.   end
  5902.  
  5903.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5904.     if attacker.effects[PBEffects::BideDamage]==0 || !opponent
  5905.       @battle.pbDisplay(_INTL("But it failed!"))
  5906.       return -1
  5907.     end
  5908.     if USENEWBATTLEMECHANICS
  5909.       typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  5910.       if typemod==0
  5911.         @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  5912.         return -1
  5913.       end
  5914.     end
  5915.     ret=pbEffectFixedDamage(attacker.effects[PBEffects::BideDamage]*2,attacker,opponent,hitnum,alltargets,showanimation)
  5916.     return ret
  5917.   end
  5918. end
  5919.  
  5920.  
  5921.  
  5922. ################################################################################
  5923. # Heals user by 1/2 of its max HP.
  5924. ################################################################################
  5925. class PokeBattle_Move_0D5 < PokeBattle_Move
  5926.   def isHealingMove?
  5927.     return true
  5928.   end
  5929.  
  5930.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5931.     if attacker.hp==attacker.totalhp
  5932.       @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5933.       return -1
  5934.     end
  5935.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5936.     attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5937.     @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5938.     return 0
  5939.   end
  5940. end
  5941.  
  5942.  
  5943.  
  5944. ################################################################################
  5945. # Heals user by 1/2 of its max HP. (Roost)
  5946. # User roosts, and its Flying type is ignored for attacks used against it.
  5947. ################################################################################
  5948. class PokeBattle_Move_0D6 < PokeBattle_Move
  5949.   def isHealingMove?
  5950.     return true
  5951.   end
  5952.  
  5953.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5954.     if attacker.hp==attacker.totalhp
  5955.       @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5956.       return -1
  5957.     end
  5958.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5959.     attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5960.     attacker.effects[PBEffects::Roost]=true
  5961.     @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5962.     return 0
  5963.   end
  5964. end
  5965.  
  5966.  
  5967.  
  5968. ################################################################################
  5969. # Battler in user's position is healed by 1/2 of its max HP, at the end of the
  5970. # next round. (Wish)
  5971. ################################################################################
  5972. class PokeBattle_Move_0D7 < PokeBattle_Move
  5973.   def isHealingMove?
  5974.     return true
  5975.   end
  5976.  
  5977.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5978.     if attacker.effects[PBEffects::Wish]>0
  5979.       @battle.pbDisplay(_INTL("But it failed!"))
  5980.       return -1
  5981.     end
  5982.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5983.     attacker.effects[PBEffects::Wish]=2
  5984.     attacker.effects[PBEffects::WishAmount]=((attacker.totalhp+1)/2).floor
  5985.     attacker.effects[PBEffects::WishMaker]=attacker.pokemonIndex
  5986.     return 0
  5987.   end
  5988. end
  5989.  
  5990.  
  5991.  
  5992. ################################################################################
  5993. # Heals user by an amount depending on the weather. (Moonlight, Morning Sun,
  5994. # Synthesis)
  5995. ################################################################################
  5996. class PokeBattle_Move_0D8 < PokeBattle_Move
  5997.   def isHealingMove?
  5998.     return true
  5999.   end
  6000.  
  6001.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6002.     if attacker.hp==attacker.totalhp
  6003.       @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6004.       return -1
  6005.     end
  6006.     hpgain=0
  6007.     if @battle.pbWeather==PBWeather::SUNNYDAY ||
  6008.        @battle.pbWeather==PBWeather::HARSHSUN
  6009.       hpgain=(attacker.totalhp*2/3).floor
  6010.     elsif @battle.pbWeather!=0
  6011.       hpgain=(attacker.totalhp/4).floor
  6012.     else
  6013.       hpgain=(attacker.totalhp/2).floor
  6014.     end
  6015.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6016.     attacker.pbRecoverHP(hpgain,true)
  6017.     @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6018.     return 0
  6019.   end
  6020. end
  6021.  
  6022.  
  6023.  
  6024. ################################################################################
  6025. # Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
  6026. ################################################################################
  6027. class PokeBattle_Move_0D9 < PokeBattle_Move
  6028.   def isHealingMove?
  6029.     return true
  6030.   end
  6031.  
  6032.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6033.     if !attacker.pbCanSleep?(attacker,true,self,true)
  6034.       return -1
  6035.     end
  6036.     if attacker.status==PBStatuses::SLEEP
  6037.       @battle.pbDisplay(_INTL("But it failed!"))
  6038.       return -1
  6039.     end
  6040.     if attacker.hp==attacker.totalhp
  6041.       @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6042.       return -1
  6043.     end
  6044.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6045.     attacker.pbSleepSelf(3)
  6046.     @battle.pbDisplay(_INTL("{1} slept and became healthy!",attacker.pbThis))
  6047.     hp=attacker.pbRecoverHP(attacker.totalhp-attacker.hp,true)
  6048.     @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis)) if hp>0
  6049.     return 0
  6050.   end
  6051. end
  6052.  
  6053.  
  6054.  
  6055. ################################################################################
  6056. # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
  6057. # (Aqua Ring)
  6058. ################################################################################
  6059. class PokeBattle_Move_0DA < PokeBattle_Move
  6060.   def isHealingMove?
  6061.     return true
  6062.   end
  6063.  
  6064.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6065.     if attacker.effects[PBEffects::AquaRing]
  6066.       @battle.pbDisplay(_INTL("But it failed!"))
  6067.       return -1
  6068.     end
  6069.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6070.     attacker.effects[PBEffects::AquaRing]=true
  6071.     @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
  6072.     return 0
  6073.   end
  6074. end
  6075.  
  6076.  
  6077.  
  6078. ################################################################################
  6079. # Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
  6080. # round, and cannot flee or switch out. (Ingrain)
  6081. ################################################################################
  6082. class PokeBattle_Move_0DB < PokeBattle_Move
  6083.   def isHealingMove?
  6084.     return true
  6085.   end
  6086.  
  6087.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6088.     if attacker.effects[PBEffects::Ingrain]
  6089.       @battle.pbDisplay(_INTL("But it failed!"))
  6090.       return -1
  6091.     end
  6092.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6093.     attacker.effects[PBEffects::Ingrain]=true
  6094.     @battle.pbDisplay(_INTL("{1} planted its roots!",attacker.pbThis))
  6095.     return 0
  6096.   end
  6097. end
  6098.  
  6099.  
  6100.  
  6101. ################################################################################
  6102. # Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each round,
  6103. # and the Pokémon in the user's position gains the same amount. (Leech Seed)
  6104. ################################################################################
  6105. class PokeBattle_Move_0DC < PokeBattle_Move
  6106.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6107.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6108.       @battle.pbDisplay(_INTL("But it failed!"))  
  6109.       return -1
  6110.     end
  6111.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  6112.     if opponent.effects[PBEffects::LeechSeed]>=0
  6113.       @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  6114.       return -1
  6115.     end
  6116.     if opponent.pbHasType?(:GRASS)
  6117.       @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6118.       return -1
  6119.     end
  6120.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6121.     opponent.effects[PBEffects::LeechSeed]=attacker.index
  6122.     @battle.pbDisplay(_INTL("{1} was seeded!",opponent.pbThis))
  6123.     return 0
  6124.   end
  6125. end
  6126.  
  6127.  
  6128.  
  6129. ################################################################################
  6130. # User gains half the HP it inflicts as damage.
  6131. ################################################################################
  6132. class PokeBattle_Move_0DD < PokeBattle_Move
  6133.   def isHealingMove?
  6134.     return USENEWBATTLEMECHANICS
  6135.   end
  6136.  
  6137.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6138.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6139.     if opponent.damagestate.calcdamage>0
  6140.       hpgain=(opponent.damagestate.hplost/2).round
  6141.       if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6142.         attacker.pbReduceHP(hpgain,true)
  6143.         @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6144.       elsif attacker.effects[PBEffects::HealBlock]==0
  6145.         hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6146.         attacker.pbRecoverHP(hpgain,true)
  6147.         @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6148.       end
  6149.     end
  6150.     return ret
  6151.   end
  6152. end
  6153.  
  6154.  
  6155.  
  6156. ################################################################################
  6157. # User gains half the HP it inflicts as damage. (Dream Eater)
  6158. # (Handled in Battler's pbSuccessCheck): Fails if target is not asleep.
  6159. ################################################################################
  6160. class PokeBattle_Move_0DE < PokeBattle_Move
  6161.   def isHealingMove?
  6162.     return USENEWBATTLEMECHANICS
  6163.   end
  6164.  
  6165.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6166.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6167.     if opponent.damagestate.calcdamage>0
  6168.       hpgain=(opponent.damagestate.hplost/2).round
  6169.       if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6170.         attacker.pbReduceHP(hpgain,true)
  6171.         @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6172.       elsif attacker.effects[PBEffects::HealBlock]==0
  6173.         hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6174.         attacker.pbRecoverHP(hpgain,true)
  6175.         @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6176.       end
  6177.     end
  6178.     return ret
  6179.   end
  6180. end
  6181.  
  6182.  
  6183.  
  6184. ################################################################################
  6185. # Heals target by 1/2 of its max HP. (Heal Pulse)
  6186. ################################################################################
  6187. class PokeBattle_Move_0DF < PokeBattle_Move
  6188.   def isHealingMove?
  6189.     return true
  6190.   end
  6191.  
  6192.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6193.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6194.       @battle.pbDisplay(_INTL("But it failed!"))  
  6195.       return -1
  6196.     end
  6197.     if opponent.hp==opponent.totalhp
  6198.       @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))  
  6199.       return -1
  6200.     end
  6201.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6202.     hpgain=((opponent.totalhp+1)/2).floor
  6203.     hpgain=(opponent.totalhp*3/4).round if attacker.hasWorkingAbility(:MEGALAUNCHER)
  6204.     opponent.pbRecoverHP(hpgain,true)
  6205.     @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))  
  6206.     return 0
  6207.   end
  6208. end
  6209.  
  6210.  
  6211.  
  6212. ################################################################################
  6213. # User faints. (Explosion, Selfdestruct)
  6214. ################################################################################
  6215. class PokeBattle_Move_0E0 < PokeBattle_Move
  6216.   def pbOnStartUse(attacker)
  6217.     if !attacker.hasMoldBreaker
  6218.       bearer=@battle.pbCheckGlobalAbility(:DAMP)
  6219.       if bearer!=nil
  6220.         @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  6221.            bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  6222.         return false
  6223.       end
  6224.     end
  6225.     return true
  6226.   end
  6227.  
  6228.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6229.     super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6230.     if !attacker.fainted?
  6231.       attacker.pbReduceHP(attacker.hp)
  6232.       attacker.pbFaint if attacker.fainted?
  6233.     end
  6234.   end
  6235. end
  6236.  
  6237.  
  6238.  
  6239. ################################################################################
  6240. # Inflicts fixed damage equal to user's current HP. (Final Gambit)
  6241. # User faints (if successful).
  6242. ################################################################################
  6243. class PokeBattle_Move_0E1 < PokeBattle_Move
  6244.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6245.     typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  6246.     if typemod==0
  6247.       @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6248.       return -1
  6249.     end
  6250.     ret=pbEffectFixedDamage(attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  6251.     return ret
  6252.   end
  6253.  
  6254.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6255.     super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6256.     if !attacker.fainted?
  6257.       attacker.pbReduceHP(attacker.hp)
  6258.       attacker.pbFaint if attacker.fainted?
  6259.     end
  6260.   end
  6261. end
  6262.  
  6263.  
  6264.  
  6265. ################################################################################
  6266. # Decreases the target's Attack and Special Attack by 2 stages each. (Memento)
  6267. # User faints (even if effect does nothing).
  6268. ################################################################################
  6269. class PokeBattle_Move_0E2 < PokeBattle_Move
  6270.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6271.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6272.       @battle.pbDisplay(_INTL("But it failed!"))
  6273.       return -1
  6274.     end
  6275.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6276.     ret=-1; showanim=true
  6277.     if opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  6278.       ret=0; showanim=false
  6279.     end
  6280.     if opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self,showanim)
  6281.       ret=0; showanim=false
  6282.     end
  6283.     attacker.pbReduceHP(attacker.hp)
  6284.     return ret
  6285.   end
  6286. end
  6287.  
  6288.  
  6289.  
  6290. ################################################################################
  6291. # User faints. The Pokémon that replaces the user is fully healed (HP and
  6292. # status). Fails if user won't be replaced. (Healing Wish)
  6293. ################################################################################
  6294. class PokeBattle_Move_0E3 < PokeBattle_Move
  6295.   def isHealingMove?
  6296.     return true
  6297.   end
  6298.  
  6299.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6300.     if !@battle.pbCanChooseNonActive?(attacker.index)
  6301.       @battle.pbDisplay(_INTL("But it failed!"))
  6302.       return -1
  6303.     end
  6304.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6305.     attacker.pbReduceHP(attacker.hp)
  6306.     attacker.effects[PBEffects::HealingWish]=true
  6307.     return 0
  6308.   end
  6309. end
  6310.  
  6311.  
  6312.  
  6313. ################################################################################
  6314. # User faints. The Pokémon that replaces the user is fully healed (HP, PP and
  6315. # status). Fails if user won't be replaced. (Lunar Dance)
  6316. ################################################################################
  6317. class PokeBattle_Move_0E4 < PokeBattle_Move
  6318.   def isHealingMove?
  6319.     return true
  6320.   end
  6321.  
  6322.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6323.     if !@battle.pbCanChooseNonActive?(attacker.index)
  6324.       @battle.pbDisplay(_INTL("But it failed!"))
  6325.       return -1
  6326.     end
  6327.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6328.     attacker.pbReduceHP(attacker.hp)
  6329.     attacker.effects[PBEffects::LunarDance]=true
  6330.     return 0
  6331.   end
  6332. end
  6333.  
  6334.  
  6335.  
  6336. ################################################################################
  6337. # All current battlers will perish after 3 more rounds. (Perish Song)
  6338. ################################################################################
  6339. class PokeBattle_Move_0E5 < PokeBattle_Move
  6340.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6341.     failed=true
  6342.     for i in 0...4
  6343.       if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
  6344.          (attacker.hasMoldBreaker ||
  6345.          !@battle.battlers[i].hasWorkingAbility(:SOUNDPROOF))
  6346.         failed=false; break
  6347.       end  
  6348.     end
  6349.     if failed
  6350.       @battle.pbDisplay(_INTL("But it failed!"))
  6351.       return -1
  6352.     end
  6353.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6354.     @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
  6355.     for i in 0...4
  6356.       if @battle.battlers[i].effects[PBEffects::PerishSong]==0
  6357.         if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  6358.           @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
  6359.              PBAbilities.getName(@battle.battlers[i].ability),@name))
  6360.         else
  6361.           @battle.battlers[i].effects[PBEffects::PerishSong]=4
  6362.           @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
  6363.         end
  6364.       end
  6365.     end
  6366.     return 0
  6367.   end
  6368. end
  6369.  
  6370.  
  6371.  
  6372. ################################################################################
  6373. # If user is KO'd before it next moves, the attack that caused it loses all PP.
  6374. # (Grudge)
  6375. ################################################################################
  6376. class PokeBattle_Move_0E6 < PokeBattle_Move
  6377.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6378.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6379.     attacker.effects[PBEffects::Grudge]=true
  6380.     @battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",attacker.pbThis))
  6381.     return 0
  6382.   end
  6383. end
  6384.  
  6385.  
  6386.  
  6387. ################################################################################
  6388. # If user is KO'd before it next moves, the battler that caused it also faints.
  6389. # (Destiny Bond)
  6390. ################################################################################
  6391. class PokeBattle_Move_0E7 < PokeBattle_Move
  6392.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6393.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6394.     attacker.effects[PBEffects::DestinyBond]=true
  6395.     @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
  6396.     return 0
  6397.   end
  6398. end
  6399.  
  6400.  
  6401.  
  6402. ################################################################################
  6403. # If user would be KO'd this round, it survives with 1HP instead. (Endure)
  6404. ################################################################################
  6405. class PokeBattle_Move_0E8 < PokeBattle_Move
  6406.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6407.     ratesharers=[
  6408.        0xAA,   # Detect, Protect
  6409.        0xAB,   # Quick Guard
  6410.        0xAC,   # Wide Guard
  6411.        0xE8,   # Endure
  6412.        0x14B,  # King's Shield
  6413.        0x14C   # Spiky Shield
  6414.     ]
  6415.     if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  6416.       attacker.effects[PBEffects::ProtectRate]=1
  6417.     end
  6418.     unmoved=false
  6419.     for poke in @battle.battlers
  6420.       next if poke.index==attacker.index
  6421.       if @battle.choices[poke.index][0]==1 && # Chose a move
  6422.          !poke.hasMovedThisRound?
  6423.         unmoved=true; break
  6424.       end
  6425.     end
  6426.     if !unmoved ||
  6427.        @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  6428.       attacker.effects[PBEffects::ProtectRate]=1
  6429.       @battle.pbDisplay(_INTL("But it failed!"))
  6430.       return -1
  6431.     end
  6432.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6433.     attacker.effects[PBEffects::Endure]=true
  6434.     attacker.effects[PBEffects::ProtectRate]*=2
  6435.     @battle.pbDisplay(_INTL("{1} braced itself!",attacker.pbThis))
  6436.     return 0
  6437.   end
  6438. end
  6439.  
  6440.  
  6441.  
  6442. ################################################################################
  6443. # If target would be KO'd by this attack, it survives with 1HP instead. (False Swipe)
  6444. ################################################################################
  6445. class PokeBattle_Move_0E9 < PokeBattle_Move
  6446. # Handled in superclass def pbReduceHPDamage, do not edit!
  6447. end
  6448.  
  6449.  
  6450.  
  6451. ################################################################################
  6452. # User flees from battle. Fails in trainer battles. (Teleport)
  6453. ################################################################################
  6454. class PokeBattle_Move_0EA < PokeBattle_Move
  6455.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6456.     if @battle.opponent ||
  6457.        !@battle.pbCanRun?(attacker.index)
  6458.       @battle.pbDisplay(_INTL("But it failed!"))
  6459.       return -1
  6460.     end
  6461.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6462.     @battle.pbDisplay(_INTL("{1} fled from battle!",attacker.pbThis))
  6463.     @battle.decision=3
  6464.     return 0
  6465.   end
  6466. end
  6467.  
  6468.  
  6469.  
  6470. ################################################################################
  6471. # In wild battles, makes target flee. Fails if target is a higher level than the
  6472. # user.
  6473. # In trainer battles, target switches out.
  6474. # For status moves. (Roar, Whirlwind)
  6475. ################################################################################
  6476. class PokeBattle_Move_0EB < PokeBattle_Move
  6477.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6478.     if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:SUCTIONCUPS)
  6479.       @battle.pbDisplay(_INTL("{1} anchored itself with {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))  
  6480.       return -1
  6481.     end
  6482.     if opponent.effects[PBEffects::Ingrain]
  6483.       @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",opponent.pbThis))  
  6484.       return -1
  6485.     end
  6486.     if !@battle.opponent
  6487.       if opponent.level>attacker.level
  6488.         @battle.pbDisplay(_INTL("But it failed!"))
  6489.         return -1
  6490.       end
  6491.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6492.       @battle.decision=3 # Set decision to escaped
  6493.       return 0
  6494.     else
  6495.       choices=false
  6496.       party=@battle.pbParty(opponent.index)
  6497.       for i in 0...party.length
  6498.         if @battle.pbCanSwitch?(opponent.index,i,false,true)
  6499.           choices=true
  6500.           break
  6501.         end
  6502.       end
  6503.       if !choices
  6504.         @battle.pbDisplay(_INTL("But it failed!"))
  6505.         return -1
  6506.       end
  6507.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6508.       opponent.effects[PBEffects::Roar]=true
  6509.       return 0
  6510.     end
  6511.   end
  6512. end
  6513.  
  6514.  
  6515.  
  6516. ################################################################################
  6517. # In wild battles, makes target flee. Fails if target is a higher level than the
  6518. # user.
  6519. # In trainer battles, target switches out.
  6520. # For damaging moves. (Circle Throw, Dragon Tail)
  6521. ################################################################################
  6522. class PokeBattle_Move_0EC < PokeBattle_Move
  6523.   def pbEffectAfterHit(attacker,opponent,turneffects)
  6524.     if !attacker.fainted? && !opponent.fainted? &&
  6525.        opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6526.        (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SUCTIONCUPS)) &&
  6527.        !opponent.effects[PBEffects::Ingrain]
  6528.       if !@battle.opponent
  6529.         if opponent.level<=attacker.level
  6530.           @battle.decision=3 # Set decision to escaped
  6531.         end
  6532.       else
  6533.         party=@battle.pbParty(opponent.index)
  6534.         for i in 0..party.length-1
  6535.           if @battle.pbCanSwitch?(opponent.index,i,false)
  6536.             opponent.effects[PBEffects::Roar]=true
  6537.             break
  6538.           end
  6539.         end
  6540.       end
  6541.     end
  6542.   end
  6543. end
  6544.  
  6545.  
  6546.  
  6547. ################################################################################
  6548. # User switches out. Various effects affecting the user are passed to the
  6549. # replacement. (Baton Pass)
  6550. ################################################################################
  6551. class PokeBattle_Move_0ED < PokeBattle_Move
  6552.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6553.     if !@battle.pbCanChooseNonActive?(attacker.index)
  6554.       @battle.pbDisplay(_INTL("But it failed!"))
  6555.       return -1
  6556.     end
  6557.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6558.     attacker.effects[PBEffects::BatonPass]=true
  6559.     return 0
  6560.   end
  6561. end
  6562.  
  6563.  
  6564.  
  6565. ################################################################################
  6566. # After inflicting damage, user switches out. Ignores trapping moves.
  6567. # (U-turn, Volt Switch)
  6568. # TODO: Pursuit should interrupt this move.
  6569. ################################################################################
  6570. class PokeBattle_Move_0EE < PokeBattle_Move
  6571.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6572.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6573.     if !attacker.fainted? && opponent.damagestate.calcdamage>0 &&
  6574.        @battle.pbCanChooseNonActive?(attacker.index) &&
  6575.        !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  6576.       attacker.effects[PBEffects::Uturn]=true
  6577.     end
  6578.     return ret
  6579.   end
  6580. end
  6581.  
  6582.  
  6583.  
  6584. ################################################################################
  6585. # Target can no longer switch out or flee, as long as the user remains active.
  6586. # (Block, Mean Look, Spider Web, Thousand Waves)
  6587. ################################################################################
  6588. class PokeBattle_Move_0EF < PokeBattle_Move
  6589.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6590.     if pbIsDamaging?
  6591.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6592.       if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6593.          !opponent.fainted?
  6594.         if opponent.effects[PBEffects::MeanLook]<0 &&
  6595.            (!USENEWBATTLEMECHANICS || !opponent.pbHasType?(:GHOST))
  6596.           opponent.effects[PBEffects::MeanLook]=attacker.index
  6597.           @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6598.         end
  6599.       end
  6600.       return ret
  6601.     end
  6602.     if opponent.effects[PBEffects::MeanLook]>=0 ||
  6603.        (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  6604.       @battle.pbDisplay(_INTL("But it failed!"))
  6605.       return -1
  6606.     end
  6607.     if USENEWBATTLEMECHANICS && opponent.pbHasType?(:GHOST)
  6608.       @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6609.       return -1
  6610.     end
  6611.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6612.     opponent.effects[PBEffects::MeanLook]=attacker.index
  6613.     @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6614.     return 0
  6615.   end
  6616. end
  6617.  
  6618.  
  6619.  
  6620. ################################################################################
  6621. # Target drops its item. It regains the item at the end of the battle. (Knock Off)
  6622. # If target has a losable item, damage is multiplied by 1.5.
  6623. ################################################################################
  6624. class PokeBattle_Move_0F0 < PokeBattle_Move
  6625.   def pbEffectAfterHit(attacker,opponent,turneffects)
  6626.     if !attacker.fainted? && !opponent.fainted? && opponent.item!=0 &&
  6627.        opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6628.       if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6629.         abilityname=PBAbilities.getName(opponent.ability)
  6630.         @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6631.       elsif !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6632.         itemname=PBItems.getName(opponent.item)
  6633.         opponent.item=0
  6634.         opponent.effects[PBEffects::ChoiceBand]=-1
  6635.         opponent.effects[PBEffects::Unburden]=true
  6636.         @battle.pbDisplay(_INTL("{1} dropped its {2}!",opponent.pbThis,itemname))
  6637.       end
  6638.     end
  6639.   end
  6640.  
  6641.   def pbModifyDamage(damagemult,attacker,opponent)
  6642.     if USENEWBATTLEMECHANICS &&
  6643.        !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6644.        # Still boosts damage even if opponent has Sticky Hold
  6645.       return (damagemult*1.5).round
  6646.     end
  6647.     return damagemult
  6648.   end
  6649. end
  6650.  
  6651.  
  6652.  
  6653. ################################################################################
  6654. # User steals the target's item, if the user has none itself. (Covet, Thief)
  6655. # Items stolen from wild Pokémon are kept after the battle.
  6656. ################################################################################
  6657. class PokeBattle_Move_0F1 < PokeBattle_Move
  6658.   def pbEffectAfterHit(attacker,opponent,turneffects)
  6659.     if !attacker.fainted? && !opponent.fainted? && opponent.item!=0 &&
  6660.        opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6661.       if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6662.         abilityname=PBAbilities.getName(opponent.ability)
  6663.         @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6664.       elsif !@battle.pbIsUnlosableItem(opponent,opponent.item) &&
  6665.             !@battle.pbIsUnlosableItem(attacker,opponent.item) &&
  6666.             attacker.item==0 &&
  6667.             (@battle.opponent || !@battle.pbIsOpposing?(attacker.index))
  6668.         itemname=PBItems.getName(opponent.item)
  6669.         attacker.item=opponent.item
  6670.         opponent.item=0
  6671.         opponent.effects[PBEffects::ChoiceBand]=-1
  6672.         opponent.effects[PBEffects::Unburden]=true
  6673.         if !@battle.opponent && # In a wild battle
  6674.            attacker.pokemon.itemInitial==0 &&
  6675.            opponent.pokemon.itemInitial==attacker.item
  6676.           attacker.pokemon.itemInitial=attacker.item
  6677.           opponent.pokemon.itemInitial=0
  6678.         end
  6679.         @battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  6680.       end
  6681.     end
  6682.   end
  6683. end
  6684.  
  6685.  
  6686.  
  6687. ################################################################################
  6688. # User and target swap items. They remain swapped after wild battles.
  6689. # (Switcheroo, Trick)
  6690. ################################################################################
  6691. class PokeBattle_Move_0F2 < PokeBattle_Move
  6692.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6693.     if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6694.        (attacker.item==0 && opponent.item==0) ||
  6695.        (!@battle.opponent && @battle.pbIsOpposing?(attacker.index))
  6696.       @battle.pbDisplay(_INTL("But it failed!"))
  6697.       return -1
  6698.     end
  6699.     if @battle.pbIsUnlosableItem(opponent,opponent.item) ||
  6700.        @battle.pbIsUnlosableItem(attacker,opponent.item) ||
  6701.        @battle.pbIsUnlosableItem(opponent,attacker.item) ||
  6702.        @battle.pbIsUnlosableItem(attacker,attacker.item)
  6703.       @battle.pbDisplay(_INTL("But it failed!"))
  6704.       return -1
  6705.     end
  6706.     if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6707.       abilityname=PBAbilities.getName(opponent.ability)
  6708.       @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,name))
  6709.       return -1
  6710.     end
  6711.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6712.     oldattitem=attacker.item
  6713.     oldoppitem=opponent.item
  6714.     oldattitemname=PBItems.getName(oldattitem)
  6715.     oldoppitemname=PBItems.getName(oldoppitem)
  6716.     tmpitem=attacker.item
  6717.     attacker.item=opponent.item
  6718.     opponent.item=tmpitem
  6719.     if !@battle.opponent && # In a wild battle
  6720.        attacker.pokemon.itemInitial==oldattitem &&
  6721.        opponent.pokemon.itemInitial==oldoppitem
  6722.       attacker.pokemon.itemInitial=oldoppitem
  6723.       opponent.pokemon.itemInitial=oldattitem
  6724.     end
  6725.     @battle.pbDisplay(_INTL("{1} switched items with its opponent!",attacker.pbThis))
  6726.     if oldoppitem>0 && oldattitem>0
  6727.       @battle.pbDisplayPaused(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname))
  6728.       @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname))
  6729.     else
  6730.       @battle.pbDisplay(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname)) if oldoppitem>0
  6731.       @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname)) if oldattitem>0
  6732.     end
  6733.     attacker.effects[PBEffects::ChoiceBand]=-1
  6734.     opponent.effects[PBEffects::ChoiceBand]=-1
  6735.     return 0
  6736.   end
  6737. end
  6738.  
  6739.  
  6740.  
  6741. ################################################################################
  6742. # User gives its item to the target. The item remains given after wild battles.
  6743. # (Bestow)
  6744. ################################################################################
  6745. class PokeBattle_Move_0F3 < PokeBattle_Move
  6746.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6747.     if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6748.        attacker.item==0 || opponent.item!=0
  6749.       @battle.pbDisplay(_INTL("But it failed!"))
  6750.       return -1
  6751.     end
  6752.     if @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6753.        @battle.pbIsUnlosableItem(opponent,attacker.item)
  6754.       @battle.pbDisplay(_INTL("But it failed!"))
  6755.       return -1
  6756.     end
  6757.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6758.     itemname=PBItems.getName(attacker.item)
  6759.     opponent.item=attacker.item
  6760.     attacker.item=0
  6761.     attacker.effects[PBEffects::ChoiceBand]=-1
  6762.     attacker.effects[PBEffects::Unburden]=true
  6763.     if !@battle.opponent && # In a wild battle
  6764.        opponent.pokemon.itemInitial==0 &&
  6765.        attacker.pokemon.itemInitial==opponent.item
  6766.       opponent.pokemon.itemInitial=opponent.item
  6767.       attacker.pokemon.itemInitial=0
  6768.     end
  6769.     @battle.pbDisplay(_INTL("{1} received {2} from {3}!",opponent.pbThis,itemname,attacker.pbThis(true)))
  6770.     return 0
  6771.   end
  6772. end
  6773.  
  6774.  
  6775.  
  6776. ################################################################################
  6777. # User consumes target's berry and gains its effect. (Bug Bite, Pluck)
  6778. ################################################################################
  6779. class PokeBattle_Move_0F4 < PokeBattle_Move
  6780.   def pbEffectAfterHit(attacker,opponent,turneffects)
  6781.     if !attacker.fainted? && !opponent.fainted? && pbIsBerry?(opponent.item) &&
  6782.        opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6783.       if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:STICKYHOLD)
  6784.         item=opponent.item
  6785.         itemname=PBItems.getName(item)
  6786.         opponent.pbConsumeItem(false,false)
  6787.         @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",attacker.pbThis,itemname))
  6788.         if !attacker.hasWorkingAbility(:KLUTZ) &&
  6789.            attacker.effects[PBEffects::Embargo]==0
  6790.           attacker.pbActivateBerryEffect(item,false)
  6791.         end
  6792.         # Symbiosis
  6793.         if attacker.item==0 &&
  6794.            attacker.pbPartner && attacker.pbPartner.hasWorkingAbility(:SYMBIOSIS)
  6795.           partner=attacker.pbPartner
  6796.           if partner.item>0 &&
  6797.              !@battle.pbIsUnlosableItem(partner,partner.item) &&
  6798.              !@battle.pbIsUnlosableItem(attacker,partner.item)
  6799.             @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
  6800.                partner.pbThis,PBAbilities.getName(partner.ability),
  6801.                PBItems.getName(partner.item),attacker.pbThis(true)))
  6802.             attacker.item=partner.item
  6803.             partner.item=0
  6804.             partner.effects[PBEffects::Unburden]=true
  6805.             attacker.pbBerryCureCheck
  6806.           end
  6807.         end
  6808.       end
  6809.     end
  6810.   end
  6811. end
  6812.  
  6813.  
  6814.  
  6815. ################################################################################
  6816. # Target's berry is destroyed. (Incinerate)
  6817. ################################################################################
  6818. class PokeBattle_Move_0F5 < PokeBattle_Move
  6819.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6820.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6821.     if !attacker.fainted? && opponent.damagestate.calcdamage>0 &&
  6822.        !opponent.damagestate.substitute &&
  6823.        (pbIsBerry?(opponent.item) || (USENEWBATTLEMECHANICS && pbIsGem?(opponent.item)))
  6824.       itemname=PBItems.getName(opponent.item)
  6825.       opponent.pbConsumeItem(false,false)
  6826.       @battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",opponent.pbThis,itemname))
  6827.     end
  6828.     return ret
  6829.   end
  6830. end
  6831.  
  6832.  
  6833.  
  6834. ################################################################################
  6835. # User recovers the last item it held and consumed. (Recycle)
  6836. ################################################################################
  6837. class PokeBattle_Move_0F6 < PokeBattle_Move
  6838.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6839.     if !attacker.pokemon || attacker.pokemon.itemRecycle==0
  6840.       @battle.pbDisplay(_INTL("But it failed!"))
  6841.       return -1
  6842.     end
  6843.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6844.     item=attacker.pokemon.itemRecycle
  6845.     itemname=PBItems.getName(item)
  6846.     attacker.item=item
  6847.     if !@battle.opponent # In a wild battle
  6848.       attacker.pokemon.itemInitial=item if attacker.pokemon.itemInitial==0
  6849.     end
  6850.     attacker.pokemon.itemRecycle=0
  6851.     attacker.effects[PBEffects::PickupItem]=0
  6852.     attacker.effects[PBEffects::PickupUse]=0
  6853.     @battle.pbDisplay(_INTL("{1} found one {2}!",attacker.pbThis,itemname))
  6854.     return 0
  6855.   end
  6856. end
  6857.  
  6858.  
  6859.  
  6860. ################################################################################
  6861. # User flings its item at the target. Power and effect depend on the item. (Fling)
  6862. ################################################################################
  6863. class PokeBattle_Move_0F7 < PokeBattle_Move
  6864.   def flingarray
  6865.     return {
  6866.        130 => [:IRONBALL],
  6867.        100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,
  6868.                :HELIXFOSSIL,:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,
  6869.                :ROOTFOSSIL,:SAILFOSSIL,:SKULLFOSSIL],
  6870.         90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,
  6871.                :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,
  6872.                :MEADOWPLATE,:MINDPLATE,:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,
  6873.                :SPOOKYPLATE,:STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],
  6874.         80 => [:ASSAULTVEST,:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,
  6875.                :ODDKEYSTONE,:OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,
  6876.                :SAFETYGOGGLES,:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY],
  6877.         70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,
  6878.                :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
  6879.                :POWERWEIGHT,:SHOCKDRIVE],
  6880.         60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LUSTROUSORB,
  6881.                :MACHOBRACE,:ROCKYHELMET,:STICK],
  6882.         50 => [:DUBIOUSDISC,:SHARPBEAK],
  6883.         40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],
  6884.         30 => [:ABILITYCAPSULE,:ABILITYURGE,:ABSORBBULB,:AMAZEMULCH,:AMULETCOIN,
  6885.                :ANTIDOTE,:AWAKENING,:BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,
  6886.                :BIGNUGGET,:BIGPEARL,:BINDINGBAND,:BLACKBELT,:BLACKFLUTE,
  6887.                :BLACKGLASSES,:BLACKSLUDGE,:BLUEFLUTE,:BLUESHARD,:BOOSTMULCH,
  6888.                :BURNHEAL,:CALCIUM,:CARBOS,:CASTELIACONE,:CELLBATTERY,
  6889.                :CHARCOAL,:CLEANSETAG,:COMETSHARD,:DAMPMULCH,:DEEPSEASCALE,
  6890.                :DIREHIT,:DIREHIT2,:DIREHIT3,:DRAGONSCALE,:EJECTBUTTON,
  6891.                :ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ESCAPEROPE,:ETHER,
  6892.                :EVERSTONE,:EXPSHARE,:FIRESTONE,:FLAMEORB,:FLOATSTONE,
  6893.                :FLUFFYTAIL,:FRESHWATER,:FULLHEAL,:FULLRESTORE,:GOOEYMULCH,
  6894.                :GREENSHARD,:GROWTHMULCH,:GUARDSPEC,:HEALPOWDER,:HEARTSCALE,
  6895.                :HONEY,:HPUP,:HYPERPOTION,:ICEHEAL,:IRON,
  6896.                :ITEMDROP,:ITEMURGE,:KINGSROCK,:LAVACOOKIE,:LEAFSTONE,
  6897.                :LEMONADE,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,:LUCKYEGG,
  6898.                :LUMINOUSMOSS,:LUMIOSEGALETTE,:MAGNET,:MAXELIXIR,:MAXETHER,
  6899.                :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,
  6900.                :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,
  6901.                :NUGGET,:OLDGATEAU,:PARALYZEHEAL,:PARLYZHEAL,:PASSORB,
  6902.                :PEARL,:PEARLSTRING,:POKEDOLL,:POKETOY,:POTION,
  6903.                :PPMAX,:PPUP,:PRISMSCALE,:PROTEIN,:RAGECANDYBAR,
  6904.                :RARECANDY,:RAZORFANG,:REDFLUTE,:REDSHARD,:RELICBAND,
  6905.                :RELICCOPPER,:RELICCROWN,:RELICGOLD,:RELICSILVER,:RELICSTATUE,
  6906.                :RELICVASE,:REPEL,:RESETURGE,:REVIVALHERB,:REVIVE,
  6907.                :RICHMULCH,:SACHET,:SACREDASH,:SCOPELENS,:SHALOURSABLE,
  6908.                :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
  6909.                :SODAPOP,:SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,
  6910.                :STARPIECE,:SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SURPRISEMULCH,
  6911.                :SWEETHEART,:THUNDERSTONE,:TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,
  6912.                :UPGRADE,:WATERSTONE,:WHIPPEDDREAM,:WHITEFLUTE,:XACCURACY,
  6913.                :XACCURACY2,:XACCURACY3,:XACCURACY6,:XATTACK,:XATTACK2,
  6914.                :XATTACK3,:XATTACK6,:XDEFEND,:XDEFEND2,:XDEFEND3,
  6915.                :XDEFEND6,:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
  6916.                :XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,:XSPATK,
  6917.                :XSPATK2,:XSPATK3,:XSPATK6,:XSPECIAL,:XSPECIAL2,
  6918.                :XSPECIAL3,:XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,
  6919.                :XSPEED6,:YELLOWFLUTE,:YELLOWSHARD,:ZINC],
  6920.         20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
  6921.                :RESISTWING,:SWIFTWING],
  6922.         10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,
  6923.                :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,
  6924.                :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,
  6925.                :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,
  6926.                :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,
  6927.                :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,
  6928.                :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,
  6929.                :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,
  6930.                :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS]
  6931.     }
  6932.   end
  6933.  
  6934.   def pbMoveFailed(attacker,opponent)
  6935.     return true if attacker.item==0 ||
  6936.                    @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6937.                    pbIsPokeBall?(attacker.item) ||
  6938.                    @battle.field.effects[PBEffects::MagicRoom]>0 ||
  6939.                    attacker.hasWorkingAbility(:KLUTZ) ||
  6940.                    attacker.effects[PBEffects::Embargo]>0
  6941.     for i in flingarray.keys
  6942.       if flingarray[i]
  6943.         for j in flingarray[i]
  6944.           return false if isConst?(attacker.item,PBItems,j)
  6945.         end
  6946.       end
  6947.     end
  6948.     return false if pbIsBerry?(attacker.item) &&
  6949.                     !attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) &&
  6950.                     !attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  6951.     return true
  6952.   end
  6953.  
  6954.   def pbBaseDamage(basedmg,attacker,opponent)
  6955.     return 10 if pbIsBerry?(attacker.item)
  6956.     return 80 if pbIsMegaStone?(attacker.item)
  6957.     for i in flingarray.keys
  6958.       if flingarray[i]
  6959.         for j in flingarray[i]
  6960.           return i if isConst?(attacker.item,PBItems,j)
  6961.         end
  6962.       end
  6963.     end
  6964.     return 1
  6965.   end
  6966.  
  6967.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6968.     if attacker.item==0
  6969.       @battle.pbDisplay(_INTL("But it failed!"))
  6970.       return 0
  6971.     end
  6972.     attacker.effects[PBEffects::Unburden]=true
  6973.     @battle.pbDisplay(_INTL("{1} flung its {2}!",attacker.pbThis,PBItems.getName(attacker.item)))
  6974.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6975.     if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6976.        (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SHIELDDUST))
  6977.       if attacker.hasWorkingBerry
  6978.         opponent.pbActivateBerryEffect(attacker.item,false)
  6979.       elsif attacker.hasWorkingItem(:FLAMEORB)
  6980.         if opponent.pbCanBurn?(attacker,false,self)
  6981.           opponent.pbBurn(attacker)
  6982.         end
  6983.       elsif attacker.hasWorkingItem(:KINGSROCK) ||
  6984.             attacker.hasWorkingItem(:RAZORFANG)
  6985.         opponent.pbFlinch(attacker)
  6986.       elsif attacker.hasWorkingItem(:LIGHTBALL)
  6987.         if opponent.pbCanParalyze?(attacker,false,self)
  6988.           opponent.pbParalyze(attacker)
  6989.         end
  6990.       elsif attacker.hasWorkingItem(:MENTALHERB)
  6991.         if opponent.effects[PBEffects::Attract]>=0
  6992.           opponent.pbCureAttract
  6993.           @battle.pbDisplay(_INTL("{1} got over its infatuation.",opponent.pbThis))
  6994.         end
  6995.         if opponent.effects[PBEffects::Taunt]>0
  6996.           opponent.effects[PBEffects::Taunt]=0
  6997.           @battle.pbDisplay(_INTL("{1}'s taunt wore off!",opponent.pbThis))
  6998.         end
  6999.         if opponent.effects[PBEffects::Encore]>0
  7000.           opponent.effects[PBEffects::Encore]=0
  7001.           opponent.effects[PBEffects::EncoreMove]=0
  7002.           opponent.effects[PBEffects::EncoreIndex]=0
  7003.           @battle.pbDisplay(_INTL("{1}'s encore ended!",opponent.pbThis))
  7004.         end
  7005.         if opponent.effects[PBEffects::Torment]
  7006.           opponent.effects[PBEffects::Torment]=false
  7007.           @battle.pbDisplay(_INTL("{1}'s torment wore off!",opponent.pbThis))
  7008.         end
  7009.         if opponent.effects[PBEffects::Disable]>0
  7010.           opponent.effects[PBEffects::Disable]=0
  7011.           @battle.pbDisplay(_INTL("{1} is no longer disabled!",opponent.pbThis))
  7012.         end
  7013.         if opponent.effects[PBEffects::HealBlock]>0
  7014.           opponent.effects[PBEffects::HealBlock]=0
  7015.           @battle.pbDisplay(_INTL("{1}'s Heal Block wore off!",opponent.pbThis))
  7016.         end
  7017.       elsif attacker.hasWorkingItem(:POISONBARB)
  7018.         if opponent.pbCanPoison?(attacker,false,self)
  7019.           opponent.pbPoison(attacker)
  7020.         end
  7021.       elsif attacker.hasWorkingItem(:TOXICORB)
  7022.         if opponent.pbCanPoison?(attacker,false,self)
  7023.           opponent.pbPoison(attacker,nil,true)
  7024.         end
  7025.       elsif attacker.hasWorkingItem(:WHITEHERB)
  7026.         while true
  7027.           reducedstats=false
  7028.           for i in [PBStats::ATTACK,PBStats::DEFENSE,
  7029.                     PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF,
  7030.                     PBStats::EVASION,PBStats::ACCURACY]
  7031.             if opponent.stages[i]<0
  7032.               opponent.stages[i]=0; reducedstats=true
  7033.             end
  7034.           end
  7035.           break if !reducedstats
  7036.           @battle.pbDisplay(_INTL("{1}'s status is returned to normal!",
  7037.              opponent.pbThis(true)))
  7038.         end
  7039.       end
  7040.     end
  7041.     attacker.pbConsumeItem
  7042.     return ret
  7043.   end
  7044. end
  7045.  
  7046.  
  7047.  
  7048. ################################################################################
  7049. # For 5 rounds, the target cannnot use its held item, its held item has no
  7050. # effect, and no items can be used on it. (Embargo)
  7051. ################################################################################
  7052. class PokeBattle_Move_0F8 < PokeBattle_Move
  7053.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7054.     if opponent.effects[PBEffects::Embargo]>0
  7055.       @battle.pbDisplay(_INTL("But it failed!"))
  7056.       return -1
  7057.     end
  7058.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7059.     opponent.effects[PBEffects::Embargo]=5
  7060.     @battle.pbDisplay(_INTL("{1} can't use items anymore!",opponent.pbThis))
  7061.     return 0
  7062.   end
  7063. end
  7064.  
  7065.  
  7066.  
  7067. ################################################################################
  7068. # For 5 rounds, all held items cannot be used in any way and have no effect.
  7069. # Held items can still change hands, but can't be thrown. (Magic Room)
  7070. ################################################################################
  7071. class PokeBattle_Move_0F9 < PokeBattle_Move
  7072.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7073.     if @battle.field.effects[PBEffects::MagicRoom]>0
  7074.       @battle.field.effects[PBEffects::MagicRoom]=0
  7075.       @battle.pbDisplay(_INTL("The area returned to normal!"))
  7076.     else
  7077.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7078.       @battle.field.effects[PBEffects::MagicRoom]=5
  7079.       @battle.pbDisplay(_INTL("It created a bizarre area in which Pokémon's held items lose their effects!"))
  7080.     end
  7081.     return 0
  7082.   end
  7083. end
  7084.  
  7085.  
  7086.  
  7087. ################################################################################
  7088. # User takes recoil damage equal to 1/4 of the damage this move dealt.
  7089. ################################################################################
  7090. class PokeBattle_Move_0FA < PokeBattle_Move
  7091.   def isRecoilMove?
  7092.     return true
  7093.   end
  7094.  
  7095.   def pbEffectAfterHit(attacker,opponent,turneffects)
  7096.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7097.       if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7098.          !attacker.hasWorkingAbility(:MAGICGUARD)
  7099.         attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/4.0).round)
  7100.         @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7101.       end
  7102.     end
  7103.   end
  7104. end
  7105.  
  7106.  
  7107.  
  7108. ################################################################################
  7109. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7110. ################################################################################
  7111. class PokeBattle_Move_0FB < PokeBattle_Move
  7112.   def isRecoilMove?
  7113.     return true
  7114.   end
  7115.  
  7116.   def pbEffectAfterHit(attacker,opponent,turneffects)
  7117.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7118.       if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7119.          !attacker.hasWorkingAbility(:MAGICGUARD)
  7120.         attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7121.         @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7122.       end
  7123.     end
  7124.   end
  7125. end
  7126.  
  7127.  
  7128.  
  7129. ################################################################################
  7130. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  7131. # (Head Smash)
  7132. ################################################################################
  7133. class PokeBattle_Move_0FC < PokeBattle_Move
  7134.   def isRecoilMove?
  7135.     return true
  7136.   end
  7137.  
  7138.   def pbEffectAfterHit(attacker,opponent,turneffects)
  7139.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7140.       if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7141.          !attacker.hasWorkingAbility(:MAGICGUARD)
  7142.         attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
  7143.         @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7144.       end
  7145.     end
  7146.   end
  7147. end
  7148.  
  7149.  
  7150.  
  7151. ################################################################################
  7152. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7153. # May paralyze the target. (Volt Tackle)
  7154. ################################################################################
  7155. class PokeBattle_Move_0FD < PokeBattle_Move
  7156.   def isRecoilMove?
  7157.     return true
  7158.   end
  7159.  
  7160.   def pbEffectAfterHit(attacker,opponent,turneffects)
  7161.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7162.       if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7163.          !attacker.hasWorkingAbility(:MAGICGUARD)
  7164.         attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7165.         @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7166.       end
  7167.     end
  7168.   end
  7169.  
  7170.   def pbAdditionalEffect(attacker,opponent)
  7171.     return if opponent.damagestate.substitute
  7172.     if opponent.pbCanParalyze?(attacker,false,self)
  7173.       opponent.pbParalyze(attacker)
  7174.     end
  7175.   end
  7176. end
  7177.  
  7178.  
  7179.  
  7180. ################################################################################
  7181. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7182. # May burn the target. (Flare Blitz)
  7183. ################################################################################
  7184. class PokeBattle_Move_0FE < PokeBattle_Move
  7185.   def isRecoilMove?
  7186.     return true
  7187.   end
  7188.  
  7189.   def pbEffectAfterHit(attacker,opponent,turneffects)
  7190.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7191.       if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7192.          !attacker.hasWorkingAbility(:MAGICGUARD)
  7193.         attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7194.         @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7195.       end
  7196.     end
  7197.   end
  7198.  
  7199.   def pbAdditionalEffect(attacker,opponent)
  7200.     return if opponent.damagestate.substitute
  7201.     if opponent.pbCanBurn?(attacker,false,self)
  7202.       opponent.pbBurn(attacker)
  7203.     end
  7204.   end
  7205. end
  7206.  
  7207.  
  7208.  
  7209. ################################################################################
  7210. # Starts sunny weather. (Sunny Day)
  7211. ################################################################################
  7212. class PokeBattle_Move_0FF < PokeBattle_Move
  7213.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7214.     case @battle.weather
  7215.     when PBWeather::HEAVYRAIN
  7216.       @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7217.       return -1
  7218.     when PBWeather::HARSHSUN
  7219.       @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7220.       return -1
  7221.     when PBWeather::STRONGWINDS
  7222.       @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7223.       return -1
  7224.     when PBWeather::SUNNYDAY
  7225.       @battle.pbDisplay(_INTL("But it failed!"))
  7226.       return -1
  7227.     end
  7228.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7229.     @battle.weather=PBWeather::SUNNYDAY
  7230.     @battle.weatherduration=5
  7231.     @battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
  7232.     @battle.pbCommonAnimation("Sunny",nil,nil)
  7233.     @battle.pbDisplay(_INTL("The sunlight turned harsh!"))
  7234.     return 0
  7235.   end
  7236. end
  7237.  
  7238.  
  7239.  
  7240. ################################################################################
  7241. # Starts rainy weather. (Rain Dance)
  7242. ################################################################################
  7243. class PokeBattle_Move_100 < PokeBattle_Move
  7244.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7245.     case @battle.weather
  7246.     when PBWeather::HEAVYRAIN
  7247.       @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7248.       return -1
  7249.     when PBWeather::HARSHSUN
  7250.       @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7251.       return -1
  7252.     when PBWeather::STRONGWINDS
  7253.       @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7254.       return -1
  7255.     when PBWeather::RAINDANCE
  7256.       @battle.pbDisplay(_INTL("But it failed!"))
  7257.       return -1
  7258.     end
  7259.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7260.     @battle.weather=PBWeather::RAINDANCE
  7261.     @battle.weatherduration=5
  7262.     @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
  7263.     @battle.pbCommonAnimation("Rain",nil,nil)
  7264.     @battle.pbDisplay(_INTL("It started to rain!"))
  7265.     return 0
  7266.   end
  7267. end
  7268.  
  7269.  
  7270.  
  7271. ################################################################################
  7272. # Starts sandstorm weather. (Sandstorm)
  7273. ################################################################################
  7274. class PokeBattle_Move_101 < PokeBattle_Move
  7275.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7276.     case @battle.weather
  7277.     when PBWeather::HEAVYRAIN
  7278.       @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7279.       return -1
  7280.     when PBWeather::HARSHSUN
  7281.       @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7282.       return -1
  7283.     when PBWeather::STRONGWINDS
  7284.       @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7285.       return -1
  7286.     when PBWeather::SANDSTORM
  7287.       @battle.pbDisplay(_INTL("But it failed!"))
  7288.       return -1
  7289.     end
  7290.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7291.     @battle.weather=PBWeather::SANDSTORM
  7292.     @battle.weatherduration=5
  7293.     @battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
  7294.     @battle.pbCommonAnimation("Sandstorm",nil,nil)
  7295.     @battle.pbDisplay(_INTL("A sandstorm brewed!"))
  7296.     return 0
  7297.   end
  7298. end
  7299.  
  7300.  
  7301.  
  7302. ################################################################################
  7303. # Starts hail weather. (Hail)
  7304. ################################################################################
  7305. class PokeBattle_Move_102 < PokeBattle_Move
  7306.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7307.     case @battle.weather
  7308.     when PBWeather::HEAVYRAIN
  7309.       @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7310.       return -1
  7311.     when PBWeather::HARSHSUN
  7312.       @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7313.       return -1
  7314.     when PBWeather::STRONGWINDS
  7315.       @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7316.       return -1
  7317.     when PBWeather::HAIL
  7318.       @battle.pbDisplay(_INTL("But it failed!"))
  7319.       return -1
  7320.     end
  7321.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7322.     @battle.weather=PBWeather::HAIL
  7323.     @battle.weatherduration=5
  7324.     @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
  7325.     @battle.pbCommonAnimation("Hail",nil,nil)
  7326.     @battle.pbDisplay(_INTL("It started to hail!"))
  7327.     return 0
  7328.   end
  7329. end
  7330.  
  7331.  
  7332.  
  7333. ################################################################################
  7334. # Entry hazard. Lays spikes on the opposing side (max. 3 layers). (Spikes)
  7335. ################################################################################
  7336. class PokeBattle_Move_103 < PokeBattle_Move
  7337.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7338.     if attacker.pbOpposingSide.effects[PBEffects::Spikes]>=3
  7339.       @battle.pbDisplay(_INTL("But it failed!"))
  7340.       return -1
  7341.     end
  7342.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7343.     attacker.pbOpposingSide.effects[PBEffects::Spikes]+=1
  7344.     if !@battle.pbIsOpposing?(attacker.index)
  7345.       @battle.pbDisplay(_INTL("Spikes were scattered all around the opposing team's feet!"))
  7346.     else
  7347.       @battle.pbDisplay(_INTL("Spikes were scattered all around your team's feet!"))
  7348.     end
  7349.     return 0
  7350.   end
  7351. end
  7352.  
  7353.  
  7354.  
  7355. ################################################################################
  7356. # Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
  7357. # (Toxic Spikes)
  7358. ################################################################################
  7359. class PokeBattle_Move_104 < PokeBattle_Move
  7360.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7361.     if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
  7362.       @battle.pbDisplay(_INTL("But it failed!"))
  7363.       return -1
  7364.     end
  7365.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7366.     attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]+=1
  7367.     if !@battle.pbIsOpposing?(attacker.index)
  7368.       @battle.pbDisplay(_INTL("Poison spikes were scattered all around the opposing team's feet!"))
  7369.     else
  7370.       @battle.pbDisplay(_INTL("Poison spikes were scattered all around your team's feet!"))
  7371.     end
  7372.     return 0
  7373.   end
  7374. end
  7375.  
  7376.  
  7377.  
  7378. ################################################################################
  7379. # Entry hazard. Lays stealth rocks on the opposing side. (Stealth Rock)
  7380. ################################################################################
  7381. class PokeBattle_Move_105 < PokeBattle_Move
  7382.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7383.     if attacker.pbOpposingSide.effects[PBEffects::StealthRock]
  7384.       @battle.pbDisplay(_INTL("But it failed!"))
  7385.       return -1
  7386.     end
  7387.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7388.     attacker.pbOpposingSide.effects[PBEffects::StealthRock]=true
  7389.     if !@battle.pbIsOpposing?(attacker.index)
  7390.       @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
  7391.     else
  7392.       @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
  7393.     end
  7394.     return 0
  7395.   end
  7396. end
  7397.  
  7398.  
  7399.  
  7400. ################################################################################
  7401. # Forces ally's Pledge move to be used next, if it hasn't already. (Grass Pledge)
  7402. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7403. # causes either a sea of fire or a swamp on the opposing side.
  7404. ################################################################################
  7405. class PokeBattle_Move_106 < PokeBattle_Move
  7406.   def pbOnStartUse(attacker)
  7407.     @doubledamage=false; @overridetype=false
  7408.     if attacker.effects[PBEffects::FirstPledge]==0x107 ||   # Fire Pledge
  7409.        attacker.effects[PBEffects::FirstPledge]==0x108      # Water Pledge
  7410.       @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7411.       @doubledamage=true
  7412.       if attacker.effects[PBEffects::FirstPledge]==0x107   # Fire Pledge
  7413.         @overridetype=true
  7414.       end
  7415.     end
  7416.     return true
  7417.   end
  7418.  
  7419.   def pbBaseDamage(basedmg,attacker,opponent)
  7420.     if @doubledamage
  7421.       return basedmg*2
  7422.     end
  7423.     return basedmg
  7424.   end
  7425.  
  7426.   def pbModifyType(type,attacker,opponent)
  7427.     if @overridetype
  7428.       type=getConst(PBTypes,:FIRE) || 0
  7429.     end
  7430.     return super(type,attacker,opponent)
  7431.   end
  7432.  
  7433.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7434.     if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7435.       attacker.effects[PBEffects::FirstPledge]=0
  7436.       return super(attacker,opponent,hitnum,alltargets,showanimation)
  7437.     end
  7438.     # Combined move's effect
  7439.     if attacker.effects[PBEffects::FirstPledge]==0x107   # Fire Pledge
  7440.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7441.       if opponent.damagestate.calcdamage>0
  7442.         attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7443.         if !@battle.pbIsOpposing?(attacker.index)
  7444.           @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7445.           @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7446.         else
  7447.           @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7448.           @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7449.         end
  7450.       end
  7451.       attacker.effects[PBEffects::FirstPledge]=0
  7452.       return ret
  7453.     elsif attacker.effects[PBEffects::FirstPledge]==0x108   # Water Pledge
  7454.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7455.       if opponent.damagestate.calcdamage>0
  7456.         attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7457.         if !@battle.pbIsOpposing?(attacker.index)
  7458.           @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7459.           @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7460.         else
  7461.           @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7462.           @battle.pbCommonAnimation("Swamp",nil,nil)
  7463.         end
  7464.       end
  7465.       attacker.effects[PBEffects::FirstPledge]=0
  7466.       return ret
  7467.     end
  7468.     # Set up partner for a combined move
  7469.     attacker.effects[PBEffects::FirstPledge]=0
  7470.     partnermove=-1
  7471.     if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7472.       if !attacker.pbPartner.hasMovedThisRound?
  7473.         move=@battle.choices[attacker.pbPartner.index][2]
  7474.         if move && move.id>0
  7475.           partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7476.         end
  7477.       end
  7478.     end
  7479.     if partnermove==0x107 ||   # Fire Pledge
  7480.        partnermove==0x108      # Water Pledge
  7481.       @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7482.       attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7483.       attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7484.       return 0
  7485.     end
  7486.     # Use the move on its own
  7487.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  7488.   end
  7489.  
  7490.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7491.     if @overridetype
  7492.       return super(getConst(PBMoves,:FIREPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7493.     end
  7494.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7495.   end
  7496. end
  7497.  
  7498.  
  7499.  
  7500. ################################################################################
  7501. # Forces ally's Pledge move to be used next, if it hasn't already. (Fire Pledge)
  7502. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7503. # causes either a sea of fire on the opposing side or a rainbow on the user's side.
  7504. ################################################################################
  7505. class PokeBattle_Move_107 < PokeBattle_Move
  7506.   def pbOnStartUse(attacker)
  7507.     @doubledamage=false; @overridetype=false
  7508.     if attacker.effects[PBEffects::FirstPledge]==0x106 ||   # Grass Pledge
  7509.        attacker.effects[PBEffects::FirstPledge]==0x108      # Water Pledge
  7510.       @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7511.       @doubledamage=true
  7512.       if attacker.effects[PBEffects::FirstPledge]==0x108   # Water Pledge
  7513.         @overridetype=true
  7514.       end
  7515.     end
  7516.     return true
  7517.   end
  7518.  
  7519.   def pbBaseDamage(basedmg,attacker,opponent)
  7520.     if @doubledamage
  7521.       return basedmg*2
  7522.     end
  7523.     return basedmg
  7524.   end
  7525.  
  7526.   def pbModifyType(type,attacker,opponent)
  7527.     if @overridetype
  7528.       type=getConst(PBTypes,:WATER) || 0
  7529.     end
  7530.     return super(type,attacker,opponent)
  7531.   end
  7532.  
  7533.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7534.     if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7535.       attacker.effects[PBEffects::FirstPledge]=0
  7536.       return super(attacker,opponent,hitnum,alltargets,showanimation)
  7537.     end
  7538.     # Combined move's effect
  7539.     if attacker.effects[PBEffects::FirstPledge]==0x106   # Grass Pledge
  7540.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7541.       if opponent.damagestate.calcdamage>0
  7542.         attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7543.         if !@battle.pbIsOpposing?(attacker.index)
  7544.           @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7545.           @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7546.         else
  7547.           @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7548.           @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7549.         end
  7550.       end
  7551.       attacker.effects[PBEffects::FirstPledge]=0
  7552.       return ret
  7553.     elsif attacker.effects[PBEffects::FirstPledge]==0x108   # Water Pledge
  7554.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7555.       if opponent.damagestate.calcdamage>0
  7556.         attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7557.         if !@battle.pbIsOpposing?(attacker.index)
  7558.           @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7559.           @battle.pbCommonAnimation("Rainbow",nil,nil)
  7560.         else
  7561.           @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7562.           @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7563.         end
  7564.       end
  7565.       attacker.effects[PBEffects::FirstPledge]=0
  7566.       return ret
  7567.     end
  7568.     # Set up partner for a combined move
  7569.     attacker.effects[PBEffects::FirstPledge]=0
  7570.     partnermove=-1
  7571.     if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7572.       if !attacker.pbPartner.hasMovedThisRound?
  7573.         move=@battle.choices[attacker.pbPartner.index][2]
  7574.         if move && move.id>0
  7575.           partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7576.         end
  7577.       end
  7578.     end
  7579.     if partnermove==0x106 ||   # Grass Pledge
  7580.        partnermove==0x108      # Water Pledge
  7581.       @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7582.       attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7583.       attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7584.       return 0
  7585.     end
  7586.     # Use the move on its own
  7587.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  7588.   end
  7589.  
  7590.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7591.     if @overridetype
  7592.       return super(getConst(PBMoves,:WATERPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7593.     end
  7594.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7595.   end
  7596. end
  7597.  
  7598.  
  7599.  
  7600. ################################################################################
  7601. # Forces ally's Pledge move to be used next, if it hasn't already. (Water Pledge)
  7602. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7603. # causes either a swamp on the opposing side or a rainbow on the user's side.
  7604. ################################################################################
  7605. class PokeBattle_Move_108 < PokeBattle_Move
  7606.   def pbOnStartUse(attacker)
  7607.     @doubledamage=false; @overridetype=false
  7608.     if attacker.effects[PBEffects::FirstPledge]==0x106 ||   # Grass Pledge
  7609.        attacker.effects[PBEffects::FirstPledge]==0x107      # Fire Pledge
  7610.       @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7611.       @doubledamage=true
  7612.       if attacker.effects[PBEffects::FirstPledge]==0x106   # Grass Pledge
  7613.         @overridetype=true
  7614.       end
  7615.     end
  7616.     return true
  7617.   end
  7618.  
  7619.   def pbBaseDamage(basedmg,attacker,opponent)
  7620.     if @doubledamage
  7621.       return basedmg*2
  7622.     end
  7623.     return basedmg
  7624.   end
  7625.  
  7626.   def pbModifyType(type,attacker,opponent)
  7627.     if @overridetype
  7628.       type=getConst(PBTypes,:GRASS) || 0
  7629.     end
  7630.     return super(type,attacker,opponent)
  7631.   end
  7632.  
  7633.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7634.     if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7635.       attacker.effects[PBEffects::FirstPledge]=0
  7636.       return super(attacker,opponent,hitnum,alltargets,showanimation)
  7637.     end
  7638.     # Combined move's effect
  7639.     if attacker.effects[PBEffects::FirstPledge]==0x106   # Grass Pledge
  7640.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7641.       if opponent.damagestate.calcdamage>0
  7642.         attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7643.         if !@battle.pbIsOpposing?(attacker.index)
  7644.           @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7645.           @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7646.         else
  7647.           @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7648.           @battle.pbCommonAnimation("Swamp",nil,nil)
  7649.         end
  7650.       end
  7651.       attacker.effects[PBEffects::FirstPledge]=0
  7652.       return ret
  7653.     elsif attacker.effects[PBEffects::FirstPledge]==0x107   # Fire Pledge
  7654.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7655.       if opponent.damagestate.calcdamage>0
  7656.         attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7657.         if !@battle.pbIsOpposing?(attacker.index)
  7658.           @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7659.           @battle.pbCommonAnimation("Rainbow",nil,nil)
  7660.         else
  7661.           @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7662.           @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7663.         end
  7664.       end
  7665.       attacker.effects[PBEffects::FirstPledge]=0
  7666.       return ret
  7667.     end
  7668.     # Set up partner for a combined move
  7669.     attacker.effects[PBEffects::FirstPledge]=0
  7670.     partnermove=-1
  7671.     if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7672.       if !attacker.pbPartner.hasMovedThisRound?
  7673.         move=@battle.choices[attacker.pbPartner.index][2]
  7674.         if move && move.id>0
  7675.           partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7676.         end
  7677.       end
  7678.     end
  7679.     if partnermove==0x106 ||   # Grass Pledge
  7680.        partnermove==0x107      # Fire Pledge
  7681.       @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7682.       attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7683.       attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7684.       return 0
  7685.     end
  7686.     # Use the move on its own
  7687.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  7688.   end
  7689.  
  7690.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7691.     if @overridetype
  7692.       return super(getConst(PBMoves,:GRASSPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7693.     end
  7694.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7695.   end
  7696. end
  7697.  
  7698.  
  7699.  
  7700. ################################################################################
  7701. # Scatters coins that the player picks up after winning the battle. (Pay Day)
  7702. ################################################################################
  7703. class PokeBattle_Move_109 < PokeBattle_Move
  7704.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7705.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7706.     if opponent.damagestate.calcdamage>0
  7707.       if @battle.pbOwnedByPlayer?(attacker.index)
  7708.         @battle.extramoney+=5*attacker.level
  7709.         @battle.extramoney=MAXMONEY if @battle.extramoney>MAXMONEY
  7710.       end
  7711.       @battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
  7712.     end
  7713.     return ret
  7714.   end
  7715. end
  7716.  
  7717.  
  7718.  
  7719. ################################################################################
  7720. # Ends the opposing side's Light Screen and Reflect. (Brick Break)
  7721. ################################################################################
  7722. class PokeBattle_Move_10A < PokeBattle_Move
  7723.   def pbCalcDamage(attacker,opponent)
  7724.     return super(attacker,opponent,PokeBattle_Move::NOREFLECT)
  7725.   end
  7726.  
  7727.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7728.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7729.     if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0
  7730.       attacker.pbOpposingSide.effects[PBEffects::Reflect]=0
  7731.       if !@battle.pbIsOpposing?(attacker.index)
  7732.         @battle.pbDisplay(_INTL("The opposing team's Reflect wore off!"))
  7733.       else
  7734.         @battle.pbDisplayPaused(_INTL("Your team's Reflect wore off!"))
  7735.       end
  7736.     end
  7737.     if attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7738.       attacker.pbOpposingSide.effects[PBEffects::LightScreen]=0
  7739.       if !@battle.pbIsOpposing?(attacker.index)
  7740.         @battle.pbDisplay(_INTL("The opposing team's Light Screen wore off!"))
  7741.       else
  7742.         @battle.pbDisplay(_INTL("Your team's Light Screen wore off!"))
  7743.       end
  7744.     end
  7745.     return ret
  7746.   end
  7747.  
  7748.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7749.     if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
  7750.        attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7751.       return super(id,attacker,opponent,1,alltargets,showanimation) # Wall-breaking anim
  7752.     end
  7753.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7754.   end
  7755. end
  7756.  
  7757.  
  7758.  
  7759. ################################################################################
  7760. # If attack misses, user takes crash damage of 1/2 of max HP.
  7761. # (Hi Jump Kick, Jump Kick)
  7762. ################################################################################
  7763. class PokeBattle_Move_10B < PokeBattle_Move
  7764.   def isRecoilMove?
  7765.     return true
  7766.   end
  7767.  
  7768.   def unusableInGravity?
  7769.     return true
  7770.   end
  7771. end
  7772.  
  7773.  
  7774.  
  7775. ################################################################################
  7776. # User turns 1/4 of max HP into a substitute. (Substitute)
  7777. ################################################################################
  7778. class PokeBattle_Move_10C < PokeBattle_Move
  7779.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7780.     if attacker.effects[PBEffects::Substitute]>0
  7781.       @battle.pbDisplay(_INTL("{1} already has a substitute!",attacker.pbThis))
  7782.       return -1
  7783.     end
  7784.     sublife=[(attacker.totalhp/4).floor,1].max
  7785.     if attacker.hp<=sublife
  7786.       @battle.pbDisplay(_INTL("It was too weak to make a substitute!"))
  7787.       return -1  
  7788.     end
  7789.     attacker.pbReduceHP(sublife,false,false)
  7790.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7791.     attacker.effects[PBEffects::MultiTurn]=0
  7792.     attacker.effects[PBEffects::MultiTurnAttack]=0
  7793.     attacker.effects[PBEffects::Substitute]=sublife
  7794.     @battle.pbDisplay(_INTL("{1} put in a substitute!",attacker.pbThis))
  7795.     return 0
  7796.   end
  7797. end
  7798.  
  7799.  
  7800.  
  7801. ################################################################################
  7802. # User is not Ghost: Decreases the user's Speed, increases the user's Attack &
  7803. # Defense by 1 stage each.
  7804. # User is Ghost: User loses 1/2 of max HP, and curses the target.
  7805. # Cursed Pokémon lose 1/4 of their max HP at the end of each round.
  7806. # (Curse)
  7807. ################################################################################
  7808. class PokeBattle_Move_10D < PokeBattle_Move
  7809.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7810.     failed=false
  7811.     if attacker.pbHasType?(:GHOST)
  7812.       if opponent.effects[PBEffects::Curse] ||
  7813.          opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  7814.         failed=true
  7815.       else
  7816.         pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7817.         @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true)))
  7818.         opponent.effects[PBEffects::Curse]=true
  7819.         attacker.pbReduceHP((attacker.totalhp/2).floor)
  7820.       end
  7821.     else
  7822.       lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  7823.       raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  7824.       raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  7825.       if !lowerspeed && !raiseatk && !raisedef
  7826.         failed=true
  7827.       else
  7828.         pbShowAnimation(@id,attacker,nil,1,alltargets,showanimation) # Non-Ghost move animation
  7829.         if lowerspeed
  7830.           attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  7831.         end
  7832.         showanim=true
  7833.         if raiseatk
  7834.           attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  7835.           showanim=false
  7836.         end
  7837.         if raisedef
  7838.           attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  7839.           showanim=false
  7840.         end
  7841.       end
  7842.     end
  7843.     if failed
  7844.       @battle.pbDisplay(_INTL("But it failed!"))
  7845.     end
  7846.     return failed ? -1 : 0
  7847.   end
  7848. end
  7849.  
  7850.  
  7851.  
  7852. ################################################################################
  7853. # Target's last move used loses 4 PP. (Spite)
  7854. ################################################################################
  7855. class PokeBattle_Move_10E < PokeBattle_Move
  7856.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7857.     for i in opponent.moves
  7858.       if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
  7859.         pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7860.         reduction=[4,i.pp].min
  7861.         opponent.pbSetPP(i,i.pp-reduction)
  7862.         @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
  7863.         return 0
  7864.       end
  7865.     end
  7866.     @battle.pbDisplay(_INTL("But it failed!"))
  7867.     return -1
  7868.   end
  7869. end
  7870.  
  7871.  
  7872.  
  7873. ################################################################################
  7874. # Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare)
  7875. ################################################################################
  7876. class PokeBattle_Move_10F < PokeBattle_Move
  7877.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7878.     if opponent.status!=PBStatuses::SLEEP || opponent.effects[PBEffects::Nightmare] ||
  7879.        (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  7880.       @battle.pbDisplay(_INTL("But it failed!"))
  7881.       return -1
  7882.     end
  7883.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7884.     opponent.effects[PBEffects::Nightmare]=true
  7885.     @battle.pbDisplay(_INTL("{1} began having a nightmare!",opponent.pbThis))
  7886.     return 0
  7887.   end
  7888. end
  7889.  
  7890.  
  7891.  
  7892. ################################################################################
  7893. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  7894. # (Rapid Spin)
  7895. ################################################################################
  7896. class PokeBattle_Move_110 < PokeBattle_Move
  7897.   def pbEffectAfterHit(attacker,opponent,turneffects)
  7898.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7899.       if attacker.effects[PBEffects::MultiTurn]>0
  7900.         mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
  7901.         mtuser=@battle.battlers[attacker.effects[PBEffects::MultiTurnUser]]
  7902.         @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
  7903.         attacker.effects[PBEffects::MultiTurn]=0
  7904.         attacker.effects[PBEffects::MultiTurnAttack]=0
  7905.         attacker.effects[PBEffects::MultiTurnUser]=-1
  7906.       end
  7907.       if attacker.effects[PBEffects::LeechSeed]>=0
  7908.         attacker.effects[PBEffects::LeechSeed]=-1
  7909.         @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))  
  7910.       end
  7911.       if attacker.pbOwnSide.effects[PBEffects::StealthRock]
  7912.         attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
  7913.         @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))    
  7914.       end
  7915.       if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
  7916.         attacker.pbOwnSide.effects[PBEffects::Spikes]=0
  7917.         @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))    
  7918.       end
  7919.       if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  7920.         attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
  7921.         @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))    
  7922.       end
  7923.       if attacker.pbOwnSide.effects[PBEffects::StickyWeb]
  7924.         attacker.pbOwnSide.effects[PBEffects::StickyWeb]=false
  7925.         @battle.pbDisplay(_INTL("{1} blew away sticky webs!",attacker.pbThis))    
  7926.       end
  7927.     end
  7928.   end
  7929. end
  7930.  
  7931.  
  7932.  
  7933. ################################################################################
  7934. # Attacks 2 rounds in the future. (Doom Desire, Future Sight)
  7935. ################################################################################
  7936. class PokeBattle_Move_111 < PokeBattle_Move
  7937.   def pbDisplayUseMessage(attacker)
  7938.     return 0 if @battle.futuresight
  7939.     return super(attacker)
  7940.   end
  7941.  
  7942.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7943.     if opponent.effects[PBEffects::FutureSight]>0
  7944.       @battle.pbDisplay(_INTL("But it failed!"))
  7945.       return -1
  7946.     end
  7947.     if @battle.futuresight
  7948.       # Attack hits
  7949.       return super(attacker,opponent,hitnum,alltargets,showanimation)
  7950.     end
  7951.     # Attack is launched
  7952.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7953.     opponent.effects[PBEffects::FutureSight]=3
  7954.     opponent.effects[PBEffects::FutureSightMove]=@id
  7955.     opponent.effects[PBEffects::FutureSightUser]=attacker.pokemonIndex
  7956.     opponent.effects[PBEffects::FutureSightUserPos]=attacker.index
  7957.     if isConst?(@id,PBMoves,:FUTURESIGHT)
  7958.       @battle.pbDisplay(_INTL("{1} foresaw an attack!",attacker.pbThis))
  7959.     else
  7960.       @battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",attacker.pbThis))
  7961.     end
  7962.     return 0
  7963.   end
  7964.  
  7965.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7966.     if @battle.futuresight
  7967.       return super(id,attacker,opponent,1,alltargets,showanimation) # Hit opponent anim
  7968.     end
  7969.     return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7970.   end
  7971. end
  7972.  
  7973.  
  7974.  
  7975. ################################################################################
  7976. # Increases the user's Defense and Special Defense by 1 stage each. Ups the
  7977. # user's stockpile by 1 (max. 3). (Stockpile)
  7978. ################################################################################
  7979. class PokeBattle_Move_112 < PokeBattle_Move
  7980.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7981.     if attacker.effects[PBEffects::Stockpile]>=3
  7982.       @battle.pbDisplay(_INTL("{1} can't stockpile any more!",attacker.pbThis))
  7983.       return -1
  7984.     end
  7985.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7986.     attacker.effects[PBEffects::Stockpile]+=1
  7987.     @battle.pbDisplay(_INTL("{1} stockpiled {2}!",attacker.pbThis,
  7988.         attacker.effects[PBEffects::Stockpile]))
  7989.     showanim=true
  7990.     if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  7991.       attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  7992.       attacker.effects[PBEffects::StockpileDef]+=1
  7993.       showanim=false
  7994.     end
  7995.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  7996.       attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  7997.       attacker.effects[PBEffects::StockpileSpDef]+=1
  7998.       showanim=false
  7999.     end
  8000.     return 0
  8001.   end
  8002. end
  8003.  
  8004.  
  8005.  
  8006. ################################################################################
  8007. # Power is 100 multiplied by the user's stockpile (X). Resets the stockpile to
  8008. # 0. Decreases the user's Defense and Special Defense by X stages each. (Spit Up)
  8009. ################################################################################
  8010. class PokeBattle_Move_113 < PokeBattle_Move
  8011.   def pbMoveFailed(attacker,opponent)
  8012.     return (attacker.effects[PBEffects::Stockpile]==0)
  8013.   end
  8014.  
  8015.   def pbBaseDamage(basedmg,attacker,opponent)
  8016.     return 100*attacker.effects[PBEffects::Stockpile]
  8017.   end
  8018.  
  8019.   def pbEffectAfterHit(attacker,opponent,turneffects)
  8020.     if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  8021.       showanim=true
  8022.       if attacker.effects[PBEffects::StockpileDef]>0
  8023.         if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8024.           attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8025.              attacker,false,self,showanim)
  8026.           showanim=false
  8027.         end
  8028.       end
  8029.       if attacker.effects[PBEffects::StockpileSpDef]>0
  8030.         if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8031.           attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8032.              attacker,false,self,showanim)
  8033.           showanim=false
  8034.         end
  8035.       end
  8036.       attacker.effects[PBEffects::Stockpile]=0
  8037.       attacker.effects[PBEffects::StockpileDef]=0
  8038.       attacker.effects[PBEffects::StockpileSpDef]=0
  8039.       @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8040.     end
  8041.   end
  8042. end
  8043.  
  8044.  
  8045.  
  8046. ################################################################################
  8047. # Heals user depending on the user's stockpile (X). Resets the stockpile to 0.
  8048. # Decreases the user's Defense and Special Defense by X stages each. (Swallow)
  8049. ################################################################################
  8050. class PokeBattle_Move_114 < PokeBattle_Move
  8051.   def isHealingMove?
  8052.     return true
  8053.   end
  8054.  
  8055.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8056.     hpgain=0
  8057.     case attacker.effects[PBEffects::Stockpile]
  8058.     when 0
  8059.       @battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
  8060.       return -1
  8061.     when 1
  8062.       hpgain=(attacker.totalhp/4).floor
  8063.     when 2
  8064.       hpgain=(attacker.totalhp/2).floor
  8065.     when 3
  8066.       hpgain=attacker.totalhp
  8067.     end
  8068.     if attacker.hp==attacker.totalhp &&
  8069.        attacker.effects[PBEffects::StockpileDef]==0 &&
  8070.        attacker.effects[PBEffects::StockpileSpDef]==0
  8071.       @battle.pbDisplay(_INTL("But it failed!"))
  8072.       return -1
  8073.     end
  8074.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8075.     if attacker.pbRecoverHP(hpgain,true)>0
  8076.       @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  8077.     end
  8078.     showanim=true
  8079.     if attacker.effects[PBEffects::StockpileDef]>0
  8080.       if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8081.         attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8082.            attacker,false,self,showanim)
  8083.         showanim=false
  8084.       end
  8085.     end
  8086.     if attacker.effects[PBEffects::StockpileSpDef]>0
  8087.       if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8088.         attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8089.            attacker,false,self,showanim)
  8090.         showanim=false
  8091.       end
  8092.     end
  8093.     attacker.effects[PBEffects::Stockpile]=0
  8094.     attacker.effects[PBEffects::StockpileDef]=0
  8095.     attacker.effects[PBEffects::StockpileSpDef]=0
  8096.     @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8097.     return 0
  8098.   end
  8099. end
  8100.  
  8101.  
  8102.  
  8103. ################################################################################
  8104. # Fails if user was hit by a damaging move this round. (Focus Punch)
  8105. ################################################################################
  8106. class PokeBattle_Move_115 < PokeBattle_Move
  8107.   def pbDisplayUseMessage(attacker)
  8108.     if attacker.lastHPLost>0
  8109.       @battle.pbDisplayBrief(_INTL("{1} lost its focus and couldn't move!",attacker.pbThis))
  8110.       return -1
  8111.     end
  8112.     return super(attacker)
  8113.   end
  8114. end
  8115.  
  8116.  
  8117.  
  8118. ################################################################################
  8119. # Fails if the target didn't chose a damaging move to use this round, or has
  8120. # already moved. (Sucker Punch)
  8121. ################################################################################
  8122. class PokeBattle_Move_116 < PokeBattle_Move
  8123.   def pbMoveFailed(attacker,opponent)
  8124.     return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8125.     oppmove=@battle.choices[opponent.index][2]
  8126.     return true if !oppmove || oppmove.id<=0 || oppmove.pbIsStatus?
  8127.     return true if opponent.hasMovedThisRound? && oppmove.function!=0xB0 # Me First
  8128.     return false
  8129.   end
  8130. end
  8131.  
  8132.  
  8133.  
  8134. ################################################################################
  8135. # This round, user becomes the target of attacks that have single targets.
  8136. # (Follow Me, Rage Powder)
  8137. ################################################################################
  8138. class PokeBattle_Move_117 < PokeBattle_Move
  8139.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8140.     if !@battle.doublebattle
  8141.       @battle.pbDisplay(_INTL("But it failed!"))
  8142.       return -1
  8143.     end
  8144.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8145.     attacker.effects[PBEffects::FollowMe]=1
  8146.     if !attacker.pbPartner.fainted? && attacker.pbPartner.effects[PBEffects::FollowMe]>0
  8147.       attacker.effects[PBEffects::FollowMe]=attacker.pbPartner.effects[PBEffects::FollowMe]+1
  8148.     end
  8149.     @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
  8150.     return 0
  8151.   end
  8152. end
  8153.  
  8154.  
  8155.  
  8156. ################################################################################
  8157. # For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
  8158. # (Gravity)
  8159. ################################################################################
  8160. class PokeBattle_Move_118 < PokeBattle_Move
  8161.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8162.     if @battle.field.effects[PBEffects::Gravity]>0
  8163.       @battle.pbDisplay(_INTL("But it failed!"))
  8164.       return -1
  8165.     end
  8166.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8167.     @battle.field.effects[PBEffects::Gravity]=5
  8168.     for i in 0...4
  8169.       poke=@battle.battlers[i]
  8170.       next if !poke
  8171.       if PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8172.          PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8173.          PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCE    # Sky Drop
  8174.         poke.effects[PBEffects::TwoTurnAttack]=0
  8175.       end
  8176.       if poke.effects[PBEffects::SkyDrop]
  8177.         poke.effects[PBEffects::SkyDrop]=false
  8178.       end
  8179.       if poke.effects[PBEffects::MagnetRise]>0
  8180.         poke.effects[PBEffects::MagnetRise]=0
  8181.       end
  8182.       if poke.effects[PBEffects::Telekinesis]>0
  8183.         poke.effects[PBEffects::Telekinesis]=0
  8184.       end
  8185.     end
  8186.     @battle.pbDisplay(_INTL("Gravity intensified!"))
  8187.     return 0
  8188.   end
  8189. end
  8190.  
  8191.  
  8192.  
  8193. ################################################################################
  8194. # For 5 rounds, user becomes airborne. (Magnet Rise)
  8195. ################################################################################
  8196. class PokeBattle_Move_119 < PokeBattle_Move
  8197.   def unusableInGravity?
  8198.     return true
  8199.   end
  8200.  
  8201.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8202.     if attacker.effects[PBEffects::Ingrain] ||
  8203.        attacker.effects[PBEffects::SmackDown] ||
  8204.        attacker.effects[PBEffects::MagnetRise]>0
  8205.       @battle.pbDisplay(_INTL("But it failed!"))
  8206.       return -1
  8207.     end
  8208.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8209.     attacker.effects[PBEffects::MagnetRise]=5
  8210.     @battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",attacker.pbThis))
  8211.     return 0
  8212.   end
  8213. end
  8214.  
  8215.  
  8216.  
  8217. ################################################################################
  8218. # For 3 rounds, target becomes airborne and can always be hit. (Telekinesis)
  8219. ################################################################################
  8220. class PokeBattle_Move_11A < PokeBattle_Move
  8221.   def unusableInGravity?
  8222.     return true
  8223.   end
  8224.  
  8225.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8226.     if opponent.effects[PBEffects::Ingrain] ||
  8227.        opponent.effects[PBEffects::SmackDown] ||
  8228.        opponent.effects[PBEffects::Telekinesis]>0
  8229.       @battle.pbDisplay(_INTL("But it failed!"))
  8230.       return -1
  8231.     end
  8232.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8233.     opponent.effects[PBEffects::Telekinesis]=3
  8234.     @battle.pbDisplay(_INTL("{1} was hurled into the air!",opponent.pbThis))
  8235.     return 0
  8236.   end
  8237. end
  8238.  
  8239.  
  8240.  
  8241.  
  8242. ################################################################################
  8243. # Hits airborne semi-invulnerable targets. (Sky Uppercut)
  8244. ################################################################################
  8245. class PokeBattle_Move_11B < PokeBattle_Move
  8246. # Handled in Battler's pbSuccessCheck, do not edit!
  8247. end
  8248.  
  8249.  
  8250.  
  8251. ################################################################################
  8252. # Grounds the target while it remains active. (Smack Down, Thousand Arrows)
  8253. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  8254. ################################################################################
  8255. class PokeBattle_Move_11C < PokeBattle_Move
  8256.   def pbBaseDamage(basedmg,attacker,opponent)
  8257.     if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8258.        PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8259.        PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  8260.        opponent.effects[PBEffects::SkyDrop]
  8261.       return basedmg*2
  8262.     end
  8263.     return basedmg
  8264.   end
  8265.  
  8266.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8267.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  8268.     if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  8269.        !opponent.effects[PBEffects::Roost]
  8270.       opponent.effects[PBEffects::SmackDown]=true
  8271.       showmsg=(opponent.pbHasType?(:FLYING) ||
  8272.                opponent.hasWorkingAbility(:LEVITATE))
  8273.       if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8274.          PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC    # Bounce
  8275.         opponent.effects[PBEffects::TwoTurnAttack]=0; showmsg=true
  8276.       end
  8277.       if opponent.effects[PBEffects::MagnetRise]>0
  8278.         opponent.effects[PBEffects::MagnetRise]=0; showmsg=true
  8279.       end
  8280.       if opponent.effects[PBEffects::Telekinesis]>0
  8281.         opponent.effects[PBEffects::Telekinesis]=0; showmsg=true
  8282.       end
  8283.       @battle.pbDisplay(_INTL("{1} fell straight down!",opponent.pbThis)) if showmsg
  8284.     end
  8285.     return ret
  8286.   end
  8287. end
  8288.  
  8289.  
  8290.  
  8291. ################################################################################
  8292. # Target moves immediately after the user, ignoring priority/speed. (After You)
  8293. ################################################################################
  8294. class PokeBattle_Move_11D < PokeBattle_Move
  8295.   def pbMoveFailed(attacker,opponent)
  8296.     return true if opponent.effects[PBEffects::MoveNext]
  8297.     return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8298.     oppmove=@battle.choices[opponent.index][2]
  8299.     return true if !oppmove || oppmove.id<=0
  8300.     return true if opponent.hasMovedThisRound?
  8301.     return false
  8302.   end
  8303.  
  8304.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8305.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8306.     opponent.effects[PBEffects::MoveNext]=true
  8307.     opponent.effects[PBEffects::Quash]=false
  8308.     @battle.pbDisplay(_INTL("{1} took the kind offer!",opponent.pbThis))
  8309.     return 0
  8310.   end
  8311. end
  8312.  
  8313.  
  8314.  
  8315. ################################################################################
  8316. # Target moves last this round, ignoring priority/speed. (Quash)
  8317. ################################################################################
  8318. class PokeBattle_Move_11E < PokeBattle_Move
  8319.   def pbMoveFailed(attacker,opponent)
  8320.     return true if opponent.effects[PBEffects::Quash]
  8321.     return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8322.     oppmove=@battle.choices[opponent.index][2]
  8323.     return true if !oppmove || oppmove.id<=0
  8324.     return true if opponent.hasMovedThisRound?
  8325.     return false
  8326.   end
  8327.  
  8328.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8329.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8330.     opponent.effects[PBEffects::Quash]=true
  8331.     opponent.effects[PBEffects::MoveNext]=false
  8332.     @battle.pbDisplay(_INTL("{1}'s move was postponed!",opponent.pbThis))
  8333.     return 0
  8334.   end
  8335. end
  8336.  
  8337.  
  8338.  
  8339. ################################################################################
  8340. # For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
  8341. # (Trick Room)
  8342. ################################################################################
  8343. class PokeBattle_Move_11F < PokeBattle_Move
  8344.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8345.     if @battle.field.effects[PBEffects::TrickRoom]>0
  8346.       @battle.field.effects[PBEffects::TrickRoom]=0
  8347.       @battle.pbDisplay(_INTL("{1} reverted the dimensions!",attacker.pbThis))
  8348.     else
  8349.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8350.       @battle.field.effects[PBEffects::TrickRoom]=5
  8351.       @battle.pbDisplay(_INTL("{1} twisted the dimensions!",attacker.pbThis))
  8352.     end
  8353.     return 0
  8354.   end
  8355. end
  8356.  
  8357.  
  8358.  
  8359. ################################################################################
  8360. # User switches places with its ally. (Ally Switch)
  8361. ################################################################################
  8362. class PokeBattle_Move_120 < PokeBattle_Move
  8363.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8364.     if !@battle.doublebattle ||
  8365.        !attacker.pbPartner || attacker.pbPartner.fainted?
  8366.       @battle.pbDisplay(_INTL("But it failed!"))
  8367.       return -1
  8368.     end
  8369.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8370.     a=@battle.battlers[attacker.index]
  8371.     b=@battle.battlers[attacker.pbPartner.index]
  8372.     temp=a; a=b; b=temp
  8373.     # Swap effects that point at the position rather than the Pokémon
  8374.     # NOT PerishSongUser (no need to swap), Attract, MultiTurnUser
  8375.     effectstoswap=[PBEffects::BideTarget,
  8376.                    PBEffects::CounterTarget,
  8377.                    PBEffects::LeechSeed,
  8378.                    PBEffects::LockOnPos,
  8379.                    PBEffects::MeanLook,
  8380.                    PBEffects::MirrorCoatTarget]
  8381.     for i in effectstoswap
  8382.       a.effects[i],b.effects[i]=b.effects[i],a.effects[i]
  8383.     end
  8384.     attacker.pbUpdate(true)
  8385.     opponent.pbUpdate(true)
  8386.     @battle.pbDisplay(_INTL("{1} and {2} switched places!",opponent.pbThis,attacker.pbThis(true)))
  8387.   end
  8388. end
  8389.  
  8390.  
  8391.  
  8392. ################################################################################
  8393. # Target's Attack is used instead of user's Attack for this move's calculations.
  8394. # (Foul Play)
  8395. ################################################################################
  8396. class PokeBattle_Move_121 < PokeBattle_Move
  8397. # Handled in superclass def pbCalcDamage, do not edit!
  8398. end
  8399.  
  8400.  
  8401.  
  8402. ################################################################################
  8403. # Target's Defense is used instead of its Special Defense for this move's
  8404. # calculations. (Psyshock, Psystrike, Secret Sword)
  8405. ################################################################################
  8406. class PokeBattle_Move_122 < PokeBattle_Move
  8407. # Handled in superclass def pbCalcDamage, do not edit!
  8408. end
  8409.  
  8410.  
  8411.  
  8412. ################################################################################
  8413. # Only damages Pokémon that share a type with the user. (Synchronoise)
  8414. ################################################################################
  8415. class PokeBattle_Move_123 < PokeBattle_Move
  8416.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8417.     if !opponent.pbHasType?(attacker.type1) &&
  8418.        !opponent.pbHasType?(attacker.type2) &&
  8419.        !opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  8420.       @battle.pbDisplay(_INTL("{1} was unaffected!",opponent.pbThis))
  8421.       return -1
  8422.     end
  8423.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  8424.   end
  8425. end
  8426.  
  8427.  
  8428.  
  8429. ################################################################################
  8430. # For 5 rounds, swaps all battlers' base Defense with base Special Defense.
  8431. # (Wonder Room)
  8432. ################################################################################
  8433. class PokeBattle_Move_124 < PokeBattle_Move
  8434.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8435.     if @battle.field.effects[PBEffects::WonderRoom]>0
  8436.       @battle.field.effects[PBEffects::WonderRoom]=0
  8437.       @battle.pbDisplay(_INTL("Wonder Room wore off, and the Defense and Sp. Def stats returned to normal!"))
  8438.     else
  8439.       pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8440.       @battle.field.effects[PBEffects::WonderRoom]=5
  8441.       @battle.pbDisplay(_INTL("It created a bizarre area in which the Defense and Sp. Def stats are swapped!"))
  8442.     end
  8443.     return 0
  8444.   end
  8445. end
  8446.  
  8447.  
  8448.  
  8449. ################################################################################
  8450. # Fails unless user has already used all other moves it knows. (Last Resort)
  8451. ################################################################################
  8452. class PokeBattle_Move_125 < PokeBattle_Move
  8453.   def pbMoveFailed(attacker,opponent)
  8454.     counter=0; nummoves=0
  8455.     for move in attacker.moves
  8456.       next if move.id<=0
  8457.       counter+=1 if move.id!=@id && !attacker.movesUsed.include?(move.id)
  8458.       nummoves+=1
  8459.     end
  8460.     return counter!=0 || nummoves==1
  8461.   end
  8462. end
  8463.  
  8464.  
  8465.  
  8466. #===============================================================================
  8467. # NOTE: Shadow moves use function codes 126-132 inclusive.
  8468. #===============================================================================
  8469.  
  8470.  
  8471.  
  8472. ################################################################################
  8473. # Does absolutely nothing. (Hold Hands)
  8474. ################################################################################
  8475. class PokeBattle_Move_133 < PokeBattle_Move
  8476.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8477.     if !@battle.doublebattle ||
  8478.        !attacker.pbPartner || attacker.pbPartner.fainted?
  8479.       @battle.pbDisplay(_INTL("But it failed!"))
  8480.       return -1
  8481.     end
  8482.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8483.     return 0
  8484.   end
  8485. end
  8486.  
  8487.  
  8488.  
  8489. ################################################################################
  8490. # Does absolutely nothing. Shows a special message. (Celebrate)
  8491. ################################################################################
  8492. class PokeBattle_Move_134 < PokeBattle_Move
  8493.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8494.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8495.     @battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwner(attacker.index).name))
  8496.     return 0
  8497.   end
  8498. end
  8499.  
  8500.  
  8501.  
  8502. ################################################################################
  8503. # Freezes the target. (Freeze-Dry)
  8504. # (Superclass's pbTypeModifier): Effectiveness against Water-type is 2x.
  8505. ################################################################################
  8506. class PokeBattle_Move_135 < PokeBattle_Move
  8507.   def pbAdditionalEffect(attacker,opponent)
  8508.     return if opponent.damagestate.substitute
  8509.     if opponent.pbCanFreeze?(attacker,false,self)
  8510.       opponent.pbFreeze
  8511.     end
  8512.   end
  8513. end
  8514.  
  8515.  
  8516.  
  8517. ################################################################################
  8518. # Increases the user's Defense by 1 stage for each target hit. (Diamond Storm)
  8519. ################################################################################
  8520. class PokeBattle_Move_136 < PokeBattle_Move_01D
  8521. # No difference to function code 01D. It may need to be separate in future.
  8522. end
  8523.  
  8524.  
  8525.  
  8526. ################################################################################
  8527. # Increases the user's and its ally's Defense and Special Defense by 1 stage
  8528. # each, if they have Plus or Minus. (Magnetic Flux)
  8529. ################################################################################
  8530. class PokeBattle_Move_137 < PokeBattle_Move
  8531.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8532.     didsomething=false
  8533.     for i in [attacker,attacker.pbPartner]
  8534.       next if !i || i.fainted?
  8535.       next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)
  8536.       next if !i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  8537.               !i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8538.       pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8539.       didsomething=true
  8540.       showanim=true
  8541.       if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8542.         i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8543.         showanim=false
  8544.       end
  8545.       if i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8546.         i.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  8547.         showanim=false
  8548.       end
  8549.     end
  8550.     if !didsomething
  8551.       @battle.pbDisplay(_INTL("But it failed!"))
  8552.       return -1
  8553.     end
  8554.     return 0
  8555.   end
  8556. end
  8557.  
  8558.  
  8559.  
  8560. ################################################################################
  8561. # Increases ally's Special Defense by 1 stage. (Aromatic Mist)
  8562. ################################################################################
  8563. class PokeBattle_Move_138 < PokeBattle_Move
  8564.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8565.     if !@battle.doublebattle || !opponent ||
  8566.        !opponent.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8567.       @battle.pbDisplay(_INTL("But it failed!"))
  8568.       return -1
  8569.     end
  8570.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8571.     ret=attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  8572.     return ret ? 0 : -1
  8573.   end
  8574. end
  8575.  
  8576.  
  8577.  
  8578. ################################################################################
  8579. # Decreases the target's Attack by 1 stage. Always hits. (Play Nice)
  8580. ################################################################################
  8581. class PokeBattle_Move_139 < PokeBattle_Move
  8582.   def pbAccuracyCheck(attacker,opponent)
  8583.     return true
  8584.   end
  8585.  
  8586.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8587.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  8588.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8589.     ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  8590.     return ret ? 0 : -1
  8591.   end
  8592. end
  8593.  
  8594.  
  8595.  
  8596. ################################################################################
  8597. # Decreases the target's Attack and Special Attack by 1 stage each. (Noble Roar)
  8598. ################################################################################
  8599. class PokeBattle_Move_13A < PokeBattle_Move
  8600.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8601.     # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  8602.     # multiple times
  8603.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8604.       @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  8605.       return -1
  8606.     end
  8607.     if opponent.pbTooLow?(PBStats::ATTACK) &&
  8608.        opponent.pbTooLow?(PBStats::SPATK)
  8609.       @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  8610.       return -1
  8611.     end
  8612.     if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  8613.       @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  8614.       return -1
  8615.     end
  8616.     if !attacker.hasMoldBreaker
  8617.       if opponent.hasWorkingAbility(:CLEARBODY) ||
  8618.          opponent.hasWorkingAbility(:WHITESMOKE)
  8619.         @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  8620.            PBAbilities.getName(opponent.ability)))
  8621.         return -1
  8622.       end
  8623.     end
  8624.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8625.     ret=-1; showanim=true
  8626.     if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER)
  8627.       abilityname=PBAbilities.getName(opponent.ability)
  8628.       @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  8629.     elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8630.       ret=0; showanim=false
  8631.     end
  8632.     if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8633.       ret=0; showanim=false
  8634.     end
  8635.     return ret
  8636.   end
  8637. end
  8638.  
  8639.  
  8640.  
  8641. ################################################################################
  8642. # Decreases the target's Defense by 1 stage. Always hits. (Hyperspace Fury)
  8643. ################################################################################
  8644. class PokeBattle_Move_13B < PokeBattle_Move
  8645.   def pbMoveFailed(attacker,opponent)
  8646.     return true if !isConst?(attacker.species,PBSpecies,:HOOPA)
  8647.     return true if attacker.form!=1
  8648.     return false
  8649.   end
  8650.  
  8651.   def pbAccuracyCheck(attacker,opponent)
  8652.     return true
  8653.   end
  8654.  
  8655.   def pbAdditionalEffect(attacker,opponent)
  8656.     return if opponent.damagestate.substitute
  8657.     if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8658.       opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  8659.     end
  8660.   end
  8661. end
  8662.  
  8663.  
  8664.  
  8665. ################################################################################
  8666. # Decreases the target's Special Attack by 1 stage. Always hits. (Confide)
  8667. ################################################################################
  8668. class PokeBattle_Move_13C < PokeBattle_Move
  8669.   def pbAccuracyCheck(attacker,opponent)
  8670.     return true
  8671.   end
  8672.  
  8673.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8674.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8675.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8676.     ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  8677.     return ret ? 0 : -1
  8678.   end
  8679. end
  8680.  
  8681.  
  8682.  
  8683. ################################################################################
  8684. # Decreases the target's Special Attack by 2 stages. (Eerie Impulse)
  8685. ################################################################################
  8686. class PokeBattle_Move_13D < PokeBattle_Move
  8687.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8688.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  8689.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8690.     return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8691.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8692.     ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8693.     return ret ? 0 : -1
  8694.   end
  8695.  
  8696.   def pbAdditionalEffect(attacker,opponent)
  8697.     return if opponent.damagestate.substitute
  8698.     if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8699.       opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8700.     end
  8701.   end
  8702. end
  8703.  
  8704.  
  8705.  
  8706. ################################################################################
  8707. # Increases the Attack and Special Attack of all Grass-type Pokémon on the field
  8708. # by 1 stage each. Doesn't affect airborne Pokémon. (Rototiller)
  8709. ################################################################################
  8710. class PokeBattle_Move_13E < PokeBattle_Move
  8711.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8712.     didsomething=false
  8713.     for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8714.       next if !i || i.fainted?
  8715.       next if !i.pbHasType?(:GRASS)
  8716.       next if i.isAirborne?(attacker.hasMoldBreaker)
  8717.       next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8718.               !i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8719.       pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8720.       didsomething=true
  8721.       showanim=true
  8722.       if i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8723.         i.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8724.         showanim=false
  8725.       end
  8726.       if i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8727.         i.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8728.         showanim=false
  8729.       end
  8730.     end
  8731.     if !didsomething
  8732.       @battle.pbDisplay(_INTL("But it failed!"))
  8733.       return -1
  8734.     end
  8735.     return 0
  8736.   end
  8737. end
  8738.  
  8739.  
  8740.  
  8741. ################################################################################
  8742. # Increases the Defense of all Grass-type Pokémon on the field by 1 stage each.
  8743. # (Flower Shield)
  8744. ################################################################################
  8745. class PokeBattle_Move_13F < PokeBattle_Move
  8746.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8747.     didsomething=false
  8748.     for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8749.       next if !i || i.fainted?
  8750.       next if !i.pbHasType?(:GRASS)
  8751.       next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8752.       pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8753.       didsomething=true
  8754.       showanim=true
  8755.       if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8756.         i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8757.         showanim=false
  8758.       end
  8759.     end
  8760.     if !didsomething
  8761.       @battle.pbDisplay(_INTL("But it failed!"))
  8762.       return -1
  8763.     end
  8764.     return 0
  8765.   end
  8766. end
  8767.  
  8768.  
  8769.  
  8770. ################################################################################
  8771. # Decreases the Attack, Special Attack and Speed of all poisoned opponents by 1
  8772. # stage each. (Venom Drench)
  8773. ################################################################################
  8774. class PokeBattle_Move_140 < PokeBattle_Move
  8775.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8776.     didsomething=false
  8777.     for i in [attacker.pbOpposing1,attacker.pbOpposing2]
  8778.       next if !i || i.fainted?
  8779.       next if !i.status==PBStatuses::POISON
  8780.       next if !i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8781.               !i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self) &&
  8782.               !i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8783.       pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8784.       didsomething=true
  8785.       showanim=true
  8786.       if i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  8787.         i.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8788.         showanim=false
  8789.       end
  8790.       if i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8791.         i.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8792.         showanim=false
  8793.       end
  8794.       if i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8795.         i.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  8796.         showanim=false
  8797.       end
  8798.     end
  8799.     if !didsomething
  8800.       @battle.pbDisplay(_INTL("But it failed!"))
  8801.       return -1
  8802.     end
  8803.     return 0
  8804.   end
  8805. end
  8806.  
  8807.  
  8808.  
  8809. ################################################################################
  8810. # Reverses all stat changes of the target. (Topsy-Turvy)
  8811. ################################################################################
  8812. class PokeBattle_Move_141 < PokeBattle_Move
  8813.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8814.     nonzero=false
  8815.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8816.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8817.       if opponent.stages[i]!=0
  8818.         nonzero=true; break
  8819.       end
  8820.     end
  8821.     if !nonzero
  8822.       @battle.pbDisplay(_INTL("But it failed!"))
  8823.       return -1
  8824.     end
  8825.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8826.     for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8827.               PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8828.       opponent.stages[i]*=-1
  8829.     end
  8830.     @battle.pbDisplay(_INTL("{1}'s stats were reversed!",opponent.pbThis))
  8831.     return 0
  8832.   end
  8833. end
  8834.  
  8835.  
  8836.  
  8837. ################################################################################
  8838. # Gives target the Ghost type. (Trick-or-Treat)
  8839. ################################################################################
  8840. class PokeBattle_Move_142 < PokeBattle_Move
  8841.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8842.     if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  8843.        !hasConst?(PBTypes,:GHOST) || opponent.pbHasType?(:GHOST) ||
  8844.        isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  8845.       @battle.pbDisplay(_INTL("But it failed!"))  
  8846.       return -1
  8847.     end
  8848.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8849.     opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GHOST)
  8850.     typename=PBTypes.getName(getConst(PBTypes,:GHOST))
  8851.     @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8852.     return 0
  8853.   end
  8854. end
  8855.  
  8856.  
  8857.  
  8858. ################################################################################
  8859. # Gives target the Grass type. (Forest's Curse)
  8860. ################################################################################
  8861. class PokeBattle_Move_143 < PokeBattle_Move
  8862.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8863.     if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8864.       @battle.pbDisplay(_INTL("But it failed!"))  
  8865.       return -1
  8866.     end
  8867.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8868.     if opponent.effects[PBEffects::LeechSeed]>=0
  8869.       @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  8870.       return -1
  8871.     end
  8872.     if !hasConst?(PBTypes,:GRASS) || opponent.pbHasType?(:GRASS) ||
  8873.        isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  8874.       @battle.pbDisplay(_INTL("But it failed!"))  
  8875.       return -1
  8876.     end
  8877.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8878.     opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GRASS)
  8879.     typename=PBTypes.getName(getConst(PBTypes,:GRASS))
  8880.     @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8881.     return 0
  8882.   end
  8883. end
  8884.  
  8885.  
  8886.  
  8887. ################################################################################
  8888. # Damage is multiplied by Flying's effectiveness against the target. Does double
  8889. # damage and has perfect accuracy if the target is Minimized. (Flying Press)
  8890. ################################################################################
  8891. class PokeBattle_Move_144 < PokeBattle_Move
  8892.   def pbModifyDamage(damagemult,attacker,opponent)
  8893.     type=getConst(PBTypes,:FLYING) || -1
  8894.     if type>=0
  8895.       mult=PBTypes.getCombinedEffectiveness(type,
  8896.          opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
  8897.       return ((damagemult*mult)/8).round
  8898.     end
  8899.     return damagemult
  8900.   end
  8901.  
  8902.   def tramplesMinimize?(param=1)
  8903.     return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  8904.     return true if param==2 # Double damage
  8905.     return false
  8906.   end
  8907. end
  8908.  
  8909.  
  8910.  
  8911. ################################################################################
  8912. # Target's moves become Electric-type for the rest of the round. (Electrify)
  8913. ################################################################################
  8914. class PokeBattle_Move_145 < PokeBattle_Move
  8915.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8916.     return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8917.     if opponent.effects[PBEffects::Electrify]
  8918.       @battle.pbDisplay(_INTL("But it failed!"))
  8919.       return -1
  8920.     end
  8921.     if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  8922.        !@battle.choices[opponent.index][2] ||
  8923.        @battle.choices[opponent.index][2].id<=0 ||
  8924.        opponent.hasMovedThisRound?
  8925.       @battle.pbDisplay(_INTL("But it failed!"))
  8926.       return -1
  8927.     end
  8928.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8929.     opponent.effects[PBEffects::Electrify]=true
  8930.     @battle.pbDisplay(_INTL("{1} was electrified!",opponent.pbThis))
  8931.     return 0
  8932.   end
  8933. end
  8934.  
  8935.  
  8936.  
  8937. ################################################################################
  8938. # All Normal-type moves become Electric-type for the rest of the round.
  8939. # (Ion Deluge)
  8940. ################################################################################
  8941. class PokeBattle_Move_146 < PokeBattle_Move
  8942.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8943.     unmoved=false
  8944.     for poke in @battle.battlers
  8945.       next if poke.index==attacker.index
  8946.       if @battle.choices[poke.index][0]==1 && # Chose a move
  8947.          !poke.hasMovedThisRound?
  8948.         unmoved=true; break
  8949.       end
  8950.     end
  8951.     if !unmoved || @battle.field.effects[PBEffects::IonDeluge]
  8952.       @battle.pbDisplay(_INTL("But it failed!"))
  8953.       return -1
  8954.     end
  8955.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8956.     @battle.field.effects[PBEffects::IonDeluge]=true
  8957.     @battle.pbDisplay(_INTL("The Ion Deluge started!"))
  8958.     return 0
  8959.   end
  8960. end
  8961.  
  8962.  
  8963.  
  8964. ################################################################################
  8965. # Always hits. (Hyperspace Hole)
  8966. # TODO: Hits through various shields.
  8967. ################################################################################
  8968. class PokeBattle_Move_147 < PokeBattle_Move
  8969.   def pbAccuracyCheck(attacker,opponent)
  8970.     return true
  8971.   end
  8972. end
  8973.  
  8974.  
  8975. ################################################################################
  8976. # Powders the foe. This round, if it uses a Fire move, it loses 1/4 of its max
  8977. # HP instead. (Powder)
  8978. ################################################################################
  8979. class PokeBattle_Move_148 < PokeBattle_Move
  8980.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8981.     if opponent.effects[PBEffects::Powder]
  8982.       @battle.pbDisplay(_INTL("But it failed!"))
  8983.       return -1
  8984.     end
  8985.     opponent.effects[PBEffects::Powder]=true
  8986.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8987.     @battle.pbDisplay(_INTL("{1} is covered in powder!",attacker.pbThis))
  8988.     return 0
  8989.   end  
  8990. end
  8991.  
  8992.  
  8993.  
  8994. ################################################################################
  8995. # This round, the user's side is unaffected by damaging moves. (Mat Block)
  8996. ################################################################################
  8997. class PokeBattle_Move_149 < PokeBattle_Move
  8998.   def pbMoveFailed(attacker,opponent)
  8999.     return (attacker.turncount>1)
  9000.   end
  9001.  
  9002.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9003.     attacker.pbOwnSide.effects[PBEffects::MatBlock]=true
  9004.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9005.     @battle.pbDisplay(_INTL("{1} intends to flip up a mat and block incoming attacks!",attacker.pbThis))
  9006.     return 0
  9007.   end
  9008. end
  9009.  
  9010.  
  9011.  
  9012. ################################################################################
  9013. # User's side is protected against status moves this round. (Crafty Shield)
  9014. ################################################################################
  9015. class PokeBattle_Move_14A < PokeBattle_Move
  9016.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9017.     if attacker.pbOwnSide.effects[PBEffects::CraftyShield]
  9018.       @battle.pbDisplay(_INTL("But it failed!"))
  9019.       return -1
  9020.     end
  9021.     unmoved=false
  9022.     for poke in @battle.battlers
  9023.       next if poke.index==attacker.index
  9024.       if @battle.choices[poke.index][0]==1 && # Chose a move
  9025.          !poke.hasMovedThisRound?
  9026.         unmoved=true; break
  9027.       end
  9028.     end
  9029.     if !unmoved
  9030.       @battle.pbDisplay(_INTL("But it failed!"))
  9031.       return -1
  9032.     end
  9033.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9034.     attacker.pbOwnSide.effects[PBEffects::CraftyShield]=true
  9035.     if !@battle.pbIsOpposing?(attacker.index)
  9036.       @battle.pbDisplay(_INTL("Crafty Shield protected your team!"))
  9037.     else
  9038.       @battle.pbDisplay(_INTL("Crafty Shield protected the opposing team!"))
  9039.     end
  9040.     return 0
  9041.   end
  9042. end
  9043.  
  9044.  
  9045.  
  9046. ################################################################################
  9047. # User is protected against damaging moves this round. Decreases the Attack of
  9048. # the user of a stopped contact move by 2 stages. (King's Shield)
  9049. ################################################################################
  9050. class PokeBattle_Move_14B < PokeBattle_Move
  9051.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9052.     if attacker.effects[PBEffects::KingsShield]
  9053.       @battle.pbDisplay(_INTL("But it failed!"))
  9054.       return -1
  9055.     end
  9056.     ratesharers=[
  9057.        0xAA,   # Detect, Protect
  9058.        0xAB,   # Quick Guard
  9059.        0xAC,   # Wide Guard
  9060.        0xE8,   # Endure
  9061.        0x14B,  # King's Shield
  9062.        0x14C   # Spiky Shield
  9063.     ]
  9064.     if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9065.       attacker.effects[PBEffects::ProtectRate]=1
  9066.     end
  9067.     unmoved=false
  9068.     for poke in @battle.battlers
  9069.       next if poke.index==attacker.index
  9070.       if @battle.choices[poke.index][0]==1 && # Chose a move
  9071.          !poke.hasMovedThisRound?
  9072.         unmoved=true; break
  9073.       end
  9074.     end
  9075.     if !unmoved ||
  9076.        (!USENEWBATTLEMECHANICS &&
  9077.        @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  9078.       attacker.effects[PBEffects::ProtectRate]=1
  9079.       @battle.pbDisplay(_INTL("But it failed!"))
  9080.       return -1
  9081.     end
  9082.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9083.     attacker.effects[PBEffects::KingsShield]=true
  9084.     attacker.effects[PBEffects::ProtectRate]*=2
  9085.     @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9086.     return 0
  9087.   end
  9088. end
  9089.  
  9090.  
  9091.  
  9092. ################################################################################
  9093. # User is protected against moves that target it this round. Damages the user of
  9094. # a stopped contact move by 1/8 of its max HP. (Spiky Shield)
  9095. ################################################################################
  9096. class PokeBattle_Move_14C < PokeBattle_Move
  9097.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9098.     if attacker.effects[PBEffects::SpikyShield]
  9099.       @battle.pbDisplay(_INTL("But it failed!"))
  9100.       return -1
  9101.     end
  9102.     ratesharers=[
  9103.        0xAA,   # Detect, Protect
  9104.        0xAB,   # Quick Guard
  9105.        0xAC,   # Wide Guard
  9106.        0xE8,   # Endure
  9107.        0x14B,  # King's Shield
  9108.        0x14C   # Spiky Shield
  9109.     ]
  9110.     if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9111.       attacker.effects[PBEffects::ProtectRate]=1
  9112.     end
  9113.     unmoved=false
  9114.     for poke in @battle.battlers
  9115.       next if poke.index==attacker.index
  9116.       if @battle.choices[poke.index][0]==1 && # Chose a move
  9117.          !poke.hasMovedThisRound?
  9118.         unmoved=true; break
  9119.       end
  9120.     end
  9121.     if !unmoved ||
  9122.        @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  9123.       attacker.effects[PBEffects::ProtectRate]=1
  9124.       @battle.pbDisplay(_INTL("But it failed!"))
  9125.       return -1
  9126.     end
  9127.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9128.     attacker.effects[PBEffects::SpikyShield]=true
  9129.     attacker.effects[PBEffects::ProtectRate]*=2
  9130.     @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9131.     return 0
  9132.   end
  9133. end
  9134.  
  9135.  
  9136.  
  9137. ################################################################################
  9138. # Two turn attack. Skips first turn, attacks second turn. (Phantom Force)
  9139. # Is invulnerable during use.
  9140. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  9141. # this round. If successful, negates them this round.
  9142. # Does double damage and has perfect accuracy if the target is Minimized.
  9143. ################################################################################
  9144. class PokeBattle_Move_14D < PokeBattle_Move
  9145.   def pbTwoTurnAttack(attacker)
  9146.     @immediate=false
  9147.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9148.       @immediate=true
  9149.     end
  9150.     return false if @immediate
  9151.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  9152.   end
  9153.  
  9154.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9155.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9156.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9157.       @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  9158.     end
  9159.     if @immediate
  9160.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  9161.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9162.       attacker.pbConsumeItem
  9163.     end
  9164.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9165.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9166.     if ret>0
  9167.       opponent.effects[PBEffects::ProtectNegation]=true
  9168.       opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  9169.     end
  9170.     return ret
  9171.   end
  9172.  
  9173.   def tramplesMinimize?(param=1)
  9174.     return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  9175.     return true if param==2 # Double damage
  9176.     return false
  9177.   end
  9178. end
  9179.  
  9180.  
  9181.  
  9182. ################################################################################
  9183. # Two turn attack. Skips first turn, increases the user's Special Attack,
  9184. # Special Defense and Speed by 2 stages each second turn. (Geomancy)
  9185. ################################################################################
  9186. class PokeBattle_Move_14E < PokeBattle_Move
  9187.   def pbTwoTurnAttack(attacker)
  9188.     @immediate=false
  9189.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9190.       @immediate=true
  9191.     end
  9192.     return false if @immediate
  9193.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  9194.   end
  9195.  
  9196.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9197.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9198.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9199.       @battle.pbDisplay(_INTL("{1} is absorbing power!",attacker.pbThis))
  9200.     end
  9201.     if @immediate
  9202.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  9203.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9204.       attacker.pbConsumeItem
  9205.     end
  9206.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9207.     if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  9208.        !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  9209.        !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9210.       @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  9211.       return -1
  9212.     end
  9213.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9214.     showanim=true
  9215.     if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  9216.       attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  9217.       showanim=false
  9218.     end
  9219.     if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  9220.       attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self,showanim)
  9221.       showanim=false
  9222.     end
  9223.     if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9224.       attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  9225.       showanim=false
  9226.     end
  9227.     return 0
  9228.   end
  9229. end
  9230.  
  9231.  
  9232.  
  9233. ################################################################################
  9234. # User gains 3/4 the HP it inflicts as damage. (Draining Kiss, Oblivion Wing)
  9235. ################################################################################
  9236. class PokeBattle_Move_14F < PokeBattle_Move
  9237.   def isHealingMove?
  9238.     return USENEWBATTLEMECHANICS
  9239.   end
  9240.  
  9241.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9242.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9243.     if opponent.damagestate.calcdamage>0
  9244.       hpgain=(opponent.damagestate.hplost*3/4).round
  9245.       if opponent.hasWorkingAbility(:LIQUIDOOZE)
  9246.         attacker.pbReduceHP(hpgain,true)
  9247.         @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  9248.       elsif attacker.effects[PBEffects::HealBlock]==0
  9249.         hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  9250.         attacker.pbRecoverHP(hpgain,true)
  9251.         @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  9252.       end
  9253.     end
  9254.     return ret
  9255.   end
  9256. end
  9257.  
  9258.  
  9259.  
  9260. ################################################################################
  9261. # If this move KO's the target, increases the user's Attack by 2 stages.
  9262. # (Fell Stinger)
  9263. ################################################################################
  9264. class PokeBattle_Move_150 < PokeBattle_Move
  9265.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9266.     ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9267.     if opponent.damagestate.calcdamage>0 && opponent.fainted?
  9268.       if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  9269.         attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  9270.       end
  9271.     end
  9272.     return ret
  9273.   end
  9274. end
  9275.  
  9276.  
  9277.  
  9278. ################################################################################
  9279. # Decreases the target's Attack and Special Attack by 1 stage each. Then, user
  9280. # switches out. Ignores trapping moves. (Parting Shot)
  9281. # TODO: Pursuit should interrupt this move.
  9282. ################################################################################
  9283. class PokeBattle_Move_151 < PokeBattle_Move
  9284.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9285.     ret=-1
  9286.     pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9287.     if !self.isSoundBased? ||
  9288.        attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SOUNDPROOF)
  9289.       showanim=true
  9290.       if opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  9291.         showanim=false; ret=0
  9292.       end
  9293.       if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  9294.         showanim=false; ret=0
  9295.       end
  9296.     end
  9297.     if !attacker.fainted? &&
  9298.        @battle.pbCanChooseNonActive?(attacker.index) &&
  9299.        !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  9300.       attacker.effects[PBEffects::Uturn]=true; ret=0
  9301.     end
  9302.     return ret
  9303.   end
  9304. end
  9305.  
  9306.  
  9307.  
  9308. ################################################################################
  9309. # No Pokémon can switch out or flee until the end of the next round, as long as
  9310. # the user remains active. (Fairy Lock)
  9311. ################################################################################
  9312. class PokeBattle_Move_152 < PokeBattle_Move
  9313.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9314.     if @battle.field.effects[PBEffects::FairyLock]>0
  9315.       @battle.pbDisplay(_INTL("But it failed!"))
  9316.       return -1
  9317.     end
  9318.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9319.     @battle.field.effects[PBEffects::FairyLock]=2
  9320.     @battle.pbDisplay(_INTL("No one will be able to run away during the next turn!"))
  9321.     return 0
  9322.   end
  9323. end
  9324.  
  9325.  
  9326.  
  9327. ################################################################################
  9328. # Entry hazard. Lays stealth rocks on the opposing side. (Sticky Web)
  9329. ################################################################################
  9330. class PokeBattle_Move_153 < PokeBattle_Move
  9331.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9332.     if attacker.pbOpposingSide.effects[PBEffects::StickyWeb]
  9333.       @battle.pbDisplay(_INTL("But it failed!"))
  9334.       return -1
  9335.     end
  9336.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9337.     attacker.pbOpposingSide.effects[PBEffects::StickyWeb]=true
  9338.     if !@battle.pbIsOpposing?(attacker.index)
  9339.       @battle.pbDisplay(_INTL("A sticky web has been laid out beneath the opposing team's feet!"))
  9340.     else
  9341.       @battle.pbDisplay(_INTL("A sticky web has been laid out beneath your team's feet!"))
  9342.     end
  9343.     return 0
  9344.   end
  9345. end
  9346.  
  9347.  
  9348.  
  9349. ################################################################################
  9350. # For 5 rounds, creates an electric terrain which boosts Electric-type moves and
  9351. # prevents Pokémon from falling asleep. Affects non-airborne Pokémon only.
  9352. # (Electric Terrain)
  9353. ################################################################################
  9354. class PokeBattle_Move_154 < PokeBattle_Move
  9355.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9356.     if @battle.field.effects[PBEffects::ElectricTerrain]>0
  9357.       @battle.pbDisplay(_INTL("But it failed!"))
  9358.       return -1
  9359.     end
  9360.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9361.     @battle.field.effects[PBEffects::GrassyTerrain]=0
  9362.     @battle.field.effects[PBEffects::MistyTerrain]=0
  9363.     @battle.field.effects[PBEffects::ElectricTerrain]=5
  9364.     @battle.pbDisplay(_INTL("An electric current runs across the battlefield!"))
  9365.     return 0
  9366.   end
  9367. end
  9368.  
  9369.  
  9370.  
  9371. ################################################################################
  9372. # For 5 rounds, creates a grassy terrain which boosts Grass-type moves and heals
  9373. # Pokémon at the end of each round. Affects non-airborne Pokémon only.
  9374. # (Grassy Terrain)
  9375. ################################################################################
  9376. class PokeBattle_Move_155 < PokeBattle_Move
  9377.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9378.     if @battle.field.effects[PBEffects::GrassyTerrain]>0
  9379.       @battle.pbDisplay(_INTL("But it failed!"))
  9380.       return -1
  9381.     end
  9382.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9383.     @battle.field.effects[PBEffects::ElectricTerrain]=0
  9384.     @battle.field.effects[PBEffects::MistyTerrain]=0
  9385.     @battle.field.effects[PBEffects::GrassyTerrain]=5
  9386.     @battle.pbDisplay(_INTL("Grass grew to cover the battlefield!"))
  9387.     return 0
  9388.   end
  9389. end
  9390.  
  9391.  
  9392.  
  9393. ################################################################################
  9394. # For 5 rounds, creates a misty terrain which weakens Dragon-type moves and
  9395. # protects Pokémon from status problems. Affects non-airborne Pokémon only.
  9396. # (Misty Terrain)
  9397. ################################################################################
  9398. class PokeBattle_Move_156 < PokeBattle_Move
  9399.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9400.     if @battle.field.effects[PBEffects::MistyTerrain]>0
  9401.       @battle.pbDisplay(_INTL("But it failed!"))
  9402.       return -1
  9403.     end
  9404.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9405.     @battle.field.effects[PBEffects::ElectricTerrain]=0
  9406.     @battle.field.effects[PBEffects::GrassyTerrain]=0
  9407.     @battle.field.effects[PBEffects::MistyTerrain]=5
  9408.     @battle.pbDisplay(_INTL("Mist swirled about the battlefield!"))
  9409.     return 0
  9410.   end
  9411. end
  9412.  
  9413.  
  9414.  
  9415. ################################################################################
  9416. # Doubles the prize money the player gets after winning the battle. (Happy Hour)
  9417. ################################################################################
  9418. class PokeBattle_Move_157 < PokeBattle_Move
  9419.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9420.     if @battle.pbIsOpposing?(attacker.index) || @battle.doublemoney
  9421.       @battle.pbDisplay(_INTL("But it failed!"))
  9422.       return -1
  9423.     end
  9424.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9425.     @battle.doublemoney=true
  9426.     @battle.pbDisplay(_INTL("Everyone is caught up in the happy atmosphere!"))
  9427.     return 0
  9428.   end
  9429. end
  9430.  
  9431.  
  9432.  
  9433. ################################################################################
  9434. # Fails unless user has consumed a berry at some point. (Belch)
  9435. ################################################################################
  9436. class PokeBattle_Move_158 < PokeBattle_Move
  9437.   def pbMoveFailed(attacker,opponent)
  9438.     return !attacker.pokemon || !attacker.pokemon.belch
  9439.   end
  9440. end
  9441.  
  9442.  
  9443.  
  9444. #===============================================================================
  9445. # NOTE: If you're inventing new move effects, use function code 159 and onwards.
  9446. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement