Advertisement
Guest User

Script

a guest
Aug 22nd, 2016
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 367.54 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.isFainted? && 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.isFainted?
  169. attacker.form=(attacker.form+1)%2
  170. attacker.pbUpdate(true)
  171. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  172. @battle.pbDisplay(_INTL("{1} transformed!",attacker.pbThis))
  173. PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
  174. end
  175. end
  176. end
  177. end
  178.  
  179.  
  180.  
  181. ################################################################################
  182. # Makes the target drowsy; it will fall asleep at the end of the next turn. (Yawn)
  183. ################################################################################
  184. class PokeBattle_Move_004 < PokeBattle_Move
  185. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  186. return -1 if !opponent.pbCanSleep?(attacker,true,self)
  187. if opponent.effects[PBEffects::Yawn]>0
  188. @battle.pbDisplay(_INTL("But it failed!"))
  189. return -1
  190. end
  191. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  192. opponent.effects[PBEffects::Yawn]=2
  193. @battle.pbDisplay(_INTL("{1} made {2} drowsy!",attacker.pbThis,opponent.pbThis(true)))
  194. return 0
  195. end
  196. end
  197.  
  198.  
  199.  
  200. ################################################################################
  201. # Poisons the target.
  202. ################################################################################
  203. class PokeBattle_Move_005 < PokeBattle_Move
  204. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  205. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  206. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  207. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  208. opponent.pbPoison(attacker)
  209. return 0
  210. end
  211.  
  212. def pbAdditionalEffect(attacker,opponent)
  213. return if opponent.damagestate.substitute
  214. if opponent.pbCanPoison?(attacker,false,self)
  215. opponent.pbPoison(attacker)
  216. end
  217. end
  218. end
  219.  
  220.  
  221.  
  222. ################################################################################
  223. # Badly poisons the target. (Poison Fang, Toxic)
  224. # (Handled in Battler's pbSuccessCheck): Hits semi-invulnerable targets if user
  225. # is Poison-type and move is status move.
  226. ################################################################################
  227. class PokeBattle_Move_006 < PokeBattle_Move
  228. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  229. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  230. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  231. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  232. opponent.pbPoison(attacker,nil,true)
  233. return 0
  234. end
  235.  
  236. def pbAdditionalEffect(attacker,opponent)
  237. return if opponent.damagestate.substitute
  238. if opponent.pbCanPoison?(attacker,false,self)
  239. opponent.pbPoison(attacker,nil,true)
  240. end
  241. end
  242. end
  243.  
  244.  
  245.  
  246. ################################################################################
  247. # Paralyzes the target.
  248. # Thunder Wave: Doesn't affect target if move's type has no effect on it.
  249. # Bolt Strike: Powers up the next Fusion Flare used this round.
  250. ################################################################################
  251. class PokeBattle_Move_007 < PokeBattle_Move
  252. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  253. if pbIsDamaging?
  254. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  255. if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BOLTSTRIKE)
  256. @battle.field.effects[PBEffects::FusionFlare]=true
  257. end
  258. return ret
  259. else
  260. if isConst?(@id,PBMoves,:THUNDERWAVE)
  261. if pbTypeModifier(type,attacker,opponent)==0
  262. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  263. return -1
  264. end
  265. end
  266. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  267. return -1 if !opponent.pbCanParalyze?(attacker,true,self)
  268. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  269. opponent.pbParalyze(attacker)
  270. return 0
  271. end
  272. return -1
  273. end
  274.  
  275. def pbAdditionalEffect(attacker,opponent)
  276. return if opponent.damagestate.substitute
  277. if opponent.pbCanParalyze?(attacker,false,self)
  278. opponent.pbParalyze(attacker)
  279. end
  280. end
  281. end
  282.  
  283.  
  284.  
  285. ################################################################################
  286. # Paralyzes the target. Accuracy perfect in rain, 50% in sunshine. (Thunder)
  287. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  288. ################################################################################
  289. class PokeBattle_Move_008 < PokeBattle_Move
  290. def pbAdditionalEffect(attacker,opponent)
  291. return if opponent.damagestate.substitute
  292. if opponent.pbCanParalyze?(attacker,false,self)
  293. opponent.pbParalyze(attacker)
  294. end
  295. end
  296.  
  297. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  298. case @battle.pbWeather
  299. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  300. return 0
  301. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  302. return 50
  303. end
  304. return baseaccuracy
  305. end
  306. end
  307.  
  308.  
  309.  
  310. ################################################################################
  311. # Paralyzes the target. May cause the target to flinch. (Thunder Fang)
  312. ################################################################################
  313. class PokeBattle_Move_009 < PokeBattle_Move
  314. def pbAdditionalEffect(attacker,opponent)
  315. return if opponent.damagestate.substitute
  316. if @battle.pbRandom(10)==0
  317. if opponent.pbCanParalyze?(attacker,false,self)
  318. opponent.pbParalyze(attacker)
  319. end
  320. end
  321. if @battle.pbRandom(10)==0
  322. opponent.pbFlinch(attacker)
  323. end
  324. end
  325. end
  326.  
  327.  
  328.  
  329. ################################################################################
  330. # Burns the target.
  331. # Blue Flare: Powers up the next Fusion Bolt used this round.
  332. ################################################################################
  333. class PokeBattle_Move_00A < PokeBattle_Move
  334. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  335. if pbIsDamaging?
  336. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  337. if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BLUEFLARE)
  338. @battle.field.effects[PBEffects::FusionBolt]=true
  339. end
  340. return ret
  341. else
  342. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  343. return -1 if !opponent.pbCanBurn?(attacker,true,self)
  344. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  345. opponent.pbBurn(attacker)
  346. return 0
  347. end
  348. return -1
  349. end
  350.  
  351. def pbAdditionalEffect(attacker,opponent)
  352. return if opponent.damagestate.substitute
  353. if opponent.pbCanBurn?(attacker,false,self)
  354. opponent.pbBurn(attacker)
  355. end
  356. end
  357. end
  358.  
  359.  
  360.  
  361. ################################################################################
  362. # Burns the target. May cause the target to flinch. (Fire Fang)
  363. ################################################################################
  364. class PokeBattle_Move_00B < PokeBattle_Move
  365. def pbAdditionalEffect(attacker,opponent)
  366. return if opponent.damagestate.substitute
  367. if @battle.pbRandom(10)==0
  368. if opponent.pbCanBurn?(attacker,false,self)
  369. opponent.pbBurn(attacker)
  370. end
  371. end
  372. if @battle.pbRandom(10)==0
  373. opponent.pbFlinch(attacker)
  374. end
  375. end
  376. end
  377.  
  378.  
  379.  
  380. ################################################################################
  381. # Freezes the target.
  382. ################################################################################
  383. class PokeBattle_Move_00C < PokeBattle_Move
  384. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  385. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  386. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  387. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  388. opponent.pbFreeze
  389. return 0
  390. end
  391.  
  392. def pbAdditionalEffect(attacker,opponent)
  393. return if opponent.damagestate.substitute
  394. if opponent.pbCanFreeze?(attacker,false,self)
  395. opponent.pbFreeze
  396. end
  397. end
  398. end
  399.  
  400.  
  401.  
  402. ################################################################################
  403. # Freezes the target. Accuracy perfect in hail. (Blizzard)
  404. ################################################################################
  405. class PokeBattle_Move_00D < PokeBattle_Move
  406. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  407. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  408. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  409. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  410. opponent.pbFreeze
  411. return 0
  412. end
  413.  
  414. def pbAdditionalEffect(attacker,opponent)
  415. return if opponent.damagestate.substitute
  416. if opponent.pbCanFreeze?(attacker,false,self)
  417. opponent.pbFreeze
  418. end
  419. end
  420.  
  421. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  422. if @battle.pbWeather==PBWeather::HAIL
  423. return 0
  424. end
  425. return baseaccuracy
  426. end
  427. end
  428.  
  429.  
  430.  
  431. ################################################################################
  432. # Freezes the target. May cause the target to flinch. (Ice Fang)
  433. ################################################################################
  434. class PokeBattle_Move_00E < PokeBattle_Move
  435. def pbAdditionalEffect(attacker,opponent)
  436. return if opponent.damagestate.substitute
  437. if @battle.pbRandom(10)==0
  438. if opponent.pbCanFreeze?(attacker,false,self)
  439. opponent.pbFreeze
  440. end
  441. end
  442. if @battle.pbRandom(10)==0
  443. opponent.pbFlinch(attacker)
  444. end
  445. end
  446. end
  447.  
  448.  
  449.  
  450. ################################################################################
  451. # Causes the target to flinch.
  452. ################################################################################
  453. class PokeBattle_Move_00F < PokeBattle_Move
  454. def pbAdditionalEffect(attacker,opponent)
  455. return if opponent.damagestate.substitute
  456. opponent.pbFlinch(attacker)
  457. end
  458. end
  459.  
  460.  
  461.  
  462. ################################################################################
  463. # Causes the target to flinch. Does double damage and has perfect accuracy if
  464. # the target is Minimized.
  465. ################################################################################
  466. class PokeBattle_Move_010 < PokeBattle_Move
  467. def pbAdditionalEffect(attacker,opponent)
  468. return if opponent.damagestate.substitute
  469. opponent.pbFlinch(attacker)
  470. end
  471.  
  472. def tramplesMinimize?(param=1)
  473. return false if isConst?(@id,PBMoves,:DRAGONRUSH) && !USENEWBATTLEMECHANICS
  474. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  475. return true if param==2 # Double damage
  476. return false
  477. end
  478. end
  479.  
  480.  
  481.  
  482. ################################################################################
  483. # Causes the target to flinch. Fails if the user is not asleep. (Snore)
  484. ################################################################################
  485. class PokeBattle_Move_011 < PokeBattle_Move
  486. def pbCanUseWhileAsleep?
  487. return true
  488. end
  489.  
  490. def pbMoveFailed(attacker,opponent)
  491. return (attacker.status!=PBStatuses::SLEEP)
  492. end
  493.  
  494. def pbAdditionalEffect(attacker,opponent)
  495. return if opponent.damagestate.substitute
  496. opponent.pbFlinch(attacker)
  497. end
  498. end
  499.  
  500.  
  501.  
  502. ################################################################################
  503. # Causes the target to flinch. Fails if this isn't the user's first turn. (Fake Out)
  504. ################################################################################
  505. class PokeBattle_Move_012 < PokeBattle_Move
  506. def pbMoveFailed(attacker,opponent)
  507. return (attacker.turncount>1)
  508. end
  509.  
  510. def pbAdditionalEffect(attacker,opponent)
  511. return if opponent.damagestate.substitute
  512. opponent.pbFlinch(attacker)
  513. end
  514. end
  515.  
  516.  
  517.  
  518. ################################################################################
  519. # Confuses the target.
  520. ################################################################################
  521. class PokeBattle_Move_013 < PokeBattle_Move
  522. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  523. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  524. if opponent.pbCanConfuse?(attacker,true,self)
  525. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  526. opponent.pbConfuse
  527. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  528. return 0
  529. end
  530. return -1
  531. end
  532.  
  533. def pbAdditionalEffect(attacker,opponent)
  534. return if opponent.damagestate.substitute
  535. if opponent.pbCanConfuse?(attacker,false,self)
  536. opponent.pbConfuse
  537. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  538. end
  539. end
  540. end
  541.  
  542.  
  543.  
  544. ################################################################################
  545. # Confuses the target. Chance of causing confusion depends on the cry's volume.
  546. # Confusion chance is 0% if user doesn't have a recorded cry. (Chatter)
  547. # TODO: Play the actual chatter cry as part of the move animation
  548. # @battle.scene.pbChatter(attacker,opponent) # Just plays cry
  549. ################################################################################
  550. class PokeBattle_Move_014 < PokeBattle_Move
  551. def addlEffect
  552. return 100 if USENEWBATTLEMECHANICS
  553. if attacker.pokemon && attacker.pokemon.chatter
  554. return attacker.pokemon.chatter.intensity*10/127
  555. end
  556. return 0
  557. end
  558.  
  559. def pbAdditionalEffect(attacker,opponent)
  560. return if opponent.damagestate.substitute
  561. if opponent.pbCanConfuse?(attacker,false,self)
  562. opponent.pbConfuse
  563. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  564. end
  565. end
  566. end
  567.  
  568.  
  569.  
  570. ################################################################################
  571. # Confuses the target. Accuracy perfect in rain, 50% in sunshine. (Hurricane)
  572. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  573. ################################################################################
  574. class PokeBattle_Move_015 < PokeBattle_Move
  575. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  576. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  577. if opponent.pbCanConfuse?(attacker,true,self)
  578. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  579. opponent.pbConfuse
  580. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  581. return 0
  582. end
  583. return -1
  584. end
  585.  
  586. def pbAdditionalEffect(attacker,opponent)
  587. return if opponent.damagestate.substitute
  588. if opponent.pbCanConfuse?(attacker,false,self)
  589. opponent.pbConfuse
  590. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  591. end
  592. end
  593.  
  594. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  595. case @battle.pbWeather
  596. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  597. return 0
  598. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  599. return 50
  600. end
  601. return baseaccuracy
  602. end
  603. end
  604.  
  605.  
  606.  
  607. ################################################################################
  608. # Attracts the target. (Attract)
  609. ################################################################################
  610. class PokeBattle_Move_016 < PokeBattle_Move
  611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  612. if !opponent.pbCanAttract?(attacker)
  613. return -1
  614. end
  615. if !attacker.hasMoldBreaker
  616. if opponent.hasWorkingAbility(:AROMAVEIL)
  617. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  618. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  619. return -1
  620. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  621. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  622. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  623. return -1
  624. end
  625. end
  626. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  627. opponent.pbAttract(attacker)
  628. return 0
  629. end
  630. end
  631.  
  632.  
  633.  
  634. ################################################################################
  635. # Burns, freezes or paralyzes the target. (Tri Attack)
  636. ################################################################################
  637. class PokeBattle_Move_017 < PokeBattle_Move
  638. def pbAdditionalEffect(attacker,opponent)
  639. return if opponent.damagestate.substitute
  640. case @battle.pbRandom(3)
  641. when 0
  642. if opponent.pbCanBurn?(attacker,false,self)
  643. opponent.pbBurn(attacker)
  644. end
  645. when 1
  646. if opponent.pbCanFreeze?(attacker,false,self)
  647. opponent.pbFreeze
  648. end
  649. when 2
  650. if opponent.pbCanParalyze?(attacker,false,self)
  651. opponent.pbParalyze(attacker)
  652. end
  653. end
  654. end
  655. end
  656.  
  657.  
  658.  
  659. ################################################################################
  660. # Cures user of burn, poison and paralysis. (Refresh)
  661. ################################################################################
  662. class PokeBattle_Move_018 < PokeBattle_Move
  663. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  664. if attacker.status!=PBStatuses::BURN &&
  665. attacker.status!=PBStatuses::POISON &&
  666. attacker.status!=PBStatuses::PARALYSIS
  667. @battle.pbDisplay(_INTL("But it failed!"))
  668. return -1
  669. else
  670. t=attacker.status
  671. attacker.pbCureStatus(false)
  672. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  673. if t==PBStatuses::BURN
  674. @battle.pbDisplay(_INTL("{1} healed its burn!",attacker.pbThis))
  675. elsif t==PBStatuses::POISON
  676. @battle.pbDisplay(_INTL("{1} cured its poisoning!",attacker.pbThis))
  677. elsif t==PBStatuses::PARALYSIS
  678. @battle.pbDisplay(_INTL("{1} cured its paralysis!",attacker.pbThis))
  679. end
  680. return 0
  681. end
  682. end
  683. end
  684.  
  685.  
  686.  
  687. ################################################################################
  688. # Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
  689. ################################################################################
  690. class PokeBattle_Move_019 < PokeBattle_Move
  691. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  692. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  693. if isConst?(@id,PBMoves,:AROMATHERAPY)
  694. @battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
  695. else
  696. @battle.pbDisplay(_INTL("A bell chimed!"))
  697. end
  698. activepkmn=[]
  699. for i in @battle.battlers
  700. next if attacker.pbIsOpposing?(i.index) || i.isFainted?
  701. activepkmn.push(i.pokemonIndex)
  702. next if USENEWBATTLEMECHANICS && i.index!=attacker.index &&
  703. pbTypeImmunityByAbility(pbType(@type,attacker,i),attacker,i)
  704. case i.status
  705. when PBStatuses::PARALYSIS
  706. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",i.pbThis))
  707. when PBStatuses::SLEEP
  708. @battle.pbDisplay(_INTL("{1}'s sleep was woken.",i.pbThis))
  709. when PBStatuses::POISON
  710. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",i.pbThis))
  711. when PBStatuses::BURN
  712. @battle.pbDisplay(_INTL("{1}'s burn was healed.",i.pbThis))
  713. when PBStatuses::FROZEN
  714. @battle.pbDisplay(_INTL("{1} was thawed out.",i.pbThis))
  715. end
  716. i.pbCureStatus(false)
  717. end
  718. party=@battle.pbParty(attacker.index) # NOTE: Considers both parties in multi battles
  719. for i in 0...party.length
  720. next if activepkmn.include?(i)
  721. next if !party[i] || party[i].isEgg? || party[i].hp<=0
  722. case party[i].status
  723. when PBStatuses::PARALYSIS
  724. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",party[i].name))
  725. when PBStatuses::SLEEP
  726. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",party[i].name))
  727. when PBStatuses::POISON
  728. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",party[i].name))
  729. when PBStatuses::BURN
  730. @battle.pbDisplay(_INTL("{1}'s burn was healed.",party[i].name))
  731. when PBStatuses::FROZEN
  732. @battle.pbDisplay(_INTL("{1} was thawed out.",party[i].name))
  733. end
  734. party[i].status=0
  735. party[i].statusCount=0
  736. end
  737. return 0
  738. end
  739. end
  740.  
  741.  
  742.  
  743. ################################################################################
  744. # Safeguards the user's side from being inflicted with status problems. (Safeguard)
  745. ################################################################################
  746. class PokeBattle_Move_01A < PokeBattle_Move
  747. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  748. if attacker.pbOwnSide.effects[PBEffects::Safeguard]>0
  749. @battle.pbDisplay(_INTL("But it failed!"))
  750. return -1
  751. end
  752. attacker.pbOwnSide.effects[PBEffects::Safeguard]=5
  753. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  754. if !@battle.pbIsOpposing?(attacker.index)
  755. @battle.pbDisplay(_INTL("Your team became cloaked in a mystical veil!"))
  756. else
  757. @battle.pbDisplay(_INTL("The opposing team became cloaked in a mystical veil!"))
  758. end
  759. return 0
  760. end
  761. end
  762.  
  763.  
  764.  
  765. ################################################################################
  766. # User passes its status problem to the target. (Psycho Shift)
  767. ################################################################################
  768. class PokeBattle_Move_01B < PokeBattle_Move
  769. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  770. if attacker.status==0 ||
  771. (attacker.status==PBStatuses::PARALYSIS && !opponent.pbCanParalyze?(attacker,false,self)) ||
  772. (attacker.status==PBStatuses::SLEEP && !opponent.pbCanSleep?(attacker,false,self)) ||
  773. (attacker.status==PBStatuses::POISON && !opponent.pbCanPoison?(attacker,false,self)) ||
  774. (attacker.status==PBStatuses::BURN && !opponent.pbCanBurn?(attacker,false,self)) ||
  775. (attacker.status==PBStatuses::FROZEN && !opponent.pbCanFreeze?(attacker,false,self))
  776. @battle.pbDisplay(_INTL("But it failed!"))
  777. return -1
  778. end
  779. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  780. case attacker.status
  781. when PBStatuses::PARALYSIS
  782. opponent.pbParalyze(attacker)
  783. opponent.pbAbilityCureCheck
  784. attacker.pbCureStatus(false)
  785. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",attacker.pbThis))
  786. when PBStatuses::SLEEP
  787. opponent.pbSleep
  788. opponent.pbAbilityCureCheck
  789. attacker.pbCureStatus(false)
  790. @battle.pbDisplay(_INTL("{1} woke up.",attacker.pbThis))
  791. when PBStatuses::POISON
  792. opponent.pbPoison(attacker,nil,attacker.statusCount!=0)
  793. opponent.pbAbilityCureCheck
  794. attacker.pbCureStatus(false)
  795. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  796. when PBStatuses::BURN
  797. opponent.pbBurn(attacker)
  798. opponent.pbAbilityCureCheck
  799. attacker.pbCureStatus(false)
  800. @battle.pbDisplay(_INTL("{1}'s burn was healed.",attacker.pbThis))
  801. when PBStatuses::FROZEN
  802. opponent.pbFreeze
  803. opponent.pbAbilityCureCheck
  804. attacker.pbCureStatus(false)
  805. @battle.pbDisplay(_INTL("{1} was thawed out.",attacker.pbThis))
  806. end
  807. return 0
  808. end
  809. end
  810.  
  811.  
  812.  
  813. ################################################################################
  814. # Increases the user's Attack by 1 stage.
  815. ################################################################################
  816. class PokeBattle_Move_01C < PokeBattle_Move
  817. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  818. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  819. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  820. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  821. ret=attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  822. return ret ? 0 : -1
  823. end
  824.  
  825. def pbAdditionalEffect(attacker,opponent)
  826. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  827. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  828. end
  829. end
  830. end
  831.  
  832.  
  833.  
  834. ################################################################################
  835. # Increases the user's Defense by 1 stage.
  836. ################################################################################
  837. class PokeBattle_Move_01D < PokeBattle_Move
  838. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  839. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  840. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  841. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  842. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  843. return ret ? 0 : -1
  844. end
  845.  
  846. def pbAdditionalEffect(attacker,opponent)
  847. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  848. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  849. end
  850. end
  851. end
  852.  
  853.  
  854.  
  855. ################################################################################
  856. # Increases the user's Defense by 1 stage. User curls up. (Defense Curl)
  857. ################################################################################
  858. class PokeBattle_Move_01E < PokeBattle_Move
  859. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  860. attacker.effects[PBEffects::DefenseCurl]=true
  861. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  862. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  863. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  864. return ret ? 0 : -1
  865. end
  866. end
  867.  
  868.  
  869.  
  870. ################################################################################
  871. # Increases the user's Speed by 1 stage.
  872. ################################################################################
  873. class PokeBattle_Move_01F < PokeBattle_Move
  874. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  875. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  876. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  877. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  878. ret=attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  879. return ret ? 0 : -1
  880. end
  881.  
  882. def pbAdditionalEffect(attacker,opponent)
  883. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  884. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  885. end
  886. end
  887. end
  888.  
  889.  
  890.  
  891. ################################################################################
  892. # Increases the user's Special Attack by 1 stage.
  893. ################################################################################
  894. class PokeBattle_Move_020 < PokeBattle_Move
  895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  896. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  897. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  898. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  899. ret=attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  900. return ret ? 0 : -1
  901. end
  902.  
  903. def pbAdditionalEffect(attacker,opponent)
  904. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  905. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  906. end
  907. end
  908. end
  909.  
  910.  
  911.  
  912. ################################################################################
  913. # Increases the user's Special Defense by 1 stage.
  914. # Charges up user's next attack if it is Electric-type. (Charge)
  915. ################################################################################
  916. class PokeBattle_Move_021 < PokeBattle_Move
  917. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  918. attacker.effects[PBEffects::Charge]=2
  919. @battle.pbDisplay(_INTL("{1} began charging power!",attacker.pbThis))
  920. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  921. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  922. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  923. end
  924. return 0
  925. end
  926. end
  927.  
  928.  
  929.  
  930. ################################################################################
  931. # Increases the user's evasion by 1 stage.
  932. ################################################################################
  933. class PokeBattle_Move_022 < PokeBattle_Move
  934. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  935. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  936. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  937. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  938. ret=attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  939. return ret ? 0 : -1
  940. end
  941.  
  942. def pbAdditionalEffect(attacker,opponent)
  943. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  944. attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  945. end
  946. end
  947. end
  948.  
  949.  
  950.  
  951. ################################################################################
  952. # Increases the user's critical hit rate. (Focus Energy)
  953. ################################################################################
  954. class PokeBattle_Move_023 < PokeBattle_Move
  955. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  956. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  957. if attacker.effects[PBEffects::FocusEnergy]>=2
  958. @battle.pbDisplay(_INTL("But it failed!"))
  959. return -1
  960. end
  961. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  962. attacker.effects[PBEffects::FocusEnergy]=2
  963. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  964. return 0
  965. end
  966.  
  967. def pbAdditionalEffect(attacker,opponent)
  968. if attacker.effects[PBEffects::FocusEnergy]<2
  969. attacker.effects[PBEffects::FocusEnergy]=2
  970. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  971. end
  972. end
  973. end
  974.  
  975.  
  976.  
  977. ################################################################################
  978. # Increases the user's Attack and Defense by 1 stage each. (Bulk Up)
  979. ################################################################################
  980. class PokeBattle_Move_024 < PokeBattle_Move
  981. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  982. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  983. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  984. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  985. return -1
  986. end
  987. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  988. showanim=true
  989. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  990. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  991. showanim=false
  992. end
  993. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  994. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  995. showanim=false
  996. end
  997. return 0
  998. end
  999. end
  1000.  
  1001.  
  1002.  
  1003. ################################################################################
  1004. # Increases the user's Attack, Defense and accuracy by 1 stage each. (Coil)
  1005. ################################################################################
  1006. class PokeBattle_Move_025 < PokeBattle_Move
  1007. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1008. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1009. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1010. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1011. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1012. return -1
  1013. end
  1014. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1015. showanim=true
  1016. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1017. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1018. showanim=false
  1019. end
  1020. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1021. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1022. showanim=false
  1023. end
  1024. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1025. attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1026. showanim=false
  1027. end
  1028. return 0
  1029. end
  1030. end
  1031.  
  1032.  
  1033.  
  1034. ################################################################################
  1035. # Increases the user's Attack and Speed by 1 stage each. (Dragon Dance)
  1036. ################################################################################
  1037. class PokeBattle_Move_026 < PokeBattle_Move
  1038. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1039. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1040. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1041. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1042. return -1
  1043. end
  1044. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1045. showanim=true
  1046. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1047. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1048. showanim=false
  1049. end
  1050. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1051. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1052. showanim=false
  1053. end
  1054. return 0
  1055. end
  1056. end
  1057.  
  1058.  
  1059.  
  1060. ################################################################################
  1061. # Increases the user's Attack and Special Attack by 1 stage each. (Work Up)
  1062. ################################################################################
  1063. class PokeBattle_Move_027 < PokeBattle_Move
  1064. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1065. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1066. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1067. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1068. return -1
  1069. end
  1070. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1071. showanim=true
  1072. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1073. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1074. showanim=false
  1075. end
  1076. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1077. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1078. showanim=false
  1079. end
  1080. return 0
  1081. end
  1082. end
  1083.  
  1084.  
  1085.  
  1086. ################################################################################
  1087. # Increases the user's Attack and Sp. Attack by 1 stage each.
  1088. # In sunny weather, increase is 2 stages each instead. (Growth)
  1089. ################################################################################
  1090. class PokeBattle_Move_028 < PokeBattle_Move
  1091. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1092. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1093. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1094. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1095. return -1
  1096. end
  1097. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1098. showanim=true
  1099. increment=1
  1100. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  1101. @battle.pbWeather==PBWeather::HARSHSUN
  1102. increment=2
  1103. end
  1104. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1105. attacker.pbIncreaseStat(PBStats::ATTACK,increment,attacker,false,self,showanim)
  1106. showanim=false
  1107. end
  1108. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1109. attacker.pbIncreaseStat(PBStats::SPATK,increment,attacker,false,self,showanim)
  1110. showanim=false
  1111. end
  1112. return 0
  1113. end
  1114. end
  1115.  
  1116.  
  1117.  
  1118. ################################################################################
  1119. # Increases the user's Attack and accuracy by 1 stage each. (Hone Claws)
  1120. ################################################################################
  1121. class PokeBattle_Move_029 < PokeBattle_Move
  1122. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1123. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1124. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1125. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1126. return -1
  1127. end
  1128. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1129. showanim=true
  1130. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1131. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1132. showanim=false
  1133. end
  1134. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1135. attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1136. showanim=false
  1137. end
  1138. return 0
  1139. end
  1140. end
  1141.  
  1142.  
  1143.  
  1144. ################################################################################
  1145. # Increases the user's Defense and Special Defense by 1 stage each. (Cosmic Power)
  1146. ################################################################################
  1147. class PokeBattle_Move_02A < PokeBattle_Move
  1148. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1149. if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1150. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1151. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1152. return -1
  1153. end
  1154. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1155. showanim=true
  1156. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1157. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1158. showanim=false
  1159. end
  1160. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1161. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1162. showanim=false
  1163. end
  1164. return 0
  1165. end
  1166. end
  1167.  
  1168.  
  1169.  
  1170. ################################################################################
  1171. # Increases the user's Sp. Attack, Sp. Defense and Speed by 1 stage each. (Quiver Dance)
  1172. ################################################################################
  1173. class PokeBattle_Move_02B < PokeBattle_Move
  1174. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1175. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1176. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  1177. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1178. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1179. return -1
  1180. end
  1181. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1182. showanim=true
  1183. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1184. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1185. showanim=false
  1186. end
  1187. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1188. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1189. showanim=false
  1190. end
  1191. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1192. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1193. showanim=false
  1194. end
  1195. return 0
  1196. end
  1197. end
  1198.  
  1199.  
  1200.  
  1201. ################################################################################
  1202. # Increases the user's Sp. Attack and Sp. Defense by 1 stage each. (Calm Mind)
  1203. ################################################################################
  1204. class PokeBattle_Move_02C < PokeBattle_Move
  1205. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1206. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1207. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1208. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1209. return -1
  1210. end
  1211. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1212. showanim=true
  1213. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1214. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1215. showanim=false
  1216. end
  1217. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1218. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1219. showanim=false
  1220. end
  1221. return 0
  1222. end
  1223. end
  1224.  
  1225.  
  1226.  
  1227. ################################################################################
  1228. # Increases the user's Attack, Defense, Speed, Special Attack and Special Defense
  1229. # by 1 stage each. (AncientPower, Ominous Wind, Silver Wind)
  1230. ################################################################################
  1231. class PokeBattle_Move_02D < PokeBattle_Move
  1232. def pbAdditionalEffect(attacker,opponent)
  1233. showanim=true
  1234. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1235. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1236. showanim=false
  1237. end
  1238. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1239. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1240. showanim=false
  1241. end
  1242. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1243. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1244. showanim=false
  1245. end
  1246. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1247. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1248. showanim=false
  1249. end
  1250. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1251. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1252. showanim=false
  1253. end
  1254. end
  1255. end
  1256.  
  1257.  
  1258.  
  1259. ################################################################################
  1260. # Increases the user's Attack by 2 stages.
  1261. ################################################################################
  1262. class PokeBattle_Move_02E < PokeBattle_Move
  1263. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1264. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1265. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  1266. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1267. ret=attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1268. return ret ? 0 : -1
  1269. end
  1270.  
  1271. def pbAdditionalEffect(attacker,opponent)
  1272. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1273. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1274. end
  1275. end
  1276. end
  1277.  
  1278.  
  1279.  
  1280. ################################################################################
  1281. # Increases the user's Defense by 2 stages.
  1282. ################################################################################
  1283. class PokeBattle_Move_02F < PokeBattle_Move
  1284. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1285. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1286. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1287. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1288. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1289. return ret ? 0 : -1
  1290. end
  1291.  
  1292. def pbAdditionalEffect(attacker,opponent)
  1293. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1294. attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1295. end
  1296. end
  1297. end
  1298.  
  1299.  
  1300.  
  1301. ################################################################################
  1302. # Increases the user's Speed by 2 stages.
  1303. ################################################################################
  1304. class PokeBattle_Move_030 < PokeBattle_Move
  1305. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1306. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1307. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1308. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1309. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1310. return ret ? 0 : -1
  1311. end
  1312.  
  1313.  
  1314. ################################################################################
  1315. # Increases the user's Speed by 2 stages. Lowers user's weight by 100kg. (Autotomize)
  1316. ################################################################################
  1317. class PokeBattle_Move_031 < PokeBattle_Move
  1318. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1319. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1320. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1321. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1322. if ret
  1323. attacker.effects[PBEffects::WeightChange]-=1000
  1324. @battle.pbDisplay(_INTL("{1} became nimble!",attacker.pbThis))
  1325. end
  1326. return ret ? 0 : -1
  1327. end
  1328. end
  1329.  
  1330.  
  1331.  
  1332. ################################################################################
  1333. # Increases the user's Special Attack by 2 stages.
  1334. ################################################################################
  1335. class PokeBattle_Move_032 < PokeBattle_Move
  1336. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1337. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1338. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1339. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1340. ret=attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1341. return ret ? 0 : -1
  1342. end
  1343.  
  1344. def pbAdditionalEffect(attacker,opponent)
  1345. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1346. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1347. end
  1348. end
  1349. end
  1350.  
  1351.  
  1352.  
  1353. ################################################################################
  1354. # Increases the user's Special Defense by 2 stages.
  1355. ################################################################################
  1356. class PokeBattle_Move_033 < PokeBattle_Move
  1357. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1358. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1359. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  1360. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1361. ret=attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1362. return ret ? 0 : -1
  1363. end
  1364.  
  1365. def pbAdditionalEffect(attacker,opponent)
  1366. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1367. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1368. end
  1369. end
  1370. end
  1371.  
  1372.  
  1373.  
  1374. ################################################################################
  1375. # Increases the user's evasion by 2 stages. Minimizes the user. (Minimize)
  1376. ################################################################################
  1377. class PokeBattle_Move_034 < PokeBattle_Move
  1378. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1379. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1380. attacker.effects[PBEffects::Minimize]=true
  1381. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  1382. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1383. ret=attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1384. return ret ? 0 : -1
  1385. end
  1386.  
  1387. def pbAdditionalEffect(attacker,opponent)
  1388. attacker.effects[PBEffects::Minimize]=true
  1389. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  1390. attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1391. end
  1392. end
  1393. end
  1394.  
  1395.  
  1396.  
  1397. ################################################################################
  1398. # Decreases the user's Defense and Special Defense by 1 stage each. (Shell Smash)
  1399. # Increases the user's Attack, Speed and Special Attack by 2 stages each.
  1400. ################################################################################
  1401. class PokeBattle_Move_035 < PokeBattle_Move
  1402. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1403. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1404. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1405. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1406. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1407. return -1
  1408. end
  1409. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1410. showanim=true
  1411. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1412. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1413. showanim=false
  1414. end
  1415. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1416. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1417. showanim=false
  1418. end
  1419. showanim=true
  1420. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1421. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  1422. showanim=false
  1423. end
  1424. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1425. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  1426. showanim=false
  1427. end
  1428. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1429. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1430. showanim=false
  1431. end
  1432. return 0
  1433. end
  1434. end
  1435.  
  1436.  
  1437.  
  1438. ################################################################################
  1439. # Increases the user's Speed by 2 stages, and its Attack by 1 stage. (Shift Gear)
  1440. ################################################################################
  1441. class PokeBattle_Move_036 < PokeBattle_Move
  1442. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1443. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1444. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1445. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1446. return -1
  1447. end
  1448. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1449. showanim=true
  1450. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1451. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1452. showanim=false
  1453. end
  1454. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1455. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1456. showanim=false
  1457. end
  1458. return 0
  1459. end
  1460. end
  1461.  
  1462.  
  1463.  
  1464. ################################################################################
  1465. # Increases one random stat of the user by 2 stages (except HP). (Acupressure)
  1466. ################################################################################
  1467. class PokeBattle_Move_037 < PokeBattle_Move
  1468. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1469. if attacker.index!=opponent.index
  1470. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  1471. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1472. @battle.pbDisplay(_INTL("But it failed!"))
  1473. return -1
  1474. end
  1475. end
  1476. array=[]
  1477. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1478. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1479. array.push(i) if opponent.pbCanIncreaseStatStage?(i,attacker,false,self)
  1480. end
  1481. if array.length==0
  1482. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",opponent.pbThis))
  1483. return -1
  1484. end
  1485. stat=array[@battle.pbRandom(array.length)]
  1486. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1487. ret=opponent.pbIncreaseStat(stat,2,attacker,false,self)
  1488. return 0
  1489. end
  1490. end
  1491.  
  1492.  
  1493.  
  1494. ################################################################################
  1495. # Increases the user's Defense by 3 stages.
  1496. ################################################################################
  1497. class PokeBattle_Move_038 < PokeBattle_Move
  1498. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1499. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1500. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1501. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1502. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1503. return ret ? 0 : -1
  1504. end
  1505.  
  1506. def pbAdditionalEffect(attacker,opponent)
  1507. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1508. attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1509. end
  1510. end
  1511. end
  1512.  
  1513.  
  1514.  
  1515. ################################################################################
  1516. # Increases the user's Special Attack by 3 stages.
  1517. ################################################################################
  1518. class PokeBattle_Move_039 < PokeBattle_Move
  1519. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1520. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1521. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1522. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1523. ret=attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1524. return ret ? 0 : -1
  1525. end
  1526.  
  1527. def pbAdditionalEffect(attacker,opponent)
  1528. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1529. attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1530. end
  1531. end
  1532. end
  1533.  
  1534.  
  1535.  
  1536. ################################################################################
  1537. # Reduces the user's HP by half of max, and sets its Attack to maximum. (Belly Drum)
  1538. ################################################################################
  1539. class PokeBattle_Move_03A < PokeBattle_Move
  1540. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1541. if attacker.hp<=(attacker.totalhp/2).floor ||
  1542. !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1543. @battle.pbDisplay(_INTL("But it failed!"))
  1544. return -1
  1545. end
  1546. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1547. attacker.pbReduceHP((attacker.totalhp/2).floor)
  1548. if attacker.hasWorkingAbility(:CONTRARY)
  1549. attacker.stages[PBStats::ATTACK]=-6
  1550. @battle.pbCommonAnimation("StatDown",attacker,nil)
  1551. @battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",attacker.pbThis))
  1552. else
  1553. attacker.stages[PBStats::ATTACK]=6
  1554. @battle.pbCommonAnimation("StatUp",attacker,nil)
  1555. @battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",attacker.pbThis))
  1556. end
  1557. return 0
  1558. end
  1559. end
  1560.  
  1561.  
  1562.  
  1563. ################################################################################
  1564. # Decreases the user's Attack and Defense by 1 stage each. (Superpower)
  1565. ################################################################################
  1566. class PokeBattle_Move_03B < PokeBattle_Move
  1567. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1568. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1569. if opponent.damagestate.calcdamage>0
  1570. showanim=true
  1571. if attacker.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1572. attacker.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1573. showanim=false
  1574. end
  1575. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1576. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1577. showanim=false
  1578. end
  1579. end
  1580. return ret
  1581. end
  1582. end
  1583.  
  1584.  
  1585.  
  1586. ################################################################################
  1587. # Decreases the user's Defense and Special Defense by 1 stage each. (Close Combat)
  1588. ################################################################################
  1589. class PokeBattle_Move_03C < PokeBattle_Move
  1590. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1591. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1592. if opponent.damagestate.calcdamage>0
  1593. showanim=true
  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. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1599. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1600. showanim=false
  1601. end
  1602. end
  1603. return ret
  1604. end
  1605. end
  1606.  
  1607.  
  1608.  
  1609. ################################################################################
  1610. # Decreases the user's Defense, Special Defense and Speed by 1 stage each.
  1611. # User's ally loses 1/16 of its total HP. (V-create)
  1612. ################################################################################
  1613. class PokeBattle_Move_03D < PokeBattle_Move
  1614. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1615. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1616. if opponent.damagestate.calcdamage>0
  1617. if attacker.pbPartner && !attacker.pbPartner.isFainted?
  1618. attacker.pbPartner.pbReduceHP((attacker.pbPartner.totalhp/16).floor,true)
  1619. end
  1620. showanim=true
  1621. if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1622. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1623. showanim=false
  1624. end
  1625. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1626. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1627. showanim=false
  1628. end
  1629. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1630. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1631. showanim=false
  1632. end
  1633. end
  1634. return ret
  1635. end
  1636. end
  1637.  
  1638.  
  1639.  
  1640. ################################################################################
  1641. # Decreases the user's Speed by 1 stage.
  1642. ################################################################################
  1643. class PokeBattle_Move_03E < PokeBattle_Move
  1644. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1645. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1646. if opponent.damagestate.calcdamage>0
  1647. if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1648. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1649. end
  1650. end
  1651. return ret
  1652. end
  1653. end
  1654.  
  1655.  
  1656.  
  1657. ################################################################################
  1658. # Decreases the user's Special Attack by 2 stages.
  1659. ################################################################################
  1660. class PokeBattle_Move_03F < PokeBattle_Move
  1661. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1662. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1663. if opponent.damagestate.calcdamage>0
  1664. if attacker.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1665. attacker.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  1666. end
  1667. end
  1668. return ret
  1669. end
  1670. end
  1671.  
  1672.  
  1673.  
  1674. ################################################################################
  1675. # Increases the target's Special Attack by 1 stage. Confuses the target. (Flatter)
  1676. ################################################################################
  1677. class PokeBattle_Move_040 < PokeBattle_Move
  1678. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1679. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1680. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1681. return -1
  1682. end
  1683. ret=-1
  1684. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1685. if opponent.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1686. opponent.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  1687. ret=0
  1688. end
  1689. if opponent.pbCanConfuse?(attacker,true,self)
  1690. opponent.pbConfuse
  1691. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1692. ret=0
  1693. end
  1694. return ret
  1695. end
  1696. end
  1697.  
  1698.  
  1699.  
  1700. ################################################################################
  1701. # Increases the target's Attack by 2 stages. Confuses the target. (Swagger)
  1702. ################################################################################
  1703. class PokeBattle_Move_041 < PokeBattle_Move
  1704. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1705. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1706. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1707. return -1
  1708. end
  1709. ret=-1
  1710. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1711. if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1712. opponent.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1713. ret=0
  1714. end
  1715. if opponent.pbCanConfuse?(attacker,true,self)
  1716. opponent.pbConfuse
  1717. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1718. ret=0
  1719. end
  1720. return ret
  1721. end
  1722. end
  1723.  
  1724.  
  1725.  
  1726. ################################################################################
  1727. # Decreases the target's Attack by 1 stage.
  1728. ################################################################################
  1729. class PokeBattle_Move_042 < PokeBattle_Move
  1730. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1731. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1732. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  1733. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1734. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1735. return ret ? 0 : -1
  1736. end
  1737.  
  1738. def pbAdditionalEffect(attacker,opponent)
  1739. return if opponent.damagestate.substitute
  1740. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1741. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1742. end
  1743. end
  1744. end
  1745.  
  1746.  
  1747.  
  1748. ################################################################################
  1749. # Decreases the target's Defense by 1 stage.
  1750. ################################################################################
  1751. class PokeBattle_Move_043 < PokeBattle_Move
  1752. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1753. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1754. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  1755. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1756. ret=opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1757. return ret ? 0 : -1
  1758. end
  1759.  
  1760. def pbAdditionalEffect(attacker,opponent)
  1761. return if opponent.damagestate.substitute
  1762. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1763. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1764. end
  1765. end
  1766. end
  1767.  
  1768.  
  1769.  
  1770. ################################################################################
  1771. # Decreases the target's Speed by 1 stage.
  1772. ################################################################################
  1773. class PokeBattle_Move_044 < PokeBattle_Move
  1774. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1775. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1776. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  1777. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1778. ret=opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1779. return ret ? 0 : -1
  1780. end
  1781.  
  1782. def pbAdditionalEffect(attacker,opponent)
  1783. return if opponent.damagestate.substitute
  1784. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1785. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1786. end
  1787. end
  1788.  
  1789. def pbModifyDamage(damagemult,attacker,opponent)
  1790. if isConst?(@id,PBMoves,:BULLDOZE) &&
  1791. @battle.field.effects[PBEffects::GrassyTerrain]>0
  1792. return (damagemult/2.0).round
  1793. end
  1794. return damagemult
  1795. end
  1796. end
  1797.  
  1798.  
  1799.  
  1800. ################################################################################
  1801. # Decreases the target's Special Attack by 1 stage.
  1802. ################################################################################
  1803. class PokeBattle_Move_045 < PokeBattle_Move
  1804. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1805. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1806. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  1807. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1808. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1809. return ret ? 0 : -1
  1810. end
  1811.  
  1812. def pbAdditionalEffect(attacker,opponent)
  1813. return if opponent.damagestate.substitute
  1814. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1815. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1816. end
  1817. end
  1818. end
  1819.  
  1820.  
  1821.  
  1822. ################################################################################
  1823. # Decreases the target's Special Defense by 1 stage.
  1824. ################################################################################
  1825. class PokeBattle_Move_046 < PokeBattle_Move
  1826. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1827. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1828. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  1829. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1830. ret=opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1831. return ret ? 0 : -1
  1832. end
  1833.  
  1834. def pbAdditionalEffect(attacker,opponent)
  1835. return if opponent.damagestate.substitute
  1836. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1837. opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1838. end
  1839. end
  1840. end
  1841.  
  1842.  
  1843.  
  1844. ################################################################################
  1845. # Decreases the target's accuracy by 1 stage.
  1846. ################################################################################
  1847. class PokeBattle_Move_047 < PokeBattle_Move
  1848. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1849. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1850. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,true,self)
  1851. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1852. ret=opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1853. return ret ? 0 : -1
  1854. end
  1855.  
  1856. def pbAdditionalEffect(attacker,opponent)
  1857. return if opponent.damagestate.substitute
  1858. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  1859. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1860. end
  1861. end
  1862. end
  1863.  
  1864.  
  1865.  
  1866. ################################################################################
  1867. # Decreases the target's evasion by 1 stage OR 2 stages. (Sweet Scent)
  1868. ################################################################################
  1869. class PokeBattle_Move_048 < PokeBattle_Move
  1870. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1871. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1872. return -1 if !opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,true,self)
  1873. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1874. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1875. ret=opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1876. return ret ? 0 : -1
  1877. end
  1878.  
  1879. def pbAdditionalEffect(attacker,opponent)
  1880. return if opponent.damagestate.substitute
  1881. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1882. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1883. opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1884. end
  1885. end
  1886. end
  1887.  
  1888.  
  1889.  
  1890. ################################################################################
  1891. # Decreases the target's evasion by 1 stage. Ends all barriers and entry
  1892. # hazards for the target's side OR on both sides. (Defog)
  1893. ################################################################################
  1894. class PokeBattle_Move_049 < PokeBattle_Move
  1895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1896. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1897. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1898. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1899. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1900. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1901. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1902. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1903. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1904. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1905. opponent.pbOwnSide.effects[PBEffects::StickyWeb] = false
  1906. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1907. if USENEWBATTLEMECHANICS
  1908. opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
  1909. opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1910. opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
  1911. opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
  1912. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1913. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1914. opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = false
  1915. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1916. end
  1917. return 0
  1918. end
  1919.  
  1920. def pbAdditionalEffect(attacker,opponent)
  1921. if !opponent.damagestate.substitute
  1922. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1923. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1924. end
  1925. end
  1926. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1927. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1928. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1929. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1930. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1931. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1932. opponent.pbOwnSide.effects[PBEffects::StickyWeb] = false
  1933. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1934. if USENEWBATTLEMECHANICS
  1935. opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
  1936. opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1937. opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
  1938. opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
  1939. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1940. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1941. opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = false
  1942. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1943. end
  1944. end
  1945. end
  1946.  
  1947.  
  1948.  
  1949. ################################################################################
  1950. # Decreases the target's Attack and Defense by 1 stage each. (Tickle)
  1951. ################################################################################
  1952. class PokeBattle_Move_04A < PokeBattle_Move
  1953. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1954. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  1955. # multiple times
  1956. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1957. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1958. return -1
  1959. end
  1960. if opponent.pbTooLow?(PBStats::ATTACK) &&
  1961. opponent.pbTooLow?(PBStats::DEFENSE)
  1962. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  1963. return -1
  1964. end
  1965. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  1966. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  1967. return -1
  1968. end
  1969. if !attacker.hasMoldBreaker
  1970. if opponent.hasWorkingAbility(:CLEARBODY) ||
  1971. opponent.hasWorkingAbility(:WHITESMOKE)
  1972. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  1973. PBAbilities.getName(opponent.ability)))
  1974. return -1
  1975. end
  1976. end
  1977. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1978. ret=-1; showanim=true
  1979. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER) &&
  1980. !opponent.pbTooLow?(PBStats::ATTACK)
  1981. abilityname=PBAbilities.getName(opponent.ability)
  1982. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  1983. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1984. ret=0; showanim=false
  1985. end
  1986. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:BIGPECKS) &&
  1987. !opponent.pbTooLow?(PBStats::DEFENSE)
  1988. abilityname=PBAbilities.getName(opponent.ability)
  1989. @battle.pbDisplay(_INTL("{1}'s {2} prevents Defense loss!",opponent.pbThis,abilityname))
  1990. elsif opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1991. ret=0; showanim=false
  1992. end
  1993. return ret
  1994. end
  1995. end
  1996.  
  1997.  
  1998.  
  1999. ################################################################################
  2000. # Decreases the target's Attack by 2 stages.
  2001. ################################################################################
  2002. class PokeBattle_Move_04B < PokeBattle_Move
  2003. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2004. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2005. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  2006. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2007. ret=opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2008. return ret ? 0 : -1
  2009. end
  2010.  
  2011. def pbAdditionalEffect(attacker,opponent)
  2012. return if opponent.damagestate.substitute
  2013. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  2014. opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2015. end
  2016. end
  2017. end
  2018.  
  2019.  
  2020.  
  2021. ################################################################################
  2022. # Decreases the target's Defense by 2 stages. (Screech)
  2023. ################################################################################
  2024. class PokeBattle_Move_04C < PokeBattle_Move
  2025. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2026. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2027. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  2028. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2029. ret=opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2030. return ret ? 0 : -1
  2031. end
  2032.  
  2033. def pbAdditionalEffect(attacker,opponent)
  2034. return if opponent.damagestate.substitute
  2035. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  2036. opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2037. end
  2038. end
  2039. end
  2040.  
  2041.  
  2042.  
  2043. ################################################################################
  2044. # Decreases the target's Speed by 2 stages. (Cotton Spore, Scary Face, String Shot)
  2045. ################################################################################
  2046. class PokeBattle_Move_04D < PokeBattle_Move
  2047. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2048. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2049. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2050. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  2051. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2052. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2053. ret=opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2054. return ret ? 0 : -1
  2055. end
  2056.  
  2057. def pbAdditionalEffect(attacker,opponent)
  2058. return if opponent.damagestate.substitute
  2059. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  2060. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2061. opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2062. end
  2063. end
  2064. end
  2065.  
  2066.  
  2067.  
  2068. ################################################################################
  2069. # Decreases the target's Special Attack by 2 stages. Only works on the opposite
  2070. # gender. (Captivate)
  2071. ################################################################################
  2072. class PokeBattle_Move_04E < PokeBattle_Move
  2073. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2074. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2075. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  2076. if attacker.gender==2 || opponent.gender==2 || attacker.gender==opponent.gender
  2077. @battle.pbDisplay(_INTL("But it failed!"))
  2078. return -1
  2079. end
  2080. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS)
  2081. @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",opponent.pbThis,
  2082. PBAbilities.getName(opponent.ability)))
  2083. return -1
  2084. end
  2085. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2086. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2087. return ret ? 0 : -1
  2088. end
  2089.  
  2090. def pbAdditionalEffect(attacker,opponent)
  2091. return if opponent.damagestate.substitute
  2092. if attacker.gender!=2 && opponent.gender!=2 && attacker.gender!=opponent.gender
  2093. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:OBLIVIOUS)
  2094. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  2095. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2096. end
  2097. end
  2098. end
  2099. end
  2100. end
  2101.  
  2102.  
  2103.  
  2104. ################################################################################
  2105. # Decreases the target's Special Defense by 2 stages.
  2106. ################################################################################
  2107. class PokeBattle_Move_04F < PokeBattle_Move
  2108. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2109. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2110. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  2111. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2112. ret=opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2113. return ret ? 0 : -1
  2114. end
  2115.  
  2116. def pbAdditionalEffect(attacker,opponent)
  2117. return if opponent.damagestate.substitute
  2118. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  2119. opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2120. end
  2121. end
  2122. end
  2123.  
  2124.  
  2125.  
  2126. ################################################################################
  2127. # Resets all target's stat stages to 0. (Clear Smog)
  2128. ################################################################################
  2129. class PokeBattle_Move_050 < PokeBattle_Move
  2130. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2131. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  2132. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  2133. opponent.stages[PBStats::ATTACK] = 0
  2134. opponent.stages[PBStats::DEFENSE] = 0
  2135. opponent.stages[PBStats::SPEED] = 0
  2136. opponent.stages[PBStats::SPATK] = 0
  2137. opponent.stages[PBStats::SPDEF] = 0
  2138. opponent.stages[PBStats::ACCURACY] = 0
  2139. opponent.stages[PBStats::EVASION] = 0
  2140. @battle.pbDisplay(_INTL("{1}'s stat changes were removed!",opponent.pbThis))
  2141. end
  2142. return ret
  2143. end
  2144. end
  2145.  
  2146.  
  2147.  
  2148. ################################################################################
  2149. # Resets all stat stages for all battlers to 0. (Haze)
  2150. ################################################################################
  2151. class PokeBattle_Move_051 < PokeBattle_Move
  2152. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2153. for i in 0...4
  2154. @battle.battlers[i].stages[PBStats::ATTACK] = 0
  2155. @battle.battlers[i].stages[PBStats::DEFENSE] = 0
  2156. @battle.battlers[i].stages[PBStats::SPEED] = 0
  2157. @battle.battlers[i].stages[PBStats::SPATK] = 0
  2158. @battle.battlers[i].stages[PBStats::SPDEF] = 0
  2159. @battle.battlers[i].stages[PBStats::ACCURACY] = 0
  2160. @battle.battlers[i].stages[PBStats::EVASION] = 0
  2161. end
  2162. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2163. @battle.pbDisplay(_INTL("All stat changes were eliminated!"))
  2164. return 0
  2165. end
  2166. end
  2167.  
  2168.  
  2169.  
  2170. ################################################################################
  2171. # User and target swap their Attack and Special Attack stat stages. (Power Swap)
  2172. ################################################################################
  2173. class PokeBattle_Move_052 < PokeBattle_Move
  2174. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2175. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2176. astage=attacker.stages
  2177. ostage=opponent.stages
  2178. astage[PBStats::ATTACK],ostage[PBStats::ATTACK]=ostage[PBStats::ATTACK],astage[PBStats::ATTACK]
  2179. astage[PBStats::SPATK],ostage[PBStats::SPATK]=ostage[PBStats::SPATK],astage[PBStats::SPATK]
  2180. @battle.pbDisplay(_INTL("{1} switched all changes to its Attack and Sp. Atk with the target!",attacker.pbThis))
  2181. return 0
  2182. end
  2183. end
  2184.  
  2185.  
  2186.  
  2187. ################################################################################
  2188. # User and target swap their Defense and Special Defense stat stages. (Guard Swap)
  2189. ################################################################################
  2190. class PokeBattle_Move_053 < PokeBattle_Move
  2191. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2192. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2193. astage=attacker.stages
  2194. ostage=opponent.stages
  2195. astage[PBStats::DEFENSE],ostage[PBStats::DEFENSE]=ostage[PBStats::DEFENSE],astage[PBStats::DEFENSE]
  2196. astage[PBStats::SPDEF],ostage[PBStats::SPDEF]=ostage[PBStats::SPDEF],astage[PBStats::SPDEF]
  2197. @battle.pbDisplay(_INTL("{1} switched all changes to its Defense and Sp. Def with the target!",attacker.pbThis))
  2198. return 0
  2199. end
  2200. end
  2201.  
  2202.  
  2203.  
  2204. ################################################################################
  2205. # User and target swap all their stat stages. (Heart Swap)
  2206. ################################################################################
  2207. class PokeBattle_Move_054 < PokeBattle_Move
  2208. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2209. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2210. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2211. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2212. attacker.stages[i],opponent.stages[i]=opponent.stages[i],attacker.stages[i]
  2213. end
  2214. @battle.pbDisplay(_INTL("{1} switched stat changes with the target!",attacker.pbThis))
  2215. return 0
  2216. end
  2217. end
  2218.  
  2219.  
  2220.  
  2221. ################################################################################
  2222. # User copies the target's stat stages. (Psych Up)
  2223. ################################################################################
  2224. class PokeBattle_Move_055 < PokeBattle_Move
  2225. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2226. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2227. @battle.pbDisplay(_INTL("But it failed!"))
  2228. return -1
  2229. end
  2230. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2231. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2232. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2233. attacker.stages[i]=opponent.stages[i]
  2234. end
  2235. @battle.pbDisplay(_INTL("{1} copied {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  2236. return 0
  2237. end
  2238. end
  2239.  
  2240.  
  2241.  
  2242. ################################################################################
  2243. # For 5 rounds, user's and ally's stat stages cannot be lowered by foes. (Mist)
  2244. ################################################################################
  2245. class PokeBattle_Move_056 < PokeBattle_Move
  2246. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2247. if attacker.pbOwnSide.effects[PBEffects::Mist]>0
  2248. @battle.pbDisplay(_INTL("But it failed!"))
  2249. return -1
  2250. end
  2251. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2252. attacker.pbOwnSide.effects[PBEffects::Mist]=5
  2253. if !@battle.pbIsOpposing?(attacker.index)
  2254. @battle.pbDisplay(_INTL("Your team became shrouded in mist!"))
  2255. else
  2256. @battle.pbDisplay(_INTL("The opposing team became shrouded in mist!"))
  2257. end
  2258. return 0
  2259. end
  2260. end
  2261.  
  2262.  
  2263.  
  2264. ################################################################################
  2265. # Swaps the user's Attack and Defense stats. (Power Trick)
  2266. ################################################################################
  2267. class PokeBattle_Move_057 < PokeBattle_Move
  2268. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2269. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2270. attacker.attack,attacker.defense=attacker.defense,attacker.attack
  2271. attacker.effects[PBEffects::PowerTrick]=!attacker.effects[PBEffects::PowerTrick]
  2272. @battle.pbDisplay(_INTL("{1} switched its Attack and Defense!",attacker.pbThis))
  2273. return 0
  2274. end
  2275. end
  2276.  
  2277.  
  2278.  
  2279. ################################################################################
  2280. # Averages the user's and target's Attack.
  2281. # Averages the user's and target's Special Attack. (Power Split)
  2282. ################################################################################
  2283. class PokeBattle_Move_058 < PokeBattle_Move
  2284. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2285. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2286. @battle.pbDisplay(_INTL("But it failed!"))
  2287. return -1
  2288. end
  2289. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2290. avatk=((attacker.attack+opponent.attack)/2).floor
  2291. avspatk=((attacker.spatk+opponent.spatk)/2).floor
  2292. attacker.attack=opponent.attack=avatk
  2293. attacker.spatk=opponent.spatk=avspatk
  2294. @battle.pbDisplay(_INTL("{1} shared its power with the target!",attacker.pbThis))
  2295. return 0
  2296. end
  2297. end
  2298.  
  2299.  
  2300.  
  2301. ################################################################################
  2302. # Averages the user's and target's Defense.
  2303. # Averages the user's and target's Special Defense. (Guard Split)
  2304. ################################################################################
  2305. class PokeBattle_Move_059 < 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. avdef=((attacker.defense+opponent.defense)/2).floor
  2313. avspdef=((attacker.spdef+opponent.spdef)/2).floor
  2314. attacker.defense=opponent.defense=avdef
  2315. attacker.spdef=opponent.spdef=avspdef
  2316. @battle.pbDisplay(_INTL("{1} shared its guard with the target!",attacker.pbThis))
  2317. return 0
  2318. end
  2319. end
  2320.  
  2321.  
  2322.  
  2323. ################################################################################
  2324. # Averages the user's and target's current HP. (Pain Split)
  2325. ################################################################################
  2326. class PokeBattle_Move_05A < PokeBattle_Move
  2327. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2328. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2329. @battle.pbDisplay(_INTL("But it failed!"))
  2330. return -1
  2331. end
  2332. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2333. olda=attacker.hp
  2334. oldo=opponent.hp
  2335. avhp=((attacker.hp+opponent.hp)/2).floor
  2336. attacker.hp=[avhp,attacker.totalhp].min
  2337. opponent.hp=[avhp,opponent.totalhp].min
  2338. @battle.scene.pbHPChanged(attacker,olda)
  2339. @battle.scene.pbHPChanged(opponent,oldo)
  2340. @battle.pbDisplay(_INTL("The battlers shared their pain!"))
  2341. return 0
  2342. end
  2343. end
  2344.  
  2345.  
  2346.  
  2347. ################################################################################
  2348. # For 4 rounds, doubles the Speed of all battlers on the user's side. (Tailwind)
  2349. ################################################################################
  2350. class PokeBattle_Move_05B < PokeBattle_Move
  2351. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2352. if attacker.pbOwnSide.effects[PBEffects::Tailwind]>0
  2353. @battle.pbDisplay(_INTL("But it failed!"))
  2354. return -1
  2355. end
  2356. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2357. attacker.pbOwnSide.effects[PBEffects::Tailwind]=4
  2358. if !@battle.pbIsOpposing?(attacker.index)
  2359. @battle.pbDisplay(_INTL("The tailwind blew from behind your team!"))
  2360. else
  2361. @battle.pbDisplay(_INTL("The tailwind blew from behind the opposing team!"))
  2362. end
  2363. return 0
  2364. end
  2365. end
  2366.  
  2367.  
  2368.  
  2369. ################################################################################
  2370. # This move turns into the last move used by the target, until user switches
  2371. # out. (Mimic)
  2372. ################################################################################
  2373. class PokeBattle_Move_05C < PokeBattle_Move
  2374. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2375. blacklist=[
  2376. 0x02, # Struggle
  2377. 0x14, # Chatter
  2378. 0x5C, # Mimic
  2379. 0x5D, # Sketch
  2380. 0xB6 # Metronome
  2381. ]
  2382. if attacker.effects[PBEffects::Transform] ||
  2383. opponent.lastMoveUsed<=0 ||
  2384. isConst?(PBMoveData.new(opponent.lastMoveUsed).type,PBTypes,:SHADOW) ||
  2385. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  2386. @battle.pbDisplay(_INTL("But it failed!"))
  2387. return -1
  2388. end
  2389. for i in attacker.moves
  2390. if i.id==opponent.lastMoveUsed
  2391. @battle.pbDisplay(_INTL("But it failed!"))
  2392. return -1
  2393. end
  2394. end
  2395. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2396. for i in 0...attacker.moves.length
  2397. if attacker.moves[i].id==@id
  2398. newmove=PBMove.new(opponent.lastMoveUsed)
  2399. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2400. movename=PBMoves.getName(opponent.lastMoveUsed)
  2401. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2402. return 0
  2403. end
  2404. end
  2405. @battle.pbDisplay(_INTL("But it failed!"))
  2406. return -1
  2407. end
  2408. end
  2409.  
  2410.  
  2411.  
  2412. ################################################################################
  2413. # This move permanently turns into the last move used by the target. (Sketch)
  2414. ################################################################################
  2415. class PokeBattle_Move_05D < PokeBattle_Move
  2416. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2417. blacklist=[
  2418. 0x02, # Struggle
  2419. 0x14, # Chatter
  2420. 0x5D # Sketch
  2421. ]
  2422. if attacker.effects[PBEffects::Transform] ||
  2423. opponent.lastMoveUsedSketch<=0 ||
  2424. isConst?(PBMoveData.new(opponent.lastMoveUsedSketch).type,PBTypes,:SHADOW) ||
  2425. blacklist.include?(PBMoveData.new(opponent.lastMoveUsedSketch).function)
  2426. @battle.pbDisplay(_INTL("But it failed!"))
  2427. return -1
  2428. end
  2429. for i in attacker.moves
  2430. if i.id==opponent.lastMoveUsedSketch
  2431. @battle.pbDisplay(_INTL("But it failed!"))
  2432. return -1
  2433. end
  2434. end
  2435. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2436. @battle.pbDisplay(_INTL("But it failed!"))
  2437. return -1
  2438. end
  2439. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2440. for i in 0...attacker.moves.length
  2441. if attacker.moves[i].id==@id
  2442. newmove=PBMove.new(opponent.lastMoveUsedSketch)
  2443. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2444. party=@battle.pbParty(attacker.index)
  2445. party[attacker.pokemonIndex].moves[i]=newmove
  2446. movename=PBMoves.getName(opponent.lastMoveUsedSketch)
  2447. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2448. return 0
  2449. end
  2450. end
  2451. @battle.pbDisplay(_INTL("But it failed!"))
  2452. return -1
  2453. end
  2454. end
  2455.  
  2456.  
  2457.  
  2458. ################################################################################
  2459. # Changes user's type to that of a random user's move, except this one, OR the
  2460. # user's first move's type. (Conversion)
  2461. ################################################################################
  2462. class PokeBattle_Move_05E < PokeBattle_Move
  2463. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2464. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2465. @battle.pbDisplay(_INTL("But it failed!"))
  2466. return -1
  2467. end
  2468. types=[]
  2469. for i in attacker.moves
  2470. next if i.id==@id
  2471. next if PBTypes.isPseudoType?(i.type)
  2472. next if attacker.pbHasType?(i.type)
  2473. if !types.include?(i.type)
  2474. types.push(i.type)
  2475. break if USENEWBATTLEMECHANICS
  2476. end
  2477. end
  2478. if types.length==0
  2479. @battle.pbDisplay(_INTL("But it failed!"))
  2480. return -1
  2481. end
  2482. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2483. newtype=types[@battle.pbRandom(types.length)]
  2484. attacker.type1=newtype
  2485. attacker.type2=newtype
  2486. attacker.effects[PBEffects::Type3]=-1
  2487. typename=PBTypes.getName(newtype)
  2488. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2489. end
  2490. end
  2491.  
  2492.  
  2493.  
  2494. ################################################################################
  2495. # Changes user's type to a random one that resists/is immune to the last move
  2496. # used by the target. (Conversion 2)
  2497. ################################################################################
  2498. class PokeBattle_Move_05F < PokeBattle_Move
  2499. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2500. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2501. @battle.pbDisplay(_INTL("But it failed!"))
  2502. return -1
  2503. end
  2504. if opponent.lastMoveUsed<=0 ||
  2505. PBTypes.isPseudoType?(PBMoveData.new(opponent.lastMoveUsed).type)
  2506. @battle.pbDisplay(_INTL("But it failed!"))
  2507. return -1
  2508. end
  2509. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2510. @battle.pbDisplay(_INTL("But it failed!"))
  2511. return -1
  2512. end
  2513. types=[]
  2514. atype=opponent.lastMoveUsedType
  2515. if atype<0
  2516. @battle.pbDisplay(_INTL("But it failed!"))
  2517. return -1
  2518. end
  2519. for i in 0..PBTypes.maxValue
  2520. next if PBTypes.isPseudoType?(i)
  2521. next if attacker.pbHasType?(i)
  2522. types.push(i) if PBTypes.getEffectiveness(atype,i)<2
  2523. end
  2524. if types.length==0
  2525. @battle.pbDisplay(_INTL("But it failed!"))
  2526. return -1
  2527. end
  2528. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2529. newtype=types[@battle.pbRandom(types.length)]
  2530. attacker.type1=newtype
  2531. attacker.type2=newtype
  2532. attacker.effects[PBEffects::Type3]=-1
  2533. typename=PBTypes.getName(newtype)
  2534. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2535. return 0
  2536. end
  2537. end
  2538.  
  2539.  
  2540.  
  2541. ################################################################################
  2542. # Changes user's type depending on the environment. (Camouflage)
  2543. ################################################################################
  2544. class PokeBattle_Move_060 < PokeBattle_Move
  2545. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2546. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2547. @battle.pbDisplay(_INTL("But it failed!"))
  2548. return -1
  2549. end
  2550. type=getConst(PBTypes,:NORMAL) || 0
  2551. case @battle.environment
  2552. when PBEnvironment::None; type=getConst(PBTypes,:NORMAL) || 0
  2553. when PBEnvironment::Grass; type=getConst(PBTypes,:GRASS) || 0
  2554. when PBEnvironment::TallGrass; type=getConst(PBTypes,:GRASS) || 0
  2555. when PBEnvironment::MovingWater; type=getConst(PBTypes,:WATER) || 0
  2556. when PBEnvironment::StillWater; type=getConst(PBTypes,:WATER) || 0
  2557. when PBEnvironment::Underwater; type=getConst(PBTypes,:WATER) || 0
  2558. when PBEnvironment::Cave; type=getConst(PBTypes,:ROCK) || 0
  2559. when PBEnvironment::Rock; type=getConst(PBTypes,:GROUND) || 0
  2560. when PBEnvironment::Sand; type=getConst(PBTypes,:GROUND) || 0
  2561. when PBEnvironment::Forest; type=getConst(PBTypes,:BUG) || 0
  2562. when PBEnvironment::Snow; type=getConst(PBTypes,:ICE) || 0
  2563. when PBEnvironment::Volcano; type=getConst(PBTypes,:FIRE) || 0
  2564. when PBEnvironment::Graveyard; type=getConst(PBTypes,:GHOST) || 0
  2565. when PBEnvironment::Sky; type=getConst(PBTypes,:FLYING) || 0
  2566. when PBEnvironment::Space; type=getConst(PBTypes,:DRAGON) || 0
  2567. end
  2568. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  2569. type=getConst(PBTypes,:ELECTRIC) if hasConst?(PBTypes,:ELECTRIC)
  2570. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  2571. type=getConst(PBTypes,:GRASS) if hasConst?(PBTypes,:GRASS)
  2572. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  2573. type=getConst(PBTypes,:FAIRY) if hasConst?(PBTypes,:FAIRY)
  2574. end
  2575. if attacker.pbHasType?(type)
  2576. @battle.pbDisplay(_INTL("But it failed!"))
  2577. return -1
  2578. end
  2579. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2580. attacker.type1=type
  2581. attacker.type2=type
  2582. attacker.effects[PBEffects::Type3]=-1
  2583. typename=PBTypes.getName(type)
  2584. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2585. return 0
  2586. end
  2587. end
  2588.  
  2589.  
  2590.  
  2591. ################################################################################
  2592. # Target becomes Water type. (Soak)
  2593. ################################################################################
  2594. class PokeBattle_Move_061 < PokeBattle_Move
  2595. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2596. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2597. @battle.pbDisplay(_INTL("But it failed!"))
  2598. return -1
  2599. end
  2600. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2601. if isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  2602. @battle.pbDisplay(_INTL("But it failed!"))
  2603. return -1
  2604. end
  2605. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2606. if opponent.type1==getConst(PBTypes,:WATER) &&
  2607. opponent.type2==getConst(PBTypes,:WATER) &&
  2608. (opponent.effects[PBEffects::Type3]<0 ||
  2609. opponent.effects[PBEffects::Type3]==getConst(PBTypes,:WATER))
  2610. @battle.pbDisplay(_INTL("But it failed!"))
  2611. return -1
  2612. end
  2613. opponent.type1=getConst(PBTypes,:WATER)
  2614. opponent.type2=getConst(PBTypes,:WATER)
  2615. opponent.effects[PBEffects::Type3]=-1
  2616. typename=PBTypes.getName(getConst(PBTypes,:WATER))
  2617. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  2618. return 0
  2619. end
  2620. end
  2621.  
  2622.  
  2623.  
  2624. ################################################################################
  2625. # User copes target's types. (Reflect Type)
  2626. ################################################################################
  2627. class PokeBattle_Move_062 < PokeBattle_Move
  2628. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2629. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2630. @battle.pbDisplay(_INTL("But it failed!"))
  2631. return -1
  2632. end
  2633. if attacker.pbHasType?(opponent.type1) &&
  2634. attacker.pbHasType?(opponent.type2) &&
  2635. attacker.pbHasType?(opponent.effects[PBEffects::Type3]) &&
  2636. opponent.pbHasType?(attacker.type1) &&
  2637. opponent.pbHasType?(attacker.type2) &&
  2638. opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  2639. @battle.pbDisplay(_INTL("But it failed!"))
  2640. return -1
  2641. end
  2642. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2643. attacker.type1=opponent.type1
  2644. attacker.type2=opponent.type2
  2645. attacker.effects[PBEffects::Type3]=-1
  2646. @battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",attacker.pbThis,opponent.pbThis(true)))
  2647. return 0
  2648. end
  2649. end
  2650.  
  2651.  
  2652.  
  2653. ################################################################################
  2654. # Target's ability becomes Simple. (Simple Beam)
  2655. ################################################################################
  2656. class PokeBattle_Move_063 < PokeBattle_Move
  2657. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2658. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2659. @battle.pbDisplay(_INTL("But it failed!"))
  2660. return -1
  2661. end
  2662. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2663. isConst?(opponent.ability,PBAbilities,:SIMPLE) ||
  2664. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2665. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2666. @battle.pbDisplay(_INTL("But it failed!"))
  2667. return -1
  2668. end
  2669. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2670. oldabil=opponent.ability
  2671. opponent.ability=getConst(PBAbilities,:SIMPLE) || 0
  2672. abilityname=PBAbilities.getName(getConst(PBAbilities,:SIMPLE))
  2673. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2674. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2675. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2676. opponent.effects[PBEffects::Illusion]=nil
  2677. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2678. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2679. end
  2680. return 0
  2681. end
  2682. end
  2683.  
  2684.  
  2685.  
  2686. ################################################################################
  2687. # Target's ability becomes Insomnia. (Worry Seed)
  2688. ################################################################################
  2689. class PokeBattle_Move_064 < PokeBattle_Move
  2690. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2691. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2692. @battle.pbDisplay(_INTL("But it failed!"))
  2693. return -1
  2694. end
  2695. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2696. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2697. isConst?(opponent.ability,PBAbilities,:INSOMNIA) ||
  2698. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2699. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2700. @battle.pbDisplay(_INTL("But it failed!"))
  2701. return -1
  2702. end
  2703. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2704. oldabil=opponent.ability
  2705. opponent.ability=getConst(PBAbilities,:INSOMNIA) || 0
  2706. abilityname=PBAbilities.getName(getConst(PBAbilities,:INSOMNIA))
  2707. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2708. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2709. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2710. opponent.effects[PBEffects::Illusion]=nil
  2711. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2712. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2713. end
  2714. return 0
  2715. end
  2716. end
  2717.  
  2718.  
  2719.  
  2720. ################################################################################
  2721. # User copies target's ability. (Role Play)
  2722. ################################################################################
  2723. class PokeBattle_Move_065 < PokeBattle_Move
  2724. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2725. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2726. @battle.pbDisplay(_INTL("But it failed!"))
  2727. return -1
  2728. end
  2729. if opponent.ability==0 ||
  2730. attacker.ability==opponent.ability ||
  2731. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2732. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2733. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2734. isConst?(opponent.ability,PBAbilities,:FORECAST) ||
  2735. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2736. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2737. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2738. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2739. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2740. isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2741. isConst?(opponent.ability,PBAbilities,:ZENMODE)
  2742. @battle.pbDisplay(_INTL("But it failed!"))
  2743. return -1
  2744. end
  2745. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2746. oldabil=attacker.ability
  2747. attacker.ability=opponent.ability
  2748. abilityname=PBAbilities.getName(opponent.ability)
  2749. @battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),abilityname))
  2750. if attacker.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2751. PBDebug.log("[Ability triggered] #{attacker.pbThis}'s Illusion ended")
  2752. attacker.effects[PBEffects::Illusion]=nil
  2753. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  2754. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",attacker.pbThis,PBAbilities.getName(oldabil)))
  2755. end
  2756. return 0
  2757. end
  2758. end
  2759.  
  2760.  
  2761.  
  2762. ################################################################################
  2763. # Target copies user's ability. (Entrainment)
  2764. ################################################################################
  2765. class PokeBattle_Move_066 < PokeBattle_Move
  2766. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2767. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2768. @battle.pbDisplay(_INTL("But it failed!"))
  2769. return -1
  2770. end
  2771. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2772. @battle.pbDisplay(_INTL("But it failed!"))
  2773. return -1
  2774. end
  2775. if attacker.ability==0 ||
  2776. attacker.ability==opponent.ability ||
  2777. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2778. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2779. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2780. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2781. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2782. isConst?(opponent.ability,PBAbilities,:TRUANT) ||
  2783. isConst?(opponent.ability,PBAbilities,:ZENMODE) ||
  2784. isConst?(attacker.ability,PBAbilities,:FLOWERGIFT) ||
  2785. isConst?(attacker.ability,PBAbilities,:FORECAST) ||
  2786. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2787. isConst?(attacker.ability,PBAbilities,:IMPOSTER) ||
  2788. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2789. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2790. isConst?(attacker.ability,PBAbilities,:TRACE) ||
  2791. isConst?(attacker.ability,PBAbilities,:ZENMODE)
  2792. @battle.pbDisplay(_INTL("But it failed!"))
  2793. return -1
  2794. end
  2795. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2796. oldabil=opponent.ability
  2797. opponent.ability=attacker.ability
  2798. abilityname=PBAbilities.getName(attacker.ability)
  2799. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2800. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2801. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2802. opponent.effects[PBEffects::Illusion]=nil
  2803. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2804. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2805. end
  2806. return 0
  2807. end
  2808. end
  2809.  
  2810.  
  2811.  
  2812. ################################################################################
  2813. # User and target swap abilities. (Skill Swap)
  2814. ################################################################################
  2815. class PokeBattle_Move_067 < PokeBattle_Move
  2816. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2817. if (attacker.ability==0 && opponent.ability==0) ||
  2818. (attacker.ability==opponent.ability && !USENEWBATTLEMECHANICS) ||
  2819. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2820. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2821. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2822. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2823. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2824. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2825. isConst?(attacker.ability,PBAbilities,:WONDERGUARD) ||
  2826. isConst?(opponent.ability,PBAbilities,:WONDERGUARD)
  2827. @battle.pbDisplay(_INTL("But it failed!"))
  2828. return -1
  2829. end
  2830. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2831. tmp=attacker.ability
  2832. attacker.ability=opponent.ability
  2833. opponent.ability=tmp
  2834. @battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
  2835. attacker.pbThis,PBAbilities.getName(opponent.ability),
  2836. PBAbilities.getName(attacker.ability)))
  2837. attacker.pbAbilitiesOnSwitchIn(true)
  2838. opponent.pbAbilitiesOnSwitchIn(true)
  2839. return 0
  2840. end
  2841. end
  2842.  
  2843.  
  2844.  
  2845. ################################################################################
  2846. # Target's ability is negated. (Gastro Acid)
  2847. ################################################################################
  2848. class PokeBattle_Move_068 < PokeBattle_Move
  2849. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2850. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2851. @battle.pbDisplay(_INTL("But it failed!"))
  2852. return -1
  2853. end
  2854. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2855. isConst?(opponent.ability,PBAbilities,:STANCECHANGE)
  2856. @battle.pbDisplay(_INTL("But it failed!"))
  2857. return -1
  2858. end
  2859. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2860. oldabil=opponent.ability
  2861. opponent.effects[PBEffects::GastroAcid]=true
  2862. opponent.effects[PBEffects::Truant]=false
  2863. @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis))
  2864. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2865. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2866. opponent.effects[PBEffects::Illusion]=nil
  2867. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2868. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2869. end
  2870. return 0
  2871. end
  2872. end
  2873.  
  2874.  
  2875.  
  2876. ################################################################################
  2877. # User transforms into the target. (Transform)
  2878. ################################################################################
  2879. class PokeBattle_Move_069 < PokeBattle_Move
  2880. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2881. blacklist=[
  2882. 0xC9, # Fly
  2883. 0xCA, # Dig
  2884. 0xCB, # Dive
  2885. 0xCC, # Bounce
  2886. 0xCD, # Shadow Force
  2887. 0xCE, # Sky Drop
  2888. 0x14D # Phantom Force
  2889. ]
  2890. if attacker.effects[PBEffects::Transform] ||
  2891. opponent.effects[PBEffects::Transform] ||
  2892. opponent.effects[PBEffects::Illusion] ||
  2893. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  2894. opponent.effects[PBEffects::SkyDrop] ||
  2895. blacklist.include?(PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function)
  2896. @battle.pbDisplay(_INTL("But it failed!"))
  2897. return -1
  2898. end
  2899. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2900. @battle.pbDisplay(_INTL("But it failed!"))
  2901. return -1
  2902. end
  2903. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2904. attacker.effects[PBEffects::Transform]=true
  2905. attacker.type1=opponent.type1
  2906. attacker.type2=opponent.type2
  2907. attacker.effects[PBEffects::Type3]=-1
  2908. attacker.ability=opponent.ability
  2909. attacker.attack=opponent.attack
  2910. attacker.defense=opponent.defense
  2911. attacker.speed=opponent.speed
  2912. attacker.spatk=opponent.spatk
  2913. attacker.spdef=opponent.spdef
  2914. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2915. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2916. attacker.stages[i]=opponent.stages[i]
  2917. end
  2918. for i in 0...4
  2919. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(
  2920. @battle,PBMove.new(opponent.moves[i].id))
  2921. attacker.moves[i].pp=5
  2922. attacker.moves[i].totalpp=5
  2923. end
  2924. attacker.effects[PBEffects::Disable]=0
  2925. attacker.effects[PBEffects::DisableMove]=0
  2926. @battle.pbDisplay(_INTL("{1} transformed into {2}!",attacker.pbThis,opponent.pbThis(true)))
  2927. return 0
  2928. end
  2929. end
  2930.  
  2931.  
  2932.  
  2933. ################################################################################
  2934. # Inflicts a fixed 20HP damage. (SonicBoom)
  2935. ################################################################################
  2936. class PokeBattle_Move_06A < PokeBattle_Move
  2937. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2938. return pbEffectFixedDamage(20,attacker,opponent,hitnum,alltargets,showanimation)
  2939. end
  2940. end
  2941.  
  2942.  
  2943.  
  2944. ################################################################################
  2945. # Inflicts a fixed 40HP damage. (Dragon Rage)
  2946. ################################################################################
  2947. class PokeBattle_Move_06B < PokeBattle_Move
  2948. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2949. return pbEffectFixedDamage(40,attacker,opponent,hitnum,alltargets,showanimation)
  2950. end
  2951. end
  2952.  
  2953.  
  2954.  
  2955. ################################################################################
  2956. # Halves the target's current HP. (Super Fang)
  2957. ################################################################################
  2958. class PokeBattle_Move_06C < PokeBattle_Move
  2959. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2960. return pbEffectFixedDamage([(opponent.hp/2).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2961. end
  2962. end
  2963.  
  2964.  
  2965.  
  2966. ################################################################################
  2967. # Inflicts damage equal to the user's level. (Night Shade, Seismic Toss)
  2968. ################################################################################
  2969. class PokeBattle_Move_06D < PokeBattle_Move
  2970. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2971. return pbEffectFixedDamage(attacker.level,attacker,opponent,hitnum,alltargets,showanimation)
  2972. end
  2973. end
  2974.  
  2975.  
  2976.  
  2977. ################################################################################
  2978. # Inflicts damage to bring the target's HP down to equal the user's HP. (Endeavor)
  2979. ################################################################################
  2980. class PokeBattle_Move_06E < PokeBattle_Move
  2981. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2982. if attacker.hp>=opponent.hp
  2983. @battle.pbDisplay(_INTL("But it failed!"))
  2984. return -1
  2985. end
  2986. return pbEffectFixedDamage(opponent.hp-attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  2987. end
  2988. end
  2989.  
  2990.  
  2991.  
  2992. ################################################################################
  2993. # Inflicts damage between 0.5 and 1.5 times the user's level. (Psywave)
  2994. ################################################################################
  2995. class PokeBattle_Move_06F < PokeBattle_Move
  2996. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2997. dmg=[(attacker.level*(@battle.pbRandom(101)+50)/100).floor,1].max
  2998. return pbEffectFixedDamage(dmg,attacker,opponent,hitnum,alltargets,showanimation)
  2999. end
  3000. end
  3001.  
  3002.  
  3003.  
  3004. ################################################################################
  3005. # OHKO. Accuracy increases by difference between levels of user and target.
  3006. ################################################################################
  3007. class PokeBattle_Move_070 < PokeBattle_Move
  3008. def pbAccuracyCheck(attacker,opponent)
  3009. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STURDY)
  3010. @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3011. return false
  3012. end
  3013. if opponent.level>attacker.level
  3014. @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
  3015. return false
  3016. end
  3017. acc=@accuracy+attacker.level-opponent.level
  3018. return @battle.pbRandom(100)<acc
  3019. end
  3020.  
  3021. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3022. damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
  3023. if opponent.isFainted?
  3024. @battle.pbDisplay(_INTL("It's a one-hit KO!"))
  3025. end
  3026. return damage
  3027. end
  3028. end
  3029.  
  3030.  
  3031. ################################################################################
  3032. # Counters a physical move used against the user this round, with 2x the power. (Counter)
  3033. ################################################################################
  3034. class PokeBattle_Move_071 < PokeBattle_Move
  3035. def pbAddTarget(targets,attacker)
  3036. if attacker.effects[PBEffects::CounterTarget]>=0 &&
  3037. attacker.pbIsOpposing?(attacker.effects[PBEffects::CounterTarget])
  3038. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::CounterTarget]])
  3039. attacker.pbRandomTarget(targets)
  3040. end
  3041. end
  3042. end
  3043.  
  3044. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3045. if attacker.effects[PBEffects::Counter]<0 || !opponent
  3046. @battle.pbDisplay(_INTL("But it failed!"))
  3047. return -1
  3048. end
  3049. ret=pbEffectFixedDamage([attacker.effects[PBEffects::Counter]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3050. return ret
  3051. end
  3052. end
  3053.  
  3054.  
  3055.  
  3056. ################################################################################
  3057. # Counters a specical move used against the user this round, with 2x the power. (Mirror Coat)
  3058. ################################################################################
  3059. class PokeBattle_Move_072 < PokeBattle_Move
  3060. def pbAddTarget(targets,attacker)
  3061. if attacker.effects[PBEffects::MirrorCoatTarget]>=0 &&
  3062. attacker.pbIsOpposing?(attacker.effects[PBEffects::MirrorCoatTarget])
  3063. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::MirrorCoatTarget]])
  3064. attacker.pbRandomTarget(targets)
  3065. end
  3066. end
  3067. end
  3068.  
  3069. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3070. if attacker.effects[PBEffects::MirrorCoat]<0 || !opponent
  3071. @battle.pbDisplay(_INTL("But it failed!"))
  3072. return -1
  3073. end
  3074. ret=pbEffectFixedDamage([attacker.effects[PBEffects::MirrorCoat]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3075. return ret
  3076. end
  3077. end
  3078.  
  3079.  
  3080.  
  3081. ################################################################################
  3082. # Counters the last damaging move used against the user this round, with 1.5x
  3083. # the power. (Metal Burst)
  3084. ################################################################################
  3085. class PokeBattle_Move_073 < PokeBattle_Move
  3086. def pbAddTarget(targets,attacker)
  3087. if attacker.lastAttacker.length>0
  3088. lastattacker=attacker.lastAttacker[attacker.lastAttacker.length-1]
  3089. if lastattacker>=0 && attacker.pbIsOpposing?(lastattacker)
  3090. if !attacker.pbAddTarget(targets,@battle.battlers[lastattacker])
  3091. attacker.pbRandomTarget(targets)
  3092. end
  3093. end
  3094. end
  3095. end
  3096.  
  3097. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3098. if attacker.lastHPLost==0 || !opponent
  3099. @battle.pbDisplay(_INTL("But it failed!"))
  3100. return -1
  3101. end
  3102. ret=pbEffectFixedDamage([(attacker.lastHPLost*1.5).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3103. return ret
  3104. end
  3105. end
  3106.  
  3107.  
  3108.  
  3109. ################################################################################
  3110. # The target's ally loses 1/16 of its max HP. (Flame Burst)
  3111. ################################################################################
  3112. class PokeBattle_Move_074 < PokeBattle_Move
  3113. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3114. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3115. if opponent.damagestate.calcdamage>0
  3116. if opponent.pbPartner && !opponent.pbPartner.isFainted? &&
  3117. !opponent.pbPartner.hasWorkingAbility(:MAGICGUARD)
  3118. opponent.pbPartner.pbReduceHP((opponent.pbPartner.totalhp/16).floor)
  3119. @battle.pbDisplay(_INTL("The bursting flame hit {1}!",opponent.pbPartner.pbThis(true)))
  3120. end
  3121. end
  3122. return ret
  3123. end
  3124. end
  3125.  
  3126.  
  3127.  
  3128. ################################################################################
  3129. # Power is doubled if the target is using Dive. (Surf)
  3130. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3131. ################################################################################
  3132. class PokeBattle_Move_075 < PokeBattle_Move
  3133. def pbModifyDamage(damagemult,attacker,opponent)
  3134. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  3135. return (damagemult*2.0).round
  3136. end
  3137. return damagemult
  3138. end
  3139. end
  3140.  
  3141.  
  3142.  
  3143. ################################################################################
  3144. # Power is doubled if the target is using Dig. Power is halved if Grassy Terrain
  3145. # is in effect. (Earthquake)
  3146. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3147. ################################################################################
  3148. class PokeBattle_Move_076 < PokeBattle_Move
  3149. def pbModifyDamage(damagemult,attacker,opponent)
  3150. ret=damagemult
  3151. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3152. ret=(damagemult*2.0).round
  3153. end
  3154. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3155. ret=(damagemult/2.0).round
  3156. end
  3157. return ret
  3158. end
  3159. end
  3160.  
  3161.  
  3162.  
  3163. ################################################################################
  3164. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Gust)
  3165. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3166. ################################################################################
  3167. class PokeBattle_Move_077 < PokeBattle_Move
  3168. def pbBaseDamage(basedmg,attacker,opponent)
  3169. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3170. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3171. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3172. opponent.effects[PBEffects::SkyDrop]
  3173. return basedmg*2
  3174. end
  3175. return basedmg
  3176. end
  3177. end
  3178.  
  3179.  
  3180.  
  3181. ################################################################################
  3182. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Twister)
  3183. # May make the target flinch.
  3184. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3185. ################################################################################
  3186. class PokeBattle_Move_078 < PokeBattle_Move
  3187. def pbBaseDamage(basedmg,attacker,opponent)
  3188. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3189. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3190. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3191. opponent.effects[PBEffects::SkyDrop]
  3192. return basedmg*2
  3193. end
  3194. return basedmg
  3195. end
  3196.  
  3197. def pbAdditionalEffect(attacker,opponent)
  3198. return if opponent.damagestate.substitute
  3199. opponent.pbFlinch(attacker)
  3200. end
  3201. end
  3202.  
  3203.  
  3204.  
  3205. ################################################################################
  3206. # Power is doubled if Fusion Flare has already been used this round. (Fusion Bolt)
  3207. ################################################################################
  3208. class PokeBattle_Move_079 < PokeBattle_Move
  3209. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3210. if @battle.field.effects[PBEffects::FusionBolt]
  3211. @battle.field.effects[PBEffects::FusionBolt]=false
  3212. @doubled=true
  3213. return (damagemult*2.0).round
  3214. end
  3215. return damagemult
  3216. end
  3217.  
  3218. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3219. @doubled=false
  3220. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3221. if opponent.damagestate.calcdamage>0
  3222. @battle.field.effects[PBEffects::FusionFlare]=true
  3223. end
  3224. return ret
  3225. end
  3226.  
  3227. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3228. if opponent.damagestate.critical || @doubled
  3229. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3230. end
  3231. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3232. end
  3233. end
  3234.  
  3235.  
  3236.  
  3237. ################################################################################
  3238. # Power is doubled if Fusion Bolt has already been used this round. (Fusion Flare)
  3239. ################################################################################
  3240. class PokeBattle_Move_07A < PokeBattle_Move
  3241. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3242. if @battle.field.effects[PBEffects::FusionFlare]
  3243. @battle.field.effects[PBEffects::FusionFlare]=false
  3244. return (damagemult*2.0).round
  3245. end
  3246. return damagemult
  3247. end
  3248.  
  3249. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3250. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3251. if opponent.damagestate.calcdamage>0
  3252. @battle.field.effects[PBEffects::FusionBolt]=true
  3253. end
  3254. return ret
  3255. end
  3256.  
  3257. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3258. if opponent.damagestate.critical || @doubled
  3259. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3260. end
  3261. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3262. end
  3263. end
  3264.  
  3265.  
  3266.  
  3267. ################################################################################
  3268. # Power is doubled if the target is poisoned. (Venoshock)
  3269. ################################################################################
  3270. class PokeBattle_Move_07B < PokeBattle_Move
  3271. def pbBaseDamage(basedmg,attacker,opponent)
  3272. if opponent.status==PBStatuses::POISON &&
  3273. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3274. return basedmg*2
  3275. end
  3276. return basedmg
  3277. end
  3278. end
  3279.  
  3280.  
  3281.  
  3282. ################################################################################
  3283. # Power is doubled if the target is paralyzed. Cures the target of paralysis.
  3284. # (SmellingSalt)
  3285. ################################################################################
  3286. class PokeBattle_Move_07C < PokeBattle_Move
  3287. def pbBaseDamage(basedmg,attacker,opponent)
  3288. if opponent.status==PBStatuses::PARALYSIS &&
  3289. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3290. return basedmg*2
  3291. end
  3292. return basedmg
  3293. end
  3294.  
  3295. def pbEffectAfterHit(attacker,opponent,turneffects)
  3296. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  3297. !opponent.damagestate.substitute && opponent.status==PBStatuses::PARALYSIS
  3298. opponent.pbCureStatus
  3299. end
  3300. end
  3301. end
  3302.  
  3303.  
  3304.  
  3305. ################################################################################
  3306. # Power is doubled if the target is asleep. Wakes the target up. (Wake-Up Slap)
  3307. ################################################################################
  3308. class PokeBattle_Move_07D < PokeBattle_Move
  3309. def pbBaseDamage(basedmg,attacker,opponent)
  3310. if opponent.status==PBStatuses::SLEEP &&
  3311. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3312. return basedmg*2
  3313. end
  3314. return basedmg
  3315. end
  3316.  
  3317. def pbEffectAfterHit(attacker,opponent,turneffects)
  3318. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  3319. !opponent.damagestate.substitute && opponent.status==PBStatuses::SLEEP
  3320. opponent.pbCureStatus
  3321. end
  3322. end
  3323. end
  3324.  
  3325.  
  3326.  
  3327. ################################################################################
  3328. # Power is doubled if the user is burned, poisoned or paralyzed. (Facade)
  3329. ################################################################################
  3330. class PokeBattle_Move_07E < PokeBattle_Move
  3331. def pbBaseDamage(basedmg,attacker,opponent)
  3332. if attacker.status==PBStatuses::POISON ||
  3333. attacker.status==PBStatuses::BURN ||
  3334. attacker.status==PBStatuses::PARALYSIS
  3335. return basedmg*2
  3336. end
  3337. return basedmg
  3338. end
  3339. end
  3340.  
  3341.  
  3342.  
  3343. ################################################################################
  3344. # Power is doubled if the target has a status problem. (Hex)
  3345. ################################################################################
  3346. class PokeBattle_Move_07F < PokeBattle_Move
  3347. def pbBaseDamage(basedmg,attacker,opponent)
  3348. if opponent.status>0 &&
  3349. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3350. return basedmg*2
  3351. end
  3352. return basedmg
  3353. end
  3354. end
  3355.  
  3356.  
  3357.  
  3358. ################################################################################
  3359. # Power is doubled if the target's HP is down to 1/2 or less. (Brine)
  3360. ################################################################################
  3361. class PokeBattle_Move_080 < PokeBattle_Move
  3362. def pbBaseDamage(basedmg,attacker,opponent)
  3363. if opponent.hp<=opponent.totalhp/2
  3364. return basedmg*2
  3365. end
  3366. return basedmg
  3367. end
  3368. end
  3369.  
  3370.  
  3371.  
  3372. ################################################################################
  3373. # Power is doubled if the user has lost HP due to the target's move this round.
  3374. # (Revenge, Avalanche)
  3375. ################################################################################
  3376. class PokeBattle_Move_081 < PokeBattle_Move
  3377. def pbBaseDamage(basedmg,attacker,opponent)
  3378. if attacker.lastHPLost>0 && attacker.lastAttacker.include?(opponent.index)
  3379. return basedmg*2
  3380. end
  3381. return basedmg
  3382. end
  3383. end
  3384.  
  3385.  
  3386.  
  3387. ################################################################################
  3388. # Power is doubled if the target has already lost HP this round. (Assurance)
  3389. ################################################################################
  3390. class PokeBattle_Move_082 < PokeBattle_Move
  3391. def pbBaseDamage(basedmg,attacker,opponent)
  3392. if opponent.tookDamage
  3393. return basedmg*2
  3394. end
  3395. return basedmg
  3396. end
  3397. end
  3398.  
  3399.  
  3400.  
  3401. ################################################################################
  3402. # Power is doubled if a user's ally has already used this move this round. (Round)
  3403. # If an ally is about to use the same move, make it go next, ignoring priority.
  3404. ################################################################################
  3405. class PokeBattle_Move_083 < PokeBattle_Move
  3406. def pbBaseDamage(basedmg,attacker,opponent)
  3407. ret=basedmg
  3408. attacker.pbOwnSide.effects[PBEffects::Round].times do
  3409. ret*=2
  3410. end
  3411. return ret
  3412. end
  3413.  
  3414. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3415. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3416. if opponent.damagestate.calcdamage>0
  3417. attacker.pbOwnSide.effects[PBEffects::Round]+=1
  3418. if attacker.pbPartner && !attacker.pbPartner.hasMovedThisRound?
  3419. if @battle.choices[attacker.pbPartner.index][0]==1 # Will use a move
  3420. partnermove=@battle.choices[attacker.pbPartner.index][2]
  3421. if partnermove.function==@function
  3422. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  3423. attacker.pbPartner.effects[PBEffects::Quash]=false
  3424. end
  3425. end
  3426. end
  3427. end
  3428. return ret
  3429. end
  3430. end
  3431.  
  3432.  
  3433.  
  3434. ################################################################################
  3435. # Power is doubled if the target has already moved this round. (Payback)
  3436. ################################################################################
  3437. class PokeBattle_Move_084 < PokeBattle_Move
  3438. def pbBaseDamage(basedmg,attacker,opponent)
  3439. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3440. opponent.hasMovedThisRound? # Used a move already
  3441. return basedmg*2
  3442. end
  3443. return basedmg
  3444. end
  3445. end
  3446.  
  3447.  
  3448.  
  3449. ################################################################################
  3450. # Power is doubled if a user's teammate fainted last round. (Retaliate)
  3451. ################################################################################
  3452. class PokeBattle_Move_085 < PokeBattle_Move
  3453. def pbBaseDamage(basedmg,attacker,opponent)
  3454. if attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]>=0 &&
  3455. attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]==@battle.turncount-1
  3456. return basedmg*2
  3457. end
  3458. return basedmg
  3459. end
  3460. end
  3461.  
  3462.  
  3463.  
  3464. ################################################################################
  3465. # Power is doubled if the user has no held item. (Acrobatics)
  3466. ################################################################################
  3467. class PokeBattle_Move_086 < PokeBattle_Move
  3468. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3469. if attacker.item==0
  3470. return (damagemult*2.0).round
  3471. end
  3472. return damagemult
  3473. end
  3474. end
  3475.  
  3476.  
  3477.  
  3478. ################################################################################
  3479. # Power is doubled in weather. Type changes depending on the weather. (Weather Ball)
  3480. ################################################################################
  3481. class PokeBattle_Move_087 < PokeBattle_Move
  3482. def pbBaseDamage(basedmg,attacker,opponent)
  3483. if @battle.pbWeather!=0
  3484. return basedmg*2
  3485. end
  3486. return basedmg
  3487. end
  3488.  
  3489. def pbModifyType(type,attacker,opponent)
  3490. type=getConst(PBTypes,:NORMAL) || 0
  3491. case @battle.pbWeather
  3492. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  3493. type=(getConst(PBTypes,:FIRE) || type)
  3494. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  3495. type=(getConst(PBTypes,:WATER) || type)
  3496. when PBWeather::SANDSTORM
  3497. type=(getConst(PBTypes,:ROCK) || type)
  3498. when PBWeather::HAIL
  3499. type=(getConst(PBTypes,:ICE) || type)
  3500. end
  3501. return type
  3502. end
  3503. end
  3504.  
  3505.  
  3506.  
  3507. ################################################################################
  3508. # Power is doubled if a foe tries to switch out or use U-turn/Volt Switch/
  3509. # Parting Shot. (Pursuit)
  3510. # (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
  3511. ################################################################################
  3512. class PokeBattle_Move_088 < PokeBattle_Move
  3513. def pbBaseDamage(basedmg,attacker,opponent)
  3514. if @battle.switching
  3515. return basedmg*2
  3516. end
  3517. return basedmg
  3518. end
  3519.  
  3520. def pbAccuracyCheck(attacker,opponent)
  3521. return true if @battle.switching
  3522. return super(attacker,opponent)
  3523. end
  3524. end
  3525.  
  3526.  
  3527.  
  3528. ################################################################################
  3529. # Power increases with the user's happiness. (Return)
  3530. ################################################################################
  3531. class PokeBattle_Move_089 < PokeBattle_Move
  3532. def pbBaseDamage(basedmg,attacker,opponent)
  3533. return [(attacker.happiness*2/5).floor,1].max
  3534. end
  3535. end
  3536.  
  3537.  
  3538.  
  3539. ################################################################################
  3540. # Power decreases with the user's happiness. (Frustration)
  3541. ################################################################################
  3542. class PokeBattle_Move_08A < PokeBattle_Move
  3543. def pbBaseDamage(basedmg,attacker,opponent)
  3544. return [((255-attacker.happiness)*2/5).floor,1].max
  3545. end
  3546. end
  3547.  
  3548.  
  3549.  
  3550. ################################################################################
  3551. # Power increases with the user's HP. (Eruption, Water Spout)
  3552. ################################################################################
  3553. class PokeBattle_Move_08B < PokeBattle_Move
  3554. def pbBaseDamage(basedmg,attacker,opponent)
  3555. return [(150*attacker.hp/attacker.totalhp).floor,1].max
  3556. end
  3557. end
  3558.  
  3559.  
  3560.  
  3561. ################################################################################
  3562. # Power increases with the target's HP. (Crush Grip, Wring Out)
  3563. ################################################################################
  3564. class PokeBattle_Move_08C < PokeBattle_Move
  3565. def pbBaseDamage(basedmg,attacker,opponent)
  3566. return [(120*opponent.hp/opponent.totalhp).floor,1].max
  3567. end
  3568. end
  3569.  
  3570.  
  3571.  
  3572. ################################################################################
  3573. # Power increases the quicker the target is than the user. (Gyro Ball)
  3574. ################################################################################
  3575. class PokeBattle_Move_08D < PokeBattle_Move
  3576. def pbBaseDamage(basedmg,attacker,opponent)
  3577. return [[(25*opponent.pbSpeed/attacker.pbSpeed).floor,150].min,1].max
  3578. end
  3579. end
  3580.  
  3581.  
  3582.  
  3583. ################################################################################
  3584. # Power increases with the user's positive stat changes (ignores negative ones).
  3585. # (Stored Power)
  3586. ################################################################################
  3587. class PokeBattle_Move_08E < PokeBattle_Move
  3588. def pbBaseDamage(basedmg,attacker,opponent)
  3589. mult=1
  3590. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3591. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3592. mult+=attacker.stages[i] if attacker.stages[i]>0
  3593. end
  3594. return 20*mult
  3595. end
  3596. end
  3597.  
  3598.  
  3599.  
  3600. ################################################################################
  3601. # Power increases with the target's positive stat changes (ignores negative ones).
  3602. # (Punishment)
  3603. ################################################################################
  3604. class PokeBattle_Move_08F < PokeBattle_Move
  3605. def pbBaseDamage(basedmg,attacker,opponent)
  3606. mult=3
  3607. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3608. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3609. mult+=opponent.stages[i] if opponent.stages[i]>0
  3610. end
  3611. return [20*mult,200].min
  3612. end
  3613. end
  3614.  
  3615.  
  3616.  
  3617. ################################################################################
  3618. # Power and type depends on the user's IVs. (Hidden Power)
  3619. ################################################################################
  3620. class PokeBattle_Move_090 < PokeBattle_Move
  3621. def pbModifyType(type,attacker,opponent)
  3622. hp=pbHiddenPower(attacker.iv)
  3623. type=hp[0]
  3624. return type
  3625. end
  3626.  
  3627. def pbBaseDamage(basedmg,attacker,opponent)
  3628. return 60 if USENEWBATTLEMECHANICS
  3629. hp=pbHiddenPower(attacker.iv)
  3630. return hp[1]
  3631. end
  3632. end
  3633.  
  3634. def pbHiddenPower(iv)
  3635. powermin=30
  3636. powermax=70
  3637. type=0; base=0
  3638. types=[]
  3639. for i in 0..PBTypes.maxValue
  3640. types.push(i) if !PBTypes.isPseudoType?(i) &&
  3641. !isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
  3642. end
  3643. type|=(iv[PBStats::HP]&1)
  3644. type|=(iv[PBStats::ATTACK]&1)<<1
  3645. type|=(iv[PBStats::DEFENSE]&1)<<2
  3646. type|=(iv[PBStats::SPEED]&1)<<3
  3647. type|=(iv[PBStats::SPATK]&1)<<4
  3648. type|=(iv[PBStats::SPDEF]&1)<<5
  3649. type=(type*(types.length-1)/63).floor
  3650. hptype=types[type]
  3651. base|=(iv[PBStats::HP]&2)>>1
  3652. base|=(iv[PBStats::ATTACK]&2)
  3653. base|=(iv[PBStats::DEFENSE]&2)<<1
  3654. base|=(iv[PBStats::SPEED]&2)<<2
  3655. base|=(iv[PBStats::SPATK]&2)<<3
  3656. base|=(iv[PBStats::SPDEF]&2)<<4
  3657. base=(base*(powermax-powermin)/63).floor+powermin
  3658. return [hptype,base]
  3659. end
  3660.  
  3661. ################################################################################
  3662. # Power doubles for each consecutive use. (Fury Cutter)
  3663. ################################################################################
  3664. class PokeBattle_Move_091 < PokeBattle_Move
  3665. def pbBaseDamage(basedmg,attacker,opponent)
  3666. basedmg=basedmg<<(attacker.effects[PBEffects::FuryCutter]-1) # can be 1 to 4
  3667. return basedmg
  3668. end
  3669. end
  3670.  
  3671.  
  3672.  
  3673. ################################################################################
  3674. # Power is multiplied by the number of consecutive rounds in which this move was
  3675. # used by any Pokémon on the user's side. (Echoed Voice)
  3676. ################################################################################
  3677. class PokeBattle_Move_092 < PokeBattle_Move
  3678. def pbBaseDamage(basedmg,attacker,opponent)
  3679. basedmg*=attacker.pbOwnSide.effects[PBEffects::EchoedVoiceCounter] # can be 1 to 5
  3680. return basedmg
  3681. end
  3682. end
  3683.  
  3684.  
  3685.  
  3686. ################################################################################
  3687. # User rages until the start of a round in which they don't use this move. (Rage)
  3688. # (Handled in Battler's pbProcessMoveAgainstTarget): Ups rager's Attack by 1
  3689. # stage each time it loses HP due to a move.
  3690. ################################################################################
  3691. class PokeBattle_Move_093 < PokeBattle_Move
  3692. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3693. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3694. attacker.effects[PBEffects::Rage]=true if ret>0
  3695. return ret
  3696. end
  3697. end
  3698.  
  3699.  
  3700.  
  3701. ################################################################################
  3702. # Randomly damages or heals the target. (Present)
  3703. ################################################################################
  3704. class PokeBattle_Move_094 < PokeBattle_Move
  3705. def pbOnStartUse(attacker)
  3706. # Just to ensure that Parental Bond's second hit damages if the first hit does
  3707. @forcedamage=false
  3708. return true
  3709. end
  3710.  
  3711. def pbBaseDamage(basedmg,attacker,opponent)
  3712. @forcedamage=true
  3713. return @calcbasedmg
  3714. end
  3715.  
  3716. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3717. @calcbasedmg=1
  3718. r=@battle.pbRandom((@forcedamage) ? 8 : 10)
  3719. if r<4
  3720. @calcbasedmg=40
  3721. elsif r<7
  3722. @calcbasedmg=80
  3723. elsif r<8
  3724. @calcbasedmg=120
  3725. else
  3726. if pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)==0
  3727. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  3728. return -1
  3729. end
  3730. if opponent.hp==opponent.totalhp
  3731. @battle.pbDisplay(_INTL("But it failed!"))
  3732. return -1
  3733. end
  3734. damage=pbCalcDamage(attacker,opponent) # Consumes Gems even if it will heal
  3735. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Healing animation
  3736. opponent.pbRecoverHP((opponent.totalhp/4).floor,true)
  3737. @battle.pbDisplay(_INTL("{1} had its HP restored.",opponent.pbThis))
  3738. return 0
  3739. end
  3740. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3741. end
  3742. end
  3743.  
  3744.  
  3745.  
  3746. ################################################################################
  3747. # Power is chosen at random. Power is doubled if the target is using Dig. (Magnitude)
  3748. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3749. ################################################################################
  3750. class PokeBattle_Move_095 < PokeBattle_Move
  3751. def pbOnStartUse(attacker)
  3752. basedmg=[10,30,50,70,90,110,150]
  3753. magnitudes=[
  3754. 4,
  3755. 5,5,
  3756. 6,6,6,6,
  3757. 7,7,7,7,7,7,
  3758. 8,8,8,8,
  3759. 9,9,
  3760. 10
  3761. ]
  3762. magni=magnitudes[@battle.pbRandom(magnitudes.length)]
  3763. @calcbasedmg=basedmg[magni-4]
  3764. @battle.pbDisplay(_INTL("Magnitude {1}!",magni))
  3765. return true
  3766. end
  3767.  
  3768. def pbBaseDamage(basedmg,attacker,opponent)
  3769. ret=@calcbasedmg
  3770. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3771. ret*=2
  3772. end
  3773. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3774. ret=(ret/2.0).round
  3775. end
  3776. return ret
  3777. end
  3778. end
  3779.  
  3780.  
  3781.  
  3782. ################################################################################
  3783. # Power and type depend on the user's held berry. Destroys the berry. (Natural Gift)
  3784. ################################################################################
  3785. class PokeBattle_Move_096 < PokeBattle_Move
  3786. def pbOnStartUse(attacker)
  3787. if !pbIsBerry?(attacker.item) ||
  3788. attacker.effects[PBEffects::Embargo]>0 ||
  3789. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  3790. attacker.hasWorkingAbility(:KLUTZ) ||
  3791. attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) ||
  3792. attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  3793. @battle.pbDisplay(_INTL("But it failed!"))
  3794. return false
  3795. end
  3796. @berry=attacker.item
  3797. return true
  3798. end
  3799.  
  3800. def pbBaseDamage(basedmg,attacker,opponent)
  3801. damagearray={
  3802. 60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
  3803. :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
  3804. :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
  3805. :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
  3806. :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
  3807. :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
  3808. :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY,:ROSELIBERRY],
  3809. 70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
  3810. :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
  3811. :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
  3812. :PAMTREBERRY],
  3813. 80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
  3814. :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
  3815. :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JABOCABERRY,:ROWAPBERRY,
  3816. :KEEBERRY,:MARANGABERRY]
  3817. }
  3818. for i in damagearray.keys
  3819. data=damagearray[i]
  3820. if data
  3821. for j in data
  3822. if isConst?(@berry,PBItems,j)
  3823. ret=i
  3824. ret+=20 if USENEWBATTLEMECHANICS
  3825. return ret
  3826. end
  3827. end
  3828. end
  3829. end
  3830. return 1
  3831. end
  3832.  
  3833. def pbModifyType(type,attacker,opponent)
  3834. type=getConst(PBTypes,:NORMAL) || 0
  3835. typearray={
  3836. :NORMAL => [:CHILANBERRY],
  3837. :FIRE => [:CHERIBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
  3838. :WATER => [:CHESTOBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
  3839. :ELECTRIC => [:PECHABERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
  3840. :GRASS => [:RAWSTBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
  3841. :ICE => [:ASPEARBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
  3842. :FIGHTING => [:LEPPABERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
  3843. :POISON => [:ORANBERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
  3844. :GROUND => [:PERSIMBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
  3845. :FLYING => [:LUMBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
  3846. :PSYCHIC => [:SITRUSBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
  3847. :BUG => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
  3848. :ROCK => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
  3849. :GHOST => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
  3850. :DRAGON => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JABOCABERRY],
  3851. :DARK => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY,:MARANGABERRY],
  3852. :STEEL => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY],
  3853. :FAIRY => [:ROSELIBERRY,:KEEBERRY]
  3854. }
  3855. for i in typearray.keys
  3856. data=typearray[i]
  3857. if data
  3858. for j in data
  3859. if isConst?(@berry,PBItems,j)
  3860. type=getConst(PBTypes,i) || type
  3861. end
  3862. end
  3863. end
  3864. end
  3865. return type
  3866. end
  3867.  
  3868. def pbEffectAfterHit(attacker,opponent,turneffects)
  3869. if turneffects[PBEffects::TotalDamage]>0>0
  3870. attacker.pbConsumeItem
  3871. end
  3872. end
  3873. end
  3874.  
  3875.  
  3876.  
  3877. ################################################################################
  3878. # Power increases the less PP this move has. (Trump Card)
  3879. ################################################################################
  3880. class PokeBattle_Move_097 < PokeBattle_Move
  3881. def pbBaseDamage(basedmg,attacker,opponent)
  3882. dmgs=[200,80,60,50,40]
  3883. ppleft=[@pp,4].min # PP is reduced before the move is used
  3884. basedmg=dmgs[ppleft]
  3885. return basedmg
  3886. end
  3887. end
  3888.  
  3889.  
  3890.  
  3891. ################################################################################
  3892. # Power increases the less HP the user has. (Flail, Reversal)
  3893. ################################################################################
  3894. class PokeBattle_Move_098 < PokeBattle_Move
  3895. def pbBaseDamage(basedmg,attacker,opponent)
  3896. n=(48*attacker.hp/attacker.totalhp).floor
  3897. ret=20
  3898. ret=40 if n<33
  3899. ret=80 if n<17
  3900. ret=100 if n<10
  3901. ret=150 if n<5
  3902. ret=200 if n<2
  3903. return ret
  3904. end
  3905. end
  3906.  
  3907.  
  3908.  
  3909. ################################################################################
  3910. # Power increases the quicker the user is than the target. (Electro Ball)
  3911. ################################################################################
  3912. class PokeBattle_Move_099 < PokeBattle_Move
  3913. def pbBaseDamage(basedmg,attacker,opponent)
  3914. n=([attacker.pbSpeed,1].max/[opponent.pbSpeed,1].max).floor
  3915. ret=60
  3916. ret=80 if n>=2
  3917. ret=120 if n>=3
  3918. ret=150 if n>=4
  3919. return ret
  3920. end
  3921. end
  3922.  
  3923.  
  3924.  
  3925. ################################################################################
  3926. # Power increases the heavier the target is. (Grass Knot, Low Kick)
  3927. ################################################################################
  3928. class PokeBattle_Move_09A < PokeBattle_Move
  3929. def pbBaseDamage(basedmg,attacker,opponent)
  3930. weight=opponent.weight(attacker)
  3931. ret=20
  3932. ret=40 if weight>=100
  3933. ret=60 if weight>=250
  3934. ret=80 if weight>=500
  3935. ret=100 if weight>=1000
  3936. ret=120 if weight>=2000
  3937. return ret
  3938. end
  3939. end
  3940.  
  3941.  
  3942.  
  3943. ################################################################################
  3944. # Power increases the heavier the user is than the target. (Heat Crash, Heavy Slam)
  3945. ################################################################################
  3946. class PokeBattle_Move_09B < PokeBattle_Move
  3947. def pbBaseDamage(basedmg,attacker,opponent)
  3948. n=(attacker.weight/opponent.weight(attacker)).floor
  3949. ret=40
  3950. ret=60 if n>=2
  3951. ret=80 if n>=3
  3952. ret=100 if n>=4
  3953. ret=120 if n>=5
  3954. return ret
  3955. end
  3956. end
  3957.  
  3958.  
  3959.  
  3960. ################################################################################
  3961. # Powers up the ally's attack this round by 1.5. (Helping Hand)
  3962. ################################################################################
  3963. class PokeBattle_Move_09C < PokeBattle_Move
  3964. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3965. if !@battle.doublebattle || opponent.isFainted? ||
  3966. @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3967. opponent.hasMovedThisRound? ||
  3968. opponent.effects[PBEffects::HelpingHand]
  3969. @battle.pbDisplay(_INTL("But it failed!"))
  3970. return -1
  3971. end
  3972. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3973. opponent.effects[PBEffects::HelpingHand]=true
  3974. @battle.pbDisplay(_INTL("{1} is ready to help {2}!",attacker.pbThis,opponent.pbThis(true)))
  3975. return 0
  3976. end
  3977. end
  3978.  
  3979.  
  3980.  
  3981. ################################################################################
  3982. # Weakens Electric attacks. (Mud Sport)
  3983. ################################################################################
  3984. class PokeBattle_Move_09D < PokeBattle_Move
  3985. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3986. if USENEWBATTLEMECHANICS
  3987. if @battle.field.effects[PBEffects::MudSportField]>0
  3988. @battle.pbDisplay(_INTL("But it failed!"))
  3989. return -1
  3990. end
  3991. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3992. @battle.field.effects[PBEffects::MudSportField]=5
  3993. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  3994. return 0
  3995. else
  3996. for i in 0...4
  3997. if attacker.battle.battlers[i].effects[PBEffects::MudSport]
  3998. @battle.pbDisplay(_INTL("But it failed!"))
  3999. return -1
  4000. end
  4001. end
  4002. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4003. attacker.effects[PBEffects::MudSport]=true
  4004. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4005. return 0
  4006. end
  4007. return -1
  4008. end
  4009. end
  4010.  
  4011.  
  4012.  
  4013. ################################################################################
  4014. # Weakens Fire attacks. (Water Sport)
  4015. ################################################################################
  4016. class PokeBattle_Move_09E < PokeBattle_Move
  4017. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4018. if USENEWBATTLEMECHANICS
  4019. if @battle.field.effects[PBEffects::WaterSportField]>0
  4020. @battle.pbDisplay(_INTL("But it failed!"))
  4021. return -1
  4022. end
  4023. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4024. @battle.field.effects[PBEffects::WaterSportField]=5
  4025. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4026. return 0
  4027. else
  4028. for i in 0...4
  4029. if attacker.battle.battlers[i].effects[PBEffects::WaterSport]
  4030. @battle.pbDisplay(_INTL("But it failed!"))
  4031. return -1
  4032. end
  4033. end
  4034. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4035. attacker.effects[PBEffects::WaterSport]=true
  4036. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4037. return 0
  4038. end
  4039. end
  4040. end
  4041.  
  4042.  
  4043.  
  4044. ################################################################################
  4045. # Type depends on the user's held item. (Judgment, Techno Blast)
  4046. ################################################################################
  4047. class PokeBattle_Move_09F < PokeBattle_Move
  4048. def pbModifyType(type,attacker,opponent)
  4049. type=getConst(PBTypes,:NORMAL) || 0
  4050. if isConst?(@id,PBMoves,:JUDGMENT)
  4051. type=(getConst(PBTypes,:FIGHTING) || 0) if attacker.hasWorkingItem(:FISTPLATE)
  4052. type=(getConst(PBTypes,:FLYING) || 0) if attacker.hasWorkingItem(:SKYPLATE)
  4053. type=(getConst(PBTypes,:POISON) || 0) if attacker.hasWorkingItem(:TOXICPLATE)
  4054. type=(getConst(PBTypes,:GROUND) || 0) if attacker.hasWorkingItem(:EARTHPLATE)
  4055. type=(getConst(PBTypes,:ROCK) || 0) if attacker.hasWorkingItem(:STONEPLATE)
  4056. type=(getConst(PBTypes,:BUG) || 0) if attacker.hasWorkingItem(:INSECTPLATE)
  4057. type=(getConst(PBTypes,:GHOST) || 0) if attacker.hasWorkingItem(:SPOOKYPLATE)
  4058. type=(getConst(PBTypes,:STEEL) || 0) if attacker.hasWorkingItem(:IRONPLATE)
  4059. type=(getConst(PBTypes,:FIRE) || 0) if attacker.hasWorkingItem(:FLAMEPLATE)
  4060. type=(getConst(PBTypes,:WATER) || 0) if attacker.hasWorkingItem(:SPLASHPLATE)
  4061. type=(getConst(PBTypes,:GRASS) || 0) if attacker.hasWorkingItem(:MEADOWPLATE)
  4062. type=(getConst(PBTypes,:ELECTRIC) || 0) if attacker.hasWorkingItem(:ZAPPLATE)
  4063. type=(getConst(PBTypes,:PSYCHIC) || 0) if attacker.hasWorkingItem(:MINDPLATE)
  4064. type=(getConst(PBTypes,:ICE) || 0) if attacker.hasWorkingItem(:ICICLEPLATE)
  4065. type=(getConst(PBTypes,:DRAGON) || 0) if attacker.hasWorkingItem(:DRACOPLATE)
  4066. type=(getConst(PBTypes,:DARK) || 0) if attacker.hasWorkingItem(:DREADPLATE)
  4067. type=(getConst(PBTypes,:FAIRY) || 0) if attacker.hasWorkingItem(:PIXIEPLATE)
  4068. elsif isConst?(@id,PBMoves,:TECHNOBLAST)
  4069. return getConst(PBTypes,:ELECTRIC) if attacker.hasWorkingItem(:SHOCKDRIVE)
  4070. return getConst(PBTypes,:FIRE) if attacker.hasWorkingItem(:BURNDRIVE)
  4071. return getConst(PBTypes,:ICE) if attacker.hasWorkingItem(:CHILLDRIVE)
  4072. return getConst(PBTypes,:WATER) if attacker.hasWorkingItem(:DOUSEDRIVE)
  4073. end
  4074. return type
  4075. end
  4076.  
  4077. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4078. if isConst?(@id,PBMoves,:TECHNOBLAST)
  4079. anim=0
  4080. anim=1 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ELECTRIC)
  4081. anim=2 if isConst?(pbType(@type,attacker,opponent),PBTypes,:FIRE)
  4082. anim=3 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ICE)
  4083. anim=4 if isConst?(pbType(@type,attacker,opponent),PBTypes,:WATER)
  4084. return super(id,attacker,opponent,anim,alltargets,showanimation) # Type-specific anim
  4085. end
  4086. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  4087. end
  4088. end
  4089.  
  4090.  
  4091.  
  4092. ################################################################################
  4093. # This attack is always a critical hit. (Frost Breath, Storm Throw)
  4094. ################################################################################
  4095. class PokeBattle_Move_0A0 < PokeBattle_Move
  4096. def pbCritialOverride(attacker,opponent)
  4097. return true
  4098. end
  4099. end
  4100.  
  4101.  
  4102.  
  4103. ################################################################################
  4104. # For 5 rounds, foes' attacks cannot become critical hits. (Lucky Chant)
  4105. ################################################################################
  4106. class PokeBattle_Move_0A1 < PokeBattle_Move
  4107. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4108. if attacker.pbOwnSide.effects[PBEffects::LuckyChant]>0
  4109. @battle.pbDisplay(_INTL("But it failed!"))
  4110. return -1
  4111. end
  4112. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4113. attacker.pbOwnSide.effects[PBEffects::LuckyChant]=5
  4114. if !@battle.pbIsOpposing?(attacker.index)
  4115. @battle.pbDisplay(_INTL("The Lucky Chant shielded your team from critical hits!"))
  4116. else
  4117. @battle.pbDisplay(_INTL("The Lucky Chant shielded the opposing team from critical hits!"))
  4118. end
  4119. return 0
  4120. end
  4121. end
  4122.  
  4123.  
  4124.  
  4125. ################################################################################
  4126. # For 5 rounds, lowers power of physical attacks against the user's side. (Reflect)
  4127. ################################################################################
  4128. class PokeBattle_Move_0A2 < PokeBattle_Move
  4129. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4130. if attacker.pbOwnSide.effects[PBEffects::Reflect]>0
  4131. @battle.pbDisplay(_INTL("But it failed!"))
  4132. return -1
  4133. end
  4134. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4135. attacker.pbOwnSide.effects[PBEffects::Reflect]=5
  4136. attacker.pbOwnSide.effects[PBEffects::Reflect]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4137. if !@battle.pbIsOpposing?(attacker.index)
  4138. @battle.pbDisplay(_INTL("Reflect raised your team's Defense!"))
  4139. else
  4140. @battle.pbDisplay(_INTL("Reflect raised the opposing team's Defense!"))
  4141. end
  4142. return 0
  4143. end
  4144. end
  4145.  
  4146.  
  4147.  
  4148. ################################################################################
  4149. # For 5 rounds, lowers power of special attacks against the user's side. (Light Screen)
  4150. ################################################################################
  4151. class PokeBattle_Move_0A3 < PokeBattle_Move
  4152. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4153. if attacker.pbOwnSide.effects[PBEffects::LightScreen]>0
  4154. @battle.pbDisplay(_INTL("But it failed!"))
  4155. return -1
  4156. end
  4157. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4158. attacker.pbOwnSide.effects[PBEffects::LightScreen]=5
  4159. attacker.pbOwnSide.effects[PBEffects::LightScreen]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4160. if !@battle.pbIsOpposing?(attacker.index)
  4161. @battle.pbDisplay(_INTL("Light Screen raised your team's Special Defense!"))
  4162. else
  4163. @battle.pbDisplay(_INTL("Light Screen raised the opposing team's Special Defense!"))
  4164. end
  4165. return 0
  4166. end
  4167. end
  4168.  
  4169.  
  4170.  
  4171. ################################################################################
  4172. # Effect depends on the environment. (Secret Power)
  4173. ################################################################################
  4174. class PokeBattle_Move_0A4 < PokeBattle_Move
  4175. def pbAdditionalEffect(attacker,opponent)
  4176. return if opponent.damagestate.substitute
  4177. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4178. if opponent.pbCanParalyze?(attacker,false,self)
  4179. opponent.pbParalyze(attacker)
  4180. return
  4181. end
  4182. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4183. if opponent.pbCanSleep?(attacker,false,self)
  4184. opponent.pbSleep
  4185. return
  4186. end
  4187. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4188. if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  4189. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  4190. return
  4191. end
  4192. end
  4193. case @battle.environment
  4194. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4195. if opponent.pbCanSleep?(attacker,false,self)
  4196. opponent.pbSleep
  4197. end
  4198. when PBEnvironment::MovingWater, PBEnvironment::Underwater
  4199. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  4200. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  4201. end
  4202. when PBEnvironment::StillWater, PBEnvironment::Sky
  4203. if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  4204. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  4205. end
  4206. when PBEnvironment::Sand
  4207. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4208. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4209. end
  4210. when PBEnvironment::Rock
  4211. if USENEWBATTLEMECHANICS
  4212. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4213. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4214. end
  4215. else
  4216. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4217. opponent.pbFlinch(attacker)
  4218. end
  4219. end
  4220. when PBEnvironment::Cave, PBEnvironment::Graveyard, PBEnvironment::Space
  4221. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4222. opponent.pbFlinch(attacker)
  4223. end
  4224. when PBEnvironment::Snow
  4225. if opponent.pbCanFreeze?(attacker,false,self)
  4226. opponent.pbFreeze
  4227. end
  4228. when PBEnvironment::Volcano
  4229. if opponent.pbCanBurn?(attacker,false,self)
  4230. opponent.pbBurn(attacker)
  4231. end
  4232. else
  4233. if opponent.pbCanParalyze?(attacker,false,self)
  4234. opponent.pbParalyze(attacker)
  4235. end
  4236. end
  4237. end
  4238.  
  4239. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4240. id=getConst(PBMoves,:BODYSLAM)
  4241. case @battle.environment
  4242. when PBEnvironment::Grass, PBEnvironment::TallGrass
  4243. id=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)) || id
  4244. when PBEnvironment::MovingWater; id=getConst(PBMoves,:WATERPULSE) || id
  4245. when PBEnvironment::StillWater; id=getConst(PBMoves,:MUDSHOT) || id
  4246. when PBEnvironment::Underwater; id=getConst(PBMoves,:WATERPULSE) || id
  4247. when PBEnvironment::Cave; id=getConst(PBMoves,:ROCKTHROW) || id
  4248. when PBEnvironment::Rock; id=getConst(PBMoves,:MUDSLAP) || id
  4249. when PBEnvironment::Sand; id=getConst(PBMoves,:MUDSLAP) || id
  4250. when PBEnvironment::Forest; id=getConst(PBMoves,:RAZORLEAF) || id
  4251. # Ice tiles in Gen 6 should be Ice Shard
  4252. when PBEnvironment::Snow; id=getConst(PBMoves,:AVALANCHE) || id
  4253. when PBEnvironment::Volcano; id=getConst(PBMoves,:INCINERATE) || id
  4254. when PBEnvironment::Graveyard; id=getConst(PBMoves,:SHADOWSNEAK) || id
  4255. when PBEnvironment::Sky; id=getConst(PBMoves,:GUST) || id
  4256. when PBEnvironment::Space; id=getConst(PBMoves,:SWIFT) || id
  4257. end
  4258. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4259. id=getConst(PBMoves,:THUNDERSHOCK) || id
  4260. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4261. id=getConst(PBMoves,:VINEWHIP) || id
  4262. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4263. id=getConst(PBMoves,:FAIRYWIND) || id
  4264. end
  4265. return super(id,attacker,opponent,hitnum,alltargets,showanimation) # Environment-specific anim
  4266. end
  4267. end
  4268.  
  4269.  
  4270.  
  4271. ################################################################################
  4272. # Always hits.
  4273. ################################################################################
  4274. class PokeBattle_Move_0A5 < PokeBattle_Move
  4275. def pbAccuracyCheck(attacker,opponent)
  4276. return true
  4277. end
  4278. end
  4279.  
  4280.  
  4281.  
  4282. ################################################################################
  4283. # User's attack next round against the target will definitely hit. (Lock-On, Mind Reader)
  4284. ################################################################################
  4285. class PokeBattle_Move_0A6 < PokeBattle_Move
  4286. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4287. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  4288. @battle.pbDisplay(_INTL("But it failed!"))
  4289. return -1
  4290. end
  4291. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4292. opponent.effects[PBEffects::LockOn]=2
  4293. opponent.effects[PBEffects::LockOnPos]=attacker.index
  4294. @battle.pbDisplay(_INTL("{1} took aim at {2}!",attacker.pbThis,opponent.pbThis(true)))
  4295. return 0
  4296. end
  4297. end
  4298.  
  4299.  
  4300.  
  4301. ################################################################################
  4302. # Target's evasion stat changes are ignored from now on. (Foresight, Odor Sleuth)
  4303. # Normal and Fighting moves have normal effectiveness against the Ghost-type target.
  4304. ################################################################################
  4305. class PokeBattle_Move_0A7 < PokeBattle_Move
  4306. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4307. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4308. @battle.pbDisplay(_INTL("But it failed!"))
  4309. return -1
  4310. end
  4311. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4312. opponent.effects[PBEffects::Foresight]=true
  4313. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4314. return 0
  4315. end
  4316. end
  4317.  
  4318.  
  4319.  
  4320. ################################################################################
  4321. # Target's evasion stat changes are ignored from now on. (Miracle Eye)
  4322. # Psychic moves have normal effectiveness against the Dark-type target.
  4323. ################################################################################
  4324. class PokeBattle_Move_0A8 < PokeBattle_Move
  4325. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4326. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4327. @battle.pbDisplay(_INTL("But it failed!"))
  4328. return -1
  4329. end
  4330. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4331. opponent.effects[PBEffects::MiracleEye]=true
  4332. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4333. return 0
  4334. end
  4335. end
  4336.  
  4337.  
  4338.  
  4339. ################################################################################
  4340. # This move ignores target's Defense, Special Defense and evasion stat changes.
  4341. # (Chip Away, Sacred Sword)
  4342. ################################################################################
  4343. class PokeBattle_Move_0A9 < PokeBattle_Move
  4344. # Handled in superclass def pbAccuracyCheck and def pbCalcDamage, do not edit!
  4345. end
  4346.  
  4347.  
  4348.  
  4349. ################################################################################
  4350. # User is protected against moves with the "B" flag this round. (Detect, Protect)
  4351. ################################################################################
  4352. class PokeBattle_Move_0AA < PokeBattle_Move
  4353. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4354. ratesharers=[
  4355. 0xAA, # Detect, Protect
  4356. 0xAB, # Quick Guard
  4357. 0xAC, # Wide Guard
  4358. 0xE8, # Endure
  4359. 0x14B, # King's Shield
  4360. 0x14C # Spiky Shield
  4361. ]
  4362. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4363. attacker.effects[PBEffects::ProtectRate]=1
  4364. end
  4365. unmoved=false
  4366. for poke in @battle.battlers
  4367. next if poke.index==attacker.index
  4368. if @battle.choices[poke.index][0]==1 && # Chose a move
  4369. !poke.hasMovedThisRound?
  4370. unmoved=true; break
  4371. end
  4372. end
  4373. if !unmoved ||
  4374. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  4375. attacker.effects[PBEffects::ProtectRate]=1
  4376. @battle.pbDisplay(_INTL("But it failed!"))
  4377. return -1
  4378. end
  4379. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4380. attacker.effects[PBEffects::Protect]=true
  4381. attacker.effects[PBEffects::ProtectRate]*=2
  4382. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  4383. return 0
  4384. end
  4385. end
  4386.  
  4387.  
  4388.  
  4389. ################################################################################
  4390. # User's side is protected against moves with priority greater than 0 this round.
  4391. # (Quick Guard)
  4392. ################################################################################
  4393. class PokeBattle_Move_0AB < PokeBattle_Move
  4394. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4395. if attacker.pbOwnSide.effects[PBEffects::QuickGuard]
  4396. @battle.pbDisplay(_INTL("But it failed!"))
  4397. return -1
  4398. end
  4399. ratesharers=[
  4400. 0xAA, # Detect, Protect
  4401. 0xAB, # Quick Guard
  4402. 0xAC, # Wide Guard
  4403. 0xE8, # Endure
  4404. 0x14B, # King's Shield
  4405. 0x14C # Spiky Shield
  4406. ]
  4407. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4408. attacker.effects[PBEffects::ProtectRate]=1
  4409. end
  4410. unmoved=false
  4411. for poke in @battle.battlers
  4412. next if poke.index==attacker.index
  4413. if @battle.choices[poke.index][0]==1 && # Chose a move
  4414. !poke.hasMovedThisRound?
  4415. unmoved=true; break
  4416. end
  4417. end
  4418. if !unmoved ||
  4419. (!USENEWBATTLEMECHANICS &&
  4420. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4421. attacker.effects[PBEffects::ProtectRate]=1
  4422. @battle.pbDisplay(_INTL("But it failed!"))
  4423. return -1
  4424. end
  4425. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4426. attacker.pbOwnSide.effects[PBEffects::QuickGuard]=true
  4427. attacker.effects[PBEffects::ProtectRate]*=2
  4428. if !@battle.pbIsOpposing?(attacker.index)
  4429. @battle.pbDisplay(_INTL("Quick Guard protected your team!"))
  4430. else
  4431. @battle.pbDisplay(_INTL("Quick Guard protected the opposing team!"))
  4432. end
  4433. return 0
  4434. end
  4435. end
  4436.  
  4437.  
  4438.  
  4439. ################################################################################
  4440. # User's side is protected against moves that target multiple battlers this round.
  4441. # (Wide Guard)
  4442. ################################################################################
  4443. class PokeBattle_Move_0AC < PokeBattle_Move
  4444. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4445. if attacker.pbOwnSide.effects[PBEffects::WideGuard]
  4446. @battle.pbDisplay(_INTL("But it failed!"))
  4447. return -1
  4448. end
  4449. ratesharers=[
  4450. 0xAA, # Detect, Protect
  4451. 0xAB, # Quick Guard
  4452. 0xAC, # Wide Guard
  4453. 0xE8, # Endure
  4454. 0x14B, # King's Shield
  4455. 0x14C # Spiky Shield
  4456. ]
  4457. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4458. attacker.effects[PBEffects::ProtectRate]=1
  4459. end
  4460. unmoved=false
  4461. for poke in @battle.battlers
  4462. next if poke.index==attacker.index
  4463. if @battle.choices[poke.index][0]==1 && # Chose a move
  4464. !poke.hasMovedThisRound?
  4465. unmoved=true; break
  4466. end
  4467. end
  4468. if !unmoved ||
  4469. (!USENEWBATTLEMECHANICS &&
  4470. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4471. attacker.effects[PBEffects::ProtectRate]=1
  4472. @battle.pbDisplay(_INTL("But it failed!"))
  4473. return -1
  4474. end
  4475. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4476. attacker.pbOwnSide.effects[PBEffects::WideGuard]=true
  4477. attacker.effects[PBEffects::ProtectRate]*=2
  4478. if !@battle.pbIsOpposing?(attacker.index)
  4479. @battle.pbDisplay(_INTL("Wide Guard protected your team!"))
  4480. else
  4481. @battle.pbDisplay(_INTL("Wide Guard protected the opposing team!"))
  4482. end
  4483. return 0
  4484. end
  4485. end
  4486.  
  4487.  
  4488.  
  4489. ################################################################################
  4490. # Ignores target's protections. If successful, all other moves this round
  4491. # ignore them too. (Feint)
  4492. ################################################################################
  4493. class PokeBattle_Move_0AD < PokeBattle_Move
  4494. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4495. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4496. if ret>0
  4497. opponent.effects[PBEffects::ProtectNegation]=true
  4498. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  4499. end
  4500. return ret
  4501. end
  4502. end
  4503.  
  4504.  
  4505.  
  4506. ################################################################################
  4507. # Uses the last move that the target used. (Mirror Move)
  4508. ################################################################################
  4509. class PokeBattle_Move_0AE < PokeBattle_Move
  4510. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4511. if opponent.lastMoveUsed<=0 ||
  4512. (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
  4513. @battle.pbDisplay(_INTL("The mirror move failed!"))
  4514. return -1
  4515. end
  4516. attacker.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
  4517. return 0
  4518. end
  4519. end
  4520.  
  4521.  
  4522.  
  4523. ################################################################################
  4524. # Uses the last move that was used. (Copycat)
  4525. ################################################################################
  4526. class PokeBattle_Move_0AF < PokeBattle_Move
  4527. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4528. blacklist=[
  4529. 0x69, # Transform
  4530. 0x71, # Counter
  4531. 0x72, # Mirror Coat
  4532. 0x73, # Metal Burst
  4533. 0x9C, # Helping Hand
  4534. 0xAA, # Detect, Protect
  4535. 0xAD, # Feint
  4536. 0xB2, # Snatch
  4537. 0xE7, # Destiny Bond
  4538. 0xE8, # Endure
  4539. 0xEC, # Circle Throw, Dragon Tail
  4540. 0xF1, # Covet, Thief
  4541. 0xF2, # Switcheroo, Trick
  4542. 0xF3, # Bestow
  4543. 0x115, # Focus Punch
  4544. 0x117, # Follow Me, Rage Powder
  4545. 0x158 # Belch
  4546. ]
  4547. if USENEWBATTLEMECHANICS
  4548. blacklist+=[
  4549. 0xEB, # Roar, Whirlwind
  4550. # Two-turn attacks
  4551. 0xC3, # Razor Wind
  4552. 0xC4, # SolarBeam
  4553. 0xC5, # Freeze Shock
  4554. 0xC6, # Ice Burn
  4555. 0xC7, # Sky Attack
  4556. 0xC8, # Skull Bash
  4557. 0xC9, # Fly
  4558. 0xCA, # Dig
  4559. 0xCB, # Dive
  4560. 0xCC, # Bounce
  4561. 0xCD, # Shadow Force
  4562. 0xCE, # Sky Drop
  4563. 0x14D, # Phantom Force
  4564. 0x14E # Geomancy
  4565. ]
  4566. end
  4567. if @battle.lastMoveUsed<=0 ||
  4568. blacklist.include?(PBMoveData.new(@battle.lastMoveUsed).function)
  4569. @battle.pbDisplay(_INTL("But it failed!"))
  4570. return -1
  4571. end
  4572. attacker.pbUseMoveSimple(@battle.lastMoveUsed,-1,@battle.lastMoveUser)
  4573. return 0
  4574. end
  4575. end
  4576.  
  4577.  
  4578.  
  4579. ################################################################################
  4580. # Uses the move the target was about to use this round, with 1.5x power. (Me First)
  4581. ################################################################################
  4582. class PokeBattle_Move_0B0 < PokeBattle_Move
  4583. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4584. blacklist=[
  4585. 0x02, # Struggle
  4586. 0x14, # Chatter
  4587. 0x71, # Counter
  4588. 0x72, # Mirror Coat
  4589. 0x73, # Metal Burst
  4590. 0xB0, # Me First
  4591. 0xF1, # Covet, Thief
  4592. 0x115, # Focus Punch
  4593. 0x158 # Belch
  4594. ]
  4595. oppmove=@battle.choices[opponent.index][2]
  4596. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  4597. opponent.hasMovedThisRound? ||
  4598. !oppmove || oppmove.id<=0 ||
  4599. oppmove.pbIsStatus? ||
  4600. blacklist.include?(oppmove.function)
  4601. @battle.pbDisplay(_INTL("But it failed!"))
  4602. return -1
  4603. end
  4604. attacker.effects[PBEffects::MeFirst]=true
  4605. attacker.pbUseMoveSimple(oppmove.id,-1,-1)
  4606. attacker.effects[PBEffects::MeFirst]=false
  4607. return 0
  4608. end
  4609. end
  4610.  
  4611.  
  4612.  
  4613. ################################################################################
  4614. # This round, reflects all moves with the "C" flag targeting the user back at
  4615. # their origin. (Magic Coat)
  4616. ################################################################################
  4617. class PokeBattle_Move_0B1 < PokeBattle_Move
  4618. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4619. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4620. attacker.effects[PBEffects::MagicCoat]=true
  4621. @battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",attacker.pbThis))
  4622. return 0
  4623. end
  4624. end
  4625.  
  4626.  
  4627.  
  4628. ################################################################################
  4629. # This round, snatches all used moves with the "D" flag. (Snatch)
  4630. ################################################################################
  4631. class PokeBattle_Move_0B2 < PokeBattle_Move
  4632. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4633. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4634. attacker.effects[PBEffects::Snatch]=true
  4635. @battle.pbDisplay(_INTL("{1} waits for a target to make a move!",attacker.pbThis))
  4636. return 0
  4637. end
  4638. end
  4639.  
  4640.  
  4641.  
  4642. ################################################################################
  4643. # Uses a different move depending on the environment. (Nature Power)
  4644. ################################################################################
  4645. class PokeBattle_Move_0B3 < PokeBattle_Move
  4646. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4647. move=getConst(PBMoves,:TRIATTACK) || 0
  4648. case @battle.environment
  4649. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4650. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:ENERGYBALL) : getConst(PBMoves,:SEEDBOMB)) || move
  4651. when PBEnvironment::MovingWater; move=getConst(PBMoves,:HYDROPUMP) || move
  4652. when PBEnvironment::StillWater; move=getConst(PBMoves,:MUDBOMB) || move
  4653. when PBEnvironment::Underwater; move=getConst(PBMoves,:HYDROPUMP) || move
  4654. when PBEnvironment::Cave
  4655. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:POWERGEM) : getConst(PBMoves,:ROCKSLIDE)) || move
  4656. when PBEnvironment::Rock
  4657. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:ROCKSLIDE)) || move
  4658. when PBEnvironment::Sand
  4659. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:EARTHQUAKE)) || move
  4660. # Ice tiles in Gen 6 should be Ice Beam
  4661. when PBEnvironment::Snow
  4662. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:FROSTBREATH) : getConst(PBMoves,:ICEBEAM)) || move
  4663. when PBEnvironment::Volcano; move=getConst(PBMoves,:LAVAPLUME) || move
  4664. when PBEnvironment::Graveyard; move=getConst(PBMoves,:SHADOWBALL) || move
  4665. when PBEnvironment::Sky; move=getConst(PBMoves,:AIRSLASH) || move
  4666. when PBEnvironment::Space; move=getConst(PBMoves,:DRACOMETEOR) || move
  4667. end
  4668. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4669. move=getConst(PBMoves,:THUNDERBOLT) || move
  4670. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4671. move=getConst(PBMoves,:ENERGYBALL) || move
  4672. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4673. move=getConst(PBMoves,:MOONBLAST) || move
  4674. end
  4675. if move==0
  4676. @battle.pbDisplay(_INTL("But it failed!"))
  4677. return -1
  4678. end
  4679. thismovename=PBMoves.getName(@id)
  4680. movename=PBMoves.getName(move)
  4681. @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
  4682. target=(USENEWBATTLEMECHANICS && opponent) ? opponent.index : -1
  4683. attacker.pbUseMoveSimple(move,-1,target)
  4684. return 0
  4685. end
  4686. end
  4687.  
  4688.  
  4689.  
  4690. ################################################################################
  4691. # Uses a random move the user knows. Fails if user is not asleep. (Sleep Talk)
  4692. ################################################################################
  4693. class PokeBattle_Move_0B4 < PokeBattle_Move
  4694. def pbCanUseWhileAsleep?
  4695. return true
  4696. end
  4697.  
  4698. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4699. if attacker.status!=PBStatuses::SLEEP
  4700. @battle.pbDisplay(_INTL("But it failed!"))
  4701. return -1
  4702. end
  4703. blacklist=[
  4704. 0x02, # Struggle
  4705. 0x14, # Chatter
  4706. 0x5C, # Mimic
  4707. 0x5D, # Sketch
  4708. 0xAE, # Mirror Move
  4709. 0xAF, # Copycat
  4710. 0xB0, # Me First
  4711. 0xB3, # Nature Power
  4712. 0xB4, # Sleep Talk
  4713. 0xB5, # Assist
  4714. 0xB6, # Metronome
  4715. 0xD1, # Uproar
  4716. 0xD4, # Bide
  4717. 0x115, # Focus Punch
  4718. # Two-turn attacks
  4719. 0xC3, # Razor Wind
  4720. 0xC4, # SolarBeam
  4721. 0xC5, # Freeze Shock
  4722. 0xC6, # Ice Burn
  4723. 0xC7, # Sky Attack
  4724. 0xC8, # Skull Bash
  4725. 0xC9, # Fly
  4726. 0xCA, # Dig
  4727. 0xCB, # Dive
  4728. 0xCC, # Bounce
  4729. 0xCD, # Shadow Force
  4730. 0xCE, # Sky Drop
  4731. 0x14D, # Phantom Force
  4732. 0x14E, # Geomancy
  4733. ]
  4734. choices=[]
  4735. for i in 0...4
  4736. found=false
  4737. next if attacker.moves[i].id==0
  4738. found=true if blacklist.include?(attacker.moves[i].function)
  4739. next if found
  4740. choices.push(i) if @battle.pbCanChooseMove?(attacker.index,i,false,true)
  4741. end
  4742. if choices.length==0
  4743. @battle.pbDisplay(_INTL("But it failed!"))
  4744. return -1
  4745. end
  4746. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4747. choice=choices[@battle.pbRandom(choices.length)]
  4748. attacker.pbUseMoveSimple(attacker.moves[choice].id,choice,attacker.pbOppositeOpposing.index)
  4749. return 0
  4750. end
  4751. end
  4752.  
  4753.  
  4754.  
  4755. ################################################################################
  4756. # Uses a random move known by any non-user Pokémon in the user's party. (Assist)
  4757. ################################################################################
  4758. class PokeBattle_Move_0B5 < PokeBattle_Move
  4759. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4760. blacklist=[
  4761. 0x02, # Struggle
  4762. 0x14, # Chatter
  4763. 0x5C, # Mimic
  4764. 0x5D, # Sketch
  4765. 0x69, # Transform
  4766. 0x71, # Counter
  4767. 0x72, # Mirror Coat
  4768. 0x73, # Metal Burst
  4769. 0x9C, # Helping Hand
  4770. 0xAA, # Detect, Protect
  4771. 0xAD, # Feint
  4772. 0xAE, # Mirror Move
  4773. 0xAF, # Copycat
  4774. 0xB0, # Me First
  4775. 0xB2, # Snatch
  4776. 0xB3, # Nature Power
  4777. 0xB4, # Sleep Talk
  4778. 0xB5, # Assist
  4779. 0xB6, # Metronome
  4780. 0xCD, # Shadow Force
  4781. 0xE7, # Destiny Bond
  4782. 0xE8, # Endure
  4783. 0xEB, # Roar, Whirlwind
  4784. 0xEC, # Circle Throw, Dragon Tail
  4785. 0xF1, # Covet, Thief
  4786. 0xF2, # Switcheroo, Trick
  4787. 0xF3, # Bestow
  4788. 0x115, # Focus Punch
  4789. 0x117, # Follow Me, Rage Powder
  4790. 0x149, # Mat Block
  4791. 0x14B, # King's Shield
  4792. 0x14C, # Spiky Shield
  4793. 0x14D, # Phantom Force
  4794. 0x158 # Belch
  4795. ]
  4796. if USENEWBATTLEMECHANICS
  4797. blacklist+=[
  4798. # Two-turn attacks
  4799. 0xC3, # Razor Wind
  4800. 0xC4, # SolarBeam
  4801. 0xC5, # Freeze Shock
  4802. 0xC6, # Ice Burn
  4803. 0xC7, # Sky Attack
  4804. 0xC8, # Skull Bash
  4805. 0xC9, # Fly
  4806. 0xCA, # Dig
  4807. 0xCB, # Dive
  4808. 0xCC, # Bounce
  4809. 0xCD, # Shadow Force
  4810. 0xCE, # Sky Drop
  4811. 0x14D, # Phantom Force
  4812. 0x14E # Geomancy
  4813. ]
  4814. end
  4815. moves=[]
  4816. party=@battle.pbParty(attacker.index) # NOTE: pbParty is common to both allies in multi battles
  4817. for i in 0...party.length
  4818. if i!=attacker.pokemonIndex && party[i] && !(USENEWBATTLEMECHANICS && party[i].isEgg?)
  4819. for j in party[i].moves
  4820. next if isConst?(j.type,PBTypes,:SHADOW)
  4821. next if j.id==0
  4822. found=false
  4823. moves.push(j.id) if !blacklist.include?(PBMoveData.new(j.id).function)
  4824. end
  4825. end
  4826. end
  4827. if moves.length==0
  4828. @battle.pbDisplay(_INTL("But it failed!"))
  4829. return -1
  4830. end
  4831. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4832. move=moves[@battle.pbRandom(moves.length)]
  4833. attacker.pbUseMoveSimple(move)
  4834. return 0
  4835. end
  4836. end
  4837.  
  4838.  
  4839.  
  4840. ################################################################################
  4841. # Uses a random move that exists. (Metronome)
  4842. ################################################################################
  4843. class PokeBattle_Move_0B6 < PokeBattle_Move
  4844. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4845. blacklist=[
  4846. 0x02, # Struggle
  4847. 0x11, # Snore
  4848. 0x14, # Chatter
  4849. 0x5C, # Mimic
  4850. 0x5D, # Sketch
  4851. 0x69, # Transform
  4852. 0x71, # Counter
  4853. 0x72, # Mirror Coat
  4854. 0x73, # Metal Burst
  4855. 0x9C, # Helping Hand
  4856. 0xAA, # Detect, Protect
  4857. 0xAB, # Quick Guard
  4858. 0xAC, # Wide Guard
  4859. 0xAD, # Feint
  4860. 0xAE, # Mirror Move
  4861. 0xAF, # Copycat
  4862. 0xB0, # Me First
  4863. 0xB2, # Snatch
  4864. 0xB3, # Nature Power
  4865. 0xB4, # Sleep Talk
  4866. 0xB5, # Assist
  4867. 0xB6, # Metronome
  4868. 0xE7, # Destiny Bond
  4869. 0xE8, # Endure
  4870. 0xF1, # Covet, Thief
  4871. 0xF2, # Switcheroo, Trick
  4872. 0xF3, # Bestow
  4873. 0x115, # Focus Punch
  4874. 0x117, # Follow Me, Rage Powder
  4875. 0x11D, # After You
  4876. 0x11E # Quash
  4877. ]
  4878. blacklistmoves=[
  4879. :FREEZESHOCK,
  4880. :ICEBURN,
  4881. :RELICSONG,
  4882. :SECRETSWORD,
  4883. :SNARL,
  4884. :TECHNOBLAST,
  4885. :VCREATE,
  4886. :GEOMANCY
  4887. ]
  4888. i=0; loop do break unless i<1000
  4889. move=@battle.pbRandom(PBMoves.maxValue)+1
  4890. next if isConst?(PBMoveData.new(move).type,PBTypes,:SHADOW)
  4891. found=false
  4892. if blacklist.include?(PBMoveData.new(move).function)
  4893. found=true
  4894. else
  4895. for j in blacklistmoves
  4896. if isConst?(move,PBMoves,j)
  4897. found=true
  4898. break
  4899. end
  4900. end
  4901. end
  4902. if !found
  4903. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4904. attacker.pbUseMoveSimple(move)
  4905. return 0
  4906. end
  4907. i+=1
  4908. end
  4909. @battle.pbDisplay(_INTL("But it failed!"))
  4910. return -1
  4911. end
  4912. end
  4913.  
  4914.  
  4915.  
  4916. ################################################################################
  4917. # The target can no longer use the same move twice in a row. (Torment)
  4918. ################################################################################
  4919. class PokeBattle_Move_0B7 < PokeBattle_Move
  4920. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4921. if opponent.effects[PBEffects::Torment]
  4922. @battle.pbDisplay(_INTL("But it failed!"))
  4923. return -1
  4924. end
  4925. if !attacker.hasMoldBreaker
  4926. if opponent.hasWorkingAbility(:AROMAVEIL)
  4927. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4928. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4929. return -1
  4930. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  4931. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4932. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  4933. return -1
  4934. end
  4935. end
  4936. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4937. opponent.effects[PBEffects::Torment]=true
  4938. @battle.pbDisplay(_INTL("{1} was subjected to torment!",opponent.pbThis))
  4939. return 0
  4940. end
  4941. end
  4942.  
  4943.  
  4944.  
  4945. ################################################################################
  4946. # Disables all target's moves that the user also knows. (Imprison)
  4947. ################################################################################
  4948. class PokeBattle_Move_0B8 < PokeBattle_Move
  4949. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4950. if attacker.effects[PBEffects::Imprison]
  4951. @battle.pbDisplay(_INTL("But it failed!"))
  4952. return -1
  4953. end
  4954. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4955. attacker.effects[PBEffects::Imprison]=true
  4956. @battle.pbDisplay(_INTL("{1} sealed the opponent's move(s)!",attacker.pbThis))
  4957. return 0
  4958. end
  4959. end
  4960.  
  4961.  
  4962.  
  4963. ################################################################################
  4964. # For 5 rounds, disables the last move the target used. (Disable)
  4965. ################################################################################
  4966. class PokeBattle_Move_0B9 < PokeBattle_Move
  4967. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4968. if opponent.effects[PBEffects::Disable]>0
  4969. @battle.pbDisplay(_INTL("But it failed!"))
  4970. return -1
  4971. end
  4972. if !attacker.hasMoldBreaker
  4973. if opponent.hasWorkingAbility(:AROMAVEIL)
  4974. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4975. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4976. return -1
  4977. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  4978. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4979. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  4980. return -1
  4981. end
  4982. end
  4983. for i in opponent.moves
  4984. if i.id>0 && i.id==opponent.lastMoveUsed && (i.pp>0 || i.totalpp==0)
  4985. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4986. opponent.effects[PBEffects::Disable]=5
  4987. opponent.effects[PBEffects::DisableMove]=opponent.lastMoveUsed
  4988. @battle.pbDisplay(_INTL("{1}'s {2} was disabled!",opponent.pbThis,i.name))
  4989. return 0
  4990. end
  4991. end
  4992. @battle.pbDisplay(_INTL("But it failed!"))
  4993. return -1
  4994. end
  4995. end
  4996.  
  4997.  
  4998.  
  4999. ################################################################################
  5000. # For 4 rounds, disables the target's non-damaging moves. (Taunt)
  5001. ################################################################################
  5002. class PokeBattle_Move_0BA < PokeBattle_Move
  5003. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5004. if opponent.effects[PBEffects::Taunt]>0 ||
  5005. (USENEWBATTLEMECHANICS &&
  5006. !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS))
  5007. @battle.pbDisplay(_INTL("But it failed!"))
  5008. return -1
  5009. end
  5010. if !attacker.hasMoldBreaker
  5011. if opponent.hasWorkingAbility(:AROMAVEIL)
  5012. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5013. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5014. return -1
  5015. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5016. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5017. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5018. return -1
  5019. end
  5020. end
  5021. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5022. opponent.effects[PBEffects::Taunt]=4
  5023. @battle.pbDisplay(_INTL("{1} fell for the taunt!",opponent.pbThis))
  5024. return 0
  5025. end
  5026. end
  5027.  
  5028.  
  5029.  
  5030. ################################################################################
  5031. # For 5 rounds, disables the target's healing moves. (Heal Block)
  5032. ################################################################################
  5033. class PokeBattle_Move_0BB < PokeBattle_Move
  5034. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5035. if opponent.effects[PBEffects::HealBlock]>0
  5036. @battle.pbDisplay(_INTL("But it failed!"))
  5037. return -1
  5038. end
  5039. if !attacker.hasMoldBreaker
  5040. if opponent.hasWorkingAbility(:AROMAVEIL)
  5041. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5042. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5043. return -1
  5044. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5045. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5046. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5047. return -1
  5048. end
  5049. end
  5050. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5051. opponent.effects[PBEffects::HealBlock]=5
  5052. @battle.pbDisplay(_INTL("{1} was prevented from healing!",opponent.pbThis))
  5053. return 0
  5054. end
  5055. end
  5056.  
  5057.  
  5058.  
  5059. ################################################################################
  5060. # For 4 rounds, the target must use the same move each round. (Encore)
  5061. ################################################################################
  5062. class PokeBattle_Move_0BC < PokeBattle_Move
  5063. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5064. blacklist=[
  5065. 0x02, # Struggle
  5066. 0x5C, # Mimic
  5067. 0x5D, # Sketch
  5068. 0x69, # Transform
  5069. 0xAE, # Mirror Move
  5070. 0xBC # Encore
  5071. ]
  5072. if opponent.effects[PBEffects::Encore]>0
  5073. @battle.pbDisplay(_INTL("But it failed!"))
  5074. return -1
  5075. end
  5076. if opponent.lastMoveUsed<=0 ||
  5077. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  5078. @battle.pbDisplay(_INTL("But it failed!"))
  5079. return -1
  5080. end
  5081. if !attacker.hasMoldBreaker
  5082. if opponent.hasWorkingAbility(:AROMAVEIL)
  5083. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5084. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5085. return -1
  5086. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5087. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5088. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5089. return -1
  5090. end
  5091. end
  5092. for i in 0...4
  5093. if opponent.lastMoveUsed==opponent.moves[i].id &&
  5094. (opponent.moves[i].pp>0 || opponent.moves[i].totalpp==0)
  5095. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5096. opponent.effects[PBEffects::Encore]=4
  5097. opponent.effects[PBEffects::EncoreIndex]=i
  5098. opponent.effects[PBEffects::EncoreMove]=opponent.moves[i].id
  5099. @battle.pbDisplay(_INTL("{1} received an encore!",opponent.pbThis))
  5100. return 0
  5101. end
  5102. end
  5103. @battle.pbDisplay(_INTL("But it failed!"))
  5104. return -1
  5105. end
  5106. end
  5107.  
  5108.  
  5109.  
  5110. ################################################################################
  5111. # Hits twice.
  5112. ################################################################################
  5113. class PokeBattle_Move_0BD < PokeBattle_Move
  5114. def pbIsMultiHit
  5115. return true
  5116. end
  5117.  
  5118. def pbNumHits(attacker)
  5119. return 2
  5120. end
  5121. end
  5122.  
  5123.  
  5124.  
  5125. ################################################################################
  5126. # Hits twice. May poison the target on each hit. (Twineedle)
  5127. ################################################################################
  5128. class PokeBattle_Move_0BE < PokeBattle_Move
  5129. def pbIsMultiHit
  5130. return true
  5131. end
  5132.  
  5133. def pbNumHits(attacker)
  5134. return 2
  5135. end
  5136.  
  5137. def pbAdditionalEffect(attacker,opponent)
  5138. return if opponent.damagestate.substitute
  5139. if opponent.pbCanPoison?(attacker,false,self)
  5140. opponent.pbPoison(attacker)
  5141. end
  5142. end
  5143. end
  5144.  
  5145.  
  5146.  
  5147. ################################################################################
  5148. # Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
  5149. # An accuracy check is performed for each hit.
  5150. ################################################################################
  5151. class PokeBattle_Move_0BF < PokeBattle_Move
  5152. def pbIsMultiHit
  5153. return true
  5154. end
  5155.  
  5156. def pbNumHits(attacker)
  5157. return 3
  5158. end
  5159.  
  5160. def successCheckPerHit?
  5161. return @checks
  5162. end
  5163.  
  5164. def pbOnStartUse(attacker)
  5165. @calcbasedmg=@basedamage
  5166. @checks=!attacker.hasWorkingAbility(:SKILLLINK)
  5167. return true
  5168. end
  5169.  
  5170. def pbBaseDamage(basedmg,attacker,opponent)
  5171. ret=@calcbasedmg
  5172. @calcbasedmg+=basedmg
  5173. return ret
  5174. end
  5175. end
  5176.  
  5177.  
  5178.  
  5179. ################################################################################
  5180. # Hits 2-5 times.
  5181. ################################################################################
  5182. class PokeBattle_Move_0C0 < PokeBattle_Move
  5183. def pbIsMultiHit
  5184. return true
  5185. end
  5186.  
  5187. def pbNumHits(attacker)
  5188. hitchances=[2,2,3,3,4,5]
  5189. ret=hitchances[@battle.pbRandom(hitchances.length)]
  5190. ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  5191. return ret
  5192. end
  5193. end
  5194.  
  5195.  
  5196.  
  5197. ################################################################################
  5198. # Hits X times, where X is 1 (the user) plus the number of non-user unfainted
  5199. # status-free Pokémon in the user's party (the participants). Fails if X is 0.
  5200. # Base power of each hit depends on the base Attack stat for the species of that
  5201. # hit's participant. (Beat Up)
  5202. ################################################################################
  5203. class PokeBattle_Move_0C1 < PokeBattle_Move
  5204. def pbIsMultiHit
  5205. return true
  5206. end
  5207.  
  5208. def pbNumHits(attacker)
  5209. return @participants.length
  5210. end
  5211.  
  5212. def pbOnStartUse(attacker)
  5213. party=@battle.pbParty(attacker.index)
  5214. @participants=[]
  5215. for i in 0...party.length
  5216. if attacker.pokemonIndex==i
  5217. @participants.push(i)
  5218. elsif party[i] && !party[i].isEgg? && party[i].hp>0 && party[i].status==0
  5219. @participants.push(i)
  5220. end
  5221. end
  5222. if @participants.length==0
  5223. @battle.pbDisplay(_INTL("But it failed!"))
  5224. return false
  5225. end
  5226. return true
  5227. end
  5228.  
  5229. def pbBaseDamage(basedmg,attacker,opponent)
  5230. party=@battle.pbParty(attacker.index)
  5231. atk=party[@participants[0]].baseStats[1]
  5232. @participants[0]=nil; @participants.compact!
  5233. return 5+(atk/10)
  5234. end
  5235. end
  5236.  
  5237.  
  5238.  
  5239. ################################################################################
  5240. # Two turn attack. Attacks first turn, skips second turn (if successful).
  5241. ################################################################################
  5242. class PokeBattle_Move_0C2 < PokeBattle_Move
  5243. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5244. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5245. if opponent.damagestate.calcdamage>0
  5246. attacker.effects[PBEffects::HyperBeam]=2
  5247. attacker.currentMove=@id
  5248. end
  5249. return ret
  5250. end
  5251. end
  5252.  
  5253.  
  5254.  
  5255. ################################################################################
  5256. # Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
  5257. ################################################################################
  5258. class PokeBattle_Move_0C3 < PokeBattle_Move
  5259. def pbTwoTurnAttack(attacker)
  5260. @immediate=false
  5261. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5262. @immediate=true
  5263. end
  5264. return false if @immediate
  5265. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5266. end
  5267.  
  5268. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5269. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5270. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5271. @battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",attacker.pbThis))
  5272. end
  5273. if @immediate
  5274. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5275. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5276. attacker.pbConsumeItem
  5277. end
  5278. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5279. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5280. end
  5281. end
  5282.  
  5283.  
  5284.  
  5285. ################################################################################
  5286. # Two turn attack. Skips first turn, attacks second turn. (SolarBeam)
  5287. # Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
  5288. ################################################################################
  5289. class PokeBattle_Move_0C4 < PokeBattle_Move
  5290. def pbTwoTurnAttack(attacker)
  5291. @immediate=false; @sunny=false
  5292. if attacker.effects[PBEffects::TwoTurnAttack]==0
  5293. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  5294. @battle.pbWeather==PBWeather::HARSHSUN
  5295. @immediate=true; @sunny=true
  5296. end
  5297. end
  5298. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5299. @immediate=true
  5300. end
  5301. return false if @immediate
  5302. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5303. end
  5304.  
  5305. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  5306. if @battle.pbWeather!=0 &&
  5307. @battle.pbWeather!=PBWeather::SUNNYDAY &&
  5308. @battle.pbWeather!=PBWeather::HARSHSUN
  5309. return (damagemult*0.5).round
  5310. end
  5311. return damagemult
  5312. end
  5313.  
  5314. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5315. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5316. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5317. @battle.pbDisplay(_INTL("{1} took in sunlight!",attacker.pbThis))
  5318. end
  5319. if @immediate && !@sunny
  5320. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5321. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5322. attacker.pbConsumeItem
  5323. end
  5324. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5325. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5326. end
  5327. end
  5328.  
  5329.  
  5330.  
  5331.  
  5332. ################################################################################
  5333. # Two turn attack. Skips first turn, attacks second turn. (Freeze Shock)
  5334. # May paralyze the target.
  5335. ################################################################################
  5336. class PokeBattle_Move_0C5 < PokeBattle_Move
  5337. def pbTwoTurnAttack(attacker)
  5338. @immediate=false
  5339. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5340. @immediate=true
  5341. end
  5342. return false if @immediate
  5343. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5344. end
  5345.  
  5346. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5347. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5348. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5349. @battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",attacker.pbThis))
  5350. end
  5351. if @immediate
  5352. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5353. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5354. attacker.pbConsumeItem
  5355. end
  5356. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5357. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5358. end
  5359.  
  5360. def pbAdditionalEffect(attacker,opponent)
  5361. return if opponent.damagestate.substitute
  5362. if opponent.pbCanParalyze?(attacker,false,self)
  5363. opponent.pbParalyze(attacker)
  5364. end
  5365. end
  5366. end
  5367.  
  5368.  
  5369.  
  5370. ################################################################################
  5371. # Two turn attack. Skips first turn, attacks second turn. (Ice Burn)
  5372. # May burn the target.
  5373. ################################################################################
  5374. class PokeBattle_Move_0C6 < PokeBattle_Move
  5375. def pbTwoTurnAttack(attacker)
  5376. @immediate=false
  5377. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5378. @immediate=true
  5379. end
  5380. return false if @immediate
  5381. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5382. end
  5383.  
  5384. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5385. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5386. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5387. @battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",attacker.pbThis))
  5388. end
  5389. if @immediate
  5390. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5391. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5392. attacker.pbConsumeItem
  5393. end
  5394. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5395. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5396. end
  5397.  
  5398. def pbAdditionalEffect(attacker,opponent)
  5399. return if opponent.damagestate.substitute
  5400. if opponent.pbCanBurn?(attacker,false,self)
  5401. opponent.pbBurn(attacker)
  5402. end
  5403. end
  5404. end
  5405.  
  5406.  
  5407.  
  5408. ################################################################################
  5409. # Two turn attack. Skips first turn, attacks second turn. (Sky Attack)
  5410. # May make the target flinch.
  5411. ################################################################################
  5412. class PokeBattle_Move_0C7 < PokeBattle_Move
  5413. def pbTwoTurnAttack(attacker)
  5414. @immediate=false
  5415. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5416. @immediate=true
  5417. end
  5418. return false if @immediate
  5419. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5420. end
  5421.  
  5422. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5423. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5424. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5425. @battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",attacker.pbThis))
  5426. end
  5427. if @immediate
  5428. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5429. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5430. attacker.pbConsumeItem
  5431. end
  5432. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5433. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5434. end
  5435.  
  5436. def pbAdditionalEffect(attacker,opponent)
  5437. return if opponent.damagestate.substitute
  5438. opponent.pbFlinch(attacker)
  5439. end
  5440. end
  5441.  
  5442.  
  5443.  
  5444. ################################################################################
  5445. # Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
  5446. # (Skull Bash)
  5447. ################################################################################
  5448. class PokeBattle_Move_0C8 < PokeBattle_Move
  5449. def pbTwoTurnAttack(attacker)
  5450. @immediate=false
  5451. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5452. @immediate=true
  5453. end
  5454. return false if @immediate
  5455. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5456. end
  5457.  
  5458. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5459. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5460. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5461. @battle.pbDisplay(_INTL("{1} tucked in its head!",attacker.pbThis))
  5462. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5463. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  5464. end
  5465. end
  5466. if @immediate
  5467. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5468. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5469. attacker.pbConsumeItem
  5470. end
  5471. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5472. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5473. end
  5474. end
  5475.  
  5476.  
  5477.  
  5478. ################################################################################
  5479. # Two turn attack. Skips first turn, attacks second turn. (Fly)
  5480. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5481. ################################################################################
  5482. class PokeBattle_Move_0C9 < PokeBattle_Move
  5483. def unusableInGravity?
  5484. return true
  5485. end
  5486.  
  5487. def pbTwoTurnAttack(attacker)
  5488. @immediate=false
  5489. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5490. @immediate=true
  5491. end
  5492. return false if @immediate
  5493. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5494. end
  5495.  
  5496. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5497. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5498. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5499. @battle.pbDisplay(_INTL("{1} flew up high!",attacker.pbThis))
  5500. end
  5501. if @immediate
  5502. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5503. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5504. attacker.pbConsumeItem
  5505. end
  5506. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5507. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5508. end
  5509. end
  5510.  
  5511.  
  5512.  
  5513. ################################################################################
  5514. # Two turn attack. Skips first turn, attacks second turn. (Dig)
  5515. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5516. ################################################################################
  5517. class PokeBattle_Move_0CA < PokeBattle_Move
  5518. def pbTwoTurnAttack(attacker)
  5519. @immediate=false
  5520. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5521. @immediate=true
  5522. end
  5523. return false if @immediate
  5524. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5525. end
  5526.  
  5527. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5528. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5529. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5530. @battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",attacker.pbThis))
  5531. end
  5532. if @immediate
  5533. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5534. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5535. attacker.pbConsumeItem
  5536. end
  5537. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5538. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5539. end
  5540. end
  5541.  
  5542.  
  5543.  
  5544. ################################################################################
  5545. # Two turn attack. Skips first turn, attacks second turn. (Dive)
  5546. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5547. ################################################################################
  5548. class PokeBattle_Move_0CB < PokeBattle_Move
  5549. def pbTwoTurnAttack(attacker)
  5550. @immediate=false
  5551. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5552. @immediate=true
  5553. end
  5554. return false if @immediate
  5555. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5556. end
  5557.  
  5558. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5559. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5560. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5561. @battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
  5562. end
  5563. if @immediate
  5564. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5565. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5566. attacker.pbConsumeItem
  5567. end
  5568. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5569. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5570. end
  5571. end
  5572.  
  5573.  
  5574.  
  5575. ################################################################################
  5576. # Two turn attack. Skips first turn, attacks second turn. (Bounce)
  5577. # May paralyze the target.
  5578. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5579. ################################################################################
  5580. class PokeBattle_Move_0CC < PokeBattle_Move
  5581. def unusableInGravity?
  5582. return true
  5583. end
  5584.  
  5585. def pbTwoTurnAttack(attacker)
  5586. @immediate=false
  5587. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5588. @immediate=true
  5589. end
  5590. return false if @immediate
  5591. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5592. end
  5593.  
  5594. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5595. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5596. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5597. @battle.pbDisplay(_INTL("{1} sprang up!",attacker.pbThis))
  5598. end
  5599. if @immediate
  5600. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5601. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5602. attacker.pbConsumeItem
  5603. end
  5604. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5605. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5606. end
  5607.  
  5608. def pbAdditionalEffect(attacker,opponent)
  5609. return if opponent.damagestate.substitute
  5610. if opponent.pbCanParalyze?(attacker,false,self)
  5611. opponent.pbParalyze(attacker)
  5612. end
  5613. end
  5614. end
  5615.  
  5616.  
  5617.  
  5618. ################################################################################
  5619. # Two turn attack. Skips first turn, attacks second turn. (Shadow Force)
  5620. # Is invulnerable during use.
  5621. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  5622. # this round. If successful, negates them this round.
  5623. ################################################################################
  5624. class PokeBattle_Move_0CD < PokeBattle_Move
  5625. def pbTwoTurnAttack(attacker)
  5626. @immediate=false
  5627. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5628. @immediate=true
  5629. end
  5630. return false if @immediate
  5631. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5632. end
  5633.  
  5634. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5635. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5636. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5637. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  5638. end
  5639. if @immediate
  5640. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5641. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5642. attacker.pbConsumeItem
  5643. end
  5644. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5645. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5646. if ret>0
  5647. opponent.effects[PBEffects::ProtectNegation]=true
  5648. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  5649. end
  5650. return ret
  5651. end
  5652. end
  5653.  
  5654.  
  5655.  
  5656. ################################################################################
  5657. # Two turn attack. Skips first turn, attacks second turn. (Sky Drop)
  5658. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5659. # Target is also semi-invulnerable during use, and can't take any action.
  5660. # Doesn't damage airborne Pokémon (but still makes them unable to move during).
  5661. ################################################################################
  5662. class PokeBattle_Move_0CE < PokeBattle_Move
  5663. def unusableInGravity?
  5664. return true
  5665. end
  5666.  
  5667. def pbMoveFailed(attacker,opponent)
  5668. ret=false
  5669. ret=true if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  5670. ret=true if opponent.effects[PBEffects::TwoTurnAttack]>0
  5671. ret=true if opponent.effects[PBEffects::SkyDrop] && attacker.effects[PBEffects::TwoTurnAttack]>0
  5672. ret=true if !opponent.pbIsOpposing?(attacker.index)
  5673. ret=true if USENEWBATTLEMECHANICS && opponent.weight(attacker)>=2000
  5674. return ret
  5675. end
  5676.  
  5677. def pbTwoTurnAttack(attacker)
  5678. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5679. end
  5680.  
  5681. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5682. if attacker.effects[PBEffects::TwoTurnAttack]>0
  5683. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5684. @battle.pbDisplay(_INTL("{1} took {2} into the sky!",attacker.pbThis,opponent.pbThis(true)))
  5685. opponent.effects[PBEffects::SkyDrop]=true
  5686. end
  5687. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5688. ret=super
  5689. @battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",opponent.pbThis))
  5690. opponent.effects[PBEffects::SkyDrop]=false
  5691. return ret
  5692. end
  5693.  
  5694. def pbTypeModifier(type,attacker,opponent)
  5695. return 0 if opponent.pbHasType?(:FLYING)
  5696. return 0 if !attacker.hasMoldBreaker &&
  5697. opponent.hasWorkingAbility(:LEVITATE) && !opponent.effects[PBEffects::SmackDown]
  5698. return super
  5699. end
  5700. end
  5701.  
  5702.  
  5703.  
  5704. ################################################################################
  5705. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5706. # at end of each round.
  5707. ################################################################################
  5708. class PokeBattle_Move_0CF < PokeBattle_Move
  5709. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5710. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5711. if opponent.damagestate.calcdamage>0 && !opponent.isFainted? &&
  5712. !opponent.damagestate.substitute
  5713. if opponent.effects[PBEffects::MultiTurn]==0
  5714. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5715. if attacker.hasWorkingItem(:GRIPCLAW)
  5716. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5717. end
  5718. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5719. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5720. if isConst?(@id,PBMoves,:BIND)
  5721. @battle.pbDisplay(_INTL("{1} was squeezed by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5722. elsif isConst?(@id,PBMoves,:CLAMP)
  5723. @battle.pbDisplay(_INTL("{1} clamped {2}!",attacker.pbThis,opponent.pbThis(true)))
  5724. elsif isConst?(@id,PBMoves,:FIRESPIN)
  5725. @battle.pbDisplay(_INTL("{1} was trapped in the fiery vortex!",opponent.pbThis))
  5726. elsif isConst?(@id,PBMoves,:MAGMASTORM)
  5727. @battle.pbDisplay(_INTL("{1} became trapped by Magma Storm!",opponent.pbThis))
  5728. elsif isConst?(@id,PBMoves,:SANDTOMB)
  5729. @battle.pbDisplay(_INTL("{1} became trapped by Sand Tomb!",opponent.pbThis))
  5730. elsif isConst?(@id,PBMoves,:WRAP)
  5731. @battle.pbDisplay(_INTL("{1} was wrapped by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5732. elsif isConst?(@id,PBMoves,:INFESTATION)
  5733. @battle.pbDisplay(_INTL("{1} has been afflicted with an infestation by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5734. else
  5735. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5736. end
  5737. end
  5738. end
  5739. return ret
  5740. end
  5741. end
  5742.  
  5743.  
  5744.  
  5745. ################################################################################
  5746. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5747. # at end of each round. (Whirlpool)
  5748. # Power is doubled if target is using Dive.
  5749. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  5750. ################################################################################
  5751. class PokeBattle_Move_0D0 < PokeBattle_Move
  5752. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5753. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5754. if opponent.damagestate.calcdamage>0 && !opponent.isFainted? &&
  5755. !opponent.damagestate.substitute
  5756. if opponent.effects[PBEffects::MultiTurn]==0
  5757. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5758. if attacker.hasWorkingItem(:GRIPCLAW)
  5759. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5760. end
  5761. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5762. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5763. @battle.pbDisplay(_INTL("{1} became trapped in the vortex!",opponent.pbThis))
  5764. end
  5765. end
  5766. return ret
  5767. end
  5768.  
  5769. def pbModifyDamage(damagemult,attacker,opponent)
  5770. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  5771. return (damagemult*2.0).round
  5772. end
  5773. return damagemult
  5774. end
  5775. end
  5776.  
  5777.  
  5778.  
  5779. ################################################################################
  5780. # User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
  5781. ################################################################################
  5782. class PokeBattle_Move_0D1 < PokeBattle_Move
  5783. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5784. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5785. if opponent.damagestate.calcdamage>0
  5786. if attacker.effects[PBEffects::Uproar]==0
  5787. attacker.effects[PBEffects::Uproar]=3
  5788. @battle.pbDisplay(_INTL("{1} caused an uproar!",attacker.pbThis))
  5789. attacker.currentMove=@id
  5790. end
  5791. end
  5792. return ret
  5793. end
  5794. end
  5795.  
  5796.  
  5797.  
  5798. ################################################################################
  5799. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  5800. # (Outrage, Petal Dange, Thrash)
  5801. ################################################################################
  5802. class PokeBattle_Move_0D2 < PokeBattle_Move
  5803. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5804. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5805. if opponent.damagestate.calcdamage>0 &&
  5806. attacker.effects[PBEffects::Outrage]==0 &&
  5807. attacker.status!=PBStatuses::SLEEP
  5808. attacker.effects[PBEffects::Outrage]=2+@battle.pbRandom(2)
  5809. attacker.currentMove=@id
  5810. elsif pbTypeModifier(@type,attacker,opponent)==0
  5811. # Cancel effect if attack is ineffective
  5812. attacker.effects[PBEffects::Outrage]=0
  5813. end
  5814. if attacker.effects[PBEffects::Outrage]>0
  5815. attacker.effects[PBEffects::Outrage]-=1
  5816. if attacker.effects[PBEffects::Outrage]==0 && attacker.pbCanConfuseSelf?(false)
  5817. attacker.pbConfuse
  5818. @battle.pbDisplay(_INTL("{1} became confused due to fatigue!",attacker.pbThis))
  5819. end
  5820. end
  5821. return ret
  5822. end
  5823. end
  5824.  
  5825.  
  5826.  
  5827. ################################################################################
  5828. # User must use this move for 4 more rounds. Power doubles each round.
  5829. # Power is also doubled if user has curled up. (Ice Ball, Rollout)
  5830. ################################################################################
  5831. class PokeBattle_Move_0D3 < PokeBattle_Move
  5832. def pbBaseDamage(basedmg,attacker,opponent)
  5833. shift=(4-attacker.effects[PBEffects::Rollout]) # from 0 through 4, 0 is most powerful
  5834. shift+=1 if attacker.effects[PBEffects::DefenseCurl]
  5835. basedmg=basedmg<<shift
  5836. return basedmg
  5837. end
  5838.  
  5839. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5840. attacker.effects[PBEffects::Rollout]=5 if attacker.effects[PBEffects::Rollout]==0
  5841. attacker.effects[PBEffects::Rollout]-=1
  5842. attacker.currentMove=thismove.id
  5843. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5844. if opponent.damagestate.calcdamage==0 ||
  5845. pbTypeModifier(@type,attacker,opponent)==0 ||
  5846. attacker.status==PBStatuses::SLEEP
  5847. # Cancel effect if attack is ineffective
  5848. attacker.effects[PBEffects::Rollout]=0
  5849. end
  5850. return ret
  5851. end
  5852. end
  5853.  
  5854.  
  5855.  
  5856. ################################################################################
  5857. # User bides its time this round and next round. The round after, deals 2x the
  5858. # total damage it took while biding to the last battler that damaged it. (Bide)
  5859. ################################################################################
  5860. class PokeBattle_Move_0D4 < PokeBattle_Move
  5861. def pbDisplayUseMessage(attacker)
  5862. if attacker.effects[PBEffects::Bide]==0
  5863. @battle.pbDisplayBrief(_INTL("{1} used\r\n{2}!",attacker.pbThis,name))
  5864. attacker.effects[PBEffects::Bide]=2
  5865. attacker.effects[PBEffects::BideDamage]=0
  5866. attacker.effects[PBEffects::BideTarget]=-1
  5867. attacker.currentMove=@id
  5868. pbShowAnimation(@id,attacker,nil)
  5869. return 1
  5870. else
  5871. attacker.effects[PBEffects::Bide]-=1
  5872. if attacker.effects[PBEffects::Bide]==0
  5873. @battle.pbDisplayBrief(_INTL("{1} unleashed energy!",attacker.pbThis))
  5874. return 0
  5875. else
  5876. @battle.pbDisplayBrief(_INTL("{1} is storing energy!",attacker.pbThis))
  5877. return 2
  5878. end
  5879. end
  5880. end
  5881.  
  5882. def pbAddTarget(targets,attacker)
  5883. if attacker.effects[PBEffects::BideTarget]>=0
  5884. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::BideTarget]])
  5885. attacker.pbRandomTarget(targets)
  5886. end
  5887. else
  5888. attacker.pbRandomTarget(targets)
  5889. end
  5890. end
  5891.  
  5892. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5893. if attacker.effects[PBEffects::BideDamage]==0 || !opponent
  5894. @battle.pbDisplay(_INTL("But it failed!"))
  5895. return -1
  5896. end
  5897. if USENEWBATTLEMECHANICS
  5898. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  5899. if typemod==0
  5900. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  5901. return -1
  5902. end
  5903. end
  5904. ret=pbEffectFixedDamage(attacker.effects[PBEffects::BideDamage]*2,attacker,opponent,hitnum,alltargets,showanimation)
  5905. return ret
  5906. end
  5907. end
  5908.  
  5909.  
  5910.  
  5911. ################################################################################
  5912. # Heals user by 1/2 of its max HP.
  5913. ################################################################################
  5914. class PokeBattle_Move_0D5 < PokeBattle_Move
  5915. def isHealingMove?
  5916. return true
  5917. end
  5918.  
  5919. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5920. if attacker.hp==attacker.totalhp
  5921. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5922. return -1
  5923. end
  5924. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5925. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5926. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5927. return 0
  5928. end
  5929. end
  5930.  
  5931.  
  5932.  
  5933. ################################################################################
  5934. # Heals user by 1/2 of its max HP. (Roost)
  5935. # User roosts, and its Flying type is ignored for attacks used against it.
  5936. ################################################################################
  5937. class PokeBattle_Move_0D6 < PokeBattle_Move
  5938. def isHealingMove?
  5939. return true
  5940. end
  5941.  
  5942. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5943. if attacker.hp==attacker.totalhp
  5944. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5945. return -1
  5946. end
  5947. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5948. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5949. attacker.effects[PBEffects::Roost]=true
  5950. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5951. return 0
  5952. end
  5953. end
  5954.  
  5955.  
  5956.  
  5957. ################################################################################
  5958. # Battler in user's position is healed by 1/2 of its max HP, at the end of the
  5959. # next round. (Wish)
  5960. ################################################################################
  5961. class PokeBattle_Move_0D7 < PokeBattle_Move
  5962. def isHealingMove?
  5963. return true
  5964. end
  5965.  
  5966. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5967. if attacker.effects[PBEffects::Wish]>0
  5968. @battle.pbDisplay(_INTL("But it failed!"))
  5969. return -1
  5970. end
  5971. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5972. attacker.effects[PBEffects::Wish]=2
  5973. attacker.effects[PBEffects::WishAmount]=((attacker.totalhp+1)/2).floor
  5974. attacker.effects[PBEffects::WishMaker]=attacker.pokemonIndex
  5975. return 0
  5976. end
  5977. end
  5978.  
  5979.  
  5980.  
  5981. ################################################################################
  5982. # Heals user by an amount depending on the weather. (Moonlight, Morning Sun,
  5983. # Synthesis)
  5984. ################################################################################
  5985. class PokeBattle_Move_0D8 < PokeBattle_Move
  5986. def isHealingMove?
  5987. return true
  5988. end
  5989.  
  5990. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5991. if attacker.hp==attacker.totalhp
  5992. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5993. return -1
  5994. end
  5995. hpgain=0
  5996. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  5997. @battle.pbWeather==PBWeather::HARSHSUN
  5998. hpgain=(attacker.totalhp*2/3).floor
  5999. elsif @battle.pbWeather!=0
  6000. hpgain=(attacker.totalhp/4).floor
  6001. else
  6002. hpgain=(attacker.totalhp/2).floor
  6003. end
  6004. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6005. attacker.pbRecoverHP(hpgain,true)
  6006. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6007. return 0
  6008. end
  6009. end
  6010.  
  6011.  
  6012.  
  6013. ################################################################################
  6014. # Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
  6015. ################################################################################
  6016. class PokeBattle_Move_0D9 < PokeBattle_Move
  6017. def isHealingMove?
  6018. return true
  6019. end
  6020.  
  6021. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6022. if !attacker.pbCanSleep?(attacker,true,self,true)
  6023. return -1
  6024. end
  6025. if attacker.status==PBStatuses::SLEEP
  6026. @battle.pbDisplay(_INTL("But it failed!"))
  6027. return -1
  6028. end
  6029. if attacker.hp==attacker.totalhp
  6030. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6031. return -1
  6032. end
  6033. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6034. attacker.pbSleepSelf(3)
  6035. @battle.pbDisplay(_INTL("{1} slept and became healthy!",attacker.pbThis))
  6036. hp=attacker.pbRecoverHP(attacker.totalhp-attacker.hp,true)
  6037. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis)) if hp>0
  6038. return 0
  6039. end
  6040. end
  6041.  
  6042.  
  6043.  
  6044. ################################################################################
  6045. # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
  6046. # (Aqua Ring)
  6047. ################################################################################
  6048. class PokeBattle_Move_0DA < PokeBattle_Move
  6049. def isHealingMove?
  6050. return true
  6051. end
  6052.  
  6053. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6054. if attacker.effects[PBEffects::AquaRing]
  6055. @battle.pbDisplay(_INTL("But it failed!"))
  6056. return -1
  6057. end
  6058. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6059. attacker.effects[PBEffects::AquaRing]=true
  6060. @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
  6061. return 0
  6062. end
  6063. end
  6064.  
  6065.  
  6066.  
  6067. ################################################################################
  6068. # Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
  6069. # round, and cannot flee or switch out. (Ingrain)
  6070. ################################################################################
  6071. class PokeBattle_Move_0DB < PokeBattle_Move
  6072. def isHealingMove?
  6073. return true
  6074. end
  6075.  
  6076. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6077. if attacker.effects[PBEffects::Ingrain]
  6078. @battle.pbDisplay(_INTL("But it failed!"))
  6079. return -1
  6080. end
  6081. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6082. attacker.effects[PBEffects::Ingrain]=true
  6083. @battle.pbDisplay(_INTL("{1} planted its roots!",attacker.pbThis))
  6084. return 0
  6085. end
  6086. end
  6087.  
  6088.  
  6089.  
  6090. ################################################################################
  6091. # Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each round,
  6092. # and the Pokémon in the user's position gains the same amount. (Leech Seed)
  6093. ################################################################################
  6094. class PokeBattle_Move_0DC < PokeBattle_Move
  6095. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6096. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6097. @battle.pbDisplay(_INTL("But it failed!"))
  6098. return -1
  6099. end
  6100. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  6101. if opponent.effects[PBEffects::LeechSeed]>=0
  6102. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  6103. return -1
  6104. end
  6105. if opponent.pbHasType?(:GRASS)
  6106. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6107. return -1
  6108. end
  6109. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6110. opponent.effects[PBEffects::LeechSeed]=attacker.index
  6111. @battle.pbDisplay(_INTL("{1} was seeded!",opponent.pbThis))
  6112. return 0
  6113. end
  6114. end
  6115.  
  6116.  
  6117.  
  6118. ################################################################################
  6119. # User gains half the HP it inflicts as damage.
  6120. ################################################################################
  6121. class PokeBattle_Move_0DD < PokeBattle_Move
  6122. def isHealingMove?
  6123. return USENEWBATTLEMECHANICS
  6124. end
  6125.  
  6126. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6127. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6128. if opponent.damagestate.calcdamage>0
  6129. hpgain=(opponent.damagestate.hplost/2).round
  6130. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6131. attacker.pbReduceHP(hpgain,true)
  6132. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6133. elsif attacker.effects[PBEffects::HealBlock]==0
  6134. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6135. attacker.pbRecoverHP(hpgain,true)
  6136. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6137. end
  6138. end
  6139. return ret
  6140. end
  6141. end
  6142.  
  6143.  
  6144.  
  6145. ################################################################################
  6146. # User gains half the HP it inflicts as damage. (Dream Eater)
  6147. # (Handled in Battler's pbSuccessCheck): Fails if target is not asleep.
  6148. ################################################################################
  6149. class PokeBattle_Move_0DE < PokeBattle_Move
  6150. def isHealingMove?
  6151. return USENEWBATTLEMECHANICS
  6152. end
  6153.  
  6154. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6155. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6156. if opponent.damagestate.calcdamage>0
  6157. hpgain=(opponent.damagestate.hplost/2).round
  6158. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6159. attacker.pbReduceHP(hpgain,true)
  6160. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6161. elsif attacker.effects[PBEffects::HealBlock]==0
  6162. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6163. attacker.pbRecoverHP(hpgain,true)
  6164. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6165. end
  6166. end
  6167. return ret
  6168. end
  6169. end
  6170.  
  6171.  
  6172.  
  6173. ################################################################################
  6174. # Heals target by 1/2 of its max HP. (Heal Pulse)
  6175. ################################################################################
  6176. class PokeBattle_Move_0DF < PokeBattle_Move
  6177. def isHealingMove?
  6178. return true
  6179. end
  6180.  
  6181. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6182. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6183. @battle.pbDisplay(_INTL("But it failed!"))
  6184. return -1
  6185. end
  6186. if opponent.hp==opponent.totalhp
  6187. @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
  6188. return -1
  6189. end
  6190. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6191. hpgain=((opponent.totalhp+1)/2).floor
  6192. hpgain=(opponent.totalhp*3/4).round if attacker.hasWorkingAbility(:MEGALAUNCHER)
  6193. opponent.pbRecoverHP(hpgain,true)
  6194. @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
  6195. return 0
  6196. end
  6197. end
  6198.  
  6199.  
  6200.  
  6201. ################################################################################
  6202. # User faints. (Explosion, Selfdestruct)
  6203. ################################################################################
  6204. class PokeBattle_Move_0E0 < PokeBattle_Move
  6205. def pbOnStartUse(attacker)
  6206. if !attacker.hasMoldBreaker
  6207. bearer=@battle.pbCheckGlobalAbility(:DAMP)
  6208. if bearer!=nil
  6209. @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  6210. bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  6211. return false
  6212. end
  6213. end
  6214. return true
  6215. end
  6216.  
  6217. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6218. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6219. if !attacker.isFainted?
  6220. attacker.pbReduceHP(attacker.hp)
  6221. attacker.pbFaint if attacker.isFainted?
  6222. end
  6223. end
  6224. end
  6225.  
  6226.  
  6227.  
  6228. ################################################################################
  6229. # Inflicts fixed damage equal to user's current HP. (Final Gambit)
  6230. # User faints (if successful).
  6231. ################################################################################
  6232. class PokeBattle_Move_0E1 < PokeBattle_Move
  6233. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6234. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  6235. if typemod==0
  6236. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6237. return -1
  6238. end
  6239. ret=pbEffectFixedDamage(attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  6240. return ret
  6241. end
  6242.  
  6243. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6244. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6245. if !attacker.isFainted?
  6246. attacker.pbReduceHP(attacker.hp)
  6247. attacker.pbFaint if attacker.isFainted?
  6248. end
  6249. end
  6250. end
  6251.  
  6252.  
  6253.  
  6254. ################################################################################
  6255. # Decreases the target's Attack and Special Attack by 2 stages each. (Memento)
  6256. # User faints (even if effect does nothing).
  6257. ################################################################################
  6258. class PokeBattle_Move_0E2 < PokeBattle_Move
  6259. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6260. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6261. @battle.pbDisplay(_INTL("But it failed!"))
  6262. return -1
  6263. end
  6264. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6265. ret=-1; showanim=true
  6266. if opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  6267. ret=0; showanim=false
  6268. end
  6269. if opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self,showanim)
  6270. ret=0; showanim=false
  6271. end
  6272. attacker.pbReduceHP(attacker.hp)
  6273. return ret
  6274. end
  6275. end
  6276.  
  6277.  
  6278.  
  6279. ################################################################################
  6280. # User faints. The Pokémon that replaces the user is fully healed (HP and
  6281. # status). Fails if user won't be replaced. (Healing Wish)
  6282. ################################################################################
  6283. class PokeBattle_Move_0E3 < PokeBattle_Move
  6284. def isHealingMove?
  6285. return true
  6286. end
  6287.  
  6288. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6289. if !@battle.pbCanChooseNonActive?(attacker.index)
  6290. @battle.pbDisplay(_INTL("But it failed!"))
  6291. return -1
  6292. end
  6293. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6294. attacker.pbReduceHP(attacker.hp)
  6295. attacker.effects[PBEffects::HealingWish]=true
  6296. return 0
  6297. end
  6298. end
  6299.  
  6300.  
  6301.  
  6302. ################################################################################
  6303. # User faints. The Pokémon that replaces the user is fully healed (HP, PP and
  6304. # status). Fails if user won't be replaced. (Lunar Dance)
  6305. ################################################################################
  6306. class PokeBattle_Move_0E4 < PokeBattle_Move
  6307. def isHealingMove?
  6308. return true
  6309. end
  6310.  
  6311. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6312. if !@battle.pbCanChooseNonActive?(attacker.index)
  6313. @battle.pbDisplay(_INTL("But it failed!"))
  6314. return -1
  6315. end
  6316. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6317. attacker.pbReduceHP(attacker.hp)
  6318. attacker.effects[PBEffects::LunarDance]=true
  6319. return 0
  6320. end
  6321. end
  6322.  
  6323.  
  6324.  
  6325. ################################################################################
  6326. # All current battlers will perish after 3 more rounds. (Perish Song)
  6327. ################################################################################
  6328. class PokeBattle_Move_0E5 < PokeBattle_Move
  6329. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6330. failed=true
  6331. for i in 0...4
  6332. if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
  6333. (attacker.hasMoldBreaker ||
  6334. !@battle.battlers[i].hasWorkingAbility(:SOUNDPROOF))
  6335. failed=false; break
  6336. end
  6337. end
  6338. if failed
  6339. @battle.pbDisplay(_INTL("But it failed!"))
  6340. return -1
  6341. end
  6342. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6343. @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
  6344. for i in 0...4
  6345. if @battle.battlers[i].effects[PBEffects::PerishSong]==0
  6346. if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  6347. @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
  6348. PBAbilities.getName(@battle.battlers[i].ability),@name))
  6349. else
  6350. @battle.battlers[i].effects[PBEffects::PerishSong]=4
  6351. @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
  6352. end
  6353. end
  6354. end
  6355. return 0
  6356. end
  6357. end
  6358.  
  6359.  
  6360.  
  6361. ################################################################################
  6362. # If user is KO'd before it next moves, the attack that caused it loses all PP.
  6363. # (Grudge)
  6364. ################################################################################
  6365. class PokeBattle_Move_0E6 < PokeBattle_Move
  6366. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6367. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6368. attacker.effects[PBEffects::Grudge]=true
  6369. @battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",attacker.pbThis))
  6370. return 0
  6371. end
  6372. end
  6373.  
  6374.  
  6375.  
  6376. ################################################################################
  6377. # If user is KO'd before it next moves, the battler that caused it also faints.
  6378. # (Destiny Bond)
  6379. ################################################################################
  6380. class PokeBattle_Move_0E7 < PokeBattle_Move
  6381. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6382. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6383. attacker.effects[PBEffects::DestinyBond]=true
  6384. @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
  6385. return 0
  6386. end
  6387. end
  6388.  
  6389.  
  6390.  
  6391. ################################################################################
  6392. # If user would be KO'd this round, it survives with 1HP instead. (Endure)
  6393. ################################################################################
  6394. class PokeBattle_Move_0E8 < PokeBattle_Move
  6395. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6396. ratesharers=[
  6397. 0xAA, # Detect, Protect
  6398. 0xAB, # Quick Guard
  6399. 0xAC, # Wide Guard
  6400. 0xE8, # Endure
  6401. 0x14B, # King's Shield
  6402. 0x14C # Spiky Shield
  6403. ]
  6404. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  6405. attacker.effects[PBEffects::ProtectRate]=1
  6406. end
  6407. unmoved=false
  6408. for poke in @battle.battlers
  6409. next if poke.index==attacker.index
  6410. if @battle.choices[poke.index][0]==1 && # Chose a move
  6411. !poke.hasMovedThisRound?
  6412. unmoved=true; break
  6413. end
  6414. end
  6415. if !unmoved ||
  6416. @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  6417. attacker.effects[PBEffects::ProtectRate]=1
  6418. @battle.pbDisplay(_INTL("But it failed!"))
  6419. return -1
  6420. end
  6421. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6422. attacker.effects[PBEffects::Endure]=true
  6423. attacker.effects[PBEffects::ProtectRate]*=2
  6424. @battle.pbDisplay(_INTL("{1} braced itself!",attacker.pbThis))
  6425. return 0
  6426. end
  6427. end
  6428.  
  6429.  
  6430.  
  6431. ################################################################################
  6432. # If target would be KO'd by this attack, it survives with 1HP instead. (False Swipe)
  6433. ################################################################################
  6434. class PokeBattle_Move_0E9 < PokeBattle_Move
  6435. # Handled in superclass def pbReduceHPDamage, do not edit!
  6436. end
  6437.  
  6438.  
  6439.  
  6440. ################################################################################
  6441. # User flees from battle. Fails in trainer battles. (Teleport)
  6442. ################################################################################
  6443. class PokeBattle_Move_0EA < PokeBattle_Move
  6444. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6445. if @battle.opponent ||
  6446. !@battle.pbCanRun?(attacker.index)
  6447. @battle.pbDisplay(_INTL("But it failed!"))
  6448. return -1
  6449. end
  6450. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6451. @battle.pbDisplay(_INTL("{1} fled from battle!",attacker.pbThis))
  6452. @battle.decision=3
  6453. return 0
  6454. end
  6455. end
  6456.  
  6457.  
  6458.  
  6459. ################################################################################
  6460. # In wild battles, makes target flee. Fails if target is a higher level than the
  6461. # user.
  6462. # In trainer battles, target switches out.
  6463. # For status moves. (Roar, Whirlwind)
  6464. ################################################################################
  6465. class PokeBattle_Move_0EB < PokeBattle_Move
  6466. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6467. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:SUCTIONCUPS)
  6468. @battle.pbDisplay(_INTL("{1} anchored itself with {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  6469. return -1
  6470. end
  6471. if opponent.effects[PBEffects::Ingrain]
  6472. @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",opponent.pbThis))
  6473. return -1
  6474. end
  6475. if !@battle.opponent
  6476. if opponent.level>attacker.level
  6477. @battle.pbDisplay(_INTL("But it failed!"))
  6478. return -1
  6479. end
  6480. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6481. @battle.decision=3 # Set decision to escaped
  6482. return 0
  6483. else
  6484. choices=false
  6485. party=@battle.pbParty(opponent.index)
  6486. for i in 0...party.length
  6487. if @battle.pbCanSwitch?(opponent.index,i,false,true)
  6488. choices=true
  6489. break
  6490. end
  6491. end
  6492. if !choices
  6493. @battle.pbDisplay(_INTL("But it failed!"))
  6494. return -1
  6495. end
  6496. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6497. opponent.effects[PBEffects::Roar]=true
  6498. return 0
  6499. end
  6500. end
  6501. end
  6502.  
  6503.  
  6504.  
  6505. ################################################################################
  6506. # In wild battles, makes target flee. Fails if target is a higher level than the
  6507. # user.
  6508. # In trainer battles, target switches out.
  6509. # For damaging moves. (Circle Throw, Dragon Tail)
  6510. ################################################################################
  6511. class PokeBattle_Move_0EC < PokeBattle_Move
  6512. def pbEffectAfterHit(attacker,opponent,turneffects)
  6513. if !attacker.isFainted? && !opponent.isFainted? &&
  6514. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6515. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SUCTIONCUPS)) &&
  6516. !opponent.effects[PBEffects::Ingrain]
  6517. if !@battle.opponent
  6518. if opponent.level<=attacker.level
  6519. @battle.decision=3 # Set decision to escaped
  6520. end
  6521. else
  6522. party=@battle.pbParty(opponent.index)
  6523. for i in 0..party.length-1
  6524. if @battle.pbCanSwitch?(opponent.index,i,false)
  6525. opponent.effects[PBEffects::Roar]=true
  6526. break
  6527. end
  6528. end
  6529. end
  6530. end
  6531. end
  6532. end
  6533.  
  6534.  
  6535.  
  6536. ################################################################################
  6537. # User switches out. Various effects affecting the user are passed to the
  6538. # replacement. (Baton Pass)
  6539. ################################################################################
  6540. class PokeBattle_Move_0ED < PokeBattle_Move
  6541. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6542. if !@battle.pbCanChooseNonActive?(attacker.index)
  6543. @battle.pbDisplay(_INTL("But it failed!"))
  6544. return -1
  6545. end
  6546. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6547. attacker.effects[PBEffects::BatonPass]=true
  6548. return 0
  6549. end
  6550. end
  6551.  
  6552.  
  6553.  
  6554. ################################################################################
  6555. # After inflicting damage, user switches out. Ignores trapping moves.
  6556. # (U-turn, Volt Switch)
  6557. # TODO: Pursuit should interrupt this move.
  6558. ################################################################################
  6559. class PokeBattle_Move_0EE < PokeBattle_Move
  6560. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6561. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6562. if !attacker.isFainted? && opponent.damagestate.calcdamage>0 &&
  6563. @battle.pbCanChooseNonActive?(attacker.index) &&
  6564. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  6565. attacker.effects[PBEffects::Uturn]=true
  6566. end
  6567. return ret
  6568. end
  6569. end
  6570.  
  6571.  
  6572.  
  6573. ################################################################################
  6574. # Target can no longer switch out or flee, as long as the user remains active.
  6575. # (Block, Mean Look, Spider Web, Thousand Waves)
  6576. ################################################################################
  6577. class PokeBattle_Move_0EF < PokeBattle_Move
  6578. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6579. if pbIsDamaging?
  6580. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6581. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6582. !opponent.isFainted?
  6583. if opponent.effects[PBEffects::MeanLook]<0 &&
  6584. (!USENEWBATTLEMECHANICS || !opponent.pbHasType?(:GHOST))
  6585. opponent.effects[PBEffects::MeanLook]=attacker.index
  6586. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6587. end
  6588. end
  6589. return ret
  6590. end
  6591. if opponent.effects[PBEffects::MeanLook]>=0 ||
  6592. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  6593. @battle.pbDisplay(_INTL("But it failed!"))
  6594. return -1
  6595. end
  6596. if USENEWBATTLEMECHANICS && opponent.pbHasType?(:GHOST)
  6597. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6598. return -1
  6599. end
  6600. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6601. opponent.effects[PBEffects::MeanLook]=attacker.index
  6602. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6603. return 0
  6604. end
  6605. end
  6606.  
  6607.  
  6608.  
  6609. ################################################################################
  6610. # Target drops its item. It regains the item at the end of the battle. (Knock Off)
  6611. # If target has a losable item, damage is multiplied by 1.5.
  6612. ################################################################################
  6613. class PokeBattle_Move_0F0 < PokeBattle_Move
  6614. def pbEffectAfterHit(attacker,opponent,turneffects)
  6615. if !attacker.isFainted? && !opponent.isFainted? && opponent.item!=0 &&
  6616. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6617. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6618. abilityname=PBAbilities.getName(opponent.ability)
  6619. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6620. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6621. itemname=PBItems.getName(opponent.item)
  6622. opponent.item=0
  6623. opponent.effects[PBEffects::ChoiceBand]=-1
  6624. opponent.effects[PBEffects::Unburden]=true
  6625. @battle.pbDisplay(_INTL("{1} dropped its {2}!",opponent.pbThis,itemname))
  6626. end
  6627. end
  6628. end
  6629.  
  6630. def pbModifyDamage(damagemult,attacker,opponent)
  6631. if USENEWBATTLEMECHANICS &&
  6632. !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6633. # Still boosts damage even if opponent has Sticky Hold
  6634. return (damagemult*1.5).round
  6635. end
  6636. return damagemult
  6637. end
  6638. end
  6639.  
  6640.  
  6641.  
  6642. ################################################################################
  6643. # User steals the target's item, if the user has none itself. (Covet, Thief)
  6644. # Items stolen from wild Pokémon are kept after the battle.
  6645. ################################################################################
  6646. class PokeBattle_Move_0F1 < PokeBattle_Move
  6647. def pbEffectAfterHit(attacker,opponent,turneffects)
  6648. if !attacker.isFainted? && !opponent.isFainted? && opponent.item!=0 &&
  6649. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6650. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6651. abilityname=PBAbilities.getName(opponent.ability)
  6652. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6653. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item) &&
  6654. !@battle.pbIsUnlosableItem(attacker,opponent.item) &&
  6655. attacker.item==0 &&
  6656. (@battle.opponent || !@battle.pbIsOpposing?(attacker.index))
  6657. itemname=PBItems.getName(opponent.item)
  6658. attacker.item=opponent.item
  6659. opponent.item=0
  6660. opponent.effects[PBEffects::ChoiceBand]=-1
  6661. opponent.effects[PBEffects::Unburden]=true
  6662. if !@battle.opponent && # In a wild battle
  6663. attacker.pokemon.itemInitial==0 &&
  6664. opponent.pokemon.itemInitial==attacker.item
  6665. attacker.pokemon.itemInitial=attacker.item
  6666. opponent.pokemon.itemInitial=0
  6667. end
  6668. @battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  6669. end
  6670. end
  6671. end
  6672. end
  6673.  
  6674.  
  6675.  
  6676. ################################################################################
  6677. # User and target swap items. They remain swapped after wild battles.
  6678. # (Switcheroo, Trick)
  6679. ################################################################################
  6680. class PokeBattle_Move_0F2 < PokeBattle_Move
  6681. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6682. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6683. (attacker.item==0 && opponent.item==0) ||
  6684. (!@battle.opponent && @battle.pbIsOpposing?(attacker.index))
  6685. @battle.pbDisplay(_INTL("But it failed!"))
  6686. return -1
  6687. end
  6688. if @battle.pbIsUnlosableItem(opponent,opponent.item) ||
  6689. @battle.pbIsUnlosableItem(attacker,opponent.item) ||
  6690. @battle.pbIsUnlosableItem(opponent,attacker.item) ||
  6691. @battle.pbIsUnlosableItem(attacker,attacker.item)
  6692. @battle.pbDisplay(_INTL("But it failed!"))
  6693. return -1
  6694. end
  6695. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6696. abilityname=PBAbilities.getName(opponent.ability)
  6697. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,name))
  6698. return -1
  6699. end
  6700. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6701. oldattitem=attacker.item
  6702. oldoppitem=opponent.item
  6703. oldattitemname=PBItems.getName(oldattitem)
  6704. oldoppitemname=PBItems.getName(oldoppitem)
  6705. tmpitem=attacker.item
  6706. attacker.item=opponent.item
  6707. opponent.item=tmpitem
  6708. if !@battle.opponent && # In a wild battle
  6709. attacker.pokemon.itemInitial==oldattitem &&
  6710. opponent.pokemon.itemInitial==oldoppitem
  6711. attacker.pokemon.itemInitial=oldoppitem
  6712. opponent.pokemon.itemInitial=oldattitem
  6713. end
  6714. @battle.pbDisplay(_INTL("{1} switched items with its opponent!",attacker.pbThis))
  6715. if oldoppitem>0 && oldattitem>0
  6716. @battle.pbDisplayPaused(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname))
  6717. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname))
  6718. else
  6719. @battle.pbDisplay(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname)) if oldoppitem>0
  6720. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname)) if oldattitem>0
  6721. end
  6722. attacker.effects[PBEffects::ChoiceBand]=-1
  6723. opponent.effects[PBEffects::ChoiceBand]=-1
  6724. return 0
  6725. end
  6726. end
  6727.  
  6728.  
  6729.  
  6730. ################################################################################
  6731. # User gives its item to the target. The item remains given after wild battles.
  6732. # (Bestow)
  6733. ################################################################################
  6734. class PokeBattle_Move_0F3 < PokeBattle_Move
  6735. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6736. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6737. attacker.item==0 || opponent.item!=0
  6738. @battle.pbDisplay(_INTL("But it failed!"))
  6739. return -1
  6740. end
  6741. if @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6742. @battle.pbIsUnlosableItem(opponent,attacker.item)
  6743. @battle.pbDisplay(_INTL("But it failed!"))
  6744. return -1
  6745. end
  6746. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6747. itemname=PBItems.getName(attacker.item)
  6748. opponent.item=attacker.item
  6749. attacker.item=0
  6750. attacker.effects[PBEffects::ChoiceBand]=-1
  6751. attacker.effects[PBEffects::Unburden]=true
  6752. if !@battle.opponent && # In a wild battle
  6753. opponent.pokemon.itemInitial==0 &&
  6754. attacker.pokemon.itemInitial==opponent.item
  6755. opponent.pokemon.itemInitial=opponent.item
  6756. attacker.pokemon.itemInitial=0
  6757. end
  6758. @battle.pbDisplay(_INTL("{1} received {2} from {3}!",opponent.pbThis,itemname,attacker.pbThis(true)))
  6759. return 0
  6760. end
  6761. end
  6762.  
  6763.  
  6764.  
  6765. ################################################################################
  6766. # User consumes target's berry and gains its effect. (Bug Bite, Pluck)
  6767. ################################################################################
  6768. class PokeBattle_Move_0F4 < PokeBattle_Move
  6769. def pbEffectAfterHit(attacker,opponent,turneffects)
  6770. if !attacker.isFainted? && !opponent.isFainted? && pbIsBerry?(opponent.item) &&
  6771. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6772. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:STICKYHOLD)
  6773. item=opponent.item
  6774. itemname=PBItems.getName(item)
  6775. opponent.pbConsumeItem(false,false)
  6776. @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",attacker.pbThis,itemname))
  6777. if !attacker.hasWorkingAbility(:KLUTZ) &&
  6778. attacker.effects[PBEffects::Embargo]==0
  6779. attacker.pbActivateBerryEffect(item,false)
  6780. end
  6781. # Symbiosis
  6782. if attacker.item==0 &&
  6783. attacker.pbPartner && attacker.pbPartner.hasWorkingAbility(:SYMBIOSIS)
  6784. partner=attacker.pbPartner
  6785. if partner.item>0 &&
  6786. !@battle.pbIsUnlosableItem(partner,partner.item) &&
  6787. !@battle.pbIsUnlosableItem(attacker,partner.item)
  6788. @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
  6789. partner.pbThis,PBAbilities.getName(partner.ability),
  6790. PBItems.getName(partner.item),attacker.pbThis(true)))
  6791. attacker.item=partner.item
  6792. partner.item=0
  6793. partner.effects[PBEffects::Unburden]=true
  6794. attacker.pbBerryCureCheck
  6795. end
  6796. end
  6797. end
  6798. end
  6799. end
  6800. end
  6801.  
  6802.  
  6803.  
  6804. ################################################################################
  6805. # Target's berry is destroyed. (Incinerate)
  6806. ################################################################################
  6807. class PokeBattle_Move_0F5 < PokeBattle_Move
  6808. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6809. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6810. if !attacker.isFainted? && opponent.damagestate.calcdamage>0 &&
  6811. !opponent.damagestate.substitute &&
  6812. (pbIsBerry?(opponent.item) || (USENEWBATTLEMECHANICS && pbIsGem?(opponent.item)))
  6813. itemname=PBItems.getName(opponent.item)
  6814. opponent.pbConsumeItem(false,false)
  6815. @battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",opponent.pbThis,itemname))
  6816. end
  6817. return ret
  6818. end
  6819. end
  6820.  
  6821.  
  6822.  
  6823. ################################################################################
  6824. # User recovers the last item it held and consumed. (Recycle)
  6825. ################################################################################
  6826. class PokeBattle_Move_0F6 < PokeBattle_Move
  6827. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6828. if !attacker.pokemon || attacker.pokemon.itemRecycle==0
  6829. @battle.pbDisplay(_INTL("But it failed!"))
  6830. return -1
  6831. end
  6832. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6833. item=attacker.pokemon.itemRecycle
  6834. itemname=PBItems.getName(item)
  6835. attacker.item=item
  6836. if !@battle.opponent # In a wild battle
  6837. attacker.pokemon.itemInitial=item if attacker.pokemon.itemInitial==0
  6838. end
  6839. attacker.pokemon.itemRecycle=0
  6840. attacker.effects[PBEffects::PickupItem]=0
  6841. attacker.effects[PBEffects::PickupUse]=0
  6842. @battle.pbDisplay(_INTL("{1} found one {2}!",attacker.pbThis,itemname))
  6843. return 0
  6844. end
  6845. end
  6846.  
  6847.  
  6848.  
  6849. ################################################################################
  6850. # User flings its item at the target. Power and effect depend on the item. (Fling)
  6851. ################################################################################
  6852. class PokeBattle_Move_0F7 < PokeBattle_Move
  6853. def flingarray
  6854. return {
  6855. 130 => [:IRONBALL],
  6856. 100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,
  6857. :HELIXFOSSIL,:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,
  6858. :ROOTFOSSIL,:SAILFOSSIL,:SKULLFOSSIL],
  6859. 90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,
  6860. :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,
  6861. :MEADOWPLATE,:MINDPLATE,:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,
  6862. :SPOOKYPLATE,:STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],
  6863. 80 => [:ASSAULTVEST,:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,
  6864. :ODDKEYSTONE,:OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,
  6865. :SAFETYGOGGLES,:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY],
  6866. 70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,
  6867. :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
  6868. :POWERWEIGHT,:SHOCKDRIVE],
  6869. 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LUSTROUSORB,
  6870. :MACHOBRACE,:ROCKYHELMET,:STICK],
  6871. 50 => [:DUBIOUSDISC,:SHARPBEAK],
  6872. 40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],
  6873. 30 => [:ABILITYCAPSULE,:ABILITYURGE,:ABSORBBULB,:AMAZEMULCH,:AMULETCOIN,
  6874. :ANTIDOTE,:AWAKENING,:BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,
  6875. :BIGNUGGET,:BIGPEARL,:BINDINGBAND,:BLACKBELT,:BLACKFLUTE,
  6876. :BLACKGLASSES,:BLACKSLUDGE,:BLUEFLUTE,:BLUESHARD,:BOOSTMULCH,
  6877. :BURNHEAL,:CALCIUM,:CARBOS,:CASTELIACONE,:CELLBATTERY,
  6878. :CHARCOAL,:CLEANSETAG,:COMETSHARD,:DAMPMULCH,:DEEPSEASCALE,
  6879. :DIREHIT,:DIREHIT2,:DIREHIT3,:DRAGONSCALE,:EJECTBUTTON,
  6880. :ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ESCAPEROPE,:ETHER,
  6881. :EVERSTONE,:EXPSHARE,:FIRESTONE,:FLAMEORB,:FLOATSTONE,
  6882. :FLUFFYTAIL,:FRESHWATER,:FULLHEAL,:FULLRESTORE,:GOOEYMULCH,
  6883. :GREENSHARD,:GROWTHMULCH,:GUARDSPEC,:HEALPOWDER,:HEARTSCALE,
  6884. :HONEY,:HPUP,:HYPERPOTION,:ICEHEAL,:IRON,
  6885. :ITEMDROP,:ITEMURGE,:KINGSROCK,:LAVACOOKIE,:LEAFSTONE,
  6886. :LEMONADE,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,:LUCKYEGG,
  6887. :LUMINOUSMOSS,:LUMIOSEGALETTE,:MAGNET,:MAXELIXIR,:MAXETHER,
  6888. :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,
  6889. :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,
  6890. :NUGGET,:OLDGATEAU,:PARALYZEHEAL,:PARLYZHEAL,:PASSORB,
  6891. :PEARL,:PEARLSTRING,:POKEDOLL,:POKETOY,:POTION,
  6892. :PPMAX,:PPUP,:PRISMSCALE,:PROTEIN,:RAGECANDYBAR,
  6893. :RARECANDY,:RAZORFANG,:REDFLUTE,:REDSHARD,:RELICBAND,
  6894. :RELICCOPPER,:RELICCROWN,:RELICGOLD,:RELICSILVER,:RELICSTATUE,
  6895. :RELICVASE,:REPEL,:RESETURGE,:REVIVALHERB,:REVIVE,
  6896. :RICHMULCH,:SACHET,:SACREDASH,:SCOPELENS,:SHALOURSABLE,
  6897. :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
  6898. :SODAPOP,:SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,
  6899. :STARPIECE,:SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SURPRISEMULCH,
  6900. :SWEETHEART,:THUNDERSTONE,:TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,
  6901. :UPGRADE,:WATERSTONE,:WHIPPEDDREAM,:WHITEFLUTE,:XACCURACY,
  6902. :XACCURACY2,:XACCURACY3,:XACCURACY6,:XATTACK,:XATTACK2,
  6903. :XATTACK3,:XATTACK6,:XDEFEND,:XDEFEND2,:XDEFEND3,
  6904. :XDEFEND6,:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
  6905. :XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,:XSPATK,
  6906. :XSPATK2,:XSPATK3,:XSPATK6,:XSPECIAL,:XSPECIAL2,
  6907. :XSPECIAL3,:XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,
  6908. :XSPEED6,:YELLOWFLUTE,:YELLOWSHARD,:ZINC],
  6909. 20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
  6910. :RESISTWING,:SWIFTWING],
  6911. 10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,
  6912. :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,
  6913. :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,
  6914. :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,
  6915. :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,
  6916. :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,
  6917. :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,
  6918. :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,
  6919. :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS]
  6920. }
  6921. end
  6922.  
  6923. def pbMoveFailed(attacker,opponent)
  6924. return true if attacker.item==0 ||
  6925. @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6926. pbIsPokeBall?(attacker.item) ||
  6927. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  6928. attacker.hasWorkingAbility(:KLUTZ) ||
  6929. attacker.effects[PBEffects::Embargo]>0
  6930. for i in flingarray.keys
  6931. if flingarray[i]
  6932. for j in flingarray[i]
  6933. return false if isConst?(attacker.item,PBItems,j)
  6934. end
  6935. end
  6936. end
  6937. return false if pbIsBerry?(attacker.item) &&
  6938. !attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) &&
  6939. !attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  6940. return true
  6941. end
  6942.  
  6943. def pbBaseDamage(basedmg,attacker,opponent)
  6944. return 10 if pbIsBerry?(attacker.item)
  6945. return 80 if pbIsMegaStone?(attacker.item)
  6946. for i in flingarray.keys
  6947. if flingarray[i]
  6948. for j in flingarray[i]
  6949. return i if isConst?(attacker.item,PBItems,j)
  6950. end
  6951. end
  6952. end
  6953. return 1
  6954. end
  6955.  
  6956. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6957. if attacker.item==0
  6958. @battle.pbDisplay(_INTL("But it failed!"))
  6959. return 0
  6960. end
  6961. attacker.effects[PBEffects::Unburden]=true
  6962. @battle.pbDisplay(_INTL("{1} flung its {2}!",attacker.pbThis,PBItems.getName(attacker.item)))
  6963. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6964. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6965. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SHIELDDUST))
  6966. if pbIsBerry?(@item)
  6967. opponent.pbActivateBerryEffect(attacker.item,false)
  6968. elsif attacker.hasWorkingItem(:FLAMEORB)
  6969. if opponent.pbCanBurn?(attacker,false,self)
  6970. opponent.pbBurn(attacker)
  6971. end
  6972. elsif attacker.hasWorkingItem(:KINGSROCK) ||
  6973. attacker.hasWorkingItem(:RAZORFANG)
  6974. opponent.pbFlinch(attacker)
  6975. elsif attacker.hasWorkingItem(:LIGHTBALL)
  6976. if opponent.pbCanParalyze?(attacker,false,self)
  6977. opponent.pbParalyze(attacker)
  6978. end
  6979. elsif attacker.hasWorkingItem(:MENTALHERB)
  6980. if opponent.effects[PBEffects::Attract]>=0
  6981. opponent.pbCureAttract
  6982. @battle.pbDisplay(_INTL("{1} got over its infatuation.",opponent.pbThis))
  6983. end
  6984. if opponent.effects[PBEffects::Taunt]>0
  6985. opponent.effects[PBEffects::Taunt]=0
  6986. @battle.pbDisplay(_INTL("{1}'s taunt wore off!",opponent.pbThis))
  6987. end
  6988. if opponent.effects[PBEffects::Encore]>0
  6989. opponent.effects[PBEffects::Encore]=0
  6990. opponent.effects[PBEffects::EncoreMove]=0
  6991. opponent.effects[PBEffects::EncoreIndex]=0
  6992. @battle.pbDisplay(_INTL("{1}'s encore ended!",opponent.pbThis))
  6993. end
  6994. if opponent.effects[PBEffects::Torment]
  6995. opponent.effects[PBEffects::Torment]=false
  6996. @battle.pbDisplay(_INTL("{1}'s torment wore off!",opponent.pbThis))
  6997. end
  6998. if opponent.effects[PBEffects::Disable]>0
  6999. opponent.effects[PBEffects::Disable]=0
  7000. @battle.pbDisplay(_INTL("{1} is no longer disabled!",opponent.pbThis))
  7001. end
  7002. if opponent.effects[PBEffects::HealBlock]>0
  7003. opponent.effects[PBEffects::HealBlock]=0
  7004. @battle.pbDisplay(_INTL("{1}'s Heal Block wore off!",opponent.pbThis))
  7005. end
  7006. elsif attacker.hasWorkingItem(:POISONBARB)
  7007. if opponent.pbCanPoison?(attacker,false,self)
  7008. opponent.pbPoison(attacker)
  7009. end
  7010. elsif attacker.hasWorkingItem(:TOXICORB)
  7011. if opponent.pbCanPoison?(attacker,false,self)
  7012. opponent.pbPoison(attacker,nil,true)
  7013. end
  7014. elsif attacker.hasWorkingItem(:WHITEHERB)
  7015. while true
  7016. reducedstats=false
  7017. for i in [PBStats::ATTACK,PBStats::DEFENSE,
  7018. PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF,
  7019. PBStats::EVASION,PBStats::ACCURACY]
  7020. if opponent.stages[i]<0
  7021. opponent.stages[i]=0; reducedstats=true
  7022. end
  7023. end
  7024. break if !reducedstats
  7025. @battle.pbDisplay(_INTL("{1}'s status is returned to normal!",
  7026. opponent.pbThis(true)))
  7027. end
  7028. end
  7029. end
  7030. attacker.pbConsumeItem
  7031. return ret
  7032. end
  7033. end
  7034.  
  7035.  
  7036.  
  7037. ################################################################################
  7038. # For 5 rounds, the target cannnot use its held item, its held item has no
  7039. # effect, and no items can be used on it. (Embargo)
  7040. ################################################################################
  7041. class PokeBattle_Move_0F8 < PokeBattle_Move
  7042. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7043. if opponent.effects[PBEffects::Embargo]>0
  7044. @battle.pbDisplay(_INTL("But it failed!"))
  7045. return -1
  7046. end
  7047. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7048. opponent.effects[PBEffects::Embargo]=5
  7049. @battle.pbDisplay(_INTL("{1} can't use items anymore!",opponent.pbThis))
  7050. return 0
  7051. end
  7052. end
  7053.  
  7054.  
  7055.  
  7056. ################################################################################
  7057. # For 5 rounds, all held items cannot be used in any way and have no effect.
  7058. # Held items can still change hands, but can't be thrown. (Magic Room)
  7059. ################################################################################
  7060. class PokeBattle_Move_0F9 < PokeBattle_Move
  7061. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7062. if @battle.field.effects[PBEffects::MagicRoom]>0
  7063. @battle.field.effects[PBEffects::MagicRoom]=0
  7064. @battle.pbDisplay(_INTL("The area returned to normal!"))
  7065. else
  7066. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7067. @battle.field.effects[PBEffects::MagicRoom]=5
  7068. @battle.pbDisplay(_INTL("It created a bizarre area in which Pokémon's held items lose their effects!"))
  7069. end
  7070. return 0
  7071. end
  7072. end
  7073.  
  7074.  
  7075.  
  7076. ################################################################################
  7077. # User takes recoil damage equal to 1/4 of the damage this move dealt.
  7078. ################################################################################
  7079. class PokeBattle_Move_0FA < PokeBattle_Move
  7080. def isRecoilMove?
  7081. return true
  7082. end
  7083.  
  7084. def pbEffectAfterHit(attacker,opponent,turneffects)
  7085. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7086. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7087. !attacker.hasWorkingAbility(:MAGICGUARD)
  7088. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/4.0).round)
  7089. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7090. end
  7091. end
  7092. end
  7093. end
  7094.  
  7095.  
  7096.  
  7097. ################################################################################
  7098. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7099. ################################################################################
  7100. class PokeBattle_Move_0FB < PokeBattle_Move
  7101. def isRecoilMove?
  7102. return true
  7103. end
  7104.  
  7105. def pbEffectAfterHit(attacker,opponent,turneffects)
  7106. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7107. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7108. !attacker.hasWorkingAbility(:MAGICGUARD)
  7109. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7110. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7111. end
  7112. end
  7113. end
  7114. end
  7115.  
  7116.  
  7117.  
  7118. ################################################################################
  7119. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  7120. # (Head Smash)
  7121. ################################################################################
  7122. class PokeBattle_Move_0FC < PokeBattle_Move
  7123. def isRecoilMove?
  7124. return true
  7125. end
  7126.  
  7127. def pbEffectAfterHit(attacker,opponent,turneffects)
  7128. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7129. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7130. !attacker.hasWorkingAbility(:MAGICGUARD)
  7131. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
  7132. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7133. end
  7134. end
  7135. end
  7136. end
  7137.  
  7138.  
  7139.  
  7140. ################################################################################
  7141. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7142. # May paralyze the target. (Volt Tackle)
  7143. ################################################################################
  7144. class PokeBattle_Move_0FD < PokeBattle_Move
  7145. def isRecoilMove?
  7146. return true
  7147. end
  7148.  
  7149. def pbEffectAfterHit(attacker,opponent,turneffects)
  7150. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7151. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7152. !attacker.hasWorkingAbility(:MAGICGUARD)
  7153. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7154. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7155. end
  7156. end
  7157. end
  7158.  
  7159. def pbAdditionalEffect(attacker,opponent)
  7160. return if opponent.damagestate.substitute
  7161. if opponent.pbCanParalyze?(attacker,false,self)
  7162. opponent.pbParalyze(attacker)
  7163. end
  7164. end
  7165. end
  7166.  
  7167.  
  7168.  
  7169. ################################################################################
  7170. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7171. # May burn the target. (Flare Blitz)
  7172. ################################################################################
  7173. class PokeBattle_Move_0FE < PokeBattle_Move
  7174. def isRecoilMove?
  7175. return true
  7176. end
  7177.  
  7178. def pbEffectAfterHit(attacker,opponent,turneffects)
  7179. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7180. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7181. !attacker.hasWorkingAbility(:MAGICGUARD)
  7182. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7183. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7184. end
  7185. end
  7186. end
  7187.  
  7188. def pbAdditionalEffect(attacker,opponent)
  7189. return if opponent.damagestate.substitute
  7190. if opponent.pbCanBurn?(attacker,false,self)
  7191. opponent.pbBurn(attacker)
  7192. end
  7193. end
  7194. end
  7195.  
  7196.  
  7197.  
  7198. ################################################################################
  7199. # Starts sunny weather. (Sunny Day)
  7200. ################################################################################
  7201. class PokeBattle_Move_0FF < PokeBattle_Move
  7202. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7203. case @battle.weather
  7204. when PBWeather::HEAVYRAIN
  7205. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7206. return -1
  7207. when PBWeather::HARSHSUN
  7208. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7209. return -1
  7210. when PBWeather::STRONGWINDS
  7211. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7212. return -1
  7213. when PBWeather::SUNNYDAY
  7214. @battle.pbDisplay(_INTL("But it failed!"))
  7215. return -1
  7216. end
  7217. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7218. @battle.weather=PBWeather::SUNNYDAY
  7219. @battle.weatherduration=5
  7220. @battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
  7221. @battle.pbCommonAnimation("Sunny",nil,nil)
  7222. @battle.pbDisplay(_INTL("The sunlight turned harsh!"))
  7223. return 0
  7224. end
  7225. end
  7226.  
  7227.  
  7228.  
  7229. ################################################################################
  7230. # Starts rainy weather. (Rain Dance)
  7231. ################################################################################
  7232. class PokeBattle_Move_100 < PokeBattle_Move
  7233. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7234. case @battle.weather
  7235. when PBWeather::HEAVYRAIN
  7236. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7237. return -1
  7238. when PBWeather::HARSHSUN
  7239. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7240. return -1
  7241. when PBWeather::STRONGWINDS
  7242. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7243. return -1
  7244. when PBWeather::RAINDANCE
  7245. @battle.pbDisplay(_INTL("But it failed!"))
  7246. return -1
  7247. end
  7248. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7249. @battle.weather=PBWeather::RAINDANCE
  7250. @battle.weatherduration=5
  7251. @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
  7252. @battle.pbCommonAnimation("Rain",nil,nil)
  7253. @battle.pbDisplay(_INTL("It started to rain!"))
  7254. return 0
  7255. end
  7256. end
  7257.  
  7258.  
  7259.  
  7260. ################################################################################
  7261. # Starts sandstorm weather. (Sandstorm)
  7262. ################################################################################
  7263. class PokeBattle_Move_101 < PokeBattle_Move
  7264. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7265. case @battle.weather
  7266. when PBWeather::HEAVYRAIN
  7267. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7268. return -1
  7269. when PBWeather::HARSHSUN
  7270. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7271. return -1
  7272. when PBWeather::STRONGWINDS
  7273. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7274. return -1
  7275. when PBWeather::SANDSTORM
  7276. @battle.pbDisplay(_INTL("But it failed!"))
  7277. return -1
  7278. end
  7279. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7280. @battle.weather=PBWeather::SANDSTORM
  7281. @battle.weatherduration=5
  7282. @battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
  7283. @battle.pbCommonAnimation("Sandstorm",nil,nil)
  7284. @battle.pbDisplay(_INTL("A sandstorm brewed!"))
  7285. return 0
  7286. end
  7287. end
  7288.  
  7289.  
  7290.  
  7291. ################################################################################
  7292. # Starts hail weather. (Hail)
  7293. ################################################################################
  7294. class PokeBattle_Move_102 < PokeBattle_Move
  7295. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7296. case @battle.weather
  7297. when PBWeather::HEAVYRAIN
  7298. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7299. return -1
  7300. when PBWeather::HARSHSUN
  7301. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7302. return -1
  7303. when PBWeather::STRONGWINDS
  7304. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7305. return -1
  7306. when PBWeather::HAIL
  7307. @battle.pbDisplay(_INTL("But it failed!"))
  7308. return -1
  7309. end
  7310. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7311. @battle.weather=PBWeather::HAIL
  7312. @battle.weatherduration=5
  7313. @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
  7314. @battle.pbCommonAnimation("Hail",nil,nil)
  7315. @battle.pbDisplay(_INTL("It started to hail!"))
  7316. return 0
  7317. end
  7318. end
  7319.  
  7320.  
  7321.  
  7322. ################################################################################
  7323. # Entry hazard. Lays spikes on the opposing side (max. 3 layers). (Spikes)
  7324. ################################################################################
  7325. class PokeBattle_Move_103 < PokeBattle_Move
  7326. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7327. if attacker.pbOpposingSide.effects[PBEffects::Spikes]>=3
  7328. @battle.pbDisplay(_INTL("But it failed!"))
  7329. return -1
  7330. end
  7331. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7332. attacker.pbOpposingSide.effects[PBEffects::Spikes]+=1
  7333. if !@battle.pbIsOpposing?(attacker.index)
  7334. @battle.pbDisplay(_INTL("Spikes were scattered all around the opposing team's feet!"))
  7335. else
  7336. @battle.pbDisplay(_INTL("Spikes were scattered all around your team's feet!"))
  7337. end
  7338. return 0
  7339. end
  7340. end
  7341.  
  7342.  
  7343.  
  7344. ################################################################################
  7345. # Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
  7346. # (Toxic Spikes)
  7347. ################################################################################
  7348. class PokeBattle_Move_104 < PokeBattle_Move
  7349. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7350. if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
  7351. @battle.pbDisplay(_INTL("But it failed!"))
  7352. return -1
  7353. end
  7354. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7355. attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]+=1
  7356. if !@battle.pbIsOpposing?(attacker.index)
  7357. @battle.pbDisplay(_INTL("Poison spikes were scattered all around the opposing team's feet!"))
  7358. else
  7359. @battle.pbDisplay(_INTL("Poison spikes were scattered all around your team's feet!"))
  7360. end
  7361. return 0
  7362. end
  7363. end
  7364.  
  7365.  
  7366.  
  7367. ################################################################################
  7368. # Entry hazard. Lays stealth rocks on the opposing side. (Stealth Rock)
  7369. ################################################################################
  7370. class PokeBattle_Move_105 < PokeBattle_Move
  7371. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7372. if attacker.pbOpposingSide.effects[PBEffects::StealthRock]
  7373. @battle.pbDisplay(_INTL("But it failed!"))
  7374. return -1
  7375. end
  7376. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7377. attacker.pbOpposingSide.effects[PBEffects::StealthRock]=true
  7378. if !@battle.pbIsOpposing?(attacker.index)
  7379. @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
  7380. else
  7381. @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
  7382. end
  7383. return 0
  7384. end
  7385. end
  7386.  
  7387.  
  7388.  
  7389. ################################################################################
  7390. # Forces ally's Pledge move to be used next, if it hasn't already. (Grass Pledge)
  7391. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7392. # causes either a sea of fire or a swamp on the opposing side.
  7393. ################################################################################
  7394. class PokeBattle_Move_106 < PokeBattle_Move
  7395. def pbOnStartUse(attacker)
  7396. @doubledamage=false; @overridetype=false
  7397. if attacker.effects[PBEffects::FirstPledge]==0x107 || # Fire Pledge
  7398. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7399. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7400. @doubledamage=true
  7401. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7402. @overridetype=true
  7403. end
  7404. end
  7405. return true
  7406. end
  7407.  
  7408. def pbBaseDamage(basedmg,attacker,opponent)
  7409. if @doubledamage
  7410. return basedmg*2
  7411. end
  7412. return basedmg
  7413. end
  7414.  
  7415. def pbModifyType(type,attacker,opponent)
  7416. if @overridetype
  7417. type=getConst(PBTypes,:FIRE) || 0
  7418. end
  7419. return super(type,attacker,opponent)
  7420. end
  7421.  
  7422. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7423. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.isFainted?
  7424. attacker.effects[PBEffects::FirstPledge]=0
  7425. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7426. end
  7427. # Combined move's effect
  7428. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7429. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7430. if opponent.damagestate.calcdamage>0
  7431. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7432. if !@battle.pbIsOpposing?(attacker.index)
  7433. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7434. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7435. else
  7436. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7437. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7438. end
  7439. end
  7440. attacker.effects[PBEffects::FirstPledge]=0
  7441. return ret
  7442. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7443. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7444. if opponent.damagestate.calcdamage>0
  7445. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7446. if !@battle.pbIsOpposing?(attacker.index)
  7447. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7448. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7449. else
  7450. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7451. @battle.pbCommonAnimation("Swamp",nil,nil)
  7452. end
  7453. end
  7454. attacker.effects[PBEffects::FirstPledge]=0
  7455. return ret
  7456. end
  7457. # Set up partner for a combined move
  7458. attacker.effects[PBEffects::FirstPledge]=0
  7459. partnermove=-1
  7460. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7461. if !attacker.pbPartner.hasMovedThisRound?
  7462. move=@battle.choices[attacker.pbPartner.index][2]
  7463. if move && move.id>0
  7464. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7465. end
  7466. end
  7467. end
  7468. if partnermove==0x107 || # Fire Pledge
  7469. partnermove==0x108 # Water Pledge
  7470. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7471. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7472. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7473. return 0
  7474. end
  7475. # Use the move on its own
  7476. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7477. end
  7478.  
  7479. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7480. if @overridetype
  7481. return super(getConst(PBMoves,:FIREPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7482. end
  7483. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7484. end
  7485. end
  7486.  
  7487.  
  7488.  
  7489. ################################################################################
  7490. # Forces ally's Pledge move to be used next, if it hasn't already. (Fire Pledge)
  7491. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7492. # causes either a sea of fire on the opposing side or a rainbow on the user's side.
  7493. ################################################################################
  7494. class PokeBattle_Move_107 < PokeBattle_Move
  7495. def pbOnStartUse(attacker)
  7496. @doubledamage=false; @overridetype=false
  7497. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7498. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7499. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7500. @doubledamage=true
  7501. if attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7502. @overridetype=true
  7503. end
  7504. end
  7505. return true
  7506. end
  7507.  
  7508. def pbBaseDamage(basedmg,attacker,opponent)
  7509. if @doubledamage
  7510. return basedmg*2
  7511. end
  7512. return basedmg
  7513. end
  7514.  
  7515. def pbModifyType(type,attacker,opponent)
  7516. if @overridetype
  7517. type=getConst(PBTypes,:WATER) || 0
  7518. end
  7519. return super(type,attacker,opponent)
  7520. end
  7521.  
  7522. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7523. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.isFainted?
  7524. attacker.effects[PBEffects::FirstPledge]=0
  7525. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7526. end
  7527. # Combined move's effect
  7528. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7529. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7530. if opponent.damagestate.calcdamage>0
  7531. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7532. if !@battle.pbIsOpposing?(attacker.index)
  7533. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7534. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7535. else
  7536. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7537. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7538. end
  7539. end
  7540. attacker.effects[PBEffects::FirstPledge]=0
  7541. return ret
  7542. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7543. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7544. if opponent.damagestate.calcdamage>0
  7545. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7546. if !@battle.pbIsOpposing?(attacker.index)
  7547. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7548. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7549. else
  7550. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7551. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7552. end
  7553. end
  7554. attacker.effects[PBEffects::FirstPledge]=0
  7555. return ret
  7556. end
  7557. # Set up partner for a combined move
  7558. attacker.effects[PBEffects::FirstPledge]=0
  7559. partnermove=-1
  7560. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7561. if !attacker.pbPartner.hasMovedThisRound?
  7562. move=@battle.choices[attacker.pbPartner.index][2]
  7563. if move && move.id>0
  7564. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7565. end
  7566. end
  7567. end
  7568. if partnermove==0x106 || # Grass Pledge
  7569. partnermove==0x108 # Water Pledge
  7570. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7571. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7572. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7573. return 0
  7574. end
  7575. # Use the move on its own
  7576. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7577. end
  7578.  
  7579. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7580. if @overridetype
  7581. return super(getConst(PBMoves,:WATERPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7582. end
  7583. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7584. end
  7585. end
  7586.  
  7587.  
  7588.  
  7589. ################################################################################
  7590. # Forces ally's Pledge move to be used next, if it hasn't already. (Water Pledge)
  7591. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7592. # causes either a swamp on the opposing side or a rainbow on the user's side.
  7593. ################################################################################
  7594. class PokeBattle_Move_108 < PokeBattle_Move
  7595. def pbOnStartUse(attacker)
  7596. @doubledamage=false; @overridetype=false
  7597. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7598. attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7599. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7600. @doubledamage=true
  7601. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7602. @overridetype=true
  7603. end
  7604. end
  7605. return true
  7606. end
  7607.  
  7608. def pbBaseDamage(basedmg,attacker,opponent)
  7609. if @doubledamage
  7610. return basedmg*2
  7611. end
  7612. return basedmg
  7613. end
  7614.  
  7615. def pbModifyType(type,attacker,opponent)
  7616. if @overridetype
  7617. type=getConst(PBTypes,:GRASS) || 0
  7618. end
  7619. return super(type,attacker,opponent)
  7620. end
  7621.  
  7622. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7623. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.isFainted?
  7624. attacker.effects[PBEffects::FirstPledge]=0
  7625. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7626. end
  7627. # Combined move's effect
  7628. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7629. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7630. if opponent.damagestate.calcdamage>0
  7631. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7632. if !@battle.pbIsOpposing?(attacker.index)
  7633. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7634. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7635. else
  7636. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7637. @battle.pbCommonAnimation("Swamp",nil,nil)
  7638. end
  7639. end
  7640. attacker.effects[PBEffects::FirstPledge]=0
  7641. return ret
  7642. elsif attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7643. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7644. if opponent.damagestate.calcdamage>0
  7645. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7646. if !@battle.pbIsOpposing?(attacker.index)
  7647. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7648. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7649. else
  7650. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7651. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7652. end
  7653. end
  7654. attacker.effects[PBEffects::FirstPledge]=0
  7655. return ret
  7656. end
  7657. # Set up partner for a combined move
  7658. attacker.effects[PBEffects::FirstPledge]=0
  7659. partnermove=-1
  7660. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7661. if !attacker.pbPartner.hasMovedThisRound?
  7662. move=@battle.choices[attacker.pbPartner.index][2]
  7663. if move && move.id>0
  7664. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7665. end
  7666. end
  7667. end
  7668. if partnermove==0x106 || # Grass Pledge
  7669. partnermove==0x107 # Fire Pledge
  7670. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7671. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7672. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7673. return 0
  7674. end
  7675. # Use the move on its own
  7676. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7677. end
  7678.  
  7679. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7680. if @overridetype
  7681. return super(getConst(PBMoves,:GRASSPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7682. end
  7683. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7684. end
  7685. end
  7686.  
  7687.  
  7688.  
  7689. ################################################################################
  7690. # Scatters coins that the player picks up after winning the battle. (Pay Day)
  7691. ################################################################################
  7692. class PokeBattle_Move_109 < PokeBattle_Move
  7693. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7694. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7695. if opponent.damagestate.calcdamage>0
  7696. if @battle.pbOwnedByPlayer?(attacker.index)
  7697. @battle.extramoney+=5*attacker.level
  7698. @battle.extramoney=MAXMONEY if @battle.extramoney>MAXMONEY
  7699. end
  7700. @battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
  7701. end
  7702. return ret
  7703. end
  7704. end
  7705.  
  7706.  
  7707.  
  7708. ################################################################################
  7709. # Ends the opposing side's Light Screen and Reflect. (Brick Break)
  7710. ################################################################################
  7711. class PokeBattle_Move_10A < PokeBattle_Move
  7712. def pbCalcDamage(attacker,opponent)
  7713. return super(attacker,opponent,PokeBattle_Move::NOREFLECT)
  7714. end
  7715.  
  7716. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7717. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7718. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0
  7719. attacker.pbOpposingSide.effects[PBEffects::Reflect]=0
  7720. if !@battle.pbIsOpposing?(attacker.index)
  7721. @battle.pbDisplay(_INTL("The opposing team's Reflect wore off!"))
  7722. else
  7723. @battle.pbDisplayPaused(_INTL("Your team's Reflect wore off!"))
  7724. end
  7725. end
  7726. if attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7727. attacker.pbOpposingSide.effects[PBEffects::LightScreen]=0
  7728. if !@battle.pbIsOpposing?(attacker.index)
  7729. @battle.pbDisplay(_INTL("The opposing team's Light Screen wore off!"))
  7730. else
  7731. @battle.pbDisplay(_INTL("Your team's Light Screen wore off!"))
  7732. end
  7733. end
  7734. return ret
  7735. end
  7736.  
  7737. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7738. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
  7739. attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7740. return super(id,attacker,opponent,1,alltargets,showanimation) # Wall-breaking anim
  7741. end
  7742. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7743. end
  7744. end
  7745.  
  7746.  
  7747.  
  7748. ################################################################################
  7749. # If attack misses, user takes crash damage of 1/2 of max HP.
  7750. # (Hi Jump Kick, Jump Kick)
  7751. ################################################################################
  7752. class PokeBattle_Move_10B < PokeBattle_Move
  7753. def isRecoilMove?
  7754. return true
  7755. end
  7756.  
  7757. def unusableInGravity?
  7758. return true
  7759. end
  7760. end
  7761.  
  7762.  
  7763.  
  7764. ################################################################################
  7765. # User turns 1/4 of max HP into a substitute. (Substitute)
  7766. ################################################################################
  7767. class PokeBattle_Move_10C < PokeBattle_Move
  7768. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7769. if attacker.effects[PBEffects::Substitute]>0
  7770. @battle.pbDisplay(_INTL("{1} already has a substitute!",attacker.pbThis))
  7771. return -1
  7772. end
  7773. sublife=[(attacker.totalhp/4).floor,1].max
  7774. if attacker.hp<=sublife
  7775. @battle.pbDisplay(_INTL("It was too weak to make a substitute!"))
  7776. return -1
  7777. end
  7778. attacker.pbReduceHP(sublife,false,false)
  7779. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7780. attacker.effects[PBEffects::MultiTurn]=0
  7781. attacker.effects[PBEffects::MultiTurnAttack]=0
  7782. attacker.effects[PBEffects::Substitute]=sublife
  7783. @battle.pbDisplay(_INTL("{1} put in a substitute!",attacker.pbThis))
  7784. return 0
  7785. end
  7786. end
  7787.  
  7788.  
  7789.  
  7790. ################################################################################
  7791. # User is not Ghost: Decreases the user's Speed, increases the user's Attack &
  7792. # Defense by 1 stage each.
  7793. # User is Ghost: User loses 1/2 of max HP, and curses the target.
  7794. # Cursed Pokémon lose 1/4 of their max HP at the end of each round.
  7795. # (Curse)
  7796. ################################################################################
  7797. class PokeBattle_Move_10D < PokeBattle_Move
  7798. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7799. failed=false
  7800. if attacker.pbHasType?(:GHOST)
  7801. if opponent.effects[PBEffects::Curse] ||
  7802. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  7803. failed=true
  7804. else
  7805. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7806. @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true)))
  7807. opponent.effects[PBEffects::Curse]=true
  7808. attacker.pbReduceHP((attacker.totalhp/2).floor)
  7809. end
  7810. else
  7811. lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  7812. raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  7813. raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  7814. if !lowerspeed && !raiseatk && !raisedef
  7815. failed=true
  7816. else
  7817. pbShowAnimation(@id,attacker,nil,1,alltargets,showanimation) # Non-Ghost move animation
  7818. if lowerspeed
  7819. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  7820. end
  7821. showanim=true
  7822. if raiseatk
  7823. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  7824. showanim=false
  7825. end
  7826. if raisedef
  7827. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  7828. showanim=false
  7829. end
  7830. end
  7831. end
  7832. if failed
  7833. @battle.pbDisplay(_INTL("But it failed!"))
  7834. end
  7835. return failed ? -1 : 0
  7836. end
  7837. end
  7838.  
  7839.  
  7840.  
  7841. ################################################################################
  7842. # Target's last move used loses 4 PP. (Spite)
  7843. ################################################################################
  7844. class PokeBattle_Move_10E < PokeBattle_Move
  7845. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7846. for i in opponent.moves
  7847. if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
  7848. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7849. reduction=[4,i.pp].min
  7850. i.pp-=reduction
  7851. @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
  7852. return 0
  7853. end
  7854. end
  7855. @battle.pbDisplay(_INTL("But it failed!"))
  7856. return -1
  7857. end
  7858. end
  7859.  
  7860.  
  7861.  
  7862. ################################################################################
  7863. # Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare)
  7864. ################################################################################
  7865. class PokeBattle_Move_10F < PokeBattle_Move
  7866. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7867. if opponent.status!=PBStatuses::SLEEP || opponent.effects[PBEffects::Nightmare] ||
  7868. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  7869. @battle.pbDisplay(_INTL("But it failed!"))
  7870. return -1
  7871. end
  7872. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7873. opponent.effects[PBEffects::Nightmare]=true
  7874. @battle.pbDisplay(_INTL("{1} began having a nightmare!",opponent.pbThis))
  7875. return 0
  7876. end
  7877. end
  7878.  
  7879.  
  7880.  
  7881. ################################################################################
  7882. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  7883. # (Rapid Spin)
  7884. ################################################################################
  7885. class PokeBattle_Move_110 < PokeBattle_Move
  7886. def pbEffectAfterHit(attacker,opponent,turneffects)
  7887. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7888. if attacker.effects[PBEffects::MultiTurn]>0
  7889. mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
  7890. mtuser=@battle.battlers[attacker.effects[PBEffects::MultiTurnUser]]
  7891. @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
  7892. attacker.effects[PBEffects::MultiTurn]=0
  7893. attacker.effects[PBEffects::MultiTurnAttack]=0
  7894. attacker.effects[PBEffects::MultiTurnUser]=-1
  7895. end
  7896. if attacker.effects[PBEffects::LeechSeed]>=0
  7897. attacker.effects[PBEffects::LeechSeed]=-1
  7898. @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))
  7899. end
  7900. if attacker.pbOwnSide.effects[PBEffects::StealthRock]
  7901. attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
  7902. @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))
  7903. end
  7904. if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
  7905. attacker.pbOwnSide.effects[PBEffects::Spikes]=0
  7906. @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))
  7907. end
  7908. if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  7909. attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
  7910. @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))
  7911. end
  7912. if attacker.pbOwnSide.effects[PBEffects::StickyWeb]
  7913. attacker.pbOwnSide.effects[PBEffects::StickyWeb]=false
  7914. @battle.pbDisplay(_INTL("{1} blew away sticky webs!",attacker.pbThis))
  7915. end
  7916. end
  7917. end
  7918. end
  7919.  
  7920.  
  7921.  
  7922. ################################################################################
  7923. # Attacks 2 rounds in the future. (Doom Desire, Future Sight)
  7924. ################################################################################
  7925. class PokeBattle_Move_111 < PokeBattle_Move
  7926. def pbDisplayUseMessage(attacker)
  7927. return 0 if @battle.futuresight
  7928. return super(attacker)
  7929. end
  7930.  
  7931. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7932. if opponent.effects[PBEffects::FutureSight]>0
  7933. @battle.pbDisplay(_INTL("But it failed!"))
  7934. return -1
  7935. end
  7936. if @battle.futuresight
  7937. # Attack hits
  7938. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7939. end
  7940. # Attack is launched
  7941. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7942. opponent.effects[PBEffects::FutureSight]=3
  7943. opponent.effects[PBEffects::FutureSightMove]=@id
  7944. opponent.effects[PBEffects::FutureSightUser]=attacker.pokemonIndex
  7945. opponent.effects[PBEffects::FutureSightUserPos]=attacker.index
  7946. if isConst?(@id,PBMoves,:FUTURESIGHT)
  7947. @battle.pbDisplay(_INTL("{1} foresaw an attack!",attacker.pbThis))
  7948. else
  7949. @battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",attacker.pbThis))
  7950. end
  7951. return 0
  7952. end
  7953.  
  7954. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7955. if @battle.futuresight
  7956. return super(id,attacker,opponent,1,alltargets,showanimation) # Hit opponent anim
  7957. end
  7958. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7959. end
  7960. end
  7961.  
  7962.  
  7963.  
  7964. ################################################################################
  7965. # Increases the user's Defense and Special Defense by 1 stage each. Ups the
  7966. # user's stockpile by 1 (max. 3). (Stockpile)
  7967. ################################################################################
  7968. class PokeBattle_Move_112 < PokeBattle_Move
  7969. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7970. if attacker.effects[PBEffects::Stockpile]>=3
  7971. @battle.pbDisplay(_INTL("{1} can't stockpile any more!",attacker.pbThis))
  7972. return -1
  7973. end
  7974. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7975. attacker.effects[PBEffects::Stockpile]+=1
  7976. @battle.pbDisplay(_INTL("{1} stockpiled {2}!",attacker.pbThis,
  7977. attacker.effects[PBEffects::Stockpile]))
  7978. showanim=true
  7979. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  7980. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  7981. attacker.effects[PBEffects::StockpileDef]+=1
  7982. showanim=false
  7983. end
  7984. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  7985. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  7986. attacker.effects[PBEffects::StockpileSpDef]+=1
  7987. showanim=false
  7988. end
  7989. return 0
  7990. end
  7991. end
  7992.  
  7993.  
  7994.  
  7995. ################################################################################
  7996. # Power is 100 multiplied by the user's stockpile (X). Resets the stockpile to
  7997. # 0. Decreases the user's Defense and Special Defense by X stages each. (Spit Up)
  7998. ################################################################################
  7999. class PokeBattle_Move_113 < PokeBattle_Move
  8000. def pbMoveFailed(attacker,opponent)
  8001. return (attacker.effects[PBEffects::Stockpile]==0)
  8002. end
  8003.  
  8004. def pbBaseDamage(basedmg,attacker,opponent)
  8005. return 100*attacker.effects[PBEffects::Stockpile]
  8006. end
  8007.  
  8008. def pbEffectAfterHit(attacker,opponent,turneffects)
  8009. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  8010. showanim=true
  8011. if attacker.effects[PBEffects::StockpileDef]>0
  8012. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8013. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8014. attacker,false,self,showanim)
  8015. showanim=false
  8016. end
  8017. end
  8018. if attacker.effects[PBEffects::StockpileSpDef]>0
  8019. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8020. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8021. attacker,false,self,showanim)
  8022. showanim=false
  8023. end
  8024. end
  8025. attacker.effects[PBEffects::Stockpile]=0
  8026. attacker.effects[PBEffects::StockpileDef]=0
  8027. attacker.effects[PBEffects::StockpileSpDef]=0
  8028. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8029. end
  8030. end
  8031. end
  8032.  
  8033.  
  8034.  
  8035. ################################################################################
  8036. # Heals user depending on the user's stockpile (X). Resets the stockpile to 0.
  8037. # Decreases the user's Defense and Special Defense by X stages each. (Swallow)
  8038. ################################################################################
  8039. class PokeBattle_Move_114 < PokeBattle_Move
  8040. def isHealingMove?
  8041. return true
  8042. end
  8043.  
  8044. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8045. hpgain=0
  8046. case attacker.effects[PBEffects::Stockpile]
  8047. when 0
  8048. @battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
  8049. return -1
  8050. when 1
  8051. hpgain=(attacker.totalhp/4).floor
  8052. when 2
  8053. hpgain=(attacker.totalhp/2).floor
  8054. when 3
  8055. hpgain=attacker.totalhp
  8056. end
  8057. if attacker.hp==attacker.totalhp &&
  8058. attacker.effects[PBEffects::StockpileDef]==0 &&
  8059. attacker.effects[PBEffects::StockpileSpDef]==0
  8060. @battle.pbDisplay(_INTL("But it failed!"))
  8061. return -1
  8062. end
  8063. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8064. if attacker.pbRecoverHP(hpgain,true)>0
  8065. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  8066. end
  8067. showanim=true
  8068. if attacker.effects[PBEffects::StockpileDef]>0
  8069. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8070. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8071. attacker,false,self,showanim)
  8072. showanim=false
  8073. end
  8074. end
  8075. if attacker.effects[PBEffects::StockpileSpDef]>0
  8076. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8077. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8078. attacker,false,self,showanim)
  8079. showanim=false
  8080. end
  8081. end
  8082. attacker.effects[PBEffects::Stockpile]=0
  8083. attacker.effects[PBEffects::StockpileDef]=0
  8084. attacker.effects[PBEffects::StockpileSpDef]=0
  8085. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8086. return 0
  8087. end
  8088. end
  8089.  
  8090.  
  8091.  
  8092. ################################################################################
  8093. # Fails if user was hit by a damaging move this round. (Focus Punch)
  8094. ################################################################################
  8095. class PokeBattle_Move_115 < PokeBattle_Move
  8096. def pbDisplayUseMessage(attacker)
  8097. if attacker.lastHPLost>0
  8098. @battle.pbDisplayBrief(_INTL("{1} lost its focus and couldn't move!",attacker.pbThis))
  8099. return -1
  8100. end
  8101. return super(attacker)
  8102. end
  8103. end
  8104.  
  8105.  
  8106.  
  8107. ################################################################################
  8108. # Fails if the target didn't chose a damaging move to use this round, or has
  8109. # already moved. (Sucker Punch)
  8110. ################################################################################
  8111. class PokeBattle_Move_116 < PokeBattle_Move
  8112. def pbMoveFailed(attacker,opponent)
  8113. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8114. oppmove=@battle.choices[opponent.index][2]
  8115. return true if !oppmove || oppmove.id<=0 || oppmove.pbIsStatus?
  8116. return true if opponent.hasMovedThisRound? && oppmove.function!=0xB0 # Me First
  8117. return false
  8118. end
  8119. end
  8120.  
  8121.  
  8122.  
  8123. ################################################################################
  8124. # This round, user becomes the target of attacks that have single targets.
  8125. # (Follow Me, Rage Powder)
  8126. ################################################################################
  8127. class PokeBattle_Move_117 < PokeBattle_Move
  8128. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8129. if !@battle.doublebattle
  8130. @battle.pbDisplay(_INTL("But it failed!"))
  8131. return -1
  8132. end
  8133. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8134. attacker.effects[PBEffects::FollowMe]=1
  8135. if !attacker.pbPartner.isFainted? && attacker.pbPartner.effects[PBEffects::FollowMe]>0
  8136. attacker.effects[PBEffects::FollowMe]=attacker.pbPartner.effects[PBEffects::FollowMe]+1
  8137. end
  8138. @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
  8139. return 0
  8140. end
  8141. end
  8142.  
  8143.  
  8144.  
  8145. ################################################################################
  8146. # For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
  8147. # (Gravity)
  8148. ################################################################################
  8149. class PokeBattle_Move_118 < PokeBattle_Move
  8150. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8151. if @battle.field.effects[PBEffects::Gravity]>0
  8152. @battle.pbDisplay(_INTL("But it failed!"))
  8153. return -1
  8154. end
  8155. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8156. @battle.field.effects[PBEffects::Gravity]=5
  8157. for i in 0...4
  8158. poke=@battle.battlers[i]
  8159. next if !poke
  8160. if PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8161. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8162. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCE # Sky Drop
  8163. poke.effects[PBEffects::TwoTurnAttack]=0
  8164. end
  8165. if poke.effects[PBEffects::SkyDrop]
  8166. poke.effects[PBEffects::SkyDrop]=false
  8167. end
  8168. if poke.effects[PBEffects::MagnetRise]>0
  8169. poke.effects[PBEffects::MagnetRise]=0
  8170. end
  8171. if poke.effects[PBEffects::Telekinesis]>0
  8172. poke.effects[PBEffects::Telekinesis]=0
  8173. end
  8174. end
  8175. @battle.pbDisplay(_INTL("Gravity intensified!"))
  8176. return 0
  8177. end
  8178. end
  8179.  
  8180.  
  8181.  
  8182. ################################################################################
  8183. # For 5 rounds, user becomes airborne. (Magnet Rise)
  8184. ################################################################################
  8185. class PokeBattle_Move_119 < PokeBattle_Move
  8186. def unusableInGravity?
  8187. return true
  8188. end
  8189.  
  8190. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8191. if attacker.effects[PBEffects::Ingrain] ||
  8192. attacker.effects[PBEffects::SmackDown] ||
  8193. attacker.effects[PBEffects::MagnetRise]>0
  8194. @battle.pbDisplay(_INTL("But it failed!"))
  8195. return -1
  8196. end
  8197. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8198. attacker.effects[PBEffects::MagnetRise]=5
  8199. @battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",attacker.pbThis))
  8200. return 0
  8201. end
  8202. end
  8203.  
  8204.  
  8205.  
  8206. ################################################################################
  8207. # For 3 rounds, target becomes airborne and can always be hit. (Telekinesis)
  8208. ################################################################################
  8209. class PokeBattle_Move_11A < PokeBattle_Move
  8210. def unusableInGravity?
  8211. return true
  8212. end
  8213.  
  8214. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8215. if opponent.effects[PBEffects::Ingrain] ||
  8216. opponent.effects[PBEffects::SmackDown] ||
  8217. opponent.effects[PBEffects::Telekinesis]>0
  8218. @battle.pbDisplay(_INTL("But it failed!"))
  8219. return -1
  8220. end
  8221. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8222. opponent.effects[PBEffects::Telekinesis]=3
  8223. @battle.pbDisplay(_INTL("{1} was hurled into the air!",opponent.pbThis))
  8224. return 0
  8225. end
  8226. end
  8227.  
  8228.  
  8229.  
  8230.  
  8231. ################################################################################
  8232. # Hits airborne semi-invulnerable targets. (Sky Uppercut)
  8233. ################################################################################
  8234. class PokeBattle_Move_11B < PokeBattle_Move
  8235. # Handled in Battler's pbSuccessCheck, do not edit!
  8236. end
  8237.  
  8238.  
  8239.  
  8240. ################################################################################
  8241. # Grounds the target while it remains active. (Smack Down, Thousand Arrows)
  8242. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  8243. ################################################################################
  8244. class PokeBattle_Move_11C < PokeBattle_Move
  8245. def pbBaseDamage(basedmg,attacker,opponent)
  8246. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8247. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8248. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  8249. opponent.effects[PBEffects::SkyDrop]
  8250. return basedmg*2
  8251. end
  8252. return basedmg
  8253. end
  8254.  
  8255. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8256. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  8257. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  8258. !opponent.effects[PBEffects::Roost]
  8259. opponent.effects[PBEffects::SmackDown]=true
  8260. showmsg=(opponent.pbHasType?(:FLYING) ||
  8261. opponent.hasWorkingAbility(:LEVITATE))
  8262. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8263. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  8264. opponent.effects[PBEffects::TwoTurnAttack]=0; showmsg=true
  8265. end
  8266. if opponent.effects[PBEffects::MagnetRise]>0
  8267. opponent.effects[PBEffects::MagnetRise]=0; showmsg=true
  8268. end
  8269. if opponent.effects[PBEffects::Telekinesis]>0
  8270. opponent.effects[PBEffects::Telekinesis]=0; showmsg=true
  8271. end
  8272. @battle.pbDisplay(_INTL("{1} fell straight down!",opponent.pbThis)) if showmsg
  8273. end
  8274. return ret
  8275. end
  8276. end
  8277.  
  8278.  
  8279.  
  8280. ################################################################################
  8281. # Target moves immediately after the user, ignoring priority/speed. (After You)
  8282. ################################################################################
  8283. class PokeBattle_Move_11D < PokeBattle_Move
  8284. def pbMoveFailed(attacker,opponent)
  8285. return true if opponent.effects[PBEffects::MoveNext]
  8286. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8287. oppmove=@battle.choices[opponent.index][2]
  8288. return true if !oppmove || oppmove.id<=0
  8289. return true if opponent.hasMovedThisRound?
  8290. return false
  8291. end
  8292.  
  8293. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8294. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8295. opponent.effects[PBEffects::MoveNext]=true
  8296. opponent.effects[PBEffects::Quash]=false
  8297. @battle.pbDisplay(_INTL("{1} took the kind offer!",opponent.pbThis))
  8298. return 0
  8299. end
  8300. end
  8301.  
  8302.  
  8303.  
  8304. ################################################################################
  8305. # Target moves last this round, ignoring priority/speed. (Quash)
  8306. ################################################################################
  8307. class PokeBattle_Move_11E < PokeBattle_Move
  8308. def pbMoveFailed(attacker,opponent)
  8309. return true if opponent.effects[PBEffects::Quash]
  8310. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8311. oppmove=@battle.choices[opponent.index][2]
  8312. return true if !oppmove || oppmove.id<=0
  8313. return true if opponent.hasMovedThisRound?
  8314. return false
  8315. end
  8316.  
  8317. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8318. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8319. opponent.effects[PBEffects::Quash]=true
  8320. opponent.effects[PBEffects::MoveNext]=false
  8321. @battle.pbDisplay(_INTL("{1}'s move was postponed!",opponent.pbThis))
  8322. return 0
  8323. end
  8324. end
  8325.  
  8326.  
  8327.  
  8328. ################################################################################
  8329. # For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
  8330. # (Trick Room)
  8331. ################################################################################
  8332. class PokeBattle_Move_11F < PokeBattle_Move
  8333. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8334. if @battle.field.effects[PBEffects::TrickRoom]>0
  8335. @battle.field.effects[PBEffects::TrickRoom]=0
  8336. @battle.pbDisplay(_INTL("{1} reverted the dimensions!",attacker.pbThis))
  8337. else
  8338. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8339. @battle.field.effects[PBEffects::TrickRoom]=5
  8340. @battle.pbDisplay(_INTL("{1} twisted the dimensions!",attacker.pbThis))
  8341. end
  8342. return 0
  8343. end
  8344. end
  8345.  
  8346.  
  8347.  
  8348. ################################################################################
  8349. # User switches places with its ally. (Ally Switch)
  8350. ################################################################################
  8351. class PokeBattle_Move_120 < PokeBattle_Move
  8352. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8353. if !@battle.doublebattle ||
  8354. !attacker.pbPartner || attacker.pbPartner.isFainted?
  8355. @battle.pbDisplay(_INTL("But it failed!"))
  8356. return -1
  8357. end
  8358. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8359. a=@battle.battlers[attacker.index]
  8360. b=@battle.battlers[attacker.pbPartner.index]
  8361. temp=a; a=b; b=temp
  8362. # Swap effects that point at the position rather than the Pokémon
  8363. # NOT PerishSongUser (no need to swap), Attract, MultiTurnUser
  8364. effectstoswap=[PBEffects::BideTarget,
  8365. PBEffects::CounterTarget,
  8366. PBEffects::LeechSeed,
  8367. PBEffects::LockOnPos,
  8368. PBEffects::MeanLook,
  8369. PBEffects::MirrorCoatTarget]
  8370. for i in effectstoswap
  8371. a.effects[i],b.effects[i]=b.effects[i],a.effects[i]
  8372. end
  8373. attacker.pbUpdate(true)
  8374. opponent.pbUpdate(true)
  8375. @battle.pbDisplay(_INTL("{1} and {2} switched places!",opponent.pbThis,attacker.pbThis(true)))
  8376. end
  8377. end
  8378.  
  8379.  
  8380.  
  8381. ################################################################################
  8382. # Target's Attack is used instead of user's Attack for this move's calculations.
  8383. # (Foul Play)
  8384. ################################################################################
  8385. class PokeBattle_Move_121 < PokeBattle_Move
  8386. # Handled in superclass def pbCalcDamage, do not edit!
  8387. end
  8388.  
  8389.  
  8390.  
  8391. ################################################################################
  8392. # Target's Defense is used instead of its Special Defense for this move's
  8393. # calculations. (Psyshock, Psystrike, Secret Sword)
  8394. ################################################################################
  8395. class PokeBattle_Move_122 < PokeBattle_Move
  8396. # Handled in superclass def pbCalcDamage, do not edit!
  8397. end
  8398.  
  8399.  
  8400.  
  8401. ################################################################################
  8402. # Only damages Pokémon that share a type with the user. (Synchronoise)
  8403. ################################################################################
  8404. class PokeBattle_Move_123 < PokeBattle_Move
  8405. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8406. if !opponent.pbHasType?(attacker.type1) &&
  8407. !opponent.pbHasType?(attacker.type2) &&
  8408. !opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  8409. @battle.pbDisplay(_INTL("{1} was unaffected!",opponent.pbThis))
  8410. return -1
  8411. end
  8412. return super(attacker,opponent,hitnum,alltargets,showanimation)
  8413. end
  8414. end
  8415.  
  8416.  
  8417.  
  8418. ################################################################################
  8419. # For 5 rounds, swaps all battlers' base Defense with base Special Defense.
  8420. # (Wonder Room)
  8421. ################################################################################
  8422. class PokeBattle_Move_124 < PokeBattle_Move
  8423. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8424. if @battle.field.effects[PBEffects::WonderRoom]>0
  8425. @battle.field.effects[PBEffects::WonderRoom]=0
  8426. @battle.pbDisplay(_INTL("Wonder Room wore off, and the Defense and Sp. Def stats returned to normal!"))
  8427. else
  8428. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8429. @battle.field.effects[PBEffects::WonderRoom]=5
  8430. @battle.pbDisplay(_INTL("It created a bizarre area in which the Defense and Sp. Def stats are swapped!"))
  8431. end
  8432. return 0
  8433. end
  8434. end
  8435.  
  8436.  
  8437.  
  8438. ################################################################################
  8439. # Fails unless user has already used all other moves it knows. (Last Resort)
  8440. ################################################################################
  8441. class PokeBattle_Move_125 < PokeBattle_Move
  8442. def pbMoveFailed(attacker,opponent)
  8443. counter=0; nummoves=0
  8444. for move in attacker.moves
  8445. next if move.id<=0
  8446. counter+=1 if move.id!=@id && !attacker.movesUsed.include?(move.id)
  8447. nummoves+=1
  8448. end
  8449. return counter!=0 || nummoves==1
  8450. end
  8451. end
  8452.  
  8453.  
  8454.  
  8455. #===============================================================================
  8456. # NOTE: Shadow moves use function codes 126-132 inclusive.
  8457. #===============================================================================
  8458.  
  8459.  
  8460.  
  8461. ################################################################################
  8462. # Does absolutely nothing. (Hold Hands)
  8463. ################################################################################
  8464. class PokeBattle_Move_133 < PokeBattle_Move
  8465. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8466. if !@battle.doublebattle ||
  8467. !attacker.pbPartner || attacker.pbPartner.isFainted?
  8468. @battle.pbDisplay(_INTL("But it failed!"))
  8469. return -1
  8470. end
  8471. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8472. return 0
  8473. end
  8474. end
  8475.  
  8476.  
  8477.  
  8478. ################################################################################
  8479. # Does absolutely nothing. Shows a special message. (Celebrate)
  8480. ################################################################################
  8481. class PokeBattle_Move_134 < PokeBattle_Move
  8482. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8483. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8484. @battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwner(attacker.index).name))
  8485. return 0
  8486. end
  8487. end
  8488.  
  8489.  
  8490.  
  8491. ################################################################################
  8492. # Freezes the target. (Freeze-Dry)
  8493. # (Superclass's pbTypeModifier): Effectiveness against Water-type is 2x.
  8494. ################################################################################
  8495. class PokeBattle_Move_135 < PokeBattle_Move
  8496. def pbAdditionalEffect(attacker,opponent)
  8497. return if opponent.damagestate.substitute
  8498. if opponent.pbCanFreeze?(attacker,false,self)
  8499. opponent.pbFreeze
  8500. end
  8501. end
  8502. end
  8503.  
  8504.  
  8505.  
  8506. ################################################################################
  8507. # Increases the user's Defense by 1 stage for each target hit. (Diamond Storm)
  8508. ################################################################################
  8509. class PokeBattle_Move_136 < PokeBattle_Move_01D
  8510. # No difference to function code 01D. It may need to be separate in future.
  8511. end
  8512.  
  8513.  
  8514.  
  8515. ################################################################################
  8516. # Increases the user's and its ally's Defense and Special Defense by 1 stage
  8517. # each, if they have Plus or Minus. (Magnetic Flux)
  8518. ################################################################################
  8519. class PokeBattle_Move_137 < PokeBattle_Move
  8520. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8521. didsomething=false
  8522. for i in [attacker,attacker.pbPartner]
  8523. next if !i || i.isFainted?
  8524. next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)
  8525. next if !i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  8526. !i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8527. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8528. didsomething=true
  8529. showanim=true
  8530. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8531. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8532. showanim=false
  8533. end
  8534. if i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8535. i.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  8536. showanim=false
  8537. end
  8538. end
  8539. if !didsomething
  8540. @battle.pbDisplay(_INTL("But it failed!"))
  8541. return -1
  8542. end
  8543. return 0
  8544. end
  8545. end
  8546.  
  8547.  
  8548.  
  8549. ################################################################################
  8550. # Increases ally's Special Defense by 1 stage. (Aromatic Mist)
  8551. ################################################################################
  8552. class PokeBattle_Move_138 < PokeBattle_Move
  8553. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8554. if !@battle.doublebattle || !opponent ||
  8555. !opponent.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8556. @battle.pbDisplay(_INTL("But it failed!"))
  8557. return -1
  8558. end
  8559. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8560. ret=attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  8561. return ret ? 0 : -1
  8562. end
  8563. end
  8564.  
  8565.  
  8566.  
  8567. ################################################################################
  8568. # Decreases the target's Attack by 1 stage. Always hits. (Play Nice)
  8569. ################################################################################
  8570. class PokeBattle_Move_139 < PokeBattle_Move
  8571. def pbAccuracyCheck(attacker,opponent)
  8572. return true
  8573. end
  8574.  
  8575. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8576. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  8577. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8578. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  8579. return ret ? 0 : -1
  8580. end
  8581. end
  8582.  
  8583.  
  8584.  
  8585. ################################################################################
  8586. # Decreases the target's Attack and Special Attack by 1 stage each. (Noble Roar)
  8587. ################################################################################
  8588. class PokeBattle_Move_13A < PokeBattle_Move
  8589. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8590. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  8591. # multiple times
  8592. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8593. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  8594. return -1
  8595. end
  8596. if opponent.pbTooLow?(PBStats::ATTACK) &&
  8597. opponent.pbTooLow?(PBStats::SPATK)
  8598. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  8599. return -1
  8600. end
  8601. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  8602. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  8603. return -1
  8604. end
  8605. if !attacker.hasMoldBreaker
  8606. if opponent.hasWorkingAbility(:CLEARBODY) ||
  8607. opponent.hasWorkingAbility(:WHITESMOKE)
  8608. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  8609. PBAbilities.getName(opponent.ability)))
  8610. return -1
  8611. end
  8612. end
  8613. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8614. ret=-1; showanim=true
  8615. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER)
  8616. abilityname=PBAbilities.getName(opponent.ability)
  8617. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  8618. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8619. ret=0; showanim=false
  8620. end
  8621. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8622. ret=0; showanim=false
  8623. end
  8624. return ret
  8625. end
  8626. end
  8627.  
  8628.  
  8629.  
  8630. ################################################################################
  8631. # Decreases the target's Defense by 1 stage. Always hits. (Hyperspace Fury)
  8632. ################################################################################
  8633. class PokeBattle_Move_13B < PokeBattle_Move
  8634. def pbMoveFailed(attacker,opponent)
  8635. return true if !isConst?(attacker.species,PBSpecies,:HOOPA)
  8636. return true if attacker.form!=1
  8637. return false
  8638. end
  8639.  
  8640. def pbAccuracyCheck(attacker,opponent)
  8641. return true
  8642. end
  8643.  
  8644. def pbAdditionalEffect(attacker,opponent)
  8645. return if opponent.damagestate.substitute
  8646. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8647. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  8648. end
  8649. end
  8650. end
  8651.  
  8652.  
  8653.  
  8654. ################################################################################
  8655. # Decreases the target's Special Attack by 1 stage. Always hits. (Confide)
  8656. ################################################################################
  8657. class PokeBattle_Move_13C < PokeBattle_Move
  8658. def pbAccuracyCheck(attacker,opponent)
  8659. return true
  8660. end
  8661.  
  8662. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8663. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8664. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8665. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  8666. return ret ? 0 : -1
  8667. end
  8668. end
  8669.  
  8670.  
  8671.  
  8672. ################################################################################
  8673. # Decreases the target's Special Attack by 2 stages. (Eerie Impulse)
  8674. ################################################################################
  8675. class PokeBattle_Move_13D < PokeBattle_Move
  8676. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8677. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  8678. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8679. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8680. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8681. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8682. return ret ? 0 : -1
  8683. end
  8684.  
  8685. def pbAdditionalEffect(attacker,opponent)
  8686. return if opponent.damagestate.substitute
  8687. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8688. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8689. end
  8690. end
  8691. end
  8692.  
  8693.  
  8694.  
  8695. ################################################################################
  8696. # Increases the Attack and Special Attack of all Grass-type Pokémon on the field
  8697. # by 1 stage each. Doesn't affect airborne Pokémon. (Rototiller)
  8698. ################################################################################
  8699. class PokeBattle_Move_13E < PokeBattle_Move
  8700. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8701. didsomething=false
  8702. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8703. next if !i || i.isFainted?
  8704. next if !i.pbHasType?(:GRASS)
  8705. next if i.isAirborne?(attacker.hasMoldBreaker)
  8706. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8707. !i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8708. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8709. didsomething=true
  8710. showanim=true
  8711. if i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8712. i.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8713. showanim=false
  8714. end
  8715. if i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8716. i.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8717. showanim=false
  8718. end
  8719. end
  8720. if !didsomething
  8721. @battle.pbDisplay(_INTL("But it failed!"))
  8722. return -1
  8723. end
  8724. return 0
  8725. end
  8726. end
  8727.  
  8728.  
  8729.  
  8730. ################################################################################
  8731. # Increases the Defense of all Grass-type Pokémon on the field by 1 stage each.
  8732. # (Flower Shield)
  8733. ################################################################################
  8734. class PokeBattle_Move_13F < PokeBattle_Move
  8735. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8736. didsomething=false
  8737. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8738. next if !i || i.isFainted?
  8739. next if !i.pbHasType?(:GRASS)
  8740. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8741. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8742. didsomething=true
  8743. showanim=true
  8744. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8745. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8746. showanim=false
  8747. end
  8748. end
  8749. if !didsomething
  8750. @battle.pbDisplay(_INTL("But it failed!"))
  8751. return -1
  8752. end
  8753. return 0
  8754. end
  8755. end
  8756.  
  8757.  
  8758.  
  8759. ################################################################################
  8760. # Decreases the Attack, Special Attack and Speed of all poisoned opponents by 1
  8761. # stage each. (Venom Drench)
  8762. ################################################################################
  8763. class PokeBattle_Move_140 < PokeBattle_Move
  8764. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8765. didsomething=false
  8766. for i in [attacker.pbOpposing1,attacker.pbOpposing2]
  8767. next if !i || i.isFainted?
  8768. next if !i.status==PBStatuses::POISON
  8769. next if !i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8770. !i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self) &&
  8771. !i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8772. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8773. didsomething=true
  8774. showanim=true
  8775. if i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  8776. i.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8777. showanim=false
  8778. end
  8779. if i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8780. i.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8781. showanim=false
  8782. end
  8783. if i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8784. i.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  8785. showanim=false
  8786. end
  8787. end
  8788. if !didsomething
  8789. @battle.pbDisplay(_INTL("But it failed!"))
  8790. return -1
  8791. end
  8792. return 0
  8793. end
  8794. end
  8795.  
  8796.  
  8797.  
  8798. ################################################################################
  8799. # Reverses all stat changes of the target. (Topsy-Turvy)
  8800. ################################################################################
  8801. class PokeBattle_Move_141 < PokeBattle_Move
  8802. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8803. nonzero=false
  8804. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8805. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8806. if opponent.stages[i]!=0
  8807. nonzero=true; break
  8808. end
  8809. end
  8810. if !nonzero
  8811. @battle.pbDisplay(_INTL("But it failed!"))
  8812. return -1
  8813. end
  8814. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation) if !didsomething
  8815. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8816. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8817. opponent.stages[i]*=-1
  8818. end
  8819. @battle.pbDisplay(_INTL("{1}'s stats were reversed!",opponent.pbThis))
  8820. return 0
  8821. end
  8822. end
  8823.  
  8824.  
  8825.  
  8826. ################################################################################
  8827. # Gives target the Ghost type. (Trick-or-Treat)
  8828. ################################################################################
  8829. class PokeBattle_Move_142 < PokeBattle_Move
  8830. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8831. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  8832. !hasConst?(PBTypes,:GHOST) || opponent.pbHasType?(:GHOST) ||
  8833. isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  8834. @battle.pbDisplay(_INTL("But it failed!"))
  8835. return -1
  8836. end
  8837. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8838. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GHOST)
  8839. typename=PBTypes.getName(getConst(PBTypes,:GHOST))
  8840. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8841. return 0
  8842. end
  8843. end
  8844.  
  8845.  
  8846.  
  8847. ################################################################################
  8848. # Gives target the Grass type. (Forest's Curse)
  8849. ################################################################################
  8850. class PokeBattle_Move_143 < PokeBattle_Move
  8851. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8852. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8853. @battle.pbDisplay(_INTL("But it failed!"))
  8854. return -1
  8855. end
  8856. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8857. if opponent.effects[PBEffects::LeechSeed]>=0
  8858. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  8859. return -1
  8860. end
  8861. if !hasConst?(PBTypes,:GRASS) || opponent.pbHasType?(:GRASS) ||
  8862. isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  8863. @battle.pbDisplay(_INTL("But it failed!"))
  8864. return -1
  8865. end
  8866. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8867. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GRASS)
  8868. typename=PBTypes.getName(getConst(PBTypes,:GRASS))
  8869. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8870. return 0
  8871. end
  8872. end
  8873.  
  8874.  
  8875.  
  8876. ################################################################################
  8877. # Damage is multiplied by Flying's effectiveness against the target. Does double
  8878. # damage and has perfect accuracy if the target is Minimized. (Flying Press)
  8879. ################################################################################
  8880. class PokeBattle_Move_144 < PokeBattle_Move
  8881. def pbModifyDamage(damagemult,attacker,opponent)
  8882. type=getConst(PBTypes,:FLYING) || -1
  8883. if type>=0
  8884. mult=PBTypes.getCombinedEffectiveness(type,
  8885. opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
  8886. return ((damagemult*mult)/8).round
  8887. end
  8888. return damagemult
  8889. end
  8890.  
  8891. def tramplesMinimize?(param=1)
  8892. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  8893. return true if param==2 # Double damage
  8894. return false
  8895. end
  8896. end
  8897.  
  8898.  
  8899.  
  8900. ################################################################################
  8901. # Target's moves become Electric-type for the rest of the round. (Electrify)
  8902. ################################################################################
  8903. class PokeBattle_Move_145 < PokeBattle_Move
  8904. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8905. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8906. if opponent.effects[PBEffects::Electrify]
  8907. @battle.pbDisplay(_INTL("But it failed!"))
  8908. return -1
  8909. end
  8910. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  8911. !@battle.choices[opponent.index][2] ||
  8912. @battle.choices[opponent.index][2].id<=0 ||
  8913. opponent.hasMovedThisRound?
  8914. @battle.pbDisplay(_INTL("But it failed!"))
  8915. return -1
  8916. end
  8917. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8918. opponent.effects[PBEffects::Electrify]=true
  8919. @battle.pbDisplay(_INTL("{1} was electrified!",opponent.pbThis))
  8920. return 0
  8921. end
  8922. end
  8923.  
  8924.  
  8925.  
  8926. ################################################################################
  8927. # All Normal-type moves become Electric-type for the rest of the round.
  8928. # (Ion Deluge)
  8929. ################################################################################
  8930. class PokeBattle_Move_146 < PokeBattle_Move
  8931. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8932. unmoved=false
  8933. for poke in @battle.battlers
  8934. next if poke.index==attacker.index
  8935. if @battle.choices[poke.index][0]==1 && # Chose a move
  8936. !poke.hasMovedThisRound?
  8937. unmoved=true; break
  8938. end
  8939. end
  8940. if !unmoved || @battle.field.effects[PBEffects::IonDeluge]
  8941. @battle.pbDisplay(_INTL("But it failed!"))
  8942. return -1
  8943. end
  8944. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8945. @battle.field.effects[PBEffects::IonDeluge]=true
  8946. @battle.pbDisplay(_INTL("The Ion Deluge started!"))
  8947. return 0
  8948. end
  8949. end
  8950.  
  8951.  
  8952.  
  8953. ################################################################################
  8954. # Always hits. (Hyperspace Hole)
  8955. # TODO: Hits through various shields.
  8956. ################################################################################
  8957. class PokeBattle_Move_147 < PokeBattle_Move
  8958. def pbAccuracyCheck(attacker,opponent)
  8959. return true
  8960. end
  8961. end
  8962.  
  8963.  
  8964. ################################################################################
  8965. # Powders the foe. This round, if it uses a Fire move, it loses 1/4 of its max
  8966. # HP instead. (Powder)
  8967. ################################################################################
  8968. class PokeBattle_Move_148 < PokeBattle_Move
  8969. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8970. if opponent.effects[PBEffects::Powder]
  8971. @battle.pbDisplay(_INTL("But it failed!"))
  8972. return -1
  8973. end
  8974. opponent.effects[PBEffects::Powder]=true
  8975. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8976. @battle.pbDisplay(_INTL("{1} is covered in powder!",attacker.pbThis))
  8977. return 0
  8978. end
  8979. end
  8980.  
  8981.  
  8982.  
  8983. ################################################################################
  8984. # This round, the user's side is unaffected by damaging moves. (Mat Block)
  8985. ################################################################################
  8986. class PokeBattle_Move_149 < PokeBattle_Move
  8987. def pbMoveFailed(attacker,opponent)
  8988. return (attacker.turncount>1)
  8989. end
  8990.  
  8991. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8992. attacker.pbOwnSide.effects[PBEffects::MatBlock]=true
  8993. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8994. @battle.pbDisplay(_INTL("{1} intends to flip up a mat and block incoming attacks!",attacker.pbThis))
  8995. return 0
  8996. end
  8997. end
  8998.  
  8999.  
  9000.  
  9001. ################################################################################
  9002. # User's side is protected against status moves this round. (Crafty Shield)
  9003. ################################################################################
  9004. class PokeBattle_Move_14A < PokeBattle_Move
  9005. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9006. if attacker.pbOwnSide.effects[PBEffects::CraftyShield]
  9007. @battle.pbDisplay(_INTL("But it failed!"))
  9008. return -1
  9009. end
  9010. unmoved=false
  9011. for poke in @battle.battlers
  9012. next if poke.index==attacker.index
  9013. if @battle.choices[poke.index][0]==1 && # Chose a move
  9014. !poke.hasMovedThisRound?
  9015. unmoved=true; break
  9016. end
  9017. end
  9018. if !unmoved
  9019. @battle.pbDisplay(_INTL("But it failed!"))
  9020. return -1
  9021. end
  9022. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9023. attacker.pbOwnSide.effects[PBEffects::CraftyShield]=true
  9024. if !@battle.pbIsOpposing?(attacker.index)
  9025. @battle.pbDisplay(_INTL("Crafty Shield protected your team!"))
  9026. else
  9027. @battle.pbDisplay(_INTL("Crafty Shield protected the opposing team!"))
  9028. end
  9029. return 0
  9030. end
  9031. end
  9032.  
  9033.  
  9034.  
  9035. ################################################################################
  9036. # User is protected against damaging moves this round. Decreases the Attack of
  9037. # the user of a stopped contact move by 2 stages. (King's Shield)
  9038. ################################################################################
  9039. class PokeBattle_Move_14B < PokeBattle_Move
  9040. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9041. if attacker.effects[PBEffects::KingsShield]
  9042. @battle.pbDisplay(_INTL("But it failed!"))
  9043. return -1
  9044. end
  9045. ratesharers=[
  9046. 0xAA, # Detect, Protect
  9047. 0xAB, # Quick Guard
  9048. 0xAC, # Wide Guard
  9049. 0xE8, # Endure
  9050. 0x14B, # King's Shield
  9051. 0x14C # Spiky Shield
  9052. ]
  9053. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9054. attacker.effects[PBEffects::ProtectRate]=1
  9055. end
  9056. unmoved=false
  9057. for poke in @battle.battlers
  9058. next if poke.index==attacker.index
  9059. if @battle.choices[poke.index][0]==1 && # Chose a move
  9060. !poke.hasMovedThisRound?
  9061. unmoved=true; break
  9062. end
  9063. end
  9064. if !unmoved ||
  9065. (!USENEWBATTLEMECHANICS &&
  9066. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  9067. attacker.effects[PBEffects::ProtectRate]=1
  9068. @battle.pbDisplay(_INTL("But it failed!"))
  9069. return -1
  9070. end
  9071. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9072. attacker.effects[PBEffects::KingsShield]=true
  9073. attacker.effects[PBEffects::ProtectRate]*=2
  9074. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9075. return 0
  9076. end
  9077. end
  9078.  
  9079.  
  9080.  
  9081. ################################################################################
  9082. # User is protected against moves that target it this round. Damages the user of
  9083. # a stopped contact move by 1/8 of its max HP. (Spiky Shield)
  9084. ################################################################################
  9085. class PokeBattle_Move_14C < PokeBattle_Move
  9086. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9087. if attacker.effects[PBEffects::SpikyShield]
  9088. @battle.pbDisplay(_INTL("But it failed!"))
  9089. return -1
  9090. end
  9091. ratesharers=[
  9092. 0xAA, # Detect, Protect
  9093. 0xAB, # Quick Guard
  9094. 0xAC, # Wide Guard
  9095. 0xE8, # Endure
  9096. 0x14B, # King's Shield
  9097. 0x14C # Spiky Shield
  9098. ]
  9099. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9100. attacker.effects[PBEffects::ProtectRate]=1
  9101. end
  9102. unmoved=false
  9103. for poke in @battle.battlers
  9104. next if poke.index==attacker.index
  9105. if @battle.choices[poke.index][0]==1 && # Chose a move
  9106. !poke.hasMovedThisRound?
  9107. unmoved=true; break
  9108. end
  9109. end
  9110. if !unmoved ||
  9111. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  9112. attacker.effects[PBEffects::ProtectRate]=1
  9113. @battle.pbDisplay(_INTL("But it failed!"))
  9114. return -1
  9115. end
  9116. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9117. attacker.effects[PBEffects::SpikyShield]=true
  9118. attacker.effects[PBEffects::ProtectRate]*=2
  9119. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9120. return 0
  9121. end
  9122. end
  9123.  
  9124.  
  9125.  
  9126. ################################################################################
  9127. # Two turn attack. Skips first turn, attacks second turn. (Phantom Force)
  9128. # Is invulnerable during use.
  9129. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  9130. # this round. If successful, negates them this round.
  9131. # Does double damage and has perfect accuracy if the target is Minimized.
  9132. ################################################################################
  9133. class PokeBattle_Move_14D < PokeBattle_Move
  9134. def pbTwoTurnAttack(attacker)
  9135. @immediate=false
  9136. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9137. @immediate=true
  9138. end
  9139. return false if @immediate
  9140. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9141. end
  9142.  
  9143. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9144. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9145. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9146. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  9147. end
  9148. if @immediate
  9149. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9150. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9151. attacker.pbConsumeItem
  9152. end
  9153. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9154. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9155. if ret>0
  9156. opponent.effects[PBEffects::ProtectNegation]=true
  9157. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  9158. end
  9159. return ret
  9160. end
  9161.  
  9162. def tramplesMinimize?(param=1)
  9163. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  9164. return true if param==2 # Double damage
  9165. return false
  9166. end
  9167. end
  9168.  
  9169.  
  9170.  
  9171. ################################################################################
  9172. # Two turn attack. Skips first turn, increases the user's Special Attack,
  9173. # Special Defense and Speed by 2 stages each second turn. (Geomancy)
  9174. ################################################################################
  9175. class PokeBattle_Move_14E < PokeBattle_Move
  9176. def pbTwoTurnAttack(attacker)
  9177. @immediate=false
  9178. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9179. @immediate=true
  9180. end
  9181. return false if @immediate
  9182. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9183. end
  9184.  
  9185. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9186. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9187. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9188. @battle.pbDisplay(_INTL("{1} is absorbing power!",attacker.pbThis))
  9189. end
  9190. if @immediate
  9191. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9192. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9193. attacker.pbConsumeItem
  9194. end
  9195. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9196. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  9197. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  9198. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9199. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  9200. return -1
  9201. end
  9202. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9203. showanim=true
  9204. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  9205. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  9206. showanim=false
  9207. end
  9208. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  9209. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self,showanim)
  9210. showanim=false
  9211. end
  9212. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9213. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  9214. showanim=false
  9215. end
  9216. return 0
  9217. end
  9218. end
  9219.  
  9220.  
  9221.  
  9222. ################################################################################
  9223. # User gains 3/4 the HP it inflicts as damage. (Draining Kiss, Oblivion Wing)
  9224. ################################################################################
  9225. class PokeBattle_Move_14F < PokeBattle_Move
  9226. def isHealingMove?
  9227. return USENEWBATTLEMECHANICS
  9228. end
  9229.  
  9230. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9231. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9232. if opponent.damagestate.calcdamage>0
  9233. hpgain=(opponent.damagestate.hplost*3/4).round
  9234. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  9235. attacker.pbReduceHP(hpgain,true)
  9236. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  9237. elsif attacker.effects[PBEffects::HealBlock]==0
  9238. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  9239. attacker.pbRecoverHP(hpgain,true)
  9240. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  9241. end
  9242. end
  9243. return ret
  9244. end
  9245. end
  9246.  
  9247.  
  9248.  
  9249. ################################################################################
  9250. # If this move KO's the target, increases the user's Attack by 2 stages.
  9251. # (Fell Stinger)
  9252. ################################################################################
  9253. class PokeBattle_Move_150 < PokeBattle_Move
  9254. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9255. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9256. if opponent.damagestate.calcdamage>0 && opponent.isFainted?
  9257. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  9258. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  9259. end
  9260. end
  9261. return ret
  9262. end
  9263. end
  9264.  
  9265.  
  9266.  
  9267. ################################################################################
  9268. # Decreases the target's Attack and Special Attack by 1 stage each. Then, user
  9269. # switches out. Ignores trapping moves. (Parting Shot)
  9270. # TODO: Pursuit should interrupt this move.
  9271. ################################################################################
  9272. class PokeBattle_Move_151 < PokeBattle_Move
  9273. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9274. ret=-1
  9275. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9276. if !self.isSoundBased? ||
  9277. attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SOUNDPROOF)
  9278. showanim=true
  9279. if opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  9280. showanim=false; ret=0
  9281. end
  9282. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  9283. showanim=false; ret=0
  9284. end
  9285. end
  9286. if !attacker.isFainted? &&
  9287. @battle.pbCanChooseNonActive?(attacker.index) &&
  9288. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  9289. attacker.effects[PBEffects::Uturn]=true; ret=0
  9290. end
  9291. return ret
  9292. end
  9293. end
  9294.  
  9295.  
  9296.  
  9297. ################################################################################
  9298. # No Pokémon can switch out or flee until the end of the next round, as long as
  9299. # the user remains active. (Fairy Lock)
  9300. ################################################################################
  9301. class PokeBattle_Move_152 < PokeBattle_Move
  9302. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9303. if @battle.field.effects[PBEffects::FairyLock]>0
  9304. @battle.pbDisplay(_INTL("But it failed!"))
  9305. return -1
  9306. end
  9307. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9308. @battle.field.effects[PBEffects::FairyLock]=2
  9309. @battle.pbDisplay(_INTL("No one will be able to run away during the next turn!"))
  9310. return 0
  9311. end
  9312. end
  9313.  
  9314.  
  9315.  
  9316. ################################################################################
  9317. # Entry hazard. Lays stealth rocks on the opposing side. (Sticky Web)
  9318. ################################################################################
  9319. class PokeBattle_Move_153 < PokeBattle_Move
  9320. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9321. if attacker.pbOpposingSide.effects[PBEffects::StickyWeb]
  9322. @battle.pbDisplay(_INTL("But it failed!"))
  9323. return -1
  9324. end
  9325. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9326. attacker.pbOpposingSide.effects[PBEffects::StickyWeb]=true
  9327. if !@battle.pbIsOpposing?(attacker.index)
  9328. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath the opposing team's feet!"))
  9329. else
  9330. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath your team's feet!"))
  9331. end
  9332. return 0
  9333. end
  9334. end
  9335.  
  9336.  
  9337.  
  9338. ################################################################################
  9339. # For 5 rounds, creates an electric terrain which boosts Electric-type moves and
  9340. # prevents Pokémon from falling asleep. Affects non-airborne Pokémon only.
  9341. # (Electric Terrain)
  9342. ################################################################################
  9343. class PokeBattle_Move_154 < PokeBattle_Move
  9344. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9345. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  9346. @battle.pbDisplay(_INTL("But it failed!"))
  9347. return -1
  9348. end
  9349. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9350. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9351. @battle.field.effects[PBEffects::MistyTerrain]=0
  9352. @battle.field.effects[PBEffects::ElectricTerrain]=5
  9353. @battle.pbDisplay(_INTL("An electric current runs across the battlefield!"))
  9354. return 0
  9355. end
  9356. end
  9357.  
  9358.  
  9359.  
  9360. ################################################################################
  9361. # For 5 rounds, creates a grassy terrain which boosts Grass-type moves and heals
  9362. # Pokémon at the end of each round. Affects non-airborne Pokémon only.
  9363. # (Grassy Terrain)
  9364. ################################################################################
  9365. class PokeBattle_Move_155 < PokeBattle_Move
  9366. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9367. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  9368. @battle.pbDisplay(_INTL("But it failed!"))
  9369. return -1
  9370. end
  9371. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9372. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9373. @battle.field.effects[PBEffects::MistyTerrain]=0
  9374. @battle.field.effects[PBEffects::GrassyTerrain]=5
  9375. @battle.pbDisplay(_INTL("Grass grew to cover the battlefield!"))
  9376. return 0
  9377. end
  9378. end
  9379.  
  9380.  
  9381.  
  9382. ################################################################################
  9383. # For 5 rounds, creates a misty terrain which weakens Dragon-type moves and
  9384. # protects Pokémon from status problems. Affects non-airborne Pokémon only.
  9385. # (Misty Terrain)
  9386. ################################################################################
  9387. class PokeBattle_Move_156 < PokeBattle_Move
  9388. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9389. if @battle.field.effects[PBEffects::MistyTerrain]>0
  9390. @battle.pbDisplay(_INTL("But it failed!"))
  9391. return -1
  9392. end
  9393. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9394. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9395. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9396. @battle.field.effects[PBEffects::MistyTerrain]=5
  9397. @battle.pbDisplay(_INTL("Mist swirled about the battlefield!"))
  9398. return 0
  9399. end
  9400. end
  9401.  
  9402.  
  9403.  
  9404. ################################################################################
  9405. # Doubles the prize money the player gets after winning the battle. (Happy Hour)
  9406. ################################################################################
  9407. class PokeBattle_Move_157 < PokeBattle_Move
  9408. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9409. if @battle.pbIsOpposing?(attacker.index) || @battle.doublemoney
  9410. @battle.pbDisplay(_INTL("But it failed!"))
  9411. return -1
  9412. end
  9413. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9414. @battle.doublemoney=true
  9415. @battle.pbDisplay(_INTL("Everyone is caught up in the happy atmosphere!"))
  9416. return 0
  9417. end
  9418. end
  9419.  
  9420.  
  9421.  
  9422. ################################################################################
  9423. # Fails unless user has consumed a berry at some point. (Belch)
  9424. ################################################################################
  9425. class PokeBattle_Move_158 < PokeBattle_Move
  9426. def pbMoveFailed(attacker,opponent)
  9427. return !attacker.pokemon || !attacker.pokemon.belch
  9428. end
  9429. end
  9430.  
  9431.  
  9432.  
  9433. #===============================================================================
  9434. # NOTE: If you're inventing new move effects, use function code 159 and onwards.
  9435. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement