Advertisement
Guest User

Untitled

a guest
Feb 4th, 2019
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 412.25 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. (!attacker.hasWorkingAbility(:COMATOSE) ||
  493. !isConst?(attacker.species,PBSpecies,:KOMALA))
  494. end
  495.  
  496. def pbAdditionalEffect(attacker,opponent)
  497. return if opponent.damagestate.substitute
  498. opponent.pbFlinch(attacker)
  499. end
  500. end
  501.  
  502.  
  503.  
  504. ################################################################################
  505. # Causes the target to flinch. Fails if this isn't the user's first turn.
  506. # (Fake Out)
  507. ################################################################################
  508. class PokeBattle_Move_012 < PokeBattle_Move
  509. def pbMoveFailed(attacker,opponent)
  510. return (attacker.turncount>1)
  511. end
  512.  
  513. def pbAdditionalEffect(attacker,opponent)
  514. return if opponent.damagestate.substitute
  515. opponent.pbFlinch(attacker)
  516. end
  517. end
  518.  
  519.  
  520.  
  521. ################################################################################
  522. # Confuses the target.
  523. ################################################################################
  524. class PokeBattle_Move_013 < PokeBattle_Move
  525. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  526. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  527. if opponent.pbCanConfuse?(attacker,true,self)
  528. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  529. opponent.pbConfuse
  530. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  531. return 0
  532. end
  533. return -1
  534. end
  535.  
  536. def pbAdditionalEffect(attacker,opponent)
  537. return if opponent.damagestate.substitute
  538. if opponent.pbCanConfuse?(attacker,false,self)
  539. opponent.pbConfuse
  540. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  541. end
  542. end
  543. end
  544.  
  545.  
  546.  
  547. ################################################################################
  548. # Confuses the target. Chance of causing confusion depends on the cry's volume.
  549. # Confusion chance is 0% if user doesn't have a recorded cry. (Chatter)
  550. # TODO: Play the actual chatter cry as part of the move animation
  551. # @battle.scene.pbChatter(attacker,opponent) # Just plays cry
  552. ################################################################################
  553. class PokeBattle_Move_014 < PokeBattle_Move
  554. def addlEffect
  555. return 100 if USENEWBATTLEMECHANICS
  556. if attacker.pokemon && attacker.pokemon.chatter
  557. return attacker.pokemon.chatter.intensity*10/127
  558. end
  559. return 0
  560. end
  561.  
  562. def pbAdditionalEffect(attacker,opponent)
  563. return if opponent.damagestate.substitute
  564. if opponent.pbCanConfuse?(attacker,false,self)
  565. opponent.pbConfuse
  566. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  567. end
  568. end
  569. end
  570.  
  571.  
  572.  
  573. ################################################################################
  574. # Confuses the target. Accuracy perfect in rain, 50% in sunshine. (Hurricane)
  575. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  576. ################################################################################
  577. class PokeBattle_Move_015 < PokeBattle_Move
  578. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  579. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  580. if opponent.pbCanConfuse?(attacker,true,self)
  581. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  582. opponent.pbConfuse
  583. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  584. return 0
  585. end
  586. return -1
  587. end
  588.  
  589. def pbAdditionalEffect(attacker,opponent)
  590. return if opponent.damagestate.substitute
  591. if opponent.pbCanConfuse?(attacker,false,self)
  592. opponent.pbConfuse
  593. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  594. end
  595. end
  596.  
  597. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  598. case @battle.pbWeather
  599. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  600. return 0
  601. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  602. return 50
  603. end
  604. return baseaccuracy
  605. end
  606. end
  607.  
  608.  
  609.  
  610. ################################################################################
  611. # Attracts the target. (Attract)
  612. ################################################################################
  613. class PokeBattle_Move_016 < PokeBattle_Move
  614. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  615. if !opponent.pbCanAttract?(attacker)
  616. return -1
  617. end
  618. if !attacker.hasMoldBreaker
  619. if opponent.hasWorkingAbility(:AROMAVEIL)
  620. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  621. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  622. return -1
  623. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  624. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  625. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  626. return -1
  627. end
  628. end
  629. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  630. opponent.pbAttract(attacker)
  631. return 0
  632. end
  633. end
  634.  
  635.  
  636.  
  637. ################################################################################
  638. # Burns, freezes or paralyzes the target. (Tri Attack)
  639. ################################################################################
  640. class PokeBattle_Move_017 < PokeBattle_Move
  641. def pbAdditionalEffect(attacker,opponent)
  642. return if opponent.damagestate.substitute
  643. case @battle.pbRandom(3)
  644. when 0
  645. if opponent.pbCanBurn?(attacker,false,self)
  646. opponent.pbBurn(attacker)
  647. end
  648. when 1
  649. if opponent.pbCanFreeze?(attacker,false,self)
  650. opponent.pbFreeze
  651. end
  652. when 2
  653. if opponent.pbCanParalyze?(attacker,false,self)
  654. opponent.pbParalyze(attacker)
  655. end
  656. end
  657. end
  658. end
  659.  
  660.  
  661.  
  662. ################################################################################
  663. # Cures user of burn, poison and paralysis. (Refresh)
  664. ################################################################################
  665. class PokeBattle_Move_018 < PokeBattle_Move
  666. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  667. if attacker.status!=PBStatuses::BURN &&
  668. attacker.status!=PBStatuses::POISON &&
  669. attacker.status!=PBStatuses::PARALYSIS
  670. @battle.pbDisplay(_INTL("But it failed!"))
  671. return -1
  672. else
  673. t=attacker.status
  674. attacker.pbCureStatus(false)
  675. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  676. if t==PBStatuses::BURN
  677. @battle.pbDisplay(_INTL("{1} healed its burn!",attacker.pbThis))
  678. elsif t==PBStatuses::POISON
  679. @battle.pbDisplay(_INTL("{1} cured its poisoning!",attacker.pbThis))
  680. elsif t==PBStatuses::PARALYSIS
  681. @battle.pbDisplay(_INTL("{1} cured its paralysis!",attacker.pbThis))
  682. end
  683. return 0
  684. end
  685. end
  686. end
  687.  
  688.  
  689.  
  690. ################################################################################
  691. # Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
  692. ################################################################################
  693. class PokeBattle_Move_019 < PokeBattle_Move
  694. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  695. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  696. if isConst?(@id,PBMoves,:AROMATHERAPY)
  697. @battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
  698. else
  699. @battle.pbDisplay(_INTL("A bell chimed!"))
  700. end
  701. activepkmn=[]
  702. for i in @battle.battlers
  703. next if attacker.pbIsOpposing?(i.index) || i.fainted?
  704. activepkmn.push(i.pokemonIndex)
  705. next if USENEWBATTLEMECHANICS && i.index!=attacker.index &&
  706. pbTypeImmunityByAbility(pbType(@type,attacker,i),attacker,i)
  707. case i.status
  708. when PBStatuses::PARALYSIS
  709. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",i.pbThis))
  710. when PBStatuses::SLEEP
  711. @battle.pbDisplay(_INTL("{1}'s sleep was woken.",i.pbThis))
  712. when PBStatuses::POISON
  713. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",i.pbThis))
  714. when PBStatuses::BURN
  715. @battle.pbDisplay(_INTL("{1}'s burn was healed.",i.pbThis))
  716. when PBStatuses::FROZEN
  717. @battle.pbDisplay(_INTL("{1} was thawed out.",i.pbThis))
  718. end
  719. i.pbCureStatus(false)
  720. end
  721. party=@battle.pbParty(attacker.index) # NOTE: Considers both parties in multi battles
  722. for i in 0...party.length
  723. next if activepkmn.include?(i)
  724. next if !party[i] || party[i].egg? || party[i].hp<=0
  725. case party[i].status
  726. when PBStatuses::PARALYSIS
  727. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",party[i].name))
  728. when PBStatuses::SLEEP
  729. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",party[i].name))
  730. when PBStatuses::POISON
  731. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",party[i].name))
  732. when PBStatuses::BURN
  733. @battle.pbDisplay(_INTL("{1}'s burn was healed.",party[i].name))
  734. when PBStatuses::FROZEN
  735. @battle.pbDisplay(_INTL("{1} was thawed out.",party[i].name))
  736. end
  737. party[i].status=0
  738. party[i].statusCount=0
  739. end
  740. return 0
  741. end
  742. end
  743.  
  744.  
  745.  
  746. ################################################################################
  747. # Safeguards the user's side from being inflicted with status problems. (Safeguard)
  748. ################################################################################
  749. class PokeBattle_Move_01A < PokeBattle_Move
  750. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  751. if attacker.pbOwnSide.effects[PBEffects::Safeguard]>0
  752. @battle.pbDisplay(_INTL("But it failed!"))
  753. return -1
  754. end
  755. attacker.pbOwnSide.effects[PBEffects::Safeguard]=5
  756. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  757. if !@battle.pbIsOpposing?(attacker.index)
  758. @battle.pbDisplay(_INTL("Your team became cloaked in a mystical veil!"))
  759. else
  760. @battle.pbDisplay(_INTL("The opposing team became cloaked in a mystical veil!"))
  761. end
  762. return 0
  763. end
  764. end
  765.  
  766.  
  767.  
  768. ################################################################################
  769. # User passes its status problem to the target. (Psycho Shift)
  770. ################################################################################
  771. class PokeBattle_Move_01B < PokeBattle_Move
  772. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  773. if attacker.status==0 ||
  774. (attacker.status==PBStatuses::PARALYSIS && !opponent.pbCanParalyze?(attacker,false,self)) ||
  775. (attacker.status==PBStatuses::SLEEP && !opponent.pbCanSleep?(attacker,false,self)) ||
  776. (attacker.status==PBStatuses::POISON && !opponent.pbCanPoison?(attacker,false,self)) ||
  777. (attacker.status==PBStatuses::BURN && !opponent.pbCanBurn?(attacker,false,self)) ||
  778. (attacker.status==PBStatuses::FROZEN && !opponent.pbCanFreeze?(attacker,false,self))
  779. @battle.pbDisplay(_INTL("But it failed!"))
  780. return -1
  781. end
  782. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  783. case attacker.status
  784. when PBStatuses::PARALYSIS
  785. opponent.pbParalyze(attacker)
  786. opponent.pbAbilityCureCheck
  787. attacker.pbCureStatus(false)
  788. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",attacker.pbThis))
  789. when PBStatuses::SLEEP
  790. opponent.pbSleep
  791. opponent.pbAbilityCureCheck
  792. attacker.pbCureStatus(false)
  793. @battle.pbDisplay(_INTL("{1} woke up.",attacker.pbThis))
  794. when PBStatuses::POISON
  795. opponent.pbPoison(attacker,nil,attacker.statusCount!=0)
  796. opponent.pbAbilityCureCheck
  797. attacker.pbCureStatus(false)
  798. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  799. when PBStatuses::BURN
  800. opponent.pbBurn(attacker)
  801. opponent.pbAbilityCureCheck
  802. attacker.pbCureStatus(false)
  803. @battle.pbDisplay(_INTL("{1}'s burn was healed.",attacker.pbThis))
  804. when PBStatuses::FROZEN
  805. opponent.pbFreeze
  806. opponent.pbAbilityCureCheck
  807. attacker.pbCureStatus(false)
  808. @battle.pbDisplay(_INTL("{1} was thawed out.",attacker.pbThis))
  809. end
  810. return 0
  811. end
  812. end
  813.  
  814.  
  815.  
  816. ################################################################################
  817. # Increases the user's Attack by 1 stage.
  818. ################################################################################
  819. class PokeBattle_Move_01C < PokeBattle_Move
  820. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  821. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  822. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  823. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  824. ret=attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  825. return ret ? 0 : -1
  826. end
  827.  
  828. def pbAdditionalEffect(attacker,opponent)
  829. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  830. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  831. end
  832. end
  833. end
  834.  
  835.  
  836.  
  837. ################################################################################
  838. # Increases the user's Defense by 1 stage.
  839. ################################################################################
  840. class PokeBattle_Move_01D < PokeBattle_Move
  841. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  842. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  843. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  844. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  845. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  846. return ret ? 0 : -1
  847. end
  848.  
  849. def pbAdditionalEffect(attacker,opponent)
  850. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  851. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  852. end
  853. end
  854. end
  855.  
  856.  
  857.  
  858. ################################################################################
  859. # Increases the user's Defense by 1 stage. User curls up. (Defense Curl)
  860. ################################################################################
  861. class PokeBattle_Move_01E < PokeBattle_Move
  862. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  863. attacker.effects[PBEffects::DefenseCurl]=true
  864. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  865. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  866. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  867. return ret ? 0 : -1
  868. end
  869. end
  870.  
  871.  
  872.  
  873. ################################################################################
  874. # Increases the user's Speed by 1 stage.
  875. ################################################################################
  876. class PokeBattle_Move_01F < PokeBattle_Move
  877. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  878. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  879. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  880. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  881. ret=attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  882. return ret ? 0 : -1
  883. end
  884.  
  885. def pbAdditionalEffect(attacker,opponent)
  886. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  887. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  888. end
  889. end
  890. end
  891.  
  892.  
  893.  
  894. ################################################################################
  895. # Increases the user's Special Attack by 1 stage.
  896. ################################################################################
  897. class PokeBattle_Move_020 < PokeBattle_Move
  898. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  899. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  900. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  901. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  902. ret=attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  903. return ret ? 0 : -1
  904. end
  905.  
  906. def pbAdditionalEffect(attacker,opponent)
  907. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  908. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  909. end
  910. end
  911. end
  912.  
  913.  
  914.  
  915. ################################################################################
  916. # Increases the user's Special Defense by 1 stage.
  917. # Charges up user's next attack if it is Electric-type. (Charge)
  918. ################################################################################
  919. class PokeBattle_Move_021 < PokeBattle_Move
  920. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  921. attacker.effects[PBEffects::Charge]=2
  922. @battle.pbDisplay(_INTL("{1} began charging power!",attacker.pbThis))
  923. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  924. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  925. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  926. end
  927. return 0
  928. end
  929. end
  930.  
  931.  
  932.  
  933. ################################################################################
  934. # Increases the user's evasion by 1 stage.
  935. ################################################################################
  936. class PokeBattle_Move_022 < PokeBattle_Move
  937. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  938. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  939. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  940. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  941. ret=attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  942. return ret ? 0 : -1
  943. end
  944.  
  945. def pbAdditionalEffect(attacker,opponent)
  946. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  947. attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  948. end
  949. end
  950. end
  951.  
  952.  
  953.  
  954. ################################################################################
  955. # Increases the user's critical hit rate. (Focus Energy)
  956. ################################################################################
  957. class PokeBattle_Move_023 < PokeBattle_Move
  958. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  959. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  960. if attacker.effects[PBEffects::FocusEnergy]>=2
  961. @battle.pbDisplay(_INTL("But it failed!"))
  962. return -1
  963. end
  964. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  965. attacker.effects[PBEffects::FocusEnergy]=2
  966. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  967. return 0
  968. end
  969.  
  970. def pbAdditionalEffect(attacker,opponent)
  971. if attacker.effects[PBEffects::FocusEnergy]<2
  972. attacker.effects[PBEffects::FocusEnergy]=2
  973. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  974. end
  975. end
  976. end
  977.  
  978.  
  979.  
  980. ################################################################################
  981. # Increases the user's Attack and Defense by 1 stage each. (Bulk Up)
  982. ################################################################################
  983. class PokeBattle_Move_024 < PokeBattle_Move
  984. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  985. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  986. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  987. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  988. return -1
  989. end
  990. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  991. showanim=true
  992. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  993. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  994. showanim=false
  995. end
  996. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  997. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  998. showanim=false
  999. end
  1000. return 0
  1001. end
  1002. end
  1003.  
  1004.  
  1005.  
  1006. ################################################################################
  1007. # Increases the user's Attack, Defense and accuracy by 1 stage each. (Coil)
  1008. ################################################################################
  1009. class PokeBattle_Move_025 < PokeBattle_Move
  1010. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1011. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1012. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1013. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1014. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1015. return -1
  1016. end
  1017. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1018. showanim=true
  1019. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1020. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1021. showanim=false
  1022. end
  1023. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1024. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1025. showanim=false
  1026. end
  1027. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1028. attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1029. showanim=false
  1030. end
  1031. return 0
  1032. end
  1033. end
  1034.  
  1035.  
  1036.  
  1037. ################################################################################
  1038. # Increases the user's Attack and Speed by 1 stage each. (Dragon Dance)
  1039. ################################################################################
  1040. class PokeBattle_Move_026 < PokeBattle_Move
  1041. def isDanceMove?
  1042. return true
  1043. end
  1044.  
  1045. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1046. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1047. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1048. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1049. return -1
  1050. end
  1051. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1052. showanim=true
  1053. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1054. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1055. showanim=false
  1056. end
  1057. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1058. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1059. showanim=false
  1060. end
  1061. return 0
  1062. end
  1063. end
  1064.  
  1065.  
  1066.  
  1067. ################################################################################
  1068. # Increases the user's Attack and Special Attack by 1 stage each. (Work Up)
  1069. ################################################################################
  1070. class PokeBattle_Move_027 < PokeBattle_Move
  1071. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1072. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1073. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1074. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1075. return -1
  1076. end
  1077. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1078. showanim=true
  1079. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1080. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1081. showanim=false
  1082. end
  1083. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1084. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1085. showanim=false
  1086. end
  1087. return 0
  1088. end
  1089. end
  1090.  
  1091.  
  1092.  
  1093. ################################################################################
  1094. # Increases the user's Attack and Sp. Attack by 1 stage each.
  1095. # In sunny weather, increase is 2 stages each instead. (Growth)
  1096. ################################################################################
  1097. class PokeBattle_Move_028 < PokeBattle_Move
  1098. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1099. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1100. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1101. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1102. return -1
  1103. end
  1104. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1105. showanim=true
  1106. increment=1
  1107. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  1108. @battle.pbWeather==PBWeather::HARSHSUN
  1109. increment=2
  1110. end
  1111. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1112. attacker.pbIncreaseStat(PBStats::ATTACK,increment,attacker,false,self,showanim)
  1113. showanim=false
  1114. end
  1115. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1116. attacker.pbIncreaseStat(PBStats::SPATK,increment,attacker,false,self,showanim)
  1117. showanim=false
  1118. end
  1119. return 0
  1120. end
  1121. end
  1122.  
  1123.  
  1124.  
  1125. ################################################################################
  1126. # Increases the user's Attack and accuracy by 1 stage each. (Hone Claws)
  1127. ################################################################################
  1128. class PokeBattle_Move_029 < PokeBattle_Move
  1129. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1130. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1131. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1132. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1133. return -1
  1134. end
  1135. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1136. showanim=true
  1137. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1138. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1139. showanim=false
  1140. end
  1141. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1142. attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1143. showanim=false
  1144. end
  1145. return 0
  1146. end
  1147. end
  1148.  
  1149.  
  1150.  
  1151. ################################################################################
  1152. # Increases the user's Defense and Special Defense by 1 stage each. (Cosmic Power)
  1153. ################################################################################
  1154. class PokeBattle_Move_02A < PokeBattle_Move
  1155. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1156. if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1157. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1158. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1159. return -1
  1160. end
  1161. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1162. showanim=true
  1163. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1164. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1165. showanim=false
  1166. end
  1167. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1168. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1169. showanim=false
  1170. end
  1171. return 0
  1172. end
  1173. end
  1174.  
  1175.  
  1176.  
  1177. ################################################################################
  1178. # Increases the user's Sp. Attack, Sp. Defense and Speed by 1 stage each. (Quiver Dance)
  1179. ################################################################################
  1180. class PokeBattle_Move_02B < PokeBattle_Move
  1181. def isDanceMove?
  1182. return true
  1183. end
  1184.  
  1185. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1186. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1187. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  1188. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1189. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1190. return -1
  1191. end
  1192. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1193. showanim=true
  1194. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1195. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1196. showanim=false
  1197. end
  1198. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1199. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1200. showanim=false
  1201. end
  1202. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1203. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1204. showanim=false
  1205. end
  1206. return 0
  1207. end
  1208. end
  1209.  
  1210.  
  1211.  
  1212. ################################################################################
  1213. # Increases the user's Sp. Attack and Sp. Defense by 1 stage each. (Calm Mind)
  1214. ################################################################################
  1215. class PokeBattle_Move_02C < PokeBattle_Move
  1216. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1217. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1218. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1219. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1220. return -1
  1221. end
  1222. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1223. showanim=true
  1224. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1225. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1226. showanim=false
  1227. end
  1228. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1229. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1230. showanim=false
  1231. end
  1232. return 0
  1233. end
  1234. end
  1235.  
  1236.  
  1237.  
  1238. ################################################################################
  1239. # Increases the user's Attack, Defense, Speed, Special Attack and Special Defense
  1240. # by 1 stage each. (AncientPower, Ominous Wind, Silver Wind)
  1241. ################################################################################
  1242. class PokeBattle_Move_02D < PokeBattle_Move
  1243. def pbAdditionalEffect(attacker,opponent)
  1244. showanim=true
  1245. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1246. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1247. showanim=false
  1248. end
  1249. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1250. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1251. showanim=false
  1252. end
  1253. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1254. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1255. showanim=false
  1256. end
  1257. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1258. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1259. showanim=false
  1260. end
  1261. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1262. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1263. showanim=false
  1264. end
  1265. end
  1266. end
  1267.  
  1268.  
  1269.  
  1270. ################################################################################
  1271. # Increases the user's Attack by 2 stages.
  1272. ################################################################################
  1273. class PokeBattle_Move_02E < PokeBattle_Move
  1274. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1275. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1276. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  1277. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1278. ret=attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1279. return ret ? 0 : -1
  1280. end
  1281.  
  1282. def pbAdditionalEffect(attacker,opponent)
  1283. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1284. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1285. end
  1286. end
  1287. end
  1288.  
  1289.  
  1290.  
  1291. ################################################################################
  1292. # Increases the user's Defense by 2 stages.
  1293. ################################################################################
  1294. class PokeBattle_Move_02F < PokeBattle_Move
  1295. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1296. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1297. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1298. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1299. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1300. return ret ? 0 : -1
  1301. end
  1302.  
  1303. def pbAdditionalEffect(attacker,opponent)
  1304. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1305. attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1306. end
  1307. end
  1308. end
  1309.  
  1310.  
  1311.  
  1312. ################################################################################
  1313. # Increases the user's Speed by 2 stages.
  1314. ################################################################################
  1315. class PokeBattle_Move_030 < PokeBattle_Move
  1316. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1317. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1318. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1319. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1320. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1321. return ret ? 0 : -1
  1322. end
  1323.  
  1324. def pbAdditionalEffect(attacker,opponent)
  1325. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1326. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1327. end
  1328. end
  1329. end
  1330.  
  1331.  
  1332.  
  1333. ################################################################################
  1334. # Increases the user's Speed by 2 stages. Lowers user's weight by 100kg. (Autotomize)
  1335. ################################################################################
  1336. class PokeBattle_Move_031 < PokeBattle_Move
  1337. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1338. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1339. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1340. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1341. if ret
  1342. attacker.effects[PBEffects::WeightChange]-=1000
  1343. @battle.pbDisplay(_INTL("{1} became nimble!",attacker.pbThis))
  1344. end
  1345. return ret ? 0 : -1
  1346. end
  1347. end
  1348.  
  1349.  
  1350.  
  1351. ################################################################################
  1352. # Increases the user's Special Attack by 2 stages.
  1353. ################################################################################
  1354. class PokeBattle_Move_032 < PokeBattle_Move
  1355. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1356. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1357. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1358. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1359. ret=attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1360. return ret ? 0 : -1
  1361. end
  1362.  
  1363. def pbAdditionalEffect(attacker,opponent)
  1364. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1365. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1366. end
  1367. end
  1368. end
  1369.  
  1370.  
  1371.  
  1372. ################################################################################
  1373. # Increases the user's Special Defense by 2 stages.
  1374. ################################################################################
  1375. class PokeBattle_Move_033 < PokeBattle_Move
  1376. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1377. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1378. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  1379. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1380. ret=attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1381. return ret ? 0 : -1
  1382. end
  1383.  
  1384. def pbAdditionalEffect(attacker,opponent)
  1385. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1386. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1387. end
  1388. end
  1389. end
  1390.  
  1391.  
  1392.  
  1393. ################################################################################
  1394. # Increases the user's evasion by 2 stages. Minimizes the user. (Minimize)
  1395. ################################################################################
  1396. class PokeBattle_Move_034 < PokeBattle_Move
  1397. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1398. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1399. attacker.effects[PBEffects::Minimize]=true
  1400. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  1401. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1402. ret=attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1403. return ret ? 0 : -1
  1404. end
  1405.  
  1406. def pbAdditionalEffect(attacker,opponent)
  1407. attacker.effects[PBEffects::Minimize]=true
  1408. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  1409. attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1410. end
  1411. end
  1412. end
  1413.  
  1414.  
  1415.  
  1416. ################################################################################
  1417. # Decreases the user's Defense and Special Defense by 1 stage each. (Shell Smash)
  1418. # Increases the user's Attack, Speed and Special Attack by 2 stages each.
  1419. ################################################################################
  1420. class PokeBattle_Move_035 < PokeBattle_Move
  1421. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1422. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1423. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1424. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1425. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1426. return -1
  1427. end
  1428. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1429. showanim=true
  1430. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1431. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1432. showanim=false
  1433. end
  1434. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1435. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1436. showanim=false
  1437. end
  1438. showanim=true
  1439. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1440. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  1441. showanim=false
  1442. end
  1443. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1444. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  1445. showanim=false
  1446. end
  1447. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1448. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1449. showanim=false
  1450. end
  1451. return 0
  1452. end
  1453. end
  1454.  
  1455.  
  1456.  
  1457. ################################################################################
  1458. # Increases the user's Speed by 2 stages, and its Attack by 1 stage. (Shift Gear)
  1459. ################################################################################
  1460. class PokeBattle_Move_036 < PokeBattle_Move
  1461. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1462. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1463. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1464. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1465. return -1
  1466. end
  1467. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1468. showanim=true
  1469. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1470. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1471. showanim=false
  1472. end
  1473. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1474. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1475. showanim=false
  1476. end
  1477. return 0
  1478. end
  1479. end
  1480.  
  1481.  
  1482.  
  1483. ################################################################################
  1484. # Increases one random stat of the user by 2 stages (except HP). (Acupressure)
  1485. ################################################################################
  1486. class PokeBattle_Move_037 < PokeBattle_Move
  1487. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1488. if attacker.index!=opponent.index
  1489. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  1490. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1491. @battle.pbDisplay(_INTL("But it failed!"))
  1492. return -1
  1493. end
  1494. end
  1495. array=[]
  1496. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1497. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1498. array.push(i) if opponent.pbCanIncreaseStatStage?(i,attacker,false,self)
  1499. end
  1500. if array.length==0
  1501. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",opponent.pbThis))
  1502. return -1
  1503. end
  1504. stat=array[@battle.pbRandom(array.length)]
  1505. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1506. ret=opponent.pbIncreaseStat(stat,2,attacker,false,self)
  1507. return 0
  1508. end
  1509. end
  1510.  
  1511.  
  1512.  
  1513. ################################################################################
  1514. # Increases the user's Defense by 3 stages.
  1515. ################################################################################
  1516. class PokeBattle_Move_038 < PokeBattle_Move
  1517. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1518. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1519. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1520. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1521. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1522. return ret ? 0 : -1
  1523. end
  1524.  
  1525. def pbAdditionalEffect(attacker,opponent)
  1526. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1527. attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1528. end
  1529. end
  1530. end
  1531.  
  1532.  
  1533.  
  1534. ################################################################################
  1535. # Increases the user's Special Attack by 3 stages.
  1536. ################################################################################
  1537. class PokeBattle_Move_039 < PokeBattle_Move
  1538. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1539. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1540. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1541. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1542. ret=attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1543. return ret ? 0 : -1
  1544. end
  1545.  
  1546. def pbAdditionalEffect(attacker,opponent)
  1547. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1548. attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1549. end
  1550. end
  1551. end
  1552.  
  1553.  
  1554.  
  1555. ################################################################################
  1556. # Reduces the user's HP by half of max, and sets its Attack to maximum. (Belly Drum)
  1557. ################################################################################
  1558. class PokeBattle_Move_03A < PokeBattle_Move
  1559. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1560. if attacker.hp<=(attacker.totalhp/2).floor ||
  1561. !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1562. @battle.pbDisplay(_INTL("But it failed!"))
  1563. return -1
  1564. end
  1565. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1566. attacker.pbReduceHP((attacker.totalhp/2).floor)
  1567. if attacker.hasWorkingAbility(:CONTRARY)
  1568. attacker.stages[PBStats::ATTACK]=-6
  1569. @battle.pbCommonAnimation("StatDown",attacker,nil)
  1570. @battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",attacker.pbThis))
  1571. else
  1572. attacker.stages[PBStats::ATTACK]=6
  1573. @battle.pbCommonAnimation("StatUp",attacker,nil)
  1574. @battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",attacker.pbThis))
  1575. end
  1576. return 0
  1577. end
  1578. end
  1579.  
  1580.  
  1581.  
  1582. ################################################################################
  1583. # Decreases the user's Attack and Defense by 1 stage each. (Superpower)
  1584. ################################################################################
  1585. class PokeBattle_Move_03B < PokeBattle_Move
  1586. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1587. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1588. if opponent.damagestate.calcdamage>0
  1589. showanim=true
  1590. if attacker.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1591. attacker.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1592. showanim=false
  1593. end
  1594. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1595. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1596. showanim=false
  1597. end
  1598. end
  1599. return ret
  1600. end
  1601. end
  1602.  
  1603.  
  1604.  
  1605. ################################################################################
  1606. # Decreases the user's Defense and Special Defense by 1 stage each. (Close Combat)
  1607. ################################################################################
  1608. class PokeBattle_Move_03C < PokeBattle_Move
  1609. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1610. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1611. if opponent.damagestate.calcdamage>0
  1612. showanim=true
  1613. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1614. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1615. showanim=false
  1616. end
  1617. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1618. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1619. showanim=false
  1620. end
  1621. end
  1622. return ret
  1623. end
  1624. end
  1625.  
  1626.  
  1627.  
  1628. ################################################################################
  1629. # Decreases the user's Defense, Special Defense and Speed by 1 stage each.
  1630. # User's ally loses 1/16 of its total HP. (V-create)
  1631. ################################################################################
  1632. class PokeBattle_Move_03D < PokeBattle_Move
  1633. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1634. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1635. if opponent.damagestate.calcdamage>0
  1636. if attacker.pbPartner && !attacker.pbPartner.fainted?
  1637. attacker.pbPartner.pbReduceHP((attacker.pbPartner.totalhp/16).floor,true)
  1638. end
  1639. showanim=true
  1640. if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1641. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1642. showanim=false
  1643. end
  1644. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1645. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1646. showanim=false
  1647. end
  1648. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1649. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1650. showanim=false
  1651. end
  1652. end
  1653. return ret
  1654. end
  1655. end
  1656.  
  1657.  
  1658.  
  1659. ################################################################################
  1660. # Decreases the user's Speed by 1 stage.
  1661. ################################################################################
  1662. class PokeBattle_Move_03E < PokeBattle_Move
  1663. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1664. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1665. if opponent.damagestate.calcdamage>0
  1666. if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1667. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1668. end
  1669. end
  1670. return ret
  1671. end
  1672. end
  1673.  
  1674.  
  1675.  
  1676. ################################################################################
  1677. # Decreases the user's Special Attack by 2 stages.
  1678. ################################################################################
  1679. class PokeBattle_Move_03F < PokeBattle_Move
  1680. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1681. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1682. if opponent.damagestate.calcdamage>0
  1683. if attacker.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1684. attacker.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  1685. end
  1686. end
  1687. return ret
  1688. end
  1689. end
  1690.  
  1691.  
  1692.  
  1693. ################################################################################
  1694. # Increases the target's Special Attack by 1 stage. Confuses the target. (Flatter)
  1695. ################################################################################
  1696. class PokeBattle_Move_040 < PokeBattle_Move
  1697. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1698. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1699. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1700. return -1
  1701. end
  1702. ret=-1
  1703. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1704. if opponent.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1705. opponent.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  1706. ret=0
  1707. end
  1708. if opponent.pbCanConfuse?(attacker,true,self)
  1709. opponent.pbConfuse
  1710. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1711. ret=0
  1712. end
  1713. return ret
  1714. end
  1715. end
  1716.  
  1717.  
  1718.  
  1719. ################################################################################
  1720. # Increases the target's Attack by 2 stages. Confuses the target. (Swagger)
  1721. ################################################################################
  1722. class PokeBattle_Move_041 < PokeBattle_Move
  1723. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1724. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1725. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1726. return -1
  1727. end
  1728. ret=-1
  1729. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1730. if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1731. opponent.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1732. ret=0
  1733. end
  1734. if opponent.pbCanConfuse?(attacker,true,self)
  1735. opponent.pbConfuse
  1736. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1737. ret=0
  1738. end
  1739. return ret
  1740. end
  1741. end
  1742.  
  1743.  
  1744.  
  1745. ################################################################################
  1746. # Decreases the target's Attack by 1 stage.
  1747. ################################################################################
  1748. class PokeBattle_Move_042 < PokeBattle_Move
  1749. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1750. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1751. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  1752. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1753. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1754. return ret ? 0 : -1
  1755. end
  1756.  
  1757. def pbAdditionalEffect(attacker,opponent)
  1758. return if opponent.damagestate.substitute
  1759. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1760. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1761. end
  1762. end
  1763. end
  1764.  
  1765.  
  1766.  
  1767. ################################################################################
  1768. # Decreases the target's Defense by 1 stage.
  1769. ################################################################################
  1770. class PokeBattle_Move_043 < PokeBattle_Move
  1771. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1772. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1773. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  1774. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1775. ret=opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1776. return ret ? 0 : -1
  1777. end
  1778.  
  1779. def pbAdditionalEffect(attacker,opponent)
  1780. return if opponent.damagestate.substitute
  1781. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1782. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1783. end
  1784. end
  1785. end
  1786.  
  1787.  
  1788.  
  1789. ################################################################################
  1790. # Decreases the target's Speed by 1 stage.
  1791. ################################################################################
  1792. class PokeBattle_Move_044 < PokeBattle_Move
  1793. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1794. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1795. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  1796. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1797. ret=opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1798. return ret ? 0 : -1
  1799. end
  1800.  
  1801. def pbAdditionalEffect(attacker,opponent)
  1802. return if opponent.damagestate.substitute
  1803. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1804. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1805. end
  1806. end
  1807.  
  1808. def pbModifyDamage(damagemult,attacker,opponent)
  1809. if isConst?(@id,PBMoves,:BULLDOZE) &&
  1810. @battle.field.effects[PBEffects::GrassyTerrain]>0
  1811. return (damagemult/2.0).round
  1812. end
  1813. return damagemult
  1814. end
  1815. end
  1816.  
  1817.  
  1818.  
  1819. ################################################################################
  1820. # Decreases the target's Special Attack by 1 stage.
  1821. ################################################################################
  1822. class PokeBattle_Move_045 < PokeBattle_Move
  1823. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1824. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1825. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  1826. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1827. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1828. return ret ? 0 : -1
  1829. end
  1830.  
  1831. def pbAdditionalEffect(attacker,opponent)
  1832. return if opponent.damagestate.substitute
  1833. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1834. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1835. end
  1836. end
  1837. end
  1838.  
  1839.  
  1840.  
  1841. ################################################################################
  1842. # Decreases the target's Special Defense by 1 stage.
  1843. ################################################################################
  1844. class PokeBattle_Move_046 < PokeBattle_Move
  1845. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1846. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1847. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  1848. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1849. ret=opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1850. return ret ? 0 : -1
  1851. end
  1852.  
  1853. def pbAdditionalEffect(attacker,opponent)
  1854. return if opponent.damagestate.substitute
  1855. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1856. opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1857. end
  1858. end
  1859. end
  1860.  
  1861.  
  1862.  
  1863. ################################################################################
  1864. # Decreases the target's accuracy by 1 stage.
  1865. ################################################################################
  1866. class PokeBattle_Move_047 < PokeBattle_Move
  1867. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1868. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1869. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,true,self)
  1870. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1871. ret=opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1872. return ret ? 0 : -1
  1873. end
  1874.  
  1875. def pbAdditionalEffect(attacker,opponent)
  1876. return if opponent.damagestate.substitute
  1877. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  1878. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1879. end
  1880. end
  1881. end
  1882.  
  1883.  
  1884.  
  1885. ################################################################################
  1886. # Decreases the target's evasion by 1 stage OR 2 stages. (Sweet Scent)
  1887. ################################################################################
  1888. class PokeBattle_Move_048 < PokeBattle_Move
  1889. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1890. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1891. return -1 if !opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,true,self)
  1892. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1893. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1894. ret=opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1895. return ret ? 0 : -1
  1896. end
  1897.  
  1898. def pbAdditionalEffect(attacker,opponent)
  1899. return if opponent.damagestate.substitute
  1900. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1901. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1902. opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1903. end
  1904. end
  1905. end
  1906.  
  1907.  
  1908.  
  1909. ################################################################################
  1910. # Decreases the target's evasion by 1 stage. Ends all barriers and entry
  1911. # hazards for the target's side OR on both sides. (Defog)
  1912. ################################################################################
  1913. class PokeBattle_Move_049 < PokeBattle_Move
  1914. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1915. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1916. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1917. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1918. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1919. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1920. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1921. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1922. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1923. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1924. opponent.pbOwnSide.effects[PBEffects::StickyWeb] = false
  1925. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1926. opponent.pbOwnSide.effects[PBEffects::AuroraVeil] = 0
  1927. if USENEWBATTLEMECHANICS
  1928. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1929. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1930. opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = false
  1931. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1932. end
  1933. return 0
  1934. end
  1935.  
  1936. def pbAdditionalEffect(attacker,opponent)
  1937. if !opponent.damagestate.substitute
  1938. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1939. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1940. end
  1941. end
  1942. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1943. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1944. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1945. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1946. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1947. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1948. opponent.pbOwnSide.effects[PBEffects::StickyWeb] = false
  1949. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1950. opponent.pbOwnSide.effects[PBEffects::AuroraVeil] = 0
  1951. if USENEWBATTLEMECHANICS
  1952. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1953. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1954. opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = false
  1955. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1956. end
  1957. end
  1958. end
  1959.  
  1960.  
  1961.  
  1962. ################################################################################
  1963. # Decreases the target's Attack and Defense by 1 stage each. (Tickle)
  1964. ################################################################################
  1965. class PokeBattle_Move_04A < PokeBattle_Move
  1966. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1967. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  1968. # multiple times
  1969. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1970. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1971. return -1
  1972. end
  1973. if opponent.pbTooLow?(PBStats::ATTACK) &&
  1974. opponent.pbTooLow?(PBStats::DEFENSE)
  1975. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  1976. return -1
  1977. end
  1978. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  1979. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  1980. return -1
  1981. end
  1982. if opponent.hasWorkingAbility(:FULLMETALBODY)
  1983. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  1984. PBAbilities.getName(opponent.ability)))
  1985. return -1
  1986. end
  1987. if !attacker.hasMoldBreaker
  1988. if opponent.hasWorkingAbility(:CLEARBODY) ||
  1989. opponent.hasWorkingAbility(:WHITESMOKE)
  1990. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  1991. PBAbilities.getName(opponent.ability)))
  1992. return -1
  1993. end
  1994. end
  1995. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1996. ret=-1; showanim=true
  1997. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER) &&
  1998. !opponent.pbTooLow?(PBStats::ATTACK)
  1999. abilityname=PBAbilities.getName(opponent.ability)
  2000. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  2001. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  2002. ret=0; showanim=false
  2003. end
  2004. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:BIGPECKS) &&
  2005. !opponent.pbTooLow?(PBStats::DEFENSE)
  2006. abilityname=PBAbilities.getName(opponent.ability)
  2007. @battle.pbDisplay(_INTL("{1}'s {2} prevents Defense loss!",opponent.pbThis,abilityname))
  2008. elsif opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  2009. ret=0; showanim=false
  2010. end
  2011. return ret
  2012. end
  2013. end
  2014.  
  2015.  
  2016.  
  2017. ################################################################################
  2018. # Decreases the target's Attack by 2 stages.
  2019. ################################################################################
  2020. class PokeBattle_Move_04B < PokeBattle_Move
  2021. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2022. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2023. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  2024. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2025. ret=opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2026. return ret ? 0 : -1
  2027. end
  2028.  
  2029. def pbAdditionalEffect(attacker,opponent)
  2030. return if opponent.damagestate.substitute
  2031. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  2032. opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2033. end
  2034. end
  2035. end
  2036.  
  2037.  
  2038.  
  2039. ################################################################################
  2040. # Decreases the target's Defense by 2 stages. (Screech)
  2041. ################################################################################
  2042. class PokeBattle_Move_04C < PokeBattle_Move
  2043. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2044. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2045. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  2046. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2047. ret=opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2048. return ret ? 0 : -1
  2049. end
  2050.  
  2051. def pbAdditionalEffect(attacker,opponent)
  2052. return if opponent.damagestate.substitute
  2053. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  2054. opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2055. end
  2056. end
  2057. end
  2058.  
  2059.  
  2060.  
  2061. ################################################################################
  2062. # Decreases the target's Speed by 2 stages. (Cotton Spore, Scary Face, String Shot)
  2063. ################################################################################
  2064. class PokeBattle_Move_04D < PokeBattle_Move
  2065. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2066. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2067. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2068. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  2069. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2070. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2071. ret=opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2072. return ret ? 0 : -1
  2073. end
  2074.  
  2075. def pbAdditionalEffect(attacker,opponent)
  2076. return if opponent.damagestate.substitute
  2077. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  2078. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2079. opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2080. end
  2081. end
  2082. end
  2083.  
  2084.  
  2085.  
  2086. ################################################################################
  2087. # Decreases the target's Special Attack by 2 stages. Only works on the opposite
  2088. # gender. (Captivate)
  2089. ################################################################################
  2090. class PokeBattle_Move_04E < PokeBattle_Move
  2091. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2092. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2093. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  2094. if attacker.gender==2 || opponent.gender==2 || attacker.gender==opponent.gender
  2095. @battle.pbDisplay(_INTL("But it failed!"))
  2096. return -1
  2097. end
  2098. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS)
  2099. @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",opponent.pbThis,
  2100. PBAbilities.getName(opponent.ability)))
  2101. return -1
  2102. end
  2103. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2104. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2105. return ret ? 0 : -1
  2106. end
  2107.  
  2108. def pbAdditionalEffect(attacker,opponent)
  2109. return if opponent.damagestate.substitute
  2110. if attacker.gender!=2 && opponent.gender!=2 && attacker.gender!=opponent.gender
  2111. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:OBLIVIOUS)
  2112. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  2113. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2114. end
  2115. end
  2116. end
  2117. end
  2118. end
  2119.  
  2120.  
  2121.  
  2122. ################################################################################
  2123. # Decreases the target's Special Defense by 2 stages.
  2124. ################################################################################
  2125. class PokeBattle_Move_04F < PokeBattle_Move
  2126. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2127. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2128. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  2129. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2130. ret=opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2131. return ret ? 0 : -1
  2132. end
  2133.  
  2134. def pbAdditionalEffect(attacker,opponent)
  2135. return if opponent.damagestate.substitute
  2136. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  2137. opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2138. end
  2139. end
  2140. end
  2141.  
  2142.  
  2143.  
  2144. ################################################################################
  2145. # Resets all target's stat stages to 0. (Clear Smog)
  2146. ################################################################################
  2147. class PokeBattle_Move_050 < PokeBattle_Move
  2148. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2149. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  2150. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  2151. opponent.stages[PBStats::ATTACK] = 0
  2152. opponent.stages[PBStats::DEFENSE] = 0
  2153. opponent.stages[PBStats::SPEED] = 0
  2154. opponent.stages[PBStats::SPATK] = 0
  2155. opponent.stages[PBStats::SPDEF] = 0
  2156. opponent.stages[PBStats::ACCURACY] = 0
  2157. opponent.stages[PBStats::EVASION] = 0
  2158. @battle.pbDisplay(_INTL("{1}'s stat changes were removed!",opponent.pbThis))
  2159. end
  2160. return ret
  2161. end
  2162. end
  2163.  
  2164.  
  2165.  
  2166. ################################################################################
  2167. # Resets all stat stages for all battlers to 0. (Haze)
  2168. ################################################################################
  2169. class PokeBattle_Move_051 < PokeBattle_Move
  2170. def doesIgnoreDazzling?
  2171. return true
  2172. end
  2173.  
  2174. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2175. for i in 0...4
  2176. @battle.battlers[i].stages[PBStats::ATTACK] = 0
  2177. @battle.battlers[i].stages[PBStats::DEFENSE] = 0
  2178. @battle.battlers[i].stages[PBStats::SPEED] = 0
  2179. @battle.battlers[i].stages[PBStats::SPATK] = 0
  2180. @battle.battlers[i].stages[PBStats::SPDEF] = 0
  2181. @battle.battlers[i].stages[PBStats::ACCURACY] = 0
  2182. @battle.battlers[i].stages[PBStats::EVASION] = 0
  2183. end
  2184. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2185. @battle.pbDisplay(_INTL("All stat changes were eliminated!"))
  2186. return 0
  2187. end
  2188. end
  2189.  
  2190.  
  2191.  
  2192. ################################################################################
  2193. # User and target swap their Attack and Special Attack stat stages. (Power Swap)
  2194. ################################################################################
  2195. class PokeBattle_Move_052 < PokeBattle_Move
  2196. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2197. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2198. astage=attacker.stages
  2199. ostage=opponent.stages
  2200. astage[PBStats::ATTACK],ostage[PBStats::ATTACK]=ostage[PBStats::ATTACK],astage[PBStats::ATTACK]
  2201. astage[PBStats::SPATK],ostage[PBStats::SPATK]=ostage[PBStats::SPATK],astage[PBStats::SPATK]
  2202. @battle.pbDisplay(_INTL("{1} switched all changes to its Attack and Sp. Atk with the target!",attacker.pbThis))
  2203. return 0
  2204. end
  2205. end
  2206.  
  2207.  
  2208.  
  2209. ################################################################################
  2210. # User and target swap their Defense and Special Defense stat stages. (Guard Swap)
  2211. ################################################################################
  2212. class PokeBattle_Move_053 < PokeBattle_Move
  2213. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2214. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2215. astage=attacker.stages
  2216. ostage=opponent.stages
  2217. astage[PBStats::DEFENSE],ostage[PBStats::DEFENSE]=ostage[PBStats::DEFENSE],astage[PBStats::DEFENSE]
  2218. astage[PBStats::SPDEF],ostage[PBStats::SPDEF]=ostage[PBStats::SPDEF],astage[PBStats::SPDEF]
  2219. @battle.pbDisplay(_INTL("{1} switched all changes to its Defense and Sp. Def with the target!",attacker.pbThis))
  2220. return 0
  2221. end
  2222. end
  2223.  
  2224.  
  2225.  
  2226. ################################################################################
  2227. # User and target swap all their stat stages. (Heart Swap)
  2228. ################################################################################
  2229. class PokeBattle_Move_054 < PokeBattle_Move
  2230. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2231. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2232. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2233. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2234. attacker.stages[i],opponent.stages[i]=opponent.stages[i],attacker.stages[i]
  2235. end
  2236. @battle.pbDisplay(_INTL("{1} switched stat changes with the target!",attacker.pbThis))
  2237. return 0
  2238. end
  2239. end
  2240.  
  2241.  
  2242.  
  2243. ################################################################################
  2244. # User copies the target's stat stages. (Psych Up)
  2245. ################################################################################
  2246. class PokeBattle_Move_055 < PokeBattle_Move
  2247. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2248. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2249. @battle.pbDisplay(_INTL("But it failed!"))
  2250. return -1
  2251. end
  2252. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2253. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2254. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2255. attacker.stages[i]=opponent.stages[i]
  2256. end
  2257. @battle.pbDisplay(_INTL("{1} copied {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  2258. return 0
  2259. end
  2260. end
  2261.  
  2262.  
  2263.  
  2264. ################################################################################
  2265. # For 5 rounds, user's and ally's stat stages cannot be lowered by foes. (Mist)
  2266. ################################################################################
  2267. class PokeBattle_Move_056 < PokeBattle_Move
  2268. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2269. if attacker.pbOwnSide.effects[PBEffects::Mist]>0
  2270. @battle.pbDisplay(_INTL("But it failed!"))
  2271. return -1
  2272. end
  2273. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2274. attacker.pbOwnSide.effects[PBEffects::Mist]=5
  2275. if !@battle.pbIsOpposing?(attacker.index)
  2276. @battle.pbDisplay(_INTL("Your team became shrouded in mist!"))
  2277. else
  2278. @battle.pbDisplay(_INTL("The opposing team became shrouded in mist!"))
  2279. end
  2280. return 0
  2281. end
  2282. end
  2283.  
  2284.  
  2285.  
  2286. ################################################################################
  2287. # Swaps the user's Attack and Defense stats. (Power Trick)
  2288. ################################################################################
  2289. class PokeBattle_Move_057 < PokeBattle_Move
  2290. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2291. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2292. attacker.attack,attacker.defense=attacker.defense,attacker.attack
  2293. attacker.effects[PBEffects::PowerTrick]=!attacker.effects[PBEffects::PowerTrick]
  2294. @battle.pbDisplay(_INTL("{1} switched its Attack and Defense!",attacker.pbThis))
  2295. return 0
  2296. end
  2297. end
  2298.  
  2299.  
  2300.  
  2301. ################################################################################
  2302. # Averages the user's and target's Attack.
  2303. # Averages the user's and target's Special Attack. (Power Split)
  2304. ################################################################################
  2305. class PokeBattle_Move_058 < PokeBattle_Move
  2306. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2307. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2308. @battle.pbDisplay(_INTL("But it failed!"))
  2309. return -1
  2310. end
  2311. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2312. avatk=((attacker.attack+opponent.attack)/2).floor
  2313. avspatk=((attacker.spatk+opponent.spatk)/2).floor
  2314. attacker.attack=opponent.attack=avatk
  2315. attacker.spatk=opponent.spatk=avspatk
  2316. @battle.pbDisplay(_INTL("{1} shared its power with the target!",attacker.pbThis))
  2317. return 0
  2318. end
  2319. end
  2320.  
  2321.  
  2322.  
  2323. ################################################################################
  2324. # Averages the user's and target's Defense.
  2325. # Averages the user's and target's Special Defense. (Guard Split)
  2326. ################################################################################
  2327. class PokeBattle_Move_059 < PokeBattle_Move
  2328. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2329. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2330. @battle.pbDisplay(_INTL("But it failed!"))
  2331. return -1
  2332. end
  2333. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2334. avdef=((attacker.defense+opponent.defense)/2).floor
  2335. avspdef=((attacker.spdef+opponent.spdef)/2).floor
  2336. attacker.defense=opponent.defense=avdef
  2337. attacker.spdef=opponent.spdef=avspdef
  2338. @battle.pbDisplay(_INTL("{1} shared its guard with the target!",attacker.pbThis))
  2339. return 0
  2340. end
  2341. end
  2342.  
  2343.  
  2344.  
  2345. ################################################################################
  2346. # Averages the user's and target's current HP. (Pain Split)
  2347. ################################################################################
  2348. class PokeBattle_Move_05A < PokeBattle_Move
  2349. def isHealingMove?
  2350. return true
  2351. end
  2352.  
  2353. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2354. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2355. @battle.pbDisplay(_INTL("But it failed!"))
  2356. return -1
  2357. end
  2358. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2359. olda=attacker.hp
  2360. oldo=opponent.hp
  2361. avhp=((attacker.hp+opponent.hp)/2).floor
  2362. attacker.hp=[avhp,attacker.totalhp].min
  2363. opponent.hp=[avhp,opponent.totalhp].min
  2364. @battle.scene.pbHPChanged(attacker,olda)
  2365. @battle.scene.pbHPChanged(opponent,oldo)
  2366. @battle.pbDisplay(_INTL("The battlers shared their pain!"))
  2367. return 0
  2368. end
  2369. end
  2370.  
  2371.  
  2372.  
  2373. ################################################################################
  2374. # For 4 rounds, doubles the Speed of all battlers on the user's side. (Tailwind)
  2375. ################################################################################
  2376. class PokeBattle_Move_05B < PokeBattle_Move
  2377. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2378. if attacker.pbOwnSide.effects[PBEffects::Tailwind]>0
  2379. @battle.pbDisplay(_INTL("But it failed!"))
  2380. return -1
  2381. end
  2382. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2383. attacker.pbOwnSide.effects[PBEffects::Tailwind]=4
  2384. if !@battle.pbIsOpposing?(attacker.index)
  2385. @battle.pbDisplay(_INTL("The tailwind blew from behind your team!"))
  2386. else
  2387. @battle.pbDisplay(_INTL("The tailwind blew from behind the opposing team!"))
  2388. end
  2389. return 0
  2390. end
  2391. end
  2392.  
  2393.  
  2394.  
  2395. ################################################################################
  2396. # This move turns into the last move used by the target, until user switches
  2397. # out. (Mimic)
  2398. ################################################################################
  2399. class PokeBattle_Move_05C < PokeBattle_Move
  2400. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2401. blacklist=[
  2402. 0x02, # Struggle
  2403. 0x14, # Chatter
  2404. 0x5C, # Mimic
  2405. 0x5D, # Sketch
  2406. 0xB6 # Metronome
  2407. ]
  2408. if attacker.effects[PBEffects::Transform] ||
  2409. opponent.lastMoveUsed<=0 ||
  2410. isConst?(PBMoveData.new(opponent.lastMoveUsed).type,PBTypes,:SHADOW) ||
  2411. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  2412. @battle.pbDisplay(_INTL("But it failed!"))
  2413. return -1
  2414. end
  2415. for i in attacker.moves
  2416. if i.id==opponent.lastMoveUsed
  2417. @battle.pbDisplay(_INTL("But it failed!"))
  2418. return -1
  2419. end
  2420. end
  2421. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2422. for i in 0...attacker.moves.length
  2423. if attacker.moves[i].id==@id
  2424. newmove=PBMove.new(opponent.lastMoveUsed)
  2425. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2426. movename=PBMoves.getName(opponent.lastMoveUsed)
  2427. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2428. return 0
  2429. end
  2430. end
  2431. @battle.pbDisplay(_INTL("But it failed!"))
  2432. return -1
  2433. end
  2434. end
  2435.  
  2436.  
  2437.  
  2438. ################################################################################
  2439. # This move permanently turns into the last move used by the target. (Sketch)
  2440. ################################################################################
  2441. class PokeBattle_Move_05D < PokeBattle_Move
  2442. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2443. blacklist=[
  2444. 0x02, # Struggle
  2445. 0x14, # Chatter
  2446. 0x5D # Sketch
  2447. ]
  2448. if attacker.effects[PBEffects::Transform] ||
  2449. opponent.lastMoveUsedSketch<=0 ||
  2450. isConst?(PBMoveData.new(opponent.lastMoveUsedSketch).type,PBTypes,:SHADOW) ||
  2451. blacklist.include?(PBMoveData.new(opponent.lastMoveUsedSketch).function)
  2452. @battle.pbDisplay(_INTL("But it failed!"))
  2453. return -1
  2454. end
  2455. for i in attacker.moves
  2456. if i.id==opponent.lastMoveUsedSketch
  2457. @battle.pbDisplay(_INTL("But it failed!"))
  2458. return -1
  2459. end
  2460. end
  2461. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2462. @battle.pbDisplay(_INTL("But it failed!"))
  2463. return -1
  2464. end
  2465. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2466. for i in 0...attacker.moves.length
  2467. if attacker.moves[i].id==@id
  2468. newmove=PBMove.new(opponent.lastMoveUsedSketch)
  2469. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2470. party=@battle.pbParty(attacker.index)
  2471. party[attacker.pokemonIndex].moves[i]=newmove
  2472. movename=PBMoves.getName(opponent.lastMoveUsedSketch)
  2473. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2474. return 0
  2475. end
  2476. end
  2477. @battle.pbDisplay(_INTL("But it failed!"))
  2478. return -1
  2479. end
  2480. end
  2481.  
  2482.  
  2483.  
  2484. ################################################################################
  2485. # Changes user's type to that of a random user's move, except this one, OR the
  2486. # user's first move's type. (Conversion)
  2487. ################################################################################
  2488. class PokeBattle_Move_05E < PokeBattle_Move
  2489. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2490. types=[]
  2491. for i in attacker.moves
  2492. next if i.id==@id
  2493. next if PBTypes.isPseudoType?(i.type)
  2494. next if attacker.pbHasType?(i.type)
  2495. if !types.include?(i.type)
  2496. types.push(i.type)
  2497. break if USENEWBATTLEMECHANICS
  2498. end
  2499. end
  2500. if types.length==0
  2501. @battle.pbDisplay(_INTL("But it failed!"))
  2502. return -1
  2503. end
  2504. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2505. newtype=types[@battle.pbRandom(types.length)]
  2506. attacker.type1=newtype
  2507. attacker.type2=newtype
  2508. attacker.effects[PBEffects::Type3]=-1
  2509. typename=PBTypes.getName(newtype)
  2510. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2511. end
  2512. end
  2513.  
  2514.  
  2515.  
  2516. ################################################################################
  2517. # Changes user's type to a random one that resists/is immune to the last move
  2518. # used by the target. (Conversion 2)
  2519. ################################################################################
  2520. class PokeBattle_Move_05F < PokeBattle_Move
  2521. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2522. if opponent.lastMoveUsed<=0 ||
  2523. PBTypes.isPseudoType?(PBMoveData.new(opponent.lastMoveUsed).type)
  2524. @battle.pbDisplay(_INTL("But it failed!"))
  2525. return -1
  2526. end
  2527. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2528. @battle.pbDisplay(_INTL("But it failed!"))
  2529. return -1
  2530. end
  2531. types=[]
  2532. atype=opponent.lastMoveUsedType
  2533. if atype<0
  2534. @battle.pbDisplay(_INTL("But it failed!"))
  2535. return -1
  2536. end
  2537. for i in 0..PBTypes.maxValue
  2538. next if PBTypes.isPseudoType?(i)
  2539. next if attacker.pbHasType?(i)
  2540. types.push(i) if PBTypes.getEffectiveness(atype,i)<2
  2541. end
  2542. if types.length==0
  2543. @battle.pbDisplay(_INTL("But it failed!"))
  2544. return -1
  2545. end
  2546. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2547. newtype=types[@battle.pbRandom(types.length)]
  2548. attacker.type1=newtype
  2549. attacker.type2=newtype
  2550. attacker.effects[PBEffects::Type3]=-1
  2551. typename=PBTypes.getName(newtype)
  2552. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2553. return 0
  2554. end
  2555. end
  2556.  
  2557.  
  2558.  
  2559. ################################################################################
  2560. # Changes user's type depending on the environment. (Camouflage)
  2561. ################################################################################
  2562. class PokeBattle_Move_060 < PokeBattle_Move
  2563. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2564. type=getConst(PBTypes,:NORMAL) || 0
  2565. case @battle.environment
  2566. when PBEnvironment::None; type=getConst(PBTypes,:NORMAL) || 0
  2567. when PBEnvironment::Grass; type=getConst(PBTypes,:GRASS) || 0
  2568. when PBEnvironment::TallGrass; type=getConst(PBTypes,:GRASS) || 0
  2569. when PBEnvironment::MovingWater; type=getConst(PBTypes,:WATER) || 0
  2570. when PBEnvironment::StillWater; type=getConst(PBTypes,:WATER) || 0
  2571. when PBEnvironment::Underwater; type=getConst(PBTypes,:WATER) || 0
  2572. when PBEnvironment::Cave; type=getConst(PBTypes,:ROCK) || 0
  2573. when PBEnvironment::Rock; type=getConst(PBTypes,:GROUND) || 0
  2574. when PBEnvironment::Sand; type=getConst(PBTypes,:GROUND) || 0
  2575. when PBEnvironment::Forest; type=getConst(PBTypes,:BUG) || 0
  2576. when PBEnvironment::Snow; type=getConst(PBTypes,:ICE) || 0
  2577. when PBEnvironment::Volcano; type=getConst(PBTypes,:FIRE) || 0
  2578. when PBEnvironment::Graveyard; type=getConst(PBTypes,:GHOST) || 0
  2579. when PBEnvironment::Sky; type=getConst(PBTypes,:FLYING) || 0
  2580. when PBEnvironment::Space; type=getConst(PBTypes,:DRAGON) || 0
  2581. end
  2582. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  2583. type=getConst(PBTypes,:ELECTRIC) if hasConst?(PBTypes,:ELECTRIC)
  2584. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  2585. type=getConst(PBTypes,:GRASS) if hasConst?(PBTypes,:GRASS)
  2586. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  2587. type=getConst(PBTypes,:FAIRY) if hasConst?(PBTypes,:FAIRY)
  2588. elsif @battle.field.effects[PBEffects::PsychicTerrain]>0
  2589. type=getConst(PBTypes,:PSYCHIC) if hasConst?(PBTypes,:PSYCHIC)
  2590. end
  2591. if attacker.pbHasType?(type)
  2592. @battle.pbDisplay(_INTL("But it failed!"))
  2593. return -1
  2594. end
  2595. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2596. attacker.type1=type
  2597. attacker.type2=type
  2598. attacker.effects[PBEffects::Type3]=-1
  2599. typename=PBTypes.getName(type)
  2600. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2601. return 0
  2602. end
  2603. end
  2604.  
  2605.  
  2606.  
  2607. ################################################################################
  2608. # Target becomes Water type. (Soak)
  2609. ################################################################################
  2610. class PokeBattle_Move_061 < PokeBattle_Move
  2611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2612. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2613. @battle.pbDisplay(_INTL("But it failed!"))
  2614. return -1
  2615. end
  2616. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2617. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2618. if opponent.type1==getConst(PBTypes,:WATER) &&
  2619. opponent.type2==getConst(PBTypes,:WATER) &&
  2620. (opponent.effects[PBEffects::Type3]<0 ||
  2621. opponent.effects[PBEffects::Type3]==getConst(PBTypes,:WATER))
  2622. @battle.pbDisplay(_INTL("But it failed!"))
  2623. return -1
  2624. end
  2625. opponent.type1=getConst(PBTypes,:WATER)
  2626. opponent.type2=getConst(PBTypes,:WATER)
  2627. opponent.effects[PBEffects::Type3]=-1
  2628. typename=PBTypes.getName(getConst(PBTypes,:WATER))
  2629. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  2630. return 0
  2631. end
  2632. end
  2633.  
  2634.  
  2635.  
  2636. ################################################################################
  2637. # User copes target's types. (Reflect Type)
  2638. ################################################################################
  2639. class PokeBattle_Move_062 < PokeBattle_Move
  2640. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  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. isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
  2675. isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
  2676. isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
  2677. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2678. isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
  2679. isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN)
  2680. @battle.pbDisplay(_INTL("But it failed!"))
  2681. return -1
  2682. end
  2683. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2684. oldabil=opponent.ability
  2685. opponent.ability=getConst(PBAbilities,:SIMPLE) || 0
  2686. abilityname=PBAbilities.getName(getConst(PBAbilities,:SIMPLE))
  2687. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2688. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2689. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2690. opponent.effects[PBEffects::Illusion]=nil
  2691. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2692. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2693. end
  2694. return 0
  2695. end
  2696. end
  2697.  
  2698.  
  2699.  
  2700. ################################################################################
  2701. # Target's ability becomes Insomnia. (Worry Seed)
  2702. ################################################################################
  2703. class PokeBattle_Move_064 < PokeBattle_Move
  2704. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2705. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2706. @battle.pbDisplay(_INTL("But it failed!"))
  2707. return -1
  2708. end
  2709. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2710. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2711. isConst?(opponent.ability,PBAbilities,:INSOMNIA) ||
  2712. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2713. isConst?(opponent.ability,PBAbilities,:TRUANT) ||
  2714. isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
  2715. isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
  2716. isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
  2717. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2718. isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
  2719. isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN)
  2720. @battle.pbDisplay(_INTL("But it failed!"))
  2721. return -1
  2722. end
  2723. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2724. oldabil=opponent.ability
  2725. opponent.ability=getConst(PBAbilities,:INSOMNIA) || 0
  2726. abilityname=PBAbilities.getName(getConst(PBAbilities,:INSOMNIA))
  2727. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2728. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2729. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2730. opponent.effects[PBEffects::Illusion]=nil
  2731. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2732. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2733. end
  2734. return 0
  2735. end
  2736. end
  2737.  
  2738.  
  2739.  
  2740. ################################################################################
  2741. # User copies target's ability. (Role Play)
  2742. ################################################################################
  2743. class PokeBattle_Move_065 < PokeBattle_Move
  2744. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2745. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2746. @battle.pbDisplay(_INTL("But it failed!"))
  2747. return -1
  2748. end
  2749. if opponent.ability==0 ||
  2750. attacker.ability==opponent.ability ||
  2751. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2752. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2753. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2754. isConst?(opponent.ability,PBAbilities,:FORECAST) ||
  2755. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2756. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2757. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2758. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2759. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2760. isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2761. isConst?(opponent.ability,PBAbilities,:ZENMODE) ||
  2762. isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
  2763. isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
  2764. isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
  2765. isConst?(opponent.ability,PBAbilities,:POWEROFALCHEMY) ||
  2766. isConst?(opponent.ability,PBAbilities,:RECEIVER) ||
  2767. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2768. isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
  2769. isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN)
  2770. @battle.pbDisplay(_INTL("But it failed!"))
  2771. return -1
  2772. end
  2773. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2774. oldabil=attacker.ability
  2775. attacker.ability=opponent.ability
  2776. abilityname=PBAbilities.getName(opponent.ability)
  2777. @battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),abilityname))
  2778. if attacker.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2779. PBDebug.log("[Ability triggered] #{attacker.pbThis}'s Illusion ended")
  2780. attacker.effects[PBEffects::Illusion]=nil
  2781. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  2782. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",attacker.pbThis,PBAbilities.getName(oldabil)))
  2783. end
  2784. return 0
  2785. end
  2786. end
  2787.  
  2788.  
  2789.  
  2790. ################################################################################
  2791. # Target copies user's ability. (Entrainment)
  2792. ################################################################################
  2793. class PokeBattle_Move_066 < PokeBattle_Move
  2794. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2795. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2796. @battle.pbDisplay(_INTL("But it failed!"))
  2797. return -1
  2798. end
  2799. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2800. @battle.pbDisplay(_INTL("But it failed!"))
  2801. return -1
  2802. end
  2803. if attacker.ability==0 ||
  2804. attacker.ability==opponent.ability ||
  2805. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2806. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2807. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2808. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2809. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2810. isConst?(opponent.ability,PBAbilities,:TRUANT) ||
  2811. isConst?(opponent.ability,PBAbilities,:ZENMODE) ||
  2812. isConst?(attacker.ability,PBAbilities,:FLOWERGIFT) ||
  2813. isConst?(attacker.ability,PBAbilities,:FORECAST) ||
  2814. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2815. isConst?(attacker.ability,PBAbilities,:IMPOSTER) ||
  2816. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2817. isConst?(attacker.ability,PBAbilities,:TRACE) ||
  2818. isConst?(attacker.ability,PBAbilities,:ZENMODE) ||
  2819. isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
  2820. isConst?(attacker.ability,PBAbilities,:COMATOSE) ||
  2821. isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
  2822. isConst?(attacker.ability,PBAbilities,:BATTLEBOND) ||
  2823. isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT) ||
  2824. isConst?(attacker.ability,PBAbilities,:POWERCONSTRUCT) ||
  2825. isConst?(attacker.ability,PBAbilities,:POWEROFALCHEMY) ||
  2826. isConst?(attacker.ability,PBAbilities,:RECEIVER) ||
  2827. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2828. isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
  2829. isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN)
  2830.  
  2831. @battle.pbDisplay(_INTL("But it failed!"))
  2832. return -1
  2833. end
  2834. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2835. oldabil=opponent.ability
  2836. opponent.ability=attacker.ability
  2837. abilityname=PBAbilities.getName(attacker.ability)
  2838. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2839. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2840. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2841. opponent.effects[PBEffects::Illusion]=nil
  2842. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2843. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2844. end
  2845. return 0
  2846. end
  2847. end
  2848.  
  2849.  
  2850.  
  2851. ################################################################################
  2852. # User and target swap abilities. (Skill Swap)
  2853. ################################################################################
  2854. class PokeBattle_Move_067 < PokeBattle_Move
  2855. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2856. if (attacker.ability==0 && opponent.ability==0) ||
  2857. (attacker.ability==opponent.ability && !USENEWBATTLEMECHANICS) ||
  2858. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2859. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2860. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2861. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2862. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2863. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2864. isConst?(attacker.ability,PBAbilities,:WONDERGUARD) ||
  2865. isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2866. isConst?(attacker.ability,PBAbilities,:COMATOSE) ||
  2867. isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
  2868. isConst?(attacker.ability,PBAbilities,:BATTLEBOND) ||
  2869. isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
  2870. isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT) ||
  2871. isConst?(attacker.ability,PBAbilities,:POWERCONSTRUCT) ||
  2872. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2873. isConst?(attacker.ability,PBAbilities,:RKSSYSTEM) ||
  2874. isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
  2875. isConst?(attacker.ability,PBAbilities,:SCHOOLING) ||
  2876. isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN) ||
  2877. isConst?(attacker.ability,PBAbilities,:SHIELDSDOWN)
  2878. @battle.pbDisplay(_INTL("But it failed!"))
  2879. return -1
  2880. end
  2881. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2882. tmp=attacker.ability
  2883. attacker.ability=opponent.ability
  2884. opponent.ability=tmp
  2885. @battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
  2886. attacker.pbThis,PBAbilities.getName(opponent.ability),
  2887. PBAbilities.getName(attacker.ability)))
  2888. attacker.pbAbilitiesOnSwitchIn(true)
  2889. opponent.pbAbilitiesOnSwitchIn(true)
  2890. return 0
  2891. end
  2892. end
  2893.  
  2894.  
  2895.  
  2896. ################################################################################
  2897. # Target's ability is negated. (Gastro Acid)
  2898. ################################################################################
  2899. class PokeBattle_Move_068 < PokeBattle_Move
  2900. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2901. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2902. @battle.pbDisplay(_INTL("But it failed!"))
  2903. return -1
  2904. end
  2905. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2906. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2907. isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
  2908. isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
  2909. isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
  2910. isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT) ||
  2911. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2912. isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
  2913. isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN)
  2914. @battle.pbDisplay(_INTL("But it failed!"))
  2915. return -1
  2916. end
  2917. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2918. oldabil=opponent.ability
  2919. opponent.effects[PBEffects::GastroAcid]=true
  2920. opponent.effects[PBEffects::Truant]=false
  2921. @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis))
  2922. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2923. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2924. opponent.effects[PBEffects::Illusion]=nil
  2925. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2926. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2927. end
  2928. return 0
  2929. end
  2930. end
  2931.  
  2932.  
  2933.  
  2934. ################################################################################
  2935. # User transforms into the target. (Transform)
  2936. ################################################################################
  2937. class PokeBattle_Move_069 < PokeBattle_Move
  2938. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2939. blacklist=[
  2940. 0xC9, # Fly
  2941. 0xCA, # Dig
  2942. 0xCB, # Dive
  2943. 0xCC, # Bounce
  2944. 0xCD, # Shadow Force
  2945. 0xCE, # Sky Drop
  2946. 0x14D # Phantom Force
  2947. ]
  2948. if attacker.effects[PBEffects::Transform] ||
  2949. opponent.effects[PBEffects::Transform] ||
  2950. opponent.effects[PBEffects::Illusion] ||
  2951. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  2952. opponent.effects[PBEffects::SkyDrop] ||
  2953. blacklist.include?(PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function)
  2954. @battle.pbDisplay(_INTL("But it failed!"))
  2955. return -1
  2956. end
  2957. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2958. @battle.pbDisplay(_INTL("But it failed!"))
  2959. return -1
  2960. end
  2961. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2962. attacker.effects[PBEffects::Transform]=true
  2963. attacker.type1=opponent.type1
  2964. attacker.type2=opponent.type2
  2965. attacker.effects[PBEffects::Type3]=-1
  2966. attacker.ability=opponent.ability
  2967. attacker.attack=opponent.attack
  2968. attacker.defense=opponent.defense
  2969. attacker.speed=opponent.speed
  2970. attacker.spatk=opponent.spatk
  2971. attacker.spdef=opponent.spdef
  2972. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2973. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2974. attacker.stages[i]=opponent.stages[i]
  2975. end
  2976. for i in 0...4
  2977. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(
  2978. @battle,PBMove.new(opponent.moves[i].id))
  2979. attacker.moves[i].pp=5
  2980. attacker.moves[i].totalpp=5
  2981. end
  2982. attacker.effects[PBEffects::Disable]=0
  2983. attacker.effects[PBEffects::DisableMove]=0
  2984. @battle.pbDisplay(_INTL("{1} transformed into {2}!",attacker.pbThis,opponent.pbThis(true)))
  2985. return 0
  2986. end
  2987. end
  2988.  
  2989.  
  2990.  
  2991. ################################################################################
  2992. # Inflicts a fixed 20HP damage. (SonicBoom)
  2993. ################################################################################
  2994. class PokeBattle_Move_06A < PokeBattle_Move
  2995. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2996. return pbEffectFixedDamage(20,attacker,opponent,hitnum,alltargets,showanimation)
  2997. end
  2998. end
  2999.  
  3000.  
  3001.  
  3002. ################################################################################
  3003. # Inflicts a fixed 40HP damage. (Dragon Rage)
  3004. ################################################################################
  3005. class PokeBattle_Move_06B < PokeBattle_Move
  3006. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3007. return pbEffectFixedDamage(40,attacker,opponent,hitnum,alltargets,showanimation)
  3008. end
  3009. end
  3010.  
  3011.  
  3012.  
  3013. ################################################################################
  3014. # Halves the target's current HP. (Super Fang, Nature´s Madness)
  3015. ################################################################################
  3016. class PokeBattle_Move_06C < PokeBattle_Move
  3017. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3018. return pbEffectFixedDamage([(opponent.hp/2).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3019. end
  3020. end
  3021.  
  3022.  
  3023.  
  3024. ################################################################################
  3025. # Inflicts damage equal to the user's level. (Night Shade, Seismic Toss)
  3026. ################################################################################
  3027. class PokeBattle_Move_06D < PokeBattle_Move
  3028. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3029. return pbEffectFixedDamage(attacker.level,attacker,opponent,hitnum,alltargets,showanimation)
  3030. end
  3031. end
  3032.  
  3033.  
  3034.  
  3035. ################################################################################
  3036. # Inflicts damage to bring the target's HP down to equal the user's HP. (Endeavor)
  3037. ################################################################################
  3038. class PokeBattle_Move_06E < PokeBattle_Move
  3039. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3040. if attacker.hp>=opponent.hp
  3041. @battle.pbDisplay(_INTL("But it failed!"))
  3042. return -1
  3043. end
  3044. return pbEffectFixedDamage(opponent.hp-attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  3045. end
  3046. end
  3047.  
  3048.  
  3049.  
  3050. ################################################################################
  3051. # Inflicts damage between 0.5 and 1.5 times the user's level. (Psywave)
  3052. ################################################################################
  3053. class PokeBattle_Move_06F < PokeBattle_Move
  3054. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3055. dmg=[(attacker.level*(@battle.pbRandom(101)+50)/100).floor,1].max
  3056. return pbEffectFixedDamage(dmg,attacker,opponent,hitnum,alltargets,showanimation)
  3057. end
  3058. end
  3059.  
  3060.  
  3061.  
  3062. ################################################################################
  3063. # OHKO. Accuracy increases by difference between levels of user and target.
  3064. ################################################################################
  3065. class PokeBattle_Move_070 < PokeBattle_Move
  3066. def pbAccuracyCheck(attacker,opponent)
  3067. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STURDY)
  3068. @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3069. return false
  3070. end
  3071. if opponent.level>attacker.level
  3072. @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
  3073. return false
  3074. end
  3075. acc=@accuracy+attacker.level-opponent.level
  3076. return @battle.pbRandom(100)<acc
  3077. end
  3078.  
  3079. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3080. damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
  3081. if opponent.fainted?
  3082. @battle.pbDisplay(_INTL("It's a one-hit KO!"))
  3083. end
  3084. return damage
  3085. end
  3086. end
  3087.  
  3088.  
  3089. ################################################################################
  3090. # Counters a physical move used against the user this round, with 2x the power. (Counter)
  3091. ################################################################################
  3092. class PokeBattle_Move_071 < PokeBattle_Move
  3093. def pbAddTarget(targets,attacker)
  3094. if attacker.effects[PBEffects::CounterTarget]>=0 &&
  3095. attacker.pbIsOpposing?(attacker.effects[PBEffects::CounterTarget])
  3096. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::CounterTarget]])
  3097. attacker.pbRandomTarget(targets)
  3098. end
  3099. end
  3100. end
  3101.  
  3102. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3103. if attacker.effects[PBEffects::Counter]<0 || !opponent
  3104. @battle.pbDisplay(_INTL("But it failed!"))
  3105. return -1
  3106. end
  3107. ret=pbEffectFixedDamage([attacker.effects[PBEffects::Counter]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3108. return ret
  3109. end
  3110. end
  3111.  
  3112.  
  3113.  
  3114. ################################################################################
  3115. # Counters a specical move used against the user this round, with 2x the power. (Mirror Coat)
  3116. ################################################################################
  3117. class PokeBattle_Move_072 < PokeBattle_Move
  3118. def pbAddTarget(targets,attacker)
  3119. if attacker.effects[PBEffects::MirrorCoatTarget]>=0 &&
  3120. attacker.pbIsOpposing?(attacker.effects[PBEffects::MirrorCoatTarget])
  3121. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::MirrorCoatTarget]])
  3122. attacker.pbRandomTarget(targets)
  3123. end
  3124. end
  3125. end
  3126.  
  3127. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3128. if attacker.effects[PBEffects::MirrorCoat]<0 || !opponent
  3129. @battle.pbDisplay(_INTL("But it failed!"))
  3130. return -1
  3131. end
  3132. ret=pbEffectFixedDamage([attacker.effects[PBEffects::MirrorCoat]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3133. return ret
  3134. end
  3135. end
  3136.  
  3137.  
  3138.  
  3139. ################################################################################
  3140. # Counters the last damaging move used against the user this round, with 1.5x
  3141. # the power. (Metal Burst)
  3142. ################################################################################
  3143. class PokeBattle_Move_073 < PokeBattle_Move
  3144. def pbAddTarget(targets,attacker)
  3145. if attacker.lastAttacker.length>0
  3146. lastattacker=attacker.lastAttacker[attacker.lastAttacker.length-1]
  3147. if lastattacker>=0 && attacker.pbIsOpposing?(lastattacker)
  3148. if !attacker.pbAddTarget(targets,@battle.battlers[lastattacker])
  3149. attacker.pbRandomTarget(targets)
  3150. end
  3151. end
  3152. end
  3153. end
  3154.  
  3155. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3156. if attacker.lastHPLost==0 || !opponent
  3157. @battle.pbDisplay(_INTL("But it failed!"))
  3158. return -1
  3159. end
  3160. ret=pbEffectFixedDamage([(attacker.lastHPLost*1.5).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3161. return ret
  3162. end
  3163. end
  3164.  
  3165.  
  3166.  
  3167. ################################################################################
  3168. # The target's ally loses 1/16 of its max HP. (Flame Burst)
  3169. ################################################################################
  3170. class PokeBattle_Move_074 < PokeBattle_Move
  3171. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3172. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3173. if opponent.damagestate.calcdamage>0
  3174. if opponent.pbPartner && !opponent.pbPartner.fainted? &&
  3175. !opponent.pbPartner.hasWorkingAbility(:MAGICGUARD)
  3176. opponent.pbPartner.pbReduceHP((opponent.pbPartner.totalhp/16).floor)
  3177. @battle.pbDisplay(_INTL("The bursting flame hit {1}!",opponent.pbPartner.pbThis(true)))
  3178. end
  3179. end
  3180. return ret
  3181. end
  3182. end
  3183.  
  3184.  
  3185.  
  3186. ################################################################################
  3187. # Power is doubled if the target is using Dive. (Surf)
  3188. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3189. ################################################################################
  3190. class PokeBattle_Move_075 < PokeBattle_Move
  3191. def pbModifyDamage(damagemult,attacker,opponent)
  3192. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  3193. return (damagemult*2.0).round
  3194. end
  3195. return damagemult
  3196. end
  3197. end
  3198.  
  3199.  
  3200.  
  3201. ################################################################################
  3202. # Power is doubled if the target is using Dig. Power is halved if Grassy Terrain
  3203. # is in effect. (Earthquake)
  3204. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3205. ################################################################################
  3206. class PokeBattle_Move_076 < PokeBattle_Move
  3207. def pbModifyDamage(damagemult,attacker,opponent)
  3208. ret=damagemult
  3209. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3210. ret=(damagemult*2.0).round
  3211. end
  3212. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3213. ret=(damagemult/0.5).round
  3214. end
  3215. return ret
  3216. end
  3217. end
  3218.  
  3219.  
  3220.  
  3221. ################################################################################
  3222. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Gust)
  3223. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3224. ################################################################################
  3225. class PokeBattle_Move_077 < PokeBattle_Move
  3226. def pbBaseDamage(basedmg,attacker,opponent)
  3227. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3228. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3229. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3230. opponent.effects[PBEffects::SkyDrop]
  3231. return basedmg*2
  3232. end
  3233. return basedmg
  3234. end
  3235. end
  3236.  
  3237.  
  3238.  
  3239. ################################################################################
  3240. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Twister)
  3241. # May make the target flinch.
  3242. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3243. ################################################################################
  3244. class PokeBattle_Move_078 < PokeBattle_Move
  3245. def pbBaseDamage(basedmg,attacker,opponent)
  3246. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3247. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3248. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3249. opponent.effects[PBEffects::SkyDrop]
  3250. return basedmg*2
  3251. end
  3252. return basedmg
  3253. end
  3254.  
  3255. def pbAdditionalEffect(attacker,opponent)
  3256. return if opponent.damagestate.substitute
  3257. opponent.pbFlinch(attacker)
  3258. end
  3259. end
  3260.  
  3261.  
  3262.  
  3263. ################################################################################
  3264. # Power is doubled if Fusion Flare has already been used this round. (Fusion Bolt)
  3265. ################################################################################
  3266. class PokeBattle_Move_079 < PokeBattle_Move
  3267. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3268. if @battle.field.effects[PBEffects::FusionBolt]
  3269. @battle.field.effects[PBEffects::FusionBolt]=false
  3270. @doubled=true
  3271. return (damagemult*2.0).round
  3272. end
  3273. return damagemult
  3274. end
  3275.  
  3276. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3277. @doubled=false
  3278. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3279. if opponent.damagestate.calcdamage>0
  3280. @battle.field.effects[PBEffects::FusionFlare]=true
  3281. end
  3282. return ret
  3283. end
  3284.  
  3285. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3286. if opponent.damagestate.critical || @doubled
  3287. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3288. end
  3289. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3290. end
  3291. end
  3292.  
  3293.  
  3294.  
  3295. ################################################################################
  3296. # Power is doubled if Fusion Bolt has already been used this round. (Fusion Flare)
  3297. ################################################################################
  3298. class PokeBattle_Move_07A < PokeBattle_Move
  3299. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3300. if @battle.field.effects[PBEffects::FusionFlare]
  3301. @battle.field.effects[PBEffects::FusionFlare]=false
  3302. return (damagemult*2.0).round
  3303. end
  3304. return damagemult
  3305. end
  3306.  
  3307. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3308. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3309. if opponent.damagestate.calcdamage>0
  3310. @battle.field.effects[PBEffects::FusionBolt]=true
  3311. end
  3312. return ret
  3313. end
  3314.  
  3315. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3316. if opponent.damagestate.critical || @doubled
  3317. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3318. end
  3319. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3320. end
  3321. end
  3322.  
  3323.  
  3324.  
  3325. ################################################################################
  3326. # Power is doubled if the target is poisoned. (Venoshock)
  3327. ################################################################################
  3328. class PokeBattle_Move_07B < PokeBattle_Move
  3329. def pbBaseDamage(basedmg,attacker,opponent)
  3330. if opponent.status==PBStatuses::POISON &&
  3331. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3332. return basedmg*2
  3333. end
  3334. return basedmg
  3335. end
  3336. end
  3337.  
  3338.  
  3339.  
  3340. ################################################################################
  3341. # Power is doubled if the target is paralyzed. Cures the target of paralysis.
  3342. # (SmellingSalt)
  3343. ################################################################################
  3344. class PokeBattle_Move_07C < PokeBattle_Move
  3345. def pbBaseDamage(basedmg,attacker,opponent)
  3346. if opponent.status==PBStatuses::PARALYSIS &&
  3347. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3348. return basedmg*2
  3349. end
  3350. return basedmg
  3351. end
  3352.  
  3353. def pbEffectAfterHit(attacker,opponent,turneffects)
  3354. if !opponent.fainted? && opponent.damagestate.calcdamage>0 &&
  3355. !opponent.damagestate.substitute && opponent.status==PBStatuses::PARALYSIS
  3356. opponent.pbCureStatus
  3357. end
  3358. end
  3359. end
  3360.  
  3361.  
  3362.  
  3363. ################################################################################
  3364. # Power is doubled if the target is asleep. Wakes the target up. (Wake-Up Slap)
  3365. ################################################################################
  3366. class PokeBattle_Move_07D < PokeBattle_Move
  3367. def pbBaseDamage(basedmg,attacker,opponent)
  3368. if (opponent.status==PBStatuses::SLEEP &&
  3369. (opponent.effects[PBEffects::Substitute]==0 ||
  3370. ignoresSubstitute?(attacker))) || (opponent.hasWorkingAbility(:COMATOSE) &&
  3371. isConst(opponent.species,PBSpecies,:KOMALA) &&
  3372. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)))
  3373. return basedmg*2
  3374. end
  3375. return basedmg
  3376. end
  3377.  
  3378. def pbEffectAfterHit(attacker,opponent,turneffects)
  3379. if !opponent.fainted? && opponent.damagestate.calcdamage>0 &&
  3380. !opponent.damagestate.substitute && opponent.status==PBStatuses::SLEEP
  3381. opponent.pbCureStatus
  3382. end
  3383. end
  3384. end
  3385.  
  3386.  
  3387.  
  3388. ################################################################################
  3389. # Power is doubled if the user is burned, poisoned or paralyzed. (Facade)
  3390. ################################################################################
  3391. class PokeBattle_Move_07E < PokeBattle_Move
  3392. def pbBaseDamage(basedmg,attacker,opponent)
  3393. if attacker.status==PBStatuses::POISON ||
  3394. attacker.status==PBStatuses::BURN ||
  3395. attacker.status==PBStatuses::PARALYSIS
  3396. return basedmg*2
  3397. end
  3398. return basedmg
  3399. end
  3400. end
  3401.  
  3402.  
  3403.  
  3404. ################################################################################
  3405. # Power is doubled if the target has a status problem. (Hex)
  3406. ################################################################################
  3407. class PokeBattle_Move_07F < PokeBattle_Move
  3408. def pbBaseDamage(basedmg,attacker,opponent)
  3409. if (opponent.status>0 &&
  3410. (opponent.effects[PBEffects::Substitute]==0 ||
  3411. ignoresSubstitute?(attacker))) || (opponent.hasWorkingAbility(:COMATOSE) &&
  3412. isConst?(opponent.species,PBSpecies,:KOMALA) &&
  3413. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)))
  3414. return basedmg*2
  3415. end
  3416. return basedmg
  3417. end
  3418. end
  3419.  
  3420.  
  3421.  
  3422. ################################################################################
  3423. # Power is doubled if the target's HP is down to 1/2 or less. (Brine)
  3424. ################################################################################
  3425. class PokeBattle_Move_080 < PokeBattle_Move
  3426. def pbBaseDamage(basedmg,attacker,opponent)
  3427. if opponent.hp<=opponent.totalhp/2
  3428. return basedmg*2
  3429. end
  3430. return basedmg
  3431. end
  3432. end
  3433.  
  3434.  
  3435.  
  3436. ################################################################################
  3437. # Power is doubled if the user has lost HP due to the target's move this round.
  3438. # (Revenge, Avalanche)
  3439. ################################################################################
  3440. class PokeBattle_Move_081 < PokeBattle_Move
  3441. def pbBaseDamage(basedmg,attacker,opponent)
  3442. if attacker.lastHPLost>0 && attacker.lastAttacker.include?(opponent.index)
  3443. return basedmg*2
  3444. end
  3445. return basedmg
  3446. end
  3447. end
  3448.  
  3449.  
  3450.  
  3451. ################################################################################
  3452. # Power is doubled if the target has already lost HP this round. (Assurance)
  3453. ################################################################################
  3454. class PokeBattle_Move_082 < PokeBattle_Move
  3455. def pbBaseDamage(basedmg,attacker,opponent)
  3456. if opponent.tookDamage
  3457. return basedmg*2
  3458. end
  3459. return basedmg
  3460. end
  3461. end
  3462.  
  3463.  
  3464.  
  3465. ################################################################################
  3466. # Power is doubled if a user's ally has already used this move this round. (Round)
  3467. # If an ally is about to use the same move, make it go next, ignoring priority.
  3468. ################################################################################
  3469. class PokeBattle_Move_083 < PokeBattle_Move
  3470. def pbBaseDamage(basedmg,attacker,opponent)
  3471. ret=basedmg
  3472. attacker.pbOwnSide.effects[PBEffects::Round].times do
  3473. ret*=2
  3474. end
  3475. return ret
  3476. end
  3477.  
  3478. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3479. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3480. if opponent.damagestate.calcdamage>0
  3481. attacker.pbOwnSide.effects[PBEffects::Round]+=1
  3482. if attacker.pbPartner && !attacker.pbPartner.hasMovedThisRound?
  3483. if @battle.choices[attacker.pbPartner.index][0]==1 # Will use a move
  3484. partnermove=@battle.choices[attacker.pbPartner.index][2]
  3485. if partnermove.function==@function
  3486. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  3487. attacker.pbPartner.effects[PBEffects::Quash]=false
  3488. end
  3489. end
  3490. end
  3491. end
  3492. return ret
  3493. end
  3494. end
  3495.  
  3496.  
  3497.  
  3498. ################################################################################
  3499. # Power is doubled if the target has already moved this round. (Payback)
  3500. ################################################################################
  3501. class PokeBattle_Move_084 < PokeBattle_Move
  3502. def pbBaseDamage(basedmg,attacker,opponent)
  3503. if @battle.choices[opponent.index][0]==3 || # Used an item
  3504. opponent.hasMovedThisRound? # Used a move already
  3505. return basedmg*2
  3506. end
  3507. return basedmg
  3508. end
  3509. end
  3510.  
  3511.  
  3512.  
  3513. ################################################################################
  3514. # Power is doubled if a user's teammate fainted last round. (Retaliate)
  3515. ################################################################################
  3516. class PokeBattle_Move_085 < PokeBattle_Move
  3517. def pbBaseDamage(basedmg,attacker,opponent)
  3518. if attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]>=0 &&
  3519. attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]==@battle.turncount-1
  3520. return basedmg*2
  3521. end
  3522. return basedmg
  3523. end
  3524. end
  3525.  
  3526.  
  3527.  
  3528. ################################################################################
  3529. # Power is doubled if the user has no held item. (Acrobatics)
  3530. ################################################################################
  3531. class PokeBattle_Move_086 < PokeBattle_Move
  3532. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3533. if attacker.item==0
  3534. return (damagemult*2.0).round
  3535. end
  3536. return damagemult
  3537. end
  3538. end
  3539.  
  3540.  
  3541.  
  3542. ################################################################################
  3543. # Power is doubled in weather. Type changes depending on the weather. (Weather Ball)
  3544. ################################################################################
  3545. class PokeBattle_Move_087 < PokeBattle_Move
  3546. def pbBaseDamage(basedmg,attacker,opponent)
  3547. if @battle.pbWeather!=0
  3548. return basedmg*2
  3549. end
  3550. return basedmg
  3551. end
  3552.  
  3553. def pbModifyType(type,attacker,opponent)
  3554. type=getConst(PBTypes,:NORMAL) || 0
  3555. case @battle.pbWeather
  3556. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  3557. type=(getConst(PBTypes,:FIRE) || type)
  3558. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  3559. type=(getConst(PBTypes,:WATER) || type)
  3560. when PBWeather::SANDSTORM
  3561. type=(getConst(PBTypes,:ROCK) || type)
  3562. when PBWeather::HAIL
  3563. type=(getConst(PBTypes,:ICE) || type)
  3564. end
  3565. return type
  3566. end
  3567. end
  3568.  
  3569.  
  3570.  
  3571. ################################################################################
  3572. # Power is doubled if a foe tries to switch out or use U-turn/Volt Switch/
  3573. # Parting Shot. (Pursuit)
  3574. # (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
  3575. ################################################################################
  3576. class PokeBattle_Move_088 < PokeBattle_Move
  3577. def pbBaseDamage(basedmg,attacker,opponent)
  3578. if @battle.switching
  3579. return basedmg*2
  3580. end
  3581. return basedmg
  3582. end
  3583.  
  3584. def pbAccuracyCheck(attacker,opponent)
  3585. return true if @battle.switching
  3586. return super(attacker,opponent)
  3587. end
  3588. end
  3589.  
  3590.  
  3591.  
  3592. ################################################################################
  3593. # Power increases with the user's happiness. (Return)
  3594. ################################################################################
  3595. class PokeBattle_Move_089 < PokeBattle_Move
  3596. def pbBaseDamage(basedmg,attacker,opponent)
  3597. return [(attacker.happiness*2/5).floor,1].max
  3598. end
  3599. end
  3600.  
  3601.  
  3602.  
  3603. ################################################################################
  3604. # Power decreases with the user's happiness. (Frustration)
  3605. ################################################################################
  3606. class PokeBattle_Move_08A < PokeBattle_Move
  3607. def pbBaseDamage(basedmg,attacker,opponent)
  3608. return [((255-attacker.happiness)*2/5).floor,1].max
  3609. end
  3610. end
  3611.  
  3612.  
  3613.  
  3614. ################################################################################
  3615. # Power increases with the user's HP. (Eruption, Water Spout)
  3616. ################################################################################
  3617. class PokeBattle_Move_08B < PokeBattle_Move
  3618. def pbBaseDamage(basedmg,attacker,opponent)
  3619. return [(150*attacker.hp/attacker.totalhp).floor,1].max
  3620. end
  3621. end
  3622.  
  3623.  
  3624.  
  3625. ################################################################################
  3626. # Power increases with the target's HP. (Crush Grip, Wring Out)
  3627. ################################################################################
  3628. class PokeBattle_Move_08C < PokeBattle_Move
  3629. def pbBaseDamage(basedmg,attacker,opponent)
  3630. return [(120*opponent.hp/opponent.totalhp).floor,1].max
  3631. end
  3632. end
  3633.  
  3634.  
  3635.  
  3636. ################################################################################
  3637. # Power increases the quicker the target is than the user. (Gyro Ball)
  3638. ################################################################################
  3639. class PokeBattle_Move_08D < PokeBattle_Move
  3640. def pbBaseDamage(basedmg,attacker,opponent)
  3641. return [[(25*opponent.pbSpeed/attacker.pbSpeed).floor,150].min,1].max
  3642. end
  3643. end
  3644.  
  3645.  
  3646.  
  3647. ################################################################################
  3648. # Power increases with the user's positive stat changes (ignores negative ones).
  3649. # (Stored Power)
  3650. ################################################################################
  3651. class PokeBattle_Move_08E < PokeBattle_Move
  3652. def pbBaseDamage(basedmg,attacker,opponent)
  3653. mult=1
  3654. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3655. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3656. mult+=attacker.stages[i] if attacker.stages[i]>0
  3657. end
  3658. return 20*mult
  3659. end
  3660. end
  3661.  
  3662.  
  3663.  
  3664. ################################################################################
  3665. # Power increases with the target's positive stat changes (ignores negative ones).
  3666. # (Punishment)
  3667. ################################################################################
  3668. class PokeBattle_Move_08F < PokeBattle_Move
  3669. def pbBaseDamage(basedmg,attacker,opponent)
  3670. mult=3
  3671. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3672. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3673. mult+=opponent.stages[i] if opponent.stages[i]>0
  3674. end
  3675. return [20*mult,200].min
  3676. end
  3677. end
  3678.  
  3679.  
  3680.  
  3681. ################################################################################
  3682. # Power and type depends on the user's IVs. (Hidden Power)
  3683. ################################################################################
  3684. class PokeBattle_Move_090 < PokeBattle_Move
  3685. def pbModifyType(type,attacker,opponent)
  3686. hp=pbHiddenPower(attacker.iv)
  3687. type=hp[0]
  3688. return type
  3689. end
  3690.  
  3691. def pbBaseDamage(basedmg,attacker,opponent)
  3692. return 60 if USENEWBATTLEMECHANICS
  3693. hp=pbHiddenPower(attacker.iv)
  3694. return hp[1]
  3695. end
  3696. end
  3697.  
  3698. def pbHiddenPower(iv)
  3699. powermin=30
  3700. powermax=70
  3701. type=0; base=0
  3702. types=[]
  3703. for i in 0..PBTypes.maxValue
  3704. types.push(i) if !PBTypes.isPseudoType?(i) &&
  3705. !isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
  3706. end
  3707. type|=(iv[PBStats::HP]&1)
  3708. type|=(iv[PBStats::ATTACK]&1)<<1
  3709. type|=(iv[PBStats::DEFENSE]&1)<<2
  3710. type|=(iv[PBStats::SPEED]&1)<<3
  3711. type|=(iv[PBStats::SPATK]&1)<<4
  3712. type|=(iv[PBStats::SPDEF]&1)<<5
  3713. type=(type*(types.length-1)/63).floor
  3714. hptype=types[type]
  3715. base|=(iv[PBStats::HP]&2)>>1
  3716. base|=(iv[PBStats::ATTACK]&2)
  3717. base|=(iv[PBStats::DEFENSE]&2)<<1
  3718. base|=(iv[PBStats::SPEED]&2)<<2
  3719. base|=(iv[PBStats::SPATK]&2)<<3
  3720. base|=(iv[PBStats::SPDEF]&2)<<4
  3721. base=(base*(powermax-powermin)/63).floor+powermin
  3722. return [hptype,base]
  3723. end
  3724.  
  3725. ################################################################################
  3726. # Power doubles for each consecutive use. (Fury Cutter)
  3727. ################################################################################
  3728. class PokeBattle_Move_091 < PokeBattle_Move
  3729. def pbBaseDamage(basedmg,attacker,opponent)
  3730. basedmg=basedmg<<(attacker.effects[PBEffects::FuryCutter]-1) # can be 1 to 4
  3731. return basedmg
  3732. end
  3733. end
  3734.  
  3735.  
  3736.  
  3737. ################################################################################
  3738. # Power is multiplied by the number of consecutive rounds in which this move was
  3739. # used by any Pokémon on the user's side. (Echoed Voice)
  3740. ################################################################################
  3741. class PokeBattle_Move_092 < PokeBattle_Move
  3742. def pbBaseDamage(basedmg,attacker,opponent)
  3743. basedmg*=attacker.pbOwnSide.effects[PBEffects::EchoedVoiceCounter] # can be 1 to 5
  3744. return basedmg
  3745. end
  3746. end
  3747.  
  3748.  
  3749.  
  3750. ################################################################################
  3751. # User rages until the start of a round in which they don't use this move. (Rage)
  3752. # (Handled in Battler's pbProcessMoveAgainstTarget): Ups rager's Attack by 1
  3753. # stage each time it loses HP due to a move.
  3754. ################################################################################
  3755. class PokeBattle_Move_093 < PokeBattle_Move
  3756. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3757. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3758. attacker.effects[PBEffects::Rage]=true if ret>0
  3759. return ret
  3760. end
  3761. end
  3762.  
  3763.  
  3764.  
  3765. ################################################################################
  3766. # Randomly damages or heals the target. (Present)
  3767. ################################################################################
  3768. class PokeBattle_Move_094 < PokeBattle_Move
  3769. def isHealingMove?
  3770. return true
  3771. end
  3772.  
  3773. def pbOnStartUse(attacker)
  3774. # Just to ensure that Parental Bond's second hit damages if the first hit does
  3775. @forcedamage=false
  3776. return true
  3777. end
  3778.  
  3779. def pbBaseDamage(basedmg,attacker,opponent)
  3780. @forcedamage=true
  3781. return @calcbasedmg
  3782. end
  3783.  
  3784. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3785. @calcbasedmg=1
  3786. r=@battle.pbRandom((@forcedamage) ? 8 : 10)
  3787. if r<4
  3788. @calcbasedmg=40
  3789. elsif r<7
  3790. @calcbasedmg=80
  3791. elsif r<8
  3792. @calcbasedmg=120
  3793. else
  3794. if pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)==0
  3795. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  3796. return -1
  3797. end
  3798. if opponent.hp==opponent.totalhp
  3799. @battle.pbDisplay(_INTL("But it failed!"))
  3800. return -1
  3801. end
  3802. damage=pbCalcDamage(attacker,opponent) # Consumes Gems even if it will heal
  3803. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Healing animation
  3804. opponent.pbRecoverHP((opponent.totalhp/4).floor,true)
  3805. @battle.pbDisplay(_INTL("{1} had its HP restored.",opponent.pbThis))
  3806. return 0
  3807. end
  3808. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3809. end
  3810. end
  3811.  
  3812.  
  3813.  
  3814. ################################################################################
  3815. # Power is chosen at random. Power is doubled if the target is using Dig. (Magnitude)
  3816. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3817. ################################################################################
  3818. class PokeBattle_Move_095 < PokeBattle_Move
  3819. def pbOnStartUse(attacker)
  3820. basedmg=[10,30,50,70,90,110,150]
  3821. magnitudes=[
  3822. 4,
  3823. 5,5,
  3824. 6,6,6,6,
  3825. 7,7,7,7,7,7,
  3826. 8,8,8,8,
  3827. 9,9,
  3828. 10
  3829. ]
  3830. magni=magnitudes[@battle.pbRandom(magnitudes.length)]
  3831. @calcbasedmg=basedmg[magni-4]
  3832. @battle.pbDisplay(_INTL("Magnitude {1}!",magni))
  3833. return true
  3834. end
  3835.  
  3836. def pbBaseDamage(basedmg,attacker,opponent)
  3837. ret=@calcbasedmg
  3838. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3839. ret*=2
  3840. end
  3841. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3842. ret=(ret/2.0).round
  3843. end
  3844. return ret
  3845. end
  3846. end
  3847.  
  3848.  
  3849.  
  3850. ################################################################################
  3851. # Power and type depend on the user's held berry. Destroys the berry. (Natural Gift)
  3852. ################################################################################
  3853. class PokeBattle_Move_096 < PokeBattle_Move
  3854. def pbOnStartUse(attacker)
  3855. if !pbIsBerry?(attacker.item) ||
  3856. attacker.effects[PBEffects::Embargo]>0 ||
  3857. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  3858. attacker.hasWorkingAbility(:KLUTZ) ||
  3859. attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) ||
  3860. attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  3861. @battle.pbDisplay(_INTL("But it failed!"))
  3862. return false
  3863. end
  3864. @berry=attacker.item
  3865. return true
  3866. end
  3867.  
  3868. def pbBaseDamage(basedmg,attacker,opponent)
  3869. damagearray={
  3870. 60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
  3871. :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
  3872. :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
  3873. :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
  3874. :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
  3875. :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
  3876. :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY,:ROSELIBERRY],
  3877. 70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
  3878. :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
  3879. :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
  3880. :PAMTREBERRY],
  3881. 80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
  3882. :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
  3883. :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JABOCABERRY,:ROWAPBERRY,
  3884. :KEEBERRY,:MARANGABERRY]
  3885. }
  3886. for i in damagearray.keys
  3887. data=damagearray[i]
  3888. if data
  3889. for j in data
  3890. if isConst?(@berry,PBItems,j)
  3891. ret=i
  3892. ret+=20 if USENEWBATTLEMECHANICS
  3893. return ret
  3894. end
  3895. end
  3896. end
  3897. end
  3898. return 1
  3899. end
  3900.  
  3901. def pbModifyType(type,attacker,opponent)
  3902. type=getConst(PBTypes,:NORMAL) || 0
  3903. typearray={
  3904. :NORMAL => [:CHILANBERRY],
  3905. :FIRE => [:CHERIBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
  3906. :WATER => [:CHESTOBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
  3907. :ELECTRIC => [:PECHABERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
  3908. :GRASS => [:RAWSTBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
  3909. :ICE => [:ASPEARBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
  3910. :FIGHTING => [:LEPPABERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
  3911. :POISON => [:ORANBERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
  3912. :GROUND => [:PERSIMBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
  3913. :FLYING => [:LUMBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
  3914. :PSYCHIC => [:SITRUSBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
  3915. :BUG => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
  3916. :ROCK => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
  3917. :GHOST => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
  3918. :DRAGON => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JABOCABERRY],
  3919. :DARK => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY,:MARANGABERRY],
  3920. :STEEL => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY],
  3921. :FAIRY => [:ROSELIBERRY,:KEEBERRY]
  3922. }
  3923. for i in typearray.keys
  3924. data=typearray[i]
  3925. if data
  3926. for j in data
  3927. if isConst?(@berry,PBItems,j)
  3928. type=getConst(PBTypes,i) || type
  3929. end
  3930. end
  3931. end
  3932. end
  3933. return type
  3934. end
  3935.  
  3936. def pbEffectAfterHit(attacker,opponent,turneffects)
  3937. if turneffects[PBEffects::TotalDamage]>0
  3938. attacker.pbConsumeItem
  3939. end
  3940. end
  3941. end
  3942.  
  3943.  
  3944.  
  3945. ################################################################################
  3946. # Power increases the less PP this move has. (Trump Card)
  3947. ################################################################################
  3948. class PokeBattle_Move_097 < PokeBattle_Move
  3949. def pbBaseDamage(basedmg,attacker,opponent)
  3950. dmgs=[200,80,60,50,40]
  3951. ppleft=[@pp,4].min # PP is reduced before the move is used
  3952. basedmg=dmgs[ppleft]
  3953. return basedmg
  3954. end
  3955. end
  3956.  
  3957.  
  3958.  
  3959. ################################################################################
  3960. # Power increases the less HP the user has. (Flail, Reversal)
  3961. ################################################################################
  3962. class PokeBattle_Move_098 < PokeBattle_Move
  3963. def pbBaseDamage(basedmg,attacker,opponent)
  3964. n=(48*attacker.hp/attacker.totalhp).floor
  3965. ret=20
  3966. ret=40 if n<33
  3967. ret=80 if n<17
  3968. ret=100 if n<10
  3969. ret=150 if n<5
  3970. ret=200 if n<2
  3971. return ret
  3972. end
  3973. end
  3974.  
  3975.  
  3976.  
  3977. ################################################################################
  3978. # Power increases the quicker the user is than the target. (Electro Ball)
  3979. ################################################################################
  3980. class PokeBattle_Move_099 < PokeBattle_Move
  3981. def pbBaseDamage(basedmg,attacker,opponent)
  3982. n=([attacker.pbSpeed,1].max/[opponent.pbSpeed,1].max).floor
  3983. ret=60
  3984. ret=80 if n>=2
  3985. ret=120 if n>=3
  3986. ret=150 if n>=4
  3987. return ret
  3988. end
  3989. end
  3990.  
  3991.  
  3992.  
  3993. ################################################################################
  3994. # Power increases the heavier the target is. (Grass Knot, Low Kick)
  3995. ################################################################################
  3996. class PokeBattle_Move_09A < PokeBattle_Move
  3997. def pbBaseDamage(basedmg,attacker,opponent)
  3998. weight=opponent.weight(attacker)
  3999. ret=20
  4000. ret=40 if weight>=100
  4001. ret=60 if weight>=250
  4002. ret=80 if weight>=500
  4003. ret=100 if weight>=1000
  4004. ret=120 if weight>=2000
  4005. return ret
  4006. end
  4007. end
  4008.  
  4009.  
  4010.  
  4011. ################################################################################
  4012. # Power increases the heavier the user is than the target. (Heat Crash, Heavy Slam)
  4013. ################################################################################
  4014. class PokeBattle_Move_09B < PokeBattle_Move
  4015. def pbBaseDamage(basedmg,attacker,opponent)
  4016. n=(attacker.weight/opponent.weight(attacker)).floor
  4017. ret=40
  4018. ret=60 if n>=2
  4019. ret=80 if n>=3
  4020. ret=100 if n>=4
  4021. ret=120 if n>=5
  4022. return ret
  4023. end
  4024. end
  4025.  
  4026.  
  4027.  
  4028. ################################################################################
  4029. # Powers up the ally's attack this round by 1.5. (Helping Hand)
  4030. ################################################################################
  4031. class PokeBattle_Move_09C < PokeBattle_Move
  4032. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4033. if !@battle.doublebattle || opponent.fainted? ||
  4034. @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  4035. opponent.hasMovedThisRound? ||
  4036. opponent.effects[PBEffects::HelpingHand]
  4037. @battle.pbDisplay(_INTL("But it failed!"))
  4038. return -1
  4039. end
  4040. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4041. opponent.effects[PBEffects::HelpingHand]=true
  4042. @battle.pbDisplay(_INTL("{1} is ready to help {2}!",attacker.pbThis,opponent.pbThis(true)))
  4043. return 0
  4044. end
  4045. end
  4046.  
  4047.  
  4048.  
  4049. ################################################################################
  4050. # Weakens Electric attacks. (Mud Sport)
  4051. ################################################################################
  4052. class PokeBattle_Move_09D < PokeBattle_Move
  4053. def doesIgnoreDazzling?
  4054. return true
  4055. end
  4056.  
  4057. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4058. if USENEWBATTLEMECHANICS
  4059. if @battle.field.effects[PBEffects::MudSportField]>0
  4060. @battle.pbDisplay(_INTL("But it failed!"))
  4061. return -1
  4062. end
  4063. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4064. @battle.field.effects[PBEffects::MudSportField]=5
  4065. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4066. return 0
  4067. else
  4068. for i in 0...4
  4069. if attacker.battle.battlers[i].effects[PBEffects::MudSport]
  4070. @battle.pbDisplay(_INTL("But it failed!"))
  4071. return -1
  4072. end
  4073. end
  4074. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4075. attacker.effects[PBEffects::MudSport]=true
  4076. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4077. return 0
  4078. end
  4079. return -1
  4080. end
  4081. end
  4082.  
  4083.  
  4084.  
  4085. ################################################################################
  4086. # Weakens Fire attacks. (Water Sport)
  4087. ################################################################################
  4088. class PokeBattle_Move_09E < PokeBattle_Move
  4089. def doesIgnoreDazzling?
  4090. return true
  4091. end
  4092.  
  4093. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4094. if USENEWBATTLEMECHANICS
  4095. if @battle.field.effects[PBEffects::WaterSportField]>0
  4096. @battle.pbDisplay(_INTL("But it failed!"))
  4097. return -1
  4098. end
  4099. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4100. @battle.field.effects[PBEffects::WaterSportField]=5
  4101. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4102. return 0
  4103. else
  4104. for i in 0...4
  4105. if attacker.battle.battlers[i].effects[PBEffects::WaterSport]
  4106. @battle.pbDisplay(_INTL("But it failed!"))
  4107. return -1
  4108. end
  4109. end
  4110. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4111. attacker.effects[PBEffects::WaterSport]=true
  4112. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4113. return 0
  4114. end
  4115. end
  4116. end
  4117.  
  4118.  
  4119.  
  4120. ################################################################################
  4121. # Type depends on the user's held item. (Judgment, Techno Blast, Multi-Attack)
  4122. ################################################################################
  4123. class PokeBattle_Move_09F < PokeBattle_Move
  4124. def pbModifyType(type,attacker,opponent)
  4125. if isConst?(@id,PBMoves,:JUDGMENT)
  4126. return (getConst(PBTypes,:FIGHTING) || 0) if isConst?(attacker.item,PBItems,:FISTPLATE)
  4127. return (getConst(PBTypes,:FLYING) || 0) if isConst?(attacker.item,PBItems,:SKYPLATE)
  4128. return (getConst(PBTypes,:POISON) || 0) if isConst?(attacker.item,PBItems,:TOXICPLATE)
  4129. return (getConst(PBTypes,:GROUND) || 0) if isConst?(attacker.item,PBItems,:EARTHPLATE)
  4130. return (getConst(PBTypes,:ROCK) || 0) if isConst?(attacker.item,PBItems,:STONEPLATE)
  4131. return (getConst(PBTypes,:BUG) || 0) if isConst?(attacker.item,PBItems,:INSECTPLATE)
  4132. return (getConst(PBTypes,:GHOST) || 0) if isConst?(attacker.item,PBItems,:SPOOKYPLATE)
  4133. return (getConst(PBTypes,:STEEL) || 0) if isConst?(attacker.item,PBItems,:IRONPLATE)
  4134. return (getConst(PBTypes,:FIRE) || 0) if isConst?(attacker.item,PBItems,:FLAMEPLATE)
  4135. return (getConst(PBTypes,:WATER) || 0) if isConst?(attacker.item,PBItems,:SPLASHPLATE)
  4136. return (getConst(PBTypes,:GRASS) || 0) if isConst?(attacker.item,PBItems,:MEADOWPLATE)
  4137. return (getConst(PBTypes,:ELECTRIC) || 0) if isConst?(attacker.item,PBItems,:ZAPPLATE)
  4138. return (getConst(PBTypes,:PSYCHIC) || 0) if isConst?(attacker.item,PBItems,:MINDPLATE)
  4139. return (getConst(PBTypes,:ICE) || 0) if isConst?(attacker.item,PBItems,:ICICLEPLATE)
  4140. return (getConst(PBTypes,:DRAGON) || 0) if isConst?(attacker.item,PBItems,:DRACOPLATE)
  4141. return (getConst(PBTypes,:DARK) || 0) if isConst?(attacker.item,PBItems,:DREADPLATE)
  4142. return (getConst(PBTypes,:FAIRY) || 0) if isConst?(attacker.item,PBItems,:PIXIEPLATE)
  4143. elsif isConst?(@id,PBMoves,:MULTIATTACK)
  4144. return (getConst(PBTypes,:FIGHTING) || 0) if isConst?(attacker.item,PBItems,:FIGHTINGMEMORY)
  4145. return (getConst(PBTypes,:FLYING) || 0) if isConst?(attacker.item,PBItems,:FLYINGMEMORY)
  4146. return (getConst(PBTypes,:POISON) || 0) if isConst?(attacker.item,PBItems,:TOXICMEMORY)
  4147. return (getConst(PBTypes,:GROUND) || 0) if isConst?(attacker.item,PBItems,:GROUNDMEMORY)
  4148. return (getConst(PBTypes,:ROCK) || 0) if isConst?(attacker.item,PBItems,:ROCKMEMORY)
  4149. return (getConst(PBTypes,:BUG) || 0) if isConst?(attacker.item,PBItems,:BUGMEMORY)
  4150. return (getConst(PBTypes,:GHOST) || 0) if isConst?(attacker.item,PBItems,:GHOSTMEMORY)
  4151. return (getConst(PBTypes,:STEEL) || 0) if isConst?(attacker.item,PBItems,:STEELMEMORY)
  4152. return (getConst(PBTypes,:FIRE) || 0) if isConst?(attacker.item,PBItems,:FIREMEMORY)
  4153. return (getConst(PBTypes,:WATER) || 0) if isConst?(attacker.item,PBItems,:WATERMEMORY)
  4154. return (getConst(PBTypes,:GRASS) || 0) if isConst?(attacker.item,PBItems,:GRASSMEMORY)
  4155. return (getConst(PBTypes,:ELECTRIC) || 0) if isConst?(attacker.item,PBItems,:ELECTRICMEMORY)
  4156. return (getConst(PBTypes,:PSYCHIC) || 0) if isConst?(attacker.item,PBItems,:PSYCHICMEMORY)
  4157. return (getConst(PBTypes,:ICE) || 0) if isConst?(attacker.item,PBItems,:ICEMEMORY)
  4158. return (getConst(PBTypes,:DRAGON) || 0) if isConst?(attacker.item,PBItems,:DRAGONMEMORY)
  4159. return (getConst(PBTypes,:DARK) || 0) if isConst?(attacker.item,PBItems,:DARKMEMORY)
  4160. return (getConst(PBTypes,:FAIRY) || 0) if isConst?(attacker.item,PBItems,:FAIRYMEMORY)
  4161. elsif isConst?(@id,PBMoves,:TECHNOBLAST)
  4162. return getConst(PBTypes,:ELECTRIC) if isConst?(attacker.item,PBItems,:SHOCKDRIVE)
  4163. return getConst(PBTypes,:FIRE) if isConst?(attacker.item,PBItems,:BURNDRIVE)
  4164. return getConst(PBTypes,:ICE) if isConst?(attacker.item,PBItems,:CHILLDRIVE)
  4165. return getConst(PBTypes,:WATER) if isConst?(attacker.item,PBItems,:DOUSEDRIVE)
  4166. end
  4167. return (getConst(PBTypes,:NORMAL) || 0)
  4168. end
  4169.  
  4170. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4171. if isConst?(@id,PBMoves,:TECHNOBLAST)
  4172. anim = 0
  4173. anim = 1 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ELECTRIC)
  4174. anim = 2 if isConst?(pbType(@type,attacker,opponent),PBTypes,:FIRE)
  4175. anim = 3 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ICE)
  4176. anim = 4 if isConst?(pbType(@type,attacker,opponent),PBTypes,:WATER)
  4177. return super(id,attacker,opponent,anim,alltargets,showanimation) # Type-specific anim
  4178. end
  4179. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  4180. end
  4181. end
  4182.  
  4183.  
  4184.  
  4185. ################################################################################
  4186. # This attack is always a critical hit. (Frost Breath, Storm Throw)
  4187. ################################################################################
  4188. class PokeBattle_Move_0A0 < PokeBattle_Move
  4189. def pbCritialOverride(attacker,opponent)
  4190. return true
  4191. end
  4192. end
  4193.  
  4194.  
  4195.  
  4196. ################################################################################
  4197. # For 5 rounds, foes' attacks cannot become critical hits. (Lucky Chant)
  4198. ################################################################################
  4199. class PokeBattle_Move_0A1 < PokeBattle_Move
  4200. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4201. if attacker.pbOwnSide.effects[PBEffects::LuckyChant]>0
  4202. @battle.pbDisplay(_INTL("But it failed!"))
  4203. return -1
  4204. end
  4205. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4206. attacker.pbOwnSide.effects[PBEffects::LuckyChant]=5
  4207. if !@battle.pbIsOpposing?(attacker.index)
  4208. @battle.pbDisplay(_INTL("The Lucky Chant shielded your team from critical hits!"))
  4209. else
  4210. @battle.pbDisplay(_INTL("The Lucky Chant shielded the opposing team from critical hits!"))
  4211. end
  4212. return 0
  4213. end
  4214. end
  4215.  
  4216.  
  4217.  
  4218. ################################################################################
  4219. # For 5 rounds, lowers power of physical attacks against the user's side. (Reflect)
  4220. ################################################################################
  4221. class PokeBattle_Move_0A2 < PokeBattle_Move
  4222. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4223. if attacker.pbOwnSide.effects[PBEffects::Reflect]>0
  4224. @battle.pbDisplay(_INTL("But it failed!"))
  4225. return -1
  4226. end
  4227. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4228. attacker.pbOwnSide.effects[PBEffects::Reflect]=5
  4229. attacker.pbOwnSide.effects[PBEffects::Reflect]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4230. if !@battle.pbIsOpposing?(attacker.index)
  4231. @battle.pbDisplay(_INTL("Reflect raised your team's Defense!"))
  4232. else
  4233. @battle.pbDisplay(_INTL("Reflect raised the opposing team's Defense!"))
  4234. end
  4235. return 0
  4236. end
  4237. end
  4238.  
  4239.  
  4240.  
  4241. ################################################################################
  4242. # For 5 rounds, lowers power of special attacks against the user's side. (Light Screen)
  4243. ################################################################################
  4244. class PokeBattle_Move_0A3 < PokeBattle_Move
  4245. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4246. if attacker.pbOwnSide.effects[PBEffects::LightScreen]>0
  4247. @battle.pbDisplay(_INTL("But it failed!"))
  4248. return -1
  4249. end
  4250. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4251. attacker.pbOwnSide.effects[PBEffects::LightScreen]=5
  4252. attacker.pbOwnSide.effects[PBEffects::LightScreen]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4253. if !@battle.pbIsOpposing?(attacker.index)
  4254. @battle.pbDisplay(_INTL("Light Screen raised your team's Special Defense!"))
  4255. else
  4256. @battle.pbDisplay(_INTL("Light Screen raised the opposing team's Special Defense!"))
  4257. end
  4258. return 0
  4259. end
  4260. end
  4261.  
  4262.  
  4263.  
  4264. ################################################################################
  4265. # Effect depends on the environment. (Secret Power)
  4266. ################################################################################
  4267. class PokeBattle_Move_0A4 < PokeBattle_Move
  4268. def pbAdditionalEffect(attacker,opponent)
  4269. return if opponent.damagestate.substitute
  4270. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4271. if opponent.pbCanParalyze?(attacker,false,self)
  4272. opponent.pbParalyze(attacker)
  4273. end
  4274. return
  4275. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4276. if opponent.pbCanSleep?(attacker,false,self)
  4277. opponent.pbSleep
  4278. end
  4279. return
  4280. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4281. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  4282. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  4283. end
  4284. return
  4285. elsif @battle.field.effects[PBEffects::PsychicTerrain]>0
  4286. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  4287. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  4288. end
  4289. return
  4290. end
  4291. case @battle.environment
  4292. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4293. if opponent.pbCanSleep?(attacker,false,self)
  4294. opponent.pbSleep
  4295. end
  4296. when PBEnvironment::MovingWater, PBEnvironment::Underwater
  4297. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  4298. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  4299. end
  4300. when PBEnvironment::StillWater, PBEnvironment::Sky
  4301. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  4302. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  4303. end
  4304. when PBEnvironment::Sand
  4305. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4306. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4307. end
  4308. when PBEnvironment::Rock
  4309. if USENEWBATTLEMECHANICS
  4310. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4311. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4312. end
  4313. else
  4314. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4315. opponent.pbFlinch(attacker)
  4316. end
  4317. end
  4318. when PBEnvironment::Cave, PBEnvironment::Graveyard, PBEnvironment::Space
  4319. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4320. opponent.pbFlinch(attacker)
  4321. end
  4322. when PBEnvironment::Snow
  4323. if opponent.pbCanFreeze?(attacker,false,self)
  4324. opponent.pbFreeze
  4325. end
  4326. when PBEnvironment::Volcano
  4327. if opponent.pbCanBurn?(attacker,false,self)
  4328. opponent.pbBurn(attacker)
  4329. end
  4330. else
  4331. if opponent.pbCanParalyze?(attacker,false,self)
  4332. opponent.pbParalyze(attacker)
  4333. end
  4334. end
  4335. end
  4336.  
  4337. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4338. id=getConst(PBMoves,:BODYSLAM)
  4339. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4340. id=getConst(PBMoves,:THUNDERSHOCK) || id
  4341. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4342. id=getConst(PBMoves,:VINEWHIP) || id
  4343. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4344. id=getConst(PBMoves,:FAIRYWIND) || id
  4345. elsif @battle.field.effects[PBEffects::PsychicTerrain]>0
  4346. id=getConst(PBMoves,:CONFUSION) || id
  4347. else
  4348. case @battle.environment
  4349. when PBEnvironment::Grass, PBEnvironment::TallGrass
  4350. id=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)) || id
  4351. when PBEnvironment::MovingWater; id=getConst(PBMoves,:WATERPULSE) || id
  4352. when PBEnvironment::StillWater; id=getConst(PBMoves,:MUDSHOT) || id
  4353. when PBEnvironment::Underwater; id=getConst(PBMoves,:WATERPULSE) || id
  4354. when PBEnvironment::Cave; id=getConst(PBMoves,:ROCKTHROW) || id
  4355. when PBEnvironment::Rock; id=getConst(PBMoves,:MUDSLAP) || id
  4356. when PBEnvironment::Sand; id=getConst(PBMoves,:MUDSLAP) || id
  4357. when PBEnvironment::Forest; id=getConst(PBMoves,:RAZORLEAF) || id
  4358. # Ice tiles in Gen 6 should be Ice Shard
  4359. when PBEnvironment::Snow; id=getConst(PBMoves,:AVALANCHE) || id
  4360. when PBEnvironment::Volcano; id=getConst(PBMoves,:INCINERATE) || id
  4361. when PBEnvironment::Graveyard; id=getConst(PBMoves,:SHADOWSNEAK) || id
  4362. when PBEnvironment::Sky; id=getConst(PBMoves,:GUST) || id
  4363. when PBEnvironment::Space; id=getConst(PBMoves,:SWIFT) || id
  4364. end
  4365. end
  4366. return super(id,attacker,opponent,hitnum,alltargets,showanimation) # Environment-specific anim
  4367. end
  4368. end
  4369.  
  4370.  
  4371.  
  4372. ################################################################################
  4373. # Always hits.
  4374. ################################################################################
  4375. class PokeBattle_Move_0A5 < PokeBattle_Move
  4376. def pbAccuracyCheck(attacker,opponent)
  4377. return true
  4378. end
  4379. end
  4380.  
  4381.  
  4382.  
  4383. ################################################################################
  4384. # User's attack next round against the target will definitely hit. (Lock-On, Mind Reader)
  4385. ################################################################################
  4386. class PokeBattle_Move_0A6 < PokeBattle_Move
  4387. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4388. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  4389. @battle.pbDisplay(_INTL("But it failed!"))
  4390. return -1
  4391. end
  4392. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4393. opponent.effects[PBEffects::LockOn]=2
  4394. opponent.effects[PBEffects::LockOnPos]=attacker.index
  4395. @battle.pbDisplay(_INTL("{1} took aim at {2}!",attacker.pbThis,opponent.pbThis(true)))
  4396. return 0
  4397. end
  4398. end
  4399.  
  4400.  
  4401.  
  4402. ################################################################################
  4403. # Target's evasion stat changes are ignored from now on. (Foresight, Odor Sleuth)
  4404. # Normal and Fighting moves have normal effectiveness against the Ghost-type target.
  4405. ################################################################################
  4406. class PokeBattle_Move_0A7 < PokeBattle_Move
  4407. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4408. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4409. @battle.pbDisplay(_INTL("But it failed!"))
  4410. return -1
  4411. end
  4412. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4413. opponent.effects[PBEffects::Foresight]=true
  4414. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4415. return 0
  4416. end
  4417. end
  4418.  
  4419.  
  4420.  
  4421. ################################################################################
  4422. # Target's evasion stat changes are ignored from now on. (Miracle Eye)
  4423. # Psychic moves have normal effectiveness against the Dark-type target.
  4424. ################################################################################
  4425. class PokeBattle_Move_0A8 < PokeBattle_Move
  4426. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4427. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4428. @battle.pbDisplay(_INTL("But it failed!"))
  4429. return -1
  4430. end
  4431. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4432. opponent.effects[PBEffects::MiracleEye]=true
  4433. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4434. return 0
  4435. end
  4436. end
  4437.  
  4438.  
  4439.  
  4440. ################################################################################
  4441. # This move ignores target's Defense, Special Defense and evasion stat changes.
  4442. # (Chip Away, Sacred Sword)
  4443. ################################################################################
  4444. class PokeBattle_Move_0A9 < PokeBattle_Move
  4445. # Handled in superclass def pbAccuracyCheck and def pbCalcDamage, do not edit!
  4446. end
  4447.  
  4448.  
  4449.  
  4450. ################################################################################
  4451. # User is protected against moves with the "B" flag this round. (Detect, Protect)
  4452. ################################################################################
  4453. class PokeBattle_Move_0AA < PokeBattle_Move
  4454. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4455. ratesharers=[
  4456. 0xAA, # Detect, Protect
  4457. 0xAB, # Quick Guard
  4458. 0xAC, # Wide Guard
  4459. 0xE8, # Endure
  4460. 0x14B, # King's Shield
  4461. 0x14C, # Spiky Shield
  4462. 0x174 # Baneful Bunker
  4463. ]
  4464. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4465. attacker.effects[PBEffects::ProtectRate]=1
  4466. end
  4467. unmoved=false
  4468. for poke in @battle.battlers
  4469. next if poke.index==attacker.index
  4470. if @battle.choices[poke.index][0]==1 && # Chose a move
  4471. !poke.hasMovedThisRound?
  4472. unmoved=true; break
  4473. end
  4474. end
  4475. if !unmoved ||
  4476. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  4477. attacker.effects[PBEffects::ProtectRate]=1
  4478. @battle.pbDisplay(_INTL("But it failed!"))
  4479. return -1
  4480. end
  4481. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4482. attacker.effects[PBEffects::Protect]=true
  4483. attacker.effects[PBEffects::ProtectRate]*=2
  4484. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  4485. return 0
  4486. end
  4487. end
  4488.  
  4489.  
  4490.  
  4491. ################################################################################
  4492. # User's side is protected against moves with priority greater than 0 this round.
  4493. # (Quick Guard)
  4494. ################################################################################
  4495. class PokeBattle_Move_0AB < PokeBattle_Move
  4496. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4497. if attacker.pbOwnSide.effects[PBEffects::QuickGuard]
  4498. @battle.pbDisplay(_INTL("But it failed!"))
  4499. return -1
  4500. end
  4501. ratesharers=[
  4502. 0xAA, # Detect, Protect
  4503. 0xAB, # Quick Guard
  4504. 0xAC, # Wide Guard
  4505. 0xE8, # Endure
  4506. 0x14B, # King's Shield
  4507. 0x14C, # Spiky Shield
  4508. 0x174 # Baneful Bunker
  4509. ]
  4510. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4511. attacker.effects[PBEffects::ProtectRate]=1
  4512. end
  4513. unmoved=false
  4514. for poke in @battle.battlers
  4515. next if poke.index==attacker.index
  4516. if @battle.choices[poke.index][0]==1 && # Chose a move
  4517. !poke.hasMovedThisRound?
  4518. unmoved=true; break
  4519. end
  4520. end
  4521. if !unmoved ||
  4522. (!USENEWBATTLEMECHANICS &&
  4523. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4524. attacker.effects[PBEffects::ProtectRate]=1
  4525. @battle.pbDisplay(_INTL("But it failed!"))
  4526. return -1
  4527. end
  4528. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4529. attacker.pbOwnSide.effects[PBEffects::QuickGuard]=true
  4530. attacker.effects[PBEffects::ProtectRate]*=2
  4531. if !@battle.pbIsOpposing?(attacker.index)
  4532. @battle.pbDisplay(_INTL("Quick Guard protected your team!"))
  4533. else
  4534. @battle.pbDisplay(_INTL("Quick Guard protected the opposing team!"))
  4535. end
  4536. return 0
  4537. end
  4538. end
  4539.  
  4540.  
  4541.  
  4542. ################################################################################
  4543. # User's side is protected against moves that target multiple battlers this round.
  4544. # (Wide Guard)
  4545. ################################################################################
  4546. class PokeBattle_Move_0AC < PokeBattle_Move
  4547. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4548. if attacker.pbOwnSide.effects[PBEffects::WideGuard]
  4549. @battle.pbDisplay(_INTL("But it failed!"))
  4550. return -1
  4551. end
  4552. ratesharers=[
  4553. 0xAA, # Detect, Protect
  4554. 0xAB, # Quick Guard
  4555. 0xAC, # Wide Guard
  4556. 0xE8, # Endure
  4557. 0x14B, # King's Shield
  4558. 0x14C, # Spiky Shield
  4559. 0x174 # Baneful Bunker
  4560. ]
  4561. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4562. attacker.effects[PBEffects::ProtectRate]=1
  4563. end
  4564. unmoved=false
  4565. for poke in @battle.battlers
  4566. next if poke.index==attacker.index
  4567. if @battle.choices[poke.index][0]==1 && # Chose a move
  4568. !poke.hasMovedThisRound?
  4569. unmoved=true; break
  4570. end
  4571. end
  4572. if !unmoved ||
  4573. (!USENEWBATTLEMECHANICS &&
  4574. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4575. attacker.effects[PBEffects::ProtectRate]=1
  4576. @battle.pbDisplay(_INTL("But it failed!"))
  4577. return -1
  4578. end
  4579. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4580. attacker.pbOwnSide.effects[PBEffects::WideGuard]=true
  4581. attacker.effects[PBEffects::ProtectRate]*=2
  4582. if !@battle.pbIsOpposing?(attacker.index)
  4583. @battle.pbDisplay(_INTL("Wide Guard protected your team!"))
  4584. else
  4585. @battle.pbDisplay(_INTL("Wide Guard protected the opposing team!"))
  4586. end
  4587. return 0
  4588. end
  4589. end
  4590.  
  4591.  
  4592.  
  4593. ################################################################################
  4594. # Ignores target's protections. If successful, all other moves this round
  4595. # ignore them too. (Feint)
  4596. ################################################################################
  4597. class PokeBattle_Move_0AD < PokeBattle_Move
  4598. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4599. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4600. if ret>0
  4601. opponent.effects[PBEffects::ProtectNegation]=true
  4602. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  4603. end
  4604. return ret
  4605. end
  4606. end
  4607.  
  4608.  
  4609.  
  4610. ################################################################################
  4611. # Uses the last move that the target used. (Mirror Move)
  4612. ################################################################################
  4613. class PokeBattle_Move_0AE < PokeBattle_Move
  4614. def doesCallOtherMoves?
  4615. return true
  4616. end
  4617.  
  4618. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4619. if opponent.lastMoveUsed<=0 ||
  4620. (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: can be copied by Mirror Move
  4621. @battle.pbDisplay(_INTL("The mirror move failed!"))
  4622. return -1
  4623. end
  4624. attacker.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
  4625. return 0
  4626. end
  4627. end
  4628.  
  4629.  
  4630.  
  4631. ################################################################################
  4632. # Uses the last move that was used. (Copycat)
  4633. ################################################################################
  4634. class PokeBattle_Move_0AF < PokeBattle_Move
  4635. def doesCallOtherMoves?
  4636. return true
  4637. end
  4638.  
  4639. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4640. blacklist=[
  4641. 0x02, # Struggle
  4642. 0x69, # Transform
  4643. 0x71, # Counter
  4644. 0x72, # Mirror Coat
  4645. 0x73, # Metal Burst
  4646. 0x9C, # Helping Hand
  4647. 0xAA, # Detect, Protect
  4648. 0xAD, # Feint
  4649. 0xAE, # Mirror Move
  4650. 0xAF, # Copycat
  4651. 0xB2, # Snatch
  4652. 0xE7, # Destiny Bond
  4653. 0xE8, # Endure
  4654. 0xEC, # Circle Throw, Dragon Tail
  4655. 0xF1, # Covet, Thief
  4656. 0xF2, # Switcheroo, Trick
  4657. 0xF3, # Bestow
  4658. 0x115, # Focus Punch
  4659. 0x117, # Follow Me, Rage Powder
  4660. 0x158, # Belch
  4661. 0x174, # Baneful Bunker
  4662. 0x15C, # Beak Blast
  4663. 0x173, # Shell Trap
  4664. 0x175 # Spotlight
  4665.  
  4666. ]
  4667. if USENEWBATTLEMECHANICS
  4668. blacklist+=[
  4669. 0xEB, # Roar, Whirlwind
  4670. 0xD4, # Bide
  4671. # Two-turn moves
  4672. 0xC3, # Razor Wind
  4673. 0xC4, # Solar Beam, Solar Blade
  4674. 0xC5, # Freeze Shock
  4675. 0xC6, # Ice Burn
  4676. 0xC7, # Sky Attack
  4677. 0xC8, # Skull Bash
  4678. 0xC9, # Fly
  4679. 0xCA, # Dig
  4680. 0xCB, # Dive
  4681. 0xCC, # Bounce
  4682. 0xCD, # Shadow Force
  4683. 0xCE, # Sky Drop
  4684. 0x14D, # Phantom Force
  4685. 0x14E # Geomancy
  4686. ]
  4687. end
  4688. if @battle.lastMoveUsed<=0 ||
  4689. blacklist.include?(PBMoveData.new(@battle.lastMoveUsed).function)
  4690. @battle.pbDisplay(_INTL("But it failed!"))
  4691. return -1
  4692. end
  4693. attacker.pbUseMoveSimple(@battle.lastMoveUsed)
  4694. return 0
  4695. end
  4696. end
  4697.  
  4698.  
  4699.  
  4700. ################################################################################
  4701. # Uses the move the target was about to use this round, with 1.5x power. (Me First)
  4702. ################################################################################
  4703. class PokeBattle_Move_0B0 < PokeBattle_Move
  4704. def doesCallOtherMoves?
  4705. return true
  4706. end
  4707.  
  4708. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4709. blacklist=[
  4710. 0x02, # Struggle
  4711. 0x14, # Chatter
  4712. 0x71, # Counter
  4713. 0x72, # Mirror Coat
  4714. 0x73, # Metal Burst
  4715. 0xB0, # Me First
  4716. 0xF1, # Covet, Thief
  4717. 0x115, # Focus Punch
  4718. 0x158, # Belch
  4719. 0x173, # Shell Trap
  4720. 0x15C # Beak Blast
  4721. ]
  4722. if USENEWBATTLEMECHANICS
  4723. blacklist+=[
  4724. 0xD4, # Bide
  4725. # Consecutively executed moves
  4726. 0xD3, # Ice Ball, Rollout
  4727. 0xD2, # Outrage, Petal Dance, Thrash
  4728. 0xD1 # Uproar
  4729. ]
  4730. end
  4731. oppmove=@battle.choices[opponent.index][2]
  4732. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  4733. opponent.hasMovedThisRound? ||
  4734. !oppmove || oppmove.id<=0 ||
  4735. oppmove.pbIsStatus? ||
  4736. blacklist.include?(oppmove.function)
  4737. @battle.pbDisplay(_INTL("But it failed!"))
  4738. return -1
  4739. end
  4740. attacker.effects[PBEffects::MeFirst]=true
  4741. attacker.pbUseMoveSimple(oppmove.id)
  4742. attacker.effects[PBEffects::MeFirst]=false
  4743. return 0
  4744. end
  4745. end
  4746.  
  4747.  
  4748.  
  4749. ################################################################################
  4750. # This round, reflects all moves with the "C" flag targeting the user back at
  4751. # their origin. (Magic Coat)
  4752. ################################################################################
  4753. class PokeBattle_Move_0B1 < PokeBattle_Move
  4754. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4755. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4756. attacker.effects[PBEffects::MagicCoat]=true
  4757. @battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",attacker.pbThis))
  4758. return 0
  4759. end
  4760. end
  4761.  
  4762.  
  4763.  
  4764. ################################################################################
  4765. # This round, snatches all used moves with the "D" flag. (Snatch)
  4766. ################################################################################
  4767. class PokeBattle_Move_0B2 < PokeBattle_Move
  4768. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4769. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4770. attacker.effects[PBEffects::Snatch]=true
  4771. @battle.pbDisplay(_INTL("{1} waits for a target to make a move!",attacker.pbThis))
  4772. return 0
  4773. end
  4774. end
  4775.  
  4776.  
  4777.  
  4778. ################################################################################
  4779. # Uses a different move depending on the environment. (Nature Power)
  4780. ################################################################################
  4781. class PokeBattle_Move_0B3 < PokeBattle_Move
  4782. def doesCallOtherMoves?
  4783. return true
  4784. end
  4785.  
  4786. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4787. move=getConst(PBMoves,:TRIATTACK) || 0
  4788. case @battle.environment
  4789. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4790. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:ENERGYBALL) : getConst(PBMoves,:SEEDBOMB)) || move
  4791. when PBEnvironment::MovingWater; move=getConst(PBMoves,:HYDROPUMP) || move
  4792. when PBEnvironment::StillWater; move=getConst(PBMoves,:MUDBOMB) || move
  4793. when PBEnvironment::Underwater; move=getConst(PBMoves,:HYDROPUMP) || move
  4794. when PBEnvironment::Cave
  4795. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:POWERGEM) : getConst(PBMoves,:ROCKSLIDE)) || move
  4796. when PBEnvironment::Rock
  4797. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:ROCKSLIDE)) || move
  4798. when PBEnvironment::Sand
  4799. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:EARTHQUAKE)) || move
  4800. # Ice tiles in Gen 6 should be Ice Beam
  4801. when PBEnvironment::Snow
  4802. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:FROSTBREATH) : getConst(PBMoves,:ICEBEAM)) || move
  4803. when PBEnvironment::Volcano; move=getConst(PBMoves,:LAVAPLUME) || move
  4804. when PBEnvironment::Graveyard; move=getConst(PBMoves,:SHADOWBALL) || move
  4805. when PBEnvironment::Sky; move=getConst(PBMoves,:AIRSLASH) || move
  4806. when PBEnvironment::Space; move=getConst(PBMoves,:DRACOMETEOR) || move
  4807. end
  4808. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4809. move=getConst(PBMoves,:THUNDERBOLT) || move
  4810. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4811. move=getConst(PBMoves,:ENERGYBALL) || move
  4812. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4813. move=getConst(PBMoves,:MOONBLAST) || move
  4814. elsif @battle.field.effects[PBEffects::PsychicTerrain]>0
  4815. move=getConst(PBMoves,:PSYCHIC) || move
  4816. end
  4817. if move==0
  4818. @battle.pbDisplay(_INTL("But it failed!"))
  4819. return -1
  4820. end
  4821. thismovename=PBMoves.getName(@id)
  4822. movename=PBMoves.getName(move)
  4823. @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
  4824. target=(USENEWBATTLEMECHANICS && opponent) ? opponent.index : -1
  4825. attacker.pbUseMoveSimple(move,-1,target)
  4826. return 0
  4827. end
  4828. end
  4829.  
  4830.  
  4831.  
  4832. ################################################################################
  4833. # Uses a random move the user knows. Fails if user is not asleep. (Sleep Talk)
  4834. ################################################################################
  4835. class PokeBattle_Move_0B4 < PokeBattle_Move
  4836. def pbCanUseWhileAsleep?
  4837. return true
  4838. end
  4839.  
  4840. def doesCallOtherMoves?
  4841. return true
  4842. end
  4843.  
  4844. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4845. if attacker.status!=PBStatuses::SLEEP &&
  4846. (!attacker.hasWorkingAbility(:COMATOSE) ||
  4847. !isConst?(attacker.species,PBSpecies,:KOMALA))
  4848. @battle.pbDisplay(_INTL("But it failed!"))
  4849. return -1
  4850. end
  4851. blacklist=[
  4852. 0x02, # Struggle
  4853. 0x14, # Chatter
  4854. 0x5C, # Mimic
  4855. 0x5D, # Sketch
  4856. 0xAE, # Mirror Move
  4857. 0xAF, # Copycat
  4858. 0xB0, # Me First
  4859. 0xB3, # Nature Power
  4860. 0xB4, # Sleep Talk
  4861. 0xB5, # Assist
  4862. 0xB6, # Metronome
  4863. 0xD1, # Uproar
  4864. 0xD4, # Bide
  4865. 0x115, # Focus Punch
  4866. 0x158, # Belch
  4867. 0x15C, # Beak Blast
  4868. 0x173, # Shell Trap
  4869. 0x175, # Spotlight
  4870. # Two-turn attacks
  4871. 0xC3, # Razor Wind
  4872. 0xC4, # Solar Beam, Solar Blade
  4873. 0xC5, # Freeze Shock
  4874. 0xC6, # Ice Burn
  4875. 0xC7, # Sky Attack
  4876. 0xC8, # Skull Bash
  4877. 0xC9, # Fly
  4878. 0xCA, # Dig
  4879. 0xCB, # Dive
  4880. 0xCC, # Bounce
  4881. 0xCD, # Shadow Force
  4882. 0xCE, # Sky Drop
  4883. 0x14D, # Phantom Force
  4884. 0x14E # Geomancy
  4885. ]
  4886. choices=[]
  4887. for i in 0...4
  4888. found=false
  4889. next if attacker.moves[i].id==0
  4890. found=true if blacklist.include?(attacker.moves[i].function)
  4891. next if found
  4892. choices.push(i) if @battle.pbCanChooseMove?(attacker.index,i,false,true)
  4893. end
  4894. if choices.length==0
  4895. @battle.pbDisplay(_INTL("But it failed!"))
  4896. return -1
  4897. end
  4898. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4899. choice=choices[@battle.pbRandom(choices.length)]
  4900. attacker.pbUseMoveSimple(attacker.moves[choice].id,-1,attacker.pbOppositeOpposing.index)
  4901. return 0
  4902. end
  4903. end
  4904.  
  4905.  
  4906.  
  4907. ################################################################################
  4908. # Uses a random move known by any non-user Pokémon in the user's party. (Assist)
  4909. ################################################################################
  4910. class PokeBattle_Move_0B5 < PokeBattle_Move
  4911. def doesCallOtherMoves?
  4912. return true
  4913. end
  4914.  
  4915. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4916. blacklist=[
  4917. 0x02, # Struggle
  4918. 0x14, # Chatter
  4919. 0x5C, # Mimic
  4920. 0x5D, # Sketch
  4921. 0x69, # Transform
  4922. 0x71, # Counter
  4923. 0x72, # Mirror Coat
  4924. 0x73, # Metal Burst
  4925. 0x9C, # Helping Hand
  4926. 0xAA, # Detect, Protect
  4927. 0xAD, # Feint
  4928. 0xAE, # Mirror Move
  4929. 0xAF, # Copycat
  4930. 0xB0, # Me First
  4931. 0xB2, # Snatch
  4932. 0xB3, # Nature Power
  4933. 0xB4, # Sleep Talk
  4934. 0xB5, # Assist
  4935. 0xB6, # Metronome
  4936. 0xCD, # Shadow Force
  4937. 0xE7, # Destiny Bond
  4938. 0xE8, # Endure
  4939. 0xEB, # Roar, Whirlwind
  4940. 0xEC, # Circle Throw, Dragon Tail
  4941. 0xF1, # Covet, Thief
  4942. 0xF2, # Switcheroo, Trick
  4943. 0xF3, # Bestow
  4944. 0x115, # Focus Punch
  4945. 0x117, # Follow Me, Rage Powder
  4946. 0x149, # Mat Block
  4947. 0x14B, # King's Shield
  4948. 0x14C, # Spiky Shield
  4949. 0x14D, # Phantom Force
  4950. 0x158, # Belch
  4951. 0x174, # Baneful Bunker
  4952. 0x15C, # Beak Blast
  4953. 0x173, # Shell Trap
  4954. 0x175 # Spotlight
  4955. ]
  4956. if USENEWBATTLEMECHANICS
  4957. blacklist+=[
  4958. # Two-turn attacks
  4959. 0xC3, # Razor Wind
  4960. 0xC4, # SolarBeam
  4961. 0xC5, # Freeze Shock
  4962. 0xC6, # Ice Burn
  4963. 0xC7, # Sky Attack
  4964. 0xC8, # Skull Bash
  4965. 0xC9, # Fly
  4966. 0xCA, # Dig
  4967. 0xCB, # Dive
  4968. 0xCC, # Bounce
  4969. 0xCD, # Shadow Force
  4970. 0xCE, # Sky Drop
  4971. 0x14D, # Phantom Force
  4972. 0x14E # Geomancy
  4973. ]
  4974. end
  4975. moves=[]
  4976. party=@battle.pbParty(attacker.index) # NOTE: pbParty is common to both allies in multi battles
  4977. for i in 0...party.length
  4978. if i!=attacker.pokemonIndex && party[i] && !(USENEWBATTLEMECHANICS && party[i].egg?)
  4979. for j in party[i].moves
  4980. next if isConst?(j.type,PBTypes,:SHADOW)
  4981. next if j.id==0
  4982. found=false
  4983. moves.push(j.id) if !blacklist.include?(PBMoveData.new(j.id).function)
  4984. end
  4985. end
  4986. end
  4987. if moves.length==0
  4988. @battle.pbDisplay(_INTL("But it failed!"))
  4989. return -1
  4990. end
  4991. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4992. move=moves[@battle.pbRandom(moves.length)]
  4993. attacker.pbUseMoveSimple(move)
  4994. return 0
  4995. end
  4996. end
  4997.  
  4998.  
  4999.  
  5000. ################################################################################
  5001. # Uses a random move that exists. (Metronome)
  5002. ################################################################################
  5003. class PokeBattle_Move_0B6 < PokeBattle_Move
  5004. def doesCallOtherMoves?
  5005. return true
  5006. end
  5007.  
  5008. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5009. blacklist=[
  5010. 0x02, # Struggle
  5011. 0x11, # Snore
  5012. 0x14, # Chatter
  5013. 0x5C, # Mimic
  5014. 0x5D, # Sketch
  5015. 0x69, # Transform
  5016. 0x71, # Counter
  5017. 0x72, # Mirror Coat
  5018. 0x73, # Metal Burst
  5019. 0x9C, # Helping Hand
  5020. 0xAA, # Detect, Protect
  5021. 0xAB, # Quick Guard
  5022. 0xAC, # Wide Guard
  5023. 0xAD, # Feint
  5024. 0xAE, # Mirror Move
  5025. 0xAF, # Copycat
  5026. 0xB0, # Me First
  5027. 0xB2, # Snatch
  5028. 0xB3, # Nature Power
  5029. 0xB4, # Sleep Talk
  5030. 0xB5, # Assist
  5031. 0xB6, # Metronome
  5032. 0xE7, # Destiny Bond
  5033. 0xE8, # Endure
  5034. 0xF1, # Covet, Thief
  5035. 0xF2, # Switcheroo, Trick
  5036. 0xF3, # Bestow
  5037. 0x115, # Focus Punch
  5038. 0x117, # Follow Me, Rage Powder
  5039. 0x11D, # After You
  5040. 0x11E, # Quash
  5041. 0x158, # Belch
  5042. 0x174, # Baneful Bunker
  5043. 0x15C, # Beak Blast
  5044. 0x173, # Shell Trap
  5045. 0x175, # Spotlight
  5046. 0x134, # Celebrate
  5047. 0x14A, # Crafty Shield
  5048. 0x136, # Diamond Storm
  5049. 0x133, # Hold Hands
  5050. 0x13B, # Hyperspace Fury
  5051. 0x147, # Hyperspace Hole
  5052. 0x163, # Instruct
  5053. 0x14B, # King's Shield
  5054. 0x149, # Mat Block
  5055. 0x169, # Spectral Thief
  5056. 0x14C, # Spiky Shield
  5057. ]
  5058. blacklistmoves=[
  5059. :FREEZESHOCK,
  5060. :ICEBURN,
  5061. :RELICSONG,
  5062. :SECRETSWORD,
  5063. :SNARL,
  5064. :TECHNOBLAST,
  5065. :VCREATE,
  5066. :THOUSANDARROWS,
  5067. :THOUSANDWAVES,
  5068. :FLEURCANNON,
  5069. :LIGHTOFRUIN,
  5070. :MINDBLOWN,
  5071. :PHOTONGEYSER,
  5072. :PLASMAFISTS,
  5073. :STEAMERUPTION
  5074. ]
  5075. i=0; loop do break unless i<1000
  5076. move=@battle.pbRandom(PBMoves.maxValue)+1
  5077. next if isConst?(PBMoveData.new(move).type,PBTypes,:SHADOW)
  5078. found=false
  5079. if blacklist.include?(PBMoveData.new(move).function)
  5080. found=true
  5081. else
  5082. for j in blacklistmoves
  5083. if isConst?(move,PBMoves,j)
  5084. found=true
  5085. break
  5086. end
  5087. end
  5088. end
  5089. if !found
  5090. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5091. attacker.pbUseMoveSimple(move)
  5092. return 0
  5093. end
  5094. i+=1
  5095. end
  5096. @battle.pbDisplay(_INTL("But it failed!"))
  5097. return -1
  5098. end
  5099. end
  5100.  
  5101.  
  5102.  
  5103. ################################################################################
  5104. # The target can no longer use the same move twice in a row. (Torment)
  5105. ################################################################################
  5106. class PokeBattle_Move_0B7 < PokeBattle_Move
  5107. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5108. if opponent.effects[PBEffects::Torment]
  5109. @battle.pbDisplay(_INTL("But it failed!"))
  5110. return -1
  5111. end
  5112. if !attacker.hasMoldBreaker
  5113. if opponent.hasWorkingAbility(:AROMAVEIL)
  5114. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5115. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5116. return -1
  5117. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5118. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5119. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5120. return -1
  5121. end
  5122. end
  5123. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5124. opponent.effects[PBEffects::Torment]=true
  5125. @battle.pbDisplay(_INTL("{1} was subjected to torment!",opponent.pbThis))
  5126. return 0
  5127. end
  5128. end
  5129.  
  5130.  
  5131.  
  5132. ################################################################################
  5133. # Disables all target's moves that the user also knows. (Imprison)
  5134. ################################################################################
  5135. class PokeBattle_Move_0B8 < PokeBattle_Move
  5136. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5137. if attacker.effects[PBEffects::Imprison]
  5138. @battle.pbDisplay(_INTL("But it failed!"))
  5139. return -1
  5140. end
  5141. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5142. attacker.effects[PBEffects::Imprison]=true
  5143. @battle.pbDisplay(_INTL("{1} sealed the opponent's move(s)!",attacker.pbThis))
  5144. return 0
  5145. end
  5146. end
  5147.  
  5148.  
  5149.  
  5150. ################################################################################
  5151. # For 5 rounds, disables the last move the target used. (Disable)
  5152. ################################################################################
  5153. class PokeBattle_Move_0B9 < PokeBattle_Move
  5154. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5155. if opponent.effects[PBEffects::Disable]>0
  5156. @battle.pbDisplay(_INTL("But it failed!"))
  5157. return -1
  5158. end
  5159. if !attacker.hasMoldBreaker
  5160. if opponent.hasWorkingAbility(:AROMAVEIL)
  5161. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5162. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5163. return -1
  5164. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5165. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5166. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5167. return -1
  5168. end
  5169. end
  5170. for i in opponent.moves
  5171. if i.id>0 && i.id==opponent.lastMoveUsed && (i.pp>0 || i.totalpp==0)
  5172. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5173. opponent.effects[PBEffects::Disable]=5
  5174. opponent.effects[PBEffects::DisableMove]=opponent.lastMoveUsed
  5175. @battle.pbDisplay(_INTL("{1}'s {2} was disabled!",opponent.pbThis,i.name))
  5176. return 0
  5177. end
  5178. end
  5179. @battle.pbDisplay(_INTL("But it failed!"))
  5180. return -1
  5181. end
  5182. end
  5183.  
  5184.  
  5185.  
  5186. ################################################################################
  5187. # For 4 rounds, disables the target's non-damaging moves. (Taunt)
  5188. ################################################################################
  5189. class PokeBattle_Move_0BA < PokeBattle_Move
  5190. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5191. if opponent.effects[PBEffects::Taunt]>0 ||
  5192. (USENEWBATTLEMECHANICS &&
  5193. !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS))
  5194. @battle.pbDisplay(_INTL("But it failed!"))
  5195. return -1
  5196. end
  5197. if !attacker.hasMoldBreaker
  5198. if opponent.hasWorkingAbility(:AROMAVEIL)
  5199. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5200. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5201. return -1
  5202. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5203. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5204. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5205. return -1
  5206. end
  5207. end
  5208. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5209. opponent.effects[PBEffects::Taunt]=4
  5210. @battle.pbDisplay(_INTL("{1} fell for the taunt!",opponent.pbThis))
  5211. return 0
  5212. end
  5213. end
  5214.  
  5215.  
  5216.  
  5217. ################################################################################
  5218. # For 5 rounds, disables the target's healing moves. (Heal Block)
  5219. ################################################################################
  5220. class PokeBattle_Move_0BB < PokeBattle_Move
  5221. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5222. if opponent.effects[PBEffects::HealBlock]>0
  5223. @battle.pbDisplay(_INTL("But it failed!"))
  5224. return -1
  5225. end
  5226. if !attacker.hasMoldBreaker
  5227. if opponent.hasWorkingAbility(:AROMAVEIL)
  5228. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5229. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5230. return -1
  5231. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5232. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5233. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5234. return -1
  5235. end
  5236. end
  5237. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5238. opponent.effects[PBEffects::HealBlock]=5
  5239. @battle.pbDisplay(_INTL("{1} was prevented from healing!",opponent.pbThis))
  5240. return 0
  5241. end
  5242. end
  5243.  
  5244.  
  5245.  
  5246. ################################################################################
  5247. # For 3 rounds, the target must use the same move each round. (Encore)
  5248. ################################################################################
  5249. class PokeBattle_Move_0BC < PokeBattle_Move
  5250. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5251. blacklist=[
  5252. 0x02, # Struggle
  5253. 0x5C, # Mimic
  5254. 0x5D, # Sketch
  5255. 0x69, # Transform
  5256. 0xAE, # Mirror Move
  5257. 0xBC, # Encore
  5258. 0xB5, # Assist
  5259. 0xAF, # Copycat
  5260. 0xB0, # Me First
  5261. 0xB6, # Metronome
  5262. 0xB3, # Nature Power
  5263. 0xB4, # Sleep Talk
  5264. 0x173, # Shell Trap
  5265. 0x15C # Beak Blast
  5266. ]
  5267. if opponent.effects[PBEffects::Encore]>0
  5268. @battle.pbDisplay(_INTL("But it failed!"))
  5269. return -1
  5270. end
  5271. if opponent.lastMoveUsed<=0 ||
  5272. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  5273. @battle.pbDisplay(_INTL("But it failed!"))
  5274. return -1
  5275. end
  5276. if !attacker.hasMoldBreaker
  5277. if opponent.hasWorkingAbility(:AROMAVEIL)
  5278. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5279. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5280. return -1
  5281. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5282. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5283. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5284. return -1
  5285. end
  5286. end
  5287. for i in 0...4
  5288. if opponent.lastMoveUsed==opponent.moves[i].id &&
  5289. (opponent.moves[i].pp>0 || opponent.moves[i].totalpp==0)
  5290. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5291. opponent.effects[PBEffects::Encore]=3
  5292. opponent.effects[PBEffects::EncoreIndex]=i
  5293. opponent.effects[PBEffects::EncoreMove]=opponent.moves[i].id
  5294. @battle.pbDisplay(_INTL("{1} received an encore!",opponent.pbThis))
  5295. return 0
  5296. end
  5297. end
  5298. @battle.pbDisplay(_INTL("But it failed!"))
  5299. return -1
  5300. end
  5301. end
  5302.  
  5303.  
  5304.  
  5305. ################################################################################
  5306. # Hits twice.
  5307. ################################################################################
  5308. class PokeBattle_Move_0BD < PokeBattle_Move
  5309. def pbIsMultiHit
  5310. return true
  5311. end
  5312.  
  5313. def pbNumHits(attacker)
  5314. return 2
  5315. end
  5316. end
  5317.  
  5318.  
  5319.  
  5320. ################################################################################
  5321. # Hits twice. May poison the target on each hit. (Twineedle)
  5322. ################################################################################
  5323. class PokeBattle_Move_0BE < PokeBattle_Move
  5324. def pbIsMultiHit
  5325. return true
  5326. end
  5327.  
  5328. def pbNumHits(attacker)
  5329. return 2
  5330. end
  5331.  
  5332. def pbAdditionalEffect(attacker,opponent)
  5333. return if opponent.damagestate.substitute
  5334. if opponent.pbCanPoison?(attacker,false,self)
  5335. opponent.pbPoison(attacker)
  5336. end
  5337. end
  5338. end
  5339.  
  5340.  
  5341.  
  5342. ################################################################################
  5343. # Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
  5344. # An accuracy check is performed for each hit.
  5345. ################################################################################
  5346. class PokeBattle_Move_0BF < PokeBattle_Move
  5347. def pbIsMultiHit
  5348. return true
  5349. end
  5350.  
  5351. def pbNumHits(attacker)
  5352. return 3
  5353. end
  5354.  
  5355. def successCheckPerHit?
  5356. return @checks
  5357. end
  5358.  
  5359. def pbOnStartUse(attacker)
  5360. @calcbasedmg=@basedamage
  5361. @checks=!attacker.hasWorkingAbility(:SKILLLINK)
  5362. return true
  5363. end
  5364.  
  5365. def pbBaseDamage(basedmg,attacker,opponent)
  5366. ret=@calcbasedmg
  5367. @calcbasedmg+=basedmg
  5368. return ret
  5369. end
  5370. end
  5371.  
  5372.  
  5373.  
  5374. ################################################################################
  5375. # Hits 2-5 times.
  5376. ################################################################################
  5377. class PokeBattle_Move_0C0 < PokeBattle_Move
  5378. def pbIsMultiHit
  5379. return true
  5380. end
  5381.  
  5382. def pbNumHits(attacker)
  5383. hitchances=[2,2,3,3,4,5]
  5384. ret=hitchances[@battle.pbRandom(hitchances.length)]
  5385. ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  5386. return ret
  5387. end
  5388. end
  5389.  
  5390.  
  5391.  
  5392. ################################################################################
  5393. # Hits X times, where X is 1 (the user) plus the number of non-user unfainted
  5394. # status-free Pokémon in the user's party (the participants). Fails if X is 0.
  5395. # Base power of each hit depends on the base Attack stat for the species of that
  5396. # hit's participant. (Beat Up)
  5397. ################################################################################
  5398. class PokeBattle_Move_0C1 < PokeBattle_Move
  5399. def pbIsMultiHit
  5400. return true
  5401. end
  5402.  
  5403. def pbNumHits(attacker)
  5404. return @participants.length
  5405. end
  5406.  
  5407. def pbOnStartUse(attacker)
  5408. party=@battle.pbParty(attacker.index)
  5409. @participants=[]
  5410. for i in 0...party.length
  5411. if attacker.pokemonIndex==i
  5412. @participants.push(i)
  5413. elsif party[i] && !party[i].egg? && party[i].hp>0 && party[i].status==0
  5414. @participants.push(i)
  5415. end
  5416. end
  5417. if @participants.length==0
  5418. @battle.pbDisplay(_INTL("But it failed!"))
  5419. return false
  5420. end
  5421. return true
  5422. end
  5423.  
  5424. def pbBaseDamage(basedmg,attacker,opponent)
  5425. party=@battle.pbParty(attacker.index)
  5426. atk=party[@participants[0]].baseStats[1]
  5427. @participants[0]=nil; @participants.compact!
  5428. return 5+(atk/10)
  5429. end
  5430. end
  5431.  
  5432.  
  5433.  
  5434. ################################################################################
  5435. # Two turn attack. Attacks first turn, skips second turn (if successful).
  5436. ################################################################################
  5437. class PokeBattle_Move_0C2 < PokeBattle_Move
  5438. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5439. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5440. if opponent.damagestate.calcdamage>0
  5441. attacker.effects[PBEffects::HyperBeam]=2
  5442. attacker.currentMove=@id
  5443. end
  5444. return ret
  5445. end
  5446. end
  5447.  
  5448.  
  5449.  
  5450. ################################################################################
  5451. # Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
  5452. ################################################################################
  5453. class PokeBattle_Move_0C3 < PokeBattle_Move
  5454. def pbTwoTurnAttack(attacker)
  5455. @immediate=false
  5456. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5457. @immediate=true
  5458. end
  5459. return false if @immediate
  5460. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5461. end
  5462.  
  5463. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5464. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5465. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5466. @battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",attacker.pbThis))
  5467. end
  5468. if @immediate
  5469. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5470. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5471. attacker.pbConsumeItem
  5472. end
  5473. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5474. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5475. end
  5476. end
  5477.  
  5478.  
  5479.  
  5480. ################################################################################
  5481. # Two turn attack. Skips first turn, attacks second turn. (SolarBeam)
  5482. # Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
  5483. ################################################################################
  5484. class PokeBattle_Move_0C4 < PokeBattle_Move
  5485. def pbTwoTurnAttack(attacker)
  5486. @immediate=false; @sunny=false
  5487. if attacker.effects[PBEffects::TwoTurnAttack]==0
  5488. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  5489. @battle.pbWeather==PBWeather::HARSHSUN
  5490. @immediate=true; @sunny=true
  5491. end
  5492. end
  5493. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5494. @immediate=true
  5495. end
  5496. return false if @immediate
  5497. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5498. end
  5499.  
  5500. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  5501. if @battle.pbWeather!=0 &&
  5502. @battle.pbWeather!=PBWeather::SUNNYDAY &&
  5503. @battle.pbWeather!=PBWeather::HARSHSUN
  5504. return (damagemult*0.5).round
  5505. end
  5506. return damagemult
  5507. end
  5508.  
  5509. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5510. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5511. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5512. @battle.pbDisplay(_INTL("{1} took in sunlight!",attacker.pbThis))
  5513. end
  5514. if @immediate && !@sunny
  5515. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5516. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5517. attacker.pbConsumeItem
  5518. end
  5519. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5520. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5521. end
  5522. end
  5523.  
  5524.  
  5525.  
  5526.  
  5527. ################################################################################
  5528. # Two turn attack. Skips first turn, attacks second turn. (Freeze Shock)
  5529. # May paralyze the target.
  5530. ################################################################################
  5531. class PokeBattle_Move_0C5 < PokeBattle_Move
  5532. def pbTwoTurnAttack(attacker)
  5533. @immediate=false
  5534. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5535. @immediate=true
  5536. end
  5537. return false if @immediate
  5538. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5539. end
  5540.  
  5541. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5542. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5543. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5544. @battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",attacker.pbThis))
  5545. end
  5546. if @immediate
  5547. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5548. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5549. attacker.pbConsumeItem
  5550. end
  5551. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5552. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5553. end
  5554.  
  5555. def pbAdditionalEffect(attacker,opponent)
  5556. return if opponent.damagestate.substitute
  5557. if opponent.pbCanParalyze?(attacker,false,self)
  5558. opponent.pbParalyze(attacker)
  5559. end
  5560. end
  5561. end
  5562.  
  5563.  
  5564.  
  5565. ################################################################################
  5566. # Two turn attack. Skips first turn, attacks second turn. (Ice Burn)
  5567. # May burn the target.
  5568. ################################################################################
  5569. class PokeBattle_Move_0C6 < PokeBattle_Move
  5570. def pbTwoTurnAttack(attacker)
  5571. @immediate=false
  5572. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5573. @immediate=true
  5574. end
  5575. return false if @immediate
  5576. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5577. end
  5578.  
  5579. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5580. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5581. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5582. @battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",attacker.pbThis))
  5583. end
  5584. if @immediate
  5585. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5586. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5587. attacker.pbConsumeItem
  5588. end
  5589. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5590. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5591. end
  5592.  
  5593. def pbAdditionalEffect(attacker,opponent)
  5594. return if opponent.damagestate.substitute
  5595. if opponent.pbCanBurn?(attacker,false,self)
  5596. opponent.pbBurn(attacker)
  5597. end
  5598. end
  5599. end
  5600.  
  5601.  
  5602.  
  5603. ################################################################################
  5604. # Two turn attack. Skips first turn, attacks second turn. (Sky Attack)
  5605. # May make the target flinch.
  5606. ################################################################################
  5607. class PokeBattle_Move_0C7 < PokeBattle_Move
  5608. def pbTwoTurnAttack(attacker)
  5609. @immediate=false
  5610. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5611. @immediate=true
  5612. end
  5613. return false if @immediate
  5614. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5615. end
  5616.  
  5617. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5618. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5619. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5620. @battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",attacker.pbThis))
  5621. end
  5622. if @immediate
  5623. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5624. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5625. attacker.pbConsumeItem
  5626. end
  5627. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5628. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5629. end
  5630.  
  5631. def pbAdditionalEffect(attacker,opponent)
  5632. return if opponent.damagestate.substitute
  5633. opponent.pbFlinch(attacker)
  5634. end
  5635. end
  5636.  
  5637.  
  5638.  
  5639. ################################################################################
  5640. # Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
  5641. # (Skull Bash)
  5642. ################################################################################
  5643. class PokeBattle_Move_0C8 < PokeBattle_Move
  5644. def pbTwoTurnAttack(attacker)
  5645. @immediate=false
  5646. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5647. @immediate=true
  5648. end
  5649. return false if @immediate
  5650. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5651. end
  5652.  
  5653. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5654. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5655. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5656. @battle.pbDisplay(_INTL("{1} tucked in its head!",attacker.pbThis))
  5657. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5658. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  5659. end
  5660. end
  5661. if @immediate
  5662. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5663. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5664. attacker.pbConsumeItem
  5665. end
  5666. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5667. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5668. end
  5669. end
  5670.  
  5671.  
  5672.  
  5673. ################################################################################
  5674. # Two turn attack. Skips first turn, attacks second turn. (Fly)
  5675. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5676. ################################################################################
  5677. class PokeBattle_Move_0C9 < PokeBattle_Move
  5678. def unusableInGravity?
  5679. return true
  5680. end
  5681.  
  5682. def pbTwoTurnAttack(attacker)
  5683. @immediate=false
  5684. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5685. @immediate=true
  5686. end
  5687. return false if @immediate
  5688. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5689. end
  5690.  
  5691. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5692. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5693. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5694. @battle.pbDisplay(_INTL("{1} flew up high!",attacker.pbThis))
  5695. end
  5696. if @immediate
  5697. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5698. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5699. attacker.pbConsumeItem
  5700. end
  5701. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5702. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5703. end
  5704. end
  5705.  
  5706.  
  5707.  
  5708. ################################################################################
  5709. # Two turn attack. Skips first turn, attacks second turn. (Dig)
  5710. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5711. ################################################################################
  5712. class PokeBattle_Move_0CA < PokeBattle_Move
  5713. def pbTwoTurnAttack(attacker)
  5714. @immediate=false
  5715. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5716. @immediate=true
  5717. end
  5718. return false if @immediate
  5719. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5720. end
  5721.  
  5722. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5723. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5724. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5725. @battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",attacker.pbThis))
  5726. end
  5727. if @immediate
  5728. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5729. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5730. attacker.pbConsumeItem
  5731. end
  5732. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5733. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5734. end
  5735. end
  5736.  
  5737.  
  5738.  
  5739. ################################################################################
  5740. # Two turn attack. Skips first turn, attacks second turn. (Dive)
  5741. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5742. ################################################################################
  5743. class PokeBattle_Move_0CB < PokeBattle_Move
  5744. def pbTwoTurnAttack(attacker)
  5745. @immediate=false
  5746. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5747. @immediate=true
  5748. end
  5749. return false if @immediate
  5750. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5751. end
  5752.  
  5753. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5754. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5755. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5756. @battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
  5757. end
  5758. if @immediate
  5759. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5760. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5761. attacker.pbConsumeItem
  5762. end
  5763. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5764. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5765. end
  5766. end
  5767.  
  5768.  
  5769.  
  5770. ################################################################################
  5771. # Two turn attack. Skips first turn, attacks second turn. (Bounce)
  5772. # May paralyze the target.
  5773. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5774. ################################################################################
  5775. class PokeBattle_Move_0CC < PokeBattle_Move
  5776. def unusableInGravity?
  5777. return true
  5778. end
  5779.  
  5780. def pbTwoTurnAttack(attacker)
  5781. @immediate=false
  5782. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5783. @immediate=true
  5784. end
  5785. return false if @immediate
  5786. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5787. end
  5788.  
  5789. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5790. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5791. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5792. @battle.pbDisplay(_INTL("{1} sprang up!",attacker.pbThis))
  5793. end
  5794. if @immediate
  5795. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5796. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5797. attacker.pbConsumeItem
  5798. end
  5799. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5800. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5801. end
  5802.  
  5803. def pbAdditionalEffect(attacker,opponent)
  5804. return if opponent.damagestate.substitute
  5805. if opponent.pbCanParalyze?(attacker,false,self)
  5806. opponent.pbParalyze(attacker)
  5807. end
  5808. end
  5809. end
  5810.  
  5811.  
  5812.  
  5813. ################################################################################
  5814. # Two turn attack. Skips first turn, attacks second turn. (Shadow Force)
  5815. # Is invulnerable during use.
  5816. # Ignores target's Detect, King's Shield, Mat Block, Protect, Spiky Shield and
  5817. # Baneful Bunker this round. If successful, negates them this round.
  5818. ################################################################################
  5819. class PokeBattle_Move_0CD < PokeBattle_Move
  5820. def pbTwoTurnAttack(attacker)
  5821. @immediate=false
  5822. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5823. @immediate=true
  5824. end
  5825. return false if @immediate
  5826. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5827. end
  5828.  
  5829. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5830. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5831. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5832. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  5833. end
  5834. if @immediate
  5835. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5836. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5837. attacker.pbConsumeItem
  5838. end
  5839. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5840. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5841. if ret>0
  5842. opponent.effects[PBEffects::ProtectNegation]=true
  5843. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  5844. end
  5845. return ret
  5846. end
  5847. end
  5848.  
  5849.  
  5850.  
  5851. ################################################################################
  5852. # Two turn attack. Skips first turn, attacks second turn. (Sky Drop)
  5853. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5854. # Target is also semi-invulnerable during use, and can't take any action.
  5855. # Doesn't damage airborne Pokémon (but still makes them unable to move during).
  5856. ################################################################################
  5857. class PokeBattle_Move_0CE < PokeBattle_Move
  5858. def unusableInGravity?
  5859. return true
  5860. end
  5861.  
  5862. def pbMoveFailed(attacker,opponent)
  5863. ret=false
  5864. ret=true if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  5865. ret=true if opponent.effects[PBEffects::TwoTurnAttack]>0
  5866. ret=true if opponent.effects[PBEffects::SkyDrop] && attacker.effects[PBEffects::TwoTurnAttack]>0
  5867. ret=true if !opponent.pbIsOpposing?(attacker.index)
  5868. ret=true if USENEWBATTLEMECHANICS && opponent.weight(attacker)>=2000
  5869. return ret
  5870. end
  5871.  
  5872. def pbTwoTurnAttack(attacker)
  5873. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5874. end
  5875.  
  5876. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5877. if attacker.effects[PBEffects::TwoTurnAttack]>0
  5878. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5879. @battle.pbDisplay(_INTL("{1} took {2} into the sky!",attacker.pbThis,opponent.pbThis(true)))
  5880. opponent.effects[PBEffects::SkyDrop]=true
  5881. end
  5882. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5883. ret=super
  5884. @battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",opponent.pbThis))
  5885. opponent.effects[PBEffects::SkyDrop]=false
  5886. return ret
  5887. end
  5888.  
  5889. def pbTypeModifier(type,attacker,opponent)
  5890. return 0 if opponent.pbHasType?(:FLYING)
  5891. return 0 if !attacker.hasMoldBreaker
  5892. opponent.hasWorkingAbility(:LEVITATE) && !opponent.effects[PBEffects::SmackDown]
  5893. return super
  5894. end
  5895. end
  5896.  
  5897.  
  5898.  
  5899. ################################################################################
  5900. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5901. # at end of each round.
  5902. ################################################################################
  5903. class PokeBattle_Move_0CF < PokeBattle_Move
  5904. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5905. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5906. if opponent.damagestate.calcdamage>0 && !opponent.fainted? &&
  5907. !opponent.damagestate.substitute
  5908. if opponent.effects[PBEffects::MultiTurn]==0
  5909. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5910. if attacker.hasWorkingItem(:GRIPCLAW)
  5911. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5912. end
  5913. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5914. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5915. if isConst?(@id,PBMoves,:BIND)
  5916. @battle.pbDisplay(_INTL("{1} was squeezed by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5917. elsif isConst?(@id,PBMoves,:CLAMP)
  5918. @battle.pbDisplay(_INTL("{1} clamped {2}!",attacker.pbThis,opponent.pbThis(true)))
  5919. elsif isConst?(@id,PBMoves,:FIRESPIN)
  5920. @battle.pbDisplay(_INTL("{1} was trapped in the fiery vortex!",opponent.pbThis))
  5921. elsif isConst?(@id,PBMoves,:MAGMASTORM)
  5922. @battle.pbDisplay(_INTL("{1} became trapped by Magma Storm!",opponent.pbThis))
  5923. elsif isConst?(@id,PBMoves,:SANDTOMB)
  5924. @battle.pbDisplay(_INTL("{1} became trapped by Sand Tomb!",opponent.pbThis))
  5925. elsif isConst?(@id,PBMoves,:WRAP)
  5926. @battle.pbDisplay(_INTL("{1} was wrapped by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5927. elsif isConst?(@id,PBMoves,:INFESTATION)
  5928. @battle.pbDisplay(_INTL("{1} has been afflicted with an infestation by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5929. else
  5930. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5931. end
  5932. end
  5933. end
  5934. return ret
  5935. end
  5936. end
  5937.  
  5938.  
  5939.  
  5940. ################################################################################
  5941. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5942. # at end of each round. (Whirlpool)
  5943. # Power is doubled if target is using Dive.
  5944. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  5945. ################################################################################
  5946. class PokeBattle_Move_0D0 < PokeBattle_Move
  5947. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5948. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5949. if opponent.damagestate.calcdamage>0 && !opponent.fainted? &&
  5950. !opponent.damagestate.substitute
  5951. if opponent.effects[PBEffects::MultiTurn]==0
  5952. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5953. if attacker.hasWorkingItem(:GRIPCLAW)
  5954. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5955. end
  5956. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5957. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5958. @battle.pbDisplay(_INTL("{1} became trapped in the vortex!",opponent.pbThis))
  5959. end
  5960. end
  5961. return ret
  5962. end
  5963.  
  5964. def pbModifyDamage(damagemult,attacker,opponent)
  5965. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  5966. return (damagemult*2.0).round
  5967. end
  5968. return damagemult
  5969. end
  5970. end
  5971.  
  5972.  
  5973.  
  5974. ################################################################################
  5975. # User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
  5976. ################################################################################
  5977. class PokeBattle_Move_0D1 < PokeBattle_Move
  5978. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5979. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5980. if opponent.damagestate.calcdamage>0
  5981. if attacker.effects[PBEffects::Uproar]==0
  5982. attacker.effects[PBEffects::Uproar]=3
  5983. @battle.pbDisplay(_INTL("{1} caused an uproar!",attacker.pbThis))
  5984. attacker.currentMove=@id
  5985. end
  5986. end
  5987. return ret
  5988. end
  5989. end
  5990.  
  5991.  
  5992.  
  5993. ################################################################################
  5994. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  5995. # (Outrage, Thrash)
  5996. ################################################################################
  5997. class PokeBattle_Move_0D2 < PokeBattle_Move
  5998. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5999. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6000. if opponent.damagestate.calcdamage>0 &&
  6001. attacker.effects[PBEffects::Outrage]==0 &&
  6002. attacker.status!=PBStatuses::SLEEP
  6003. attacker.effects[PBEffects::Outrage]=2+@battle.pbRandom(2)
  6004. attacker.currentMove=@id
  6005. elsif pbTypeModifier(@type,attacker,opponent)==0
  6006. # Cancel effect if attack is ineffective
  6007. attacker.effects[PBEffects::Outrage]=0
  6008. end
  6009. if attacker.effects[PBEffects::Outrage]>0
  6010. attacker.effects[PBEffects::Outrage]-=1
  6011. if attacker.effects[PBEffects::Outrage]==0 && attacker.pbCanConfuseSelf?(false)
  6012. attacker.pbConfuse
  6013. @battle.pbDisplay(_INTL("{1} became confused due to fatigue!",attacker.pbThis))
  6014. end
  6015. end
  6016. return ret
  6017. end
  6018. end
  6019.  
  6020.  
  6021.  
  6022. ################################################################################
  6023. # User must use this move for 4 more rounds. Power doubles each round.
  6024. # Power is also doubled if user has curled up. (Ice Ball, Rollout)
  6025. ################################################################################
  6026. class PokeBattle_Move_0D3 < PokeBattle_Move
  6027. def pbBaseDamage(basedmg,attacker,opponent)
  6028. shift=(4-attacker.effects[PBEffects::Rollout]) # from 0 through 4, 0 is most powerful
  6029. shift+=1 if attacker.effects[PBEffects::DefenseCurl]
  6030. basedmg=basedmg<<shift
  6031. return basedmg
  6032. end
  6033.  
  6034. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6035. attacker.effects[PBEffects::Rollout]=5 if attacker.effects[PBEffects::Rollout]==0
  6036. attacker.effects[PBEffects::Rollout]-=1
  6037. attacker.currentMove=thismove.id
  6038. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6039. if opponent.damagestate.calcdamage==0 ||
  6040. pbTypeModifier(@type,attacker,opponent)==0 ||
  6041. attacker.status==PBStatuses::SLEEP
  6042. # Cancel effect if attack is ineffective
  6043. attacker.effects[PBEffects::Rollout]=0
  6044. end
  6045. return ret
  6046. end
  6047. end
  6048.  
  6049.  
  6050.  
  6051. ################################################################################
  6052. # User bides its time this round and next round. The round after, deals 2x the
  6053. # total damage it took while biding to the last battler that damaged it. (Bide)
  6054. ################################################################################
  6055. class PokeBattle_Move_0D4 < PokeBattle_Move
  6056. def pbDisplayUseMessage(attacker)
  6057. if attacker.effects[PBEffects::Bide]==0
  6058. @battle.pbDisplayBrief(_INTL("{1} used\r\n{2}!",attacker.pbThis,name))
  6059. attacker.effects[PBEffects::Bide]=2
  6060. attacker.effects[PBEffects::BideDamage]=0
  6061. attacker.effects[PBEffects::BideTarget]=-1
  6062. attacker.currentMove=@id
  6063. pbShowAnimation(@id,attacker,nil)
  6064. return 1
  6065. else
  6066. attacker.effects[PBEffects::Bide]-=1
  6067. if attacker.effects[PBEffects::Bide]==0
  6068. @battle.pbDisplayBrief(_INTL("{1} unleashed energy!",attacker.pbThis))
  6069. return 0
  6070. else
  6071. @battle.pbDisplayBrief(_INTL("{1} is storing energy!",attacker.pbThis))
  6072. return 2
  6073. end
  6074. end
  6075. end
  6076.  
  6077. def pbAddTarget(targets,attacker)
  6078. if attacker.effects[PBEffects::BideTarget]>=0
  6079. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::BideTarget]])
  6080. attacker.pbRandomTarget(targets)
  6081. end
  6082. else
  6083. attacker.pbRandomTarget(targets)
  6084. end
  6085. end
  6086.  
  6087. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6088. if attacker.effects[PBEffects::BideDamage]==0 || !opponent
  6089. @battle.pbDisplay(_INTL("But it failed!"))
  6090. return -1
  6091. end
  6092. if USENEWBATTLEMECHANICS
  6093. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  6094. if typemod==0
  6095. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6096. return -1
  6097. end
  6098. end
  6099. ret=pbEffectFixedDamage(attacker.effects[PBEffects::BideDamage]*2,attacker,opponent,hitnum,alltargets,showanimation)
  6100. return ret
  6101. end
  6102. end
  6103.  
  6104.  
  6105.  
  6106. ################################################################################
  6107. # Heals user by 1/2 of its max HP.
  6108. ################################################################################
  6109. class PokeBattle_Move_0D5 < PokeBattle_Move
  6110. def isHealingMove?
  6111. return true
  6112. end
  6113.  
  6114. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6115. if attacker.hp==attacker.totalhp
  6116. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6117. return -1
  6118. end
  6119. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6120. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  6121. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6122. return 0
  6123. end
  6124. end
  6125.  
  6126.  
  6127.  
  6128. ################################################################################
  6129. # Heals user by 1/2 of its max HP. (Roost)
  6130. # User roosts, and its Flying type is ignored for attacks used against it.
  6131. ################################################################################
  6132. class PokeBattle_Move_0D6 < PokeBattle_Move
  6133. def isHealingMove?
  6134. return true
  6135. end
  6136.  
  6137. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6138. if attacker.hp==attacker.totalhp
  6139. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6140. return -1
  6141. end
  6142. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6143. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  6144. attacker.effects[PBEffects::Roost]=true
  6145. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6146. return 0
  6147. end
  6148. end
  6149.  
  6150.  
  6151.  
  6152. ################################################################################
  6153. # Battler in user's position is healed by 1/2 of its max HP, at the end of the
  6154. # next round. (Wish)
  6155. ################################################################################
  6156. class PokeBattle_Move_0D7 < PokeBattle_Move
  6157. def isHealingMove?
  6158. return true
  6159. end
  6160.  
  6161. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6162. if attacker.effects[PBEffects::Wish]>0
  6163. @battle.pbDisplay(_INTL("But it failed!"))
  6164. return -1
  6165. end
  6166. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6167. attacker.effects[PBEffects::Wish]=2
  6168. attacker.effects[PBEffects::WishAmount]=((attacker.totalhp+1)/2).floor
  6169. attacker.effects[PBEffects::WishMaker]=attacker.pokemonIndex
  6170. return 0
  6171. end
  6172. end
  6173.  
  6174.  
  6175.  
  6176. ################################################################################
  6177. # Heals user by an amount depending on the weather. (Moonlight, Morning Sun,
  6178. # Synthesis, Shore Up)
  6179. ################################################################################
  6180. class PokeBattle_Move_0D8 < PokeBattle_Move
  6181. def isHealingMove?
  6182. return true
  6183. end
  6184.  
  6185. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6186. if attacker.hp==attacker.totalhp
  6187. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6188. return -1
  6189. end
  6190. hpgain=0
  6191. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  6192. @battle.pbWeather==PBWeather::HARSHSUN
  6193. hpgain=(attacker.totalhp*2/3).floor
  6194. elsif @battle.pbWeather!=0
  6195. hpgain=(attacker.totalhp/4).floor
  6196. else
  6197. hpgain=(attacker.totalhp/2).floor
  6198. end
  6199. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6200. attacker.pbRecoverHP(hpgain,true)
  6201. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6202. return 0
  6203. end
  6204. end
  6205.  
  6206.  
  6207.  
  6208. ################################################################################
  6209. # Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
  6210. ################################################################################
  6211. class PokeBattle_Move_0D9 < PokeBattle_Move
  6212. def isHealingMove?
  6213. return true
  6214. end
  6215.  
  6216. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6217. if !attacker.pbCanSleep?(attacker,true,self,true)
  6218. return -1
  6219. end
  6220. if attacker.status==PBStatuses::SLEEP
  6221. @battle.pbDisplay(_INTL("But it failed!"))
  6222. return -1
  6223. end
  6224. if attacker.hp==attacker.totalhp
  6225. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6226. return -1
  6227. end
  6228. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6229. attacker.pbSleepSelf(3)
  6230. @battle.pbDisplay(_INTL("{1} slept and became healthy!",attacker.pbThis))
  6231. hp=attacker.pbRecoverHP(attacker.totalhp-attacker.hp,true)
  6232. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis)) if hp>0
  6233. return 0
  6234. end
  6235. end
  6236.  
  6237.  
  6238.  
  6239. ################################################################################
  6240. # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
  6241. # (Aqua Ring)
  6242. ################################################################################
  6243. class PokeBattle_Move_0DA < PokeBattle_Move
  6244. def isHealingMove?
  6245. return true
  6246. end
  6247.  
  6248. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6249. if attacker.effects[PBEffects::AquaRing]
  6250. @battle.pbDisplay(_INTL("But it failed!"))
  6251. return -1
  6252. end
  6253. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6254. attacker.effects[PBEffects::AquaRing]=true
  6255. @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
  6256. return 0
  6257. end
  6258. end
  6259.  
  6260.  
  6261.  
  6262. ################################################################################
  6263. # Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
  6264. # round, and cannot flee or switch out. (Ingrain)
  6265. ################################################################################
  6266. class PokeBattle_Move_0DB < PokeBattle_Move
  6267. def isHealingMove?
  6268. return true
  6269. end
  6270.  
  6271. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6272. if attacker.effects[PBEffects::Ingrain]
  6273. @battle.pbDisplay(_INTL("But it failed!"))
  6274. return -1
  6275. end
  6276. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6277. attacker.effects[PBEffects::Ingrain]=true
  6278. @battle.pbDisplay(_INTL("{1} planted its roots!",attacker.pbThis))
  6279. return 0
  6280. end
  6281. end
  6282.  
  6283.  
  6284.  
  6285. ################################################################################
  6286. # Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each round,
  6287. # and the Pokémon in the user's position gains the same amount. (Leech Seed)
  6288. ################################################################################
  6289. class PokeBattle_Move_0DC < PokeBattle_Move
  6290. def isHealingMove?
  6291. return true
  6292. end
  6293.  
  6294. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6295. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6296. @battle.pbDisplay(_INTL("But it failed!"))
  6297. return -1
  6298. end
  6299. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  6300. if opponent.effects[PBEffects::LeechSeed]>=0
  6301. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  6302. return -1
  6303. end
  6304. if opponent.pbHasType?(:GRASS)
  6305. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6306. return -1
  6307. end
  6308. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6309. opponent.effects[PBEffects::LeechSeed]=attacker.index
  6310. @battle.pbDisplay(_INTL("{1} was seeded!",opponent.pbThis))
  6311. return 0
  6312. end
  6313. end
  6314.  
  6315.  
  6316.  
  6317. ################################################################################
  6318. # User gains half the HP it inflicts as damage.
  6319. ################################################################################
  6320. class PokeBattle_Move_0DD < PokeBattle_Move
  6321. def isHealingMove?
  6322. return USENEWBATTLEMECHANICS
  6323. end
  6324.  
  6325. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6326. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6327. if opponent.damagestate.calcdamage>0
  6328. hpgain=(opponent.damagestate.hplost/2).round
  6329. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6330. attacker.pbReduceHP(hpgain,true)
  6331. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6332. elsif attacker.effects[PBEffects::HealBlock]==0
  6333. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6334. attacker.pbRecoverHP(hpgain,true)
  6335. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6336. end
  6337. end
  6338. return ret
  6339. end
  6340. end
  6341.  
  6342.  
  6343.  
  6344. ################################################################################
  6345. # User gains half the HP it inflicts as damage. (Dream Eater)
  6346. # (Handled in Battler's pbSuccessCheck): Fails if target is not asleep.
  6347. ################################################################################
  6348. class PokeBattle_Move_0DE < PokeBattle_Move
  6349. def isHealingMove?
  6350. return USENEWBATTLEMECHANICS
  6351. end
  6352.  
  6353. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6354. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6355. if opponent.damagestate.calcdamage>0
  6356. hpgain=(opponent.damagestate.hplost/2).round
  6357. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6358. attacker.pbReduceHP(hpgain,true)
  6359. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6360. elsif attacker.effects[PBEffects::HealBlock]==0
  6361. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6362. attacker.pbRecoverHP(hpgain,true)
  6363. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6364. end
  6365. end
  6366. return ret
  6367. end
  6368. end
  6369.  
  6370.  
  6371.  
  6372. ################################################################################
  6373. # Heals target by 1/2 of its max HP. (Heal Pulse)
  6374. ################################################################################
  6375. class PokeBattle_Move_0DF < PokeBattle_Move
  6376. def isHealingMove?
  6377. return true
  6378. end
  6379.  
  6380. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6381. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6382. @battle.pbDisplay(_INTL("But it failed!"))
  6383. return -1
  6384. end
  6385. if opponent.hp==opponent.totalhp
  6386. @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
  6387. return -1
  6388. end
  6389. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6390. hpgain=((opponent.totalhp+1)/2).floor
  6391. hpgain=(opponent.totalhp*3/4).round if attacker.hasWorkingAbility(:MEGALAUNCHER)
  6392. opponent.pbRecoverHP(hpgain,true)
  6393. @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
  6394. return 0
  6395. end
  6396. end
  6397.  
  6398.  
  6399.  
  6400. ################################################################################
  6401. # User faints. (Explosion, Selfdestruct)
  6402. ################################################################################
  6403. class PokeBattle_Move_0E0 < PokeBattle_Move
  6404. def pbOnStartUse(attacker)
  6405. if !attacker.hasMoldBreaker
  6406. bearer=@battle.pbCheckGlobalAbility(:DAMP)
  6407. if bearer!=nil
  6408. @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  6409. bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  6410. return false
  6411. end
  6412. end
  6413. return true
  6414. end
  6415.  
  6416. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6417. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6418. if !attacker.fainted?
  6419. attacker.pbReduceHP(attacker.hp)
  6420. attacker.pbFaint if attacker.fainted?
  6421. end
  6422. end
  6423. end
  6424.  
  6425.  
  6426.  
  6427. ################################################################################
  6428. # Inflicts fixed damage equal to user's current HP. (Final Gambit)
  6429. # User faints (if successful).
  6430. ################################################################################
  6431. class PokeBattle_Move_0E1 < PokeBattle_Move
  6432. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6433. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  6434. if typemod==0
  6435. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6436. return -1
  6437. end
  6438. ret=pbEffectFixedDamage(attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  6439. return ret
  6440. end
  6441.  
  6442. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6443. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6444. if !attacker.fainted?
  6445. attacker.pbReduceHP(attacker.hp)
  6446. attacker.pbFaint if attacker.fainted?
  6447. end
  6448. end
  6449. end
  6450.  
  6451.  
  6452.  
  6453. ################################################################################
  6454. # Decreases the target's Attack and Special Attack by 2 stages each. (Memento)
  6455. # User faints (even if effect does nothing).
  6456. ################################################################################
  6457. class PokeBattle_Move_0E2 < PokeBattle_Move
  6458. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6459. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6460. @battle.pbDisplay(_INTL("But it failed!"))
  6461. return -1
  6462. end
  6463. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6464. ret=-1; showanim=true
  6465. if opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  6466. ret=0; showanim=false
  6467. end
  6468. if opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self,showanim)
  6469. ret=0; showanim=false
  6470. end
  6471. attacker.pbReduceHP(attacker.hp)
  6472. return ret
  6473. end
  6474. end
  6475.  
  6476.  
  6477.  
  6478. ################################################################################
  6479. # User faints. The Pokémon that replaces the user is fully healed (HP and
  6480. # status). Fails if user won't be replaced. (Healing Wish)
  6481. ################################################################################
  6482. class PokeBattle_Move_0E3 < PokeBattle_Move
  6483. def isHealingMove?
  6484. return true
  6485. end
  6486.  
  6487. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6488. if !@battle.pbCanChooseNonActive?(attacker.index)
  6489. @battle.pbDisplay(_INTL("But it failed!"))
  6490. return -1
  6491. end
  6492. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6493. attacker.pbReduceHP(attacker.hp)
  6494. attacker.effects[PBEffects::HealingWish]=true
  6495. return 0
  6496. end
  6497. end
  6498.  
  6499.  
  6500.  
  6501. ################################################################################
  6502. # User faints. The Pokémon that replaces the user is fully healed (HP, PP and
  6503. # status). Fails if user won't be replaced. (Lunar Dance)
  6504. ################################################################################
  6505. class PokeBattle_Move_0E4 < PokeBattle_Move
  6506. def isHealingMove?
  6507. return true
  6508. end
  6509.  
  6510. def isDanceMove?
  6511. return true
  6512. end
  6513.  
  6514. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6515. if !@battle.pbCanChooseNonActive?(attacker.index)
  6516. @battle.pbDisplay(_INTL("But it failed!"))
  6517. return -1
  6518. end
  6519. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6520. attacker.pbReduceHP(attacker.hp)
  6521. attacker.effects[PBEffects::LunarDance]=true
  6522. return 0
  6523. end
  6524. end
  6525.  
  6526.  
  6527.  
  6528. ################################################################################
  6529. # All current battlers will perish after 3 more rounds. (Perish Song)
  6530. ################################################################################
  6531. class PokeBattle_Move_0E5 < PokeBattle_Move
  6532. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6533. failed=true
  6534. for i in 0...4
  6535. if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
  6536. (attacker.hasMoldBreaker ||
  6537. !@battle.battlers[i].hasWorkingAbility(:SOUNDPROOF))
  6538. failed=false; break
  6539. end
  6540. end
  6541. if failed
  6542. @battle.pbDisplay(_INTL("But it failed!"))
  6543. return -1
  6544. end
  6545. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6546. @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
  6547. for i in 0...4
  6548. if @battle.battlers[i].effects[PBEffects::PerishSong]==0
  6549. if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  6550. @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
  6551. PBAbilities.getName(@battle.battlers[i].ability),@name))
  6552. else
  6553. @battle.battlers[i].effects[PBEffects::PerishSong]=4
  6554. @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
  6555. end
  6556. end
  6557. end
  6558. return 0
  6559. end
  6560. end
  6561.  
  6562.  
  6563.  
  6564. ################################################################################
  6565. # If user is KO'd before it next moves, the attack that caused it loses all PP.
  6566. # (Grudge)
  6567. ################################################################################
  6568. class PokeBattle_Move_0E6 < PokeBattle_Move
  6569. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6570. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6571. attacker.effects[PBEffects::Grudge]=true
  6572. @battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",attacker.pbThis))
  6573. return 0
  6574. end
  6575. end
  6576.  
  6577.  
  6578.  
  6579. ################################################################################
  6580. # If user is KO'd before it next moves, the battler that caused it also faints.
  6581. # (Destiny Bond)
  6582. ################################################################################
  6583. class PokeBattle_Move_0E7 < PokeBattle_Move
  6584. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6585. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6586. attacker.effects[PBEffects::DestinyBond]=true
  6587. @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
  6588. return 0
  6589. end
  6590. end
  6591.  
  6592.  
  6593.  
  6594. ################################################################################
  6595. # If user would be KO'd this round, it survives with 1HP instead. (Endure)
  6596. ################################################################################
  6597. class PokeBattle_Move_0E8 < PokeBattle_Move
  6598. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6599. ratesharers=[
  6600. 0xAA, # Detect, Protect
  6601. 0xAB, # Quick Guard
  6602. 0xAC, # Wide Guard
  6603. 0xE8, # Endure
  6604. 0x14B, # King's Shield
  6605. 0x14C, # Spiky Shield
  6606. 0x174 # Baneful Bunker
  6607. ]
  6608. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  6609. attacker.effects[PBEffects::ProtectRate]=1
  6610. end
  6611. unmoved=false
  6612. for poke in @battle.battlers
  6613. next if poke.index==attacker.index
  6614. if @battle.choices[poke.index][0]==1 && # Chose a move
  6615. !poke.hasMovedThisRound?
  6616. unmoved=true; break
  6617. end
  6618. end
  6619. if !unmoved ||
  6620. @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  6621. attacker.effects[PBEffects::ProtectRate]=1
  6622. @battle.pbDisplay(_INTL("But it failed!"))
  6623. return -1
  6624. end
  6625. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6626. attacker.effects[PBEffects::Endure]=true
  6627. attacker.effects[PBEffects::ProtectRate]*=2
  6628. @battle.pbDisplay(_INTL("{1} braced itself!",attacker.pbThis))
  6629. return 0
  6630. end
  6631. end
  6632.  
  6633.  
  6634.  
  6635. ################################################################################
  6636. # If target would be KO'd by this attack, it survives with 1HP instead. (False Swipe)
  6637. ################################################################################
  6638. class PokeBattle_Move_0E9 < PokeBattle_Move
  6639. # Handled in ot edit!
  6640. end
  6641.  
  6642.  
  6643.  
  6644. ################################################################################
  6645. # User flees from battle. Fails in trainer battles. (Teleport)
  6646. ################################################################################
  6647. class PokeBattle_Move_0EA < PokeBattle_Move
  6648. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6649. if @battle.opponent ||
  6650. !@battle.pbCanRun?(attacker.index)
  6651. @battle.pbDisplay(_INTL("But it failed!"))
  6652. return -1
  6653. end
  6654. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6655. @battle.pbDisplay(_INTL("{1} fled from battle!",attacker.pbThis))
  6656. @battle.decision=3
  6657. return 0
  6658. end
  6659. end
  6660.  
  6661.  
  6662.  
  6663. ################################################################################
  6664. # In wild battles, makes target flee. Fails if target is a higher level than the
  6665. # user.
  6666. # In trainer battles, target switches out.
  6667. # For status moves. (Roar, Whirlwind)
  6668. ################################################################################
  6669. class PokeBattle_Move_0EB < PokeBattle_Move
  6670. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6671. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:SUCTIONCUPS)
  6672. @battle.pbDisplay(_INTL("{1} anchored itself with {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  6673. return -1
  6674. end
  6675. if opponent.effects[PBEffects::Ingrain]
  6676. @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",opponent.pbThis))
  6677. return -1
  6678. end
  6679. if !@battle.opponent
  6680. if opponent.level>attacker.level
  6681. @battle.pbDisplay(_INTL("But it failed!"))
  6682. return -1
  6683. end
  6684. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6685. @battle.decision=3 # Set decision to escaped
  6686. return 0
  6687. else
  6688. choices=false
  6689. party=@battle.pbParty(opponent.index)
  6690. for i in 0...party.length
  6691. if @battle.pbCanSwitch?(opponent.index,i,false,true)
  6692. choices=true
  6693. break
  6694. end
  6695. end
  6696. if !choices
  6697. @battle.pbDisplay(_INTL("But it failed!"))
  6698. return -1
  6699. end
  6700. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6701. opponent.effects[PBEffects::Roar]=true
  6702. return 0
  6703. end
  6704. end
  6705. end
  6706.  
  6707.  
  6708.  
  6709. ################################################################################
  6710. # In wild battles, makes target flee. Fails if target is a higher level than the
  6711. # user.
  6712. # In trainer battles, target switches out.
  6713. # For damaging moves. (Circle Throw, Dragon Tail)
  6714. ################################################################################
  6715. class PokeBattle_Move_0EC < PokeBattle_Move
  6716. def pbEffectAfterHit(attacker,opponent,turneffects)
  6717. if !attacker.fainted? && !opponent.fainted? &&
  6718. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6719. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SUCTIONCUPS)) &&
  6720. !opponent.effects[PBEffects::Ingrain]
  6721. if !@battle.opponent
  6722. if opponent.level<=attacker.level
  6723. @battle.decision=3 # Set decision to escaped
  6724. end
  6725. else
  6726. party=@battle.pbParty(opponent.index)
  6727. for i in 0..party.length-1
  6728. if @battle.pbCanSwitch?(opponent.index,i,false)
  6729. opponent.effects[PBEffects::Roar]=true
  6730. break
  6731. end
  6732. end
  6733. end
  6734. end
  6735. end
  6736. end
  6737.  
  6738.  
  6739.  
  6740. ################################################################################
  6741. # User switches out. Various effects affecting the user are passed to the
  6742. # replacement. (Baton Pass)
  6743. ################################################################################
  6744. class PokeBattle_Move_0ED < PokeBattle_Move
  6745. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6746. if !@battle.pbCanChooseNonActive?(attacker.index)
  6747. @battle.pbDisplay(_INTL("But it failed!"))
  6748. return -1
  6749. end
  6750. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6751. attacker.effects[PBEffects::BatonPass]=true
  6752. return 0
  6753. end
  6754. end
  6755.  
  6756.  
  6757.  
  6758. ################################################################################
  6759. # After inflicting damage, user switches out. Ignores trapping moves.
  6760. # (U-turn, Volt Switch)
  6761. # TODO: Pursuit should interrupt this move.
  6762. ################################################################################
  6763. class PokeBattle_Move_0EE < PokeBattle_Move
  6764. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6765. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6766. if !attacker.fainted? && opponent.damagestate.calcdamage>0 &&
  6767. @battle.pbCanChooseNonActive?(attacker.index) &&
  6768. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  6769. attacker.effects[PBEffects::Uturn]=true
  6770. end
  6771. return ret
  6772. end
  6773. end
  6774.  
  6775.  
  6776.  
  6777. ################################################################################
  6778. # Target can no longer switch out or flee, as long as the user remains active.
  6779. # (Block, Mean Look, Spider Web, Thousand Waves)
  6780. ################################################################################
  6781. class PokeBattle_Move_0EF < PokeBattle_Move
  6782. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6783. if pbIsDamaging?
  6784. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6785. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6786. !opponent.fainted?
  6787. if opponent.effects[PBEffects::MeanLook]<0 &&
  6788. (!USENEWBATTLEMECHANICS || !opponent.pbHasType?(:GHOST))
  6789. opponent.effects[PBEffects::MeanLook]=attacker.index
  6790. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6791. end
  6792. end
  6793. return ret
  6794. end
  6795. if opponent.effects[PBEffects::MeanLook]>=0 ||
  6796. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  6797. @battle.pbDisplay(_INTL("But it failed!"))
  6798. return -1
  6799. end
  6800. if USENEWBATTLEMECHANICS && opponent.pbHasType?(:GHOST)
  6801. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6802. return -1
  6803. end
  6804. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6805. opponent.effects[PBEffects::MeanLook]=attacker.index
  6806. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6807. return 0
  6808. end
  6809. end
  6810.  
  6811.  
  6812.  
  6813. ################################################################################
  6814. # Target drops its item. It regains the item at the end of the battle. (Knock Off)
  6815. # If target has a losable item, damage is multiplied by 1.5.
  6816. ################################################################################
  6817. class PokeBattle_Move_0F0 < PokeBattle_Move
  6818. def pbEffectAfterHit(attacker,opponent,turneffects)
  6819. if !attacker.fainted? && !opponent.fainted? && opponent.item!=0 &&
  6820. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6821. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6822. abilityname=PBAbilities.getName(opponent.ability)
  6823. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6824. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6825. itemname=PBItems.getName(opponent.item)
  6826. opponent.item=0
  6827. opponent.effects[PBEffects::ChoiceBand]=-1
  6828. opponent.effects[PBEffects::Unburden]=true
  6829. @battle.pbDisplay(_INTL("{1} dropped its {2}!",opponent.pbThis,itemname))
  6830. end
  6831. end
  6832. end
  6833.  
  6834. def pbModifyDamage(damagemult,attacker,opponent)
  6835. if USENEWBATTLEMECHANICS &&
  6836. !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6837. # Still boosts damage even if opponent has Sticky Hold
  6838. return (damagemult*1.5).round
  6839. end
  6840. return damagemult
  6841. end
  6842. end
  6843.  
  6844.  
  6845.  
  6846. ################################################################################
  6847. # User steals the target's item, if the user has none itself. (Covet, Thief)
  6848. # Items stolen from wild Pokémon are kept after the battle.
  6849. ################################################################################
  6850. class PokeBattle_Move_0F1 < PokeBattle_Move
  6851. def pbEffectAfterHit(attacker,opponent,turneffects)
  6852. if !attacker.fainted? && !opponent.fainted? && opponent.item!=0 &&
  6853. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6854. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6855. abilityname=PBAbilities.getName(opponent.ability)
  6856. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6857. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item) &&
  6858. !@battle.pbIsUnlosableItem(attacker,opponent.item) &&
  6859. attacker.item==0 &&
  6860. (@battle.opponent || !@battle.pbIsOpposing?(attacker.index))
  6861. itemname=PBItems.getName(opponent.item)
  6862. attacker.item=opponent.item
  6863. opponent.item=0
  6864. opponent.effects[PBEffects::ChoiceBand]=-1
  6865. opponent.effects[PBEffects::Unburden]=true
  6866. if !@battle.opponent && # In a wild battle
  6867. attacker.pokemon.itemInitial==0 &&
  6868. opponent.pokemon.itemInitial==attacker.item
  6869. attacker.pokemon.itemInitial=attacker.item
  6870. opponent.pokemon.itemInitial=0
  6871. end
  6872. @battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  6873. end
  6874. end
  6875. end
  6876. end
  6877.  
  6878.  
  6879.  
  6880. ################################################################################
  6881. # User and target swap items. They remain swapped after wild battles.
  6882. # (Switcheroo, Trick)
  6883. ################################################################################
  6884. class PokeBattle_Move_0F2 < PokeBattle_Move
  6885. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6886. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6887. (attacker.item==0 && opponent.item==0) ||
  6888. (!@battle.opponent && @battle.pbIsOpposing?(attacker.index))
  6889. @battle.pbDisplay(_INTL("But it failed!"))
  6890. return -1
  6891. end
  6892. if @battle.pbIsUnlosableItem(opponent,opponent.item) ||
  6893. @battle.pbIsUnlosableItem(attacker,opponent.item) ||
  6894. @battle.pbIsUnlosableItem(opponent,attacker.item) ||
  6895. @battle.pbIsUnlosableItem(attacker,attacker.item)
  6896. @battle.pbDisplay(_INTL("But it failed!"))
  6897. return -1
  6898. end
  6899. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6900. abilityname=PBAbilities.getName(opponent.ability)
  6901. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,name))
  6902. return -1
  6903. end
  6904. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6905. oldattitem=attacker.item
  6906. oldoppitem=opponent.item
  6907. oldattitemname=PBItems.getName(oldattitem)
  6908. oldoppitemname=PBItems.getName(oldoppitem)
  6909. tmpitem=attacker.item
  6910. attacker.item=opponent.item
  6911. opponent.item=tmpitem
  6912. if !@battle.opponent && # In a wild battle
  6913. attacker.pokemon.itemInitial==oldattitem &&
  6914. opponent.pokemon.itemInitial==oldoppitem
  6915. attacker.pokemon.itemInitial=oldoppitem
  6916. opponent.pokemon.itemInitial=oldattitem
  6917. end
  6918. @battle.pbDisplay(_INTL("{1} switched items with its opponent!",attacker.pbThis))
  6919. if oldoppitem>0 && oldattitem>0
  6920. @battle.pbDisplayPaused(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname))
  6921. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname))
  6922. else
  6923. @battle.pbDisplay(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname)) if oldoppitem>0
  6924. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname)) if oldattitem>0
  6925. end
  6926. attacker.effects[PBEffects::ChoiceBand]=-1
  6927. opponent.effects[PBEffects::ChoiceBand]=-1
  6928. return 0
  6929. end
  6930. end
  6931.  
  6932.  
  6933.  
  6934. ################################################################################
  6935. # User gives its item to the target. The item remains given after wild battles.
  6936. # (Bestow)
  6937. ################################################################################
  6938. class PokeBattle_Move_0F3 < PokeBattle_Move
  6939. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6940. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6941. attacker.item==0 || opponent.item!=0
  6942. @battle.pbDisplay(_INTL("But it failed!"))
  6943. return -1
  6944. end
  6945. if @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6946. @battle.pbIsUnlosableItem(opponent,attacker.item)
  6947. @battle.pbDisplay(_INTL("But it failed!"))
  6948. return -1
  6949. end
  6950. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6951. itemname=PBItems.getName(attacker.item)
  6952. opponent.item=attacker.item
  6953. attacker.item=0
  6954. attacker.effects[PBEffects::ChoiceBand]=-1
  6955. attacker.effects[PBEffects::Unburden]=true
  6956. if !@battle.opponent && # In a wild battle
  6957. opponent.pokemon.itemInitial==0 &&
  6958. attacker.pokemon.itemInitial==opponent.item
  6959. opponent.pokemon.itemInitial=opponent.item
  6960. attacker.pokemon.itemInitial=0
  6961. end
  6962. @battle.pbDisplay(_INTL("{1} received {2} from {3}!",opponent.pbThis,itemname,attacker.pbThis(true)))
  6963. return 0
  6964. end
  6965. end
  6966.  
  6967.  
  6968.  
  6969. ################################################################################
  6970. # User consumes target's berry and gains its effect. (Bug Bite, Pluck)
  6971. ################################################################################
  6972. class PokeBattle_Move_0F4 < PokeBattle_Move
  6973. def pbEffectAfterHit(attacker,opponent,turneffects)
  6974. if !attacker.fainted? && !opponent.fainted? && pbIsBerry?(opponent.item) &&
  6975. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6976. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:STICKYHOLD)
  6977. item=opponent.item
  6978. itemname=PBItems.getName(item)
  6979. opponent.pbConsumeItem(false,false)
  6980. @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",attacker.pbThis,itemname))
  6981. if !attacker.hasWorkingAbility(:KLUTZ) &&
  6982. attacker.effects[PBEffects::Embargo]==0
  6983. attacker.pbActivateBerryEffect(item,false)
  6984. end
  6985. # Symbiosis
  6986. if attacker.item==0 &&
  6987. attacker.pbPartner && attacker.pbPartner.hasWorkingAbility(:SYMBIOSIS)
  6988. partner=attacker.pbPartner
  6989. if partner.item>0 &&
  6990. !@battle.pbIsUnlosableItem(partner,partner.item) &&
  6991. !@battle.pbIsUnlosableItem(attacker,partner.item)
  6992. @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
  6993. partner.pbThis,PBAbilities.getName(partner.ability),
  6994. PBItems.getName(partner.item),attacker.pbThis(true)))
  6995. attacker.item=partner.item
  6996. partner.item=0
  6997. partner.effects[PBEffects::Unburden]=true
  6998. attacker.pbBerryCureCheck
  6999. end
  7000. end
  7001. end
  7002. end
  7003. end
  7004. end
  7005.  
  7006.  
  7007.  
  7008. ################################################################################
  7009. # Target's berry is destroyed. (Incinerate)
  7010. ################################################################################
  7011. class PokeBattle_Move_0F5 < PokeBattle_Move
  7012. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7013. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7014. if !attacker.fainted? && opponent.damagestate.calcdamage>0 &&
  7015. !opponent.damagestate.substitute &&
  7016. (pbIsBerry?(opponent.item) || (USENEWBATTLEMECHANICS && pbIsGem?(opponent.item)))
  7017. itemname=PBItems.getName(opponent.item)
  7018. opponent.pbConsumeItem(false,false)
  7019. @battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",opponent.pbThis,itemname))
  7020. end
  7021. return ret
  7022. end
  7023. end
  7024.  
  7025.  
  7026.  
  7027. ################################################################################
  7028. # User recovers the last item it held and consumed. (Recycle)
  7029. ################################################################################
  7030. class PokeBattle_Move_0F6 < PokeBattle_Move
  7031. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7032. if !attacker.pokemon || attacker.pokemon.itemRecycle==0
  7033. @battle.pbDisplay(_INTL("But it failed!"))
  7034. return -1
  7035. end
  7036. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7037. item=attacker.pokemon.itemRecycle
  7038. itemname=PBItems.getName(item)
  7039. attacker.item=item
  7040. if !@battle.opponent # In a wild battle
  7041. attacker.pokemon.itemInitial=item if attacker.pokemon.itemInitial==0
  7042. end
  7043. attacker.pokemon.itemRecycle=0
  7044. attacker.effects[PBEffects::PickupItem]=0
  7045. attacker.effects[PBEffects::PickupUse]=0
  7046. @battle.pbDisplay(_INTL("{1} found one {2}!",attacker.pbThis,itemname))
  7047. return 0
  7048. end
  7049. end
  7050.  
  7051.  
  7052.  
  7053. ################################################################################
  7054. # User flings its item at the target. Power and effect depend on the item. (Fling)
  7055. ################################################################################
  7056. class PokeBattle_Move_0F7 < PokeBattle_Move
  7057. def flingarray
  7058. return {
  7059. 130 => [:IRONBALL],
  7060. 100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,
  7061. :HELIXFOSSIL,:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,
  7062. :ROOTFOSSIL,:SAILFOSSIL,:SKULLFOSSIL],
  7063. 90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,
  7064. :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,
  7065. :MEADOWPLATE,:MINDPLATE,:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,
  7066. :SPOOKYPLATE,:STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],
  7067. 80 => [:ASSAULTVEST,:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,
  7068. :ODDKEYSTONE,:OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,
  7069. :SAFETYGOGGLES,:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY,:SACHET,
  7070. :WHIPPEDDREAM],
  7071. 70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,
  7072. :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
  7073. :POWERWEIGHT,:SHOCKDRIVE],
  7074. 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LUSTROUSORB,
  7075. :MACHOBRACE,:ROCKYHELMET,:STICK,:TERRAINEXTENDER],
  7076. 50 => [:DUBIOUSDISC,:SHARPBEAK,:BUGMEMORY,:DARKMEMORY,:DRAGONMEMORY,
  7077. :ELECTRICMEMORY,:FAIRYMEMORY,:FIGHTING,:FIREMEMORY,:FLYINGMEMORY,
  7078. :GHOSTMEMORY,:GRASSMEMORY,:GROUNDMEMORY,:ICEMEMORY,:PSYCHICMEMORY,
  7079. :ROCKMEMORY,:STEELMEMORY,:WATERMEMORY,:POISONMEMORY],
  7080. 40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],
  7081. 30 => [:ABILITYURGE,:ABSORBBULB,:AMAZEMULCH,:AMULETCOIN,
  7082. :ANTIDOTE,:AWAKENING,:BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,
  7083. :BIGNUGGET,:BIGPEARL,:BINDINGBAND,:BLACKBELT,:BLACKFLUTE,
  7084. :BLACKGLASSES,:BLACKSLUDGE,:BLUEFLUTE,:BLUESHARD,:BOOSTMULCH,
  7085. :BURNHEAL,:CALCIUM,:CARBOS,:CASTELIACONE,:CELLBATTERY,
  7086. :CHARCOAL,:CLEANSETAG,:COMETSHARD,:DAMPMULCH,:DEEPSEASCALE,
  7087. :DIREHIT,:DIREHIT2,:DIREHIT3,:DRAGONSCALE,:EJECTBUTTON,
  7088. :ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ESCAPEROPE,:ETHER,
  7089. :EVERSTONE,:EXPSHARE,:FIRESTONE,:FLAMEORB,:FLOATSTONE,
  7090. :FLUFFYTAIL,:FRESHWATER,:FULLHEAL,:FULLRESTORE,:GOOEYMULCH,
  7091. :GREENSHARD,:GROWTHMULCH,:GUARDSPEC,:HEALPOWDER,:HEARTSCALE,
  7092. :HONEY,:HPUP,:HYPERPOTION,:ICEHEAL,:IRON,
  7093. :ITEMDROP,:ITEMURGE,:KINGSROCK,:LAVACOOKIE,:LEAFSTONE,
  7094. :LEMONADE,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,:LUCKYEGG,
  7095. :LUMINOUSMOSS,:LUMIOSEGALETTE,:MAGNET,:MAXELIXIR,:MAXETHER,
  7096. :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,
  7097. :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,
  7098. :NUGGET,:OLDGATEAU,:PARALYZEHEAL,:PARLYZHEAL,:PASSORB,
  7099. :PEARL,:PEARLSTRING,:POKEDOLL,:POKETOY,:POTION,
  7100. :PPMAX,:PPUP,:PRISMSCALE,:PROTEIN,:RAGECANDYBAR,
  7101. :RARECANDY,:RAZORFANG,:REDFLUTE,:REDSHARD,:RELICBAND,
  7102. :RELICCOPPER,:RELICCROWN,:RELICGOLD,:RELICSILVER,:RELICSTATUE,
  7103. :RELICVASE,:REPEL,:RESETURGE,:REVIVALHERB,:REVIVE,
  7104. :RICHMULCH,:SACREDASH,:SCOPELENS,:SHALOURSABLE,
  7105. :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
  7106. :SODAPOP,:SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,
  7107. :STARPIECE,:SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SURPRISEMULCH,
  7108. :SWEETHEART,:THUNDERSTONE,:TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,
  7109. :UPGRADE,:WATERSTONE,:WHITEFLUTE,:XACCURACY,
  7110. :XACCURACY2,:XACCURACY3,:XACCURACY6,:XATTACK,:XATTACK2,
  7111. :XATTACK3,:XATTACK6,:XDEFEND,:XDEFEND2,:XDEFEND3,
  7112. :XDEFEND6,:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
  7113. :XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,:XSPATK,
  7114. :XSPATK2,:XSPATK3,:XSPATK6,:XSPECIAL,:XSPECIAL2,
  7115. :XSPECIAL3,:XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,
  7116. :XSPEED6,:YELLOWFLUTE,:YELLOWSHARD,:ZINC,:ADRENALINEORB,
  7117. :BIGMALASADA,:BOTTLECAP,:PROTECTIVEPADS,:GOLDBOTTLECAP,
  7118. :PINKNECTAR,:PURPLENECTAR,:REDNECTAR,:YELLOWNECTAR],
  7119. 20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
  7120. :RESISTWING,:SWIFTWING],
  7121. 10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,
  7122. :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,
  7123. :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,
  7124. :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,
  7125. :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,
  7126. :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,
  7127. :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,
  7128. :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,
  7129. :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS,:ELECTRICSEED,
  7130. :GRASSYSEED,:MISTYSEED,:PSYCHICSEED,:ICESTONE,:DISCOUNTCOUPON]
  7131. }
  7132. end
  7133.  
  7134. def pbMoveFailed(attacker,opponent)
  7135. return true if attacker.item==0 ||
  7136. @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  7137. pbIsPokeBall?(attacker.item) ||
  7138. pbIsGem?(attacker.item) ||
  7139. isConst?(attacker.item,PBItems,:ABILITYCAPSULE) ||
  7140. isConst?(attacker.item,PBItems,:FESTIVALTICKET) ||
  7141. isConst?(attacker.item,PBItems,:REDORB) ||
  7142. isConst?(attacker.item,PBItems,:BLUEORB) ||
  7143. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  7144. attacker.hasWorkingAbility(:KLUTZ) ||
  7145. attacker.effects[PBEffects::Embargo]>0
  7146. for i in flingarray.keys
  7147. if flingarray[i]
  7148. for j in flingarray[i]
  7149. return false if isConst?(attacker.item,PBItems,j)
  7150. end
  7151. end
  7152. end
  7153. return false if pbIsBerry?(attacker.item) &&
  7154. !attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) &&
  7155. !attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  7156. return true
  7157. end
  7158.  
  7159. def pbBaseDamage(basedmg,attacker,opponent)
  7160. return 10 if pbIsBerry?(attacker.item)
  7161. return 80 if pbIsMegaStone?(attacker.item)
  7162. for i in flingarray.keys
  7163. if flingarray[i]
  7164. for j in flingarray[i]
  7165. return i if isConst?(attacker.item,PBItems,j)
  7166. end
  7167. end
  7168. end
  7169. return 1
  7170. end
  7171.  
  7172. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7173. if attacker.item==0
  7174. @battle.pbDisplay(_INTL("But it failed!"))
  7175. return 0
  7176. end
  7177. attacker.effects[PBEffects::Unburden]=true
  7178. @battle.pbDisplay(_INTL("{1} flung its {2}!",attacker.pbThis,PBItems.getName(attacker.item)))
  7179. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7180. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  7181. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SHIELDDUST))
  7182. if attacker.hasWorkingBerry
  7183. opponent.pbActivateBerryEffect(attacker.item,false)
  7184. elsif attacker.hasWorkingItem(:FLAMEORB)
  7185. if opponent.pbCanBurn?(attacker,false,self)
  7186. opponent.pbBurn(attacker)
  7187. end
  7188. elsif attacker.hasWorkingItem(:KINGSROCK) ||
  7189. attacker.hasWorkingItem(:RAZORFANG)
  7190. opponent.pbFlinch(attacker)
  7191. elsif attacker.hasWorkingItem(:LIGHTBALL)
  7192. if opponent.pbCanParalyze?(attacker,false,self)
  7193. opponent.pbParalyze(attacker)
  7194. end
  7195. elsif attacker.hasWorkingItem(:MENTALHERB)
  7196. if opponent.effects[PBEffects::Attract]>=0
  7197. opponent.pbCureAttract
  7198. @battle.pbDisplay(_INTL("{1} got over its infatuation.",opponent.pbThis))
  7199. end
  7200. if opponent.effects[PBEffects::Taunt]>0
  7201. opponent.effects[PBEffects::Taunt]=0
  7202. @battle.pbDisplay(_INTL("{1}'s taunt wore off!",opponent.pbThis))
  7203. end
  7204. if opponent.effects[PBEffects::Encore]>0
  7205. opponent.effects[PBEffects::Encore]=0
  7206. opponent.effects[PBEffects::EncoreMove]=0
  7207. opponent.effects[PBEffects::EncoreIndex]=0
  7208. @battle.pbDisplay(_INTL("{1}'s encore ended!",opponent.pbThis))
  7209. end
  7210. if opponent.effects[PBEffects::Torment]
  7211. opponent.effects[PBEffects::Torment]=false
  7212. @battle.pbDisplay(_INTL("{1}'s torment wore off!",opponent.pbThis))
  7213. end
  7214. if opponent.effects[PBEffects::Disable]>0
  7215. opponent.effects[PBEffects::Disable]=0
  7216. @battle.pbDisplay(_INTL("{1} is no longer disabled!",opponent.pbThis))
  7217. end
  7218. if opponent.effects[PBEffects::HealBlock]>0
  7219. opponent.effects[PBEffects::HealBlock]=0
  7220. @battle.pbDisplay(_INTL("{1}'s Heal Block wore off!",opponent.pbThis))
  7221. end
  7222. elsif attacker.hasWorkingItem(:POISONBARB)
  7223. if opponent.pbCanPoison?(attacker,false,self)
  7224. opponent.pbPoison(attacker)
  7225. end
  7226. elsif attacker.hasWorkingItem(:TOXICORB)
  7227. if opponent.pbCanPoison?(attacker,false,self)
  7228. opponent.pbPoison(attacker,nil,true)
  7229. end
  7230. elsif attacker.hasWorkingItem(:WHITEHERB)
  7231. while true
  7232. reducedstats=false
  7233. for i in [PBStats::ATTACK,PBStats::DEFENSE,
  7234. PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF,
  7235. PBStats::EVASION,PBStats::ACCURACY]
  7236. if opponent.stages[i]<0
  7237. opponent.stages[i]=0; reducedstats=true
  7238. end
  7239. end
  7240. break if !reducedstats
  7241. @battle.pbDisplay(_INTL("{1}'s status is returned to normal!",
  7242. opponent.pbThis(true)))
  7243. end
  7244. end
  7245. end
  7246. attacker.pbConsumeItem
  7247. return ret
  7248. end
  7249. end
  7250.  
  7251.  
  7252.  
  7253. ################################################################################
  7254. # For 5 rounds, the target cannnot use its held item, its held item has no
  7255. # effect, and no items can be used on it. (Embargo)
  7256. ################################################################################
  7257. class PokeBattle_Move_0F8 < PokeBattle_Move
  7258. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7259. if opponent.effects[PBEffects::Embargo]>0
  7260. @battle.pbDisplay(_INTL("But it failed!"))
  7261. return -1
  7262. end
  7263. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7264. opponent.effects[PBEffects::Embargo]=5
  7265. @battle.pbDisplay(_INTL("{1} can't use items anymore!",opponent.pbThis))
  7266. return 0
  7267. end
  7268. end
  7269.  
  7270.  
  7271.  
  7272. ################################################################################
  7273. # For 5 rounds, all held items cannot be used in any way and have no effect.
  7274. # Held items can still change hands, but can't be thrown. (Magic Room)
  7275. ################################################################################
  7276. class PokeBattle_Move_0F9 < PokeBattle_Move
  7277. def doesIgnoreDazzling?
  7278. return true
  7279. end
  7280.  
  7281. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7282. if @battle.field.effects[PBEffects::MagicRoom]>0
  7283. @battle.field.effects[PBEffects::MagicRoom]=0
  7284. @battle.pbDisplay(_INTL("The area returned to normal!"))
  7285. else
  7286. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7287. @battle.field.effects[PBEffects::MagicRoom]=5
  7288. @battle.pbDisplay(_INTL("It created a bizarre area in which Pokémon's held items lose their effects!"))
  7289. end
  7290. return 0
  7291. end
  7292. end
  7293.  
  7294.  
  7295.  
  7296. ################################################################################
  7297. # User takes recoil damage equal to 1/4 of the damage this move dealt.
  7298. ################################################################################
  7299. class PokeBattle_Move_0FA < PokeBattle_Move
  7300. def isRecoilMove?
  7301. return true
  7302. end
  7303.  
  7304. def pbEffectAfterHit(attacker,opponent,turneffects)
  7305. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7306. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7307. !attacker.hasWorkingAbility(:MAGICGUARD)
  7308. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/4.0).round)
  7309. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7310. end
  7311. end
  7312. end
  7313. end
  7314.  
  7315.  
  7316.  
  7317. ################################################################################
  7318. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7319. ################################################################################
  7320. class PokeBattle_Move_0FB < PokeBattle_Move
  7321. def isRecoilMove?
  7322. return true
  7323. end
  7324.  
  7325. def pbEffectAfterHit(attacker,opponent,turneffects)
  7326. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7327. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7328. !attacker.hasWorkingAbility(:MAGICGUARD)
  7329. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7330. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7331. end
  7332. end
  7333. end
  7334. end
  7335.  
  7336.  
  7337.  
  7338. ################################################################################
  7339. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  7340. # (Head Smash)
  7341. ################################################################################
  7342. class PokeBattle_Move_0FC < PokeBattle_Move
  7343. def isRecoilMove?
  7344. return true
  7345. end
  7346.  
  7347. def pbEffectAfterHit(attacker,opponent,turneffects)
  7348. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7349. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7350. !attacker.hasWorkingAbility(:MAGICGUARD)
  7351. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
  7352. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7353. end
  7354. end
  7355. end
  7356. end
  7357.  
  7358.  
  7359.  
  7360. ################################################################################
  7361. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7362. # May paralyze the target. (Volt Tackle)
  7363. ################################################################################
  7364. class PokeBattle_Move_0FD < PokeBattle_Move
  7365. def isRecoilMove?
  7366. return true
  7367. end
  7368.  
  7369. def pbEffectAfterHit(attacker,opponent,turneffects)
  7370. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7371. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7372. !attacker.hasWorkingAbility(:MAGICGUARD)
  7373. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7374. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7375. end
  7376. end
  7377. end
  7378.  
  7379. def pbAdditionalEffect(attacker,opponent)
  7380. return if opponent.damagestate.substitute
  7381. if opponent.pbCanParalyze?(attacker,false,self)
  7382. opponent.pbParalyze(attacker)
  7383. end
  7384. end
  7385. end
  7386.  
  7387.  
  7388.  
  7389. ################################################################################
  7390. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7391. # May burn the target. (Flare Blitz)
  7392. ################################################################################
  7393. class PokeBattle_Move_0FE < PokeBattle_Move
  7394. def isRecoilMove?
  7395. return true
  7396. end
  7397.  
  7398. def pbEffectAfterHit(attacker,opponent,turneffects)
  7399. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7400. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7401. !attacker.hasWorkingAbility(:MAGICGUARD)
  7402. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7403. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7404. end
  7405. end
  7406. end
  7407.  
  7408. def pbAdditionalEffect(attacker,opponent)
  7409. return if opponent.damagestate.substitute
  7410. if opponent.pbCanBurn?(attacker,false,self)
  7411. opponent.pbBurn(attacker)
  7412. end
  7413. end
  7414. end
  7415.  
  7416.  
  7417.  
  7418. ################################################################################
  7419. # Starts sunny weather. (Sunny Day)
  7420. ################################################################################
  7421. class PokeBattle_Move_0FF < PokeBattle_Move
  7422. def doesIgnoreDazzling?
  7423. return true
  7424. end
  7425.  
  7426. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7427. case @battle.weather
  7428. when PBWeather::HEAVYRAIN
  7429. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7430. return -1
  7431. when PBWeather::HARSHSUN
  7432. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7433. return -1
  7434. when PBWeather::STRONGWINDS
  7435. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7436. return -1
  7437. when PBWeather::SUNNYDAY
  7438. @battle.pbDisplay(_INTL("But it failed!"))
  7439. return -1
  7440. end
  7441. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7442. @battle.weather=PBWeather::SUNNYDAY
  7443. @battle.weatherduration=5
  7444. @battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
  7445. @battle.pbCommonAnimation("Sunny",nil,nil)
  7446. @battle.pbDisplay(_INTL("The sunlight turned harsh!"))
  7447. return 0
  7448. end
  7449. end
  7450.  
  7451.  
  7452.  
  7453. ################################################################################
  7454. # Starts rainy weather. (Rain Dance)
  7455. ################################################################################
  7456. class PokeBattle_Move_100 < PokeBattle_Move
  7457. def doesIgnoreDazzling?
  7458. return true
  7459. end
  7460.  
  7461. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7462. case @battle.weather
  7463. when PBWeather::HEAVYRAIN
  7464. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7465. return -1
  7466. when PBWeather::HARSHSUN
  7467. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7468. return -1
  7469. when PBWeather::STRONGWINDS
  7470. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7471. return -1
  7472. when PBWeather::RAINDANCE
  7473. @battle.pbDisplay(_INTL("But it failed!"))
  7474. return -1
  7475. end
  7476. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7477. @battle.weather=PBWeather::RAINDANCE
  7478. @battle.weatherduration=5
  7479. @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
  7480. @battle.pbCommonAnimation("Rain",nil,nil)
  7481. @battle.pbDisplay(_INTL("It started to rain!"))
  7482. return 0
  7483. end
  7484. end
  7485.  
  7486.  
  7487.  
  7488. ################################################################################
  7489. # Starts sandstorm weather. (Sandstorm)
  7490. ################################################################################
  7491. class PokeBattle_Move_101 < PokeBattle_Move
  7492. def doesIgnoreDazzling?
  7493. return true
  7494. end
  7495.  
  7496. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7497. case @battle.weather
  7498. when PBWeather::HEAVYRAIN
  7499. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7500. return -1
  7501. when PBWeather::HARSHSUN
  7502. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7503. return -1
  7504. when PBWeather::STRONGWINDS
  7505. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7506. return -1
  7507. when PBWeather::SANDSTORM
  7508. @battle.pbDisplay(_INTL("But it failed!"))
  7509. return -1
  7510. end
  7511. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7512. @battle.weather=PBWeather::SANDSTORM
  7513. @battle.weatherduration=5
  7514. @battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
  7515. @battle.pbCommonAnimation("Sandstorm",nil,nil)
  7516. @battle.pbDisplay(_INTL("A sandstorm brewed!"))
  7517. return 0
  7518. end
  7519. end
  7520.  
  7521.  
  7522.  
  7523. ################################################################################
  7524. # Starts hail weather. (Hail)
  7525. ################################################################################
  7526. class PokeBattle_Move_102 < PokeBattle_Move
  7527. def doesIgnoreDazzling?
  7528. return true
  7529. end
  7530.  
  7531. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7532. case @battle.weather
  7533. when PBWeather::HEAVYRAIN
  7534. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7535. return -1
  7536. when PBWeather::HARSHSUN
  7537. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7538. return -1
  7539. when PBWeather::STRONGWINDS
  7540. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7541. return -1
  7542. when PBWeather::HAIL
  7543. @battle.pbDisplay(_INTL("But it failed!"))
  7544. return -1
  7545. end
  7546. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7547. @battle.weather=PBWeather::HAIL
  7548. @battle.weatherduration=5
  7549. @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
  7550. @battle.pbCommonAnimation("Hail",nil,nil)
  7551. @battle.pbDisplay(_INTL("It started to hail!"))
  7552. return 0
  7553. end
  7554. end
  7555.  
  7556.  
  7557.  
  7558. ################################################################################
  7559. # Entry hazard. Lays spikes on the opposing side (max. 3 layers). (Spikes)
  7560. ################################################################################
  7561. class PokeBattle_Move_103 < PokeBattle_Move
  7562. def doesIgnoreDazzling?
  7563. return true
  7564. end
  7565.  
  7566. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7567. if attacker.pbOpposingSide.effects[PBEffects::Spikes]>=3
  7568. @battle.pbDisplay(_INTL("But it failed!"))
  7569. return -1
  7570. end
  7571. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7572. attacker.pbOpposingSide.effects[PBEffects::Spikes]+=1
  7573. if !@battle.pbIsOpposing?(attacker.index)
  7574. @battle.pbDisplay(_INTL("Spikes were scattered all around the opposing team's feet!"))
  7575. else
  7576. @battle.pbDisplay(_INTL("Spikes were scattered all around your team's feet!"))
  7577. end
  7578. return 0
  7579. end
  7580. end
  7581.  
  7582.  
  7583.  
  7584. ################################################################################
  7585. # Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
  7586. # (Toxic Spikes)
  7587. ################################################################################
  7588. class PokeBattle_Move_104 < PokeBattle_Move
  7589. def doesIgnoreDazzling?
  7590. return true
  7591. end
  7592.  
  7593. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7594. if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
  7595. @battle.pbDisplay(_INTL("But it failed!"))
  7596. return -1
  7597. end
  7598. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7599. attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]+=1
  7600. if !@battle.pbIsOpposing?(attacker.index)
  7601. @battle.pbDisplay(_INTL("Poison spikes were scattered all around the opposing team's feet!"))
  7602. else
  7603. @battle.pbDisplay(_INTL("Poison spikes were scattered all around your team's feet!"))
  7604. end
  7605. return 0
  7606. end
  7607. end
  7608.  
  7609.  
  7610.  
  7611. ################################################################################
  7612. # Entry hazard. Lays stealth rocks on the opposing side. (Stealth Rock)
  7613. ################################################################################
  7614. class PokeBattle_Move_105 < PokeBattle_Move
  7615. def doesIgnoreDazzling?
  7616. return true
  7617. end
  7618.  
  7619. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7620. if attacker.pbOpposingSide.effects[PBEffects::StealthRock]
  7621. @battle.pbDisplay(_INTL("But it failed!"))
  7622. return -1
  7623. end
  7624. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7625. attacker.pbOpposingSide.effects[PBEffects::StealthRock]=true
  7626. if !@battle.pbIsOpposing?(attacker.index)
  7627. @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
  7628. else
  7629. @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
  7630. end
  7631. return 0
  7632. end
  7633. end
  7634.  
  7635.  
  7636.  
  7637. ################################################################################
  7638. # Forces ally's Pledge move to be used next, if it hasn't already. (Grass Pledge)
  7639. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7640. # causes either a sea of fire or a swamp on the opposing side.
  7641. ################################################################################
  7642. class PokeBattle_Move_106 < PokeBattle_Move
  7643. def pbOnStartUse(attacker)
  7644. @doubledamage=false; @overridetype=false
  7645. if attacker.effects[PBEffects::FirstPledge]==0x107 || # Fire Pledge
  7646. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7647. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7648. @doubledamage=true
  7649. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7650. @overridetype=true
  7651. end
  7652. end
  7653. return true
  7654. end
  7655.  
  7656. def pbBaseDamage(basedmg,attacker,opponent)
  7657. if @doubledamage
  7658. return basedmg*2
  7659. end
  7660. return basedmg
  7661. end
  7662.  
  7663. def pbModifyType(type,attacker,opponent)
  7664. if @overridetype
  7665. type=getConst(PBTypes,:FIRE) || 0
  7666. end
  7667. return super(type,attacker,opponent)
  7668. end
  7669.  
  7670. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7671. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7672. attacker.effects[PBEffects::FirstPledge]=0
  7673. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7674. end
  7675. # Combined move's effect
  7676. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7677. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7678. if opponent.damagestate.calcdamage>0
  7679. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7680. if !@battle.pbIsOpposing?(attacker.index)
  7681. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7682. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7683. else
  7684. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7685. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7686. end
  7687. end
  7688. attacker.effects[PBEffects::FirstPledge]=0
  7689. return ret
  7690. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7691. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7692. if opponent.damagestate.calcdamage>0
  7693. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7694. if !@battle.pbIsOpposing?(attacker.index)
  7695. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7696. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7697. else
  7698. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7699. @battle.pbCommonAnimation("Swamp",nil,nil)
  7700. end
  7701. end
  7702. attacker.effects[PBEffects::FirstPledge]=0
  7703. return ret
  7704. end
  7705. # Set up partner for a combined move
  7706. attacker.effects[PBEffects::FirstPledge]=0
  7707. partnermove=-1
  7708. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7709. if !attacker.pbPartner.hasMovedThisRound?
  7710. move=@battle.choices[attacker.pbPartner.index][2]
  7711. if move && move.id>0
  7712. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7713. end
  7714. end
  7715. end
  7716. if partnermove==0x107 || # Fire Pledge
  7717. partnermove==0x108 # Water Pledge
  7718. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7719. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7720. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7721. return 0
  7722. end
  7723. # Use the move on its own
  7724. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7725. end
  7726.  
  7727. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7728. if @overridetype
  7729. return super(getConst(PBMoves,:FIREPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7730. end
  7731. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7732. end
  7733. end
  7734.  
  7735.  
  7736.  
  7737. ################################################################################
  7738. # Forces ally's Pledge move to be used next, if it hasn't already. (Fire Pledge)
  7739. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7740. # causes either a sea of fire on the opposing side or a rainbow on the user's side.
  7741. ################################################################################
  7742. class PokeBattle_Move_107 < PokeBattle_Move
  7743. def pbOnStartUse(attacker)
  7744. @doubledamage=false; @overridetype=false
  7745. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7746. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7747. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7748. @doubledamage=true
  7749. if attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7750. @overridetype=true
  7751. end
  7752. end
  7753. return true
  7754. end
  7755.  
  7756. def pbBaseDamage(basedmg,attacker,opponent)
  7757. if @doubledamage
  7758. return basedmg*2
  7759. end
  7760. return basedmg
  7761. end
  7762.  
  7763. def pbModifyType(type,attacker,opponent)
  7764. if @overridetype
  7765. type=getConst(PBTypes,:WATER) || 0
  7766. end
  7767. return super(type,attacker,opponent)
  7768. end
  7769.  
  7770. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7771. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7772. attacker.effects[PBEffects::FirstPledge]=0
  7773. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7774. end
  7775. # Combined move's effect
  7776. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7777. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7778. if opponent.damagestate.calcdamage>0
  7779. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7780. if !@battle.pbIsOpposing?(attacker.index)
  7781. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7782. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7783. else
  7784. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7785. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7786. end
  7787. end
  7788. attacker.effects[PBEffects::FirstPledge]=0
  7789. return ret
  7790. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7791. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7792. if opponent.damagestate.calcdamage>0
  7793. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7794. if !@battle.pbIsOpposing?(attacker.index)
  7795. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7796. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7797. else
  7798. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7799. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7800. end
  7801. end
  7802. attacker.effects[PBEffects::FirstPledge]=0
  7803. return ret
  7804. end
  7805. # Set up partner for a combined move
  7806. attacker.effects[PBEffects::FirstPledge]=0
  7807. partnermove=-1
  7808. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7809. if !attacker.pbPartner.hasMovedThisRound?
  7810. move=@battle.choices[attacker.pbPartner.index][2]
  7811. if move && move.id>0
  7812. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7813. end
  7814. end
  7815. end
  7816. if partnermove==0x106 || # Grass Pledge
  7817. partnermove==0x108 # Water Pledge
  7818. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7819. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7820. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7821. return 0
  7822. end
  7823. # Use the move on its own
  7824. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7825. end
  7826.  
  7827. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7828. if @overridetype
  7829. return super(getConst(PBMoves,:WATERPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7830. end
  7831. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7832. end
  7833. end
  7834.  
  7835.  
  7836.  
  7837. ################################################################################
  7838. # Forces ally's Pledge move to be used next, if it hasn't already. (Water Pledge)
  7839. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7840. # causes either a swamp on the opposing side or a rainbow on the user's side.
  7841. ################################################################################
  7842. class PokeBattle_Move_108 < PokeBattle_Move
  7843. def pbOnStartUse(attacker)
  7844. @doubledamage=false; @overridetype=false
  7845. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7846. attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7847. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7848. @doubledamage=true
  7849. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7850. @overridetype=true
  7851. end
  7852. end
  7853. return true
  7854. end
  7855.  
  7856. def pbBaseDamage(basedmg,attacker,opponent)
  7857. if @doubledamage
  7858. return basedmg*2
  7859. end
  7860. return basedmg
  7861. end
  7862.  
  7863. def pbModifyType(type,attacker,opponent)
  7864. if @overridetype
  7865. type=getConst(PBTypes,:GRASS) || 0
  7866. end
  7867. return super(type,attacker,opponent)
  7868. end
  7869.  
  7870. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7871. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7872. attacker.effects[PBEffects::FirstPledge]=0
  7873. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7874. end
  7875. # Combined move's effect
  7876. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7877. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7878. if opponent.damagestate.calcdamage>0
  7879. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7880. if !@battle.pbIsOpposing?(attacker.index)
  7881. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7882. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7883. else
  7884. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7885. @battle.pbCommonAnimation("Swamp",nil,nil)
  7886. end
  7887. end
  7888. attacker.effects[PBEffects::FirstPledge]=0
  7889. return ret
  7890. elsif attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7891. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7892. if opponent.damagestate.calcdamage>0
  7893. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7894. if !@battle.pbIsOpposing?(attacker.index)
  7895. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7896. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7897. else
  7898. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7899. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7900. end
  7901. end
  7902. attacker.effects[PBEffects::FirstPledge]=0
  7903. return ret
  7904. end
  7905. # Set up partner for a combined move
  7906. attacker.effects[PBEffects::FirstPledge]=0
  7907. partnermove=-1
  7908. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7909. if !attacker.pbPartner.hasMovedThisRound?
  7910. move=@battle.choices[attacker.pbPartner.index][2]
  7911. if move && move.id>0
  7912. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7913. end
  7914. end
  7915. end
  7916. if partnermove==0x106 || # Grass Pledge
  7917. partnermove==0x107 # Fire Pledge
  7918. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7919. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7920. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7921. return 0
  7922. end
  7923. # Use the move on its own
  7924. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7925. end
  7926.  
  7927. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7928. if @overridetype
  7929. return super(getConst(PBMoves,:GRASSPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7930. end
  7931. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7932. end
  7933. end
  7934.  
  7935.  
  7936.  
  7937. ################################################################################
  7938. # Scatters coins that the player picks up after winning the battle. (Pay Day)
  7939. ################################################################################
  7940. class PokeBattle_Move_109 < PokeBattle_Move
  7941. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7942. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7943. if opponent.damagestate.calcdamage>0
  7944. if @battle.pbOwnedByPlayer?(attacker.index)
  7945. @battle.extramoney+=5*attacker.level
  7946. @battle.extramoney=MAXMONEY if @battle.extramoney>MAXMONEY
  7947. end
  7948. @battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
  7949. end
  7950. return ret
  7951. end
  7952. end
  7953.  
  7954.  
  7955.  
  7956. ################################################################################
  7957. # Ends the opposing side's Light Screen and Reflect. (Brick Break)
  7958. ################################################################################
  7959. class PokeBattle_Move_10A < PokeBattle_Move
  7960. def pbCalcDamage(attacker,opponent)
  7961. return super(attacker,opponent,PokeBattle_Move::NOREFLECT)
  7962. end
  7963.  
  7964. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7965. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7966. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0
  7967. attacker.pbOpposingSide.effects[PBEffects::Reflect]=0
  7968. if !@battle.pbIsOpposing?(attacker.index)
  7969. @battle.pbDisplay(_INTL("The opposing team's Reflect wore off!"))
  7970. else
  7971. @battle.pbDisplayPaused(_INTL("Your team's Reflect wore off!"))
  7972. end
  7973. end
  7974. if attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7975. attacker.pbOpposingSide.effects[PBEffects::LightScreen]=0
  7976. if !@battle.pbIsOpposing?(attacker.index)
  7977. @battle.pbDisplay(_INTL("The opposing team's Light Screen wore off!"))
  7978. else
  7979. @battle.pbDisplay(_INTL("Your team's Light Screen wore off!"))
  7980. end
  7981. end
  7982. return ret
  7983. end
  7984.  
  7985. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7986. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
  7987. attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7988. return super(id,attacker,opponent,1,alltargets,showanimation) # Wall-breaking anim
  7989. end
  7990. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7991. end
  7992. end
  7993.  
  7994.  
  7995.  
  7996. ################################################################################
  7997. # If attack misses, user takes crash damage of 1/2 of max HP.
  7998. # (Hi Jump Kick, Jump Kick)
  7999. ################################################################################
  8000. class PokeBattle_Move_10B < PokeBattle_Move
  8001. def isRecoilMove?
  8002. return true
  8003. end
  8004.  
  8005. def unusableInGravity?
  8006. return true
  8007. end
  8008. end
  8009.  
  8010.  
  8011.  
  8012. ################################################################################
  8013. # User turns 1/4 of max HP into a substitute. (Substitute)
  8014. ################################################################################
  8015. class PokeBattle_Move_10C < PokeBattle_Move
  8016. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8017. if attacker.effects[PBEffects::Substitute]>0
  8018. @battle.pbDisplay(_INTL("{1} already has a substitute!",attacker.pbThis))
  8019. return -1
  8020. end
  8021. sublife=[(attacker.totalhp/4).floor,1].max
  8022. if attacker.hp<=sublife
  8023. @battle.pbDisplay(_INTL("It was too weak to make a substitute!"))
  8024. return -1
  8025. end
  8026. attacker.pbReduceHP(sublife,false,false)
  8027. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8028. attacker.effects[PBEffects::MultiTurn]=0
  8029. attacker.effects[PBEffects::MultiTurnAttack]=0
  8030. attacker.effects[PBEffects::Substitute]=sublife
  8031. @battle.pbDisplay(_INTL("{1} put in a substitute!",attacker.pbThis))
  8032. return 0
  8033. end
  8034. end
  8035.  
  8036.  
  8037.  
  8038. ################################################################################
  8039. # User is not Ghost: Decreases the user's Speed, increases the user's Attack &
  8040. # Defense by 1 stage each.
  8041. # User is Ghost: User loses 1/2 of max HP, and curses the target.
  8042. # Cursed Pokémon lose 1/4 of their max HP at the end of each round.
  8043. # (Curse)
  8044. ################################################################################
  8045. class PokeBattle_Move_10D < PokeBattle_Move
  8046. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8047. failed=false
  8048. if attacker.pbHasType?(:GHOST)
  8049. if opponent.effects[PBEffects::Curse] ||
  8050. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  8051. failed=true
  8052. else
  8053. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8054. @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true)))
  8055. opponent.effects[PBEffects::Curse]=true
  8056. attacker.pbReduceHP((attacker.totalhp/2).floor)
  8057. end
  8058. else
  8059. lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8060. raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8061. raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8062. if !lowerspeed && !raiseatk && !raisedef
  8063. failed=true
  8064. else
  8065. pbShowAnimation(@id,attacker,nil,1,alltargets,showanimation) # Non-Ghost move animation
  8066. if lowerspeed
  8067. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  8068. end
  8069. showanim=true
  8070. if raiseatk
  8071. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8072. showanim=false
  8073. end
  8074. if raisedef
  8075. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8076. showanim=false
  8077. end
  8078. end
  8079. end
  8080. if failed
  8081. @battle.pbDisplay(_INTL("But it failed!"))
  8082. end
  8083. return failed ? -1 : 0
  8084. end
  8085. end
  8086.  
  8087.  
  8088.  
  8089. ################################################################################
  8090. # Target's last move used loses 4 PP. (Spite)
  8091. ################################################################################
  8092. class PokeBattle_Move_10E < PokeBattle_Move
  8093. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8094. for i in opponent.moves
  8095. if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
  8096. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8097. reduction=[4,i.pp].min
  8098. opponent.pbSetPP(i,i.pp-reduction)
  8099. @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
  8100. return 0
  8101. end
  8102. end
  8103. @battle.pbDisplay(_INTL("But it failed!"))
  8104. return -1
  8105. end
  8106. end
  8107.  
  8108.  
  8109.  
  8110. ################################################################################
  8111. # Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare)
  8112. ################################################################################
  8113. class PokeBattle_Move_10F < PokeBattle_Move
  8114. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8115. if (opponent.status!=PBStatuses::SLEEP || opponent.effects[PBEffects::Nightmare] ||
  8116. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))) &&
  8117. (!opponent.hasWorkingAbility(:COMATOSE) ||
  8118. isConst?(opponent.species,PBSpecies,:KOMALA) || opponent.effects[PBEffects::Nightmare] ||
  8119. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)))
  8120. @battle.pbDisplay(_INTL("But it failed!"))
  8121. return -1
  8122. end
  8123. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8124. opponent.effects[PBEffects::Nightmare]=true
  8125. @battle.pbDisplay(_INTL("{1} began having a nightmare!",opponent.pbThis))
  8126. return 0
  8127. end
  8128. end
  8129.  
  8130.  
  8131.  
  8132. ################################################################################
  8133. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  8134. # (Rapid Spin)
  8135. ################################################################################
  8136. class PokeBattle_Move_110 < PokeBattle_Move
  8137. def pbEffectAfterHit(attacker,opponent,turneffects)
  8138. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  8139. if attacker.effects[PBEffects::MultiTurn]>0
  8140. mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
  8141. mtuser=@battle.battlers[attacker.effects[PBEffects::MultiTurnUser]]
  8142. @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
  8143. attacker.effects[PBEffects::MultiTurn]=0
  8144. attacker.effects[PBEffects::MultiTurnAttack]=0
  8145. attacker.effects[PBEffects::MultiTurnUser]=-1
  8146. end
  8147. if attacker.effects[PBEffects::LeechSeed]>=0
  8148. attacker.effects[PBEffects::LeechSeed]=-1
  8149. @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))
  8150. end
  8151. if attacker.pbOwnSide.effects[PBEffects::StealthRock]
  8152. attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
  8153. @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))
  8154. end
  8155. if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
  8156. attacker.pbOwnSide.effects[PBEffects::Spikes]=0
  8157. @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))
  8158. end
  8159. if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  8160. attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
  8161. @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))
  8162. end
  8163. if attacker.pbOwnSide.effects[PBEffects::StickyWeb]
  8164. attacker.pbOwnSide.effects[PBEffects::StickyWeb]=false
  8165. @battle.pbDisplay(_INTL("{1} blew away sticky webs!",attacker.pbThis))
  8166. end
  8167. end
  8168. end
  8169. end
  8170.  
  8171.  
  8172.  
  8173. ################################################################################
  8174. # Attacks 2 rounds in the future. (Doom Desire, Future Sight)
  8175. ################################################################################
  8176. class PokeBattle_Move_111 < PokeBattle_Move
  8177. def pbDisplayUseMessage(attacker)
  8178. return 0 if @battle.futuresight
  8179. return super(attacker)
  8180. end
  8181.  
  8182. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8183. if opponent.effects[PBEffects::FutureSight]>0
  8184. @battle.pbDisplay(_INTL("But it failed!"))
  8185. return -1
  8186. end
  8187. if @battle.futuresight
  8188. # Attack hits
  8189. return super(attacker,opponent,hitnum,alltargets,showanimation)
  8190. end
  8191. # Attack is launched
  8192. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8193. opponent.effects[PBEffects::FutureSight]=3
  8194. opponent.effects[PBEffects::FutureSightMove]=@id
  8195. opponent.effects[PBEffects::FutureSightUser]=attacker.pokemonIndex
  8196. opponent.effects[PBEffects::FutureSightUserPos]=attacker.index
  8197. if isConst?(@id,PBMoves,:FUTURESIGHT)
  8198. @battle.pbDisplay(_INTL("{1} foresaw an attack!",attacker.pbThis))
  8199. else
  8200. @battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",attacker.pbThis))
  8201. end
  8202. return 0
  8203. end
  8204.  
  8205. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8206. if @battle.futuresight
  8207. return super(id,attacker,opponent,1,alltargets,showanimation) # Hit opponent anim
  8208. end
  8209. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  8210. end
  8211. end
  8212.  
  8213.  
  8214.  
  8215. ################################################################################
  8216. # Increases the user's Defense and Special Defense by 1 stage each. Ups the
  8217. # user's stockpile by 1 (max. 3). (Stockpile)
  8218. ################################################################################
  8219. class PokeBattle_Move_112 < PokeBattle_Move
  8220. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8221. if attacker.effects[PBEffects::Stockpile]>=3
  8222. @battle.pbDisplay(_INTL("{1} can't stockpile any more!",attacker.pbThis))
  8223. return -1
  8224. end
  8225. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8226. attacker.effects[PBEffects::Stockpile]+=1
  8227. @battle.pbDisplay(_INTL("{1} stockpiled {2}!",attacker.pbThis,
  8228. attacker.effects[PBEffects::Stockpile]))
  8229. showanim=true
  8230. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8231. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8232. attacker.effects[PBEffects::StockpileDef]+=1
  8233. showanim=false
  8234. end
  8235. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8236. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  8237. attacker.effects[PBEffects::StockpileSpDef]+=1
  8238. showanim=false
  8239. end
  8240. return 0
  8241. end
  8242. end
  8243.  
  8244.  
  8245.  
  8246. ################################################################################
  8247. # Power is 100 multiplied by the user's stockpile (X). Resets the stockpile to
  8248. # 0. Decreases the user's Defense and Special Defense by X stages each. (Spit Up)
  8249. ################################################################################
  8250. class PokeBattle_Move_113 < PokeBattle_Move
  8251. def pbMoveFailed(attacker,opponent)
  8252. return (attacker.effects[PBEffects::Stockpile]==0)
  8253. end
  8254.  
  8255. def pbBaseDamage(basedmg,attacker,opponent)
  8256. return 100*attacker.effects[PBEffects::Stockpile]
  8257. end
  8258.  
  8259. def pbEffectAfterHit(attacker,opponent,turneffects)
  8260. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  8261. showanim=true
  8262. if attacker.effects[PBEffects::StockpileDef]>0
  8263. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8264. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8265. attacker,false,self,showanim)
  8266. showanim=false
  8267. end
  8268. end
  8269. if attacker.effects[PBEffects::StockpileSpDef]>0
  8270. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8271. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8272. attacker,false,self,showanim)
  8273. showanim=false
  8274. end
  8275. end
  8276. attacker.effects[PBEffects::Stockpile]=0
  8277. attacker.effects[PBEffects::StockpileDef]=0
  8278. attacker.effects[PBEffects::StockpileSpDef]=0
  8279. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8280. end
  8281. end
  8282. end
  8283.  
  8284.  
  8285.  
  8286. ################################################################################
  8287. # Heals user depending on the user's stockpile (X). Resets the stockpile to 0.
  8288. # Decreases the user's Defense and Special Defense by X stages each. (Swallow)
  8289. ################################################################################
  8290. class PokeBattle_Move_114 < PokeBattle_Move
  8291. def isHealingMove?
  8292. return true
  8293. end
  8294.  
  8295. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8296. hpgain=0
  8297. case attacker.effects[PBEffects::Stockpile]
  8298. when 0
  8299. @battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
  8300. return -1
  8301. when 1
  8302. hpgain=(attacker.totalhp/4).floor
  8303. when 2
  8304. hpgain=(attacker.totalhp/2).floor
  8305. when 3
  8306. hpgain=attacker.totalhp
  8307. end
  8308. if attacker.hp==attacker.totalhp &&
  8309. attacker.effects[PBEffects::StockpileDef]==0 &&
  8310. attacker.effects[PBEffects::StockpileSpDef]==0
  8311. @battle.pbDisplay(_INTL("But it failed!"))
  8312. return -1
  8313. end
  8314. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8315. if attacker.pbRecoverHP(hpgain,true)>0
  8316. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  8317. end
  8318. showanim=true
  8319. if attacker.effects[PBEffects::StockpileDef]>0
  8320. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8321. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8322. attacker,false,self,showanim)
  8323. showanim=false
  8324. end
  8325. end
  8326. if attacker.effects[PBEffects::StockpileSpDef]>0
  8327. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8328. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8329. attacker,false,self,showanim)
  8330. showanim=false
  8331. end
  8332. end
  8333. attacker.effects[PBEffects::Stockpile]=0
  8334. attacker.effects[PBEffects::StockpileDef]=0
  8335. attacker.effects[PBEffects::StockpileSpDef]=0
  8336. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8337. return 0
  8338. end
  8339. end
  8340.  
  8341.  
  8342.  
  8343. ################################################################################
  8344. # Fails if user was hit by a damaging move this round. (Focus Punch)
  8345. ################################################################################
  8346. class PokeBattle_Move_115 < PokeBattle_Move
  8347. def pbDisplayUseMessage(attacker)
  8348. if attacker.lastHPLost>0
  8349. @battle.pbDisplayBrief(_INTL("{1} lost its focus and couldn't move!",attacker.pbThis))
  8350. return -1
  8351. end
  8352. return super(attacker)
  8353. end
  8354. end
  8355.  
  8356.  
  8357.  
  8358. ################################################################################
  8359. # Fails if the target didn't chose a damaging move to use this round, or has
  8360. # already moved. (Sucker Punch)
  8361. ################################################################################
  8362. class PokeBattle_Move_116 < PokeBattle_Move
  8363. def pbMoveFailed(attacker,opponent)
  8364. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8365. oppmove=@battle.choices[opponent.index][2]
  8366. return true if !oppmove || oppmove.id<=0 || oppmove.pbIsStatus?
  8367. return true if opponent.hasMovedThisRound? && oppmove.function!=0xB0 # Me First
  8368. return false
  8369. end
  8370. end
  8371.  
  8372.  
  8373.  
  8374. ################################################################################
  8375. # This round, user becomes the target of attacks that have single targets.
  8376. # (Follow Me, Rage Powder)
  8377. ################################################################################
  8378. class PokeBattle_Move_117 < PokeBattle_Move
  8379. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8380. if !@battle.doublebattle
  8381. @battle.pbDisplay(_INTL("But it failed!"))
  8382. return -1
  8383. end
  8384. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8385. attacker.effects[PBEffects::FollowMe]=1
  8386. if !attacker.pbPartner.fainted? && attacker.pbPartner.effects[PBEffects::FollowMe]>0
  8387. attacker.effects[PBEffects::FollowMe]=attacker.pbPartner.effects[PBEffects::FollowMe]+1
  8388. end
  8389. @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
  8390. return 0
  8391. end
  8392. end
  8393.  
  8394.  
  8395.  
  8396. ################################################################################
  8397. # For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
  8398. # (Gravity)
  8399. ################################################################################
  8400. class PokeBattle_Move_118 < PokeBattle_Move
  8401. def doesIgnoreDazzling?
  8402. return true
  8403. end
  8404.  
  8405. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8406. if @battle.field.effects[PBEffects::Gravity]>0
  8407. @battle.pbDisplay(_INTL("But it failed!"))
  8408. return -1
  8409. end
  8410. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8411. @battle.field.effects[PBEffects::Gravity]=5
  8412. for i in 0...4
  8413. poke=@battle.battlers[i]
  8414. next if !poke
  8415. if PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8416. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8417. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCE # Sky Drop
  8418. poke.effects[PBEffects::TwoTurnAttack]=0
  8419. end
  8420. if poke.effects[PBEffects::SkyDrop]
  8421. poke.effects[PBEffects::SkyDrop]=false
  8422. end
  8423. if poke.effects[PBEffects::MagnetRise]>0
  8424. poke.effects[PBEffects::MagnetRise]=0
  8425. end
  8426. if poke.effects[PBEffects::Telekinesis]>0
  8427. poke.effects[PBEffects::Telekinesis]=0
  8428. end
  8429. end
  8430. @battle.pbDisplay(_INTL("Gravity intensified!"))
  8431. return 0
  8432. end
  8433. end
  8434.  
  8435.  
  8436.  
  8437. ################################################################################
  8438. # For 5 rounds, user becomes airborne. (Magnet Rise)
  8439. ################################################################################
  8440. class PokeBattle_Move_119 < PokeBattle_Move
  8441. def unusableInGravity?
  8442. return true
  8443. end
  8444.  
  8445. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8446. if attacker.effects[PBEffects::Ingrain] ||
  8447. attacker.effects[PBEffects::SmackDown] ||
  8448. attacker.effects[PBEffects::MagnetRise]>0
  8449. @battle.pbDisplay(_INTL("But it failed!"))
  8450. return -1
  8451. end
  8452. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8453. attacker.effects[PBEffects::MagnetRise]=5
  8454. @battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",attacker.pbThis))
  8455. return 0
  8456. end
  8457. end
  8458.  
  8459.  
  8460.  
  8461. ################################################################################
  8462. # For 3 rounds, target becomes airborne and can always be hit. (Telekinesis)
  8463. ################################################################################
  8464. class PokeBattle_Move_11A < PokeBattle_Move
  8465. def unusableInGravity?
  8466. return true
  8467. end
  8468.  
  8469. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8470. if opponent.effects[PBEffects::Ingrain] ||
  8471. opponent.effects[PBEffects::SmackDown] ||
  8472. opponent.effects[PBEffects::Telekinesis]>0
  8473. @battle.pbDisplay(_INTL("But it failed!"))
  8474. return -1
  8475. end
  8476. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8477. opponent.effects[PBEffects::Telekinesis]=3
  8478. @battle.pbDisplay(_INTL("{1} was hurled into the air!",opponent.pbThis))
  8479. return 0
  8480. end
  8481. end
  8482.  
  8483.  
  8484.  
  8485.  
  8486. ################################################################################
  8487. # Hits airborne semi-invulnerable targets. (Sky Uppercut)
  8488. ################################################################################
  8489. class PokeBattle_Move_11B < PokeBattle_Move
  8490. # Handled in Battler's pbSuccessCheck, do not edit!
  8491. end
  8492.  
  8493.  
  8494.  
  8495. ################################################################################
  8496. # Grounds the target while it remains active. (Smack Down, Thousand Arrows)
  8497. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  8498. ################################################################################
  8499. class PokeBattle_Move_11C < PokeBattle_Move
  8500. def pbBaseDamage(basedmg,attacker,opponent)
  8501. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8502. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8503. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  8504. opponent.effects[PBEffects::SkyDrop]
  8505. return basedmg*2
  8506. end
  8507. return basedmg
  8508. end
  8509.  
  8510. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8511. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  8512. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  8513. !opponent.effects[PBEffects::Roost]
  8514. opponent.effects[PBEffects::SmackDown]=true
  8515. showmsg=(opponent.pbHasType?(:FLYING) ||
  8516. opponent.hasWorkingAbility(:LEVITATE))
  8517. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8518. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  8519. opponent.effects[PBEffects::TwoTurnAttack]=0; showmsg=true
  8520. end
  8521. if opponent.effects[PBEffects::MagnetRise]>0
  8522. opponent.effects[PBEffects::MagnetRise]=0; showmsg=true
  8523. end
  8524. if opponent.effects[PBEffects::Telekinesis]>0
  8525. opponent.effects[PBEffects::Telekinesis]=0; showmsg=true
  8526. end
  8527. @battle.pbDisplay(_INTL("{1} fell straight down!",opponent.pbThis)) if showmsg
  8528. end
  8529. return ret
  8530. end
  8531. end
  8532.  
  8533.  
  8534.  
  8535. ################################################################################
  8536. # Target moves immediately after the user, ignoring priority/speed. (After You)
  8537. ################################################################################
  8538. class PokeBattle_Move_11D < PokeBattle_Move
  8539. def pbMoveFailed(attacker,opponent)
  8540. return true if opponent.effects[PBEffects::MoveNext]
  8541. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8542. oppmove=@battle.choices[opponent.index][2]
  8543. return true if !oppmove || oppmove.id<=0
  8544. return true if opponent.hasMovedThisRound?
  8545. return false
  8546. end
  8547.  
  8548. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8549. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8550. opponent.effects[PBEffects::MoveNext]=true
  8551. opponent.effects[PBEffects::Quash]=false
  8552. @battle.pbDisplay(_INTL("{1} took the kind offer!",opponent.pbThis))
  8553. return 0
  8554. end
  8555. end
  8556.  
  8557.  
  8558.  
  8559. ################################################################################
  8560. # Target moves last this round, ignoring priority/speed. (Quash)
  8561. ################################################################################
  8562. class PokeBattle_Move_11E < PokeBattle_Move
  8563. def pbMoveFailed(attacker,opponent)
  8564. return true if opponent.effects[PBEffects::Quash]
  8565. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8566. oppmove=@battle.choices[opponent.index][2]
  8567. return true if !oppmove || oppmove.id<=0
  8568. return true if opponent.hasMovedThisRound?
  8569. return false
  8570. end
  8571.  
  8572. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8573. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8574. opponent.effects[PBEffects::Quash]=true
  8575. opponent.effects[PBEffects::MoveNext]=false
  8576. @battle.pbDisplay(_INTL("{1}'s move was postponed!",opponent.pbThis))
  8577. return 0
  8578. end
  8579. end
  8580.  
  8581.  
  8582.  
  8583. ################################################################################
  8584. # For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
  8585. # (Trick Room)
  8586. ################################################################################
  8587. class PokeBattle_Move_11F < PokeBattle_Move
  8588. def doesIgnoreDazzling?
  8589. return true
  8590. end
  8591.  
  8592. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8593. if @battle.field.effects[PBEffects::TrickRoom]>0
  8594. @battle.field.effects[PBEffects::TrickRoom]=0
  8595. @battle.pbDisplay(_INTL("{1} reverted the dimensions!",attacker.pbThis))
  8596. else
  8597. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8598. @battle.field.effects[PBEffects::TrickRoom]=5
  8599. @battle.pbDisplay(_INTL("{1} twisted the dimensions!",attacker.pbThis))
  8600. end
  8601. return 0
  8602. end
  8603. end
  8604.  
  8605.  
  8606.  
  8607. ################################################################################
  8608. # User switches places with its ally. (Ally Switch)
  8609. ################################################################################
  8610. class PokeBattle_Move_120 < PokeBattle_Move
  8611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8612. if !@battle.doublebattle ||
  8613. !attacker.pbPartner || attacker.pbPartner.fainted?
  8614. @battle.pbDisplay(_INTL("But it failed!"))
  8615. return -1
  8616. end
  8617. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8618. a=@battle.battlers[attacker.index]
  8619. b=@battle.battlers[attacker.pbPartner.index]
  8620. temp=a; a=b; b=temp
  8621. # Swap effects that point at the position rather than the Pokémon
  8622. # NOT PerishSongUser (no need to swap), Attract, MultiTurnUser
  8623. effectstoswap=[PBEffects::BideTarget,
  8624. PBEffects::CounterTarget,
  8625. PBEffects::LeechSeed,
  8626. PBEffects::LockOnPos,
  8627. PBEffects::MeanLook,
  8628. PBEffects::MirrorCoatTarget]
  8629. for i in effectstoswap
  8630. a.effects[i],b.effects[i]=b.effects[i],a.effects[i]
  8631. end
  8632. attacker.pbUpdate(true)
  8633. opponent.pbUpdate(true)
  8634. @battle.pbDisplay(_INTL("{1} and {2} switched places!",opponent.pbThis,attacker.pbThis(true)))
  8635. end
  8636. end
  8637.  
  8638.  
  8639.  
  8640. ################################################################################
  8641. # Target's Attack is used instead of user's Attack for this move's calculations.
  8642. # (Foul Play)
  8643. ################################################################################
  8644. class PokeBattle_Move_121 < PokeBattle_Move
  8645. # Handled in superclass def pbCalcDamage, do not edit!
  8646. end
  8647.  
  8648.  
  8649.  
  8650. ################################################################################
  8651. # Target's Defense is used instead of its Special Defense for this move's
  8652. # calculations. (Psyshock, Psystrike, Secret Sword)
  8653. ################################################################################
  8654. class PokeBattle_Move_122 < PokeBattle_Move
  8655. # Handled in superclass def pbCalcDamage, do not edit!
  8656. end
  8657.  
  8658.  
  8659.  
  8660. ################################################################################
  8661. # Only damages Pokémon that share a type with the user. (Synchronoise)
  8662. ################################################################################
  8663. class PokeBattle_Move_123 < PokeBattle_Move
  8664. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8665. if !opponent.pbHasType?(attacker.type1) &&
  8666. !opponent.pbHasType?(attacker.type2) &&
  8667. !opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  8668. @battle.pbDisplay(_INTL("{1} was unaffected!",opponent.pbThis))
  8669. return -1
  8670. end
  8671. return super(attacker,opponent,hitnum,alltargets,showanimation)
  8672. end
  8673. end
  8674.  
  8675.  
  8676.  
  8677. ################################################################################
  8678. # For 5 rounds, swaps all battlers' base Defense with base Special Defense.
  8679. # (Wonder Room)
  8680. ################################################################################
  8681. class PokeBattle_Move_124 < PokeBattle_Move
  8682. def doesIgnoreDazzling?
  8683. return true
  8684. end
  8685.  
  8686. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8687. if @battle.field.effects[PBEffects::WonderRoom]>0
  8688. @battle.field.effects[PBEffects::WonderRoom]=0
  8689. @battle.pbDisplay(_INTL("Wonder Room wore off, and the Defense and Sp. Def stats returned to normal!"))
  8690. else
  8691. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8692. @battle.field.effects[PBEffects::WonderRoom]=5
  8693. @battle.pbDisplay(_INTL("It created a bizarre area in which the Defense and Sp. Def stats are swapped!"))
  8694. end
  8695. return 0
  8696. end
  8697. end
  8698.  
  8699.  
  8700.  
  8701. ################################################################################
  8702. # Fails unless user has already used all other moves it knows. (Last Resort)
  8703. ################################################################################
  8704. class PokeBattle_Move_125 < PokeBattle_Move
  8705. def pbMoveFailed(attacker,opponent)
  8706. counter=0; nummoves=0
  8707. for move in attacker.moves
  8708. next if move.id<=0
  8709. counter+=1 if move.id!=@id && !attacker.movesUsed.include?(move.id)
  8710. nummoves+=1
  8711. end
  8712. return counter!=0 || nummoves==1
  8713. end
  8714. end
  8715.  
  8716.  
  8717.  
  8718. #===============================================================================
  8719. # NOTE: Shadow moves use function codes 126-132 inclusive.
  8720. #===============================================================================
  8721.  
  8722.  
  8723.  
  8724. ################################################################################
  8725. # Does absolutely nothing. (Hold Hands)
  8726. ################################################################################
  8727. class PokeBattle_Move_133 < PokeBattle_Move
  8728. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8729. if !@battle.doublebattle ||
  8730. !attacker.pbPartner || attacker.pbPartner.fainted?
  8731. @battle.pbDisplay(_INTL("But it failed!"))
  8732. return -1
  8733. end
  8734. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8735. return 0
  8736. end
  8737. end
  8738.  
  8739.  
  8740.  
  8741. ################################################################################
  8742. # Does absolutely nothing. Shows a special message. (Celebrate)
  8743. ################################################################################
  8744. class PokeBattle_Move_134 < PokeBattle_Move
  8745. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8746. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8747. @battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwner(attacker.index).name))
  8748. return 0
  8749. end
  8750. end
  8751.  
  8752.  
  8753.  
  8754. ################################################################################
  8755. # Freezes the target. (Freeze-Dry)
  8756. # (Superclass's pbTypeModifier): Effectiveness against Water-type is 2x.
  8757. ################################################################################
  8758. class PokeBattle_Move_135 < PokeBattle_Move
  8759. def pbAdditionalEffect(attacker,opponent)
  8760. return if opponent.damagestate.substitute
  8761. if opponent.pbCanFreeze?(attacker,false,self)
  8762. opponent.pbFreeze
  8763. end
  8764. end
  8765. end
  8766.  
  8767.  
  8768.  
  8769. ################################################################################
  8770. # Increases the user's Defense by 2 stages for each target hit. (Diamond Storm)
  8771. ################################################################################
  8772. class PokeBattle_Move_136 < PokeBattle_Move_01D
  8773. def pbAdditionalEffect(attacker,opponent)
  8774. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8775. attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  8776. end
  8777. end
  8778. end
  8779.  
  8780.  
  8781.  
  8782. ################################################################################
  8783. # Increases the user's and its ally's Defense and Special Defense by 1 stage
  8784. # each, if they have Plus or Minus. (Magnetic Flux)
  8785. ################################################################################
  8786. class PokeBattle_Move_137 < PokeBattle_Move
  8787. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8788. didsomething=false
  8789. for i in [attacker,attacker.pbPartner]
  8790. next if !i || i.fainted?
  8791. next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)
  8792. next if !i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  8793. !i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8794. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8795. didsomething=true
  8796. showanim=true
  8797. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8798. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8799. showanim=false
  8800. end
  8801. if i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8802. i.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  8803. showanim=false
  8804. end
  8805. end
  8806. if !didsomething
  8807. @battle.pbDisplay(_INTL("But it failed!"))
  8808. return -1
  8809. end
  8810. return 0
  8811. end
  8812. end
  8813.  
  8814.  
  8815.  
  8816. ################################################################################
  8817. # Increases ally's Special Defense by 1 stage. (Aromatic Mist)
  8818. ################################################################################
  8819. class PokeBattle_Move_138 < PokeBattle_Move
  8820. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8821. if !@battle.doublebattle || !opponent ||
  8822. !opponent.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8823. @battle.pbDisplay(_INTL("But it failed!"))
  8824. return -1
  8825. end
  8826. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8827. ret=attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  8828. return ret ? 0 : -1
  8829. end
  8830. end
  8831.  
  8832.  
  8833.  
  8834. ################################################################################
  8835. # Decreases the target's Attack by 1 stage. Always hits. (Play Nice)
  8836. ################################################################################
  8837. class PokeBattle_Move_139 < PokeBattle_Move
  8838. def pbAccuracyCheck(attacker,opponent)
  8839. return true
  8840. end
  8841.  
  8842. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8843. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  8844. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8845. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  8846. return ret ? 0 : -1
  8847. end
  8848. end
  8849.  
  8850.  
  8851.  
  8852. ################################################################################
  8853. # Decreases the target's Attack and Special Attack by 1 stage each. (Noble Roar)
  8854. ################################################################################
  8855. class PokeBattle_Move_13A < PokeBattle_Move
  8856. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8857. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  8858. # multiple times
  8859. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8860. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  8861. return -1
  8862. end
  8863. if opponent.pbTooLow?(PBStats::ATTACK) &&
  8864. opponent.pbTooLow?(PBStats::SPATK)
  8865. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  8866. return -1
  8867. end
  8868. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  8869. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  8870. return -1
  8871. end
  8872. if opponent.hasWorkingAbility(:FULLMETALBODY)
  8873. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  8874. PBAbilities.getName(opponent.ability)))
  8875. return -1
  8876. end
  8877. if !attacker.hasMoldBreaker
  8878. if opponent.hasWorkingAbility(:CLEARBODY) ||
  8879. opponent.hasWorkingAbility(:WHITESMOKE)
  8880. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  8881. PBAbilities.getName(opponent.ability)))
  8882. return -1
  8883. end
  8884. end
  8885. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8886. ret=-1; showanim=true
  8887. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER)
  8888. abilityname=PBAbilities.getName(opponent.ability)
  8889. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  8890. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8891. ret=0; showanim=false
  8892. end
  8893. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8894. ret=0; showanim=false
  8895. end
  8896. return ret
  8897. end
  8898. end
  8899.  
  8900.  
  8901.  
  8902. ################################################################################
  8903. # Decreases the target's Defense by 1 stage. Always hits. (Hyperspace Fury)
  8904. ################################################################################
  8905. class PokeBattle_Move_13B < PokeBattle_Move
  8906. def pbMoveFailed(attacker,opponent)
  8907. return true if !isConst?(attacker.species,PBSpecies,:HOOPA)
  8908. return true if attacker.form!=1
  8909. return false
  8910. end
  8911.  
  8912. def pbAccuracyCheck(attacker,opponent)
  8913. return true
  8914. end
  8915.  
  8916. def pbAdditionalEffect(attacker,opponent)
  8917. return if opponent.damagestate.substitute
  8918. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8919. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  8920. end
  8921. end
  8922. end
  8923.  
  8924.  
  8925.  
  8926. ################################################################################
  8927. # Decreases the target's Special Attack by 1 stage. Always hits. (Confide)
  8928. ################################################################################
  8929. class PokeBattle_Move_13C < PokeBattle_Move
  8930. def pbAccuracyCheck(attacker,opponent)
  8931. return true
  8932. end
  8933.  
  8934. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8935. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8936. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8937. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  8938. return ret ? 0 : -1
  8939. end
  8940. end
  8941.  
  8942.  
  8943.  
  8944. ################################################################################
  8945. # Decreases the target's Special Attack by 2 stages. (Eerie Impulse)
  8946. ################################################################################
  8947. class PokeBattle_Move_13D < PokeBattle_Move
  8948. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8949. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  8950. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8951. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8952. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8953. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8954. return ret ? 0 : -1
  8955. end
  8956.  
  8957. def pbAdditionalEffect(attacker,opponent)
  8958. return if opponent.damagestate.substitute
  8959. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8960. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8961. end
  8962. end
  8963. end
  8964.  
  8965.  
  8966.  
  8967. ################################################################################
  8968. # Increases the Attack and Special Attack of all Grass-type Pokémon on the field
  8969. # by 1 stage each. Doesn't affect airborne Pokémon. (Rototiller)
  8970. ################################################################################
  8971. class PokeBattle_Move_13E < PokeBattle_Move
  8972. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8973. didsomething=false
  8974. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8975. next if !i || i.fainted?
  8976. next if !i.pbHasType?(:GRASS)
  8977. next if i.isAirborne?(attacker.hasMoldBreaker)
  8978. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8979. !i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8980. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8981. didsomething=true
  8982. showanim=true
  8983. if i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8984. i.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8985. showanim=false
  8986. end
  8987. if i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8988. i.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8989. showanim=false
  8990. end
  8991. end
  8992. if !didsomething
  8993. @battle.pbDisplay(_INTL("But it failed!"))
  8994. return -1
  8995. end
  8996. return 0
  8997. end
  8998. end
  8999.  
  9000.  
  9001.  
  9002. ################################################################################
  9003. # Increases the Defense of all Grass-type Pokémon on the field by 1 stage each.
  9004. # (Flower Shield)
  9005. ################################################################################
  9006. class PokeBattle_Move_13F < PokeBattle_Move
  9007. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9008. didsomething=false
  9009. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  9010. next if !i || i.fainted?
  9011. next if !i.pbHasType?(:GRASS)
  9012. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  9013. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  9014. didsomething=true
  9015. showanim=true
  9016. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  9017. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  9018. showanim=false
  9019. end
  9020. end
  9021. if !didsomething
  9022. @battle.pbDisplay(_INTL("But it failed!"))
  9023. return -1
  9024. end
  9025. return 0
  9026. end
  9027. end
  9028.  
  9029.  
  9030.  
  9031. ################################################################################
  9032. # Decreases the Attack, Special Attack and Speed of all poisoned opponents by 1
  9033. # stage each. (Venom Drench)
  9034. ################################################################################
  9035. class PokeBattle_Move_140 < PokeBattle_Move
  9036. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9037. didsomething=false
  9038. for i in [attacker.pbOpposing1,attacker.pbOpposing2]
  9039. next if !i || i.fainted?
  9040. next if !i.status==PBStatuses::POISON
  9041. next if !i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self) &&
  9042. !i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self) &&
  9043. !i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  9044. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  9045. didsomething=true
  9046. showanim=true
  9047. if i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  9048. i.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  9049. showanim=false
  9050. end
  9051. if i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  9052. i.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  9053. showanim=false
  9054. end
  9055. if i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  9056. i.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  9057. showanim=false
  9058. end
  9059. end
  9060. if !didsomething
  9061. @battle.pbDisplay(_INTL("But it failed!"))
  9062. return -1
  9063. end
  9064. return 0
  9065. end
  9066. end
  9067.  
  9068.  
  9069.  
  9070. ################################################################################
  9071. # Reverses all stat changes of the target. (Topsy-Turvy)
  9072. ################################################################################
  9073. class PokeBattle_Move_141 < PokeBattle_Move
  9074. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9075. nonzero=false
  9076. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  9077. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  9078. if opponent.stages[i]!=0
  9079. nonzero=true; break
  9080. end
  9081. end
  9082. if !nonzero
  9083. @battle.pbDisplay(_INTL("But it failed!"))
  9084. return -1
  9085. end
  9086. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9087. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  9088. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  9089. opponent.stages[i]*=-1
  9090. end
  9091. @battle.pbDisplay(_INTL("{1}'s stats were reversed!",opponent.pbThis))
  9092. return 0
  9093. end
  9094. end
  9095.  
  9096.  
  9097.  
  9098. ################################################################################
  9099. # Gives target the Ghost type. (Trick-or-Treat)
  9100. ################################################################################
  9101. class PokeBattle_Move_142 < PokeBattle_Move
  9102. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9103. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  9104. !hasConst?(PBTypes,:GHOST) || opponent.pbHasType?(:GHOST)
  9105. @battle.pbDisplay(_INTL("But it failed!"))
  9106. return -1
  9107. end
  9108. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9109. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GHOST)
  9110. typename=PBTypes.getName(getConst(PBTypes,:GHOST))
  9111. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  9112. return 0
  9113. end
  9114. end
  9115.  
  9116.  
  9117.  
  9118. ################################################################################
  9119. # Gives target the Grass type. (Forest's Curse)
  9120. ################################################################################
  9121. class PokeBattle_Move_143 < PokeBattle_Move
  9122. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9123. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  9124. @battle.pbDisplay(_INTL("But it failed!"))
  9125. return -1
  9126. end
  9127. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  9128. if opponent.effects[PBEffects::LeechSeed]>=0
  9129. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  9130. return -1
  9131. end
  9132. if !hasConst?(PBTypes,:GRASS) || opponent.pbHasType?(:GRASS)
  9133. @battle.pbDisplay(_INTL("But it failed!"))
  9134. return -1
  9135. end
  9136. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9137. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GRASS)
  9138. typename=PBTypes.getName(getConst(PBTypes,:GRASS))
  9139. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  9140. return 0
  9141. end
  9142. end
  9143.  
  9144.  
  9145.  
  9146. ################################################################################
  9147. # Damage is multiplied by Flying's effectiveness against the target. Does double
  9148. # damage and has perfect accuracy if the target is Minimized. (Flying Press)
  9149. ################################################################################
  9150. class PokeBattle_Move_144 < PokeBattle_Move
  9151. def pbModifyDamage(damagemult,attacker,opponent)
  9152. type=getConst(PBTypes,:FLYING) || -1
  9153. if type>=0
  9154. mult=PBTypes.getCombinedEffectiveness(type,
  9155. opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
  9156. return ((damagemult*mult)/8).round
  9157. end
  9158. return damagemult
  9159. end
  9160.  
  9161. def tramplesMinimize?(param=1)
  9162. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  9163. return true if param==2 # Double damage
  9164. return false
  9165. end
  9166. end
  9167.  
  9168.  
  9169.  
  9170. ################################################################################
  9171. # Target's moves become Electric-type for the rest of the round. (Electrify)
  9172. ################################################################################
  9173. class PokeBattle_Move_145 < PokeBattle_Move
  9174. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9175. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  9176. if opponent.effects[PBEffects::Electrify]
  9177. @battle.pbDisplay(_INTL("But it failed!"))
  9178. return -1
  9179. end
  9180. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  9181. !@battle.choices[opponent.index][2] ||
  9182. @battle.choices[opponent.index][2].id<=0 ||
  9183. opponent.hasMovedThisRound?
  9184. @battle.pbDisplay(_INTL("But it failed!"))
  9185. return -1
  9186. end
  9187. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9188. opponent.effects[PBEffects::Electrify]=true
  9189. @battle.pbDisplay(_INTL("{1} was electrified!",opponent.pbThis))
  9190. return 0
  9191. end
  9192. end
  9193.  
  9194.  
  9195.  
  9196. ################################################################################
  9197. # All Normal-type moves become Electric-type for the rest of the round.
  9198. # (Ion Deluge)
  9199. ################################################################################
  9200. class PokeBattle_Move_146 < PokeBattle_Move
  9201. def doesIgnoreDazzling?
  9202. return true
  9203. end
  9204.  
  9205. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9206. unmoved=false
  9207. for poke in @battle.battlers
  9208. next if poke.index==attacker.index
  9209. if @battle.choices[poke.index][0]==1 && # Chose a move
  9210. !poke.hasMovedThisRound?
  9211. unmoved=true; break
  9212. end
  9213. end
  9214. if !unmoved || @battle.field.effects[PBEffects::IonDeluge]
  9215. @battle.pbDisplay(_INTL("But it failed!"))
  9216. return -1
  9217. end
  9218. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9219. @battle.field.effects[PBEffects::IonDeluge]=true
  9220. @battle.pbDisplay(_INTL("The Ion Deluge started!"))
  9221. return 0
  9222. end
  9223. end
  9224.  
  9225.  
  9226.  
  9227. ################################################################################
  9228. # Always hits. (Hyperspace Hole)
  9229. # TODO: Hits through various shields.
  9230. ################################################################################
  9231. class PokeBattle_Move_147 < PokeBattle_Move
  9232. def pbAccuracyCheck(attacker,opponent)
  9233. return true
  9234. end
  9235. end
  9236.  
  9237.  
  9238. ################################################################################
  9239. # Powders the foe. This round, if it uses a Fire move, it loses 1/4 of its max
  9240. # HP instead. (Powder)
  9241. ################################################################################
  9242. class PokeBattle_Move_148 < PokeBattle_Move
  9243. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9244. if opponent.effects[PBEffects::Powder]
  9245. @battle.pbDisplay(_INTL("But it failed!"))
  9246. return -1
  9247. end
  9248. opponent.effects[PBEffects::Powder]=true
  9249. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9250. @battle.pbDisplay(_INTL("{1} is covered in powder!",opponent.pbThis))
  9251. return 0
  9252. end
  9253. end
  9254.  
  9255.  
  9256.  
  9257. ################################################################################
  9258. # This round, the user's side is unaffected by damaging moves. (Mat Block)
  9259. ################################################################################
  9260. class PokeBattle_Move_149 < PokeBattle_Move
  9261. def pbMoveFailed(attacker,opponent)
  9262. return (attacker.turncount>1)
  9263. end
  9264.  
  9265. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9266. attacker.pbOwnSide.effects[PBEffects::MatBlock]=true
  9267. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9268. @battle.pbDisplay(_INTL("{1} intends to flip up a mat and block incoming attacks!",attacker.pbThis))
  9269. return 0
  9270. end
  9271. end
  9272.  
  9273.  
  9274.  
  9275. ################################################################################
  9276. # User's side is protected against status moves this round. (Crafty Shield)
  9277. ################################################################################
  9278. class PokeBattle_Move_14A < PokeBattle_Move
  9279. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9280. if attacker.pbOwnSide.effects[PBEffects::CraftyShield]
  9281. @battle.pbDisplay(_INTL("But it failed!"))
  9282. return -1
  9283. end
  9284. unmoved=false
  9285. for poke in @battle.battlers
  9286. next if poke.index==attacker.index
  9287. if @battle.choices[poke.index][0]==1 && # Chose a move
  9288. !poke.hasMovedThisRound?
  9289. unmoved=true; break
  9290. end
  9291. end
  9292. if !unmoved
  9293. @battle.pbDisplay(_INTL("But it failed!"))
  9294. return -1
  9295. end
  9296. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9297. attacker.pbOwnSide.effects[PBEffects::CraftyShield]=true
  9298. if !@battle.pbIsOpposing?(attacker.index)
  9299. @battle.pbDisplay(_INTL("Crafty Shield protected your team!"))
  9300. else
  9301. @battle.pbDisplay(_INTL("Crafty Shield protected the opposing team!"))
  9302. end
  9303. return 0
  9304. end
  9305. end
  9306.  
  9307.  
  9308.  
  9309. ################################################################################
  9310. # User is protected against damaging moves this round. Decreases the Attack of
  9311. # the user of a stopped contact move by 2 stages. (King's Shield)
  9312. ################################################################################
  9313. class PokeBattle_Move_14B < PokeBattle_Move
  9314. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9315. if attacker.effects[PBEffects::KingsShield]
  9316. @battle.pbDisplay(_INTL("But it failed!"))
  9317. return -1
  9318. end
  9319. ratesharers=[
  9320. 0xAA, # Detect, Protect
  9321. 0xAB, # Quick Guard
  9322. 0xAC, # Wide Guard
  9323. 0xE8, # Endure
  9324. 0x14B, # King's Shield
  9325. 0x14C # Spiky Shield
  9326. ]
  9327. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9328. attacker.effects[PBEffects::ProtectRate]=1
  9329. end
  9330. unmoved=false
  9331. for poke in @battle.battlers
  9332. next if poke.index==attacker.index
  9333. if @battle.choices[poke.index][0]==1 && # Chose a move
  9334. !poke.hasMovedThisRound?
  9335. unmoved=true; break
  9336. end
  9337. end
  9338. if !unmoved ||
  9339. (!USENEWBATTLEMECHANICS &&
  9340. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  9341. attacker.effects[PBEffects::ProtectRate]=1
  9342. @battle.pbDisplay(_INTL("But it failed!"))
  9343. return -1
  9344. end
  9345. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9346. attacker.effects[PBEffects::KingsShield]=true
  9347. attacker.effects[PBEffects::ProtectRate]*=2
  9348. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9349. return 0
  9350. end
  9351. end
  9352.  
  9353.  
  9354.  
  9355. ################################################################################
  9356. # User is protected against moves that target it this round. Damages the user of
  9357. # a stopped contact move by 1/8 of its max HP. (Spiky Shield)
  9358. ################################################################################
  9359. class PokeBattle_Move_14C < PokeBattle_Move
  9360. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9361. if attacker.effects[PBEffects::SpikyShield]
  9362. @battle.pbDisplay(_INTL("But it failed!"))
  9363. return -1
  9364. end
  9365. ratesharers=[
  9366. 0xAA, # Detect, Protect
  9367. 0xAB, # Quick Guard
  9368. 0xAC, # Wide Guard
  9369. 0xE8, # Endure
  9370. 0x14B, # King's Shield
  9371. 0x14C # Spiky Shield
  9372. ]
  9373. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9374. attacker.effects[PBEffects::ProtectRate]=1
  9375. end
  9376. unmoved=false
  9377. for poke in @battle.battlers
  9378. next if poke.index==attacker.index
  9379. if @battle.choices[poke.index][0]==1 && # Chose a move
  9380. !poke.hasMovedThisRound?
  9381. unmoved=true; break
  9382. end
  9383. end
  9384. if !unmoved ||
  9385. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  9386. attacker.effects[PBEffects::ProtectRate]=1
  9387. @battle.pbDisplay(_INTL("But it failed!"))
  9388. return -1
  9389. end
  9390. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9391. attacker.effects[PBEffects::SpikyShield]=true
  9392. attacker.effects[PBEffects::ProtectRate]*=2
  9393. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9394. return 0
  9395. end
  9396. end
  9397.  
  9398.  
  9399.  
  9400. ################################################################################
  9401. # Two turn attack. Skips first turn, attacks second turn. (Phantom Force)
  9402. # Is invulnerable during use.
  9403. # Ignores target's Detect, King's Shield, Mat Block, Protect, Spiky Shield and
  9404. # Baneful Bunker this round. If successful, negates them this round.
  9405. # Does double damage and has perfect accuracy if the target is Minimized.
  9406. ################################################################################
  9407. class PokeBattle_Move_14D < PokeBattle_Move
  9408. def pbTwoTurnAttack(attacker)
  9409. @immediate=false
  9410. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9411. @immediate=true
  9412. end
  9413. return false if @immediate
  9414. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9415. end
  9416.  
  9417. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9418. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9419. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9420. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  9421. end
  9422. if @immediate
  9423. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9424. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9425. attacker.pbConsumeItem
  9426. end
  9427. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9428. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9429. if ret>0
  9430. opponent.effects[PBEffects::ProtectNegation]=true
  9431. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  9432. end
  9433. return ret
  9434. end
  9435.  
  9436. def tramplesMinimize?(param=1)
  9437. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  9438. return true if param==2 # Double damage
  9439. return false
  9440. end
  9441. end
  9442.  
  9443.  
  9444.  
  9445. ################################################################################
  9446. # Two turn attack. Skips first turn, increases the user's Special Attack,
  9447. # Special Defense and Speed by 2 stages each second turn. (Geomancy)
  9448. ################################################################################
  9449. class PokeBattle_Move_14E < PokeBattle_Move
  9450. def pbTwoTurnAttack(attacker)
  9451. @immediate=false
  9452. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9453. @immediate=true
  9454. end
  9455. return false if @immediate
  9456. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9457. end
  9458.  
  9459. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9460. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9461. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9462. @battle.pbDisplay(_INTL("{1} is absorbing power!",attacker.pbThis))
  9463. end
  9464. if @immediate
  9465. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9466. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9467. attacker.pbConsumeItem
  9468. end
  9469. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9470. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  9471. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  9472. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9473. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  9474. return -1
  9475. end
  9476. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9477. showanim=true
  9478. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  9479. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  9480. showanim=false
  9481. end
  9482. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  9483. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self,showanim)
  9484. showanim=false
  9485. end
  9486. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9487. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  9488. showanim=false
  9489. end
  9490. return 0
  9491. end
  9492. end
  9493.  
  9494.  
  9495.  
  9496. ################################################################################
  9497. # User gains 3/4 the HP it inflicts as damage. (Draining Kiss, Oblivion Wing)
  9498. ################################################################################
  9499. class PokeBattle_Move_14F < PokeBattle_Move
  9500. def isHealingMove?
  9501. return USENEWBATTLEMECHANICS
  9502. end
  9503.  
  9504. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9505. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9506. if opponent.damagestate.calcdamage>0
  9507. hpgain=(opponent.damagestate.hplost*3/4).round
  9508. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  9509. attacker.pbReduceHP(hpgain,true)
  9510. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  9511. elsif attacker.effects[PBEffects::HealBlock]==0
  9512. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  9513. attacker.pbRecoverHP(hpgain,true)
  9514. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  9515. end
  9516. end
  9517. return ret
  9518. end
  9519. end
  9520.  
  9521.  
  9522.  
  9523. ################################################################################
  9524. # If this move KO's the target, increases the user's Attack by 3 stages.
  9525. # (Fell Stinger)
  9526. ################################################################################
  9527. class PokeBattle_Move_150 < PokeBattle_Move
  9528. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9529. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9530. if opponent.damagestate.calcdamage>0 && opponent.fainted?
  9531. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  9532. attacker.pbIncreaseStat(PBStats::ATTACK,3,attacker,false,self)
  9533. end
  9534. end
  9535. return ret
  9536. end
  9537. end
  9538.  
  9539.  
  9540.  
  9541. ################################################################################
  9542. # Decreases the target's Attack and Special Attack by 1 stage each. Then, user
  9543. # switches out. Ignores trapping moves. (Parting Shot)
  9544. # TODO: Pursuit should interrupt this move.
  9545. ################################################################################
  9546. class PokeBattle_Move_151 < PokeBattle_Move
  9547. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9548. ret=-1
  9549. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9550. if !self.isSoundBased? ||
  9551. attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SOUNDPROOF)
  9552. showanim=true
  9553. if opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  9554. showanim=false; ret=0
  9555. end
  9556. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  9557. showanim=false; ret=0
  9558. end
  9559. end
  9560. if !attacker.fainted? &&
  9561. @battle.pbCanChooseNonActive?(attacker.index) &&
  9562. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  9563. attacker.effects[PBEffects::Uturn]=true; ret=0
  9564. end
  9565. return ret
  9566. end
  9567. end
  9568.  
  9569.  
  9570.  
  9571. ################################################################################
  9572. # No Pokémon can switch out or flee until the end of the next round, as long as
  9573. # the user remains active. (Fairy Lock)
  9574. ################################################################################
  9575. class PokeBattle_Move_152 < PokeBattle_Move
  9576. def doesIgnoreDazzling?
  9577. return true
  9578. end
  9579.  
  9580. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9581. if @battle.field.effects[PBEffects::FairyLock]>0
  9582. @battle.pbDisplay(_INTL("But it failed!"))
  9583. return -1
  9584. end
  9585. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9586. @battle.field.effects[PBEffects::FairyLock]=2
  9587. @battle.pbDisplay(_INTL("No one will be able to run away during the next turn!"))
  9588. return 0
  9589. end
  9590. end
  9591.  
  9592.  
  9593.  
  9594. ################################################################################
  9595. # Entry hazard. Lays stealth rocks on the opposing side. (Sticky Web)
  9596. ################################################################################
  9597. class PokeBattle_Move_153 < PokeBattle_Move
  9598. def doesIgnoreDazzling?
  9599. return true
  9600. end
  9601.  
  9602. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9603. if attacker.pbOpposingSide.effects[PBEffects::StickyWeb]
  9604. @battle.pbDisplay(_INTL("But it failed!"))
  9605. return -1
  9606. end
  9607. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9608. attacker.pbOpposingSide.effects[PBEffects::StickyWeb]=true
  9609. if !@battle.pbIsOpposing?(attacker.index)
  9610. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath the opposing team's feet!"))
  9611. else
  9612. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath your team's feet!"))
  9613. end
  9614. return 0
  9615. end
  9616. end
  9617.  
  9618.  
  9619.  
  9620. ################################################################################
  9621. # For 5 rounds, creates an electric terrain which boosts Electric-type moves and
  9622. # prevents Pokémon from falling asleep. Affects non-airborne Pokémon only.
  9623. # (Electric Terrain)
  9624. ################################################################################
  9625. class PokeBattle_Move_154 < PokeBattle_Move
  9626. def doesIgnoreDazzling?
  9627. return true
  9628. end
  9629.  
  9630. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9631. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  9632. @battle.pbDisplay(_INTL("But it failed!"))
  9633. return -1
  9634. end
  9635. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9636. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9637. @battle.field.effects[PBEffects::MistyTerrain]=0
  9638. @battle.field.effects[PBEffects::PsychicTerrain]=0
  9639. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9640. @battle.field.effects[PBEffects::ElectricTerrain]=8
  9641. else
  9642. @battle.field.effects[PBEffects::ElectricTerrain]=5
  9643. end
  9644. @battle.pbDisplay(_INTL("An electric current runs across the battlefield!"))
  9645. return 0
  9646. end
  9647. end
  9648.  
  9649.  
  9650.  
  9651. ################################################################################
  9652. # For 5 rounds, creates a grassy terrain which boosts Grass-type moves and heals
  9653. # Pokémon at the end of each round. Affects non-airborne Pokémon only.
  9654. # (Grassy Terrain)
  9655. ################################################################################
  9656. class PokeBattle_Move_155 < PokeBattle_Move
  9657. def isHealingMove?
  9658. return true
  9659. end
  9660.  
  9661. def doesIgnoreDazzling?
  9662. return true
  9663. end
  9664.  
  9665. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9666. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  9667. @battle.pbDisplay(_INTL("But it failed!"))
  9668. return -1
  9669. end
  9670. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9671. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9672. @battle.field.effects[PBEffects::MistyTerrain]=0
  9673. @battle.field.effects[PBEffects::PsychicTerrain]=0
  9674. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9675. @battle.field.effects[PBEffects::GrassyTerrain]=8
  9676. else
  9677. @battle.field.effects[PBEffects::GrassyTerrain]=5
  9678. end
  9679. @battle.pbDisplay(_INTL("Grass grew to cover the battlefield!"))
  9680. return 0
  9681. end
  9682. end
  9683.  
  9684.  
  9685.  
  9686. ################################################################################
  9687. # For 5 rounds, creates a misty terrain which weakens Dragon-type moves and
  9688. # protects Pokémon from status problems. Affects non-airborne Pokémon only.
  9689. # (Misty Terrain)
  9690. ################################################################################
  9691. class PokeBattle_Move_156 < PokeBattle_Move
  9692. def doesIgnoreDazzling?
  9693. return true
  9694. end
  9695.  
  9696. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9697. if @battle.field.effects[PBEffects::MistyTerrain]>0
  9698. @battle.pbDisplay(_INTL("But it failed!"))
  9699. return -1
  9700. end
  9701. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9702. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9703. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9704. @battle.field.effects[PBEffects::PsychicTerrain]=0
  9705. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9706. @battle.field.effects[PBEffects::MistyTerrain]=8
  9707. else
  9708. @battle.field.effects[PBEffects::MistyTerrain]=5
  9709. end
  9710. @battle.pbDisplay(_INTL("Mist swirled about the battlefield!"))
  9711. return 0
  9712. end
  9713. end
  9714.  
  9715.  
  9716.  
  9717. ################################################################################
  9718. # Doubles the prize money the player gets after winning the battle. (Happy Hour)
  9719. ################################################################################
  9720. class PokeBattle_Move_157 < PokeBattle_Move
  9721. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9722. if @battle.pbIsOpposing?(attacker.index) || @battle.doublemoney
  9723. @battle.pbDisplay(_INTL("But it failed!"))
  9724. return -1
  9725. end
  9726. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9727. @battle.doublemoney=true
  9728. @battle.pbDisplay(_INTL("Everyone is caught up in the happy atmosphere!"))
  9729. return 0
  9730. end
  9731. end
  9732.  
  9733.  
  9734.  
  9735. ################################################################################
  9736. # Fails unless user has consumed a berry at some point. (Belch)
  9737. ################################################################################
  9738. class PokeBattle_Move_158 < PokeBattle_Move
  9739. def pbMoveFailed(attacker,opponent)
  9740. return !attacker.pokemon || !attacker.pokemon.belch
  9741. end
  9742. end
  9743.  
  9744.  
  9745.  
  9746. ################################################################################
  9747. # The user's type determines the type of this move. (Revelation Dance)
  9748. ################################################################################
  9749. class PokeBattle_Move_159 < PokeBattle_Move
  9750. def isDanceMove?
  9751. return true
  9752. end
  9753.  
  9754. def pbModifyType(type,attacker,opponent)
  9755. type=getConst(PBTypes,:NORMAL) || 0
  9756. if isConst?(@id,PBMoves,:REVELATIONDANCE)
  9757. type=(getConst(PBTypes,:FIGHTING) || 0) if attacker.pbHasPrimaryType?(:FIGHTING)
  9758. type=(getConst(PBTypes,:FLYING) || 0) if attacker.pbHasPrimaryType?(:FLYING)
  9759. type=(getConst(PBTypes,:POISON) || 0) if attacker.pbHasPrimaryType?(:POISON)
  9760. type=(getConst(PBTypes,:GROUND) || 0) if attacker.pbHasPrimaryType?(:GROUND)
  9761. type=(getConst(PBTypes,:ROCK) || 0) if attacker.pbHasPrimaryType?(:ROCK)
  9762. type=(getConst(PBTypes,:BUG) || 0) if attacker.pbHasPrimaryType?(:BUG)
  9763. type=(getConst(PBTypes,:GHOST) || 0) if attacker.pbHasPrimaryType?(:GHOST)
  9764. type=(getConst(PBTypes,:STEEL) || 0) if attacker.pbHasPrimaryType?(:STEEL)
  9765. type=(getConst(PBTypes,:FIRE) || 0) if attacker.pbHasPrimaryType?(:FIRE)
  9766. type=(getConst(PBTypes,:WATER) || 0) if attacker.pbHasPrimaryType?(:WATER)
  9767. type=(getConst(PBTypes,:GRASS) || 0) if attacker.pbHasPrimaryType?(:GRASS)
  9768. type=(getConst(PBTypes,:ELECTRIC) || 0) if attacker.pbHasPrimaryType?(:ELECTRIC)
  9769. type=(getConst(PBTypes,:PSYCHIC) || 0) if attacker.pbHasPrimaryType?(:PSYCHIC)
  9770. type=(getConst(PBTypes,:ICE) || 0) if attacker.pbHasPrimaryType?(:ICE)
  9771. type=(getConst(PBTypes,:DRAGON) || 0) if attacker.pbHasPrimaryType?(:DRAGON)
  9772. type=(getConst(PBTypes,:DARK) || 0) if attacker.pbHasPrimaryType?(:DARK)
  9773. type=(getConst(PBTypes,:FAIRY) || 0) if attacker.pbHasPrimaryType?(:FAIRY)
  9774. end
  9775. return type
  9776. end
  9777. end
  9778.  
  9779.  
  9780.  
  9781. ################################################################################
  9782. # For 5 rounds, creates a psychic terrain which boosts Psychic-type moves and
  9783. # protects Pokémon from priority moves. Affects non-airborne Pokémon only.
  9784. # (Psychic Terrain)
  9785. ################################################################################
  9786. class PokeBattle_Move_15A < PokeBattle_Move
  9787. def doesIgnoreDazzling?
  9788. return true
  9789. end
  9790.  
  9791. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9792. if @battle.field.effects[PBEffects::PsychicTerrain]>0
  9793. @battle.pbDisplay(_INTL("But it failed!"))
  9794. return -1
  9795. end
  9796. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9797. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9798. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9799. @battle.field.effects[PBEffects::MistyTerrain]=0
  9800. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9801. @battle.field.effects[PBEffects::PsychicTerrain]=8
  9802. else
  9803. @battle.field.effects[PBEffects::PsychicTerrain]=5
  9804. end
  9805. @battle.pbDisplay(_INTL("A psychic terrain was summoned!"))
  9806. return 0
  9807. end
  9808. end
  9809.  
  9810.  
  9811.  
  9812. ################################################################################
  9813. # Hits 2-5 times. Greninja-Ash always hit thrice and with increased base damage.
  9814. # (Water Shuriken)
  9815. ################################################################################
  9816. class PokeBattle_Move_15B < PokeBattle_Move
  9817. def pbIsMultiHit
  9818. return true
  9819. end
  9820.  
  9821. def pbBaseDamage(basedmg,attacker,opponent)
  9822. basedmg=20 if attacker.hasWorkingAbility(:BATTLEBOND) &&
  9823. isConst?(attacker.species,PBSpecies,:GRENINJA) &&
  9824. attacker.form==1
  9825. return basedmg
  9826. end
  9827.  
  9828. def pbNumHits(attacker)
  9829. hitchances=[2,2,3,3,4,5]
  9830. ret=hitchances[@battle.pbRandom(hitchances.length)]
  9831. ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  9832. ret=3 if attacker.hasWorkingAbility(:BATTLEBOND) &&
  9833. isConst?(attacker.species,PBSpecies,:GRENINJA) &&
  9834. attacker.form==1
  9835. return ret
  9836. end
  9837. end
  9838.  
  9839.  
  9840.  
  9841. ################################################################################
  9842. # Charges its beak and attacks second turn. (Beak Blast)
  9843. ################################################################################
  9844. class PokeBattle_Move_15C < PokeBattle_Move
  9845. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9846. if !opponent
  9847. @battle.pbDisplay(_INTL("But it failed."))
  9848. return -1
  9849. end
  9850. return super(attacker,opponent,hitnum,alltargets,showanimation)
  9851. end
  9852. end
  9853.  
  9854.  
  9855.  
  9856. ################################################################################
  9857. # The user loses its fire-type after this move. (Burn Up)
  9858. ################################################################################
  9859. class PokeBattle_Move_15D < PokeBattle_Move
  9860. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9861. if !isConst?(attacker.type1,PBTypes,:FIRE) && !isConst?(attacker.type2,PBTypes,:FIRE)
  9862. @battle.pbDisplay(_INTL("But it failed!"))
  9863. return -1
  9864. end
  9865. attacker.status=0 if isConst?(attacker.status,PBStatuses,:FROZEN)
  9866. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation)
  9867. attacker.effects[PBEffects::BurnUp]=true
  9868. @battle.pbDisplay(_INTL("{1} gave up all his fire!",attacker.pbThis))
  9869. return ret
  9870. end
  9871. end
  9872.  
  9873.  
  9874.  
  9875. ################################################################################
  9876. # The user rubs the scales on its entire body and makes a huge noise to attack.
  9877. # The user's Defense is lowered. (Clanging Scales)
  9878. ################################################################################
  9879. class PokeBattle_Move_15E < PokeBattle_Move
  9880. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9881. situation=false
  9882. situation=true if !opponent.pbPartner.fainted? && !opponent.fainted? &&
  9883. @battle.doublebattle &&
  9884. !PBTypes.isIneffective?(@type,opponent.type1,
  9885. opponent.type2) &&
  9886. !PBTypes.isIneffective?(@type,opponent.pbPartner.type1,
  9887. opponent.pbPartner.type2)
  9888. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9889. if opponent.damagestate.calcdamage>0
  9890. showanim=true
  9891. if !situation
  9892. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  9893. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  9894. showanim=false
  9895. end
  9896. else
  9897. attacker.effects[PBEffects::ClangingScales]+=1
  9898. end
  9899. elsif attacker.effects[PBEffects::ClangingScales]==1
  9900. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  9901. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  9902. showanim=false
  9903. end
  9904. elsif attacker.effects[PBEffects::ClangingScales]==0
  9905. attacker.effects[PBEffects::ClangingScales]=1.5
  9906. end
  9907. if attacker.effects[PBEffects::ClangingScales]>=2
  9908. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  9909. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  9910. showanim=false
  9911. end
  9912. end
  9913. return ret
  9914. end
  9915. end
  9916.  
  9917.  
  9918.  
  9919. ################################################################################
  9920. # A powerful beam representing Zygarde is shot at the opponent. Supresses
  9921. # opponent´s ability. (Core Enforcer)
  9922. ################################################################################
  9923. class PokeBattle_Move_15F < PokeBattle_Move
  9924. def pbAdditionalEffect(attacker,opponent)
  9925. return if opponent.damagestate.substitute
  9926. if opponent.hasMovedThisRound? || @battle.choices[opponent.index][0]==3
  9927. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  9928. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  9929. isConst?(opponent.ability,PBAbilities,:DISGUISE) ||
  9930. isConst?(opponent.ability,PBAbilities,:COMATOSE) ||
  9931. isConst?(opponent.ability,PBAbilities,:BATTLEBOND) ||
  9932. isConst?(opponent.ability,PBAbilities,:POWERCONSTRUCT) ||
  9933. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  9934. isConst?(opponent.ability,PBAbilities,:SCHOOLING) ||
  9935. isConst?(opponent.ability,PBAbilities,:SHIELDSDOWN)
  9936. return
  9937. end
  9938. opponent.effects[PBEffects::GastroAcid]=true
  9939. opponent.effects[PBEffects::Truant]=false
  9940. @battle.pbDisplay(_INTL("{1}'s ability was suppressed!",opponent.pbThis))
  9941. end
  9942. end
  9943. end
  9944.  
  9945.  
  9946.  
  9947. ################################################################################
  9948. # Although this move has great power, it only works the first turn the user is
  9949. # in battle. (First Impression)
  9950. ################################################################################
  9951. class PokeBattle_Move_160 < PokeBattle_Move
  9952. def pbMoveFailed(attacker,opponent)
  9953. return (attacker.turncount>1)
  9954. end
  9955. end
  9956.  
  9957.  
  9958.  
  9959. ################################################################################
  9960. # The user restores the target's HP by up to half of its max HP. It
  9961. # restores more during Grassy Terrain. (Floral Healing)
  9962. ################################################################################
  9963. class PokeBattle_Move_161 < PokeBattle_Move
  9964. def isHealingMove?
  9965. return true
  9966. end
  9967.  
  9968. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9969. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  9970. @battle.pbDisplay(_INTL("But it failed!"))
  9971. return -1
  9972. end
  9973. if opponent.hp==opponent.totalhp
  9974. @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
  9975. return -1
  9976. end
  9977. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9978. hpgain=((opponent.totalhp+1)/2).floor
  9979. hpgain=(opponent.totalhp*2/3).round if @battle.field.effects[PBEffects::GrassyTerrain]>0
  9980. opponent.pbRecoverHP(hpgain,true)
  9981. @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
  9982. return 0
  9983. end
  9984. end
  9985.  
  9986.  
  9987.  
  9988. ################################################################################
  9989. # The user engages its gears to raise the Attack and Special Attack of an ally.
  9990. # (Gear Up)
  9991. ################################################################################
  9992. class PokeBattle_Move_162 < PokeBattle_Move
  9993. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9994. didsomething=false
  9995. for i in [attacker,attacker.pbPartner]
  9996. next if !i || i.fainted?
  9997. next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)
  9998. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  9999. !i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  10000. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  10001. didsomething=true
  10002. showanim=true
  10003. if i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  10004. i.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  10005. showanim=false
  10006. end
  10007. if i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  10008. i.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  10009. showanim=false
  10010. end
  10011. end
  10012. if !didsomething
  10013. @battle.pbDisplay(_INTL("But it failed!"))
  10014. return -1
  10015. end
  10016. return 0
  10017. end
  10018. end
  10019.  
  10020.  
  10021.  
  10022. ################################################################################
  10023. # The user instructs the target to use its last move again. (Instruct)
  10024. ################################################################################
  10025. class PokeBattle_Move_163 < PokeBattle_Move
  10026. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10027. if !opponent.damagestate.substitute &&
  10028. !opponent.effects[PBEffects::Bide] &&
  10029. !opponent.effects[PBEffects::Outrage]
  10030. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  10031. opponent.effects[PBEffects::Instruct]=true
  10032. else
  10033. @battle.pbDisplay(_INTL("But it failed!"))
  10034. return -1
  10035. end
  10036. return 0
  10037. end
  10038. end
  10039.  
  10040.  
  10041.  
  10042. ################################################################################
  10043. # The user's next move will be a critical hit. (Laser Focus)
  10044. ################################################################################
  10045. class PokeBattle_Move_164 < PokeBattle_Move
  10046. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10047. attacker.effects[PBEffects::LaserFocus]=true
  10048. @battle.pbDisplay(_INTL("{1} began focusing hard!",attacker.pbThis))
  10049. return 0
  10050. end
  10051. end
  10052.  
  10053.  
  10054.  
  10055. ################################################################################
  10056. # The user attacks the enemy with a pollen puff that explodes. (Pollen Puff)
  10057. ################################################################################
  10058. class PokeBattle_Move_165 < PokeBattle_Move
  10059. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10060. if attacker.pbPartner != nil
  10061. if attacker.pbPartner == opponent
  10062. life=(opponent.totalhp/2).floor
  10063. opponent.pbRecoverHP(life,true)
  10064. return 0
  10065. end
  10066. end
  10067. return super(attacker,opponent,hitnum,alltargets,showanimation)
  10068. end
  10069. end
  10070.  
  10071.  
  10072.  
  10073. ################################################################################
  10074. # Heals the target's Status condition and heals the user by 50%. (Purify)
  10075. ################################################################################
  10076. class PokeBattle_Move_166 < PokeBattle_Move
  10077. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=false)
  10078. if opponent.status!=PBStatuses::BURN &&
  10079. opponent.status!=PBStatuses::POISON &&
  10080. opponent.status!=PBStatuses::PARALYSIS &&
  10081. opponent.status!=PBStatuses::SLEEP &&
  10082. opponent.status!=PBStatuses::FROZEN
  10083. @battle.pbDisplay(_INTL("But it failed!"))
  10084. return -1
  10085. else
  10086. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  10087. t=opponent.status
  10088. opponent.pbCureStatus(false)
  10089. if t==PBStatuses::BURN
  10090. @battle.pbDisplay(_INTL("{1}'s Purify cured {2}'s burn!",attacker.pbThis,opponent.pbThis))
  10091. elsif t==PBStatuses::POISON
  10092. @battle.pbDisplay(_INTL("{1}'s Purify cured {2}'s poison!",attacker.pbThis,opponent.pbThis))
  10093. elsif t==PBStatuses::PARALYSIS
  10094. @battle.pbDisplay(_INTL("{1}'s Purify cured {2}'s paralysis",attacker.pbThis,opponent.pbThis))
  10095. elsif t==PBStatuses::SLEEP
  10096. @battle.pbDisplay(_INTL("{1}'s Purify woke {2} up!",attacker.pbThis,opponent.pbThis))
  10097. elsif t==PBStatuses::FROZEN
  10098. @battle.pbDisplay(_INTL("{1}'s Purify thawed {2} out!",attacker.pbThis,opponent.pbThis))
  10099. end
  10100. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  10101. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  10102. return 0
  10103. end
  10104. end
  10105. end
  10106.  
  10107.  
  10108.  
  10109. ################################################################################
  10110. # The user regains up to half of its max HP. It restores more HP in a sandstorm.
  10111. # (Shore Up)
  10112. ################################################################################
  10113. class PokeBattle_Move_167 < PokeBattle_Move
  10114. def isHealingMove?
  10115. return true
  10116. end
  10117.  
  10118. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10119. if attacker.hp==attacker.totalhp
  10120. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  10121. return -1
  10122. end
  10123. hpgain=0
  10124. if @battle.pbWeather==PBWeather::SANDSTORM
  10125. hpgain=(attacker.totalhp*2/3).floor
  10126. else
  10127. hpgain=(attacker.totalhp/2).floor
  10128. end
  10129. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  10130. attacker.pbRecoverHP(hpgain,true)
  10131. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  10132. return 0
  10133. end
  10134. end
  10135.  
  10136.  
  10137.  
  10138. ################################################################################
  10139. # Inflicts damage to the target. If the target is burned, the burn is healed.
  10140. # (Sparkling Aria)
  10141. ################################################################################
  10142. class PokeBattle_Move_168 < PokeBattle_Move
  10143. def pbEffectAfterHit(attacker,opponent,turneffects)
  10144. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  10145. opponent.status==PBStatuses::BURN
  10146. opponent.pbCureStatus
  10147. end
  10148. end
  10149. end
  10150.  
  10151.  
  10152.  
  10153. ################################################################################
  10154. # Copies the opponent's stat changes and then resets it. After this, it will
  10155. # Attack. (Spectral Thief)
  10156. ################################################################################
  10157. class PokeBattle_Move_169 < PokeBattle_Move
  10158. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10159. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  10160. @battle.pbDisplay(_INTL("But it failed!"))
  10161. return -1
  10162. end
  10163. att=false
  10164. deff=false
  10165. spa=false
  10166. spd=false
  10167. spe=false
  10168. acc=false
  10169. eva=false
  10170. if opponent.stages[PBStats::ATTACK]>0 &&
  10171. attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  10172. att=true
  10173. end
  10174. if opponent.stages[PBStats::DEFENSE]>0 &&
  10175. attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  10176. deff=true
  10177. end
  10178. if opponent.stages[PBStats::SPATK]>0 &&
  10179. attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  10180. spa=true
  10181. end
  10182. if opponent.stages[PBStats::SPDEF]>0 &&
  10183. attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  10184. spd=true
  10185. end
  10186. if opponent.stages[PBStats::SPEED]>0 &&
  10187. attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  10188. spe=true
  10189. end
  10190. if opponent.stages[PBStats::ACCURACY]>0 &&
  10191. attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  10192. acc=true
  10193. end
  10194. if opponent.stages[PBStats::EVASION]>0 &&
  10195. attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  10196. eva=true
  10197. end
  10198.  
  10199. if atk || deff || spa || spd || spe || acc || eva
  10200. @battle.pbDisplay(_INTL("{1} stole {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  10201. end
  10202. if atk
  10203. attacker.pbIncreaseStat(PBStats::ATTACK,opponent.stages[PBStats::ATTACK],attacker,false,self)
  10204. opponent.stages[PBStats::ATTACK]=0
  10205. end
  10206. if deff
  10207. attacker.pbIncreaseStat(PBStats::DEFENSE,opponent.stages[PBStats::DEFENSE],attacker,false,self)
  10208. opponent.stages[PBStats::DEFENSE]=0
  10209. end
  10210. if spa
  10211. attacker.pbIncreaseStat(PBStats::SPATK,opponent.stages[PBStats::SPATK],attacker,false,self)
  10212. opponent.stages[PBStats::SPATK]=0
  10213. end
  10214. if spd
  10215. attacker.pbIncreaseStat(PBStats::SPDEF,opponent.stages[PBStats::SPDEF],attacker,false,self)
  10216. opponent.stages[PBStats::SPDEF]=0
  10217. end
  10218. if spd
  10219. attacker.pbIncreaseStat(PBStats::SPEED,opponent.stages[PBStats::SPEED],attacker,false,self)
  10220. opponent.stages[PBStats::SPEED]=0
  10221. end
  10222. if acc
  10223. attacker.pbIncreaseStat(PBStats::ACCURACY,opponent.stages[PBStats::ACCURACY],attacker,false,self)
  10224. opponent.stages[PBStats::ACCURACY]=0
  10225. end
  10226. if eva
  10227. attacker.pbIncreaseStat(PBStats::EVASION,opponent.stages[PBStats::EVASION],attacker,false,self)
  10228. opponent.stages[PBStats::EVASION]=0
  10229. end
  10230. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  10231. return ret
  10232. end
  10233. end
  10234.  
  10235.  
  10236.  
  10237. ################################################################################
  10238. # User and target swap their Speed stats. (Speed Swap)
  10239. ################################################################################
  10240. class PokeBattle_Move_16A < PokeBattle_Move
  10241. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10242. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  10243. attacker.speed,opponent.speed=opponent.speed,attacker.speed
  10244. @battle.pbDisplay(_INTL("{1} and {2} switched their Speed stats!",attacker.pbThis,opponent.pbThis))
  10245. return 0
  10246. end
  10247. end
  10248.  
  10249.  
  10250.  
  10251. ################################################################################
  10252. # Deals damage and makes the target unable to switch out. (Spirit Shackle)
  10253. ################################################################################
  10254. class PokeBattle_Move_16B < PokeBattle_Move
  10255. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10256. if pbIsDamaging?
  10257. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  10258. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  10259. !opponent.isFainted?
  10260. if opponent.effects[PBEffects::MeanLook]<0
  10261. opponent.effects[PBEffects::MeanLook]=attacker.index
  10262. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  10263. end
  10264. end
  10265. return ret
  10266. end
  10267. end
  10268. end
  10269.  
  10270.  
  10271.  
  10272. ################################################################################
  10273. # Heals the user for an amount equal to the target's effective Attack stat
  10274. # Lowers the target's Attack by 1 stage. (Strength Sap)
  10275. ################################################################################
  10276. class PokeBattle_Move_16C < PokeBattle_Move
  10277. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10278. if attacker.effects[PBEffects::HealBlock]>0
  10279. bob="heal"
  10280. bob=_INTL("use {1}",name) if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
  10281. @battle.pbDisplay(_INTL("{1} can't {2} because of Heal Block!",attacker.pbThis,bob))
  10282. return -1
  10283. elsif attacker.hp==attacker.totalhp
  10284. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  10285. return -1
  10286. else
  10287. oatk=opponent.attack
  10288. attacker.pbRecoverHP(oatk,true)
  10289. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  10290. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,opponent,false,self)
  10291. opponent.pbReduceStat(PBStats::ATTACK,1,opponent,false,self)
  10292. end
  10293. end
  10294. return 0
  10295. end
  10296. end
  10297.  
  10298.  
  10299.  
  10300. ################################################################################
  10301. # Lowers the target's Attack and Special Attack. Bypasses Accuracy. (Tearful Look)
  10302. ################################################################################
  10303. class PokeBattle_Move_16D < PokeBattle_Move
  10304. def pbAccuracyCheck(attacker,opponent)
  10305. return true
  10306. end
  10307.  
  10308. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10309. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  10310. showanim=true
  10311. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,opponent,false,self)
  10312. opponent.pbReduceStat(PBStats::ATTACK,1,opponent,false,self,showanim)
  10313. showanim=false
  10314. end
  10315. if opponent.pbCanReduceStatStage?(PBStats::SPATK,opponent,false,self)
  10316. opponent.pbReduceStat(PBStats::SPATK,1,opponent,false,self,showanim)
  10317. showanim=false
  10318. end
  10319. return ret
  10320. end
  10321. end
  10322.  
  10323.  
  10324.  
  10325. ################################################################################
  10326. # The user attacks the target's throat, and prevents the target from using
  10327. # sound-based moves for two turns. (Throat Chop)
  10328. ################################################################################
  10329. class PokeBattle_Move_16E < PokeBattle_Move
  10330. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10331. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  10332. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  10333. !opponent.isFainted?
  10334. opponent.effects[PBEffects::ThroatChop]=2
  10335. @battle.pbDisplay(_INTL("{1} can't use sound based moves!",opponent.pbThis))
  10336. end
  10337. return ret
  10338. end
  10339. end
  10340.  
  10341.  
  10342.  
  10343. ################################################################################
  10344. # Poisons the target and lowers its speed. (Toxic Thread)
  10345. ################################################################################
  10346. class PokeBattle_Move_16F < PokeBattle_Move
  10347. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10348. if opponent.pbCanPoison?(attacker,false,self)
  10349. opponent.pbPoison(attacker)
  10350. end
  10351. if opponent.pbCanReduceStatStage?(PBStats::SPEED,opponent,false,self)
  10352. opponent.pbReduceStat(PBStats::SPEED,1,opponent,false,self,showanim)
  10353. showanim=true
  10354. end
  10355. end
  10356. end
  10357.  
  10358.  
  10359.  
  10360. ################################################################################
  10361. # Driven by frustration, the user attacks the target. Doubles power if
  10362. # previous move used failed. (Stomping Tantrum)
  10363. ################################################################################
  10364. class PokeBattle_Move_170 < PokeBattle_Move
  10365. def pbBaseDamage(basedmg,attacker,opponent)
  10366. return basedmg*2 if attacker.effects[PBEffects::LastMoveFailed]
  10367. return basedmg
  10368. end
  10369. end
  10370.  
  10371.  
  10372.  
  10373. ################################################################################
  10374. # For 5 rounds, lowers power of physical and special attacks against the user's
  10375. # Side. (Aurora Veil)
  10376. ################################################################################
  10377. class PokeBattle_Move_171 < PokeBattle_Move
  10378. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10379. if attacker.pbOwnSide.effects[PBEffects::AuroraVeil]>0
  10380. @battle.pbDisplay(_INTL("But it failed!"))
  10381. return -1
  10382. end
  10383. if @battle.pbWeather!=PBWeather::HAIL
  10384. @battle.pbDisplay(_INTL("But it failed!"))
  10385. return -1
  10386. end
  10387. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  10388. attacker.pbOwnSide.effects[PBEffects::AuroraVeil]=5
  10389. attacker.pbOwnSide.effects[PBEffects::AuroraVeil]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  10390. if !@battle.pbIsOpposing?(attacker.index)
  10391. @battle.pbDisplay(_INTL("Aurora Veil is protecting your side!"))
  10392. else
  10393. @battle.pbDisplay(_INTL("Aurora Veil is protecting the opposing team's side!"))
  10394. end
  10395. return 0
  10396. end
  10397. end
  10398.  
  10399. ################################################################################
  10400. # Hits twice. May cause the target to flinch. (Double Iron Bash)
  10401. ################################################################################
  10402. class PokeBattle_Move_172 < PokeBattle_Move
  10403. def pbAdditionalEffect(attacker,opponent)
  10404. return if opponent.damagestate.substitute
  10405. opponent.pbFlinch(attacker)
  10406. end
  10407.  
  10408. def pbIsMultiHit
  10409. return true
  10410. end
  10411.  
  10412. def pbNumHits(attacker)
  10413. return 2
  10414. end
  10415. end
  10416.  
  10417. ################################################################################
  10418. # Counters a physical move used against the user this round, with an explosion.
  10419. # (Shell Trap)
  10420. ################################################################################
  10421. class PokeBattle_Move_173 < PokeBattle_Move
  10422. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10423. if !attacker.effects[PBEffects::ShellTrap]
  10424. @battle.pbDisplay(_INTL("No one fell into the trap."))
  10425. return -1
  10426. end
  10427. return super(attacker,opponent,hitnum,alltargets,showanimation)
  10428. end
  10429. end
  10430.  
  10431. ################################################################################
  10432. # User is protected against damaging moves this round. Poisons the
  10433. # user of a stopped contact move. (Baneful Bunker)
  10434. ################################################################################
  10435. class PokeBattle_Move_174 < PokeBattle_Move
  10436. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10437. if attacker.effects[PBEffects::BanefulBunker]
  10438. @battle.pbDisplay(_INTL("But it failed!"))
  10439. return -1
  10440. end
  10441. ratesharers=[
  10442. 0xAA, # Detect, Protect
  10443. 0xAB, # Quick Guard
  10444. 0xAC, # Wide Guard
  10445. 0xE8, # Endure
  10446. 0x14B, # King's Shield
  10447. 0x14C, # Spiky Shield
  10448. 0x174 # Baneful Bunker
  10449. ]
  10450. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  10451. attacker.effects[PBEffects::ProtectRate]=1
  10452. end
  10453. unmoved=false
  10454. for poke in @battle.battlers
  10455. next if poke.index==attacker.index
  10456. if @battle.choices[poke.index][0]==1 && # Chose a move
  10457. !poke.hasMovedThisRound?
  10458. unmoved=true; break
  10459. end
  10460. end
  10461. if !unmoved ||
  10462. (!USENEWBATTLEMECHANICS &&
  10463. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  10464. attacker.effects[PBEffects::ProtectRate]=1
  10465. @battle.pbDisplay(_INTL("But it failed!"))
  10466. return -1
  10467. end
  10468. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  10469. attacker.effects[PBEffects::BanefulBunker]=true
  10470. attacker.effects[PBEffects::ProtectRate]*=2
  10471. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  10472. return 0
  10473. end
  10474. end
  10475.  
  10476. ################################################################################
  10477. # This round, the foe becomes the target of attacks that have single targets.
  10478. # (Spotlight)
  10479. ################################################################################
  10480. class PokeBattle_Move_175 < PokeBattle_Move
  10481. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10482. if !@battle.doublebattle
  10483. @battle.pbDisplay(_INTL("But it failed!"))
  10484. return -1
  10485. end
  10486. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  10487. opponent.effects[PBEffects::FollowMe]=1
  10488. if !opponent.pbPartner.fainted? && opponent.pbPartner.effects[PBEffects::FollowMe]>0
  10489. opponent.effects[PBEffects::FollowMe]=opponent.pbPartner.effects[PBEffects::FollowMe]+1
  10490. end
  10491. @battle.pbDisplay(_INTL("{1} became the center of attention!",opponent.pbThis))
  10492. return 0
  10493. end
  10494. end
  10495.  
  10496.  
  10497. ################################################################################
  10498. # Ignores foe's ignoring abilities. This move's category is Special, if Special
  10499. # Attack of the attacker is greater than its Attack, and Physical otherwise.
  10500. # (Photon Geyser)
  10501. ################################################################################
  10502. class PokeBattle_Move_176 < PokeBattle_Move
  10503. def doesBypassIgnorableAbilities?
  10504. return true
  10505. end
  10506.  
  10507. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10508. if attacker.attack+attacker.stages[PBStats::ATTACK]>attacker.spatk+attacker.stages[PBStats::SPATK]
  10509. @category=0
  10510. else
  10511. @category=1
  10512. end
  10513. return super(attacker,opponent,hitnum,alltargets,showanimation)
  10514. end
  10515. end
  10516.  
  10517. ################################################################################
  10518. # The user attacks with electrically charged fists. This move changes
  10519. # Normal-type moves to Electric- type moves. (Plasma Fists)
  10520. ################################################################################
  10521. class PokeBattle_Move_177 < PokeBattle_Move
  10522. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10523. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  10524. @battle.field.effects[PBEffects::IonDeluge]=true
  10525. @battle.pbDisplay(_INTL("{1} emited a strange electric field.",attacker.pbThis))
  10526. return ret
  10527. end
  10528. end
  10529.  
  10530. ################################################################################
  10531. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  10532. # (Mind Blown)
  10533. ################################################################################
  10534. class PokeBattle_Move_178 < PokeBattle_Move
  10535. def pbOnStartUse(attacker)
  10536. if !attacker.hasMoldBreaker
  10537. bearer=@battle.pbCheckGlobalAbility(:DAMP)
  10538. if bearer!=nil
  10539. @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  10540. bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  10541. return false
  10542. end
  10543. end
  10544. return true
  10545. end
  10546.  
  10547. def pbEffectAfterHit(attacker,opponent,turneffects)
  10548. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  10549. if !attacker.hasWorkingAbility(:MAGICGUARD)
  10550. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
  10551. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  10552. end
  10553. end
  10554. end
  10555. end
  10556.  
  10557. ################################################################################
  10558. # Puts the target to sleep. (Dark Void)
  10559. ################################################################################
  10560. class PokeBattle_Move_179 < PokeBattle_Move
  10561. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  10562. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent) ||
  10563. !isConst?(attacker.species,PBSpecies,:DARKRAI)
  10564. if opponent.pbCanSleep?(attacker,true,self)
  10565. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  10566. opponent.pbSleep
  10567. return 0
  10568. end
  10569. return -1
  10570. end
  10571. end
  10572.  
  10573. ################################################################################
  10574. # Ignores foe's ignoring abilities. (Sunsteel Strike, Moongeist Beam)
  10575. ################################################################################
  10576. class PokeBattle_Move_17A < PokeBattle_Move
  10577. def doesBypassIgnorableAbilities?
  10578. return true
  10579. end
  10580. end
  10581.  
  10582. ################################################################################
  10583. # Increases the user's Special Attack by 1 stage. (Fiery Dance)
  10584. ################################################################################
  10585. class PokeBattle_Move_17B < PokeBattle_Move_020
  10586. def isDanceMove?
  10587. return true
  10588. end
  10589. end
  10590.  
  10591. ################################################################################
  10592. # Decreases the target's Attack by 2 stages. (Feather Dance)
  10593. ################################################################################
  10594. class PokeBattle_Move_17C < PokeBattle_Move_04B
  10595. def isDanceMove?
  10596. return true
  10597. end
  10598. end
  10599.  
  10600. ################################################################################
  10601. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  10602. # (Petal Dance)
  10603. ################################################################################
  10604. class PokeBattle_Move_17D < PokeBattle_Move_0D2
  10605. def isDanceMove?
  10606. return true
  10607. end
  10608. end
  10609.  
  10610. ################################################################################
  10611. # Increases the user's Attack by 2 stages. (Swords Dance)
  10612. ################################################################################
  10613. class PokeBattle_Move_17E < PokeBattle_Move_02E
  10614. def isDanceMove?
  10615. return true
  10616. end
  10617. end
  10618.  
  10619. ################################################################################
  10620. # Confuses the target. (Teeter Dance)
  10621. ################################################################################
  10622. class PokeBattle_Move_17F < PokeBattle_Move_013
  10623. def isDanceMove?
  10624. return true
  10625. end
  10626. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement