Advertisement
Guest User

Untitled

a guest
Mar 6th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 367.94 KB | None | 0 0
  1. ################################################################################
  2. # Superclass that handles moves using a non-existent function code.
  3. # Damaging moves just do damage with no additional effect.
  4. # Non-damaging moves always fail.
  5. ################################################################################
  6. class PokeBattle_UnimplementedMove < PokeBattle_Move
  7. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8. if pbIsDamaging?
  9. return super(attacker,opponent,hitnum,alltargets,showanimation)
  10. else
  11. @battle.pbDisplay("But it failed!")
  12. return -1
  13. end
  14. end
  15. end
  16.  
  17.  
  18.  
  19. ################################################################################
  20. # Superclass for a failed move. Always fails.
  21. # This class is unused.
  22. ################################################################################
  23. class PokeBattle_FailedMove < PokeBattle_Move
  24. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  25. @battle.pbDisplay("But it failed!")
  26. return -1
  27. end
  28. end
  29.  
  30.  
  31.  
  32. ################################################################################
  33. # Pseudomove for confusion damage.
  34. ################################################################################
  35. class PokeBattle_Confusion < PokeBattle_Move
  36. def initialize(battle,move)
  37. @battle = battle
  38. @basedamage = 40
  39. @type = -1
  40. @accuracy = 100
  41. @pp = -1
  42. @addlEffect = 0
  43. @target = 0
  44. @priority = 0
  45. @flags = 0
  46. @thismove = move
  47. @name = ""
  48. @id = 0
  49. end
  50.  
  51. def pbIsPhysical?(type); return true; end
  52. def pbIsSpecial?(type); return false; end
  53.  
  54. def pbCalcDamage(attacker,opponent)
  55. return super(attacker,opponent,
  56. PokeBattle_Move::NOCRITICAL|PokeBattle_Move::SELFCONFUSE|PokeBattle_Move::NOTYPE|PokeBattle_Move::NOWEIGHTING)
  57. end
  58.  
  59. def pbEffectMessages(attacker,opponent,ignoretype=false)
  60. return super(attacker,opponent,true)
  61. end
  62. end
  63.  
  64.  
  65.  
  66. ################################################################################
  67. # Implements the move Struggle.
  68. # For cases where the real move named Struggle is not defined.
  69. ################################################################################
  70. class PokeBattle_Struggle < PokeBattle_Move
  71. def initialize(battle,move)
  72. @id = -1 # doesn't work if 0
  73. @battle = battle
  74. @name = _INTL("Struggle")
  75. @basedamage = 50
  76. @type = -1
  77. @accuracy = 0
  78. @addlEffect = 0
  79. @target = 0
  80. @priority = 0
  81. @flags = 0
  82. @thismove = nil # not associated with a move
  83. @pp = -1
  84. @totalpp = 0
  85. if move
  86. @id = move.id
  87. @name = PBMoves.getName(id)
  88. end
  89. end
  90.  
  91. def pbIsPhysical?(type); return true; end
  92. def pbIsSpecial?(type); return false; end
  93.  
  94. def pbEffectAfterHit(attacker,opponent,turneffects)
  95. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  96. attacker.pbReduceHP((attacker.totalhp/4.0).round)
  97. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  98. end
  99. end
  100.  
  101. def pbCalcDamage(attacker,opponent)
  102. return super(attacker,opponent,PokeBattle_Move::IGNOREPKMNTYPES)
  103. end
  104. end
  105.  
  106.  
  107.  
  108. ################################################################################
  109. # No additional effect.
  110. ################################################################################
  111. class PokeBattle_Move_000 < PokeBattle_Move
  112. end
  113.  
  114.  
  115.  
  116. ################################################################################
  117. # Does absolutely nothing. (Splash)
  118. ################################################################################
  119. class PokeBattle_Move_001 < PokeBattle_Move
  120. def unusableInGravity?
  121. return true
  122. end
  123.  
  124. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  125. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  126. @battle.pbDisplay(_INTL("But nothing happened!"))
  127. return 0
  128. end
  129. end
  130.  
  131.  
  132.  
  133. ################################################################################
  134. # Struggle. Overrides the default Struggle effect above.
  135. ################################################################################
  136. class PokeBattle_Move_002 < PokeBattle_Struggle
  137. end
  138.  
  139.  
  140.  
  141. ################################################################################
  142. # Puts the target to sleep.
  143. ################################################################################
  144. class PokeBattle_Move_003 < PokeBattle_Move
  145. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  146. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  147. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  148. if opponent.pbCanSleep?(attacker,true,self)
  149. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  150. opponent.pbSleep
  151. return 0
  152. end
  153. return -1
  154. end
  155.  
  156. def pbAdditionalEffect(attacker,opponent)
  157. return if opponent.damagestate.substitute
  158. if opponent.pbCanSleep?(attacker,false,self)
  159. opponent.pbSleep
  160. end
  161. end
  162.  
  163. def pbEffectAfterHit(attacker,opponent,turneffects)
  164. if isConst?(@id,PBMoves,:RELICSONG)
  165. if isConst?(attacker.species,PBSpecies,:MELOETTA) &&
  166. !attacker.effects[PBEffects::Transform] &&
  167. !(attacker.hasWorkingAbility(:SHEERFORCE) && self.addlEffect>0) &&
  168. !attacker.fainted?
  169. attacker.form=(attacker.form+1)%2
  170. attacker.pbUpdate(true)
  171. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  172. @battle.pbDisplay(_INTL("{1} transformed!",attacker.pbThis))
  173. PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
  174. end
  175. end
  176. end
  177. end
  178.  
  179.  
  180.  
  181. ################################################################################
  182. # Makes the target drowsy; it will fall asleep at the end of the next turn. (Yawn)
  183. ################################################################################
  184. class PokeBattle_Move_004 < PokeBattle_Move
  185. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  186. return -1 if !opponent.pbCanSleep?(attacker,true,self)
  187. if opponent.effects[PBEffects::Yawn]>0
  188. @battle.pbDisplay(_INTL("But it failed!"))
  189. return -1
  190. end
  191. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  192. opponent.effects[PBEffects::Yawn]=2
  193. @battle.pbDisplay(_INTL("{1} made {2} drowsy!",attacker.pbThis,opponent.pbThis(true)))
  194. return 0
  195. end
  196. end
  197.  
  198.  
  199.  
  200. ################################################################################
  201. # Poisons the target.
  202. ################################################################################
  203. class PokeBattle_Move_005 < PokeBattle_Move
  204. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  205. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  206. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  207. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  208. opponent.pbPoison(attacker)
  209. return 0
  210. end
  211.  
  212. def pbAdditionalEffect(attacker,opponent)
  213. return if opponent.damagestate.substitute
  214. if opponent.pbCanPoison?(attacker,false,self)
  215. opponent.pbPoison(attacker)
  216. end
  217. end
  218. end
  219.  
  220.  
  221.  
  222. ################################################################################
  223. # Badly poisons the target. (Poison Fang, Toxic)
  224. # (Handled in Battler's pbSuccessCheck): Hits semi-invulnerable targets if user
  225. # is Poison-type and move is status move.
  226. ################################################################################
  227. class PokeBattle_Move_006 < PokeBattle_Move
  228. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  229. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  230. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  231. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  232. opponent.pbPoison(attacker,nil,true)
  233. return 0
  234. end
  235.  
  236. def pbAdditionalEffect(attacker,opponent)
  237. return if opponent.damagestate.substitute
  238. if opponent.pbCanPoison?(attacker,false,self)
  239. opponent.pbPoison(attacker,nil,true)
  240. end
  241. end
  242. end
  243.  
  244.  
  245.  
  246. ################################################################################
  247. # Paralyzes the target.
  248. # Thunder Wave: Doesn't affect target if move's type has no effect on it.
  249. # Bolt Strike: Powers up the next Fusion Flare used this round.
  250. ################################################################################
  251. class PokeBattle_Move_007 < PokeBattle_Move
  252. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  253. if pbIsDamaging?
  254. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  255. if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BOLTSTRIKE)
  256. @battle.field.effects[PBEffects::FusionFlare]=true
  257. end
  258. return ret
  259. else
  260. if isConst?(@id,PBMoves,:THUNDERWAVE)
  261. if pbTypeModifier(type,attacker,opponent)==0
  262. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  263. return -1
  264. end
  265. end
  266. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  267. return -1 if !opponent.pbCanParalyze?(attacker,true,self)
  268. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  269. opponent.pbParalyze(attacker)
  270. return 0
  271. end
  272. return -1
  273. end
  274.  
  275. def pbAdditionalEffect(attacker,opponent)
  276. return if opponent.damagestate.substitute
  277. if opponent.pbCanParalyze?(attacker,false,self)
  278. opponent.pbParalyze(attacker)
  279. end
  280. end
  281. end
  282.  
  283.  
  284.  
  285. ################################################################################
  286. # Paralyzes the target. Accuracy perfect in rain, 50% in sunshine. (Thunder)
  287. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  288. ################################################################################
  289. class PokeBattle_Move_008 < PokeBattle_Move
  290. def pbAdditionalEffect(attacker,opponent)
  291. return if opponent.damagestate.substitute
  292. if opponent.pbCanParalyze?(attacker,false,self)
  293. opponent.pbParalyze(attacker)
  294. end
  295. end
  296.  
  297. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  298. case @battle.pbWeather
  299. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  300. return 0
  301. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  302. return 50
  303. end
  304. return baseaccuracy
  305. end
  306. end
  307.  
  308.  
  309.  
  310. ################################################################################
  311. # Paralyzes the target. May cause the target to flinch. (Thunder Fang)
  312. ################################################################################
  313. class PokeBattle_Move_009 < PokeBattle_Move
  314. def pbAdditionalEffect(attacker,opponent)
  315. return if opponent.damagestate.substitute
  316. if @battle.pbRandom(10)==0
  317. if opponent.pbCanParalyze?(attacker,false,self)
  318. opponent.pbParalyze(attacker)
  319. end
  320. end
  321. if @battle.pbRandom(10)==0
  322. opponent.pbFlinch(attacker)
  323. end
  324. end
  325. end
  326.  
  327.  
  328.  
  329. ################################################################################
  330. # Burns the target.
  331. # Blue Flare: Powers up the next Fusion Bolt used this round.
  332. ################################################################################
  333. class PokeBattle_Move_00A < PokeBattle_Move
  334. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  335. if pbIsDamaging?
  336. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  337. if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BLUEFLARE)
  338. @battle.field.effects[PBEffects::FusionBolt]=true
  339. end
  340. return ret
  341. else
  342. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  343. return -1 if !opponent.pbCanBurn?(attacker,true,self)
  344. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  345. opponent.pbBurn(attacker)
  346. return 0
  347. end
  348. return -1
  349. end
  350.  
  351. def pbAdditionalEffect(attacker,opponent)
  352. return if opponent.damagestate.substitute
  353. if opponent.pbCanBurn?(attacker,false,self)
  354. opponent.pbBurn(attacker)
  355. end
  356. end
  357. end
  358.  
  359.  
  360.  
  361. ################################################################################
  362. # Burns the target. May cause the target to flinch. (Fire Fang)
  363. ################################################################################
  364. class PokeBattle_Move_00B < PokeBattle_Move
  365. def pbAdditionalEffect(attacker,opponent)
  366. return if opponent.damagestate.substitute
  367. if @battle.pbRandom(10)==0
  368. if opponent.pbCanBurn?(attacker,false,self)
  369. opponent.pbBurn(attacker)
  370. end
  371. end
  372. if @battle.pbRandom(10)==0
  373. opponent.pbFlinch(attacker)
  374. end
  375. end
  376. end
  377.  
  378.  
  379.  
  380. ################################################################################
  381. # Freezes the target.
  382. ################################################################################
  383. class PokeBattle_Move_00C < PokeBattle_Move
  384. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  385. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  386. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  387. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  388. opponent.pbFreeze
  389. return 0
  390. end
  391.  
  392. def pbAdditionalEffect(attacker,opponent)
  393. return if opponent.damagestate.substitute
  394. if opponent.pbCanFreeze?(attacker,false,self)
  395. opponent.pbFreeze
  396. end
  397. end
  398. end
  399.  
  400.  
  401.  
  402. ################################################################################
  403. # Freezes the target. Accuracy perfect in hail. (Blizzard)
  404. ################################################################################
  405. class PokeBattle_Move_00D < PokeBattle_Move
  406. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  407. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  408. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  409. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  410. opponent.pbFreeze
  411. return 0
  412. end
  413.  
  414. def pbAdditionalEffect(attacker,opponent)
  415. return if opponent.damagestate.substitute
  416. if opponent.pbCanFreeze?(attacker,false,self)
  417. opponent.pbFreeze
  418. end
  419. end
  420.  
  421. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  422. if @battle.pbWeather==PBWeather::HAIL
  423. return 0
  424. end
  425. return baseaccuracy
  426. end
  427. end
  428.  
  429.  
  430.  
  431. ################################################################################
  432. # Freezes the target. May cause the target to flinch. (Ice Fang)
  433. ################################################################################
  434. class PokeBattle_Move_00E < PokeBattle_Move
  435. def pbAdditionalEffect(attacker,opponent)
  436. return if opponent.damagestate.substitute
  437. if @battle.pbRandom(10)==0
  438. if opponent.pbCanFreeze?(attacker,false,self)
  439. opponent.pbFreeze
  440. end
  441. end
  442. if @battle.pbRandom(10)==0
  443. opponent.pbFlinch(attacker)
  444. end
  445. end
  446. end
  447.  
  448.  
  449.  
  450. ################################################################################
  451. # Causes the target to flinch.
  452. ################################################################################
  453. class PokeBattle_Move_00F < PokeBattle_Move
  454. def pbAdditionalEffect(attacker,opponent)
  455. return if opponent.damagestate.substitute
  456. opponent.pbFlinch(attacker)
  457. end
  458. end
  459.  
  460.  
  461.  
  462. ################################################################################
  463. # Causes the target to flinch. Does double damage and has perfect accuracy if
  464. # the target is Minimized.
  465. ################################################################################
  466. class PokeBattle_Move_010 < PokeBattle_Move
  467. def pbAdditionalEffect(attacker,opponent)
  468. return if opponent.damagestate.substitute
  469. opponent.pbFlinch(attacker)
  470. end
  471.  
  472. def tramplesMinimize?(param=1)
  473. return false if isConst?(@id,PBMoves,:DRAGONRUSH) && !USENEWBATTLEMECHANICS
  474. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  475. return true if param==2 # Double damage
  476. return false
  477. end
  478. end
  479.  
  480.  
  481.  
  482. ################################################################################
  483. # Causes the target to flinch. Fails if the user is not asleep. (Snore)
  484. ################################################################################
  485. class PokeBattle_Move_011 < PokeBattle_Move
  486. def pbCanUseWhileAsleep?
  487. return true
  488. end
  489.  
  490. def pbMoveFailed(attacker,opponent)
  491. return (attacker.status!=PBStatuses::SLEEP)
  492. end
  493.  
  494. def pbAdditionalEffect(attacker,opponent)
  495. return if opponent.damagestate.substitute
  496. opponent.pbFlinch(attacker)
  497. end
  498. end
  499.  
  500.  
  501.  
  502. ################################################################################
  503. # Causes the target to flinch. Fails if this isn't the user's first turn. (Fake Out)
  504. ################################################################################
  505. class PokeBattle_Move_012 < PokeBattle_Move
  506. def pbMoveFailed(attacker,opponent)
  507. return (attacker.turncount>1)
  508. end
  509.  
  510. def pbAdditionalEffect(attacker,opponent)
  511. return if opponent.damagestate.substitute
  512. opponent.pbFlinch(attacker)
  513. end
  514. end
  515.  
  516.  
  517.  
  518. ################################################################################
  519. # Confuses the target.
  520. ################################################################################
  521. class PokeBattle_Move_013 < PokeBattle_Move
  522. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  523. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  524. if opponent.pbCanConfuse?(attacker,true,self)
  525. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  526. opponent.pbConfuse
  527. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  528. return 0
  529. end
  530. return -1
  531. end
  532.  
  533. def pbAdditionalEffect(attacker,opponent)
  534. return if opponent.damagestate.substitute
  535. if opponent.pbCanConfuse?(attacker,false,self)
  536. opponent.pbConfuse
  537. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  538. end
  539. end
  540. end
  541.  
  542.  
  543.  
  544. ################################################################################
  545. # Confuses the target. Chance of causing confusion depends on the cry's volume.
  546. # Confusion chance is 0% if user doesn't have a recorded cry. (Chatter)
  547. # TODO: Play the actual chatter cry as part of the move animation
  548. # @battle.scene.pbChatter(attacker,opponent) # Just plays cry
  549. ################################################################################
  550. class PokeBattle_Move_014 < PokeBattle_Move
  551. def addlEffect
  552. return 100 if USENEWBATTLEMECHANICS
  553. if attacker.pokemon && attacker.pokemon.chatter
  554. return attacker.pokemon.chatter.intensity*10/127
  555. end
  556. return 0
  557. end
  558.  
  559. def pbAdditionalEffect(attacker,opponent)
  560. return if opponent.damagestate.substitute
  561. if opponent.pbCanConfuse?(attacker,false,self)
  562. opponent.pbConfuse
  563. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  564. end
  565. end
  566. end
  567.  
  568.  
  569.  
  570. ################################################################################
  571. # Confuses the target. Accuracy perfect in rain, 50% in sunshine. (Hurricane)
  572. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  573. ################################################################################
  574. class PokeBattle_Move_015 < PokeBattle_Move
  575. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  576. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  577. if opponent.pbCanConfuse?(attacker,true,self)
  578. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  579. opponent.pbConfuse
  580. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  581. return 0
  582. end
  583. return -1
  584. end
  585.  
  586. def pbAdditionalEffect(attacker,opponent)
  587. return if opponent.damagestate.substitute
  588. if opponent.pbCanConfuse?(attacker,false,self)
  589. opponent.pbConfuse
  590. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  591. end
  592. end
  593.  
  594. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  595. case @battle.pbWeather
  596. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  597. return 0
  598. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  599. return 50
  600. end
  601. return baseaccuracy
  602. end
  603. end
  604.  
  605.  
  606.  
  607. ################################################################################
  608. # Attracts the target. (Attract)
  609. ################################################################################
  610. class PokeBattle_Move_016 < PokeBattle_Move
  611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  612. if !opponent.pbCanAttract?(attacker)
  613. return -1
  614. end
  615. if !attacker.hasMoldBreaker
  616. if opponent.hasWorkingAbility(:AROMAVEIL)
  617. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  618. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  619. return -1
  620. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  621. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  622. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  623. return -1
  624. end
  625. end
  626. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  627. opponent.pbAttract(attacker)
  628. return 0
  629. end
  630. end
  631.  
  632.  
  633.  
  634. ################################################################################
  635. # Burns, freezes or paralyzes the target. (Tri Attack)
  636. ################################################################################
  637. class PokeBattle_Move_017 < PokeBattle_Move
  638. def pbAdditionalEffect(attacker,opponent)
  639. return if opponent.damagestate.substitute
  640. case @battle.pbRandom(3)
  641. when 0
  642. if opponent.pbCanBurn?(attacker,false,self)
  643. opponent.pbBurn(attacker)
  644. end
  645. when 1
  646. if opponent.pbCanFreeze?(attacker,false,self)
  647. opponent.pbFreeze
  648. end
  649. when 2
  650. if opponent.pbCanParalyze?(attacker,false,self)
  651. opponent.pbParalyze(attacker)
  652. end
  653. end
  654. end
  655. end
  656.  
  657.  
  658.  
  659. ################################################################################
  660. # Cures user of burn, poison and paralysis. (Refresh)
  661. ################################################################################
  662. class PokeBattle_Move_018 < PokeBattle_Move
  663. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  664. if attacker.status!=PBStatuses::BURN &&
  665. attacker.status!=PBStatuses::POISON &&
  666. attacker.status!=PBStatuses::PARALYSIS
  667. @battle.pbDisplay(_INTL("But it failed!"))
  668. return -1
  669. else
  670. t=attacker.status
  671. attacker.pbCureStatus(false)
  672. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  673. if t==PBStatuses::BURN
  674. @battle.pbDisplay(_INTL("{1} healed its burn!",attacker.pbThis))
  675. elsif t==PBStatuses::POISON
  676. @battle.pbDisplay(_INTL("{1} cured its poisoning!",attacker.pbThis))
  677. elsif t==PBStatuses::PARALYSIS
  678. @battle.pbDisplay(_INTL("{1} cured its paralysis!",attacker.pbThis))
  679. end
  680. return 0
  681. end
  682. end
  683. end
  684.  
  685.  
  686.  
  687. ################################################################################
  688. # Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
  689. ################################################################################
  690. class PokeBattle_Move_019 < PokeBattle_Move
  691. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  692. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  693. if isConst?(@id,PBMoves,:AROMATHERAPY)
  694. @battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
  695. else
  696. @battle.pbDisplay(_INTL("A bell chimed!"))
  697. end
  698. activepkmn=[]
  699. for i in @battle.battlers
  700. next if attacker.pbIsOpposing?(i.index) || i.fainted?
  701. activepkmn.push(i.pokemonIndex)
  702. next if USENEWBATTLEMECHANICS && i.index!=attacker.index &&
  703. pbTypeImmunityByAbility(pbType(@type,attacker,i),attacker,i)
  704. case i.status
  705. when PBStatuses::PARALYSIS
  706. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",i.pbThis))
  707. when PBStatuses::SLEEP
  708. @battle.pbDisplay(_INTL("{1}'s sleep was woken.",i.pbThis))
  709. when PBStatuses::POISON
  710. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",i.pbThis))
  711. when PBStatuses::BURN
  712. @battle.pbDisplay(_INTL("{1}'s burn was healed.",i.pbThis))
  713. when PBStatuses::FROZEN
  714. @battle.pbDisplay(_INTL("{1} was thawed out.",i.pbThis))
  715. end
  716. i.pbCureStatus(false)
  717. end
  718. party=@battle.pbParty(attacker.index) # NOTE: Considers both parties in multi battles
  719. for i in 0...party.length
  720. next if activepkmn.include?(i)
  721. next if !party[i] || party[i].egg? || party[i].hp<=0
  722. case party[i].status
  723. when PBStatuses::PARALYSIS
  724. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",party[i].name))
  725. when PBStatuses::SLEEP
  726. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",party[i].name))
  727. when PBStatuses::POISON
  728. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",party[i].name))
  729. when PBStatuses::BURN
  730. @battle.pbDisplay(_INTL("{1}'s burn was healed.",party[i].name))
  731. when PBStatuses::FROZEN
  732. @battle.pbDisplay(_INTL("{1} was thawed out.",party[i].name))
  733. end
  734. party[i].status=0
  735. party[i].statusCount=0
  736. end
  737. return 0
  738. end
  739. end
  740.  
  741.  
  742.  
  743. ################################################################################
  744. # Safeguards the user's side from being inflicted with status problems. (Safeguard)
  745. ################################################################################
  746. class PokeBattle_Move_01A < PokeBattle_Move
  747. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  748. if attacker.pbOwnSide.effects[PBEffects::Safeguard]>0
  749. @battle.pbDisplay(_INTL("But it failed!"))
  750. return -1
  751. end
  752. attacker.pbOwnSide.effects[PBEffects::Safeguard]=5
  753. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  754. if !@battle.pbIsOpposing?(attacker.index)
  755. @battle.pbDisplay(_INTL("Your team became cloaked in a mystical veil!"))
  756. else
  757. @battle.pbDisplay(_INTL("The opposing team became cloaked in a mystical veil!"))
  758. end
  759. return 0
  760. end
  761. end
  762.  
  763.  
  764.  
  765. ################################################################################
  766. # User passes its status problem to the target. (Psycho Shift)
  767. ################################################################################
  768. class PokeBattle_Move_01B < PokeBattle_Move
  769. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  770. if attacker.status==0 ||
  771. (attacker.status==PBStatuses::PARALYSIS && !opponent.pbCanParalyze?(attacker,false,self)) ||
  772. (attacker.status==PBStatuses::SLEEP && !opponent.pbCanSleep?(attacker,false,self)) ||
  773. (attacker.status==PBStatuses::POISON && !opponent.pbCanPoison?(attacker,false,self)) ||
  774. (attacker.status==PBStatuses::BURN && !opponent.pbCanBurn?(attacker,false,self)) ||
  775. (attacker.status==PBStatuses::FROZEN && !opponent.pbCanFreeze?(attacker,false,self))
  776. @battle.pbDisplay(_INTL("But it failed!"))
  777. return -1
  778. end
  779. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  780. case attacker.status
  781. when PBStatuses::PARALYSIS
  782. opponent.pbParalyze(attacker)
  783. opponent.pbAbilityCureCheck
  784. attacker.pbCureStatus(false)
  785. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",attacker.pbThis))
  786. when PBStatuses::SLEEP
  787. opponent.pbSleep
  788. opponent.pbAbilityCureCheck
  789. attacker.pbCureStatus(false)
  790. @battle.pbDisplay(_INTL("{1} woke up.",attacker.pbThis))
  791. when PBStatuses::POISON
  792. opponent.pbPoison(attacker,nil,attacker.statusCount!=0)
  793. opponent.pbAbilityCureCheck
  794. attacker.pbCureStatus(false)
  795. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  796. when PBStatuses::BURN
  797. opponent.pbBurn(attacker)
  798. opponent.pbAbilityCureCheck
  799. attacker.pbCureStatus(false)
  800. @battle.pbDisplay(_INTL("{1}'s burn was healed.",attacker.pbThis))
  801. when PBStatuses::FROZEN
  802. opponent.pbFreeze
  803. opponent.pbAbilityCureCheck
  804. attacker.pbCureStatus(false)
  805. @battle.pbDisplay(_INTL("{1} was thawed out.",attacker.pbThis))
  806. end
  807. return 0
  808. end
  809. end
  810.  
  811.  
  812.  
  813. ################################################################################
  814. # Increases the user's Attack by 1 stage.
  815. ################################################################################
  816. class PokeBattle_Move_01C < PokeBattle_Move
  817. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  818. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  819. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  820. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  821. ret=attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  822. return ret ? 0 : -1
  823. end
  824.  
  825. def pbAdditionalEffect(attacker,opponent)
  826. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  827. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  828. end
  829. end
  830. end
  831.  
  832.  
  833.  
  834. ################################################################################
  835. # Increases the user's Defense by 1 stage.
  836. ################################################################################
  837. class PokeBattle_Move_01D < PokeBattle_Move
  838. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  839. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  840. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  841. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  842. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  843. return ret ? 0 : -1
  844. end
  845.  
  846. def pbAdditionalEffect(attacker,opponent)
  847. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  848. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  849. end
  850. end
  851. end
  852.  
  853.  
  854.  
  855. ################################################################################
  856. # Increases the user's Defense by 1 stage. User curls up. (Defense Curl)
  857. ################################################################################
  858. class PokeBattle_Move_01E < PokeBattle_Move
  859. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  860. attacker.effects[PBEffects::DefenseCurl]=true
  861. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  862. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  863. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  864. return ret ? 0 : -1
  865. end
  866. end
  867.  
  868.  
  869.  
  870. ################################################################################
  871. # Increases the user's Speed by 1 stage.
  872. ################################################################################
  873. class PokeBattle_Move_01F < PokeBattle_Move
  874. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  875. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  876. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  877. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  878. ret=attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  879. return ret ? 0 : -1
  880. end
  881.  
  882. def pbAdditionalEffect(attacker,opponent)
  883. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  884. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  885. end
  886. end
  887. end
  888.  
  889.  
  890.  
  891. ################################################################################
  892. # Increases the user's Special Attack by 1 stage.
  893. ################################################################################
  894. class PokeBattle_Move_020 < PokeBattle_Move
  895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  896. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  897. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  898. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  899. ret=attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  900. return ret ? 0 : -1
  901. end
  902.  
  903. def pbAdditionalEffect(attacker,opponent)
  904. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  905. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  906. end
  907. end
  908. end
  909.  
  910.  
  911.  
  912. ################################################################################
  913. # Increases the user's Special Defense by 1 stage.
  914. # Charges up user's next attack if it is Electric-type. (Charge)
  915. ################################################################################
  916. class PokeBattle_Move_021 < PokeBattle_Move
  917. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  918. attacker.effects[PBEffects::Charge]=2
  919. @battle.pbDisplay(_INTL("{1} began charging power!",attacker.pbThis))
  920. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  921. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  922. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  923. end
  924. return 0
  925. end
  926. end
  927.  
  928.  
  929.  
  930. ################################################################################
  931. # Increases the user's evasion by 1 stage.
  932. ################################################################################
  933. class PokeBattle_Move_022 < PokeBattle_Move
  934. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  935. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  936. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  937. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  938. ret=attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  939. return ret ? 0 : -1
  940. end
  941.  
  942. def pbAdditionalEffect(attacker,opponent)
  943. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  944. attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  945. end
  946. end
  947. end
  948.  
  949.  
  950.  
  951. ################################################################################
  952. # Increases the user's critical hit rate. (Focus Energy)
  953. ################################################################################
  954. class PokeBattle_Move_023 < PokeBattle_Move
  955. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  956. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  957. if attacker.effects[PBEffects::FocusEnergy]>=2
  958. @battle.pbDisplay(_INTL("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. def pbAdditionalEffect(attacker,opponent)
  1314. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1315. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1316. end
  1317. end
  1318. end
  1319.  
  1320.  
  1321.  
  1322. ################################################################################
  1323. # Increases the user's Speed by 2 stages. Lowers user's weight by 100kg. (Autotomize)
  1324. ################################################################################
  1325. class PokeBattle_Move_031 < PokeBattle_Move
  1326. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1327. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1328. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1329. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1330. if ret
  1331. attacker.effects[PBEffects::WeightChange]-=1000
  1332. @battle.pbDisplay(_INTL("{1} became nimble!",attacker.pbThis))
  1333. end
  1334. return ret ? 0 : -1
  1335. end
  1336. end
  1337.  
  1338.  
  1339.  
  1340. ################################################################################
  1341. # Increases the user's Special Attack by 2 stages.
  1342. ################################################################################
  1343. class PokeBattle_Move_032 < PokeBattle_Move
  1344. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1345. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1346. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1347. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1348. ret=attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1349. return ret ? 0 : -1
  1350. end
  1351.  
  1352. def pbAdditionalEffect(attacker,opponent)
  1353. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1354. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1355. end
  1356. end
  1357. end
  1358.  
  1359.  
  1360.  
  1361. ################################################################################
  1362. # Increases the user's Special Defense by 2 stages.
  1363. ################################################################################
  1364. class PokeBattle_Move_033 < PokeBattle_Move
  1365. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1366. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1367. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  1368. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1369. ret=attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1370. return ret ? 0 : -1
  1371. end
  1372.  
  1373. def pbAdditionalEffect(attacker,opponent)
  1374. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1375. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1376. end
  1377. end
  1378. end
  1379.  
  1380.  
  1381.  
  1382. ################################################################################
  1383. # Increases the user's evasion by 2 stages. Minimizes the user. (Minimize)
  1384. ################################################################################
  1385. class PokeBattle_Move_034 < PokeBattle_Move
  1386. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1387. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1388. attacker.effects[PBEffects::Minimize]=true
  1389. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  1390. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1391. ret=attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1392. return ret ? 0 : -1
  1393. end
  1394.  
  1395. def pbAdditionalEffect(attacker,opponent)
  1396. attacker.effects[PBEffects::Minimize]=true
  1397. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  1398. attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1399. end
  1400. end
  1401. end
  1402.  
  1403.  
  1404.  
  1405. ################################################################################
  1406. # Decreases the user's Defense and Special Defense by 1 stage each. (Shell Smash)
  1407. # Increases the user's Attack, Speed and Special Attack by 2 stages each.
  1408. ################################################################################
  1409. class PokeBattle_Move_035 < PokeBattle_Move
  1410. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1411. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1412. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1413. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1414. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1415. return -1
  1416. end
  1417. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1418. showanim=true
  1419. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1420. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1421. showanim=false
  1422. end
  1423. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1424. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1425. showanim=false
  1426. end
  1427. showanim=true
  1428. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1429. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  1430. showanim=false
  1431. end
  1432. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1433. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  1434. showanim=false
  1435. end
  1436. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1437. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1438. showanim=false
  1439. end
  1440. return 0
  1441. end
  1442. end
  1443.  
  1444.  
  1445.  
  1446. ################################################################################
  1447. # Increases the user's Speed by 2 stages, and its Attack by 1 stage. (Shift Gear)
  1448. ################################################################################
  1449. class PokeBattle_Move_036 < PokeBattle_Move
  1450. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1451. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1452. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1453. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1454. return -1
  1455. end
  1456. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1457. showanim=true
  1458. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1459. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  1460. showanim=false
  1461. end
  1462. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1463. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1464. showanim=false
  1465. end
  1466. return 0
  1467. end
  1468. end
  1469.  
  1470.  
  1471.  
  1472. ################################################################################
  1473. # Increases one random stat of the user by 2 stages (except HP). (Acupressure)
  1474. ################################################################################
  1475. class PokeBattle_Move_037 < PokeBattle_Move
  1476. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1477. if attacker.index!=opponent.index
  1478. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  1479. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1480. @battle.pbDisplay(_INTL("But it failed!"))
  1481. return -1
  1482. end
  1483. end
  1484. array=[]
  1485. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1486. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1487. array.push(i) if opponent.pbCanIncreaseStatStage?(i,attacker,false,self)
  1488. end
  1489. if array.length==0
  1490. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",opponent.pbThis))
  1491. return -1
  1492. end
  1493. stat=array[@battle.pbRandom(array.length)]
  1494. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1495. ret=opponent.pbIncreaseStat(stat,2,attacker,false,self)
  1496. return 0
  1497. end
  1498. end
  1499.  
  1500.  
  1501.  
  1502. ################################################################################
  1503. # Increases the user's Defense by 3 stages.
  1504. ################################################################################
  1505. class PokeBattle_Move_038 < PokeBattle_Move
  1506. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1507. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1508. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1509. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1510. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1511. return ret ? 0 : -1
  1512. end
  1513.  
  1514. def pbAdditionalEffect(attacker,opponent)
  1515. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1516. attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1517. end
  1518. end
  1519. end
  1520.  
  1521.  
  1522.  
  1523. ################################################################################
  1524. # Increases the user's Special Attack by 3 stages.
  1525. ################################################################################
  1526. class PokeBattle_Move_039 < PokeBattle_Move
  1527. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1528. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1529. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1530. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1531. ret=attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1532. return ret ? 0 : -1
  1533. end
  1534.  
  1535. def pbAdditionalEffect(attacker,opponent)
  1536. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1537. attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1538. end
  1539. end
  1540. end
  1541.  
  1542.  
  1543.  
  1544. ################################################################################
  1545. # Reduces the user's HP by half of max, and sets its Attack to maximum. (Belly Drum)
  1546. ################################################################################
  1547. class PokeBattle_Move_03A < PokeBattle_Move
  1548. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1549. if attacker.hp<=(attacker.totalhp/2).floor ||
  1550. !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1551. @battle.pbDisplay(_INTL("But it failed!"))
  1552. return -1
  1553. end
  1554. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1555. attacker.pbReduceHP((attacker.totalhp/2).floor)
  1556. if attacker.hasWorkingAbility(:CONTRARY)
  1557. attacker.stages[PBStats::ATTACK]=-6
  1558. @battle.pbCommonAnimation("StatDown",attacker,nil)
  1559. @battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",attacker.pbThis))
  1560. else
  1561. attacker.stages[PBStats::ATTACK]=6
  1562. @battle.pbCommonAnimation("StatUp",attacker,nil)
  1563. @battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",attacker.pbThis))
  1564. end
  1565. return 0
  1566. end
  1567. end
  1568.  
  1569.  
  1570.  
  1571. ################################################################################
  1572. # Decreases the user's Attack and Defense by 1 stage each. (Superpower)
  1573. ################################################################################
  1574. class PokeBattle_Move_03B < PokeBattle_Move
  1575. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1576. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1577. if opponent.damagestate.calcdamage>0
  1578. showanim=true
  1579. if attacker.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1580. attacker.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1581. showanim=false
  1582. end
  1583. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1584. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1585. showanim=false
  1586. end
  1587. end
  1588. return ret
  1589. end
  1590. end
  1591.  
  1592.  
  1593.  
  1594. ################################################################################
  1595. # Decreases the user's Defense and Special Defense by 1 stage each. (Close Combat)
  1596. ################################################################################
  1597. class PokeBattle_Move_03C < PokeBattle_Move
  1598. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1599. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1600. if opponent.damagestate.calcdamage>0
  1601. showanim=true
  1602. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1603. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1604. showanim=false
  1605. end
  1606. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1607. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1608. showanim=false
  1609. end
  1610. end
  1611. return ret
  1612. end
  1613. end
  1614.  
  1615.  
  1616.  
  1617. ################################################################################
  1618. # Decreases the user's Defense, Special Defense and Speed by 1 stage each.
  1619. # User's ally loses 1/16 of its total HP. (V-create)
  1620. ################################################################################
  1621. class PokeBattle_Move_03D < PokeBattle_Move
  1622. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1623. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1624. if opponent.damagestate.calcdamage>0
  1625. if attacker.pbPartner && !attacker.pbPartner.fainted?
  1626. attacker.pbPartner.pbReduceHP((attacker.pbPartner.totalhp/16).floor,true)
  1627. end
  1628. showanim=true
  1629. if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1630. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1631. showanim=false
  1632. end
  1633. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1634. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1635. showanim=false
  1636. end
  1637. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1638. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1639. showanim=false
  1640. end
  1641. end
  1642. return ret
  1643. end
  1644. end
  1645.  
  1646.  
  1647.  
  1648. ################################################################################
  1649. # Decreases the user's Speed by 1 stage.
  1650. ################################################################################
  1651. class PokeBattle_Move_03E < PokeBattle_Move
  1652. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1653. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1654. if opponent.damagestate.calcdamage>0
  1655. if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1656. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1657. end
  1658. end
  1659. return ret
  1660. end
  1661. end
  1662.  
  1663.  
  1664.  
  1665. ################################################################################
  1666. # Decreases the user's Special Attack by 2 stages.
  1667. ################################################################################
  1668. class PokeBattle_Move_03F < PokeBattle_Move
  1669. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1670. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1671. if opponent.damagestate.calcdamage>0
  1672. if attacker.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1673. attacker.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  1674. end
  1675. end
  1676. return ret
  1677. end
  1678. end
  1679.  
  1680.  
  1681.  
  1682. ################################################################################
  1683. # Increases the target's Special Attack by 1 stage. Confuses the target. (Flatter)
  1684. ################################################################################
  1685. class PokeBattle_Move_040 < PokeBattle_Move
  1686. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1687. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1688. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1689. return -1
  1690. end
  1691. ret=-1
  1692. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1693. if opponent.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1694. opponent.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  1695. ret=0
  1696. end
  1697. if opponent.pbCanConfuse?(attacker,true,self)
  1698. opponent.pbConfuse
  1699. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1700. ret=0
  1701. end
  1702. return ret
  1703. end
  1704. end
  1705.  
  1706.  
  1707.  
  1708. ################################################################################
  1709. # Increases the target's Attack by 2 stages. Confuses the target. (Swagger)
  1710. ################################################################################
  1711. class PokeBattle_Move_041 < PokeBattle_Move
  1712. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1713. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1714. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1715. return -1
  1716. end
  1717. ret=-1
  1718. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1719. if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1720. opponent.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1721. ret=0
  1722. end
  1723. if opponent.pbCanConfuse?(attacker,true,self)
  1724. opponent.pbConfuse
  1725. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1726. ret=0
  1727. end
  1728. return ret
  1729. end
  1730. end
  1731.  
  1732.  
  1733.  
  1734. ################################################################################
  1735. # Decreases the target's Attack by 1 stage.
  1736. ################################################################################
  1737. class PokeBattle_Move_042 < PokeBattle_Move
  1738. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1739. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1740. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  1741. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1742. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1743. return ret ? 0 : -1
  1744. end
  1745.  
  1746. def pbAdditionalEffect(attacker,opponent)
  1747. return if opponent.damagestate.substitute
  1748. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1749. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1750. end
  1751. end
  1752. end
  1753.  
  1754.  
  1755.  
  1756. ################################################################################
  1757. # Decreases the target's Defense by 1 stage.
  1758. ################################################################################
  1759. class PokeBattle_Move_043 < PokeBattle_Move
  1760. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1761. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1762. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  1763. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1764. ret=opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1765. return ret ? 0 : -1
  1766. end
  1767.  
  1768. def pbAdditionalEffect(attacker,opponent)
  1769. return if opponent.damagestate.substitute
  1770. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1771. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1772. end
  1773. end
  1774. end
  1775.  
  1776.  
  1777.  
  1778. ################################################################################
  1779. # Decreases the target's Speed by 1 stage.
  1780. ################################################################################
  1781. class PokeBattle_Move_044 < PokeBattle_Move
  1782. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1783. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1784. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  1785. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1786. ret=opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1787. return ret ? 0 : -1
  1788. end
  1789.  
  1790. def pbAdditionalEffect(attacker,opponent)
  1791. return if opponent.damagestate.substitute
  1792. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1793. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1794. end
  1795. end
  1796.  
  1797. def pbModifyDamage(damagemult,attacker,opponent)
  1798. if isConst?(@id,PBMoves,:BULLDOZE) &&
  1799. @battle.field.effects[PBEffects::GrassyTerrain]>0
  1800. return (damagemult/2.0).round
  1801. end
  1802. return damagemult
  1803. end
  1804. end
  1805.  
  1806.  
  1807.  
  1808. ################################################################################
  1809. # Decreases the target's Special Attack by 1 stage.
  1810. ################################################################################
  1811. class PokeBattle_Move_045 < PokeBattle_Move
  1812. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1813. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1814. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  1815. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1816. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1817. return ret ? 0 : -1
  1818. end
  1819.  
  1820. def pbAdditionalEffect(attacker,opponent)
  1821. return if opponent.damagestate.substitute
  1822. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1823. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1824. end
  1825. end
  1826. end
  1827.  
  1828.  
  1829.  
  1830. ################################################################################
  1831. # Decreases the target's Special Defense by 1 stage.
  1832. ################################################################################
  1833. class PokeBattle_Move_046 < PokeBattle_Move
  1834. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1835. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1836. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  1837. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1838. ret=opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1839. return ret ? 0 : -1
  1840. end
  1841.  
  1842. def pbAdditionalEffect(attacker,opponent)
  1843. return if opponent.damagestate.substitute
  1844. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1845. opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1846. end
  1847. end
  1848. end
  1849.  
  1850.  
  1851.  
  1852. ################################################################################
  1853. # Decreases the target's accuracy by 1 stage.
  1854. ################################################################################
  1855. class PokeBattle_Move_047 < PokeBattle_Move
  1856. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1857. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1858. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,true,self)
  1859. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1860. ret=opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1861. return ret ? 0 : -1
  1862. end
  1863.  
  1864. def pbAdditionalEffect(attacker,opponent)
  1865. return if opponent.damagestate.substitute
  1866. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  1867. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1868. end
  1869. end
  1870. end
  1871.  
  1872.  
  1873.  
  1874. ################################################################################
  1875. # Decreases the target's evasion by 1 stage OR 2 stages. (Sweet Scent)
  1876. ################################################################################
  1877. class PokeBattle_Move_048 < PokeBattle_Move
  1878. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1879. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1880. return -1 if !opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,true,self)
  1881. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1882. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1883. ret=opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1884. return ret ? 0 : -1
  1885. end
  1886.  
  1887. def pbAdditionalEffect(attacker,opponent)
  1888. return if opponent.damagestate.substitute
  1889. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1890. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1891. opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1892. end
  1893. end
  1894. end
  1895.  
  1896.  
  1897.  
  1898. ################################################################################
  1899. # Decreases the target's evasion by 1 stage. Ends all barriers and entry
  1900. # hazards for the target's side OR on both sides. (Defog)
  1901. ################################################################################
  1902. class PokeBattle_Move_049 < PokeBattle_Move
  1903. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1904. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1905. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1906. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1907. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1908. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1909. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1910. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1911. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1912. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1913. opponent.pbOwnSide.effects[PBEffects::StickyWeb] = false
  1914. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1915. if USENEWBATTLEMECHANICS
  1916. opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
  1917. opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1918. opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
  1919. opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
  1920. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1921. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1922. opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = false
  1923. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1924. end
  1925. return 0
  1926. end
  1927.  
  1928. def pbAdditionalEffect(attacker,opponent)
  1929. if !opponent.damagestate.substitute
  1930. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1931. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1932. end
  1933. end
  1934. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1935. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1936. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1937. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1938. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1939. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1940. opponent.pbOwnSide.effects[PBEffects::StickyWeb] = false
  1941. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1942. if USENEWBATTLEMECHANICS
  1943. opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
  1944. opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1945. opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
  1946. opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
  1947. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1948. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1949. opponent.pbOpposingSide.effects[PBEffects::StickyWeb] = false
  1950. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1951. end
  1952. end
  1953. end
  1954.  
  1955.  
  1956.  
  1957. ################################################################################
  1958. # Decreases the target's Attack and Defense by 1 stage each. (Tickle)
  1959. ################################################################################
  1960. class PokeBattle_Move_04A < PokeBattle_Move
  1961. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1962. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  1963. # multiple times
  1964. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1965. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1966. return -1
  1967. end
  1968. if opponent.pbTooLow?(PBStats::ATTACK) &&
  1969. opponent.pbTooLow?(PBStats::DEFENSE)
  1970. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  1971. return -1
  1972. end
  1973. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  1974. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  1975. return -1
  1976. end
  1977. if !attacker.hasMoldBreaker
  1978. if opponent.hasWorkingAbility(:CLEARBODY) ||
  1979. opponent.hasWorkingAbility(:WHITESMOKE)
  1980. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  1981. PBAbilities.getName(opponent.ability)))
  1982. return -1
  1983. end
  1984. end
  1985. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1986. ret=-1; showanim=true
  1987. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER) &&
  1988. !opponent.pbTooLow?(PBStats::ATTACK)
  1989. abilityname=PBAbilities.getName(opponent.ability)
  1990. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  1991. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1992. ret=0; showanim=false
  1993. end
  1994. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:BIGPECKS) &&
  1995. !opponent.pbTooLow?(PBStats::DEFENSE)
  1996. abilityname=PBAbilities.getName(opponent.ability)
  1997. @battle.pbDisplay(_INTL("{1}'s {2} prevents Defense loss!",opponent.pbThis,abilityname))
  1998. elsif opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1999. ret=0; showanim=false
  2000. end
  2001. return ret
  2002. end
  2003. end
  2004.  
  2005.  
  2006.  
  2007. ################################################################################
  2008. # Decreases the target's Attack by 2 stages.
  2009. ################################################################################
  2010. class PokeBattle_Move_04B < PokeBattle_Move
  2011. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2012. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2013. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  2014. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2015. ret=opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2016. return ret ? 0 : -1
  2017. end
  2018.  
  2019. def pbAdditionalEffect(attacker,opponent)
  2020. return if opponent.damagestate.substitute
  2021. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  2022. opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  2023. end
  2024. end
  2025. end
  2026.  
  2027.  
  2028.  
  2029. ################################################################################
  2030. # Decreases the target's Defense by 2 stages. (Screech)
  2031. ################################################################################
  2032. class PokeBattle_Move_04C < PokeBattle_Move
  2033. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2034. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2035. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  2036. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2037. ret=opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2038. return ret ? 0 : -1
  2039. end
  2040.  
  2041. def pbAdditionalEffect(attacker,opponent)
  2042. return if opponent.damagestate.substitute
  2043. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  2044. opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  2045. end
  2046. end
  2047. end
  2048.  
  2049.  
  2050.  
  2051. ################################################################################
  2052. # Decreases the target's Speed by 2 stages. (Cotton Spore, Scary Face, String Shot)
  2053. ################################################################################
  2054. class PokeBattle_Move_04D < PokeBattle_Move
  2055. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2056. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2057. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2058. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  2059. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2060. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2061. ret=opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2062. return ret ? 0 : -1
  2063. end
  2064.  
  2065. def pbAdditionalEffect(attacker,opponent)
  2066. return if opponent.damagestate.substitute
  2067. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  2068. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  2069. opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  2070. end
  2071. end
  2072. end
  2073.  
  2074.  
  2075.  
  2076. ################################################################################
  2077. # Decreases the target's Special Attack by 2 stages. Only works on the opposite
  2078. # gender. (Captivate)
  2079. ################################################################################
  2080. class PokeBattle_Move_04E < PokeBattle_Move
  2081. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2082. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2083. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  2084. if attacker.gender==2 || opponent.gender==2 || attacker.gender==opponent.gender
  2085. @battle.pbDisplay(_INTL("But it failed!"))
  2086. return -1
  2087. end
  2088. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS)
  2089. @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",opponent.pbThis,
  2090. PBAbilities.getName(opponent.ability)))
  2091. return -1
  2092. end
  2093. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2094. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2095. return ret ? 0 : -1
  2096. end
  2097.  
  2098. def pbAdditionalEffect(attacker,opponent)
  2099. return if opponent.damagestate.substitute
  2100. if attacker.gender!=2 && opponent.gender!=2 && attacker.gender!=opponent.gender
  2101. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:OBLIVIOUS)
  2102. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  2103. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  2104. end
  2105. end
  2106. end
  2107. end
  2108. end
  2109.  
  2110.  
  2111.  
  2112. ################################################################################
  2113. # Decreases the target's Special Defense by 2 stages.
  2114. ################################################################################
  2115. class PokeBattle_Move_04F < PokeBattle_Move
  2116. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2117. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  2118. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  2119. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2120. ret=opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2121. return ret ? 0 : -1
  2122. end
  2123.  
  2124. def pbAdditionalEffect(attacker,opponent)
  2125. return if opponent.damagestate.substitute
  2126. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  2127. opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  2128. end
  2129. end
  2130. end
  2131.  
  2132.  
  2133.  
  2134. ################################################################################
  2135. # Resets all target's stat stages to 0. (Clear Smog)
  2136. ################################################################################
  2137. class PokeBattle_Move_050 < PokeBattle_Move
  2138. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2139. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  2140. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  2141. opponent.stages[PBStats::ATTACK] = 0
  2142. opponent.stages[PBStats::DEFENSE] = 0
  2143. opponent.stages[PBStats::SPEED] = 0
  2144. opponent.stages[PBStats::SPATK] = 0
  2145. opponent.stages[PBStats::SPDEF] = 0
  2146. opponent.stages[PBStats::ACCURACY] = 0
  2147. opponent.stages[PBStats::EVASION] = 0
  2148. @battle.pbDisplay(_INTL("{1}'s stat changes were removed!",opponent.pbThis))
  2149. end
  2150. return ret
  2151. end
  2152. end
  2153.  
  2154.  
  2155.  
  2156. ################################################################################
  2157. # Resets all stat stages for all battlers to 0. (Haze)
  2158. ################################################################################
  2159. class PokeBattle_Move_051 < PokeBattle_Move
  2160. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2161. for i in 0...4
  2162. @battle.battlers[i].stages[PBStats::ATTACK] = 0
  2163. @battle.battlers[i].stages[PBStats::DEFENSE] = 0
  2164. @battle.battlers[i].stages[PBStats::SPEED] = 0
  2165. @battle.battlers[i].stages[PBStats::SPATK] = 0
  2166. @battle.battlers[i].stages[PBStats::SPDEF] = 0
  2167. @battle.battlers[i].stages[PBStats::ACCURACY] = 0
  2168. @battle.battlers[i].stages[PBStats::EVASION] = 0
  2169. end
  2170. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2171. @battle.pbDisplay(_INTL("All stat changes were eliminated!"))
  2172. return 0
  2173. end
  2174. end
  2175.  
  2176.  
  2177.  
  2178. ################################################################################
  2179. # User and target swap their Attack and Special Attack stat stages. (Power Swap)
  2180. ################################################################################
  2181. class PokeBattle_Move_052 < PokeBattle_Move
  2182. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2183. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2184. astage=attacker.stages
  2185. ostage=opponent.stages
  2186. astage[PBStats::ATTACK],ostage[PBStats::ATTACK]=ostage[PBStats::ATTACK],astage[PBStats::ATTACK]
  2187. astage[PBStats::SPATK],ostage[PBStats::SPATK]=ostage[PBStats::SPATK],astage[PBStats::SPATK]
  2188. @battle.pbDisplay(_INTL("{1} switched all changes to its Attack and Sp. Atk with the target!",attacker.pbThis))
  2189. return 0
  2190. end
  2191. end
  2192.  
  2193.  
  2194.  
  2195. ################################################################################
  2196. # User and target swap their Defense and Special Defense stat stages. (Guard Swap)
  2197. ################################################################################
  2198. class PokeBattle_Move_053 < PokeBattle_Move
  2199. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2200. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2201. astage=attacker.stages
  2202. ostage=opponent.stages
  2203. astage[PBStats::DEFENSE],ostage[PBStats::DEFENSE]=ostage[PBStats::DEFENSE],astage[PBStats::DEFENSE]
  2204. astage[PBStats::SPDEF],ostage[PBStats::SPDEF]=ostage[PBStats::SPDEF],astage[PBStats::SPDEF]
  2205. @battle.pbDisplay(_INTL("{1} switched all changes to its Defense and Sp. Def with the target!",attacker.pbThis))
  2206. return 0
  2207. end
  2208. end
  2209.  
  2210.  
  2211.  
  2212. ################################################################################
  2213. # User and target swap all their stat stages. (Heart Swap)
  2214. ################################################################################
  2215. class PokeBattle_Move_054 < PokeBattle_Move
  2216. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2217. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2218. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2219. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2220. attacker.stages[i],opponent.stages[i]=opponent.stages[i],attacker.stages[i]
  2221. end
  2222. @battle.pbDisplay(_INTL("{1} switched stat changes with the target!",attacker.pbThis))
  2223. return 0
  2224. end
  2225. end
  2226.  
  2227.  
  2228.  
  2229. ################################################################################
  2230. # User copies the target's stat stages. (Psych Up)
  2231. ################################################################################
  2232. class PokeBattle_Move_055 < PokeBattle_Move
  2233. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2234. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2235. @battle.pbDisplay(_INTL("But it failed!"))
  2236. return -1
  2237. end
  2238. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2239. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2240. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2241. attacker.stages[i]=opponent.stages[i]
  2242. end
  2243. @battle.pbDisplay(_INTL("{1} copied {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  2244. return 0
  2245. end
  2246. end
  2247.  
  2248.  
  2249.  
  2250. ################################################################################
  2251. # For 5 rounds, user's and ally's stat stages cannot be lowered by foes. (Mist)
  2252. ################################################################################
  2253. class PokeBattle_Move_056 < PokeBattle_Move
  2254. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2255. if attacker.pbOwnSide.effects[PBEffects::Mist]>0
  2256. @battle.pbDisplay(_INTL("But it failed!"))
  2257. return -1
  2258. end
  2259. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2260. attacker.pbOwnSide.effects[PBEffects::Mist]=5
  2261. if !@battle.pbIsOpposing?(attacker.index)
  2262. @battle.pbDisplay(_INTL("Your team became shrouded in mist!"))
  2263. else
  2264. @battle.pbDisplay(_INTL("The opposing team became shrouded in mist!"))
  2265. end
  2266. return 0
  2267. end
  2268. end
  2269.  
  2270.  
  2271.  
  2272. ################################################################################
  2273. # Swaps the user's Attack and Defense stats. (Power Trick)
  2274. ################################################################################
  2275. class PokeBattle_Move_057 < PokeBattle_Move
  2276. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2277. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2278. attacker.attack,attacker.defense=attacker.defense,attacker.attack
  2279. attacker.effects[PBEffects::PowerTrick]=!attacker.effects[PBEffects::PowerTrick]
  2280. @battle.pbDisplay(_INTL("{1} switched its Attack and Defense!",attacker.pbThis))
  2281. return 0
  2282. end
  2283. end
  2284.  
  2285.  
  2286.  
  2287. ################################################################################
  2288. # Averages the user's and target's Attack.
  2289. # Averages the user's and target's Special Attack. (Power Split)
  2290. ################################################################################
  2291. class PokeBattle_Move_058 < PokeBattle_Move
  2292. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2293. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2294. @battle.pbDisplay(_INTL("But it failed!"))
  2295. return -1
  2296. end
  2297. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2298. avatk=((attacker.attack+opponent.attack)/2).floor
  2299. avspatk=((attacker.spatk+opponent.spatk)/2).floor
  2300. attacker.attack=opponent.attack=avatk
  2301. attacker.spatk=opponent.spatk=avspatk
  2302. @battle.pbDisplay(_INTL("{1} shared its power with the target!",attacker.pbThis))
  2303. return 0
  2304. end
  2305. end
  2306.  
  2307.  
  2308.  
  2309. ################################################################################
  2310. # Averages the user's and target's Defense.
  2311. # Averages the user's and target's Special Defense. (Guard Split)
  2312. ################################################################################
  2313. class PokeBattle_Move_059 < PokeBattle_Move
  2314. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2315. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2316. @battle.pbDisplay(_INTL("But it failed!"))
  2317. return -1
  2318. end
  2319. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2320. avdef=((attacker.defense+opponent.defense)/2).floor
  2321. avspdef=((attacker.spdef+opponent.spdef)/2).floor
  2322. attacker.defense=opponent.defense=avdef
  2323. attacker.spdef=opponent.spdef=avspdef
  2324. @battle.pbDisplay(_INTL("{1} shared its guard with the target!",attacker.pbThis))
  2325. return 0
  2326. end
  2327. end
  2328.  
  2329.  
  2330.  
  2331. ################################################################################
  2332. # Averages the user's and target's current HP. (Pain Split)
  2333. ################################################################################
  2334. class PokeBattle_Move_05A < PokeBattle_Move
  2335. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2336. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2337. @battle.pbDisplay(_INTL("But it failed!"))
  2338. return -1
  2339. end
  2340. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2341. olda=attacker.hp
  2342. oldo=opponent.hp
  2343. avhp=((attacker.hp+opponent.hp)/2).floor
  2344. attacker.hp=[avhp,attacker.totalhp].min
  2345. opponent.hp=[avhp,opponent.totalhp].min
  2346. @battle.scene.pbHPChanged(attacker,olda)
  2347. @battle.scene.pbHPChanged(opponent,oldo)
  2348. @battle.pbDisplay(_INTL("The battlers shared their pain!"))
  2349. return 0
  2350. end
  2351. end
  2352.  
  2353.  
  2354.  
  2355. ################################################################################
  2356. # For 4 rounds, doubles the Speed of all battlers on the user's side. (Tailwind)
  2357. ################################################################################
  2358. class PokeBattle_Move_05B < PokeBattle_Move
  2359. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2360. if attacker.pbOwnSide.effects[PBEffects::Tailwind]>0
  2361. @battle.pbDisplay(_INTL("But it failed!"))
  2362. return -1
  2363. end
  2364. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2365. attacker.pbOwnSide.effects[PBEffects::Tailwind]=4
  2366. if !@battle.pbIsOpposing?(attacker.index)
  2367. @battle.pbDisplay(_INTL("The tailwind blew from behind your team!"))
  2368. else
  2369. @battle.pbDisplay(_INTL("The tailwind blew from behind the opposing team!"))
  2370. end
  2371. return 0
  2372. end
  2373. end
  2374.  
  2375.  
  2376.  
  2377. ################################################################################
  2378. # This move turns into the last move used by the target, until user switches
  2379. # out. (Mimic)
  2380. ################################################################################
  2381. class PokeBattle_Move_05C < PokeBattle_Move
  2382. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2383. blacklist=[
  2384. 0x02, # Struggle
  2385. 0x14, # Chatter
  2386. 0x5C, # Mimic
  2387. 0x5D, # Sketch
  2388. 0xB6 # Metronome
  2389. ]
  2390. if attacker.effects[PBEffects::Transform] ||
  2391. opponent.lastMoveUsed<=0 ||
  2392. isConst?(PBMoveData.new(opponent.lastMoveUsed).type,PBTypes,:SHADOW) ||
  2393. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  2394. @battle.pbDisplay(_INTL("But it failed!"))
  2395. return -1
  2396. end
  2397. for i in attacker.moves
  2398. if i.id==opponent.lastMoveUsed
  2399. @battle.pbDisplay(_INTL("But it failed!"))
  2400. return -1
  2401. end
  2402. end
  2403. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2404. for i in 0...attacker.moves.length
  2405. if attacker.moves[i].id==@id
  2406. newmove=PBMove.new(opponent.lastMoveUsed)
  2407. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2408. movename=PBMoves.getName(opponent.lastMoveUsed)
  2409. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2410. return 0
  2411. end
  2412. end
  2413. @battle.pbDisplay(_INTL("But it failed!"))
  2414. return -1
  2415. end
  2416. end
  2417.  
  2418.  
  2419.  
  2420. ################################################################################
  2421. # This move permanently turns into the last move used by the target. (Sketch)
  2422. ################################################################################
  2423. class PokeBattle_Move_05D < PokeBattle_Move
  2424. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2425. blacklist=[
  2426. 0x02, # Struggle
  2427. 0x14, # Chatter
  2428. 0x5D # Sketch
  2429. ]
  2430. if attacker.effects[PBEffects::Transform] ||
  2431. opponent.lastMoveUsedSketch<=0 ||
  2432. isConst?(PBMoveData.new(opponent.lastMoveUsedSketch).type,PBTypes,:SHADOW) ||
  2433. blacklist.include?(PBMoveData.new(opponent.lastMoveUsedSketch).function)
  2434. @battle.pbDisplay(_INTL("But it failed!"))
  2435. return -1
  2436. end
  2437. for i in attacker.moves
  2438. if i.id==opponent.lastMoveUsedSketch
  2439. @battle.pbDisplay(_INTL("But it failed!"))
  2440. return -1
  2441. end
  2442. end
  2443. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2444. @battle.pbDisplay(_INTL("But it failed!"))
  2445. return -1
  2446. end
  2447. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2448. for i in 0...attacker.moves.length
  2449. if attacker.moves[i].id==@id
  2450. newmove=PBMove.new(opponent.lastMoveUsedSketch)
  2451. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2452. party=@battle.pbParty(attacker.index)
  2453. party[attacker.pokemonIndex].moves[i]=newmove
  2454. movename=PBMoves.getName(opponent.lastMoveUsedSketch)
  2455. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2456. return 0
  2457. end
  2458. end
  2459. @battle.pbDisplay(_INTL("But it failed!"))
  2460. return -1
  2461. end
  2462. end
  2463.  
  2464.  
  2465.  
  2466. ################################################################################
  2467. # Changes user's type to that of a random user's move, except this one, OR the
  2468. # user's first move's type. (Conversion)
  2469. ################################################################################
  2470. class PokeBattle_Move_05E < PokeBattle_Move
  2471. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2472. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2473. @battle.pbDisplay(_INTL("But it failed!"))
  2474. return -1
  2475. end
  2476. types=[]
  2477. for i in attacker.moves
  2478. next if i.id==@id
  2479. next if PBTypes.isPseudoType?(i.type)
  2480. next if attacker.pbHasType?(i.type)
  2481. if !types.include?(i.type)
  2482. types.push(i.type)
  2483. break if USENEWBATTLEMECHANICS
  2484. end
  2485. end
  2486. if types.length==0
  2487. @battle.pbDisplay(_INTL("But it failed!"))
  2488. return -1
  2489. end
  2490. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2491. newtype=types[@battle.pbRandom(types.length)]
  2492. attacker.type1=newtype
  2493. attacker.type2=newtype
  2494. attacker.effects[PBEffects::Type3]=-1
  2495. typename=PBTypes.getName(newtype)
  2496. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2497. end
  2498. end
  2499.  
  2500.  
  2501.  
  2502. ################################################################################
  2503. # Changes user's type to a random one that resists/is immune to the last move
  2504. # used by the target. (Conversion 2)
  2505. ################################################################################
  2506. class PokeBattle_Move_05F < PokeBattle_Move
  2507. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2508. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2509. @battle.pbDisplay(_INTL("But it failed!"))
  2510. return -1
  2511. end
  2512. if opponent.lastMoveUsed<=0 ||
  2513. PBTypes.isPseudoType?(PBMoveData.new(opponent.lastMoveUsed).type)
  2514. @battle.pbDisplay(_INTL("But it failed!"))
  2515. return -1
  2516. end
  2517. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2518. @battle.pbDisplay(_INTL("But it failed!"))
  2519. return -1
  2520. end
  2521. types=[]
  2522. atype=opponent.lastMoveUsedType
  2523. if atype<0
  2524. @battle.pbDisplay(_INTL("But it failed!"))
  2525. return -1
  2526. end
  2527. for i in 0..PBTypes.maxValue
  2528. next if PBTypes.isPseudoType?(i)
  2529. next if attacker.pbHasType?(i)
  2530. types.push(i) if PBTypes.getEffectiveness(atype,i)<2
  2531. end
  2532. if types.length==0
  2533. @battle.pbDisplay(_INTL("But it failed!"))
  2534. return -1
  2535. end
  2536. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2537. newtype=types[@battle.pbRandom(types.length)]
  2538. attacker.type1=newtype
  2539. attacker.type2=newtype
  2540. attacker.effects[PBEffects::Type3]=-1
  2541. typename=PBTypes.getName(newtype)
  2542. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2543. return 0
  2544. end
  2545. end
  2546.  
  2547.  
  2548.  
  2549. ################################################################################
  2550. # Changes user's type depending on the environment. (Camouflage)
  2551. ################################################################################
  2552. class PokeBattle_Move_060 < PokeBattle_Move
  2553. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2554. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2555. @battle.pbDisplay(_INTL("But it failed!"))
  2556. return -1
  2557. end
  2558. type=getConst(PBTypes,:NORMAL) || 0
  2559. case @battle.environment
  2560. when PBEnvironment::None; type=getConst(PBTypes,:NORMAL) || 0
  2561. when PBEnvironment::Grass; type=getConst(PBTypes,:GRASS) || 0
  2562. when PBEnvironment::TallGrass; type=getConst(PBTypes,:GRASS) || 0
  2563. when PBEnvironment::MovingWater; type=getConst(PBTypes,:WATER) || 0
  2564. when PBEnvironment::StillWater; type=getConst(PBTypes,:WATER) || 0
  2565. when PBEnvironment::Underwater; type=getConst(PBTypes,:WATER) || 0
  2566. when PBEnvironment::Cave; type=getConst(PBTypes,:ROCK) || 0
  2567. when PBEnvironment::Rock; type=getConst(PBTypes,:GROUND) || 0
  2568. when PBEnvironment::Sand; type=getConst(PBTypes,:GROUND) || 0
  2569. when PBEnvironment::Forest; type=getConst(PBTypes,:BUG) || 0
  2570. when PBEnvironment::Snow; type=getConst(PBTypes,:ICE) || 0
  2571. when PBEnvironment::Volcano; type=getConst(PBTypes,:FIRE) || 0
  2572. when PBEnvironment::Graveyard; type=getConst(PBTypes,:GHOST) || 0
  2573. when PBEnvironment::Sky; type=getConst(PBTypes,:FLYING) || 0
  2574. when PBEnvironment::Space; type=getConst(PBTypes,:DRAGON) || 0
  2575. end
  2576. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  2577. type=getConst(PBTypes,:ELECTRIC) if hasConst?(PBTypes,:ELECTRIC)
  2578. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  2579. type=getConst(PBTypes,:GRASS) if hasConst?(PBTypes,:GRASS)
  2580. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  2581. type=getConst(PBTypes,:FAIRY) if hasConst?(PBTypes,:FAIRY)
  2582. end
  2583. if attacker.pbHasType?(type)
  2584. @battle.pbDisplay(_INTL("But it failed!"))
  2585. return -1
  2586. end
  2587. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2588. attacker.type1=type
  2589. attacker.type2=type
  2590. attacker.effects[PBEffects::Type3]=-1
  2591. typename=PBTypes.getName(type)
  2592. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2593. return 0
  2594. end
  2595. end
  2596.  
  2597.  
  2598.  
  2599. ################################################################################
  2600. # Target becomes Water type. (Soak)
  2601. ################################################################################
  2602. class PokeBattle_Move_061 < PokeBattle_Move
  2603. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2604. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2605. @battle.pbDisplay(_INTL("But it failed!"))
  2606. return -1
  2607. end
  2608. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2609. if isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  2610. @battle.pbDisplay(_INTL("But it failed!"))
  2611. return -1
  2612. end
  2613. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2614. if opponent.type1==getConst(PBTypes,:WATER) &&
  2615. opponent.type2==getConst(PBTypes,:WATER) &&
  2616. (opponent.effects[PBEffects::Type3]<0 ||
  2617. opponent.effects[PBEffects::Type3]==getConst(PBTypes,:WATER))
  2618. @battle.pbDisplay(_INTL("But it failed!"))
  2619. return -1
  2620. end
  2621. opponent.type1=getConst(PBTypes,:WATER)
  2622. opponent.type2=getConst(PBTypes,:WATER)
  2623. opponent.effects[PBEffects::Type3]=-1
  2624. typename=PBTypes.getName(getConst(PBTypes,:WATER))
  2625. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  2626. return 0
  2627. end
  2628. end
  2629.  
  2630.  
  2631.  
  2632. ################################################################################
  2633. # User copes target's types. (Reflect Type)
  2634. ################################################################################
  2635. class PokeBattle_Move_062 < PokeBattle_Move
  2636. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2637. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2638. @battle.pbDisplay(_INTL("But it failed!"))
  2639. return -1
  2640. end
  2641. if attacker.pbHasType?(opponent.type1) &&
  2642. attacker.pbHasType?(opponent.type2) &&
  2643. attacker.pbHasType?(opponent.effects[PBEffects::Type3]) &&
  2644. opponent.pbHasType?(attacker.type1) &&
  2645. opponent.pbHasType?(attacker.type2) &&
  2646. opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  2647. @battle.pbDisplay(_INTL("But it failed!"))
  2648. return -1
  2649. end
  2650. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2651. attacker.type1=opponent.type1
  2652. attacker.type2=opponent.type2
  2653. attacker.effects[PBEffects::Type3]=-1
  2654. @battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",attacker.pbThis,opponent.pbThis(true)))
  2655. return 0
  2656. end
  2657. end
  2658.  
  2659.  
  2660.  
  2661. ################################################################################
  2662. # Target's ability becomes Simple. (Simple Beam)
  2663. ################################################################################
  2664. class PokeBattle_Move_063 < PokeBattle_Move
  2665. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2666. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2667. @battle.pbDisplay(_INTL("But it failed!"))
  2668. return -1
  2669. end
  2670. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2671. isConst?(opponent.ability,PBAbilities,:SIMPLE) ||
  2672. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2673. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2674. @battle.pbDisplay(_INTL("But it failed!"))
  2675. return -1
  2676. end
  2677. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2678. oldabil=opponent.ability
  2679. opponent.ability=getConst(PBAbilities,:SIMPLE) || 0
  2680. abilityname=PBAbilities.getName(getConst(PBAbilities,:SIMPLE))
  2681. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2682. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2683. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2684. opponent.effects[PBEffects::Illusion]=nil
  2685. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2686. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2687. end
  2688. return 0
  2689. end
  2690. end
  2691.  
  2692.  
  2693.  
  2694. ################################################################################
  2695. # Target's ability becomes Insomnia. (Worry Seed)
  2696. ################################################################################
  2697. class PokeBattle_Move_064 < PokeBattle_Move
  2698. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2699. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2700. @battle.pbDisplay(_INTL("But it failed!"))
  2701. return -1
  2702. end
  2703. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2704. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2705. isConst?(opponent.ability,PBAbilities,:INSOMNIA) ||
  2706. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2707. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2708. @battle.pbDisplay(_INTL("But it failed!"))
  2709. return -1
  2710. end
  2711. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2712. oldabil=opponent.ability
  2713. opponent.ability=getConst(PBAbilities,:INSOMNIA) || 0
  2714. abilityname=PBAbilities.getName(getConst(PBAbilities,:INSOMNIA))
  2715. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2716. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2717. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2718. opponent.effects[PBEffects::Illusion]=nil
  2719. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2720. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2721. end
  2722. return 0
  2723. end
  2724. end
  2725.  
  2726.  
  2727.  
  2728. ################################################################################
  2729. # User copies target's ability. (Role Play)
  2730. ################################################################################
  2731. class PokeBattle_Move_065 < PokeBattle_Move
  2732. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2733. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2734. @battle.pbDisplay(_INTL("But it failed!"))
  2735. return -1
  2736. end
  2737. if opponent.ability==0 ||
  2738. attacker.ability==opponent.ability ||
  2739. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2740. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2741. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2742. isConst?(opponent.ability,PBAbilities,:FORECAST) ||
  2743. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2744. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2745. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2746. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2747. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2748. isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2749. isConst?(opponent.ability,PBAbilities,:ZENMODE)
  2750. @battle.pbDisplay(_INTL("But it failed!"))
  2751. return -1
  2752. end
  2753. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2754. oldabil=attacker.ability
  2755. attacker.ability=opponent.ability
  2756. abilityname=PBAbilities.getName(opponent.ability)
  2757. @battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),abilityname))
  2758. if attacker.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2759. PBDebug.log("[Ability triggered] #{attacker.pbThis}'s Illusion ended")
  2760. attacker.effects[PBEffects::Illusion]=nil
  2761. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  2762. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",attacker.pbThis,PBAbilities.getName(oldabil)))
  2763. end
  2764. return 0
  2765. end
  2766. end
  2767.  
  2768.  
  2769.  
  2770. ################################################################################
  2771. # Target copies user's ability. (Entrainment)
  2772. ################################################################################
  2773. class PokeBattle_Move_066 < PokeBattle_Move
  2774. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2775. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2776. @battle.pbDisplay(_INTL("But it failed!"))
  2777. return -1
  2778. end
  2779. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2780. @battle.pbDisplay(_INTL("But it failed!"))
  2781. return -1
  2782. end
  2783. if attacker.ability==0 ||
  2784. attacker.ability==opponent.ability ||
  2785. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2786. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2787. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2788. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2789. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2790. isConst?(opponent.ability,PBAbilities,:TRUANT) ||
  2791. isConst?(opponent.ability,PBAbilities,:ZENMODE) ||
  2792. isConst?(attacker.ability,PBAbilities,:FLOWERGIFT) ||
  2793. isConst?(attacker.ability,PBAbilities,:FORECAST) ||
  2794. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2795. isConst?(attacker.ability,PBAbilities,:IMPOSTER) ||
  2796. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2797. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2798. isConst?(attacker.ability,PBAbilities,:TRACE) ||
  2799. isConst?(attacker.ability,PBAbilities,:ZENMODE)
  2800. @battle.pbDisplay(_INTL("But it failed!"))
  2801. return -1
  2802. end
  2803. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2804. oldabil=opponent.ability
  2805. opponent.ability=attacker.ability
  2806. abilityname=PBAbilities.getName(attacker.ability)
  2807. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2808. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2809. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2810. opponent.effects[PBEffects::Illusion]=nil
  2811. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2812. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2813. end
  2814. return 0
  2815. end
  2816. end
  2817.  
  2818.  
  2819.  
  2820. ################################################################################
  2821. # User and target swap abilities. (Skill Swap)
  2822. ################################################################################
  2823. class PokeBattle_Move_067 < PokeBattle_Move
  2824. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2825. if (attacker.ability==0 && opponent.ability==0) ||
  2826. (attacker.ability==opponent.ability && !USENEWBATTLEMECHANICS) ||
  2827. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2828. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2829. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2830. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2831. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2832. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2833. isConst?(attacker.ability,PBAbilities,:WONDERGUARD) ||
  2834. isConst?(opponent.ability,PBAbilities,:WONDERGUARD)
  2835. @battle.pbDisplay(_INTL("But it failed!"))
  2836. return -1
  2837. end
  2838. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2839. tmp=attacker.ability
  2840. attacker.ability=opponent.ability
  2841. opponent.ability=tmp
  2842. @battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
  2843. attacker.pbThis,PBAbilities.getName(opponent.ability),
  2844. PBAbilities.getName(attacker.ability)))
  2845. attacker.pbAbilitiesOnSwitchIn(true)
  2846. opponent.pbAbilitiesOnSwitchIn(true)
  2847. return 0
  2848. end
  2849. end
  2850.  
  2851.  
  2852.  
  2853. ################################################################################
  2854. # Target's ability is negated. (Gastro Acid)
  2855. ################################################################################
  2856. class PokeBattle_Move_068 < PokeBattle_Move
  2857. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2858. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2859. @battle.pbDisplay(_INTL("But it failed!"))
  2860. return -1
  2861. end
  2862. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2863. isConst?(opponent.ability,PBAbilities,:STANCECHANGE)
  2864. @battle.pbDisplay(_INTL("But it failed!"))
  2865. return -1
  2866. end
  2867. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2868. oldabil=opponent.ability
  2869. opponent.effects[PBEffects::GastroAcid]=true
  2870. opponent.effects[PBEffects::Truant]=false
  2871. @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis))
  2872. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2873. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2874. opponent.effects[PBEffects::Illusion]=nil
  2875. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2876. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2877. end
  2878. return 0
  2879. end
  2880. end
  2881.  
  2882.  
  2883.  
  2884. ################################################################################
  2885. # User transforms into the target. (Transform)
  2886. ################################################################################
  2887. class PokeBattle_Move_069 < PokeBattle_Move
  2888. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2889. blacklist=[
  2890. 0xC9, # Fly
  2891. 0xCA, # Dig
  2892. 0xCB, # Dive
  2893. 0xCC, # Bounce
  2894. 0xCD, # Shadow Force
  2895. 0xCE, # Sky Drop
  2896. 0x14D # Phantom Force
  2897. ]
  2898. if attacker.effects[PBEffects::Transform] ||
  2899. opponent.effects[PBEffects::Transform] ||
  2900. opponent.effects[PBEffects::Illusion] ||
  2901. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  2902. opponent.effects[PBEffects::SkyDrop] ||
  2903. blacklist.include?(PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function)
  2904. @battle.pbDisplay(_INTL("But it failed!"))
  2905. return -1
  2906. end
  2907. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2908. @battle.pbDisplay(_INTL("But it failed!"))
  2909. return -1
  2910. end
  2911. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2912. attacker.effects[PBEffects::Transform]=true
  2913. attacker.type1=opponent.type1
  2914. attacker.type2=opponent.type2
  2915. attacker.effects[PBEffects::Type3]=-1
  2916. attacker.ability=opponent.ability
  2917. attacker.attack=opponent.attack
  2918. attacker.defense=opponent.defense
  2919. attacker.speed=opponent.speed
  2920. attacker.spatk=opponent.spatk
  2921. attacker.spdef=opponent.spdef
  2922. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2923. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2924. attacker.stages[i]=opponent.stages[i]
  2925. end
  2926. for i in 0...4
  2927. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(
  2928. @battle,PBMove.new(opponent.moves[i].id))
  2929. attacker.moves[i].pp=5
  2930. attacker.moves[i].totalpp=5
  2931. end
  2932. attacker.effects[PBEffects::Disable]=0
  2933. attacker.effects[PBEffects::DisableMove]=0
  2934. @battle.pbDisplay(_INTL("{1} transformed into {2}!",attacker.pbThis,opponent.pbThis(true)))
  2935. return 0
  2936. end
  2937. end
  2938.  
  2939.  
  2940.  
  2941. ################################################################################
  2942. # Inflicts a fixed 20HP damage. (SonicBoom)
  2943. ################################################################################
  2944. class PokeBattle_Move_06A < PokeBattle_Move
  2945. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2946. return pbEffectFixedDamage(20,attacker,opponent,hitnum,alltargets,showanimation)
  2947. end
  2948. end
  2949.  
  2950.  
  2951.  
  2952. ################################################################################
  2953. # Inflicts a fixed 40HP damage. (Dragon Rage)
  2954. ################################################################################
  2955. class PokeBattle_Move_06B < PokeBattle_Move
  2956. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2957. return pbEffectFixedDamage(40,attacker,opponent,hitnum,alltargets,showanimation)
  2958. end
  2959. end
  2960.  
  2961.  
  2962.  
  2963. ################################################################################
  2964. # Halves the target's current HP. (Super Fang)
  2965. ################################################################################
  2966. class PokeBattle_Move_06C < PokeBattle_Move
  2967. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2968. return pbEffectFixedDamage([(opponent.hp/2).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2969. end
  2970. end
  2971.  
  2972.  
  2973.  
  2974. ################################################################################
  2975. # Inflicts damage equal to the user's level. (Night Shade, Seismic Toss)
  2976. ################################################################################
  2977. class PokeBattle_Move_06D < PokeBattle_Move
  2978. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2979. return pbEffectFixedDamage(attacker.level,attacker,opponent,hitnum,alltargets,showanimation)
  2980. end
  2981. end
  2982.  
  2983.  
  2984.  
  2985. ################################################################################
  2986. # Inflicts damage to bring the target's HP down to equal the user's HP. (Endeavor)
  2987. ################################################################################
  2988. class PokeBattle_Move_06E < PokeBattle_Move
  2989. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2990. if attacker.hp>=opponent.hp
  2991. @battle.pbDisplay(_INTL("But it failed!"))
  2992. return -1
  2993. end
  2994. return pbEffectFixedDamage(opponent.hp-attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  2995. end
  2996. end
  2997.  
  2998.  
  2999.  
  3000. ################################################################################
  3001. # Inflicts damage between 0.5 and 1.5 times the user's level. (Psywave)
  3002. ################################################################################
  3003. class PokeBattle_Move_06F < PokeBattle_Move
  3004. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3005. dmg=[(attacker.level*(@battle.pbRandom(101)+50)/100).floor,1].max
  3006. return pbEffectFixedDamage(dmg,attacker,opponent,hitnum,alltargets,showanimation)
  3007. end
  3008. end
  3009.  
  3010.  
  3011.  
  3012. ################################################################################
  3013. # OHKO. Accuracy increases by difference between levels of user and target.
  3014. ################################################################################
  3015. class PokeBattle_Move_070 < PokeBattle_Move
  3016. def pbAccuracyCheck(attacker,opponent)
  3017. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STURDY)
  3018. @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3019. return false
  3020. end
  3021. if opponent.level>attacker.level
  3022. @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
  3023. return false
  3024. end
  3025. acc=@accuracy+attacker.level-opponent.level
  3026. return @battle.pbRandom(100)<acc
  3027. end
  3028.  
  3029. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3030. damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
  3031. if opponent.fainted?
  3032. @battle.pbDisplay(_INTL("The Impact Caused HEAD TRAUMA!"))
  3033. end
  3034. return damage
  3035. end
  3036. end
  3037.  
  3038.  
  3039.  
  3040. ################################################################################
  3041. # Counters a physical move used against the user this round, with 2x the power. (Counter)
  3042. ################################################################################
  3043. class PokeBattle_Move_071 < PokeBattle_Move
  3044. def pbAddTarget(targets,attacker)
  3045. if attacker.effects[PBEffects::CounterTarget]>=0 &&
  3046. attacker.pbIsOpposing?(attacker.effects[PBEffects::CounterTarget])
  3047. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::CounterTarget]])
  3048. attacker.pbRandomTarget(targets)
  3049. end
  3050. end
  3051. end
  3052.  
  3053. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3054. if attacker.effects[PBEffects::Counter]<0 || !opponent
  3055. @battle.pbDisplay(_INTL("But it failed!"))
  3056. return -1
  3057. end
  3058. ret=pbEffectFixedDamage([attacker.effects[PBEffects::Counter]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3059. return ret
  3060. end
  3061. end
  3062.  
  3063.  
  3064.  
  3065. ################################################################################
  3066. # Counters a specical move used against the user this round, with 2x the power. (Mirror Coat)
  3067. ################################################################################
  3068. class PokeBattle_Move_072 < PokeBattle_Move
  3069. def pbAddTarget(targets,attacker)
  3070. if attacker.effects[PBEffects::MirrorCoatTarget]>=0 &&
  3071. attacker.pbIsOpposing?(attacker.effects[PBEffects::MirrorCoatTarget])
  3072. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::MirrorCoatTarget]])
  3073. attacker.pbRandomTarget(targets)
  3074. end
  3075. end
  3076. end
  3077.  
  3078. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3079. if attacker.effects[PBEffects::MirrorCoat]<0 || !opponent
  3080. @battle.pbDisplay(_INTL("But it failed!"))
  3081. return -1
  3082. end
  3083. ret=pbEffectFixedDamage([attacker.effects[PBEffects::MirrorCoat]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3084. return ret
  3085. end
  3086. end
  3087.  
  3088.  
  3089.  
  3090. ################################################################################
  3091. # Counters the last damaging move used against the user this round, with 1.5x
  3092. # the power. (Metal Burst)
  3093. ################################################################################
  3094. class PokeBattle_Move_073 < PokeBattle_Move
  3095. def pbAddTarget(targets,attacker)
  3096. if attacker.lastAttacker.length>0
  3097. lastattacker=attacker.lastAttacker[attacker.lastAttacker.length-1]
  3098. if lastattacker>=0 && attacker.pbIsOpposing?(lastattacker)
  3099. if !attacker.pbAddTarget(targets,@battle.battlers[lastattacker])
  3100. attacker.pbRandomTarget(targets)
  3101. end
  3102. end
  3103. end
  3104. end
  3105.  
  3106. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3107. if attacker.lastHPLost==0 || !opponent
  3108. @battle.pbDisplay(_INTL("But it failed!"))
  3109. return -1
  3110. end
  3111. ret=pbEffectFixedDamage([(attacker.lastHPLost*1.5).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3112. return ret
  3113. end
  3114. end
  3115.  
  3116.  
  3117.  
  3118. ################################################################################
  3119. # The target's ally loses 1/16 of its max HP. (Flame Burst)
  3120. ################################################################################
  3121. class PokeBattle_Move_074 < PokeBattle_Move
  3122. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3123. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3124. if opponent.damagestate.calcdamage>0
  3125. if opponent.pbPartner && !opponent.pbPartner.fainted? &&
  3126. !opponent.pbPartner.hasWorkingAbility(:MAGICGUARD)
  3127. opponent.pbPartner.pbReduceHP((opponent.pbPartner.totalhp/16).floor)
  3128. @battle.pbDisplay(_INTL("The bursting flame hit {1}!",opponent.pbPartner.pbThis(true)))
  3129. end
  3130. end
  3131. return ret
  3132. end
  3133. end
  3134.  
  3135.  
  3136.  
  3137. ################################################################################
  3138. # Power is doubled if the target is using Dive. (Surf)
  3139. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3140. ################################################################################
  3141. class PokeBattle_Move_075 < PokeBattle_Move
  3142. def pbModifyDamage(damagemult,attacker,opponent)
  3143. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  3144. return (damagemult*2.0).round
  3145. end
  3146. return damagemult
  3147. end
  3148. end
  3149.  
  3150.  
  3151.  
  3152. ################################################################################
  3153. # Power is doubled if the target is using Dig. Power is halved if Grassy Terrain
  3154. # is in effect. (Earthquake)
  3155. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3156. ################################################################################
  3157. class PokeBattle_Move_076 < PokeBattle_Move
  3158. def pbModifyDamage(damagemult,attacker,opponent)
  3159. ret=damagemult
  3160. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3161. ret=(damagemult*2.0).round
  3162. end
  3163. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3164. ret=(damagemult/2.0).round
  3165. end
  3166. return ret
  3167. end
  3168. end
  3169.  
  3170.  
  3171.  
  3172. ################################################################################
  3173. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Gust)
  3174. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3175. ################################################################################
  3176. class PokeBattle_Move_077 < PokeBattle_Move
  3177. def pbBaseDamage(basedmg,attacker,opponent)
  3178. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3179. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3180. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3181. opponent.effects[PBEffects::SkyDrop]
  3182. return basedmg*2
  3183. end
  3184. return basedmg
  3185. end
  3186. end
  3187.  
  3188.  
  3189.  
  3190. ################################################################################
  3191. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Twister)
  3192. # May make the target flinch.
  3193. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3194. ################################################################################
  3195. class PokeBattle_Move_078 < PokeBattle_Move
  3196. def pbBaseDamage(basedmg,attacker,opponent)
  3197. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3198. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3199. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3200. opponent.effects[PBEffects::SkyDrop]
  3201. return basedmg*2
  3202. end
  3203. return basedmg
  3204. end
  3205.  
  3206. def pbAdditionalEffect(attacker,opponent)
  3207. return if opponent.damagestate.substitute
  3208. opponent.pbFlinch(attacker)
  3209. end
  3210. end
  3211.  
  3212.  
  3213.  
  3214. ################################################################################
  3215. # Power is doubled if Fusion Flare has already been used this round. (Fusion Bolt)
  3216. ################################################################################
  3217. class PokeBattle_Move_079 < PokeBattle_Move
  3218. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3219. if @battle.field.effects[PBEffects::FusionBolt]
  3220. @battle.field.effects[PBEffects::FusionBolt]=false
  3221. @doubled=true
  3222. return (damagemult*2.0).round
  3223. end
  3224. return damagemult
  3225. end
  3226.  
  3227. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3228. @doubled=false
  3229. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3230. if opponent.damagestate.calcdamage>0
  3231. @battle.field.effects[PBEffects::FusionFlare]=true
  3232. end
  3233. return ret
  3234. end
  3235.  
  3236. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3237. if opponent.damagestate.critical || @doubled
  3238. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3239. end
  3240. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3241. end
  3242. end
  3243.  
  3244.  
  3245.  
  3246. ################################################################################
  3247. # Power is doubled if Fusion Bolt has already been used this round. (Fusion Flare)
  3248. ################################################################################
  3249. class PokeBattle_Move_07A < PokeBattle_Move
  3250. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3251. if @battle.field.effects[PBEffects::FusionFlare]
  3252. @battle.field.effects[PBEffects::FusionFlare]=false
  3253. return (damagemult*2.0).round
  3254. end
  3255. return damagemult
  3256. end
  3257.  
  3258. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3259. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3260. if opponent.damagestate.calcdamage>0
  3261. @battle.field.effects[PBEffects::FusionBolt]=true
  3262. end
  3263. return ret
  3264. end
  3265.  
  3266. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3267. if opponent.damagestate.critical || @doubled
  3268. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3269. end
  3270. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3271. end
  3272. end
  3273.  
  3274.  
  3275.  
  3276. ################################################################################
  3277. # Power is doubled if the target is poisoned. (Venoshock)
  3278. ################################################################################
  3279. class PokeBattle_Move_07B < PokeBattle_Move
  3280. def pbBaseDamage(basedmg,attacker,opponent)
  3281. if opponent.status==PBStatuses::POISON &&
  3282. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3283. return basedmg*2
  3284. end
  3285. return basedmg
  3286. end
  3287. end
  3288.  
  3289.  
  3290.  
  3291. ################################################################################
  3292. # Power is doubled if the target is paralyzed. Cures the target of paralysis.
  3293. # (SmellingSalt)
  3294. ################################################################################
  3295. class PokeBattle_Move_07C < PokeBattle_Move
  3296. def pbBaseDamage(basedmg,attacker,opponent)
  3297. if opponent.status==PBStatuses::PARALYSIS &&
  3298. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3299. return basedmg*2
  3300. end
  3301. return basedmg
  3302. end
  3303.  
  3304. def pbEffectAfterHit(attacker,opponent,turneffects)
  3305. if !opponent.fainted? && opponent.damagestate.calcdamage>0 &&
  3306. !opponent.damagestate.substitute && opponent.status==PBStatuses::PARALYSIS
  3307. opponent.pbCureStatus
  3308. end
  3309. end
  3310. end
  3311.  
  3312.  
  3313.  
  3314. ################################################################################
  3315. # Power is doubled if the target is asleep. Wakes the target up. (Wake-Up Slap)
  3316. ################################################################################
  3317. class PokeBattle_Move_07D < PokeBattle_Move
  3318. def pbBaseDamage(basedmg,attacker,opponent)
  3319. if opponent.status==PBStatuses::SLEEP &&
  3320. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3321. return basedmg*2
  3322. end
  3323. return basedmg
  3324. end
  3325.  
  3326. def pbEffectAfterHit(attacker,opponent,turneffects)
  3327. if !opponent.fainted? && opponent.damagestate.calcdamage>0 &&
  3328. !opponent.damagestate.substitute && opponent.status==PBStatuses::SLEEP
  3329. opponent.pbCureStatus
  3330. end
  3331. end
  3332. end
  3333.  
  3334.  
  3335.  
  3336. ################################################################################
  3337. # Power is doubled if the user is burned, poisoned or paralyzed. (Facade)
  3338. ################################################################################
  3339. class PokeBattle_Move_07E < PokeBattle_Move
  3340. def pbBaseDamage(basedmg,attacker,opponent)
  3341. if attacker.status==PBStatuses::POISON ||
  3342. attacker.status==PBStatuses::BURN ||
  3343. attacker.status==PBStatuses::PARALYSIS
  3344. return basedmg*2
  3345. end
  3346. return basedmg
  3347. end
  3348. end
  3349.  
  3350.  
  3351.  
  3352. ################################################################################
  3353. # Power is doubled if the target has a status problem. (Hex)
  3354. ################################################################################
  3355. class PokeBattle_Move_07F < PokeBattle_Move
  3356. def pbBaseDamage(basedmg,attacker,opponent)
  3357. if opponent.status>0 &&
  3358. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3359. return basedmg*2
  3360. end
  3361. return basedmg
  3362. end
  3363. end
  3364.  
  3365.  
  3366.  
  3367. ################################################################################
  3368. # Power is doubled if the target's HP is down to 1/2 or less. (Brine)
  3369. ################################################################################
  3370. class PokeBattle_Move_080 < PokeBattle_Move
  3371. def pbBaseDamage(basedmg,attacker,opponent)
  3372. if opponent.hp<=opponent.totalhp/2
  3373. return basedmg*2
  3374. end
  3375. return basedmg
  3376. end
  3377. end
  3378.  
  3379.  
  3380.  
  3381. ################################################################################
  3382. # Power is doubled if the user has lost HP due to the target's move this round.
  3383. # (Revenge, Avalanche)
  3384. ################################################################################
  3385. class PokeBattle_Move_081 < PokeBattle_Move
  3386. def pbBaseDamage(basedmg,attacker,opponent)
  3387. if attacker.lastHPLost>0 && attacker.lastAttacker.include?(opponent.index)
  3388. return basedmg*2
  3389. end
  3390. return basedmg
  3391. end
  3392. end
  3393.  
  3394.  
  3395.  
  3396. ################################################################################
  3397. # Power is doubled if the target has already lost HP this round. (Assurance)
  3398. ################################################################################
  3399. class PokeBattle_Move_082 < PokeBattle_Move
  3400. def pbBaseDamage(basedmg,attacker,opponent)
  3401. if opponent.tookDamage
  3402. return basedmg*2
  3403. end
  3404. return basedmg
  3405. end
  3406. end
  3407.  
  3408.  
  3409.  
  3410. ################################################################################
  3411. # Power is doubled if a user's ally has already used this move this round. (Round)
  3412. # If an ally is about to use the same move, make it go next, ignoring priority.
  3413. ################################################################################
  3414. class PokeBattle_Move_083 < PokeBattle_Move
  3415. def pbBaseDamage(basedmg,attacker,opponent)
  3416. ret=basedmg
  3417. attacker.pbOwnSide.effects[PBEffects::Round].times do
  3418. ret*=2
  3419. end
  3420. return ret
  3421. end
  3422.  
  3423. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3424. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3425. if opponent.damagestate.calcdamage>0
  3426. attacker.pbOwnSide.effects[PBEffects::Round]+=1
  3427. if attacker.pbPartner && !attacker.pbPartner.hasMovedThisRound?
  3428. if @battle.choices[attacker.pbPartner.index][0]==1 # Will use a move
  3429. partnermove=@battle.choices[attacker.pbPartner.index][2]
  3430. if partnermove.function==@function
  3431. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  3432. attacker.pbPartner.effects[PBEffects::Quash]=false
  3433. end
  3434. end
  3435. end
  3436. end
  3437. return ret
  3438. end
  3439. end
  3440.  
  3441.  
  3442.  
  3443. ################################################################################
  3444. # Power is doubled if the target has already moved this round. (Payback)
  3445. ################################################################################
  3446. class PokeBattle_Move_084 < PokeBattle_Move
  3447. def pbBaseDamage(basedmg,attacker,opponent)
  3448. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3449. opponent.hasMovedThisRound? # Used a move already
  3450. return basedmg*2
  3451. end
  3452. return basedmg
  3453. end
  3454. end
  3455.  
  3456.  
  3457.  
  3458. ################################################################################
  3459. # Power is doubled if a user's teammate fainted last round. (Retaliate)
  3460. ################################################################################
  3461. class PokeBattle_Move_085 < PokeBattle_Move
  3462. def pbBaseDamage(basedmg,attacker,opponent)
  3463. if attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]>=0 &&
  3464. attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]==@battle.turncount-1
  3465. return basedmg*2
  3466. end
  3467. return basedmg
  3468. end
  3469. end
  3470.  
  3471.  
  3472.  
  3473. ################################################################################
  3474. # Power is doubled if the user has no held item. (Acrobatics)
  3475. ################################################################################
  3476. class PokeBattle_Move_086 < PokeBattle_Move
  3477. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3478. if attacker.item==0
  3479. return (damagemult*2.0).round
  3480. end
  3481. return damagemult
  3482. end
  3483. end
  3484.  
  3485.  
  3486.  
  3487. ################################################################################
  3488. # Power is doubled in weather. Type changes depending on the weather. (Weather Ball)
  3489. ################################################################################
  3490. class PokeBattle_Move_087 < PokeBattle_Move
  3491. def pbBaseDamage(basedmg,attacker,opponent)
  3492. if @battle.pbWeather!=0
  3493. return basedmg*2
  3494. end
  3495. return basedmg
  3496. end
  3497.  
  3498. def pbModifyType(type,attacker,opponent)
  3499. type=getConst(PBTypes,:NORMAL) || 0
  3500. case @battle.pbWeather
  3501. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  3502. type=(getConst(PBTypes,:FIRE) || type)
  3503. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  3504. type=(getConst(PBTypes,:WATER) || type)
  3505. when PBWeather::SANDSTORM
  3506. type=(getConst(PBTypes,:ROCK) || type)
  3507. when PBWeather::HAIL
  3508. type=(getConst(PBTypes,:ICE) || type)
  3509. end
  3510. return type
  3511. end
  3512. end
  3513.  
  3514.  
  3515.  
  3516. ################################################################################
  3517. # Power is doubled if a foe tries to switch out or use U-turn/Volt Switch/
  3518. # Parting Shot. (Pursuit)
  3519. # (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
  3520. ################################################################################
  3521. class PokeBattle_Move_088 < PokeBattle_Move
  3522. def pbBaseDamage(basedmg,attacker,opponent)
  3523. if @battle.switching
  3524. return basedmg*2
  3525. end
  3526. return basedmg
  3527. end
  3528.  
  3529. def pbAccuracyCheck(attacker,opponent)
  3530. return true if @battle.switching
  3531. return super(attacker,opponent)
  3532. end
  3533. end
  3534.  
  3535.  
  3536.  
  3537. ################################################################################
  3538. # Power increases with the user's happiness. (Return)
  3539. ################################################################################
  3540. class PokeBattle_Move_089 < PokeBattle_Move
  3541. def pbBaseDamage(basedmg,attacker,opponent)
  3542. return [(attacker.happiness*2/5).floor,1].max
  3543. end
  3544. end
  3545.  
  3546.  
  3547.  
  3548. ################################################################################
  3549. # Power decreases with the user's happiness. (Frustration)
  3550. ################################################################################
  3551. class PokeBattle_Move_08A < PokeBattle_Move
  3552. def pbBaseDamage(basedmg,attacker,opponent)
  3553. return [((255-attacker.happiness)*2/5).floor,1].max
  3554. end
  3555. end
  3556.  
  3557.  
  3558.  
  3559. ################################################################################
  3560. # Power increases with the user's HP. (Eruption, Water Spout)
  3561. ################################################################################
  3562. class PokeBattle_Move_08B < PokeBattle_Move
  3563. def pbBaseDamage(basedmg,attacker,opponent)
  3564. return [(150*attacker.hp/attacker.totalhp).floor,1].max
  3565. end
  3566. end
  3567.  
  3568.  
  3569.  
  3570. ################################################################################
  3571. # Power increases with the target's HP. (Crush Grip, Wring Out)
  3572. ################################################################################
  3573. class PokeBattle_Move_08C < PokeBattle_Move
  3574. def pbBaseDamage(basedmg,attacker,opponent)
  3575. return [(120*opponent.hp/opponent.totalhp).floor,1].max
  3576. end
  3577. end
  3578.  
  3579.  
  3580.  
  3581. ################################################################################
  3582. # Power increases the quicker the target is than the user. (Gyro Ball)
  3583. ################################################################################
  3584. class PokeBattle_Move_08D < PokeBattle_Move
  3585. def pbBaseDamage(basedmg,attacker,opponent)
  3586. return [[(25*opponent.pbSpeed/attacker.pbSpeed).floor,150].min,1].max
  3587. end
  3588. end
  3589.  
  3590.  
  3591.  
  3592. ################################################################################
  3593. # Power increases with the user's positive stat changes (ignores negative ones).
  3594. # (Stored Power)
  3595. ################################################################################
  3596. class PokeBattle_Move_08E < PokeBattle_Move
  3597. def pbBaseDamage(basedmg,attacker,opponent)
  3598. mult=1
  3599. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3600. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3601. mult+=attacker.stages[i] if attacker.stages[i]>0
  3602. end
  3603. return 20*mult
  3604. end
  3605. end
  3606.  
  3607.  
  3608.  
  3609. ################################################################################
  3610. # Power increases with the target's positive stat changes (ignores negative ones).
  3611. # (Punishment)
  3612. ################################################################################
  3613. class PokeBattle_Move_08F < PokeBattle_Move
  3614. def pbBaseDamage(basedmg,attacker,opponent)
  3615. mult=3
  3616. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3617. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3618. mult+=opponent.stages[i] if opponent.stages[i]>0
  3619. end
  3620. return [20*mult,200].min
  3621. end
  3622. end
  3623.  
  3624.  
  3625.  
  3626. ################################################################################
  3627. # Power and type depends on the user's IVs. (Hidden Power)
  3628. ################################################################################
  3629. class PokeBattle_Move_090 < PokeBattle_Move
  3630. def pbModifyType(type,attacker,opponent)
  3631. hp=pbHiddenPower(attacker.iv)
  3632. type=hp[0]
  3633. return type
  3634. end
  3635.  
  3636. def pbBaseDamage(basedmg,attacker,opponent)
  3637. return 60 if USENEWBATTLEMECHANICS
  3638. hp=pbHiddenPower(attacker.iv)
  3639. return hp[1]
  3640. end
  3641. end
  3642.  
  3643. def pbHiddenPower(iv)
  3644. powermin=30
  3645. powermax=70
  3646. type=0; base=0
  3647. types=[]
  3648. for i in 0..PBTypes.maxValue
  3649. types.push(i) if !PBTypes.isPseudoType?(i) &&
  3650. !isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
  3651. end
  3652. type|=(iv[PBStats::HP]&1)
  3653. type|=(iv[PBStats::ATTACK]&1)<<1
  3654. type|=(iv[PBStats::DEFENSE]&1)<<2
  3655. type|=(iv[PBStats::SPEED]&1)<<3
  3656. type|=(iv[PBStats::SPATK]&1)<<4
  3657. type|=(iv[PBStats::SPDEF]&1)<<5
  3658. type=(type*(types.length-1)/63).floor
  3659. hptype=types[type]
  3660. base|=(iv[PBStats::HP]&2)>>1
  3661. base|=(iv[PBStats::ATTACK]&2)
  3662. base|=(iv[PBStats::DEFENSE]&2)<<1
  3663. base|=(iv[PBStats::SPEED]&2)<<2
  3664. base|=(iv[PBStats::SPATK]&2)<<3
  3665. base|=(iv[PBStats::SPDEF]&2)<<4
  3666. base=(base*(powermax-powermin)/63).floor+powermin
  3667. return [hptype,base]
  3668. end
  3669.  
  3670. ################################################################################
  3671. # Power doubles for each consecutive use. (Fury Cutter)
  3672. ################################################################################
  3673. class PokeBattle_Move_091 < PokeBattle_Move
  3674. def pbBaseDamage(basedmg,attacker,opponent)
  3675. basedmg=basedmg<<(attacker.effects[PBEffects::FuryCutter]-1) # can be 1 to 4
  3676. return basedmg
  3677. end
  3678. end
  3679.  
  3680.  
  3681.  
  3682. ################################################################################
  3683. # Power is multiplied by the number of consecutive rounds in which this move was
  3684. # used by any Pokémon on the user's side. (Echoed Voice)
  3685. ################################################################################
  3686. class PokeBattle_Move_092 < PokeBattle_Move
  3687. def pbBaseDamage(basedmg,attacker,opponent)
  3688. basedmg*=attacker.pbOwnSide.effects[PBEffects::EchoedVoiceCounter] # can be 1 to 5
  3689. return basedmg
  3690. end
  3691. end
  3692.  
  3693.  
  3694.  
  3695. ################################################################################
  3696. # User rages until the start of a round in which they don't use this move. (Rage)
  3697. # (Handled in Battler's pbProcessMoveAgainstTarget): Ups rager's Attack by 1
  3698. # stage each time it loses HP due to a move.
  3699. ################################################################################
  3700. class PokeBattle_Move_093 < PokeBattle_Move
  3701. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3702. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3703. attacker.effects[PBEffects::Rage]=true if ret>0
  3704. return ret
  3705. end
  3706. end
  3707.  
  3708.  
  3709.  
  3710. ################################################################################
  3711. # Randomly damages or heals the target. (Present)
  3712. ################################################################################
  3713. class PokeBattle_Move_094 < PokeBattle_Move
  3714. def pbOnStartUse(attacker)
  3715. # Just to ensure that Parental Bond's second hit damages if the first hit does
  3716. @forcedamage=false
  3717. return true
  3718. end
  3719.  
  3720. def pbBaseDamage(basedmg,attacker,opponent)
  3721. @forcedamage=true
  3722. return @calcbasedmg
  3723. end
  3724.  
  3725. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3726. @calcbasedmg=1
  3727. r=@battle.pbRandom((@forcedamage) ? 8 : 10)
  3728. if r<4
  3729. @calcbasedmg=40
  3730. elsif r<7
  3731. @calcbasedmg=80
  3732. elsif r<8
  3733. @calcbasedmg=120
  3734. else
  3735. if pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)==0
  3736. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  3737. return -1
  3738. end
  3739. if opponent.hp==opponent.totalhp
  3740. @battle.pbDisplay(_INTL("But it failed!"))
  3741. return -1
  3742. end
  3743. damage=pbCalcDamage(attacker,opponent) # Consumes Gems even if it will heal
  3744. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Healing animation
  3745. opponent.pbRecoverHP((opponent.totalhp/4).floor,true)
  3746. @battle.pbDisplay(_INTL("{1} had its HP restored.",opponent.pbThis))
  3747. return 0
  3748. end
  3749. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3750. end
  3751. end
  3752.  
  3753.  
  3754.  
  3755. ################################################################################
  3756. # Power is chosen at random. Power is doubled if the target is using Dig. (Magnitude)
  3757. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3758. ################################################################################
  3759. class PokeBattle_Move_095 < PokeBattle_Move
  3760. def pbOnStartUse(attacker)
  3761. basedmg=[10,30,50,70,90,110,150]
  3762. magnitudes=[
  3763. 4,
  3764. 5,5,
  3765. 6,6,6,6,
  3766. 7,7,7,7,7,7,
  3767. 8,8,8,8,
  3768. 9,9,
  3769. 10
  3770. ]
  3771. magni=magnitudes[@battle.pbRandom(magnitudes.length)]
  3772. @calcbasedmg=basedmg[magni-4]
  3773. @battle.pbDisplay(_INTL("Magnitude {1}!",magni))
  3774. return true
  3775. end
  3776.  
  3777. def pbBaseDamage(basedmg,attacker,opponent)
  3778. ret=@calcbasedmg
  3779. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3780. ret*=2
  3781. end
  3782. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3783. ret=(ret/2.0).round
  3784. end
  3785. return ret
  3786. end
  3787. end
  3788.  
  3789.  
  3790.  
  3791. ################################################################################
  3792. # Power and type depend on the user's held berry. Destroys the berry. (Natural Gift)
  3793. ################################################################################
  3794. class PokeBattle_Move_096 < PokeBattle_Move
  3795. def pbOnStartUse(attacker)
  3796. if !pbIsBerry?(attacker.item) ||
  3797. attacker.effects[PBEffects::Embargo]>0 ||
  3798. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  3799. attacker.hasWorkingAbility(:KLUTZ) ||
  3800. attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) ||
  3801. attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  3802. @battle.pbDisplay(_INTL("But it failed!"))
  3803. return false
  3804. end
  3805. @berry=attacker.item
  3806. return true
  3807. end
  3808.  
  3809. def pbBaseDamage(basedmg,attacker,opponent)
  3810. damagearray={
  3811. 60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
  3812. :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
  3813. :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
  3814. :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
  3815. :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
  3816. :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
  3817. :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY,:ROSELIBERRY],
  3818. 70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
  3819. :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
  3820. :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
  3821. :PAMTREBERRY],
  3822. 80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
  3823. :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
  3824. :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JABOCABERRY,:ROWAPBERRY,
  3825. :KEEBERRY,:MARANGABERRY]
  3826. }
  3827. for i in damagearray.keys
  3828. data=damagearray[i]
  3829. if data
  3830. for j in data
  3831. if isConst?(@berry,PBItems,j)
  3832. ret=i
  3833. ret+=20 if USENEWBATTLEMECHANICS
  3834. return ret
  3835. end
  3836. end
  3837. end
  3838. end
  3839. return 1
  3840. end
  3841.  
  3842. def pbModifyType(type,attacker,opponent)
  3843. type=getConst(PBTypes,:NORMAL) || 0
  3844. typearray={
  3845. :NORMAL => [:CHILANBERRY],
  3846. :FIRE => [:CHERIBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
  3847. :WATER => [:CHESTOBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
  3848. :ELECTRIC => [:PECHABERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
  3849. :GRASS => [:RAWSTBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
  3850. :ICE => [:ASPEARBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
  3851. :FIGHTING => [:LEPPABERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
  3852. :POISON => [:ORANBERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
  3853. :GROUND => [:PERSIMBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
  3854. :FLYING => [:LUMBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
  3855. :PSYCHIC => [:SITRUSBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
  3856. :BUG => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
  3857. :ROCK => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
  3858. :GHOST => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
  3859. :DRAGON => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JABOCABERRY],
  3860. :DARK => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY,:MARANGABERRY],
  3861. :STEEL => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY],
  3862. :FAIRY => [:ROSELIBERRY,:KEEBERRY]
  3863. }
  3864. for i in typearray.keys
  3865. data=typearray[i]
  3866. if data
  3867. for j in data
  3868. if isConst?(@berry,PBItems,j)
  3869. type=getConst(PBTypes,i) || type
  3870. end
  3871. end
  3872. end
  3873. end
  3874. return type
  3875. end
  3876.  
  3877. def pbEffectAfterHit(attacker,opponent,turneffects)
  3878. if turneffects[PBEffects::TotalDamage]>0
  3879. attacker.pbConsumeItem
  3880. end
  3881. end
  3882. end
  3883.  
  3884.  
  3885.  
  3886. ################################################################################
  3887. # Power increases the less PP this move has. (Trump Card)
  3888. ################################################################################
  3889. class PokeBattle_Move_097 < PokeBattle_Move
  3890. def pbBaseDamage(basedmg,attacker,opponent)
  3891. dmgs=[200,80,60,50,40]
  3892. ppleft=[@pp,4].min # PP is reduced before the move is used
  3893. basedmg=dmgs[ppleft]
  3894. return basedmg
  3895. end
  3896. end
  3897.  
  3898.  
  3899.  
  3900. ################################################################################
  3901. # Power increases the less HP the user has. (Flail, Reversal)
  3902. ################################################################################
  3903. class PokeBattle_Move_098 < PokeBattle_Move
  3904. def pbBaseDamage(basedmg,attacker,opponent)
  3905. n=(48*attacker.hp/attacker.totalhp).floor
  3906. ret=20
  3907. ret=40 if n<33
  3908. ret=80 if n<17
  3909. ret=100 if n<10
  3910. ret=150 if n<5
  3911. ret=200 if n<2
  3912. return ret
  3913. end
  3914. end
  3915.  
  3916.  
  3917.  
  3918. ################################################################################
  3919. # Power increases the quicker the user is than the target. (Electro Ball)
  3920. ################################################################################
  3921. class PokeBattle_Move_099 < PokeBattle_Move
  3922. def pbBaseDamage(basedmg,attacker,opponent)
  3923. n=([attacker.pbSpeed,1].max/[opponent.pbSpeed,1].max).floor
  3924. ret=60
  3925. ret=80 if n>=2
  3926. ret=120 if n>=3
  3927. ret=150 if n>=4
  3928. return ret
  3929. end
  3930. end
  3931.  
  3932.  
  3933.  
  3934. ################################################################################
  3935. # Power increases the heavier the target is. (Grass Knot, Low Kick)
  3936. ################################################################################
  3937. class PokeBattle_Move_09A < PokeBattle_Move
  3938. def pbBaseDamage(basedmg,attacker,opponent)
  3939. weight=opponent.weight(attacker)
  3940. ret=20
  3941. ret=40 if weight>=100
  3942. ret=60 if weight>=250
  3943. ret=80 if weight>=500
  3944. ret=100 if weight>=1000
  3945. ret=120 if weight>=2000
  3946. return ret
  3947. end
  3948. end
  3949.  
  3950.  
  3951.  
  3952. ################################################################################
  3953. # Power increases the heavier the user is than the target. (Heat Crash, Heavy Slam)
  3954. ################################################################################
  3955. class PokeBattle_Move_09B < PokeBattle_Move
  3956. def pbBaseDamage(basedmg,attacker,opponent)
  3957. n=(attacker.weight/opponent.weight(attacker)).floor
  3958. ret=40
  3959. ret=60 if n>=2
  3960. ret=80 if n>=3
  3961. ret=100 if n>=4
  3962. ret=120 if n>=5
  3963. return ret
  3964. end
  3965. end
  3966.  
  3967.  
  3968.  
  3969. ################################################################################
  3970. # Powers up the ally's attack this round by 1.5. (Helping Hand)
  3971. ################################################################################
  3972. class PokeBattle_Move_09C < PokeBattle_Move
  3973. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3974. if !@battle.doublebattle || opponent.fainted? ||
  3975. @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3976. opponent.hasMovedThisRound? ||
  3977. opponent.effects[PBEffects::HelpingHand]
  3978. @battle.pbDisplay(_INTL("But it failed!"))
  3979. return -1
  3980. end
  3981. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3982. opponent.effects[PBEffects::HelpingHand]=true
  3983. @battle.pbDisplay(_INTL("{1} is ready to help {2}!",attacker.pbThis,opponent.pbThis(true)))
  3984. return 0
  3985. end
  3986. end
  3987.  
  3988.  
  3989.  
  3990. ################################################################################
  3991. # Weakens Electric attacks. (Mud Sport)
  3992. ################################################################################
  3993. class PokeBattle_Move_09D < PokeBattle_Move
  3994. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3995. if USENEWBATTLEMECHANICS
  3996. if @battle.field.effects[PBEffects::MudSportField]>0
  3997. @battle.pbDisplay(_INTL("But it failed!"))
  3998. return -1
  3999. end
  4000. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4001. @battle.field.effects[PBEffects::MudSportField]=5
  4002. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4003. return 0
  4004. else
  4005. for i in 0...4
  4006. if attacker.battle.battlers[i].effects[PBEffects::MudSport]
  4007. @battle.pbDisplay(_INTL("But it failed!"))
  4008. return -1
  4009. end
  4010. end
  4011. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4012. attacker.effects[PBEffects::MudSport]=true
  4013. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4014. return 0
  4015. end
  4016. return -1
  4017. end
  4018. end
  4019.  
  4020.  
  4021.  
  4022. ################################################################################
  4023. # Weakens Fire attacks. (Water Sport)
  4024. ################################################################################
  4025. class PokeBattle_Move_09E < PokeBattle_Move
  4026. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4027. if USENEWBATTLEMECHANICS
  4028. if @battle.field.effects[PBEffects::WaterSportField]>0
  4029. @battle.pbDisplay(_INTL("But it failed!"))
  4030. return -1
  4031. end
  4032. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4033. @battle.field.effects[PBEffects::WaterSportField]=5
  4034. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4035. return 0
  4036. else
  4037. for i in 0...4
  4038. if attacker.battle.battlers[i].effects[PBEffects::WaterSport]
  4039. @battle.pbDisplay(_INTL("But it failed!"))
  4040. return -1
  4041. end
  4042. end
  4043. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4044. attacker.effects[PBEffects::WaterSport]=true
  4045. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4046. return 0
  4047. end
  4048. end
  4049. end
  4050.  
  4051.  
  4052.  
  4053. ################################################################################
  4054. # Type depends on the user's held item. (Judgment, Techno Blast)
  4055. ################################################################################
  4056. class PokeBattle_Move_09F < PokeBattle_Move
  4057. def pbModifyType(type,attacker,opponent)
  4058. if isConst?(@id,PBMoves,:JUDGMENT)
  4059. return (getConst(PBTypes,:FIGHTING) || 0) if isConst?(attacker.item,PBItems,:FISTPLATE)
  4060. return (getConst(PBTypes,:FLYING) || 0) if isConst?(attacker.item,PBItems,:SKYPLATE)
  4061. return (getConst(PBTypes,:POISON) || 0) if isConst?(attacker.item,PBItems,:TOXICPLATE)
  4062. return (getConst(PBTypes,:GROUND) || 0) if isConst?(attacker.item,PBItems,:EARTHPLATE)
  4063. return (getConst(PBTypes,:ROCK) || 0) if isConst?(attacker.item,PBItems,:STONEPLATE)
  4064. return (getConst(PBTypes,:BUG) || 0) if isConst?(attacker.item,PBItems,:INSECTPLATE)
  4065. return (getConst(PBTypes,:GHOST) || 0) if isConst?(attacker.item,PBItems,:SPOOKYPLATE)
  4066. return (getConst(PBTypes,:STEEL) || 0) if isConst?(attacker.item,PBItems,:IRONPLATE)
  4067. return (getConst(PBTypes,:FIRE) || 0) if isConst?(attacker.item,PBItems,:FLAMEPLATE)
  4068. return (getConst(PBTypes,:WATER) || 0) if isConst?(attacker.item,PBItems,:SPLASHPLATE)
  4069. return (getConst(PBTypes,:GRASS) || 0) if isConst?(attacker.item,PBItems,:MEADOWPLATE)
  4070. return (getConst(PBTypes,:ELECTRIC) || 0) if isConst?(attacker.item,PBItems,:ZAPPLATE)
  4071. return (getConst(PBTypes,:PSYCHIC) || 0) if isConst?(attacker.item,PBItems,:MINDPLATE)
  4072. return (getConst(PBTypes,:ICE) || 0) if isConst?(attacker.item,PBItems,:ICICLEPLATE)
  4073. return (getConst(PBTypes,:DRAGON) || 0) if isConst?(attacker.item,PBItems,:DRACOPLATE)
  4074. return (getConst(PBTypes,:DARK) || 0) if isConst?(attacker.item,PBItems,:DREADPLATE)
  4075. return (getConst(PBTypes,:FAIRY) || 0) if isConst?(attacker.item,PBItems,:PIXIEPLATE)
  4076. elsif isConst?(@id,PBMoves,:TECHNOBLAST)
  4077. return getConst(PBTypes,:ELECTRIC) if isConst?(attacker.item,PBItems,:SHOCKDRIVE)
  4078. return getConst(PBTypes,:FIRE) if isConst?(attacker.item,PBItems,:BURNDRIVE)
  4079. return getConst(PBTypes,:ICE) if isConst?(attacker.item,PBItems,:CHILLDRIVE)
  4080. return getConst(PBTypes,:WATER) if isConst?(attacker.item,PBItems,:DOUSEDRIVE)
  4081. end
  4082. return (getConst(PBTypes,:NORMAL) || 0)
  4083. end
  4084.  
  4085. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4086. if isConst?(@id,PBMoves,:TECHNOBLAST)
  4087. anim = 0
  4088. anim = 1 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ELECTRIC)
  4089. anim = 2 if isConst?(pbType(@type,attacker,opponent),PBTypes,:FIRE)
  4090. anim = 3 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ICE)
  4091. anim = 4 if isConst?(pbType(@type,attacker,opponent),PBTypes,:WATER)
  4092. return super(id,attacker,opponent,anim,alltargets,showanimation) # Type-specific anim
  4093. end
  4094. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  4095. end
  4096. end
  4097.  
  4098.  
  4099.  
  4100. ################################################################################
  4101. # This attack is always a critical hit. (Frost Breath, Storm Throw)
  4102. ################################################################################
  4103. class PokeBattle_Move_0A0 < PokeBattle_Move
  4104. def pbCritialOverride(attacker,opponent)
  4105. return true
  4106. end
  4107. end
  4108.  
  4109.  
  4110.  
  4111. ################################################################################
  4112. # For 5 rounds, foes' attacks cannot become critical hits. (Lucky Chant)
  4113. ################################################################################
  4114. class PokeBattle_Move_0A1 < PokeBattle_Move
  4115. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4116. if attacker.pbOwnSide.effects[PBEffects::LuckyChant]>0
  4117. @battle.pbDisplay(_INTL("But it failed!"))
  4118. return -1
  4119. end
  4120. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4121. attacker.pbOwnSide.effects[PBEffects::LuckyChant]=5
  4122. if !@battle.pbIsOpposing?(attacker.index)
  4123. @battle.pbDisplay(_INTL("The Lucky Chant shielded your team from critical hits!"))
  4124. else
  4125. @battle.pbDisplay(_INTL("The Lucky Chant shielded the opposing team from critical hits!"))
  4126. end
  4127. return 0
  4128. end
  4129. end
  4130.  
  4131.  
  4132.  
  4133. ################################################################################
  4134. # For 5 rounds, lowers power of physical attacks against the user's side. (Reflect)
  4135. ################################################################################
  4136. class PokeBattle_Move_0A2 < PokeBattle_Move
  4137. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4138. if attacker.pbOwnSide.effects[PBEffects::Reflect]>0
  4139. @battle.pbDisplay(_INTL("But it failed!"))
  4140. return -1
  4141. end
  4142. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4143. attacker.pbOwnSide.effects[PBEffects::Reflect]=5
  4144. attacker.pbOwnSide.effects[PBEffects::Reflect]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4145. if !@battle.pbIsOpposing?(attacker.index)
  4146. @battle.pbDisplay(_INTL("Reflect raised your team's Defense!"))
  4147. else
  4148. @battle.pbDisplay(_INTL("Reflect raised the opposing team's Defense!"))
  4149. end
  4150. return 0
  4151. end
  4152. end
  4153.  
  4154.  
  4155.  
  4156. ################################################################################
  4157. # For 5 rounds, lowers power of special attacks against the user's side. (Light Screen)
  4158. ################################################################################
  4159. class PokeBattle_Move_0A3 < PokeBattle_Move
  4160. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4161. if attacker.pbOwnSide.effects[PBEffects::LightScreen]>0
  4162. @battle.pbDisplay(_INTL("But it failed!"))
  4163. return -1
  4164. end
  4165. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4166. attacker.pbOwnSide.effects[PBEffects::LightScreen]=5
  4167. attacker.pbOwnSide.effects[PBEffects::LightScreen]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4168. if !@battle.pbIsOpposing?(attacker.index)
  4169. @battle.pbDisplay(_INTL("Light Screen raised your team's Special Defense!"))
  4170. else
  4171. @battle.pbDisplay(_INTL("Light Screen raised the opposing team's Special Defense!"))
  4172. end
  4173. return 0
  4174. end
  4175. end
  4176.  
  4177.  
  4178.  
  4179. ################################################################################
  4180. # Effect depends on the environment. (Secret Power)
  4181. ################################################################################
  4182. class PokeBattle_Move_0A4 < PokeBattle_Move
  4183. def pbAdditionalEffect(attacker,opponent)
  4184. return if opponent.damagestate.substitute
  4185. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4186. if opponent.pbCanParalyze?(attacker,false,self)
  4187. opponent.pbParalyze(attacker)
  4188. end
  4189. return
  4190. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4191. if opponent.pbCanSleep?(attacker,false,self)
  4192. opponent.pbSleep
  4193. end
  4194. return
  4195. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4196. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  4197. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  4198. end
  4199. return
  4200. end
  4201. case @battle.environment
  4202. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4203. if opponent.pbCanSleep?(attacker,false,self)
  4204. opponent.pbSleep
  4205. end
  4206. when PBEnvironment::MovingWater, PBEnvironment::Underwater
  4207. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  4208. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  4209. end
  4210. when PBEnvironment::StillWater, PBEnvironment::Sky
  4211. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  4212. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  4213. end
  4214. when PBEnvironment::Sand
  4215. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4216. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4217. end
  4218. when PBEnvironment::Rock
  4219. if USENEWBATTLEMECHANICS
  4220. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4221. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4222. end
  4223. else
  4224. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4225. opponent.pbFlinch(attacker)
  4226. end
  4227. end
  4228. when PBEnvironment::Cave, PBEnvironment::Graveyard, PBEnvironment::Space
  4229. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4230. opponent.pbFlinch(attacker)
  4231. end
  4232. when PBEnvironment::Snow
  4233. if opponent.pbCanFreeze?(attacker,false,self)
  4234. opponent.pbFreeze
  4235. end
  4236. when PBEnvironment::Volcano
  4237. if opponent.pbCanBurn?(attacker,false,self)
  4238. opponent.pbBurn(attacker)
  4239. end
  4240. else
  4241. if opponent.pbCanParalyze?(attacker,false,self)
  4242. opponent.pbParalyze(attacker)
  4243. end
  4244. end
  4245. end
  4246.  
  4247. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4248. id=getConst(PBMoves,:BODYSLAM)
  4249. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4250. id=getConst(PBMoves,:THUNDERSHOCK) || id
  4251. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4252. id=getConst(PBMoves,:VINEWHIP) || id
  4253. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4254. id=getConst(PBMoves,:FAIRYWIND) || id
  4255. else
  4256. case @battle.environment
  4257. when PBEnvironment::Grass, PBEnvironment::TallGrass
  4258. id=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)) || id
  4259. when PBEnvironment::MovingWater; id=getConst(PBMoves,:WATERPULSE) || id
  4260. when PBEnvironment::StillWater; id=getConst(PBMoves,:MUDSHOT) || id
  4261. when PBEnvironment::Underwater; id=getConst(PBMoves,:WATERPULSE) || id
  4262. when PBEnvironment::Cave; id=getConst(PBMoves,:ROCKTHROW) || id
  4263. when PBEnvironment::Rock; id=getConst(PBMoves,:MUDSLAP) || id
  4264. when PBEnvironment::Sand; id=getConst(PBMoves,:MUDSLAP) || id
  4265. when PBEnvironment::Forest; id=getConst(PBMoves,:RAZORLEAF) || id
  4266. # Ice tiles in Gen 6 should be Ice Shard
  4267. when PBEnvironment::Snow; id=getConst(PBMoves,:AVALANCHE) || id
  4268. when PBEnvironment::Volcano; id=getConst(PBMoves,:INCINERATE) || id
  4269. when PBEnvironment::Graveyard; id=getConst(PBMoves,:SHADOWSNEAK) || id
  4270. when PBEnvironment::Sky; id=getConst(PBMoves,:GUST) || id
  4271. when PBEnvironment::Space; id=getConst(PBMoves,:SWIFT) || id
  4272. end
  4273. end
  4274. return super(id,attacker,opponent,hitnum,alltargets,showanimation) # Environment-specific anim
  4275. end
  4276. end
  4277.  
  4278.  
  4279.  
  4280. ################################################################################
  4281. # Always hits.
  4282. ################################################################################
  4283. class PokeBattle_Move_0A5 < PokeBattle_Move
  4284. def pbAccuracyCheck(attacker,opponent)
  4285. return true
  4286. end
  4287. end
  4288.  
  4289.  
  4290.  
  4291. ################################################################################
  4292. # User's attack next round against the target will definitely hit. (Lock-On, Mind Reader)
  4293. ################################################################################
  4294. class PokeBattle_Move_0A6 < PokeBattle_Move
  4295. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4296. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  4297. @battle.pbDisplay(_INTL("But it failed!"))
  4298. return -1
  4299. end
  4300. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4301. opponent.effects[PBEffects::LockOn]=2
  4302. opponent.effects[PBEffects::LockOnPos]=attacker.index
  4303. @battle.pbDisplay(_INTL("{1} took aim at {2}!",attacker.pbThis,opponent.pbThis(true)))
  4304. return 0
  4305. end
  4306. end
  4307.  
  4308.  
  4309.  
  4310. ################################################################################
  4311. # Target's evasion stat changes are ignored from now on. (Foresight, Odor Sleuth)
  4312. # Normal and Fighting moves have normal effectiveness against the Ghost-type target.
  4313. ################################################################################
  4314. class PokeBattle_Move_0A7 < PokeBattle_Move
  4315. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4316. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4317. @battle.pbDisplay(_INTL("But it failed!"))
  4318. return -1
  4319. end
  4320. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4321. opponent.effects[PBEffects::Foresight]=true
  4322. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4323. return 0
  4324. end
  4325. end
  4326.  
  4327.  
  4328.  
  4329. ################################################################################
  4330. # Target's evasion stat changes are ignored from now on. (Miracle Eye)
  4331. # Psychic moves have normal effectiveness against the Dark-type target.
  4332. ################################################################################
  4333. class PokeBattle_Move_0A8 < PokeBattle_Move
  4334. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4335. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4336. @battle.pbDisplay(_INTL("But it failed!"))
  4337. return -1
  4338. end
  4339. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4340. opponent.effects[PBEffects::MiracleEye]=true
  4341. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4342. return 0
  4343. end
  4344. end
  4345.  
  4346.  
  4347.  
  4348. ################################################################################
  4349. # This move ignores target's Defense, Special Defense and evasion stat changes.
  4350. # (Chip Away, Sacred Sword)
  4351. ################################################################################
  4352. class PokeBattle_Move_0A9 < PokeBattle_Move
  4353. # Handled in superclass def pbAccuracyCheck and def pbCalcDamage, do not edit!
  4354. end
  4355.  
  4356.  
  4357.  
  4358. ################################################################################
  4359. # User is protected against moves with the "B" flag this round. (Detect, Protect)
  4360. ################################################################################
  4361. class PokeBattle_Move_0AA < PokeBattle_Move
  4362. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4363. ratesharers=[
  4364. 0xAA, # Detect, Protect
  4365. 0xAB, # Quick Guard
  4366. 0xAC, # Wide Guard
  4367. 0xE8, # Endure
  4368. 0x14B, # King's Shield
  4369. 0x14C # Spiky Shield
  4370. ]
  4371. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4372. attacker.effects[PBEffects::ProtectRate]=1
  4373. end
  4374. unmoved=false
  4375. for poke in @battle.battlers
  4376. next if poke.index==attacker.index
  4377. if @battle.choices[poke.index][0]==1 && # Chose a move
  4378. !poke.hasMovedThisRound?
  4379. unmoved=true; break
  4380. end
  4381. end
  4382. if !unmoved ||
  4383. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  4384. attacker.effects[PBEffects::ProtectRate]=1
  4385. @battle.pbDisplay(_INTL("But it failed!"))
  4386. return -1
  4387. end
  4388. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4389. attacker.effects[PBEffects::Protect]=true
  4390. attacker.effects[PBEffects::ProtectRate]*=2
  4391. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  4392. return 0
  4393. end
  4394. end
  4395.  
  4396.  
  4397.  
  4398. ################################################################################
  4399. # User's side is protected against moves with priority greater than 0 this round.
  4400. # (Quick Guard)
  4401. ################################################################################
  4402. class PokeBattle_Move_0AB < PokeBattle_Move
  4403. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4404. if attacker.pbOwnSide.effects[PBEffects::QuickGuard]
  4405. @battle.pbDisplay(_INTL("But it failed!"))
  4406. return -1
  4407. end
  4408. ratesharers=[
  4409. 0xAA, # Detect, Protect
  4410. 0xAB, # Quick Guard
  4411. 0xAC, # Wide Guard
  4412. 0xE8, # Endure
  4413. 0x14B, # King's Shield
  4414. 0x14C # Spiky Shield
  4415. ]
  4416. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4417. attacker.effects[PBEffects::ProtectRate]=1
  4418. end
  4419. unmoved=false
  4420. for poke in @battle.battlers
  4421. next if poke.index==attacker.index
  4422. if @battle.choices[poke.index][0]==1 && # Chose a move
  4423. !poke.hasMovedThisRound?
  4424. unmoved=true; break
  4425. end
  4426. end
  4427. if !unmoved ||
  4428. (!USENEWBATTLEMECHANICS &&
  4429. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4430. attacker.effects[PBEffects::ProtectRate]=1
  4431. @battle.pbDisplay(_INTL("But it failed!"))
  4432. return -1
  4433. end
  4434. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4435. attacker.pbOwnSide.effects[PBEffects::QuickGuard]=true
  4436. attacker.effects[PBEffects::ProtectRate]*=2
  4437. if !@battle.pbIsOpposing?(attacker.index)
  4438. @battle.pbDisplay(_INTL("Quick Guard protected your team!"))
  4439. else
  4440. @battle.pbDisplay(_INTL("Quick Guard protected the opposing team!"))
  4441. end
  4442. return 0
  4443. end
  4444. end
  4445.  
  4446.  
  4447.  
  4448. ################################################################################
  4449. # User's side is protected against moves that target multiple battlers this round.
  4450. # (Wide Guard)
  4451. ################################################################################
  4452. class PokeBattle_Move_0AC < PokeBattle_Move
  4453. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4454. if attacker.pbOwnSide.effects[PBEffects::WideGuard]
  4455. @battle.pbDisplay(_INTL("But it failed!"))
  4456. return -1
  4457. end
  4458. ratesharers=[
  4459. 0xAA, # Detect, Protect
  4460. 0xAB, # Quick Guard
  4461. 0xAC, # Wide Guard
  4462. 0xE8, # Endure
  4463. 0x14B, # King's Shield
  4464. 0x14C # Spiky Shield
  4465. ]
  4466. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4467. attacker.effects[PBEffects::ProtectRate]=1
  4468. end
  4469. unmoved=false
  4470. for poke in @battle.battlers
  4471. next if poke.index==attacker.index
  4472. if @battle.choices[poke.index][0]==1 && # Chose a move
  4473. !poke.hasMovedThisRound?
  4474. unmoved=true; break
  4475. end
  4476. end
  4477. if !unmoved ||
  4478. (!USENEWBATTLEMECHANICS &&
  4479. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4480. attacker.effects[PBEffects::ProtectRate]=1
  4481. @battle.pbDisplay(_INTL("But it failed!"))
  4482. return -1
  4483. end
  4484. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4485. attacker.pbOwnSide.effects[PBEffects::WideGuard]=true
  4486. attacker.effects[PBEffects::ProtectRate]*=2
  4487. if !@battle.pbIsOpposing?(attacker.index)
  4488. @battle.pbDisplay(_INTL("Wide Guard protected your team!"))
  4489. else
  4490. @battle.pbDisplay(_INTL("Wide Guard protected the opposing team!"))
  4491. end
  4492. return 0
  4493. end
  4494. end
  4495.  
  4496.  
  4497.  
  4498. ################################################################################
  4499. # Ignores target's protections. If successful, all other moves this round
  4500. # ignore them too. (Feint)
  4501. ################################################################################
  4502. class PokeBattle_Move_0AD < PokeBattle_Move
  4503. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4504. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4505. if ret>0
  4506. opponent.effects[PBEffects::ProtectNegation]=true
  4507. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  4508. end
  4509. return ret
  4510. end
  4511. end
  4512.  
  4513.  
  4514.  
  4515. ################################################################################
  4516. # Uses the last move that the target used. (Mirror Move)
  4517. ################################################################################
  4518. class PokeBattle_Move_0AE < PokeBattle_Move
  4519. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4520. if opponent.lastMoveUsed<=0 ||
  4521. (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
  4522. @battle.pbDisplay(_INTL("The mirror move failed!"))
  4523. return -1
  4524. end
  4525. attacker.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
  4526. return 0
  4527. end
  4528. end
  4529.  
  4530.  
  4531.  
  4532. ################################################################################
  4533. # Uses the last move that was used. (Copycat)
  4534. ################################################################################
  4535. class PokeBattle_Move_0AF < PokeBattle_Move
  4536. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4537. blacklist=[
  4538. 0x02, # Struggle
  4539. 0x69, # Transform
  4540. 0x71, # Counter
  4541. 0x72, # Mirror Coat
  4542. 0x73, # Metal Burst
  4543. 0x9C, # Helping Hand
  4544. 0xAA, # Detect, Protect
  4545. 0xAD, # Feint
  4546. 0xAE, # Mirror Move
  4547. 0xAF, # Copycat
  4548. 0xB2, # Snatch
  4549. 0xE7, # Destiny Bond
  4550. 0xE8, # Endure
  4551. 0xEC, # Circle Throw, Dragon Tail
  4552. 0xF1, # Covet, Thief
  4553. 0xF2, # Switcheroo, Trick
  4554. 0xF3, # Bestow
  4555. 0x115, # Focus Punch
  4556. 0x117, # Follow Me, Rage Powder
  4557. 0x158 # Belch
  4558. ]
  4559. if USENEWBATTLEMECHANICS
  4560. blacklist+=[
  4561. 0xEB, # Roar, Whirlwind
  4562. # Two-turn attacks
  4563. 0xC3, # Razor Wind
  4564. 0xC4, # SolarBeam
  4565. 0xC5, # Freeze Shock
  4566. 0xC6, # Ice Burn
  4567. 0xC7, # Sky Attack
  4568. 0xC8, # Skull Bash
  4569. 0xC9, # Fly
  4570. 0xCA, # Dig
  4571. 0xCB, # Dive
  4572. 0xCC, # Bounce
  4573. 0xCD, # Shadow Force
  4574. 0xCE, # Sky Drop
  4575. 0x14D, # Phantom Force
  4576. 0x14E # Geomancy
  4577. ]
  4578. end
  4579. if @battle.lastMoveUsed<=0 ||
  4580. blacklist.include?(PBMoveData.new(@battle.lastMoveUsed).function)
  4581. @battle.pbDisplay(_INTL("But it failed!"))
  4582. return -1
  4583. end
  4584. attacker.pbUseMoveSimple(@battle.lastMoveUsed)
  4585. return 0
  4586. end
  4587. end
  4588.  
  4589.  
  4590.  
  4591. ################################################################################
  4592. # Uses the move the target was about to use this round, with 1.5x power. (Me First)
  4593. ################################################################################
  4594. class PokeBattle_Move_0B0 < PokeBattle_Move
  4595. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4596. blacklist=[
  4597. 0x02, # Struggle
  4598. 0x14, # Chatter
  4599. 0x71, # Counter
  4600. 0x72, # Mirror Coat
  4601. 0x73, # Metal Burst
  4602. 0xB0, # Me First
  4603. 0xF1, # Covet, Thief
  4604. 0x115, # Focus Punch
  4605. 0x158 # Belch
  4606. ]
  4607. oppmove=@battle.choices[opponent.index][2]
  4608. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  4609. opponent.hasMovedThisRound? ||
  4610. !oppmove || oppmove.id<=0 ||
  4611. oppmove.pbIsStatus? ||
  4612. blacklist.include?(oppmove.function)
  4613. @battle.pbDisplay(_INTL("But it failed!"))
  4614. return -1
  4615. end
  4616. attacker.effects[PBEffects::MeFirst]=true
  4617. attacker.pbUseMoveSimple(oppmove.id)
  4618. attacker.effects[PBEffects::MeFirst]=false
  4619. return 0
  4620. end
  4621. end
  4622.  
  4623.  
  4624.  
  4625. ################################################################################
  4626. # This round, reflects all moves with the "C" flag targeting the user back at
  4627. # their origin. (Magic Coat)
  4628. ################################################################################
  4629. class PokeBattle_Move_0B1 < PokeBattle_Move
  4630. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4631. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4632. attacker.effects[PBEffects::MagicCoat]=true
  4633. @battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",attacker.pbThis))
  4634. return 0
  4635. end
  4636. end
  4637.  
  4638.  
  4639.  
  4640. ################################################################################
  4641. # This round, snatches all used moves with the "D" flag. (Snatch)
  4642. ################################################################################
  4643. class PokeBattle_Move_0B2 < PokeBattle_Move
  4644. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4645. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4646. attacker.effects[PBEffects::Snatch]=true
  4647. @battle.pbDisplay(_INTL("{1} waits for a target to make a move!",attacker.pbThis))
  4648. return 0
  4649. end
  4650. end
  4651.  
  4652.  
  4653.  
  4654. ################################################################################
  4655. # Uses a different move depending on the environment. (Nature Power)
  4656. ################################################################################
  4657. class PokeBattle_Move_0B3 < PokeBattle_Move
  4658. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4659. move=getConst(PBMoves,:TRIATTACK) || 0
  4660. case @battle.environment
  4661. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4662. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:ENERGYBALL) : getConst(PBMoves,:SEEDBOMB)) || move
  4663. when PBEnvironment::MovingWater; move=getConst(PBMoves,:HYDROPUMP) || move
  4664. when PBEnvironment::StillWater; move=getConst(PBMoves,:MUDBOMB) || move
  4665. when PBEnvironment::Underwater; move=getConst(PBMoves,:HYDROPUMP) || move
  4666. when PBEnvironment::Cave
  4667. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:POWERGEM) : getConst(PBMoves,:ROCKSLIDE)) || move
  4668. when PBEnvironment::Rock
  4669. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:ROCKSLIDE)) || move
  4670. when PBEnvironment::Sand
  4671. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:EARTHQUAKE)) || move
  4672. # Ice tiles in Gen 6 should be Ice Beam
  4673. when PBEnvironment::Snow
  4674. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:FROSTBREATH) : getConst(PBMoves,:ICEBEAM)) || move
  4675. when PBEnvironment::Volcano; move=getConst(PBMoves,:LAVAPLUME) || move
  4676. when PBEnvironment::Graveyard; move=getConst(PBMoves,:SHADOWBALL) || move
  4677. when PBEnvironment::Sky; move=getConst(PBMoves,:AIRSLASH) || move
  4678. when PBEnvironment::Space; move=getConst(PBMoves,:DRACOMETEOR) || move
  4679. end
  4680. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4681. move=getConst(PBMoves,:THUNDERBOLT) || move
  4682. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4683. move=getConst(PBMoves,:ENERGYBALL) || move
  4684. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4685. move=getConst(PBMoves,:MOONBLAST) || move
  4686. end
  4687. if move==0
  4688. @battle.pbDisplay(_INTL("But it failed!"))
  4689. return -1
  4690. end
  4691. thismovename=PBMoves.getName(@id)
  4692. movename=PBMoves.getName(move)
  4693. @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
  4694. target=(USENEWBATTLEMECHANICS && opponent) ? opponent.index : -1
  4695. attacker.pbUseMoveSimple(move,-1,target)
  4696. return 0
  4697. end
  4698. end
  4699.  
  4700.  
  4701.  
  4702. ################################################################################
  4703. # Uses a random move the user knows. Fails if user is not asleep. (Sleep Talk)
  4704. ################################################################################
  4705. class PokeBattle_Move_0B4 < PokeBattle_Move
  4706. def pbCanUseWhileAsleep?
  4707. return true
  4708. end
  4709.  
  4710. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4711. if attacker.status!=PBStatuses::SLEEP
  4712. @battle.pbDisplay(_INTL("But it failed!"))
  4713. return -1
  4714. end
  4715. blacklist=[
  4716. 0x02, # Struggle
  4717. 0x14, # Chatter
  4718. 0x5C, # Mimic
  4719. 0x5D, # Sketch
  4720. 0xAE, # Mirror Move
  4721. 0xAF, # Copycat
  4722. 0xB0, # Me First
  4723. 0xB3, # Nature Power
  4724. 0xB4, # Sleep Talk
  4725. 0xB5, # Assist
  4726. 0xB6, # Metronome
  4727. 0xD1, # Uproar
  4728. 0xD4, # Bide
  4729. 0x115, # Focus Punch
  4730. # Two-turn attacks
  4731. 0xC3, # Razor Wind
  4732. 0xC4, # SolarBeam
  4733. 0xC5, # Freeze Shock
  4734. 0xC6, # Ice Burn
  4735. 0xC7, # Sky Attack
  4736. 0xC8, # Skull Bash
  4737. 0xC9, # Fly
  4738. 0xCA, # Dig
  4739. 0xCB, # Dive
  4740. 0xCC, # Bounce
  4741. 0xCD, # Shadow Force
  4742. 0xCE, # Sky Drop
  4743. 0x14D, # Phantom Force
  4744. 0x14E, # Geomancy
  4745. ]
  4746. choices=[]
  4747. for i in 0...4
  4748. found=false
  4749. next if attacker.moves[i].id==0
  4750. found=true if blacklist.include?(attacker.moves[i].function)
  4751. next if found
  4752. choices.push(i) if @battle.pbCanChooseMove?(attacker.index,i,false,true)
  4753. end
  4754. if choices.length==0
  4755. @battle.pbDisplay(_INTL("But it failed!"))
  4756. return -1
  4757. end
  4758. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4759. choice=choices[@battle.pbRandom(choices.length)]
  4760. attacker.pbUseMoveSimple(attacker.moves[choice].id,-1,attacker.pbOppositeOpposing.index)
  4761. return 0
  4762. end
  4763. end
  4764.  
  4765.  
  4766.  
  4767. ################################################################################
  4768. # Uses a random move known by any non-user Pokémon in the user's party. (Assist)
  4769. ################################################################################
  4770. class PokeBattle_Move_0B5 < PokeBattle_Move
  4771. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4772. blacklist=[
  4773. 0x02, # Struggle
  4774. 0x14, # Chatter
  4775. 0x5C, # Mimic
  4776. 0x5D, # Sketch
  4777. 0x69, # Transform
  4778. 0x71, # Counter
  4779. 0x72, # Mirror Coat
  4780. 0x73, # Metal Burst
  4781. 0x9C, # Helping Hand
  4782. 0xAA, # Detect, Protect
  4783. 0xAD, # Feint
  4784. 0xAE, # Mirror Move
  4785. 0xAF, # Copycat
  4786. 0xB0, # Me First
  4787. 0xB2, # Snatch
  4788. 0xB3, # Nature Power
  4789. 0xB4, # Sleep Talk
  4790. 0xB5, # Assist
  4791. 0xB6, # Metronome
  4792. 0xCD, # Shadow Force
  4793. 0xE7, # Destiny Bond
  4794. 0xE8, # Endure
  4795. 0xEB, # Roar, Whirlwind
  4796. 0xEC, # Circle Throw, Dragon Tail
  4797. 0xF1, # Covet, Thief
  4798. 0xF2, # Switcheroo, Trick
  4799. 0xF3, # Bestow
  4800. 0x115, # Focus Punch
  4801. 0x117, # Follow Me, Rage Powder
  4802. 0x149, # Mat Block
  4803. 0x14B, # King's Shield
  4804. 0x14C, # Spiky Shield
  4805. 0x14D, # Phantom Force
  4806. 0x158 # Belch
  4807. ]
  4808. if USENEWBATTLEMECHANICS
  4809. blacklist+=[
  4810. # Two-turn attacks
  4811. 0xC3, # Razor Wind
  4812. 0xC4, # SolarBeam
  4813. 0xC5, # Freeze Shock
  4814. 0xC6, # Ice Burn
  4815. 0xC7, # Sky Attack
  4816. 0xC8, # Skull Bash
  4817. 0xC9, # Fly
  4818. 0xCA, # Dig
  4819. 0xCB, # Dive
  4820. 0xCC, # Bounce
  4821. 0xCD, # Shadow Force
  4822. 0xCE, # Sky Drop
  4823. 0x14D, # Phantom Force
  4824. 0x14E # Geomancy
  4825. ]
  4826. end
  4827. moves=[]
  4828. party=@battle.pbParty(attacker.index) # NOTE: pbParty is common to both allies in multi battles
  4829. for i in 0...party.length
  4830. if i!=attacker.pokemonIndex && party[i] && !(USENEWBATTLEMECHANICS && party[i].egg?)
  4831. for j in party[i].moves
  4832. next if isConst?(j.type,PBTypes,:SHADOW)
  4833. next if j.id==0
  4834. found=false
  4835. moves.push(j.id) if !blacklist.include?(PBMoveData.new(j.id).function)
  4836. end
  4837. end
  4838. end
  4839. if moves.length==0
  4840. @battle.pbDisplay(_INTL("But it failed!"))
  4841. return -1
  4842. end
  4843. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4844. move=moves[@battle.pbRandom(moves.length)]
  4845. attacker.pbUseMoveSimple(move)
  4846. return 0
  4847. end
  4848. end
  4849.  
  4850.  
  4851.  
  4852. ################################################################################
  4853. # Uses a random move that exists. (Metronome)
  4854. ################################################################################
  4855. class PokeBattle_Move_0B6 < PokeBattle_Move
  4856. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4857. blacklist=[
  4858. 0x02, # Struggle
  4859. 0x11, # Snore
  4860. 0x14, # Chatter
  4861. 0x5C, # Mimic
  4862. 0x5D, # Sketch
  4863. 0x69, # Transform
  4864. 0x71, # Counter
  4865. 0x72, # Mirror Coat
  4866. 0x73, # Metal Burst
  4867. 0x9C, # Helping Hand
  4868. 0xAA, # Detect, Protect
  4869. 0xAB, # Quick Guard
  4870. 0xAC, # Wide Guard
  4871. 0xAD, # Feint
  4872. 0xAE, # Mirror Move
  4873. 0xAF, # Copycat
  4874. 0xB0, # Me First
  4875. 0xB2, # Snatch
  4876. 0xB3, # Nature Power
  4877. 0xB4, # Sleep Talk
  4878. 0xB5, # Assist
  4879. 0xB6, # Metronome
  4880. 0xE7, # Destiny Bond
  4881. 0xE8, # Endure
  4882. 0xF1, # Covet, Thief
  4883. 0xF2, # Switcheroo, Trick
  4884. 0xF3, # Bestow
  4885. 0x115, # Focus Punch
  4886. 0x117, # Follow Me, Rage Powder
  4887. 0x11D, # After You
  4888. 0x11E # Quash
  4889. ]
  4890. blacklistmoves=[
  4891. :FREEZESHOCK,
  4892. :ICEBURN,
  4893. :RELICSONG,
  4894. :SECRETSWORD,
  4895. :SNARL,
  4896. :TECHNOBLAST,
  4897. :VCREATE,
  4898. :GEOMANCY
  4899. ]
  4900. i=0; loop do break unless i<1000
  4901. move=@battle.pbRandom(PBMoves.maxValue)+1
  4902. next if isConst?(PBMoveData.new(move).type,PBTypes,:SHADOW)
  4903. found=false
  4904. if blacklist.include?(PBMoveData.new(move).function)
  4905. found=true
  4906. else
  4907. for j in blacklistmoves
  4908. if isConst?(move,PBMoves,j)
  4909. found=true
  4910. break
  4911. end
  4912. end
  4913. end
  4914. if !found
  4915. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4916. attacker.pbUseMoveSimple(move)
  4917. return 0
  4918. end
  4919. i+=1
  4920. end
  4921. @battle.pbDisplay(_INTL("But it failed!"))
  4922. return -1
  4923. end
  4924. end
  4925.  
  4926.  
  4927.  
  4928. ################################################################################
  4929. # The target can no longer use the same move twice in a row. (Torment)
  4930. ################################################################################
  4931. class PokeBattle_Move_0B7 < PokeBattle_Move
  4932. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4933. if opponent.effects[PBEffects::Torment]
  4934. @battle.pbDisplay(_INTL("But it failed!"))
  4935. return -1
  4936. end
  4937. if !attacker.hasMoldBreaker
  4938. if opponent.hasWorkingAbility(:AROMAVEIL)
  4939. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4940. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4941. return -1
  4942. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  4943. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4944. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  4945. return -1
  4946. end
  4947. end
  4948. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4949. opponent.effects[PBEffects::Torment]=true
  4950. @battle.pbDisplay(_INTL("{1} was subjected to torment!",opponent.pbThis))
  4951. return 0
  4952. end
  4953. end
  4954.  
  4955.  
  4956.  
  4957. ################################################################################
  4958. # Disables all target's moves that the user also knows. (Imprison)
  4959. ################################################################################
  4960. class PokeBattle_Move_0B8 < PokeBattle_Move
  4961. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4962. if attacker.effects[PBEffects::Imprison]
  4963. @battle.pbDisplay(_INTL("But it failed!"))
  4964. return -1
  4965. end
  4966. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4967. attacker.effects[PBEffects::Imprison]=true
  4968. @battle.pbDisplay(_INTL("{1} sealed the opponent's move(s)!",attacker.pbThis))
  4969. return 0
  4970. end
  4971. end
  4972.  
  4973.  
  4974.  
  4975. ################################################################################
  4976. # For 5 rounds, disables the last move the target used. (Disable)
  4977. ################################################################################
  4978. class PokeBattle_Move_0B9 < PokeBattle_Move
  4979. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4980. if opponent.effects[PBEffects::Disable]>0
  4981. @battle.pbDisplay(_INTL("But it failed!"))
  4982. return -1
  4983. end
  4984. if !attacker.hasMoldBreaker
  4985. if opponent.hasWorkingAbility(:AROMAVEIL)
  4986. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4987. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4988. return -1
  4989. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  4990. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4991. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  4992. return -1
  4993. end
  4994. end
  4995. for i in opponent.moves
  4996. if i.id>0 && i.id==opponent.lastMoveUsed && (i.pp>0 || i.totalpp==0)
  4997. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4998. opponent.effects[PBEffects::Disable]=5
  4999. opponent.effects[PBEffects::DisableMove]=opponent.lastMoveUsed
  5000. @battle.pbDisplay(_INTL("{1}'s {2} was disabled!",opponent.pbThis,i.name))
  5001. return 0
  5002. end
  5003. end
  5004. @battle.pbDisplay(_INTL("But it failed!"))
  5005. return -1
  5006. end
  5007. end
  5008.  
  5009.  
  5010.  
  5011. ################################################################################
  5012. # For 4 rounds, disables the target's non-damaging moves. (Taunt)
  5013. ################################################################################
  5014. class PokeBattle_Move_0BA < PokeBattle_Move
  5015. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5016. if opponent.effects[PBEffects::Taunt]>0 ||
  5017. (USENEWBATTLEMECHANICS &&
  5018. !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS))
  5019. @battle.pbDisplay(_INTL("But it failed!"))
  5020. return -1
  5021. end
  5022. if !attacker.hasMoldBreaker
  5023. if opponent.hasWorkingAbility(:AROMAVEIL)
  5024. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5025. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5026. return -1
  5027. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5028. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5029. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5030. return -1
  5031. end
  5032. end
  5033. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5034. opponent.effects[PBEffects::Taunt]=4
  5035. @battle.pbDisplay(_INTL("{1} fell for the taunt!",opponent.pbThis))
  5036. return 0
  5037. end
  5038. end
  5039.  
  5040.  
  5041.  
  5042. ################################################################################
  5043. # For 5 rounds, disables the target's healing moves. (Heal Block)
  5044. ################################################################################
  5045. class PokeBattle_Move_0BB < PokeBattle_Move
  5046. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5047. if opponent.effects[PBEffects::HealBlock]>0
  5048. @battle.pbDisplay(_INTL("But it failed!"))
  5049. return -1
  5050. end
  5051. if !attacker.hasMoldBreaker
  5052. if opponent.hasWorkingAbility(:AROMAVEIL)
  5053. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5054. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5055. return -1
  5056. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5057. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5058. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5059. return -1
  5060. end
  5061. end
  5062. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5063. opponent.effects[PBEffects::HealBlock]=5
  5064. @battle.pbDisplay(_INTL("{1} was prevented from healing!",opponent.pbThis))
  5065. return 0
  5066. end
  5067. end
  5068.  
  5069.  
  5070.  
  5071. ################################################################################
  5072. # For 4 rounds, the target must use the same move each round. (Encore)
  5073. ################################################################################
  5074. class PokeBattle_Move_0BC < PokeBattle_Move
  5075. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5076. blacklist=[
  5077. 0x02, # Struggle
  5078. 0x5C, # Mimic
  5079. 0x5D, # Sketch
  5080. 0x69, # Transform
  5081. 0xAE, # Mirror Move
  5082. 0xBC # Encore
  5083. ]
  5084. if opponent.effects[PBEffects::Encore]>0
  5085. @battle.pbDisplay(_INTL("But it failed!"))
  5086. return -1
  5087. end
  5088. if opponent.lastMoveUsed<=0 ||
  5089. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  5090. @battle.pbDisplay(_INTL("But it failed!"))
  5091. return -1
  5092. end
  5093. if !attacker.hasMoldBreaker
  5094. if opponent.hasWorkingAbility(:AROMAVEIL)
  5095. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5096. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5097. return -1
  5098. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5099. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5100. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5101. return -1
  5102. end
  5103. end
  5104. for i in 0...4
  5105. if opponent.lastMoveUsed==opponent.moves[i].id &&
  5106. (opponent.moves[i].pp>0 || opponent.moves[i].totalpp==0)
  5107. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5108. opponent.effects[PBEffects::Encore]=4
  5109. opponent.effects[PBEffects::EncoreIndex]=i
  5110. opponent.effects[PBEffects::EncoreMove]=opponent.moves[i].id
  5111. @battle.pbDisplay(_INTL("{1} received an encore!",opponent.pbThis))
  5112. return 0
  5113. end
  5114. end
  5115. @battle.pbDisplay(_INTL("But it failed!"))
  5116. return -1
  5117. end
  5118. end
  5119.  
  5120.  
  5121.  
  5122. ################################################################################
  5123. # Hits twice.
  5124. ################################################################################
  5125. class PokeBattle_Move_0BD < PokeBattle_Move
  5126. def pbIsMultiHit
  5127. return true
  5128. end
  5129.  
  5130. def pbNumHits(attacker)
  5131. return 2
  5132. end
  5133. end
  5134.  
  5135.  
  5136.  
  5137. ################################################################################
  5138. # Hits twice. May poison the target on each hit. (Twineedle)
  5139. ################################################################################
  5140. class PokeBattle_Move_0BE < PokeBattle_Move
  5141. def pbIsMultiHit
  5142. return true
  5143. end
  5144.  
  5145. def pbNumHits(attacker)
  5146. return 2
  5147. end
  5148.  
  5149. def pbAdditionalEffect(attacker,opponent)
  5150. return if opponent.damagestate.substitute
  5151. if opponent.pbCanPoison?(attacker,false,self)
  5152. opponent.pbPoison(attacker)
  5153. end
  5154. end
  5155. end
  5156.  
  5157.  
  5158.  
  5159. ################################################################################
  5160. # Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
  5161. # An accuracy check is performed for each hit.
  5162. ################################################################################
  5163. class PokeBattle_Move_0BF < PokeBattle_Move
  5164. def pbIsMultiHit
  5165. return true
  5166. end
  5167.  
  5168. def pbNumHits(attacker)
  5169. return 3
  5170. end
  5171.  
  5172. def successCheckPerHit?
  5173. return @checks
  5174. end
  5175.  
  5176. def pbOnStartUse(attacker)
  5177. @calcbasedmg=@basedamage
  5178. @checks=!attacker.hasWorkingAbility(:SKILLLINK)
  5179. return true
  5180. end
  5181.  
  5182. def pbBaseDamage(basedmg,attacker,opponent)
  5183. ret=@calcbasedmg
  5184. @calcbasedmg+=basedmg
  5185. return ret
  5186. end
  5187. end
  5188.  
  5189.  
  5190.  
  5191. ################################################################################
  5192. # Hits 2-5 times.
  5193. ################################################################################
  5194. class PokeBattle_Move_0C0 < PokeBattle_Move
  5195. def pbIsMultiHit
  5196. return true
  5197. end
  5198.  
  5199. def pbNumHits(attacker)
  5200. hitchances=[2,2,3,3,4,5]
  5201. ret=hitchances[@battle.pbRandom(hitchances.length)]
  5202. ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  5203. return ret
  5204. end
  5205. end
  5206.  
  5207.  
  5208.  
  5209. ################################################################################
  5210. # Hits X times, where X is 1 (the user) plus the number of non-user unfainted
  5211. # status-free Pokémon in the user's party (the participants). Fails if X is 0.
  5212. # Base power of each hit depends on the base Attack stat for the species of that
  5213. # hit's participant. (Beat Up)
  5214. ################################################################################
  5215. class PokeBattle_Move_0C1 < PokeBattle_Move
  5216. def pbIsMultiHit
  5217. return true
  5218. end
  5219.  
  5220. def pbNumHits(attacker)
  5221. return @participants.length
  5222. end
  5223.  
  5224. def pbOnStartUse(attacker)
  5225. party=@battle.pbParty(attacker.index)
  5226. @participants=[]
  5227. for i in 0...party.length
  5228. if attacker.pokemonIndex==i
  5229. @participants.push(i)
  5230. elsif party[i] && !party[i].egg? && party[i].hp>0 && party[i].status==0
  5231. @participants.push(i)
  5232. end
  5233. end
  5234. if @participants.length==0
  5235. @battle.pbDisplay(_INTL("But it failed!"))
  5236. return false
  5237. end
  5238. return true
  5239. end
  5240.  
  5241. def pbBaseDamage(basedmg,attacker,opponent)
  5242. party=@battle.pbParty(attacker.index)
  5243. atk=party[@participants[0]].baseStats[1]
  5244. @participants[0]=nil; @participants.compact!
  5245. return 5+(atk/10)
  5246. end
  5247. end
  5248.  
  5249.  
  5250.  
  5251. ################################################################################
  5252. # Two turn attack. Attacks first turn, skips second turn (if successful).
  5253. ################################################################################
  5254. class PokeBattle_Move_0C2 < PokeBattle_Move
  5255. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5256. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5257. if opponent.damagestate.calcdamage>0
  5258. attacker.effects[PBEffects::HyperBeam]=2
  5259. attacker.currentMove=@id
  5260. end
  5261. return ret
  5262. end
  5263. end
  5264.  
  5265.  
  5266.  
  5267. ################################################################################
  5268. # Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
  5269. ################################################################################
  5270. class PokeBattle_Move_0C3 < PokeBattle_Move
  5271. def pbTwoTurnAttack(attacker)
  5272. @immediate=false
  5273. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5274. @immediate=true
  5275. end
  5276. return false if @immediate
  5277. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5278. end
  5279.  
  5280. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5281. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5282. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5283. @battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",attacker.pbThis))
  5284. end
  5285. if @immediate
  5286. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5287. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5288. attacker.pbConsumeItem
  5289. end
  5290. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5291. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5292. end
  5293. end
  5294.  
  5295.  
  5296.  
  5297. ################################################################################
  5298. # Two turn attack. Skips first turn, attacks second turn. (SolarBeam)
  5299. # Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
  5300. ################################################################################
  5301. class PokeBattle_Move_0C4 < PokeBattle_Move
  5302. def pbTwoTurnAttack(attacker)
  5303. @immediate=false; @sunny=false
  5304. if attacker.effects[PBEffects::TwoTurnAttack]==0
  5305. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  5306. @battle.pbWeather==PBWeather::HARSHSUN
  5307. @immediate=true; @sunny=true
  5308. end
  5309. end
  5310. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5311. @immediate=true
  5312. end
  5313. return false if @immediate
  5314. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5315. end
  5316.  
  5317. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  5318. if @battle.pbWeather!=0 &&
  5319. @battle.pbWeather!=PBWeather::SUNNYDAY &&
  5320. @battle.pbWeather!=PBWeather::HARSHSUN
  5321. return (damagemult*0.5).round
  5322. end
  5323. return damagemult
  5324. end
  5325.  
  5326. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5327. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5328. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5329. @battle.pbDisplay(_INTL("{1} took in sunlight!",attacker.pbThis))
  5330. end
  5331. if @immediate && !@sunny
  5332. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5333. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5334. attacker.pbConsumeItem
  5335. end
  5336. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5337. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5338. end
  5339. end
  5340.  
  5341.  
  5342.  
  5343.  
  5344. ################################################################################
  5345. # Two turn attack. Skips first turn, attacks second turn. (Freeze Shock)
  5346. # May paralyze the target.
  5347. ################################################################################
  5348. class PokeBattle_Move_0C5 < PokeBattle_Move
  5349. def pbTwoTurnAttack(attacker)
  5350. @immediate=false
  5351. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5352. @immediate=true
  5353. end
  5354. return false if @immediate
  5355. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5356. end
  5357.  
  5358. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5359. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5360. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5361. @battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",attacker.pbThis))
  5362. end
  5363. if @immediate
  5364. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5365. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5366. attacker.pbConsumeItem
  5367. end
  5368. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5369. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5370. end
  5371.  
  5372. def pbAdditionalEffect(attacker,opponent)
  5373. return if opponent.damagestate.substitute
  5374. if opponent.pbCanParalyze?(attacker,false,self)
  5375. opponent.pbParalyze(attacker)
  5376. end
  5377. end
  5378. end
  5379.  
  5380.  
  5381.  
  5382. ################################################################################
  5383. # Two turn attack. Skips first turn, attacks second turn. (Ice Burn)
  5384. # May burn the target.
  5385. ################################################################################
  5386. class PokeBattle_Move_0C6 < PokeBattle_Move
  5387. def pbTwoTurnAttack(attacker)
  5388. @immediate=false
  5389. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5390. @immediate=true
  5391. end
  5392. return false if @immediate
  5393. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5394. end
  5395.  
  5396. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5397. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5398. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5399. @battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",attacker.pbThis))
  5400. end
  5401. if @immediate
  5402. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5403. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5404. attacker.pbConsumeItem
  5405. end
  5406. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5407. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5408. end
  5409.  
  5410. def pbAdditionalEffect(attacker,opponent)
  5411. return if opponent.damagestate.substitute
  5412. if opponent.pbCanBurn?(attacker,false,self)
  5413. opponent.pbBurn(attacker)
  5414. end
  5415. end
  5416. end
  5417.  
  5418.  
  5419.  
  5420. ################################################################################
  5421. # Two turn attack. Skips first turn, attacks second turn. (Sky Attack)
  5422. # May make the target flinch.
  5423. ################################################################################
  5424. class PokeBattle_Move_0C7 < PokeBattle_Move
  5425. def pbTwoTurnAttack(attacker)
  5426. @immediate=false
  5427. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5428. @immediate=true
  5429. end
  5430. return false if @immediate
  5431. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5432. end
  5433.  
  5434. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5435. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5436. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5437. @battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",attacker.pbThis))
  5438. end
  5439. if @immediate
  5440. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5441. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5442. attacker.pbConsumeItem
  5443. end
  5444. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5445. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5446. end
  5447.  
  5448. def pbAdditionalEffect(attacker,opponent)
  5449. return if opponent.damagestate.substitute
  5450. opponent.pbFlinch(attacker)
  5451. end
  5452. end
  5453.  
  5454.  
  5455.  
  5456. ################################################################################
  5457. # Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
  5458. # (Skull Bash)
  5459. ################################################################################
  5460. class PokeBattle_Move_0C8 < PokeBattle_Move
  5461. def pbTwoTurnAttack(attacker)
  5462. @immediate=false
  5463. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5464. @immediate=true
  5465. end
  5466. return false if @immediate
  5467. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5468. end
  5469.  
  5470. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5471. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5472. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5473. @battle.pbDisplay(_INTL("{1} tucked in its head!",attacker.pbThis))
  5474. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5475. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  5476. end
  5477. end
  5478. if @immediate
  5479. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5480. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5481. attacker.pbConsumeItem
  5482. end
  5483. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5484. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5485. end
  5486. end
  5487.  
  5488.  
  5489.  
  5490. ################################################################################
  5491. # Two turn attack. Skips first turn, attacks second turn. (Fly)
  5492. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5493. ################################################################################
  5494. class PokeBattle_Move_0C9 < PokeBattle_Move
  5495. def unusableInGravity?
  5496. return true
  5497. end
  5498.  
  5499. def pbTwoTurnAttack(attacker)
  5500. @immediate=false
  5501. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5502. @immediate=true
  5503. end
  5504. return false if @immediate
  5505. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5506. end
  5507.  
  5508. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5509. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5510. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5511. @battle.pbDisplay(_INTL("{1} flew up high!",attacker.pbThis))
  5512. end
  5513. if @immediate
  5514. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5515. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5516. attacker.pbConsumeItem
  5517. end
  5518. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5519. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5520. end
  5521. end
  5522.  
  5523.  
  5524.  
  5525. ################################################################################
  5526. # Two turn attack. Skips first turn, attacks second turn. (Dig)
  5527. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5528. ################################################################################
  5529. class PokeBattle_Move_0CA < PokeBattle_Move
  5530. def pbTwoTurnAttack(attacker)
  5531. @immediate=false
  5532. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5533. @immediate=true
  5534. end
  5535. return false if @immediate
  5536. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5537. end
  5538.  
  5539. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5540. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5541. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5542. @battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",attacker.pbThis))
  5543. end
  5544. if @immediate
  5545. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5546. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5547. attacker.pbConsumeItem
  5548. end
  5549. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5550. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5551. end
  5552. end
  5553.  
  5554.  
  5555.  
  5556. ################################################################################
  5557. # Two turn attack. Skips first turn, attacks second turn. (Dive)
  5558. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5559. ################################################################################
  5560. class PokeBattle_Move_0CB < PokeBattle_Move
  5561. def pbTwoTurnAttack(attacker)
  5562. @immediate=false
  5563. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5564. @immediate=true
  5565. end
  5566. return false if @immediate
  5567. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5568. end
  5569.  
  5570. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5571. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5572. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5573. @battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
  5574. end
  5575. if @immediate
  5576. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5577. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5578. attacker.pbConsumeItem
  5579. end
  5580. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5581. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5582. end
  5583. end
  5584.  
  5585.  
  5586.  
  5587. ################################################################################
  5588. # Two turn attack. Skips first turn, attacks second turn. (Bounce)
  5589. # May paralyze the target.
  5590. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5591. ################################################################################
  5592. class PokeBattle_Move_0CC < PokeBattle_Move
  5593. def unusableInGravity?
  5594. return true
  5595. end
  5596.  
  5597. def pbTwoTurnAttack(attacker)
  5598. @immediate=false
  5599. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5600. @immediate=true
  5601. end
  5602. return false if @immediate
  5603. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5604. end
  5605.  
  5606. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5607. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5608. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5609. @battle.pbDisplay(_INTL("{1} sprang up!",attacker.pbThis))
  5610. end
  5611. if @immediate
  5612. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5613. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5614. attacker.pbConsumeItem
  5615. end
  5616. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5617. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5618. end
  5619.  
  5620. def pbAdditionalEffect(attacker,opponent)
  5621. return if opponent.damagestate.substitute
  5622. if opponent.pbCanParalyze?(attacker,false,self)
  5623. opponent.pbParalyze(attacker)
  5624. end
  5625. end
  5626. end
  5627.  
  5628.  
  5629.  
  5630. ################################################################################
  5631. # Two turn attack. Skips first turn, attacks second turn. (Shadow Force)
  5632. # Is invulnerable during use.
  5633. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  5634. # this round. If successful, negates them this round.
  5635. ################################################################################
  5636. class PokeBattle_Move_0CD < PokeBattle_Move
  5637. def pbTwoTurnAttack(attacker)
  5638. @immediate=false
  5639. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5640. @immediate=true
  5641. end
  5642. return false if @immediate
  5643. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5644. end
  5645.  
  5646. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5647. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5648. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5649. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  5650. end
  5651. if @immediate
  5652. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5653. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5654. attacker.pbConsumeItem
  5655. end
  5656. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5657. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5658. if ret>0
  5659. opponent.effects[PBEffects::ProtectNegation]=true
  5660. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  5661. end
  5662. return ret
  5663. end
  5664. end
  5665.  
  5666.  
  5667.  
  5668. ################################################################################
  5669. # Two turn attack. Skips first turn, attacks second turn. (Sky Drop)
  5670. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5671. # Target is also semi-invulnerable during use, and can't take any action.
  5672. # Doesn't damage airborne Pokémon (but still makes them unable to move during).
  5673. ################################################################################
  5674. class PokeBattle_Move_0CE < PokeBattle_Move
  5675. def unusableInGravity?
  5676. return true
  5677. end
  5678.  
  5679. def pbMoveFailed(attacker,opponent)
  5680. ret=false
  5681. ret=true if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  5682. ret=true if opponent.effects[PBEffects::TwoTurnAttack]>0
  5683. ret=true if opponent.effects[PBEffects::SkyDrop] && attacker.effects[PBEffects::TwoTurnAttack]>0
  5684. ret=true if !opponent.pbIsOpposing?(attacker.index)
  5685. ret=true if USENEWBATTLEMECHANICS && opponent.weight(attacker)>=2000
  5686. return ret
  5687. end
  5688.  
  5689. def pbTwoTurnAttack(attacker)
  5690. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5691. end
  5692.  
  5693. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5694. if attacker.effects[PBEffects::TwoTurnAttack]>0
  5695. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5696. @battle.pbDisplay(_INTL("{1} took {2} into the sky!",attacker.pbThis,opponent.pbThis(true)))
  5697. opponent.effects[PBEffects::SkyDrop]=true
  5698. end
  5699. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5700. ret=super
  5701. @battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",opponent.pbThis))
  5702. opponent.effects[PBEffects::SkyDrop]=false
  5703. return ret
  5704. end
  5705.  
  5706. def pbTypeModifier(type,attacker,opponent)
  5707. return 0 if opponent.pbHasType?(:FLYING)
  5708. return 0 if !attacker.hasMoldBreaker &&
  5709. opponent.hasWorkingAbility(:LEVITATE) && !opponent.effects[PBEffects::SmackDown]
  5710. return super
  5711. end
  5712. end
  5713.  
  5714.  
  5715.  
  5716. ################################################################################
  5717. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5718. # at end of each round.
  5719. ################################################################################
  5720. class PokeBattle_Move_0CF < PokeBattle_Move
  5721. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5722. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5723. if opponent.damagestate.calcdamage>0 && !opponent.fainted? &&
  5724. !opponent.damagestate.substitute
  5725. if opponent.effects[PBEffects::MultiTurn]==0
  5726. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5727. if attacker.hasWorkingItem(:GRIPCLAW)
  5728. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5729. end
  5730. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5731. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5732. if isConst?(@id,PBMoves,:BIND)
  5733. @battle.pbDisplay(_INTL("{1} was squeezed by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5734. elsif isConst?(@id,PBMoves,:CLAMP)
  5735. @battle.pbDisplay(_INTL("{1} clamped {2}!",attacker.pbThis,opponent.pbThis(true)))
  5736. elsif isConst?(@id,PBMoves,:FIRESPIN)
  5737. @battle.pbDisplay(_INTL("{1} was trapped in the fiery vortex!",opponent.pbThis))
  5738. elsif isConst?(@id,PBMoves,:MAGMASTORM)
  5739. @battle.pbDisplay(_INTL("{1} became trapped by Magma Storm!",opponent.pbThis))
  5740. elsif isConst?(@id,PBMoves,:SANDTOMB)
  5741. @battle.pbDisplay(_INTL("{1} became trapped by Sand Tomb!",opponent.pbThis))
  5742. elsif isConst?(@id,PBMoves,:WRAP)
  5743. @battle.pbDisplay(_INTL("{1} was wrapped by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5744. elsif isConst?(@id,PBMoves,:INFESTATION)
  5745. @battle.pbDisplay(_INTL("{1} has been afflicted with an infestation by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5746. else
  5747. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5748. end
  5749. end
  5750. end
  5751. return ret
  5752. end
  5753. end
  5754.  
  5755.  
  5756.  
  5757. ################################################################################
  5758. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5759. # at end of each round. (Whirlpool)
  5760. # Power is doubled if target is using Dive.
  5761. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  5762. ################################################################################
  5763. class PokeBattle_Move_0D0 < PokeBattle_Move
  5764. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5765. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5766. if opponent.damagestate.calcdamage>0 && !opponent.fainted? &&
  5767. !opponent.damagestate.substitute
  5768. if opponent.effects[PBEffects::MultiTurn]==0
  5769. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5770. if attacker.hasWorkingItem(:GRIPCLAW)
  5771. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5772. end
  5773. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5774. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5775. @battle.pbDisplay(_INTL("{1} became trapped in the vortex!",opponent.pbThis))
  5776. end
  5777. end
  5778. return ret
  5779. end
  5780.  
  5781. def pbModifyDamage(damagemult,attacker,opponent)
  5782. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  5783. return (damagemult*2.0).round
  5784. end
  5785. return damagemult
  5786. end
  5787. end
  5788.  
  5789.  
  5790.  
  5791. ################################################################################
  5792. # User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
  5793. ################################################################################
  5794. class PokeBattle_Move_0D1 < PokeBattle_Move
  5795. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5796. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5797. if opponent.damagestate.calcdamage>0
  5798. if attacker.effects[PBEffects::Uproar]==0
  5799. attacker.effects[PBEffects::Uproar]=3
  5800. @battle.pbDisplay(_INTL("{1} caused an uproar!",attacker.pbThis))
  5801. attacker.currentMove=@id
  5802. end
  5803. end
  5804. return ret
  5805. end
  5806. end
  5807.  
  5808.  
  5809.  
  5810. ################################################################################
  5811. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  5812. # (Outrage, Petal Dange, Thrash)
  5813. ################################################################################
  5814. class PokeBattle_Move_0D2 < PokeBattle_Move
  5815. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5816. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5817. if opponent.damagestate.calcdamage>0 &&
  5818. attacker.effects[PBEffects::Outrage]==0 &&
  5819. attacker.status!=PBStatuses::SLEEP
  5820. attacker.effects[PBEffects::Outrage]=2+@battle.pbRandom(2)
  5821. attacker.currentMove=@id
  5822. elsif pbTypeModifier(@type,attacker,opponent)==0
  5823. # Cancel effect if attack is ineffective
  5824. attacker.effects[PBEffects::Outrage]=0
  5825. end
  5826. if attacker.effects[PBEffects::Outrage]>0
  5827. attacker.effects[PBEffects::Outrage]-=1
  5828. if attacker.effects[PBEffects::Outrage]==0 && attacker.pbCanConfuseSelf?(false)
  5829. attacker.pbConfuse
  5830. @battle.pbDisplay(_INTL("{1} became confused due to fatigue!",attacker.pbThis))
  5831. end
  5832. end
  5833. return ret
  5834. end
  5835. end
  5836.  
  5837.  
  5838.  
  5839. ################################################################################
  5840. # User must use this move for 4 more rounds. Power doubles each round.
  5841. # Power is also doubled if user has curled up. (Ice Ball, Rollout)
  5842. ################################################################################
  5843. class PokeBattle_Move_0D3 < PokeBattle_Move
  5844. def pbBaseDamage(basedmg,attacker,opponent)
  5845. shift=(4-attacker.effects[PBEffects::Rollout]) # from 0 through 4, 0 is most powerful
  5846. shift+=1 if attacker.effects[PBEffects::DefenseCurl]
  5847. basedmg=basedmg<<shift
  5848. return basedmg
  5849. end
  5850.  
  5851. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5852. attacker.effects[PBEffects::Rollout]=5 if attacker.effects[PBEffects::Rollout]==0
  5853. attacker.effects[PBEffects::Rollout]-=1
  5854. attacker.currentMove=thismove.id
  5855. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5856. if opponent.damagestate.calcdamage==0 ||
  5857. pbTypeModifier(@type,attacker,opponent)==0 ||
  5858. attacker.status==PBStatuses::SLEEP
  5859. # Cancel effect if attack is ineffective
  5860. attacker.effects[PBEffects::Rollout]=0
  5861. end
  5862. return ret
  5863. end
  5864. end
  5865.  
  5866.  
  5867.  
  5868. ################################################################################
  5869. # User bides its time this round and next round. The round after, deals 2x the
  5870. # total damage it took while biding to the last battler that damaged it. (Bide)
  5871. ################################################################################
  5872. class PokeBattle_Move_0D4 < PokeBattle_Move
  5873. def pbDisplayUseMessage(attacker)
  5874. if attacker.effects[PBEffects::Bide]==0
  5875. @battle.pbDisplayBrief(_INTL("{1} used\r\n{2}!",attacker.pbThis,name))
  5876. attacker.effects[PBEffects::Bide]=2
  5877. attacker.effects[PBEffects::BideDamage]=0
  5878. attacker.effects[PBEffects::BideTarget]=-1
  5879. attacker.currentMove=@id
  5880. pbShowAnimation(@id,attacker,nil)
  5881. return 1
  5882. else
  5883. attacker.effects[PBEffects::Bide]-=1
  5884. if attacker.effects[PBEffects::Bide]==0
  5885. @battle.pbDisplayBrief(_INTL("{1} unleashed energy!",attacker.pbThis))
  5886. return 0
  5887. else
  5888. @battle.pbDisplayBrief(_INTL("{1} is storing energy!",attacker.pbThis))
  5889. return 2
  5890. end
  5891. end
  5892. end
  5893.  
  5894. def pbAddTarget(targets,attacker)
  5895. if attacker.effects[PBEffects::BideTarget]>=0
  5896. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::BideTarget]])
  5897. attacker.pbRandomTarget(targets)
  5898. end
  5899. else
  5900. attacker.pbRandomTarget(targets)
  5901. end
  5902. end
  5903.  
  5904. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5905. if attacker.effects[PBEffects::BideDamage]==0 || !opponent
  5906. @battle.pbDisplay(_INTL("But it failed!"))
  5907. return -1
  5908. end
  5909. if USENEWBATTLEMECHANICS
  5910. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  5911. if typemod==0
  5912. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  5913. return -1
  5914. end
  5915. end
  5916. ret=pbEffectFixedDamage(attacker.effects[PBEffects::BideDamage]*2,attacker,opponent,hitnum,alltargets,showanimation)
  5917. return ret
  5918. end
  5919. end
  5920.  
  5921.  
  5922.  
  5923. ################################################################################
  5924. # Heals user by 1/2 of its max HP.
  5925. ################################################################################
  5926. class PokeBattle_Move_0D5 < PokeBattle_Move
  5927. def isHealingMove?
  5928. return true
  5929. end
  5930.  
  5931. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5932. if attacker.hp==attacker.totalhp
  5933. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5934. return -1
  5935. end
  5936. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5937. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5938. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5939. return 0
  5940. end
  5941. end
  5942.  
  5943.  
  5944.  
  5945. ################################################################################
  5946. # Heals user by 1/2 of its max HP. (Roost)
  5947. # User roosts, and its Flying type is ignored for attacks used against it.
  5948. ################################################################################
  5949. class PokeBattle_Move_0D6 < PokeBattle_Move
  5950. def isHealingMove?
  5951. return true
  5952. end
  5953.  
  5954. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5955. if attacker.hp==attacker.totalhp
  5956. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5957. return -1
  5958. end
  5959. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5960. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5961. attacker.effects[PBEffects::Roost]=true
  5962. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5963. return 0
  5964. end
  5965. end
  5966.  
  5967.  
  5968.  
  5969. ################################################################################
  5970. # Battler in user's position is healed by 1/2 of its max HP, at the end of the
  5971. # next round. (Wish)
  5972. ################################################################################
  5973. class PokeBattle_Move_0D7 < PokeBattle_Move
  5974. def isHealingMove?
  5975. return true
  5976. end
  5977.  
  5978. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5979. if attacker.effects[PBEffects::Wish]>0
  5980. @battle.pbDisplay(_INTL("But it failed!"))
  5981. return -1
  5982. end
  5983. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5984. attacker.effects[PBEffects::Wish]=2
  5985. attacker.effects[PBEffects::WishAmount]=((attacker.totalhp+1)/2).floor
  5986. attacker.effects[PBEffects::WishMaker]=attacker.pokemonIndex
  5987. return 0
  5988. end
  5989. end
  5990.  
  5991.  
  5992.  
  5993. ################################################################################
  5994. # Heals user by an amount depending on the weather. (Moonlight, Morning Sun,
  5995. # Synthesis)
  5996. ################################################################################
  5997. class PokeBattle_Move_0D8 < PokeBattle_Move
  5998. def isHealingMove?
  5999. return true
  6000. end
  6001.  
  6002. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6003. if attacker.hp==attacker.totalhp
  6004. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6005. return -1
  6006. end
  6007. hpgain=0
  6008. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  6009. @battle.pbWeather==PBWeather::HARSHSUN
  6010. hpgain=(attacker.totalhp*2/3).floor
  6011. elsif @battle.pbWeather!=0
  6012. hpgain=(attacker.totalhp/4).floor
  6013. else
  6014. hpgain=(attacker.totalhp/2).floor
  6015. end
  6016. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6017. attacker.pbRecoverHP(hpgain,true)
  6018. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6019. return 0
  6020. end
  6021. end
  6022.  
  6023.  
  6024.  
  6025. ################################################################################
  6026. # Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
  6027. ################################################################################
  6028. class PokeBattle_Move_0D9 < PokeBattle_Move
  6029. def isHealingMove?
  6030. return true
  6031. end
  6032.  
  6033. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6034. if !attacker.pbCanSleep?(attacker,true,self,true)
  6035. return -1
  6036. end
  6037. if attacker.status==PBStatuses::SLEEP
  6038. @battle.pbDisplay(_INTL("But it failed!"))
  6039. return -1
  6040. end
  6041. if attacker.hp==attacker.totalhp
  6042. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6043. return -1
  6044. end
  6045. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6046. attacker.pbSleepSelf(3)
  6047. @battle.pbDisplay(_INTL("{1} slept and became healthy!",attacker.pbThis))
  6048. hp=attacker.pbRecoverHP(attacker.totalhp-attacker.hp,true)
  6049. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis)) if hp>0
  6050. return 0
  6051. end
  6052. end
  6053.  
  6054.  
  6055.  
  6056. ################################################################################
  6057. # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
  6058. # (Aqua Ring)
  6059. ################################################################################
  6060. class PokeBattle_Move_0DA < PokeBattle_Move
  6061. def isHealingMove?
  6062. return true
  6063. end
  6064.  
  6065. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6066. if attacker.effects[PBEffects::AquaRing]
  6067. @battle.pbDisplay(_INTL("But it failed!"))
  6068. return -1
  6069. end
  6070. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6071. attacker.effects[PBEffects::AquaRing]=true
  6072. @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
  6073. return 0
  6074. end
  6075. end
  6076.  
  6077.  
  6078.  
  6079. ################################################################################
  6080. # Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
  6081. # round, and cannot flee or switch out. (Ingrain)
  6082. ################################################################################
  6083. class PokeBattle_Move_0DB < PokeBattle_Move
  6084. def isHealingMove?
  6085. return true
  6086. end
  6087.  
  6088. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6089. if attacker.effects[PBEffects::Ingrain]
  6090. @battle.pbDisplay(_INTL("But it failed!"))
  6091. return -1
  6092. end
  6093. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6094. attacker.effects[PBEffects::Ingrain]=true
  6095. @battle.pbDisplay(_INTL("{1} planted its roots!",attacker.pbThis))
  6096. return 0
  6097. end
  6098. end
  6099.  
  6100.  
  6101.  
  6102. ################################################################################
  6103. # Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each round,
  6104. # and the Pokémon in the user's position gains the same amount. (Leech Seed)
  6105. ################################################################################
  6106. class PokeBattle_Move_0DC < PokeBattle_Move
  6107. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6108. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6109. @battle.pbDisplay(_INTL("But it failed!"))
  6110. return -1
  6111. end
  6112. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  6113. if opponent.effects[PBEffects::LeechSeed]>=0
  6114. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  6115. return -1
  6116. end
  6117. if opponent.pbHasType?(:GRASS)
  6118. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6119. return -1
  6120. end
  6121. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6122. opponent.effects[PBEffects::LeechSeed]=attacker.index
  6123. @battle.pbDisplay(_INTL("{1} was seeded!",opponent.pbThis))
  6124. return 0
  6125. end
  6126. end
  6127.  
  6128.  
  6129.  
  6130. ################################################################################
  6131. # User gains half the HP it inflicts as damage.
  6132. ################################################################################
  6133. class PokeBattle_Move_0DD < PokeBattle_Move
  6134. def isHealingMove?
  6135. return USENEWBATTLEMECHANICS
  6136. end
  6137.  
  6138. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6139. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6140. if opponent.damagestate.calcdamage>0
  6141. hpgain=(opponent.damagestate.hplost/2).round
  6142. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6143. attacker.pbReduceHP(hpgain,true)
  6144. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6145. elsif attacker.effects[PBEffects::HealBlock]==0
  6146. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6147. attacker.pbRecoverHP(hpgain,true)
  6148. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6149. end
  6150. end
  6151. return ret
  6152. end
  6153. end
  6154.  
  6155.  
  6156.  
  6157. ################################################################################
  6158. # User gains half the HP it inflicts as damage. (Dream Eater)
  6159. # (Handled in Battler's pbSuccessCheck): Fails if target is not asleep.
  6160. ################################################################################
  6161. class PokeBattle_Move_0DE < PokeBattle_Move
  6162. def isHealingMove?
  6163. return USENEWBATTLEMECHANICS
  6164. end
  6165.  
  6166. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6167. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6168. if opponent.damagestate.calcdamage>0
  6169. hpgain=(opponent.damagestate.hplost/2).round
  6170. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6171. attacker.pbReduceHP(hpgain,true)
  6172. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6173. elsif attacker.effects[PBEffects::HealBlock]==0
  6174. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6175. attacker.pbRecoverHP(hpgain,true)
  6176. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6177. end
  6178. end
  6179. return ret
  6180. end
  6181. end
  6182.  
  6183.  
  6184.  
  6185. ################################################################################
  6186. # Heals target by 1/2 of its max HP. (Heal Pulse)
  6187. ################################################################################
  6188. class PokeBattle_Move_0DF < PokeBattle_Move
  6189. def isHealingMove?
  6190. return true
  6191. end
  6192.  
  6193. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6194. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6195. @battle.pbDisplay(_INTL("But it failed!"))
  6196. return -1
  6197. end
  6198. if opponent.hp==opponent.totalhp
  6199. @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
  6200. return -1
  6201. end
  6202. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6203. hpgain=((opponent.totalhp+1)/2).floor
  6204. hpgain=(opponent.totalhp*3/4).round if attacker.hasWorkingAbility(:MEGALAUNCHER)
  6205. opponent.pbRecoverHP(hpgain,true)
  6206. @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
  6207. return 0
  6208. end
  6209. end
  6210.  
  6211.  
  6212.  
  6213. ################################################################################
  6214. # User faints. (Explosion, Selfdestruct)
  6215. ################################################################################
  6216. class PokeBattle_Move_0E0 < PokeBattle_Move
  6217. def pbOnStartUse(attacker)
  6218. if !attacker.hasMoldBreaker
  6219. bearer=@battle.pbCheckGlobalAbility(:DAMP)
  6220. if bearer!=nil
  6221. @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  6222. bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  6223. return false
  6224. end
  6225. end
  6226. return true
  6227. end
  6228.  
  6229. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6230. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6231. if !attacker.fainted?
  6232. attacker.pbReduceHP(attacker.hp)
  6233. attacker.pbFaint if attacker.fainted?
  6234. end
  6235. end
  6236. end
  6237.  
  6238.  
  6239.  
  6240. ################################################################################
  6241. # Inflicts fixed damage equal to user's current HP. (Final Gambit)
  6242. # User faints (if successful).
  6243. ################################################################################
  6244. class PokeBattle_Move_0E1 < PokeBattle_Move
  6245. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6246. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  6247. if typemod==0
  6248. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6249. return -1
  6250. end
  6251. ret=pbEffectFixedDamage(attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  6252. return ret
  6253. end
  6254.  
  6255. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6256. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6257. if !attacker.fainted?
  6258. attacker.pbReduceHP(attacker.hp)
  6259. attacker.pbFaint if attacker.fainted?
  6260. end
  6261. end
  6262. end
  6263.  
  6264.  
  6265.  
  6266. ################################################################################
  6267. # Decreases the target's Attack and Special Attack by 2 stages each. (Memento)
  6268. # User faints (even if effect does nothing).
  6269. ################################################################################
  6270. class PokeBattle_Move_0E2 < PokeBattle_Move
  6271. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6272. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6273. @battle.pbDisplay(_INTL("But it failed!"))
  6274. return -1
  6275. end
  6276. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6277. ret=-1; showanim=true
  6278. if opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  6279. ret=0; showanim=false
  6280. end
  6281. if opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self,showanim)
  6282. ret=0; showanim=false
  6283. end
  6284. attacker.pbReduceHP(attacker.hp)
  6285. return ret
  6286. end
  6287. end
  6288.  
  6289.  
  6290.  
  6291. ################################################################################
  6292. # User faints. The Pokémon that replaces the user is fully healed (HP and
  6293. # status). Fails if user won't be replaced. (Healing Wish)
  6294. ################################################################################
  6295. class PokeBattle_Move_0E3 < PokeBattle_Move
  6296. def isHealingMove?
  6297. return true
  6298. end
  6299.  
  6300. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6301. if !@battle.pbCanChooseNonActive?(attacker.index)
  6302. @battle.pbDisplay(_INTL("But it failed!"))
  6303. return -1
  6304. end
  6305. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6306. attacker.pbReduceHP(attacker.hp)
  6307. attacker.effects[PBEffects::HealingWish]=true
  6308. return 0
  6309. end
  6310. end
  6311.  
  6312.  
  6313.  
  6314. ################################################################################
  6315. # User faints. The Pokémon that replaces the user is fully healed (HP, PP and
  6316. # status). Fails if user won't be replaced. (Lunar Dance)
  6317. ################################################################################
  6318. class PokeBattle_Move_0E4 < PokeBattle_Move
  6319. def isHealingMove?
  6320. return true
  6321. end
  6322.  
  6323. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6324. if !@battle.pbCanChooseNonActive?(attacker.index)
  6325. @battle.pbDisplay(_INTL("But it failed!"))
  6326. return -1
  6327. end
  6328. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6329. attacker.pbReduceHP(attacker.hp)
  6330. attacker.effects[PBEffects::LunarDance]=true
  6331. return 0
  6332. end
  6333. end
  6334.  
  6335.  
  6336.  
  6337. ################################################################################
  6338. # All current battlers will perish after 3 more rounds. (Perish Song)
  6339. ################################################################################
  6340. class PokeBattle_Move_0E5 < PokeBattle_Move
  6341. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6342. failed=true
  6343. for i in 0...4
  6344. if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
  6345. (attacker.hasMoldBreaker ||
  6346. !@battle.battlers[i].hasWorkingAbility(:SOUNDPROOF))
  6347. failed=false; break
  6348. end
  6349. end
  6350. if failed
  6351. @battle.pbDisplay(_INTL("But it failed!"))
  6352. return -1
  6353. end
  6354. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6355. @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
  6356. for i in 0...4
  6357. if @battle.battlers[i].effects[PBEffects::PerishSong]==0
  6358. if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  6359. @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
  6360. PBAbilities.getName(@battle.battlers[i].ability),@name))
  6361. else
  6362. @battle.battlers[i].effects[PBEffects::PerishSong]=4
  6363. @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
  6364. end
  6365. end
  6366. end
  6367. return 0
  6368. end
  6369. end
  6370.  
  6371.  
  6372.  
  6373. ################################################################################
  6374. # If user is KO'd before it next moves, the attack that caused it loses all PP.
  6375. # (Grudge)
  6376. ################################################################################
  6377. class PokeBattle_Move_0E6 < PokeBattle_Move
  6378. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6379. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6380. attacker.effects[PBEffects::Grudge]=true
  6381. @battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",attacker.pbThis))
  6382. return 0
  6383. end
  6384. end
  6385.  
  6386.  
  6387.  
  6388. ################################################################################
  6389. # If user is KO'd before it next moves, the battler that caused it also faints.
  6390. # (Destiny Bond)
  6391. ################################################################################
  6392. class PokeBattle_Move_0E7 < PokeBattle_Move
  6393. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6394. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6395. attacker.effects[PBEffects::DestinyBond]=true
  6396. @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
  6397. return 0
  6398. end
  6399. end
  6400.  
  6401.  
  6402.  
  6403. ################################################################################
  6404. # If user would be KO'd this round, it survives with 1HP instead. (Endure)
  6405. ################################################################################
  6406. class PokeBattle_Move_0E8 < PokeBattle_Move
  6407. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6408. ratesharers=[
  6409. 0xAA, # Detect, Protect
  6410. 0xAB, # Quick Guard
  6411. 0xAC, # Wide Guard
  6412. 0xE8, # Endure
  6413. 0x14B, # King's Shield
  6414. 0x14C # Spiky Shield
  6415. ]
  6416. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  6417. attacker.effects[PBEffects::ProtectRate]=1
  6418. end
  6419. unmoved=false
  6420. for poke in @battle.battlers
  6421. next if poke.index==attacker.index
  6422. if @battle.choices[poke.index][0]==1 && # Chose a move
  6423. !poke.hasMovedThisRound?
  6424. unmoved=true; break
  6425. end
  6426. end
  6427. if !unmoved ||
  6428. @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  6429. attacker.effects[PBEffects::ProtectRate]=1
  6430. @battle.pbDisplay(_INTL("But it failed!"))
  6431. return -1
  6432. end
  6433. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6434. attacker.effects[PBEffects::Endure]=true
  6435. attacker.effects[PBEffects::ProtectRate]*=2
  6436. @battle.pbDisplay(_INTL("{1} braced itself!",attacker.pbThis))
  6437. return 0
  6438. end
  6439. end
  6440.  
  6441.  
  6442.  
  6443. ################################################################################
  6444. # If target would be KO'd by this attack, it survives with 1HP instead. (False Swipe)
  6445. ################################################################################
  6446. class PokeBattle_Move_0E9 < PokeBattle_Move
  6447. # Handled in superclass def pbReduceHPDamage, do not edit!
  6448. end
  6449.  
  6450.  
  6451.  
  6452. ################################################################################
  6453. # User flees from battle. Fails in trainer battles. (Teleport)
  6454. ################################################################################
  6455. class PokeBattle_Move_0EA < PokeBattle_Move
  6456. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6457. if @battle.opponent ||
  6458. !@battle.pbCanRun?(attacker.index)
  6459. @battle.pbDisplay(_INTL("But it failed!"))
  6460. return -1
  6461. end
  6462. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6463. @battle.pbDisplay(_INTL("{1} fled from battle!",attacker.pbThis))
  6464. @battle.decision=3
  6465. return 0
  6466. end
  6467. end
  6468.  
  6469.  
  6470.  
  6471. ################################################################################
  6472. # In wild battles, makes target flee. Fails if target is a higher level than the
  6473. # user.
  6474. # In trainer battles, target switches out.
  6475. # For status moves. (Roar, Whirlwind)
  6476. ################################################################################
  6477. class PokeBattle_Move_0EB < PokeBattle_Move
  6478. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6479. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:SUCTIONCUPS)
  6480. @battle.pbDisplay(_INTL("{1} anchored itself with {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  6481. return -1
  6482. end
  6483. if opponent.effects[PBEffects::Ingrain]
  6484. @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",opponent.pbThis))
  6485. return -1
  6486. end
  6487. if !@battle.opponent
  6488. if opponent.level>attacker.level
  6489. @battle.pbDisplay(_INTL("But it failed!"))
  6490. return -1
  6491. end
  6492. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6493. @battle.decision=3 # Set decision to escaped
  6494. return 0
  6495. else
  6496. choices=false
  6497. party=@battle.pbParty(opponent.index)
  6498. for i in 0...party.length
  6499. if @battle.pbCanSwitch?(opponent.index,i,false,true)
  6500. choices=true
  6501. break
  6502. end
  6503. end
  6504. if !choices
  6505. @battle.pbDisplay(_INTL("But it failed!"))
  6506. return -1
  6507. end
  6508. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6509. opponent.effects[PBEffects::Roar]=true
  6510. return 0
  6511. end
  6512. end
  6513. end
  6514.  
  6515.  
  6516.  
  6517. ################################################################################
  6518. # In wild battles, makes target flee. Fails if target is a higher level than the
  6519. # user.
  6520. # In trainer battles, target switches out.
  6521. # For damaging moves. (Circle Throw, Dragon Tail)
  6522. ################################################################################
  6523. class PokeBattle_Move_0EC < PokeBattle_Move
  6524. def pbEffectAfterHit(attacker,opponent,turneffects)
  6525. if !attacker.fainted? && !opponent.fainted? &&
  6526. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6527. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SUCTIONCUPS)) &&
  6528. !opponent.effects[PBEffects::Ingrain]
  6529. if !@battle.opponent
  6530. if opponent.level<=attacker.level
  6531. @battle.decision=3 # Set decision to escaped
  6532. end
  6533. else
  6534. party=@battle.pbParty(opponent.index)
  6535. for i in 0..party.length-1
  6536. if @battle.pbCanSwitch?(opponent.index,i,false)
  6537. opponent.effects[PBEffects::Roar]=true
  6538. break
  6539. end
  6540. end
  6541. end
  6542. end
  6543. end
  6544. end
  6545.  
  6546.  
  6547.  
  6548. ################################################################################
  6549. # User switches out. Various effects affecting the user are passed to the
  6550. # replacement. (Baton Pass)
  6551. ################################################################################
  6552. class PokeBattle_Move_0ED < PokeBattle_Move
  6553. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6554. if !@battle.pbCanChooseNonActive?(attacker.index)
  6555. @battle.pbDisplay(_INTL("But it failed!"))
  6556. return -1
  6557. end
  6558. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6559. attacker.effects[PBEffects::BatonPass]=true
  6560. return 0
  6561. end
  6562. end
  6563.  
  6564.  
  6565.  
  6566. ################################################################################
  6567. # After inflicting damage, user switches out. Ignores trapping moves.
  6568. # (U-turn, Volt Switch)
  6569. # TODO: Pursuit should interrupt this move.
  6570. ################################################################################
  6571. class PokeBattle_Move_0EE < PokeBattle_Move
  6572. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6573. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6574. if !attacker.fainted? && opponent.damagestate.calcdamage>0 &&
  6575. @battle.pbCanChooseNonActive?(attacker.index) &&
  6576. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  6577. attacker.effects[PBEffects::Uturn]=true
  6578. end
  6579. return ret
  6580. end
  6581. end
  6582.  
  6583.  
  6584.  
  6585. ################################################################################
  6586. # Target can no longer switch out or flee, as long as the user remains active.
  6587. # (Block, Mean Look, Spider Web, Thousand Waves)
  6588. ################################################################################
  6589. class PokeBattle_Move_0EF < PokeBattle_Move
  6590. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6591. if pbIsDamaging?
  6592. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6593. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6594. !opponent.fainted?
  6595. if opponent.effects[PBEffects::MeanLook]<0 &&
  6596. (!USENEWBATTLEMECHANICS || !opponent.pbHasType?(:GHOST))
  6597. opponent.effects[PBEffects::MeanLook]=attacker.index
  6598. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6599. end
  6600. end
  6601. return ret
  6602. end
  6603. if opponent.effects[PBEffects::MeanLook]>=0 ||
  6604. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  6605. @battle.pbDisplay(_INTL("But it failed!"))
  6606. return -1
  6607. end
  6608. if USENEWBATTLEMECHANICS && opponent.pbHasType?(:GHOST)
  6609. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6610. return -1
  6611. end
  6612. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6613. opponent.effects[PBEffects::MeanLook]=attacker.index
  6614. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6615. return 0
  6616. end
  6617. end
  6618.  
  6619.  
  6620.  
  6621. ################################################################################
  6622. # Target drops its item. It regains the item at the end of the battle. (Knock Off)
  6623. # If target has a losable item, damage is multiplied by 1.5.
  6624. ################################################################################
  6625. class PokeBattle_Move_0F0 < PokeBattle_Move
  6626. def pbEffectAfterHit(attacker,opponent,turneffects)
  6627. if !attacker.fainted? && !opponent.fainted? && opponent.item!=0 &&
  6628. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6629. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6630. abilityname=PBAbilities.getName(opponent.ability)
  6631. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6632. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6633. itemname=PBItems.getName(opponent.item)
  6634. opponent.item=0
  6635. opponent.effects[PBEffects::ChoiceBand]=-1
  6636. opponent.effects[PBEffects::Unburden]=true
  6637. @battle.pbDisplay(_INTL("{1} dropped its {2}!",opponent.pbThis,itemname))
  6638. end
  6639. end
  6640. end
  6641.  
  6642. def pbModifyDamage(damagemult,attacker,opponent)
  6643. if USENEWBATTLEMECHANICS &&
  6644. !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6645. # Still boosts damage even if opponent has Sticky Hold
  6646. return (damagemult*1.5).round
  6647. end
  6648. return damagemult
  6649. end
  6650. end
  6651.  
  6652.  
  6653.  
  6654. ################################################################################
  6655. # User steals the target's item, if the user has none itself. (Covet, Thief)
  6656. # Items stolen from wild Pokémon are kept after the battle.
  6657. ################################################################################
  6658. class PokeBattle_Move_0F1 < PokeBattle_Move
  6659. def pbEffectAfterHit(attacker,opponent,turneffects)
  6660. if !attacker.fainted? && !opponent.fainted? && opponent.item!=0 &&
  6661. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6662. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6663. abilityname=PBAbilities.getName(opponent.ability)
  6664. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6665. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item) &&
  6666. !@battle.pbIsUnlosableItem(attacker,opponent.item) &&
  6667. attacker.item==0 &&
  6668. (@battle.opponent || !@battle.pbIsOpposing?(attacker.index))
  6669. itemname=PBItems.getName(opponent.item)
  6670. attacker.item=opponent.item
  6671. opponent.item=0
  6672. opponent.effects[PBEffects::ChoiceBand]=-1
  6673. opponent.effects[PBEffects::Unburden]=true
  6674. if !@battle.opponent && # In a wild battle
  6675. attacker.pokemon.itemInitial==0 &&
  6676. opponent.pokemon.itemInitial==attacker.item
  6677. attacker.pokemon.itemInitial=attacker.item
  6678. opponent.pokemon.itemInitial=0
  6679. end
  6680. @battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  6681. end
  6682. end
  6683. end
  6684. end
  6685.  
  6686.  
  6687.  
  6688. ################################################################################
  6689. # User and target swap items. They remain swapped after wild battles.
  6690. # (Switcheroo, Trick)
  6691. ################################################################################
  6692. class PokeBattle_Move_0F2 < PokeBattle_Move
  6693. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6694. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6695. (attacker.item==0 && opponent.item==0) ||
  6696. (!@battle.opponent && @battle.pbIsOpposing?(attacker.index))
  6697. @battle.pbDisplay(_INTL("But it failed!"))
  6698. return -1
  6699. end
  6700. if @battle.pbIsUnlosableItem(opponent,opponent.item) ||
  6701. @battle.pbIsUnlosableItem(attacker,opponent.item) ||
  6702. @battle.pbIsUnlosableItem(opponent,attacker.item) ||
  6703. @battle.pbIsUnlosableItem(attacker,attacker.item)
  6704. @battle.pbDisplay(_INTL("But it failed!"))
  6705. return -1
  6706. end
  6707. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6708. abilityname=PBAbilities.getName(opponent.ability)
  6709. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,name))
  6710. return -1
  6711. end
  6712. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6713. oldattitem=attacker.item
  6714. oldoppitem=opponent.item
  6715. oldattitemname=PBItems.getName(oldattitem)
  6716. oldoppitemname=PBItems.getName(oldoppitem)
  6717. tmpitem=attacker.item
  6718. attacker.item=opponent.item
  6719. opponent.item=tmpitem
  6720. if !@battle.opponent && # In a wild battle
  6721. attacker.pokemon.itemInitial==oldattitem &&
  6722. opponent.pokemon.itemInitial==oldoppitem
  6723. attacker.pokemon.itemInitial=oldoppitem
  6724. opponent.pokemon.itemInitial=oldattitem
  6725. end
  6726. @battle.pbDisplay(_INTL("{1} switched items with its opponent!",attacker.pbThis))
  6727. if oldoppitem>0 && oldattitem>0
  6728. @battle.pbDisplayPaused(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname))
  6729. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname))
  6730. else
  6731. @battle.pbDisplay(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname)) if oldoppitem>0
  6732. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname)) if oldattitem>0
  6733. end
  6734. attacker.effects[PBEffects::ChoiceBand]=-1
  6735. opponent.effects[PBEffects::ChoiceBand]=-1
  6736. return 0
  6737. end
  6738. end
  6739.  
  6740.  
  6741.  
  6742. ################################################################################
  6743. # User gives its item to the target. The item remains given after wild battles.
  6744. # (Bestow)
  6745. ################################################################################
  6746. class PokeBattle_Move_0F3 < PokeBattle_Move
  6747. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6748. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6749. attacker.item==0 || opponent.item!=0
  6750. @battle.pbDisplay(_INTL("But it failed!"))
  6751. return -1
  6752. end
  6753. if @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6754. @battle.pbIsUnlosableItem(opponent,attacker.item)
  6755. @battle.pbDisplay(_INTL("But it failed!"))
  6756. return -1
  6757. end
  6758. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6759. itemname=PBItems.getName(attacker.item)
  6760. opponent.item=attacker.item
  6761. attacker.item=0
  6762. attacker.effects[PBEffects::ChoiceBand]=-1
  6763. attacker.effects[PBEffects::Unburden]=true
  6764. if !@battle.opponent && # In a wild battle
  6765. opponent.pokemon.itemInitial==0 &&
  6766. attacker.pokemon.itemInitial==opponent.item
  6767. opponent.pokemon.itemInitial=opponent.item
  6768. attacker.pokemon.itemInitial=0
  6769. end
  6770. @battle.pbDisplay(_INTL("{1} received {2} from {3}!",opponent.pbThis,itemname,attacker.pbThis(true)))
  6771. return 0
  6772. end
  6773. end
  6774.  
  6775.  
  6776.  
  6777. ################################################################################
  6778. # User consumes target's berry and gains its effect. (Bug Bite, Pluck)
  6779. ################################################################################
  6780. class PokeBattle_Move_0F4 < PokeBattle_Move
  6781. def pbEffectAfterHit(attacker,opponent,turneffects)
  6782. if !attacker.fainted? && !opponent.fainted? && pbIsBerry?(opponent.item) &&
  6783. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6784. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:STICKYHOLD)
  6785. item=opponent.item
  6786. itemname=PBItems.getName(item)
  6787. opponent.pbConsumeItem(false,false)
  6788. @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",attacker.pbThis,itemname))
  6789. if !attacker.hasWorkingAbility(:KLUTZ) &&
  6790. attacker.effects[PBEffects::Embargo]==0
  6791. attacker.pbActivateBerryEffect(item,false)
  6792. end
  6793. # Symbiosis
  6794. if attacker.item==0 &&
  6795. attacker.pbPartner && attacker.pbPartner.hasWorkingAbility(:SYMBIOSIS)
  6796. partner=attacker.pbPartner
  6797. if partner.item>0 &&
  6798. !@battle.pbIsUnlosableItem(partner,partner.item) &&
  6799. !@battle.pbIsUnlosableItem(attacker,partner.item)
  6800. @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
  6801. partner.pbThis,PBAbilities.getName(partner.ability),
  6802. PBItems.getName(partner.item),attacker.pbThis(true)))
  6803. attacker.item=partner.item
  6804. partner.item=0
  6805. partner.effects[PBEffects::Unburden]=true
  6806. attacker.pbBerryCureCheck
  6807. end
  6808. end
  6809. end
  6810. end
  6811. end
  6812. end
  6813.  
  6814.  
  6815.  
  6816. ################################################################################
  6817. # Target's berry is destroyed. (Incinerate)
  6818. ################################################################################
  6819. class PokeBattle_Move_0F5 < PokeBattle_Move
  6820. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6821. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6822. if !attacker.fainted? && opponent.damagestate.calcdamage>0 &&
  6823. !opponent.damagestate.substitute &&
  6824. (pbIsBerry?(opponent.item) || (USENEWBATTLEMECHANICS && pbIsGem?(opponent.item)))
  6825. itemname=PBItems.getName(opponent.item)
  6826. opponent.pbConsumeItem(false,false)
  6827. @battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",opponent.pbThis,itemname))
  6828. end
  6829. return ret
  6830. end
  6831. end
  6832.  
  6833.  
  6834.  
  6835. ################################################################################
  6836. # User recovers the last item it held and consumed. (Recycle)
  6837. ################################################################################
  6838. class PokeBattle_Move_0F6 < PokeBattle_Move
  6839. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6840. if !attacker.pokemon || attacker.pokemon.itemRecycle==0
  6841. @battle.pbDisplay(_INTL("But it failed!"))
  6842. return -1
  6843. end
  6844. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6845. item=attacker.pokemon.itemRecycle
  6846. itemname=PBItems.getName(item)
  6847. attacker.item=item
  6848. if !@battle.opponent # In a wild battle
  6849. attacker.pokemon.itemInitial=item if attacker.pokemon.itemInitial==0
  6850. end
  6851. attacker.pokemon.itemRecycle=0
  6852. attacker.effects[PBEffects::PickupItem]=0
  6853. attacker.effects[PBEffects::PickupUse]=0
  6854. @battle.pbDisplay(_INTL("{1} found one {2}!",attacker.pbThis,itemname))
  6855. return 0
  6856. end
  6857. end
  6858.  
  6859.  
  6860.  
  6861. ################################################################################
  6862. # User flings its item at the target. Power and effect depend on the item. (Fling)
  6863. ################################################################################
  6864. class PokeBattle_Move_0F7 < PokeBattle_Move
  6865. def flingarray
  6866. return {
  6867. 130 => [:IRONBALL],
  6868. 100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,
  6869. :HELIXFOSSIL,:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,
  6870. :ROOTFOSSIL,:SAILFOSSIL,:SKULLFOSSIL],
  6871. 90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,
  6872. :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,
  6873. :MEADOWPLATE,:MINDPLATE,:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,
  6874. :SPOOKYPLATE,:STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],
  6875. 80 => [:ASSAULTVEST,:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,
  6876. :ODDKEYSTONE,:OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,
  6877. :SAFETYGOGGLES,:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY],
  6878. 70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,
  6879. :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
  6880. :POWERWEIGHT,:SHOCKDRIVE],
  6881. 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LUSTROUSORB,
  6882. :MACHOBRACE,:ROCKYHELMET,:STICK],
  6883. 50 => [:DUBIOUSDISC,:SHARPBEAK],
  6884. 40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],
  6885. 30 => [:ABILITYCAPSULE,:ABILITYURGE,:ABSORBBULB,:AMAZEMULCH,:AMULETCOIN,
  6886. :ANTIDOTE,:AWAKENING,:BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,
  6887. :BIGNUGGET,:BIGPEARL,:BINDINGBAND,:BLACKBELT,:BLACKFLUTE,
  6888. :BLACKGLASSES,:BLACKSLUDGE,:BLUEFLUTE,:BLUESHARD,:BOOSTMULCH,
  6889. :BURNHEAL,:CALCIUM,:CARBOS,:CASTELIACONE,:CELLBATTERY,
  6890. :CHARCOAL,:CLEANSETAG,:COMETSHARD,:DAMPMULCH,:DEEPSEASCALE,
  6891. :DIREHIT,:DIREHIT2,:DIREHIT3,:DRAGONSCALE,:EJECTBUTTON,
  6892. :ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ESCAPEROPE,:ETHER,
  6893. :EVERSTONE,:EXPSHARE,:FIRESTONE,:FLAMEORB,:FLOATSTONE,
  6894. :FLUFFYTAIL,:FRESHWATER,:FULLHEAL,:FULLRESTORE,:GOOEYMULCH,
  6895. :GREENSHARD,:GROWTHMULCH,:GUARDSPEC,:HEALPOWDER,:HEARTSCALE,
  6896. :HONEY,:HPUP,:HYPERPOTION,:ICEHEAL,:IRON,
  6897. :ITEMDROP,:ITEMURGE,:KINGSROCK,:LAVACOOKIE,:LEAFSTONE,
  6898. :LEMONADE,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,:LUCKYEGG,
  6899. :LUMINOUSMOSS,:LUMIOSEGALETTE,:MAGNET,:MAXELIXIR,:MAXETHER,
  6900. :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,
  6901. :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,
  6902. :NUGGET,:OLDGATEAU,:PARALYZEHEAL,:PARLYZHEAL,:PASSORB,
  6903. :PEARL,:PEARLSTRING,:POKEDOLL,:POKETOY,:POTION,
  6904. :PPMAX,:PPUP,:PRISMSCALE,:PROTEIN,:RAGECANDYBAR,
  6905. :RARECANDY,:RAZORFANG,:REDFLUTE,:REDSHARD,:RELICBAND,
  6906. :RELICCOPPER,:RELICCROWN,:RELICGOLD,:RELICSILVER,:RELICSTATUE,
  6907. :RELICVASE,:REPEL,:RESETURGE,:REVIVALHERB,:REVIVE,
  6908. :RICHMULCH,:SACHET,:SACREDASH,:SCOPELENS,:SHALOURSABLE,
  6909. :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
  6910. :SODAPOP,:SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,
  6911. :STARPIECE,:SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SURPRISEMULCH,
  6912. :SWEETHEART,:THUNDERSTONE,:TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,
  6913. :UPGRADE,:WATERSTONE,:WHIPPEDDREAM,:WHITEFLUTE,:XACCURACY,
  6914. :XACCURACY2,:XACCURACY3,:XACCURACY6,:XATTACK,:XATTACK2,
  6915. :XATTACK3,:XATTACK6,:XDEFEND,:XDEFEND2,:XDEFEND3,
  6916. :XDEFEND6,:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
  6917. :XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,:XSPATK,
  6918. :XSPATK2,:XSPATK3,:XSPATK6,:XSPECIAL,:XSPECIAL2,
  6919. :XSPECIAL3,:XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,
  6920. :XSPEED6,:YELLOWFLUTE,:YELLOWSHARD,:ZINC],
  6921. 20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
  6922. :RESISTWING,:SWIFTWING],
  6923. 10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,
  6924. :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,
  6925. :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,
  6926. :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,
  6927. :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,
  6928. :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,
  6929. :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,
  6930. :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,
  6931. :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS]
  6932. }
  6933. end
  6934.  
  6935. def pbMoveFailed(attacker,opponent)
  6936. return true if attacker.item==0 ||
  6937. @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6938. pbIsPokeBall?(attacker.item) ||
  6939. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  6940. attacker.hasWorkingAbility(:KLUTZ) ||
  6941. attacker.effects[PBEffects::Embargo]>0
  6942. for i in flingarray.keys
  6943. if flingarray[i]
  6944. for j in flingarray[i]
  6945. return false if isConst?(attacker.item,PBItems,j)
  6946. end
  6947. end
  6948. end
  6949. return false if pbIsBerry?(attacker.item) &&
  6950. !attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) &&
  6951. !attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  6952. return true
  6953. end
  6954.  
  6955. def pbBaseDamage(basedmg,attacker,opponent)
  6956. return 10 if pbIsBerry?(attacker.item)
  6957. return 80 if pbIsMegaStone?(attacker.item)
  6958. for i in flingarray.keys
  6959. if flingarray[i]
  6960. for j in flingarray[i]
  6961. return i if isConst?(attacker.item,PBItems,j)
  6962. end
  6963. end
  6964. end
  6965. return 1
  6966. end
  6967.  
  6968. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6969. if attacker.item==0
  6970. @battle.pbDisplay(_INTL("But it failed!"))
  6971. return 0
  6972. end
  6973. attacker.effects[PBEffects::Unburden]=true
  6974. @battle.pbDisplay(_INTL("{1} flung its {2}!",attacker.pbThis,PBItems.getName(attacker.item)))
  6975. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6976. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6977. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SHIELDDUST))
  6978. if attacker.hasWorkingBerry
  6979. opponent.pbActivateBerryEffect(attacker.item,false)
  6980. elsif attacker.hasWorkingItem(:FLAMEORB)
  6981. if opponent.pbCanBurn?(attacker,false,self)
  6982. opponent.pbBurn(attacker)
  6983. end
  6984. elsif attacker.hasWorkingItem(:KINGSROCK) ||
  6985. attacker.hasWorkingItem(:RAZORFANG)
  6986. opponent.pbFlinch(attacker)
  6987. elsif attacker.hasWorkingItem(:LIGHTBALL)
  6988. if opponent.pbCanParalyze?(attacker,false,self)
  6989. opponent.pbParalyze(attacker)
  6990. end
  6991. elsif attacker.hasWorkingItem(:MENTALHERB)
  6992. if opponent.effects[PBEffects::Attract]>=0
  6993. opponent.pbCureAttract
  6994. @battle.pbDisplay(_INTL("{1} got over its infatuation.",opponent.pbThis))
  6995. end
  6996. if opponent.effects[PBEffects::Taunt]>0
  6997. opponent.effects[PBEffects::Taunt]=0
  6998. @battle.pbDisplay(_INTL("{1}'s taunt wore off!",opponent.pbThis))
  6999. end
  7000. if opponent.effects[PBEffects::Encore]>0
  7001. opponent.effects[PBEffects::Encore]=0
  7002. opponent.effects[PBEffects::EncoreMove]=0
  7003. opponent.effects[PBEffects::EncoreIndex]=0
  7004. @battle.pbDisplay(_INTL("{1}'s encore ended!",opponent.pbThis))
  7005. end
  7006. if opponent.effects[PBEffects::Torment]
  7007. opponent.effects[PBEffects::Torment]=false
  7008. @battle.pbDisplay(_INTL("{1}'s torment wore off!",opponent.pbThis))
  7009. end
  7010. if opponent.effects[PBEffects::Disable]>0
  7011. opponent.effects[PBEffects::Disable]=0
  7012. @battle.pbDisplay(_INTL("{1} is no longer disabled!",opponent.pbThis))
  7013. end
  7014. if opponent.effects[PBEffects::HealBlock]>0
  7015. opponent.effects[PBEffects::HealBlock]=0
  7016. @battle.pbDisplay(_INTL("{1}'s Heal Block wore off!",opponent.pbThis))
  7017. end
  7018. elsif attacker.hasWorkingItem(:POISONBARB)
  7019. if opponent.pbCanPoison?(attacker,false,self)
  7020. opponent.pbPoison(attacker)
  7021. end
  7022. elsif attacker.hasWorkingItem(:TOXICORB)
  7023. if opponent.pbCanPoison?(attacker,false,self)
  7024. opponent.pbPoison(attacker,nil,true)
  7025. end
  7026. elsif attacker.hasWorkingItem(:WHITEHERB)
  7027. while true
  7028. reducedstats=false
  7029. for i in [PBStats::ATTACK,PBStats::DEFENSE,
  7030. PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF,
  7031. PBStats::EVASION,PBStats::ACCURACY]
  7032. if opponent.stages[i]<0
  7033. opponent.stages[i]=0; reducedstats=true
  7034. end
  7035. end
  7036. break if !reducedstats
  7037. @battle.pbDisplay(_INTL("{1}'s status is returned to normal!",
  7038. opponent.pbThis(true)))
  7039. end
  7040. end
  7041. end
  7042. attacker.pbConsumeItem
  7043. return ret
  7044. end
  7045. end
  7046.  
  7047.  
  7048.  
  7049. ################################################################################
  7050. # For 5 rounds, the target cannnot use its held item, its held item has no
  7051. # effect, and no items can be used on it. (Embargo)
  7052. ################################################################################
  7053. class PokeBattle_Move_0F8 < PokeBattle_Move
  7054. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7055. if opponent.effects[PBEffects::Embargo]>0
  7056. @battle.pbDisplay(_INTL("But it failed!"))
  7057. return -1
  7058. end
  7059. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7060. opponent.effects[PBEffects::Embargo]=5
  7061. @battle.pbDisplay(_INTL("{1} can't use items anymore!",opponent.pbThis))
  7062. return 0
  7063. end
  7064. end
  7065.  
  7066.  
  7067.  
  7068. ################################################################################
  7069. # For 5 rounds, all held items cannot be used in any way and have no effect.
  7070. # Held items can still change hands, but can't be thrown. (Magic Room)
  7071. ################################################################################
  7072. class PokeBattle_Move_0F9 < PokeBattle_Move
  7073. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7074. if @battle.field.effects[PBEffects::MagicRoom]>0
  7075. @battle.field.effects[PBEffects::MagicRoom]=0
  7076. @battle.pbDisplay(_INTL("The area returned to normal!"))
  7077. else
  7078. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7079. @battle.field.effects[PBEffects::MagicRoom]=5
  7080. @battle.pbDisplay(_INTL("It created a bizarre area in which Pokémon's held items lose their effects!"))
  7081. end
  7082. return 0
  7083. end
  7084. end
  7085.  
  7086.  
  7087.  
  7088. ################################################################################
  7089. # User takes recoil damage equal to 1/4 of the damage this move dealt.
  7090. ################################################################################
  7091. class PokeBattle_Move_0FA < PokeBattle_Move
  7092. def isRecoilMove?
  7093. return true
  7094. end
  7095.  
  7096. def pbEffectAfterHit(attacker,opponent,turneffects)
  7097. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7098. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7099. !attacker.hasWorkingAbility(:MAGICGUARD)
  7100. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/4.0).round)
  7101. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7102. end
  7103. end
  7104. end
  7105. end
  7106.  
  7107.  
  7108.  
  7109. ################################################################################
  7110. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7111. ################################################################################
  7112. class PokeBattle_Move_0FB < PokeBattle_Move
  7113. def isRecoilMove?
  7114. return true
  7115. end
  7116.  
  7117. def pbEffectAfterHit(attacker,opponent,turneffects)
  7118. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7119. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7120. !attacker.hasWorkingAbility(:MAGICGUARD)
  7121. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7122. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7123. end
  7124. end
  7125. end
  7126. end
  7127.  
  7128.  
  7129.  
  7130. ################################################################################
  7131. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  7132. # (Head Smash)
  7133. ################################################################################
  7134. class PokeBattle_Move_0FC < PokeBattle_Move
  7135. def isRecoilMove?
  7136. return true
  7137. end
  7138.  
  7139. def pbEffectAfterHit(attacker,opponent,turneffects)
  7140. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7141. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7142. !attacker.hasWorkingAbility(:MAGICGUARD)
  7143. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
  7144. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7145. end
  7146. end
  7147. end
  7148. end
  7149.  
  7150.  
  7151.  
  7152. ################################################################################
  7153. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7154. # May paralyze the target. (Volt Tackle)
  7155. ################################################################################
  7156. class PokeBattle_Move_0FD < PokeBattle_Move
  7157. def isRecoilMove?
  7158. return true
  7159. end
  7160.  
  7161. def pbEffectAfterHit(attacker,opponent,turneffects)
  7162. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7163. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7164. !attacker.hasWorkingAbility(:MAGICGUARD)
  7165. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7166. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7167. end
  7168. end
  7169. end
  7170.  
  7171. def pbAdditionalEffect(attacker,opponent)
  7172. return if opponent.damagestate.substitute
  7173. if opponent.pbCanParalyze?(attacker,false,self)
  7174. opponent.pbParalyze(attacker)
  7175. end
  7176. end
  7177. end
  7178.  
  7179.  
  7180.  
  7181. ################################################################################
  7182. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7183. # May burn the target. (Flare Blitz)
  7184. ################################################################################
  7185. class PokeBattle_Move_0FE < PokeBattle_Move
  7186. def isRecoilMove?
  7187. return true
  7188. end
  7189.  
  7190. def pbEffectAfterHit(attacker,opponent,turneffects)
  7191. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7192. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7193. !attacker.hasWorkingAbility(:MAGICGUARD)
  7194. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7195. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7196. end
  7197. end
  7198. end
  7199.  
  7200. def pbAdditionalEffect(attacker,opponent)
  7201. return if opponent.damagestate.substitute
  7202. if opponent.pbCanBurn?(attacker,false,self)
  7203. opponent.pbBurn(attacker)
  7204. end
  7205. end
  7206. end
  7207.  
  7208.  
  7209.  
  7210. ################################################################################
  7211. # Starts sunny weather. (Sunny Day)
  7212. ################################################################################
  7213. class PokeBattle_Move_0FF < PokeBattle_Move
  7214. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7215. case @battle.weather
  7216. when PBWeather::HEAVYRAIN
  7217. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7218. return -1
  7219. when PBWeather::HARSHSUN
  7220. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7221. return -1
  7222. when PBWeather::STRONGWINDS
  7223. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7224. return -1
  7225. when PBWeather::SUNNYDAY
  7226. @battle.pbDisplay(_INTL("But it failed!"))
  7227. return -1
  7228. end
  7229. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7230. @battle.weather=PBWeather::SUNNYDAY
  7231. @battle.weatherduration=5
  7232. @battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
  7233. @battle.pbCommonAnimation("Sunny",nil,nil)
  7234. @battle.pbDisplay(_INTL("The sunlight turned harsh!"))
  7235. return 0
  7236. end
  7237. end
  7238.  
  7239.  
  7240.  
  7241. ################################################################################
  7242. # Starts rainy weather. (Rain Dance)
  7243. ################################################################################
  7244. class PokeBattle_Move_100 < PokeBattle_Move
  7245. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7246. case @battle.weather
  7247. when PBWeather::HEAVYRAIN
  7248. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7249. return -1
  7250. when PBWeather::HARSHSUN
  7251. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7252. return -1
  7253. when PBWeather::STRONGWINDS
  7254. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7255. return -1
  7256. when PBWeather::RAINDANCE
  7257. @battle.pbDisplay(_INTL("But it failed!"))
  7258. return -1
  7259. end
  7260. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7261. @battle.weather=PBWeather::RAINDANCE
  7262. @battle.weatherduration=5
  7263. @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
  7264. @battle.pbCommonAnimation("Rain",nil,nil)
  7265. @battle.pbDisplay(_INTL("It started to rain!"))
  7266. return 0
  7267. end
  7268. end
  7269.  
  7270.  
  7271.  
  7272. ################################################################################
  7273. # Starts sandstorm weather. (Sandstorm)
  7274. ################################################################################
  7275. class PokeBattle_Move_101 < PokeBattle_Move
  7276. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7277. case @battle.weather
  7278. when PBWeather::HEAVYRAIN
  7279. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7280. return -1
  7281. when PBWeather::HARSHSUN
  7282. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7283. return -1
  7284. when PBWeather::STRONGWINDS
  7285. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7286. return -1
  7287. when PBWeather::SANDSTORM
  7288. @battle.pbDisplay(_INTL("But it failed!"))
  7289. return -1
  7290. end
  7291. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7292. @battle.weather=PBWeather::SANDSTORM
  7293. @battle.weatherduration=5
  7294. @battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
  7295. @battle.pbCommonAnimation("Sandstorm",nil,nil)
  7296. @battle.pbDisplay(_INTL("A sandstorm brewed!"))
  7297. return 0
  7298. end
  7299. end
  7300.  
  7301.  
  7302.  
  7303. ################################################################################
  7304. # Starts hail weather. (Hail)
  7305. ################################################################################
  7306. class PokeBattle_Move_102 < PokeBattle_Move
  7307. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7308. case @battle.weather
  7309. when PBWeather::HEAVYRAIN
  7310. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7311. return -1
  7312. when PBWeather::HARSHSUN
  7313. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7314. return -1
  7315. when PBWeather::STRONGWINDS
  7316. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7317. return -1
  7318. when PBWeather::HAIL
  7319. @battle.pbDisplay(_INTL("But it failed!"))
  7320. return -1
  7321. end
  7322. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7323. @battle.weather=PBWeather::HAIL
  7324. @battle.weatherduration=5
  7325. @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
  7326. @battle.pbCommonAnimation("Hail",nil,nil)
  7327. @battle.pbDisplay(_INTL("It started to hail!"))
  7328. return 0
  7329. end
  7330. end
  7331.  
  7332.  
  7333.  
  7334. ################################################################################
  7335. # Entry hazard. Lays spikes on the opposing side (max. 3 layers). (Spikes)
  7336. ################################################################################
  7337. class PokeBattle_Move_103 < PokeBattle_Move
  7338. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7339. if attacker.pbOpposingSide.effects[PBEffects::Spikes]>=3
  7340. @battle.pbDisplay(_INTL("But it failed!"))
  7341. return -1
  7342. end
  7343. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7344. attacker.pbOpposingSide.effects[PBEffects::Spikes]+=1
  7345. if !@battle.pbIsOpposing?(attacker.index)
  7346. @battle.pbDisplay(_INTL("Spikes were scattered all around the opposing team's feet!"))
  7347. else
  7348. @battle.pbDisplay(_INTL("Spikes were scattered all around your team's feet!"))
  7349. end
  7350. return 0
  7351. end
  7352. end
  7353.  
  7354.  
  7355.  
  7356. ################################################################################
  7357. # Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
  7358. # (Toxic Spikes)
  7359. ################################################################################
  7360. class PokeBattle_Move_104 < PokeBattle_Move
  7361. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7362. if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
  7363. @battle.pbDisplay(_INTL("But it failed!"))
  7364. return -1
  7365. end
  7366. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7367. attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]+=1
  7368. if !@battle.pbIsOpposing?(attacker.index)
  7369. @battle.pbDisplay(_INTL("Poison spikes were scattered all around the opposing team's feet!"))
  7370. else
  7371. @battle.pbDisplay(_INTL("Poison spikes were scattered all around your team's feet!"))
  7372. end
  7373. return 0
  7374. end
  7375. end
  7376.  
  7377.  
  7378.  
  7379. ################################################################################
  7380. # Entry hazard. Lays stealth rocks on the opposing side. (Stealth Rock)
  7381. ################################################################################
  7382. class PokeBattle_Move_105 < PokeBattle_Move
  7383. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7384. if attacker.pbOpposingSide.effects[PBEffects::StealthRock]
  7385. @battle.pbDisplay(_INTL("But it failed!"))
  7386. return -1
  7387. end
  7388. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7389. attacker.pbOpposingSide.effects[PBEffects::StealthRock]=true
  7390. if !@battle.pbIsOpposing?(attacker.index)
  7391. @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
  7392. else
  7393. @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
  7394. end
  7395. return 0
  7396. end
  7397. end
  7398.  
  7399.  
  7400.  
  7401. ################################################################################
  7402. # Forces ally's Pledge move to be used next, if it hasn't already. (Grass Pledge)
  7403. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7404. # causes either a sea of fire or a swamp on the opposing side.
  7405. ################################################################################
  7406. class PokeBattle_Move_106 < PokeBattle_Move
  7407. def pbOnStartUse(attacker)
  7408. @doubledamage=false; @overridetype=false
  7409. if attacker.effects[PBEffects::FirstPledge]==0x107 || # Fire Pledge
  7410. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7411. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7412. @doubledamage=true
  7413. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7414. @overridetype=true
  7415. end
  7416. end
  7417. return true
  7418. end
  7419.  
  7420. def pbBaseDamage(basedmg,attacker,opponent)
  7421. if @doubledamage
  7422. return basedmg*2
  7423. end
  7424. return basedmg
  7425. end
  7426.  
  7427. def pbModifyType(type,attacker,opponent)
  7428. if @overridetype
  7429. type=getConst(PBTypes,:FIRE) || 0
  7430. end
  7431. return super(type,attacker,opponent)
  7432. end
  7433.  
  7434. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7435. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7436. attacker.effects[PBEffects::FirstPledge]=0
  7437. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7438. end
  7439. # Combined move's effect
  7440. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7441. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7442. if opponent.damagestate.calcdamage>0
  7443. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7444. if !@battle.pbIsOpposing?(attacker.index)
  7445. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7446. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7447. else
  7448. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7449. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7450. end
  7451. end
  7452. attacker.effects[PBEffects::FirstPledge]=0
  7453. return ret
  7454. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7455. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7456. if opponent.damagestate.calcdamage>0
  7457. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7458. if !@battle.pbIsOpposing?(attacker.index)
  7459. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7460. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7461. else
  7462. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7463. @battle.pbCommonAnimation("Swamp",nil,nil)
  7464. end
  7465. end
  7466. attacker.effects[PBEffects::FirstPledge]=0
  7467. return ret
  7468. end
  7469. # Set up partner for a combined move
  7470. attacker.effects[PBEffects::FirstPledge]=0
  7471. partnermove=-1
  7472. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7473. if !attacker.pbPartner.hasMovedThisRound?
  7474. move=@battle.choices[attacker.pbPartner.index][2]
  7475. if move && move.id>0
  7476. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7477. end
  7478. end
  7479. end
  7480. if partnermove==0x107 || # Fire Pledge
  7481. partnermove==0x108 # Water Pledge
  7482. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7483. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7484. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7485. return 0
  7486. end
  7487. # Use the move on its own
  7488. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7489. end
  7490.  
  7491. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7492. if @overridetype
  7493. return super(getConst(PBMoves,:FIREPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7494. end
  7495. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7496. end
  7497. end
  7498.  
  7499.  
  7500.  
  7501. ################################################################################
  7502. # Forces ally's Pledge move to be used next, if it hasn't already. (Fire Pledge)
  7503. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7504. # causes either a sea of fire on the opposing side or a rainbow on the user's side.
  7505. ################################################################################
  7506. class PokeBattle_Move_107 < PokeBattle_Move
  7507. def pbOnStartUse(attacker)
  7508. @doubledamage=false; @overridetype=false
  7509. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7510. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7511. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7512. @doubledamage=true
  7513. if attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7514. @overridetype=true
  7515. end
  7516. end
  7517. return true
  7518. end
  7519.  
  7520. def pbBaseDamage(basedmg,attacker,opponent)
  7521. if @doubledamage
  7522. return basedmg*2
  7523. end
  7524. return basedmg
  7525. end
  7526.  
  7527. def pbModifyType(type,attacker,opponent)
  7528. if @overridetype
  7529. type=getConst(PBTypes,:WATER) || 0
  7530. end
  7531. return super(type,attacker,opponent)
  7532. end
  7533.  
  7534. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7535. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7536. attacker.effects[PBEffects::FirstPledge]=0
  7537. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7538. end
  7539. # Combined move's effect
  7540. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7541. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7542. if opponent.damagestate.calcdamage>0
  7543. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7544. if !@battle.pbIsOpposing?(attacker.index)
  7545. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7546. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7547. else
  7548. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7549. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7550. end
  7551. end
  7552. attacker.effects[PBEffects::FirstPledge]=0
  7553. return ret
  7554. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7555. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7556. if opponent.damagestate.calcdamage>0
  7557. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7558. if !@battle.pbIsOpposing?(attacker.index)
  7559. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7560. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7561. else
  7562. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7563. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7564. end
  7565. end
  7566. attacker.effects[PBEffects::FirstPledge]=0
  7567. return ret
  7568. end
  7569. # Set up partner for a combined move
  7570. attacker.effects[PBEffects::FirstPledge]=0
  7571. partnermove=-1
  7572. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7573. if !attacker.pbPartner.hasMovedThisRound?
  7574. move=@battle.choices[attacker.pbPartner.index][2]
  7575. if move && move.id>0
  7576. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7577. end
  7578. end
  7579. end
  7580. if partnermove==0x106 || # Grass Pledge
  7581. partnermove==0x108 # Water Pledge
  7582. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7583. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7584. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7585. return 0
  7586. end
  7587. # Use the move on its own
  7588. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7589. end
  7590.  
  7591. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7592. if @overridetype
  7593. return super(getConst(PBMoves,:WATERPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7594. end
  7595. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7596. end
  7597. end
  7598.  
  7599.  
  7600.  
  7601. ################################################################################
  7602. # Forces ally's Pledge move to be used next, if it hasn't already. (Water Pledge)
  7603. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7604. # causes either a swamp on the opposing side or a rainbow on the user's side.
  7605. ################################################################################
  7606. class PokeBattle_Move_108 < PokeBattle_Move
  7607. def pbOnStartUse(attacker)
  7608. @doubledamage=false; @overridetype=false
  7609. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7610. attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7611. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7612. @doubledamage=true
  7613. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7614. @overridetype=true
  7615. end
  7616. end
  7617. return true
  7618. end
  7619.  
  7620. def pbBaseDamage(basedmg,attacker,opponent)
  7621. if @doubledamage
  7622. return basedmg*2
  7623. end
  7624. return basedmg
  7625. end
  7626.  
  7627. def pbModifyType(type,attacker,opponent)
  7628. if @overridetype
  7629. type=getConst(PBTypes,:GRASS) || 0
  7630. end
  7631. return super(type,attacker,opponent)
  7632. end
  7633.  
  7634. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7635. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.fainted?
  7636. attacker.effects[PBEffects::FirstPledge]=0
  7637. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7638. end
  7639. # Combined move's effect
  7640. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7641. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7642. if opponent.damagestate.calcdamage>0
  7643. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7644. if !@battle.pbIsOpposing?(attacker.index)
  7645. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7646. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7647. else
  7648. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7649. @battle.pbCommonAnimation("Swamp",nil,nil)
  7650. end
  7651. end
  7652. attacker.effects[PBEffects::FirstPledge]=0
  7653. return ret
  7654. elsif attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7655. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7656. if opponent.damagestate.calcdamage>0
  7657. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7658. if !@battle.pbIsOpposing?(attacker.index)
  7659. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7660. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7661. else
  7662. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7663. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7664. end
  7665. end
  7666. attacker.effects[PBEffects::FirstPledge]=0
  7667. return ret
  7668. end
  7669. # Set up partner for a combined move
  7670. attacker.effects[PBEffects::FirstPledge]=0
  7671. partnermove=-1
  7672. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7673. if !attacker.pbPartner.hasMovedThisRound?
  7674. move=@battle.choices[attacker.pbPartner.index][2]
  7675. if move && move.id>0
  7676. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7677. end
  7678. end
  7679. end
  7680. if partnermove==0x106 || # Grass Pledge
  7681. partnermove==0x107 # Fire Pledge
  7682. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7683. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7684. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7685. return 0
  7686. end
  7687. # Use the move on its own
  7688. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7689. end
  7690.  
  7691. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7692. if @overridetype
  7693. return super(getConst(PBMoves,:GRASSPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7694. end
  7695. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7696. end
  7697. end
  7698.  
  7699.  
  7700.  
  7701. ################################################################################
  7702. # Scatters coins that the player picks up after winning the battle. (Pay Day)
  7703. ################################################################################
  7704. class PokeBattle_Move_109 < PokeBattle_Move
  7705. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7706. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7707. if opponent.damagestate.calcdamage>0
  7708. if @battle.pbOwnedByPlayer?(attacker.index)
  7709. @battle.extramoney+=5*attacker.level
  7710. @battle.extramoney=MAXMONEY if @battle.extramoney>MAXMONEY
  7711. end
  7712. @battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
  7713. end
  7714. return ret
  7715. end
  7716. end
  7717.  
  7718.  
  7719.  
  7720. ################################################################################
  7721. # Ends the opposing side's Light Screen and Reflect. (Brick Break)
  7722. ################################################################################
  7723. class PokeBattle_Move_10A < PokeBattle_Move
  7724. def pbCalcDamage(attacker,opponent)
  7725. return super(attacker,opponent,PokeBattle_Move::NOREFLECT)
  7726. end
  7727.  
  7728. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7729. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7730. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0
  7731. attacker.pbOpposingSide.effects[PBEffects::Reflect]=0
  7732. if !@battle.pbIsOpposing?(attacker.index)
  7733. @battle.pbDisplay(_INTL("The opposing team's Reflect wore off!"))
  7734. else
  7735. @battle.pbDisplayPaused(_INTL("Your team's Reflect wore off!"))
  7736. end
  7737. end
  7738. if attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7739. attacker.pbOpposingSide.effects[PBEffects::LightScreen]=0
  7740. if !@battle.pbIsOpposing?(attacker.index)
  7741. @battle.pbDisplay(_INTL("The opposing team's Light Screen wore off!"))
  7742. else
  7743. @battle.pbDisplay(_INTL("Your team's Light Screen wore off!"))
  7744. end
  7745. end
  7746. return ret
  7747. end
  7748.  
  7749. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7750. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
  7751. attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7752. return super(id,attacker,opponent,1,alltargets,showanimation) # Wall-breaking anim
  7753. end
  7754. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7755. end
  7756. end
  7757.  
  7758.  
  7759.  
  7760. ################################################################################
  7761. # If attack misses, user takes crash damage of 1/2 of max HP.
  7762. # (Hi Jump Kick, Jump Kick)
  7763. ################################################################################
  7764. class PokeBattle_Move_10B < PokeBattle_Move
  7765. def isRecoilMove?
  7766. return true
  7767. end
  7768.  
  7769. def unusableInGravity?
  7770. return true
  7771. end
  7772. end
  7773.  
  7774.  
  7775.  
  7776. ################################################################################
  7777. # User turns 1/4 of max HP into a substitute. (Substitute)
  7778. ################################################################################
  7779. class PokeBattle_Move_10C < PokeBattle_Move
  7780. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7781. if attacker.effects[PBEffects::Substitute]>0
  7782. @battle.pbDisplay(_INTL("{1} already has a substitute!",attacker.pbThis))
  7783. return -1
  7784. end
  7785. sublife=[(attacker.totalhp/4).floor,1].max
  7786. if attacker.hp<=sublife
  7787. @battle.pbDisplay(_INTL("It was too weak to make a substitute!"))
  7788. return -1
  7789. end
  7790. attacker.pbReduceHP(sublife,false,false)
  7791. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7792. attacker.effects[PBEffects::MultiTurn]=0
  7793. attacker.effects[PBEffects::MultiTurnAttack]=0
  7794. attacker.effects[PBEffects::Substitute]=sublife
  7795. @battle.pbDisplay(_INTL("{1} put in a substitute!",attacker.pbThis))
  7796. return 0
  7797. end
  7798. end
  7799.  
  7800.  
  7801.  
  7802. ################################################################################
  7803. # User is not Ghost: Decreases the user's Speed, increases the user's Attack &
  7804. # Defense by 1 stage each.
  7805. # User is Ghost: User loses 1/2 of max HP, and curses the target.
  7806. # Cursed Pokémon lose 1/4 of their max HP at the end of each round.
  7807. # (Curse)
  7808. ################################################################################
  7809. class PokeBattle_Move_10D < PokeBattle_Move
  7810. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7811. failed=false
  7812. if attacker.pbHasType?(:GHOST)
  7813. if opponent.effects[PBEffects::Curse] ||
  7814. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  7815. failed=true
  7816. else
  7817. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7818. @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true)))
  7819. opponent.effects[PBEffects::Curse]=true
  7820. attacker.pbReduceHP((attacker.totalhp/2).floor)
  7821. end
  7822. else
  7823. lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  7824. raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  7825. raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  7826. if !lowerspeed && !raiseatk && !raisedef
  7827. failed=true
  7828. else
  7829. pbShowAnimation(@id,attacker,nil,1,alltargets,showanimation) # Non-Ghost move animation
  7830. if lowerspeed
  7831. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  7832. end
  7833. showanim=true
  7834. if raiseatk
  7835. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  7836. showanim=false
  7837. end
  7838. if raisedef
  7839. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  7840. showanim=false
  7841. end
  7842. end
  7843. end
  7844. if failed
  7845. @battle.pbDisplay(_INTL("But it failed!"))
  7846. end
  7847. return failed ? -1 : 0
  7848. end
  7849. end
  7850.  
  7851.  
  7852.  
  7853. ################################################################################
  7854. # Target's last move used loses 4 PP. (Spite)
  7855. ################################################################################
  7856. class PokeBattle_Move_10E < PokeBattle_Move
  7857. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7858. for i in opponent.moves
  7859. if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
  7860. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7861. reduction=[4,i.pp].min
  7862. opponent.pbSetPP(i,i.pp-reduction)
  7863. @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
  7864. return 0
  7865. end
  7866. end
  7867. @battle.pbDisplay(_INTL("But it failed!"))
  7868. return -1
  7869. end
  7870. end
  7871.  
  7872.  
  7873.  
  7874. ################################################################################
  7875. # Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare)
  7876. ################################################################################
  7877. class PokeBattle_Move_10F < PokeBattle_Move
  7878. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7879. if opponent.status!=PBStatuses::SLEEP || opponent.effects[PBEffects::Nightmare] ||
  7880. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  7881. @battle.pbDisplay(_INTL("But it failed!"))
  7882. return -1
  7883. end
  7884. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7885. opponent.effects[PBEffects::Nightmare]=true
  7886. @battle.pbDisplay(_INTL("{1} began having a nightmare!",opponent.pbThis))
  7887. return 0
  7888. end
  7889. end
  7890.  
  7891.  
  7892.  
  7893. ################################################################################
  7894. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  7895. # (Rapid Spin)
  7896. ################################################################################
  7897. class PokeBattle_Move_110 < PokeBattle_Move
  7898. def pbEffectAfterHit(attacker,opponent,turneffects)
  7899. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  7900. if attacker.effects[PBEffects::MultiTurn]>0
  7901. mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
  7902. mtuser=@battle.battlers[attacker.effects[PBEffects::MultiTurnUser]]
  7903. @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
  7904. attacker.effects[PBEffects::MultiTurn]=0
  7905. attacker.effects[PBEffects::MultiTurnAttack]=0
  7906. attacker.effects[PBEffects::MultiTurnUser]=-1
  7907. end
  7908. if attacker.effects[PBEffects::LeechSeed]>=0
  7909. attacker.effects[PBEffects::LeechSeed]=-1
  7910. @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))
  7911. end
  7912. if attacker.pbOwnSide.effects[PBEffects::StealthRock]
  7913. attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
  7914. @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))
  7915. end
  7916. if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
  7917. attacker.pbOwnSide.effects[PBEffects::Spikes]=0
  7918. @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))
  7919. end
  7920. if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  7921. attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
  7922. @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))
  7923. end
  7924. if attacker.pbOwnSide.effects[PBEffects::StickyWeb]
  7925. attacker.pbOwnSide.effects[PBEffects::StickyWeb]=false
  7926. @battle.pbDisplay(_INTL("{1} blew away sticky webs!",attacker.pbThis))
  7927. end
  7928. end
  7929. end
  7930. end
  7931.  
  7932.  
  7933.  
  7934. ################################################################################
  7935. # Attacks 2 rounds in the future. (Doom Desire, Future Sight)
  7936. ################################################################################
  7937. class PokeBattle_Move_111 < PokeBattle_Move
  7938. def pbDisplayUseMessage(attacker)
  7939. return 0 if @battle.futuresight
  7940. return super(attacker)
  7941. end
  7942.  
  7943. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7944. if opponent.effects[PBEffects::FutureSight]>0
  7945. @battle.pbDisplay(_INTL("But it failed!"))
  7946. return -1
  7947. end
  7948. if @battle.futuresight
  7949. # Attack hits
  7950. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7951. end
  7952. # Attack is launched
  7953. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7954. opponent.effects[PBEffects::FutureSight]=3
  7955. opponent.effects[PBEffects::FutureSightMove]=@id
  7956. opponent.effects[PBEffects::FutureSightUser]=attacker.pokemonIndex
  7957. opponent.effects[PBEffects::FutureSightUserPos]=attacker.index
  7958. if isConst?(@id,PBMoves,:FUTURESIGHT)
  7959. @battle.pbDisplay(_INTL("{1} foresaw an attack!",attacker.pbThis))
  7960. else
  7961. @battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",attacker.pbThis))
  7962. end
  7963. return 0
  7964. end
  7965.  
  7966. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7967. if @battle.futuresight
  7968. return super(id,attacker,opponent,1,alltargets,showanimation) # Hit opponent anim
  7969. end
  7970. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7971. end
  7972. end
  7973.  
  7974.  
  7975.  
  7976. ################################################################################
  7977. # Increases the user's Defense and Special Defense by 1 stage each. Ups the
  7978. # user's stockpile by 1 (max. 3). (Stockpile)
  7979. ################################################################################
  7980. class PokeBattle_Move_112 < PokeBattle_Move
  7981. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7982. if attacker.effects[PBEffects::Stockpile]>=3
  7983. @battle.pbDisplay(_INTL("{1} can't stockpile any more!",attacker.pbThis))
  7984. return -1
  7985. end
  7986. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7987. attacker.effects[PBEffects::Stockpile]+=1
  7988. @battle.pbDisplay(_INTL("{1} stockpiled {2}!",attacker.pbThis,
  7989. attacker.effects[PBEffects::Stockpile]))
  7990. showanim=true
  7991. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  7992. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  7993. attacker.effects[PBEffects::StockpileDef]+=1
  7994. showanim=false
  7995. end
  7996. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  7997. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  7998. attacker.effects[PBEffects::StockpileSpDef]+=1
  7999. showanim=false
  8000. end
  8001. return 0
  8002. end
  8003. end
  8004.  
  8005.  
  8006.  
  8007. ################################################################################
  8008. # Power is 100 multiplied by the user's stockpile (X). Resets the stockpile to
  8009. # 0. Decreases the user's Defense and Special Defense by X stages each. (Spit Up)
  8010. ################################################################################
  8011. class PokeBattle_Move_113 < PokeBattle_Move
  8012. def pbMoveFailed(attacker,opponent)
  8013. return (attacker.effects[PBEffects::Stockpile]==0)
  8014. end
  8015.  
  8016. def pbBaseDamage(basedmg,attacker,opponent)
  8017. return 100*attacker.effects[PBEffects::Stockpile]
  8018. end
  8019.  
  8020. def pbEffectAfterHit(attacker,opponent,turneffects)
  8021. if !attacker.fainted? && turneffects[PBEffects::TotalDamage]>0
  8022. showanim=true
  8023. if attacker.effects[PBEffects::StockpileDef]>0
  8024. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8025. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8026. attacker,false,self,showanim)
  8027. showanim=false
  8028. end
  8029. end
  8030. if attacker.effects[PBEffects::StockpileSpDef]>0
  8031. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8032. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8033. attacker,false,self,showanim)
  8034. showanim=false
  8035. end
  8036. end
  8037. attacker.effects[PBEffects::Stockpile]=0
  8038. attacker.effects[PBEffects::StockpileDef]=0
  8039. attacker.effects[PBEffects::StockpileSpDef]=0
  8040. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8041. end
  8042. end
  8043. end
  8044.  
  8045.  
  8046.  
  8047. ################################################################################
  8048. # Heals user depending on the user's stockpile (X). Resets the stockpile to 0.
  8049. # Decreases the user's Defense and Special Defense by X stages each. (Swallow)
  8050. ################################################################################
  8051. class PokeBattle_Move_114 < PokeBattle_Move
  8052. def isHealingMove?
  8053. return true
  8054. end
  8055.  
  8056. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8057. hpgain=0
  8058. case attacker.effects[PBEffects::Stockpile]
  8059. when 0
  8060. @battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
  8061. return -1
  8062. when 1
  8063. hpgain=(attacker.totalhp/4).floor
  8064. when 2
  8065. hpgain=(attacker.totalhp/2).floor
  8066. when 3
  8067. hpgain=attacker.totalhp
  8068. end
  8069. if attacker.hp==attacker.totalhp &&
  8070. attacker.effects[PBEffects::StockpileDef]==0 &&
  8071. attacker.effects[PBEffects::StockpileSpDef]==0
  8072. @battle.pbDisplay(_INTL("But it failed!"))
  8073. return -1
  8074. end
  8075. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8076. if attacker.pbRecoverHP(hpgain,true)>0
  8077. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  8078. end
  8079. showanim=true
  8080. if attacker.effects[PBEffects::StockpileDef]>0
  8081. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8082. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8083. attacker,false,self,showanim)
  8084. showanim=false
  8085. end
  8086. end
  8087. if attacker.effects[PBEffects::StockpileSpDef]>0
  8088. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8089. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8090. attacker,false,self,showanim)
  8091. showanim=false
  8092. end
  8093. end
  8094. attacker.effects[PBEffects::Stockpile]=0
  8095. attacker.effects[PBEffects::StockpileDef]=0
  8096. attacker.effects[PBEffects::StockpileSpDef]=0
  8097. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8098. return 0
  8099. end
  8100. end
  8101.  
  8102.  
  8103.  
  8104. ################################################################################
  8105. # Fails if user was hit by a damaging move this round. (Focus Punch)
  8106. ################################################################################
  8107. class PokeBattle_Move_115 < PokeBattle_Move
  8108. def pbDisplayUseMessage(attacker)
  8109. if attacker.lastHPLost>0
  8110. @battle.pbDisplayBrief(_INTL("{1} lost its focus and couldn't move!",attacker.pbThis))
  8111. return -1
  8112. end
  8113. return super(attacker)
  8114. end
  8115. end
  8116.  
  8117.  
  8118.  
  8119. ################################################################################
  8120. # Fails if the target didn't chose a damaging move to use this round, or has
  8121. # already moved. (Sucker Punch)
  8122. ################################################################################
  8123. class PokeBattle_Move_116 < PokeBattle_Move
  8124. def pbMoveFailed(attacker,opponent)
  8125. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8126. oppmove=@battle.choices[opponent.index][2]
  8127. return true if !oppmove || oppmove.id<=0 || oppmove.pbIsStatus?
  8128. return true if opponent.hasMovedThisRound? && oppmove.function!=0xB0 # Me First
  8129. return false
  8130. end
  8131. end
  8132.  
  8133.  
  8134.  
  8135. ################################################################################
  8136. # This round, user becomes the target of attacks that have single targets.
  8137. # (Follow Me, Rage Powder)
  8138. ################################################################################
  8139. class PokeBattle_Move_117 < PokeBattle_Move
  8140. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8141. if !@battle.doublebattle
  8142. @battle.pbDisplay(_INTL("But it failed!"))
  8143. return -1
  8144. end
  8145. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8146. attacker.effects[PBEffects::FollowMe]=1
  8147. if !attacker.pbPartner.fainted? && attacker.pbPartner.effects[PBEffects::FollowMe]>0
  8148. attacker.effects[PBEffects::FollowMe]=attacker.pbPartner.effects[PBEffects::FollowMe]+1
  8149. end
  8150. @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
  8151. return 0
  8152. end
  8153. end
  8154.  
  8155.  
  8156.  
  8157. ################################################################################
  8158. # For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
  8159. # (Gravity)
  8160. ################################################################################
  8161. class PokeBattle_Move_118 < PokeBattle_Move
  8162. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8163. if @battle.field.effects[PBEffects::Gravity]>0
  8164. @battle.pbDisplay(_INTL("But it failed!"))
  8165. return -1
  8166. end
  8167. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8168. @battle.field.effects[PBEffects::Gravity]=5
  8169. for i in 0...4
  8170. poke=@battle.battlers[i]
  8171. next if !poke
  8172. if PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8173. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8174. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCE # Sky Drop
  8175. poke.effects[PBEffects::TwoTurnAttack]=0
  8176. end
  8177. if poke.effects[PBEffects::SkyDrop]
  8178. poke.effects[PBEffects::SkyDrop]=false
  8179. end
  8180. if poke.effects[PBEffects::MagnetRise]>0
  8181. poke.effects[PBEffects::MagnetRise]=0
  8182. end
  8183. if poke.effects[PBEffects::Telekinesis]>0
  8184. poke.effects[PBEffects::Telekinesis]=0
  8185. end
  8186. end
  8187. @battle.pbDisplay(_INTL("Gravity intensified!"))
  8188. return 0
  8189. end
  8190. end
  8191.  
  8192.  
  8193.  
  8194. ################################################################################
  8195. # For 5 rounds, user becomes airborne. (Magnet Rise)
  8196. ################################################################################
  8197. class PokeBattle_Move_119 < PokeBattle_Move
  8198. def unusableInGravity?
  8199. return true
  8200. end
  8201.  
  8202. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8203. if attacker.effects[PBEffects::Ingrain] ||
  8204. attacker.effects[PBEffects::SmackDown] ||
  8205. attacker.effects[PBEffects::MagnetRise]>0
  8206. @battle.pbDisplay(_INTL("But it failed!"))
  8207. return -1
  8208. end
  8209. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8210. attacker.effects[PBEffects::MagnetRise]=5
  8211. @battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",attacker.pbThis))
  8212. return 0
  8213. end
  8214. end
  8215.  
  8216.  
  8217.  
  8218. ################################################################################
  8219. # For 3 rounds, target becomes airborne and can always be hit. (Telekinesis)
  8220. ################################################################################
  8221. class PokeBattle_Move_11A < PokeBattle_Move
  8222. def unusableInGravity?
  8223. return true
  8224. end
  8225.  
  8226. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8227. if opponent.effects[PBEffects::Ingrain] ||
  8228. opponent.effects[PBEffects::SmackDown] ||
  8229. opponent.effects[PBEffects::Telekinesis]>0
  8230. @battle.pbDisplay(_INTL("But it failed!"))
  8231. return -1
  8232. end
  8233. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8234. opponent.effects[PBEffects::Telekinesis]=3
  8235. @battle.pbDisplay(_INTL("{1} was hurled into the air!",opponent.pbThis))
  8236. return 0
  8237. end
  8238. end
  8239.  
  8240.  
  8241.  
  8242.  
  8243. ################################################################################
  8244. # Hits airborne semi-invulnerable targets. (Sky Uppercut)
  8245. ################################################################################
  8246. class PokeBattle_Move_11B < PokeBattle_Move
  8247. # Handled in Battler's pbSuccessCheck, do not edit!
  8248. end
  8249.  
  8250.  
  8251.  
  8252. ################################################################################
  8253. # Grounds the target while it remains active. (Smack Down, Thousand Arrows)
  8254. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  8255. ################################################################################
  8256. class PokeBattle_Move_11C < PokeBattle_Move
  8257. def pbBaseDamage(basedmg,attacker,opponent)
  8258. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8259. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8260. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  8261. opponent.effects[PBEffects::SkyDrop]
  8262. return basedmg*2
  8263. end
  8264. return basedmg
  8265. end
  8266.  
  8267. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8268. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  8269. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  8270. !opponent.effects[PBEffects::Roost]
  8271. opponent.effects[PBEffects::SmackDown]=true
  8272. showmsg=(opponent.pbHasType?(:FLYING) ||
  8273. opponent.hasWorkingAbility(:LEVITATE))
  8274. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8275. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  8276. opponent.effects[PBEffects::TwoTurnAttack]=0; showmsg=true
  8277. end
  8278. if opponent.effects[PBEffects::MagnetRise]>0
  8279. opponent.effects[PBEffects::MagnetRise]=0; showmsg=true
  8280. end
  8281. if opponent.effects[PBEffects::Telekinesis]>0
  8282. opponent.effects[PBEffects::Telekinesis]=0; showmsg=true
  8283. end
  8284. @battle.pbDisplay(_INTL("{1} fell straight down!",opponent.pbThis)) if showmsg
  8285. end
  8286. return ret
  8287. end
  8288. end
  8289.  
  8290.  
  8291.  
  8292. ################################################################################
  8293. # Target moves immediately after the user, ignoring priority/speed. (After You)
  8294. ################################################################################
  8295. class PokeBattle_Move_11D < PokeBattle_Move
  8296. def pbMoveFailed(attacker,opponent)
  8297. return true if opponent.effects[PBEffects::MoveNext]
  8298. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8299. oppmove=@battle.choices[opponent.index][2]
  8300. return true if !oppmove || oppmove.id<=0
  8301. return true if opponent.hasMovedThisRound?
  8302. return false
  8303. end
  8304.  
  8305. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8306. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8307. opponent.effects[PBEffects::MoveNext]=true
  8308. opponent.effects[PBEffects::Quash]=false
  8309. @battle.pbDisplay(_INTL("{1} took the kind offer!",opponent.pbThis))
  8310. return 0
  8311. end
  8312. end
  8313.  
  8314.  
  8315.  
  8316. ################################################################################
  8317. # Target moves last this round, ignoring priority/speed. (Quash)
  8318. ################################################################################
  8319. class PokeBattle_Move_11E < PokeBattle_Move
  8320. def pbMoveFailed(attacker,opponent)
  8321. return true if opponent.effects[PBEffects::Quash]
  8322. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8323. oppmove=@battle.choices[opponent.index][2]
  8324. return true if !oppmove || oppmove.id<=0
  8325. return true if opponent.hasMovedThisRound?
  8326. return false
  8327. end
  8328.  
  8329. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8330. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8331. opponent.effects[PBEffects::Quash]=true
  8332. opponent.effects[PBEffects::MoveNext]=false
  8333. @battle.pbDisplay(_INTL("{1}'s move was postponed!",opponent.pbThis))
  8334. return 0
  8335. end
  8336. end
  8337.  
  8338.  
  8339.  
  8340. ################################################################################
  8341. # For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
  8342. # (Trick Room)
  8343. ################################################################################
  8344. class PokeBattle_Move_11F < PokeBattle_Move
  8345. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8346. if @battle.field.effects[PBEffects::TrickRoom]>0
  8347. @battle.field.effects[PBEffects::TrickRoom]=0
  8348. @battle.pbDisplay(_INTL("{1} reverted the dimensions!",attacker.pbThis))
  8349. else
  8350. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8351. @battle.field.effects[PBEffects::TrickRoom]=5
  8352. @battle.pbDisplay(_INTL("{1} twisted the dimensions!",attacker.pbThis))
  8353. end
  8354. return 0
  8355. end
  8356. end
  8357.  
  8358.  
  8359.  
  8360. ################################################################################
  8361. # User switches places with its ally. (Ally Switch)
  8362. ################################################################################
  8363. class PokeBattle_Move_120 < PokeBattle_Move
  8364. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8365. if !@battle.doublebattle ||
  8366. !attacker.pbPartner || attacker.pbPartner.fainted?
  8367. @battle.pbDisplay(_INTL("But it failed!"))
  8368. return -1
  8369. end
  8370. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8371. a=@battle.battlers[attacker.index]
  8372. b=@battle.battlers[attacker.pbPartner.index]
  8373. temp=a; a=b; b=temp
  8374. # Swap effects that point at the position rather than the Pokémon
  8375. # NOT PerishSongUser (no need to swap), Attract, MultiTurnUser
  8376. effectstoswap=[PBEffects::BideTarget,
  8377. PBEffects::CounterTarget,
  8378. PBEffects::LeechSeed,
  8379. PBEffects::LockOnPos,
  8380. PBEffects::MeanLook,
  8381. PBEffects::MirrorCoatTarget]
  8382. for i in effectstoswap
  8383. a.effects[i],b.effects[i]=b.effects[i],a.effects[i]
  8384. end
  8385. attacker.pbUpdate(true)
  8386. opponent.pbUpdate(true)
  8387. @battle.pbDisplay(_INTL("{1} and {2} switched places!",opponent.pbThis,attacker.pbThis(true)))
  8388. end
  8389. end
  8390.  
  8391.  
  8392.  
  8393. ################################################################################
  8394. # Target's Attack is used instead of user's Attack for this move's calculations.
  8395. # (Foul Play)
  8396. ################################################################################
  8397. class PokeBattle_Move_121 < PokeBattle_Move
  8398. # Handled in superclass def pbCalcDamage, do not edit!
  8399. end
  8400.  
  8401.  
  8402.  
  8403. ################################################################################
  8404. # Target's Defense is used instead of its Special Defense for this move's
  8405. # calculations. (Psyshock, Psystrike, Secret Sword)
  8406. ################################################################################
  8407. class PokeBattle_Move_122 < PokeBattle_Move
  8408. # Handled in superclass def pbCalcDamage, do not edit!
  8409. end
  8410.  
  8411.  
  8412.  
  8413. ################################################################################
  8414. # Only damages Pokémon that share a type with the user. (Synchronoise)
  8415. ################################################################################
  8416. class PokeBattle_Move_123 < PokeBattle_Move
  8417. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8418. if !opponent.pbHasType?(attacker.type1) &&
  8419. !opponent.pbHasType?(attacker.type2) &&
  8420. !opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  8421. @battle.pbDisplay(_INTL("{1} was unaffected!",opponent.pbThis))
  8422. return -1
  8423. end
  8424. return super(attacker,opponent,hitnum,alltargets,showanimation)
  8425. end
  8426. end
  8427.  
  8428.  
  8429.  
  8430. ################################################################################
  8431. # For 5 rounds, swaps all battlers' base Defense with base Special Defense.
  8432. # (Wonder Room)
  8433. ################################################################################
  8434. class PokeBattle_Move_124 < PokeBattle_Move
  8435. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8436. if @battle.field.effects[PBEffects::WonderRoom]>0
  8437. @battle.field.effects[PBEffects::WonderRoom]=0
  8438. @battle.pbDisplay(_INTL("Wonder Room wore off, and the Defense and Sp. Def stats returned to normal!"))
  8439. else
  8440. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8441. @battle.field.effects[PBEffects::WonderRoom]=5
  8442. @battle.pbDisplay(_INTL("It created a bizarre area in which the Defense and Sp. Def stats are swapped!"))
  8443. end
  8444. return 0
  8445. end
  8446. end
  8447.  
  8448.  
  8449.  
  8450. ################################################################################
  8451. # Fails unless user has already used all other moves it knows. (Last Resort)
  8452. ################################################################################
  8453. class PokeBattle_Move_125 < PokeBattle_Move
  8454. def pbMoveFailed(attacker,opponent)
  8455. counter=0; nummoves=0
  8456. for move in attacker.moves
  8457. next if move.id<=0
  8458. counter+=1 if move.id!=@id && !attacker.movesUsed.include?(move.id)
  8459. nummoves+=1
  8460. end
  8461. return counter!=0 || nummoves==1
  8462. end
  8463. end
  8464.  
  8465.  
  8466.  
  8467. #===============================================================================
  8468. # NOTE: Shadow moves use function codes 126-132 inclusive.
  8469. #===============================================================================
  8470.  
  8471.  
  8472.  
  8473. ################################################################################
  8474. # Does absolutely nothing. (Hold Hands)
  8475. ################################################################################
  8476. class PokeBattle_Move_133 < PokeBattle_Move
  8477. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8478. if !@battle.doublebattle ||
  8479. !attacker.pbPartner || attacker.pbPartner.fainted?
  8480. @battle.pbDisplay(_INTL("But it failed!"))
  8481. return -1
  8482. end
  8483. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8484. return 0
  8485. end
  8486. end
  8487.  
  8488.  
  8489.  
  8490. ################################################################################
  8491. # Does absolutely nothing. Shows a special message. (Celebrate)
  8492. ################################################################################
  8493. class PokeBattle_Move_134 < PokeBattle_Move
  8494. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8495. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8496. @battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwner(attacker.index).name))
  8497. return 0
  8498. end
  8499. end
  8500.  
  8501.  
  8502.  
  8503. ################################################################################
  8504. # Freezes the target. (Freeze-Dry)
  8505. # (Superclass's pbTypeModifier): Effectiveness against Water-type is 2x.
  8506. ################################################################################
  8507. class PokeBattle_Move_135 < PokeBattle_Move
  8508. def pbAdditionalEffect(attacker,opponent)
  8509. return if opponent.damagestate.substitute
  8510. if opponent.pbCanFreeze?(attacker,false,self)
  8511. opponent.pbFreeze
  8512. end
  8513. end
  8514. end
  8515.  
  8516.  
  8517.  
  8518. ################################################################################
  8519. # Increases the user's Defense by 1 stage for each target hit. (Diamond Storm)
  8520. ################################################################################
  8521. class PokeBattle_Move_136 < PokeBattle_Move_01D
  8522. # No difference to function code 01D. It may need to be separate in future.
  8523. end
  8524.  
  8525.  
  8526.  
  8527. ################################################################################
  8528. # Increases the user's and its ally's Defense and Special Defense by 1 stage
  8529. # each, if they have Plus or Minus. (Magnetic Flux)
  8530. ################################################################################
  8531. class PokeBattle_Move_137 < PokeBattle_Move
  8532. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8533. didsomething=false
  8534. for i in [attacker,attacker.pbPartner]
  8535. next if !i || i.fainted?
  8536. next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)
  8537. next if !i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  8538. !i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8539. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8540. didsomething=true
  8541. showanim=true
  8542. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8543. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8544. showanim=false
  8545. end
  8546. if i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8547. i.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  8548. showanim=false
  8549. end
  8550. end
  8551. if !didsomething
  8552. @battle.pbDisplay(_INTL("But it failed!"))
  8553. return -1
  8554. end
  8555. return 0
  8556. end
  8557. end
  8558.  
  8559.  
  8560.  
  8561. ################################################################################
  8562. # Increases ally's Special Defense by 1 stage. (Aromatic Mist)
  8563. ################################################################################
  8564. class PokeBattle_Move_138 < PokeBattle_Move
  8565. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8566. if !@battle.doublebattle || !opponent ||
  8567. !opponent.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8568. @battle.pbDisplay(_INTL("But it failed!"))
  8569. return -1
  8570. end
  8571. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8572. ret=attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  8573. return ret ? 0 : -1
  8574. end
  8575. end
  8576.  
  8577.  
  8578.  
  8579. ################################################################################
  8580. # Decreases the target's Attack by 1 stage. Always hits. (Play Nice)
  8581. ################################################################################
  8582. class PokeBattle_Move_139 < PokeBattle_Move
  8583. def pbAccuracyCheck(attacker,opponent)
  8584. return true
  8585. end
  8586.  
  8587. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8588. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  8589. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8590. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  8591. return ret ? 0 : -1
  8592. end
  8593. end
  8594.  
  8595.  
  8596.  
  8597. ################################################################################
  8598. # Decreases the target's Attack and Special Attack by 1 stage each. (Noble Roar)
  8599. ################################################################################
  8600. class PokeBattle_Move_13A < PokeBattle_Move
  8601. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8602. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  8603. # multiple times
  8604. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8605. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  8606. return -1
  8607. end
  8608. if opponent.pbTooLow?(PBStats::ATTACK) &&
  8609. opponent.pbTooLow?(PBStats::SPATK)
  8610. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  8611. return -1
  8612. end
  8613. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  8614. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  8615. return -1
  8616. end
  8617. if !attacker.hasMoldBreaker
  8618. if opponent.hasWorkingAbility(:CLEARBODY) ||
  8619. opponent.hasWorkingAbility(:WHITESMOKE)
  8620. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  8621. PBAbilities.getName(opponent.ability)))
  8622. return -1
  8623. end
  8624. end
  8625. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8626. ret=-1; showanim=true
  8627. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER)
  8628. abilityname=PBAbilities.getName(opponent.ability)
  8629. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  8630. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8631. ret=0; showanim=false
  8632. end
  8633. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8634. ret=0; showanim=false
  8635. end
  8636. return ret
  8637. end
  8638. end
  8639.  
  8640.  
  8641.  
  8642. ################################################################################
  8643. # Decreases the target's Defense by 1 stage. Always hits. (Hyperspace Fury)
  8644. ################################################################################
  8645. class PokeBattle_Move_13B < PokeBattle_Move
  8646. def pbMoveFailed(attacker,opponent)
  8647. return true if !isConst?(attacker.species,PBSpecies,:HOOPA)
  8648. return true if attacker.form!=1
  8649. return false
  8650. end
  8651.  
  8652. def pbAccuracyCheck(attacker,opponent)
  8653. return true
  8654. end
  8655.  
  8656. def pbAdditionalEffect(attacker,opponent)
  8657. return if opponent.damagestate.substitute
  8658. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8659. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  8660. end
  8661. end
  8662. end
  8663.  
  8664.  
  8665.  
  8666. ################################################################################
  8667. # Decreases the target's Special Attack by 1 stage. Always hits. (Confide)
  8668. ################################################################################
  8669. class PokeBattle_Move_13C < PokeBattle_Move
  8670. def pbAccuracyCheck(attacker,opponent)
  8671. return true
  8672. end
  8673.  
  8674. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8675. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8676. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8677. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  8678. return ret ? 0 : -1
  8679. end
  8680. end
  8681.  
  8682.  
  8683.  
  8684. ################################################################################
  8685. # Decreases the target's Special Attack by 2 stages. (Eerie Impulse)
  8686. ################################################################################
  8687. class PokeBattle_Move_13D < PokeBattle_Move
  8688. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8689. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  8690. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8691. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8692. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8693. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8694. return ret ? 0 : -1
  8695. end
  8696.  
  8697. def pbAdditionalEffect(attacker,opponent)
  8698. return if opponent.damagestate.substitute
  8699. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8700. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8701. end
  8702. end
  8703. end
  8704.  
  8705.  
  8706.  
  8707. ################################################################################
  8708. # Increases the Attack and Special Attack of all Grass-type Pokémon on the field
  8709. # by 1 stage each. Doesn't affect airborne Pokémon. (Rototiller)
  8710. ################################################################################
  8711. class PokeBattle_Move_13E < PokeBattle_Move
  8712. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8713. didsomething=false
  8714. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8715. next if !i || i.fainted?
  8716. next if !i.pbHasType?(:GRASS)
  8717. next if i.isAirborne?(attacker.hasMoldBreaker)
  8718. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8719. !i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8720. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8721. didsomething=true
  8722. showanim=true
  8723. if i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8724. i.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8725. showanim=false
  8726. end
  8727. if i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8728. i.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8729. showanim=false
  8730. end
  8731. end
  8732. if !didsomething
  8733. @battle.pbDisplay(_INTL("But it failed!"))
  8734. return -1
  8735. end
  8736. return 0
  8737. end
  8738. end
  8739.  
  8740.  
  8741.  
  8742. ################################################################################
  8743. # Increases the Defense of all Grass-type Pokémon on the field by 1 stage each.
  8744. # (Flower Shield)
  8745. ################################################################################
  8746. class PokeBattle_Move_13F < PokeBattle_Move
  8747. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8748. didsomething=false
  8749. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8750. next if !i || i.fainted?
  8751. next if !i.pbHasType?(:GRASS)
  8752. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8753. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8754. didsomething=true
  8755. showanim=true
  8756. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8757. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8758. showanim=false
  8759. end
  8760. end
  8761. if !didsomething
  8762. @battle.pbDisplay(_INTL("But it failed!"))
  8763. return -1
  8764. end
  8765. return 0
  8766. end
  8767. end
  8768.  
  8769.  
  8770.  
  8771. ################################################################################
  8772. # Decreases the Attack, Special Attack and Speed of all poisoned opponents by 1
  8773. # stage each. (Venom Drench)
  8774. ################################################################################
  8775. class PokeBattle_Move_140 < PokeBattle_Move
  8776. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8777. didsomething=false
  8778. for i in [attacker.pbOpposing1,attacker.pbOpposing2]
  8779. next if !i || i.fainted?
  8780. next if !i.status==PBStatuses::POISON
  8781. next if !i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8782. !i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self) &&
  8783. !i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8784. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8785. didsomething=true
  8786. showanim=true
  8787. if i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  8788. i.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8789. showanim=false
  8790. end
  8791. if i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8792. i.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8793. showanim=false
  8794. end
  8795. if i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8796. i.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  8797. showanim=false
  8798. end
  8799. end
  8800. if !didsomething
  8801. @battle.pbDisplay(_INTL("But it failed!"))
  8802. return -1
  8803. end
  8804. return 0
  8805. end
  8806. end
  8807.  
  8808.  
  8809.  
  8810. ################################################################################
  8811. # Reverses all stat changes of the target. (Topsy-Turvy)
  8812. ################################################################################
  8813. class PokeBattle_Move_141 < PokeBattle_Move
  8814. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8815. nonzero=false
  8816. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8817. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8818. if opponent.stages[i]!=0
  8819. nonzero=true; break
  8820. end
  8821. end
  8822. if !nonzero
  8823. @battle.pbDisplay(_INTL("But it failed!"))
  8824. return -1
  8825. end
  8826. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8827. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8828. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8829. opponent.stages[i]*=-1
  8830. end
  8831. @battle.pbDisplay(_INTL("{1}'s stats were reversed!",opponent.pbThis))
  8832. return 0
  8833. end
  8834. end
  8835.  
  8836.  
  8837.  
  8838. ################################################################################
  8839. # Gives target the Ghost type. (Trick-or-Treat)
  8840. ################################################################################
  8841. class PokeBattle_Move_142 < PokeBattle_Move
  8842. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8843. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  8844. !hasConst?(PBTypes,:GHOST) || opponent.pbHasType?(:GHOST) ||
  8845. isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  8846. @battle.pbDisplay(_INTL("But it failed!"))
  8847. return -1
  8848. end
  8849. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8850. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GHOST)
  8851. typename=PBTypes.getName(getConst(PBTypes,:GHOST))
  8852. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8853. return 0
  8854. end
  8855. end
  8856.  
  8857.  
  8858.  
  8859. ################################################################################
  8860. # Gives target the Grass type. (Forest's Curse)
  8861. ################################################################################
  8862. class PokeBattle_Move_143 < PokeBattle_Move
  8863. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8864. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8865. @battle.pbDisplay(_INTL("But it failed!"))
  8866. return -1
  8867. end
  8868. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8869. if opponent.effects[PBEffects::LeechSeed]>=0
  8870. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  8871. return -1
  8872. end
  8873. if !hasConst?(PBTypes,:GRASS) || opponent.pbHasType?(:GRASS) ||
  8874. isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  8875. @battle.pbDisplay(_INTL("But it failed!"))
  8876. return -1
  8877. end
  8878. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8879. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GRASS)
  8880. typename=PBTypes.getName(getConst(PBTypes,:GRASS))
  8881. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8882. return 0
  8883. end
  8884. end
  8885.  
  8886.  
  8887.  
  8888. ################################################################################
  8889. # Damage is multiplied by Flying's effectiveness against the target. Does double
  8890. # damage and has perfect accuracy if the target is Minimized. (Flying Press)
  8891. ################################################################################
  8892. class PokeBattle_Move_144 < PokeBattle_Move
  8893. def pbModifyDamage(damagemult,attacker,opponent)
  8894. type=getConst(PBTypes,:FLYING) || -1
  8895. if type>=0
  8896. mult=PBTypes.getCombinedEffectiveness(type,
  8897. opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
  8898. return ((damagemult*mult)/8).round
  8899. end
  8900. return damagemult
  8901. end
  8902.  
  8903. def tramplesMinimize?(param=1)
  8904. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  8905. return true if param==2 # Double damage
  8906. return false
  8907. end
  8908. end
  8909.  
  8910.  
  8911.  
  8912. ################################################################################
  8913. # Target's moves become Electric-type for the rest of the round. (Electrify)
  8914. ################################################################################
  8915. class PokeBattle_Move_145 < PokeBattle_Move
  8916. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8917. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8918. if opponent.effects[PBEffects::Electrify]
  8919. @battle.pbDisplay(_INTL("But it failed!"))
  8920. return -1
  8921. end
  8922. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  8923. !@battle.choices[opponent.index][2] ||
  8924. @battle.choices[opponent.index][2].id<=0 ||
  8925. opponent.hasMovedThisRound?
  8926. @battle.pbDisplay(_INTL("But it failed!"))
  8927. return -1
  8928. end
  8929. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8930. opponent.effects[PBEffects::Electrify]=true
  8931. @battle.pbDisplay(_INTL("{1} was electrified!",opponent.pbThis))
  8932. return 0
  8933. end
  8934. end
  8935.  
  8936.  
  8937.  
  8938. ################################################################################
  8939. # All Normal-type moves become Electric-type for the rest of the round.
  8940. # (Ion Deluge)
  8941. ################################################################################
  8942. class PokeBattle_Move_146 < PokeBattle_Move
  8943. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8944. unmoved=false
  8945. for poke in @battle.battlers
  8946. next if poke.index==attacker.index
  8947. if @battle.choices[poke.index][0]==1 && # Chose a move
  8948. !poke.hasMovedThisRound?
  8949. unmoved=true; break
  8950. end
  8951. end
  8952. if !unmoved || @battle.field.effects[PBEffects::IonDeluge]
  8953. @battle.pbDisplay(_INTL("But it failed!"))
  8954. return -1
  8955. end
  8956. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8957. @battle.field.effects[PBEffects::IonDeluge]=true
  8958. @battle.pbDisplay(_INTL("The Ion Deluge started!"))
  8959. return 0
  8960. end
  8961. end
  8962.  
  8963.  
  8964.  
  8965. ################################################################################
  8966. # Always hits. (Hyperspace Hole)
  8967. # TODO: Hits through various shields.
  8968. ################################################################################
  8969. class PokeBattle_Move_147 < PokeBattle_Move
  8970. def pbAccuracyCheck(attacker,opponent)
  8971. return true
  8972. end
  8973. end
  8974.  
  8975.  
  8976. ################################################################################
  8977. # Powders the foe. This round, if it uses a Fire move, it loses 1/4 of its max
  8978. # HP instead. (Powder)
  8979. ################################################################################
  8980. class PokeBattle_Move_148 < PokeBattle_Move
  8981. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8982. if opponent.effects[PBEffects::Powder]
  8983. @battle.pbDisplay(_INTL("But it failed!"))
  8984. return -1
  8985. end
  8986. opponent.effects[PBEffects::Powder]=true
  8987. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8988. @battle.pbDisplay(_INTL("{1} is covered in powder!",attacker.pbThis))
  8989. return 0
  8990. end
  8991. end
  8992.  
  8993.  
  8994.  
  8995. ################################################################################
  8996. # This round, the user's side is unaffected by damaging moves. (Mat Block)
  8997. ################################################################################
  8998. class PokeBattle_Move_149 < PokeBattle_Move
  8999. def pbMoveFailed(attacker,opponent)
  9000. return (attacker.turncount>1)
  9001. end
  9002.  
  9003. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9004. attacker.pbOwnSide.effects[PBEffects::MatBlock]=true
  9005. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9006. @battle.pbDisplay(_INTL("{1} intends to flip up a mat and block incoming attacks!",attacker.pbThis))
  9007. return 0
  9008. end
  9009. end
  9010.  
  9011.  
  9012.  
  9013. ################################################################################
  9014. # User's side is protected against status moves this round. (Crafty Shield)
  9015. ################################################################################
  9016. class PokeBattle_Move_14A < PokeBattle_Move
  9017. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9018. if attacker.pbOwnSide.effects[PBEffects::CraftyShield]
  9019. @battle.pbDisplay(_INTL("But it failed!"))
  9020. return -1
  9021. end
  9022. unmoved=false
  9023. for poke in @battle.battlers
  9024. next if poke.index==attacker.index
  9025. if @battle.choices[poke.index][0]==1 && # Chose a move
  9026. !poke.hasMovedThisRound?
  9027. unmoved=true; break
  9028. end
  9029. end
  9030. if !unmoved
  9031. @battle.pbDisplay(_INTL("But it failed!"))
  9032. return -1
  9033. end
  9034. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9035. attacker.pbOwnSide.effects[PBEffects::CraftyShield]=true
  9036. if !@battle.pbIsOpposing?(attacker.index)
  9037. @battle.pbDisplay(_INTL("Crafty Shield protected your team!"))
  9038. else
  9039. @battle.pbDisplay(_INTL("Crafty Shield protected the opposing team!"))
  9040. end
  9041. return 0
  9042. end
  9043. end
  9044.  
  9045.  
  9046.  
  9047. ################################################################################
  9048. # User is protected against damaging moves this round. Decreases the Attack of
  9049. # the user of a stopped contact move by 2 stages. (King's Shield)
  9050. ################################################################################
  9051. class PokeBattle_Move_14B < PokeBattle_Move
  9052. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9053. if attacker.effects[PBEffects::KingsShield]
  9054. @battle.pbDisplay(_INTL("But it failed!"))
  9055. return -1
  9056. end
  9057. ratesharers=[
  9058. 0xAA, # Detect, Protect
  9059. 0xAB, # Quick Guard
  9060. 0xAC, # Wide Guard
  9061. 0xE8, # Endure
  9062. 0x14B, # King's Shield
  9063. 0x14C # Spiky Shield
  9064. ]
  9065. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9066. attacker.effects[PBEffects::ProtectRate]=1
  9067. end
  9068. unmoved=false
  9069. for poke in @battle.battlers
  9070. next if poke.index==attacker.index
  9071. if @battle.choices[poke.index][0]==1 && # Chose a move
  9072. !poke.hasMovedThisRound?
  9073. unmoved=true; break
  9074. end
  9075. end
  9076. if !unmoved ||
  9077. (!USENEWBATTLEMECHANICS &&
  9078. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  9079. attacker.effects[PBEffects::ProtectRate]=1
  9080. @battle.pbDisplay(_INTL("But it failed!"))
  9081. return -1
  9082. end
  9083. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9084. attacker.effects[PBEffects::KingsShield]=true
  9085. attacker.effects[PBEffects::ProtectRate]*=2
  9086. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9087. return 0
  9088. end
  9089. end
  9090.  
  9091.  
  9092.  
  9093. ################################################################################
  9094. # User is protected against moves that target it this round. Damages the user of
  9095. # a stopped contact move by 1/8 of its max HP. (Spiky Shield)
  9096. ################################################################################
  9097. class PokeBattle_Move_14C < PokeBattle_Move
  9098. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9099. if attacker.effects[PBEffects::SpikyShield]
  9100. @battle.pbDisplay(_INTL("But it failed!"))
  9101. return -1
  9102. end
  9103. ratesharers=[
  9104. 0xAA, # Detect, Protect
  9105. 0xAB, # Quick Guard
  9106. 0xAC, # Wide Guard
  9107. 0xE8, # Endure
  9108. 0x14B, # King's Shield
  9109. 0x14C # Spiky Shield
  9110. ]
  9111. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9112. attacker.effects[PBEffects::ProtectRate]=1
  9113. end
  9114. unmoved=false
  9115. for poke in @battle.battlers
  9116. next if poke.index==attacker.index
  9117. if @battle.choices[poke.index][0]==1 && # Chose a move
  9118. !poke.hasMovedThisRound?
  9119. unmoved=true; break
  9120. end
  9121. end
  9122. if !unmoved ||
  9123. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  9124. attacker.effects[PBEffects::ProtectRate]=1
  9125. @battle.pbDisplay(_INTL("But it failed!"))
  9126. return -1
  9127. end
  9128. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9129. attacker.effects[PBEffects::SpikyShield]=true
  9130. attacker.effects[PBEffects::ProtectRate]*=2
  9131. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9132. return 0
  9133. end
  9134. end
  9135.  
  9136.  
  9137.  
  9138. ################################################################################
  9139. # Two turn attack. Skips first turn, attacks second turn. (Phantom Force)
  9140. # Is invulnerable during use.
  9141. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  9142. # this round. If successful, negates them this round.
  9143. # Does double damage and has perfect accuracy if the target is Minimized.
  9144. ################################################################################
  9145. class PokeBattle_Move_14D < PokeBattle_Move
  9146. def pbTwoTurnAttack(attacker)
  9147. @immediate=false
  9148. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9149. @immediate=true
  9150. end
  9151. return false if @immediate
  9152. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9153. end
  9154.  
  9155. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9156. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9157. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9158. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  9159. end
  9160. if @immediate
  9161. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9162. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9163. attacker.pbConsumeItem
  9164. end
  9165. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9166. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9167. if ret>0
  9168. opponent.effects[PBEffects::ProtectNegation]=true
  9169. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  9170. end
  9171. return ret
  9172. end
  9173.  
  9174. def tramplesMinimize?(param=1)
  9175. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  9176. return true if param==2 # Double damage
  9177. return false
  9178. end
  9179. end
  9180.  
  9181.  
  9182.  
  9183. ################################################################################
  9184. # Two turn attack. Skips first turn, increases the user's Special Attack,
  9185. # Special Defense and Speed by 2 stages each second turn. (Geomancy)
  9186. ################################################################################
  9187. class PokeBattle_Move_14E < PokeBattle_Move
  9188. def pbTwoTurnAttack(attacker)
  9189. @immediate=false
  9190. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9191. @immediate=true
  9192. end
  9193. return false if @immediate
  9194. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9195. end
  9196.  
  9197. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9198. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9199. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9200. @battle.pbDisplay(_INTL("{1} is absorbing power!",attacker.pbThis))
  9201. end
  9202. if @immediate
  9203. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9204. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9205. attacker.pbConsumeItem
  9206. end
  9207. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9208. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  9209. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  9210. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9211. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  9212. return -1
  9213. end
  9214. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9215. showanim=true
  9216. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  9217. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  9218. showanim=false
  9219. end
  9220. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  9221. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self,showanim)
  9222. showanim=false
  9223. end
  9224. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9225. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  9226. showanim=false
  9227. end
  9228. return 0
  9229. end
  9230. end
  9231.  
  9232.  
  9233.  
  9234. ################################################################################
  9235. # User gains 3/4 the HP it inflicts as damage. (Draining Kiss, Oblivion Wing)
  9236. ################################################################################
  9237. class PokeBattle_Move_14F < PokeBattle_Move
  9238. def isHealingMove?
  9239. return USENEWBATTLEMECHANICS
  9240. end
  9241.  
  9242. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9243. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9244. if opponent.damagestate.calcdamage>0
  9245. hpgain=(opponent.damagestate.hplost*3/4).round
  9246. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  9247. attacker.pbReduceHP(hpgain,true)
  9248. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  9249. elsif attacker.effects[PBEffects::HealBlock]==0
  9250. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  9251. attacker.pbRecoverHP(hpgain,true)
  9252. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  9253. end
  9254. end
  9255. return ret
  9256. end
  9257. end
  9258.  
  9259.  
  9260.  
  9261. ################################################################################
  9262. # If this move KO's the target, increases the user's Attack by 2 stages.
  9263. # (Fell Stinger)
  9264. ################################################################################
  9265. class PokeBattle_Move_150 < PokeBattle_Move
  9266. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9267. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9268. if opponent.damagestate.calcdamage>0 && opponent.fainted?
  9269. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  9270. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  9271. end
  9272. end
  9273. return ret
  9274. end
  9275. end
  9276.  
  9277.  
  9278.  
  9279. ################################################################################
  9280. # Decreases the target's Attack and Special Attack by 1 stage each. Then, user
  9281. # switches out. Ignores trapping moves. (Parting Shot)
  9282. # TODO: Pursuit should interrupt this move.
  9283. ################################################################################
  9284. class PokeBattle_Move_151 < PokeBattle_Move
  9285. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9286. ret=-1
  9287. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9288. if !self.isSoundBased? ||
  9289. attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SOUNDPROOF)
  9290. showanim=true
  9291. if opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  9292. showanim=false; ret=0
  9293. end
  9294. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  9295. showanim=false; ret=0
  9296. end
  9297. end
  9298. if !attacker.fainted? &&
  9299. @battle.pbCanChooseNonActive?(attacker.index) &&
  9300. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  9301. attacker.effects[PBEffects::Uturn]=true; ret=0
  9302. end
  9303. return ret
  9304. end
  9305. end
  9306.  
  9307.  
  9308.  
  9309. ################################################################################
  9310. # No Pokémon can switch out or flee until the end of the next round, as long as
  9311. # the user remains active. (Fairy Lock)
  9312. ################################################################################
  9313. class PokeBattle_Move_152 < PokeBattle_Move
  9314. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9315. if @battle.field.effects[PBEffects::FairyLock]>0
  9316. @battle.pbDisplay(_INTL("But it failed!"))
  9317. return -1
  9318. end
  9319. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9320. @battle.field.effects[PBEffects::FairyLock]=2
  9321. @battle.pbDisplay(_INTL("No one will be able to run away during the next turn!"))
  9322. return 0
  9323. end
  9324. end
  9325.  
  9326.  
  9327.  
  9328. ################################################################################
  9329. # Entry hazard. Lays stealth rocks on the opposing side. (Sticky Web)
  9330. ################################################################################
  9331. class PokeBattle_Move_153 < PokeBattle_Move
  9332. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9333. if attacker.pbOpposingSide.effects[PBEffects::StickyWeb]
  9334. @battle.pbDisplay(_INTL("But it failed!"))
  9335. return -1
  9336. end
  9337. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9338. attacker.pbOpposingSide.effects[PBEffects::StickyWeb]=true
  9339. if !@battle.pbIsOpposing?(attacker.index)
  9340. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath the opposing team's feet!"))
  9341. else
  9342. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath your team's feet!"))
  9343. end
  9344. return 0
  9345. end
  9346. end
  9347.  
  9348.  
  9349.  
  9350. ################################################################################
  9351. # For 5 rounds, creates an electric terrain which boosts Electric-type moves and
  9352. # prevents Pokémon from falling asleep. Affects non-airborne Pokémon only.
  9353. # (Electric Terrain)
  9354. ################################################################################
  9355. class PokeBattle_Move_154 < PokeBattle_Move
  9356. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9357. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  9358. @battle.pbDisplay(_INTL("But it failed!"))
  9359. return -1
  9360. end
  9361. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9362. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9363. @battle.field.effects[PBEffects::MistyTerrain]=0
  9364. @battle.field.effects[PBEffects::ElectricTerrain]=5
  9365. @battle.pbDisplay(_INTL("An electric current runs across the battlefield!"))
  9366. return 0
  9367. end
  9368. end
  9369.  
  9370.  
  9371.  
  9372. ################################################################################
  9373. # For 5 rounds, creates a grassy terrain which boosts Grass-type moves and heals
  9374. # Pokémon at the end of each round. Affects non-airborne Pokémon only.
  9375. # (Grassy Terrain)
  9376. ################################################################################
  9377. class PokeBattle_Move_155 < PokeBattle_Move
  9378. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9379. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  9380. @battle.pbDisplay(_INTL("But it failed!"))
  9381. return -1
  9382. end
  9383. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9384. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9385. @battle.field.effects[PBEffects::MistyTerrain]=0
  9386. @battle.field.effects[PBEffects::GrassyTerrain]=5
  9387. @battle.pbDisplay(_INTL("Grass grew to cover the battlefield!"))
  9388. return 0
  9389. end
  9390. end
  9391.  
  9392.  
  9393.  
  9394. ################################################################################
  9395. # For 5 rounds, creates a misty terrain which weakens Dragon-type moves and
  9396. # protects Pokémon from status problems. Affects non-airborne Pokémon only.
  9397. # (Misty Terrain)
  9398. ################################################################################
  9399. class PokeBattle_Move_156 < PokeBattle_Move
  9400. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9401. if @battle.field.effects[PBEffects::MistyTerrain]>0
  9402. @battle.pbDisplay(_INTL("But it failed!"))
  9403. return -1
  9404. end
  9405. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9406. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9407. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9408. @battle.field.effects[PBEffects::MistyTerrain]=5
  9409. @battle.pbDisplay(_INTL("Mist swirled about the battlefield!"))
  9410. return 0
  9411. end
  9412. end
  9413.  
  9414.  
  9415.  
  9416. ################################################################################
  9417. # Doubles the prize money the player gets after winning the battle. (Happy Hour)
  9418. ################################################################################
  9419. class PokeBattle_Move_157 < PokeBattle_Move
  9420. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9421. if @battle.pbIsOpposing?(attacker.index) || @battle.doublemoney
  9422. @battle.pbDisplay(_INTL("But it failed!"))
  9423. return -1
  9424. end
  9425. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9426. @battle.doublemoney=true
  9427. @battle.pbDisplay(_INTL("Everyone is caught up in the happy atmosphere!"))
  9428. return 0
  9429. end
  9430. end
  9431.  
  9432.  
  9433.  
  9434. ################################################################################
  9435. # Fails unless user has consumed a berry at some point. (Belch)
  9436. ################################################################################
  9437. class PokeBattle_Move_158 < PokeBattle_Move
  9438. def pbMoveFailed(attacker,opponent)
  9439. return !attacker.pokemon || !attacker.pokemon.belch
  9440. end
  9441. end
  9442.  
  9443.  
  9444.  
  9445. #===============================================================================
  9446. # NOTE: If you're inventing new move effects, use function code 159 and onwards.
  9447. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement