Advertisement
Guest User

Untitled

a guest
Apr 15th, 2017
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 390.45 KB | None | 0 0
  1. ################################################################################
  2. # Superclass that handles moves using a non-existent function code.
  3. # Damaging moves just do damage with no additional effect.
  4. # Non-damaging moves always fail.
  5. ################################################################################
  6. class PokeBattle_UnimplementedMove < PokeBattle_Move
  7. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8. if pbIsDamaging?
  9. return super(attacker,opponent,hitnum,alltargets,showanimation)
  10. else
  11. @battle.pbDisplay("But it failed!")
  12. return -1
  13. end
  14. end
  15. end
  16.  
  17.  
  18.  
  19. ################################################################################
  20. # Superclass for a failed move. Always fails.
  21. # This class is unused.
  22. ################################################################################
  23. class PokeBattle_FailedMove < PokeBattle_Move
  24. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  25. @battle.pbDisplay("But it failed!")
  26. return -1
  27. end
  28. end
  29.  
  30.  
  31.  
  32. ################################################################################
  33. # Pseudomove for confusion damage.
  34. ################################################################################
  35. class PokeBattle_Confusion < PokeBattle_Move
  36. def initialize(battle,move)
  37. @battle = battle
  38. @basedamage = 40
  39. @type = -1
  40. @accuracy = 100
  41. @pp = -1
  42. @addlEffect = 0
  43. @target = 0
  44. @priority = 0
  45. @flags = 0
  46. @thismove = move
  47. @name = ""
  48. @id = 0
  49. end
  50.  
  51. def pbIsPhysical?(type); return true; end
  52. def pbIsSpecial?(type); return false; end
  53.  
  54. def pbCalcDamage(attacker,opponent)
  55. return super(attacker,opponent,
  56. PokeBattle_Move::NOCRITICAL|PokeBattle_Move::SELFCONFUSE|PokeBattle_Move::NOTYPE|PokeBattle_Move::NOWEIGHTING)
  57. end
  58.  
  59. def pbEffectMessages(attacker,opponent,ignoretype=false)
  60. return super(attacker,opponent,true)
  61. end
  62. end
  63.  
  64.  
  65.  
  66. ################################################################################
  67. # Implements the move Struggle.
  68. # For cases where the real move named Struggle is not defined.
  69. ################################################################################
  70. class PokeBattle_Struggle < PokeBattle_Move
  71. def initialize(battle,move)
  72. @id = -1 # doesn't work if 0
  73. @battle = battle
  74. @name = _INTL("Struggle")
  75. @basedamage = 50
  76. @type = -1
  77. @accuracy = 0
  78. @addlEffect = 0
  79. @target = 0
  80. @priority = 0
  81. @flags = 0
  82. @thismove = nil # not associated with a move
  83. @pp = -1
  84. @totalpp = 0
  85. if move
  86. @id = move.id
  87. @name = PBMoves.getName(id)
  88. end
  89. end
  90.  
  91. def pbIsPhysical?(type); return true; end
  92. def pbIsSpecial?(type); return false; end
  93.  
  94. def pbEffectAfterHit(attacker,opponent,turneffects)
  95. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  96. attacker.pbReduceHP((attacker.totalhp/4.0).round)
  97. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  98. end
  99. end
  100.  
  101. def pbCalcDamage(attacker,opponent)
  102. return super(attacker,opponent,PokeBattle_Move::IGNOREPKMNTYPES)
  103. end
  104. end
  105.  
  106.  
  107.  
  108. ################################################################################
  109. # No additional effect.
  110. ################################################################################
  111. class PokeBattle_Move_000 < PokeBattle_Move
  112. end
  113.  
  114.  
  115.  
  116. ################################################################################
  117. # Does absolutely nothing. (Splash)
  118. ################################################################################
  119. class PokeBattle_Move_001 < PokeBattle_Move
  120. def unusableInGravity?
  121. return true
  122. end
  123.  
  124. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  125. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  126. @battle.pbDisplay(_INTL("But nothing happened!"))
  127. return 0
  128. end
  129. end
  130.  
  131.  
  132.  
  133. ################################################################################
  134. # Struggle. Overrides the default Struggle effect above.
  135. ################################################################################
  136. class PokeBattle_Move_002 < PokeBattle_Struggle
  137. end
  138.  
  139.  
  140.  
  141. ################################################################################
  142. # Puts the target to sleep.
  143. ################################################################################
  144. class PokeBattle_Move_003 < PokeBattle_Move
  145. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  146. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  147. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  148. if opponent.pbCanSleep?(attacker,true,self)
  149. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  150. opponent.pbSleep
  151. return 0
  152. end
  153. return -1
  154. end
  155.  
  156. def pbAdditionalEffect(attacker,opponent)
  157. return if opponent.damagestate.substitute
  158. if opponent.pbCanSleep?(attacker,false,self)
  159. opponent.pbSleep
  160. end
  161. end
  162.  
  163. def pbEffectAfterHit(attacker,opponent,turneffects)
  164. if isConst?(@id,PBMoves,:RELICSONG)
  165. if isConst?(attacker.species,PBSpecies,:MELOETTA) &&
  166. !attacker.effects[PBEffects::Transform] &&
  167. !(attacker.hasWorkingAbility(:SHEERFORCE) && self.addlEffect>0) &&
  168. !attacker.isFainted?
  169. attacker.form=(attacker.form+1)%2
  170. attacker.pbUpdate(true)
  171. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  172. @battle.pbDisplay(_INTL("{1} transformed!",attacker.pbThis))
  173. PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
  174. end
  175. end
  176. end
  177. end
  178.  
  179.  
  180.  
  181. ################################################################################
  182. # Makes the target drowsy; it will fall asleep at the end of the next turn. (Yawn)
  183. ################################################################################
  184. class PokeBattle_Move_004 < PokeBattle_Move
  185. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  186. return -1 if !opponent.pbCanSleep?(attacker,true,self)
  187. if opponent.effects[PBEffects::Yawn]>0
  188. @battle.pbDisplay(_INTL("But it failed!"))
  189. return -1
  190. end
  191. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  192. opponent.effects[PBEffects::Yawn]=2
  193. @battle.pbDisplay(_INTL("{1} made {2} drowsy!",attacker.pbThis,opponent.pbThis(true)))
  194. return 0
  195. end
  196. end
  197.  
  198.  
  199.  
  200. ################################################################################
  201. # Poisons the target.
  202. ################################################################################
  203. class PokeBattle_Move_005 < PokeBattle_Move
  204. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  205. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  206. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  207. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  208. opponent.pbPoison(attacker)
  209. return 0
  210. end
  211.  
  212. def pbAdditionalEffect(attacker,opponent)
  213. return if opponent.damagestate.substitute
  214. if opponent.pbCanPoison?(attacker,false,self)
  215. opponent.pbPoison(attacker)
  216. end
  217. end
  218. end
  219.  
  220.  
  221.  
  222. ################################################################################
  223. # Badly poisons the target. (Poison Fang, Toxic)
  224. # (Handled in Battler's pbSuccessCheck): Hits semi-invulnerable targets if user
  225. # is Poison-type and move is status move.
  226. ################################################################################
  227. class PokeBattle_Move_006 < PokeBattle_Move
  228. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  229. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  230. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  231. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  232. opponent.pbPoison(attacker,nil,true)
  233. return 0
  234. end
  235.  
  236. def pbAdditionalEffect(attacker,opponent)
  237. return if opponent.damagestate.substitute
  238. if opponent.pbCanPoison?(attacker,false,self)
  239. opponent.pbPoison(attacker,nil,true)
  240. end
  241. end
  242. end
  243.  
  244.  
  245.  
  246. ################################################################################
  247. # Paralyzes the target.
  248. # Thunder Wave: Doesn't affect target if move's type has no effect on it.
  249. # Bolt Strike: Powers up the next Fusion Flare used this round.
  250. ################################################################################
  251. class PokeBattle_Move_007 < PokeBattle_Move
  252. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  253. if pbIsDamaging?
  254. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  255. if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BOLTSTRIKE)
  256. @battle.field.effects[PBEffects::FusionFlare]=true
  257. end
  258. return ret
  259. else
  260. if isConst?(@id,PBMoves,:THUNDERWAVE)
  261. if pbTypeModifier(type,attacker,opponent)==0
  262. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  263. return -1
  264. end
  265. end
  266. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  267. return -1 if !opponent.pbCanParalyze?(attacker,true,self)
  268. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  269. opponent.pbParalyze(attacker)
  270. return 0
  271. end
  272. return -1
  273. end
  274.  
  275. def pbAdditionalEffect(attacker,opponent)
  276. return if opponent.damagestate.substitute
  277. if opponent.pbCanParalyze?(attacker,false,self)
  278. opponent.pbParalyze(attacker)
  279. end
  280. end
  281. end
  282.  
  283.  
  284.  
  285. ################################################################################
  286. # Paralyzes the target. Accuracy perfect in rain, 50% in sunshine. (Thunder)
  287. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  288. ################################################################################
  289. class PokeBattle_Move_008 < PokeBattle_Move
  290. def pbAdditionalEffect(attacker,opponent)
  291. return if opponent.damagestate.substitute
  292. if opponent.pbCanParalyze?(attacker,false,self)
  293. opponent.pbParalyze(attacker)
  294. end
  295. end
  296.  
  297. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  298. case @battle.pbWeather
  299. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  300. return 0
  301. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  302. return 50
  303. end
  304. return baseaccuracy
  305. end
  306. end
  307.  
  308.  
  309.  
  310. ################################################################################
  311. # Paralyzes the target. May cause the target to flinch. (Thunder Fang)
  312. ################################################################################
  313. class PokeBattle_Move_009 < PokeBattle_Move
  314. def pbAdditionalEffect(attacker,opponent)
  315. return if opponent.damagestate.substitute
  316. if @battle.pbRandom(10)==0
  317. if opponent.pbCanParalyze?(attacker,false,self)
  318. opponent.pbParalyze(attacker)
  319. end
  320. end
  321. if @battle.pbRandom(10)==0
  322. opponent.pbFlinch(attacker)
  323. end
  324. end
  325. end
  326.  
  327.  
  328.  
  329. ################################################################################
  330. # Burns the target.
  331. # Blue Flare: Powers up the next Fusion Bolt used this round.
  332. ################################################################################
  333. class PokeBattle_Move_00A < PokeBattle_Move
  334. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  335. if pbIsDamaging?
  336. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  337. if opponent.damagestate.calcdamage>0 && isConst?(@id,PBMoves,:BLUEFLARE)
  338. @battle.field.effects[PBEffects::FusionBolt]=true
  339. end
  340. return ret
  341. else
  342. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  343. return -1 if !opponent.pbCanBurn?(attacker,true,self)
  344. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  345. opponent.pbBurn(attacker)
  346. return 0
  347. end
  348. return -1
  349. end
  350.  
  351. def pbAdditionalEffect(attacker,opponent)
  352. return if opponent.damagestate.substitute
  353. if opponent.pbCanBurn?(attacker,false,self)
  354. opponent.pbBurn(attacker)
  355. end
  356. end
  357. end
  358.  
  359.  
  360.  
  361. ################################################################################
  362. # Burns the target. May cause the target to flinch. (Fire Fang)
  363. ################################################################################
  364. class PokeBattle_Move_00B < PokeBattle_Move
  365. def pbAdditionalEffect(attacker,opponent)
  366. return if opponent.damagestate.substitute
  367. if @battle.pbRandom(10)==0
  368. if opponent.pbCanBurn?(attacker,false,self)
  369. opponent.pbBurn(attacker)
  370. end
  371. end
  372. if @battle.pbRandom(10)==0
  373. opponent.pbFlinch(attacker)
  374. end
  375. end
  376. end
  377.  
  378.  
  379.  
  380. ################################################################################
  381. # Freezes the target.
  382. ################################################################################
  383. class PokeBattle_Move_00C < PokeBattle_Move
  384. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  385. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  386. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  387. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  388. opponent.pbFreeze
  389. return 0
  390. end
  391.  
  392. def pbAdditionalEffect(attacker,opponent)
  393. return if opponent.damagestate.substitute
  394. if opponent.pbCanFreeze?(attacker,false,self)
  395. opponent.pbFreeze
  396. end
  397. end
  398. end
  399.  
  400.  
  401.  
  402. ################################################################################
  403. # Freezes the target. Accuracy perfect in hail. (Blizzard)
  404. ################################################################################
  405. class PokeBattle_Move_00D < PokeBattle_Move
  406. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  407. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  408. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  409. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  410. opponent.pbFreeze
  411. return 0
  412. end
  413.  
  414. def pbAdditionalEffect(attacker,opponent)
  415. return if opponent.damagestate.substitute
  416. if opponent.pbCanFreeze?(attacker,false,self)
  417. opponent.pbFreeze
  418. end
  419. end
  420.  
  421. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  422. if @battle.pbWeather==PBWeather::HAIL
  423. return 0
  424. end
  425. return baseaccuracy
  426. end
  427. end
  428.  
  429.  
  430.  
  431. ################################################################################
  432. # Freezes the target. May cause the target to flinch. (Ice Fang)
  433. ################################################################################
  434. class PokeBattle_Move_00E < PokeBattle_Move
  435. def pbAdditionalEffect(attacker,opponent)
  436. return if opponent.damagestate.substitute
  437. if @battle.pbRandom(10)==0
  438. if opponent.pbCanFreeze?(attacker,false,self)
  439. opponent.pbFreeze
  440. end
  441. end
  442. if @battle.pbRandom(10)==0
  443. opponent.pbFlinch(attacker)
  444. end
  445. end
  446. end
  447.  
  448.  
  449.  
  450. ################################################################################
  451. # Causes the target to flinch.
  452. ################################################################################
  453. class PokeBattle_Move_00F < PokeBattle_Move
  454. def pbAdditionalEffect(attacker,opponent)
  455. return if opponent.damagestate.substitute
  456. opponent.pbFlinch(attacker)
  457. end
  458. end
  459.  
  460.  
  461.  
  462. ################################################################################
  463. # Causes the target to flinch. Does double damage and has perfect accuracy if
  464. # the target is Minimized.
  465. ################################################################################
  466. class PokeBattle_Move_010 < PokeBattle_Move
  467. def pbAdditionalEffect(attacker,opponent)
  468. return if opponent.damagestate.substitute
  469. opponent.pbFlinch(attacker)
  470. end
  471.  
  472. def tramplesMinimize?(param=1)
  473. return false if isConst?(@id,PBMoves,:DRAGONRUSH) && !USENEWBATTLEMECHANICS
  474. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  475. return true if param==2 # Double damage
  476. return false
  477. end
  478. end
  479.  
  480.  
  481.  
  482. ################################################################################
  483. # Causes the target to flinch. Fails if the user is not asleep. (Snore)
  484. ################################################################################
  485. class PokeBattle_Move_011 < PokeBattle_Move
  486. def pbCanUseWhileAsleep?
  487. return true
  488. end
  489.  
  490. def pbMoveFailed(attacker,opponent)
  491. return (attacker.status!=PBStatuses::SLEEP)
  492. end
  493.  
  494. def pbAdditionalEffect(attacker,opponent)
  495. return if opponent.damagestate.substitute
  496. opponent.pbFlinch(attacker)
  497. end
  498. end
  499.  
  500.  
  501.  
  502. ################################################################################
  503. # Causes the target to flinch. Fails if this isn't the user's first turn. (Fake Out)
  504. ################################################################################
  505. class PokeBattle_Move_012 < PokeBattle_Move
  506. def pbMoveFailed(attacker,opponent)
  507. return (attacker.turncount>1)
  508. end
  509.  
  510. def pbAdditionalEffect(attacker,opponent)
  511. return if opponent.damagestate.substitute
  512. opponent.pbFlinch(attacker)
  513. end
  514. end
  515.  
  516.  
  517.  
  518. ################################################################################
  519. # Confuses the target.
  520. ################################################################################
  521. class PokeBattle_Move_013 < PokeBattle_Move
  522. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  523. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  524. if opponent.pbCanConfuse?(attacker,true,self)
  525. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  526. opponent.pbConfuse
  527. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  528. return 0
  529. end
  530. return -1
  531. end
  532.  
  533. def pbAdditionalEffect(attacker,opponent)
  534. return if opponent.damagestate.substitute
  535. if opponent.pbCanConfuse?(attacker,false,self)
  536. opponent.pbConfuse
  537. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  538. end
  539. end
  540. end
  541.  
  542.  
  543.  
  544. ################################################################################
  545. # Confuses the target. Chance of causing confusion depends on the cry's volume.
  546. # Confusion chance is 0% if user doesn't have a recorded cry. (Chatter)
  547. # TODO: Play the actual chatter cry as part of the move animation
  548. # @battle.scene.pbChatter(attacker,opponent) # Just plays cry
  549. ################################################################################
  550. class PokeBattle_Move_014 < PokeBattle_Move
  551. def addlEffect
  552. return 100 if USENEWBATTLEMECHANICS
  553. if attacker.pokemon && attacker.pokemon.chatter
  554. return attacker.pokemon.chatter.intensity*10/127
  555. end
  556. return 0
  557. end
  558.  
  559. def pbAdditionalEffect(attacker,opponent)
  560. return if opponent.damagestate.substitute
  561. if opponent.pbCanConfuse?(attacker,false,self)
  562. opponent.pbConfuse
  563. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  564. end
  565. end
  566. end
  567.  
  568.  
  569.  
  570. ################################################################################
  571. # Confuses the target. Accuracy perfect in rain, 50% in sunshine. (Hurricane)
  572. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  573. ################################################################################
  574. class PokeBattle_Move_015 < PokeBattle_Move
  575. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  576. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  577. if opponent.pbCanConfuse?(attacker,true,self)
  578. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  579. opponent.pbConfuse
  580. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  581. return 0
  582. end
  583. return -1
  584. end
  585.  
  586. def pbAdditionalEffect(attacker,opponent)
  587. return if opponent.damagestate.substitute
  588. if opponent.pbCanConfuse?(attacker,false,self)
  589. opponent.pbConfuse
  590. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  591. end
  592. end
  593.  
  594. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  595. case @battle.pbWeather
  596. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  597. return 0
  598. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  599. return 50
  600. end
  601. return baseaccuracy
  602. end
  603. end
  604.  
  605.  
  606.  
  607. ################################################################################
  608. # Attracts the target. (Attract)
  609. ################################################################################
  610. class PokeBattle_Move_016 < PokeBattle_Move
  611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  612. if !opponent.pbCanAttract?(attacker)
  613. return -1
  614. end
  615. if !attacker.hasMoldBreaker
  616. if opponent.hasWorkingAbility(:AROMAVEIL)
  617. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  618. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  619. return -1
  620. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  621. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  622. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  623. return -1
  624. end
  625. end
  626. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  627. opponent.pbAttract(attacker)
  628. return 0
  629. end
  630. end
  631.  
  632.  
  633.  
  634. ################################################################################
  635. # Burns, freezes or paralyzes the target. (Tri Attack)
  636. ################################################################################
  637. class PokeBattle_Move_017 < PokeBattle_Move
  638. def pbAdditionalEffect(attacker,opponent)
  639. return if opponent.damagestate.substitute
  640. case @battle.pbRandom(3)
  641. when 0
  642. if opponent.pbCanBurn?(attacker,false,self)
  643. opponent.pbBurn(attacker)
  644. end
  645. when 1
  646. if opponent.pbCanFreeze?(attacker,false,self)
  647. opponent.pbFreeze
  648. end
  649. when 2
  650. if opponent.pbCanParalyze?(attacker,false,self)
  651. opponent.pbParalyze(attacker)
  652. end
  653. end
  654. end
  655. end
  656.  
  657.  
  658.  
  659. ################################################################################
  660. # Cures user of burn, poison and paralysis. (Refresh)
  661. ################################################################################
  662. class PokeBattle_Move_018 < PokeBattle_Move
  663. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  664. if attacker.status!=PBStatuses::BURN &&
  665. attacker.status!=PBStatuses::POISON &&
  666. attacker.status!=PBStatuses::PARALYSIS
  667. @battle.pbDisplay(_INTL("But it failed!"))
  668. return -1
  669. else
  670. t=attacker.status
  671. attacker.pbCureStatus(false)
  672. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  673. if t==PBStatuses::BURN
  674. @battle.pbDisplay(_INTL("{1} healed its burn!",attacker.pbThis))
  675. elsif t==PBStatuses::POISON
  676. @battle.pbDisplay(_INTL("{1} cured its poisoning!",attacker.pbThis))
  677. elsif t==PBStatuses::PARALYSIS
  678. @battle.pbDisplay(_INTL("{1} cured its paralysis!",attacker.pbThis))
  679. end
  680. return 0
  681. end
  682. end
  683. end
  684.  
  685.  
  686.  
  687. ################################################################################
  688. # Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
  689. ################################################################################
  690. class PokeBattle_Move_019 < PokeBattle_Move
  691. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  692. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  693. if isConst?(@id,PBMoves,:AROMATHERAPY)
  694. @battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
  695. else
  696. @battle.pbDisplay(_INTL("A bell chimed!"))
  697. end
  698. activepkmn=[]
  699. for i in @battle.battlers
  700. next if attacker.pbIsOpposing?(i.index) || i.isFainted?
  701. activepkmn.push(i.pokemonIndex)
  702. next if USENEWBATTLEMECHANICS && i.index!=attacker.index &&
  703. pbTypeImmunityByAbility(pbType(@type,attacker,i),attacker,i)
  704. case i.status
  705. when PBStatuses::PARALYSIS
  706. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",i.pbThis))
  707. when PBStatuses::SLEEP
  708. @battle.pbDisplay(_INTL("{1}'s sleep was woken.",i.pbThis))
  709. when PBStatuses::POISON
  710. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",i.pbThis))
  711. when PBStatuses::BURN
  712. @battle.pbDisplay(_INTL("{1}'s burn was healed.",i.pbThis))
  713. when PBStatuses::FROZEN
  714. @battle.pbDisplay(_INTL("{1} was thawed out.",i.pbThis))
  715. end
  716. i.pbCureStatus(false)
  717. end
  718. party=@battle.pbParty(attacker.index) # NOTE: Considers both parties in multi battles
  719. for i in 0...party.length
  720. next if activepkmn.include?(i)
  721. next if !party[i] || party[i].isEgg? || party[i].hp<=0
  722. case party[i].status
  723. when PBStatuses::PARALYSIS
  724. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",party[i].name))
  725. when PBStatuses::SLEEP
  726. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",party[i].name))
  727. when PBStatuses::POISON
  728. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",party[i].name))
  729. when PBStatuses::BURN
  730. @battle.pbDisplay(_INTL("{1}'s burn was healed.",party[i].name))
  731. when PBStatuses::FROZEN
  732. @battle.pbDisplay(_INTL("{1} was thawed out.",party[i].name))
  733. end
  734. party[i].status=0
  735. party[i].statusCount=0
  736. end
  737. return 0
  738. end
  739. end
  740.  
  741.  
  742.  
  743. ################################################################################
  744. # Safeguards the user's side from being inflicted with status problems. (Safeguard)
  745. ################################################################################
  746. class PokeBattle_Move_01A < PokeBattle_Move
  747. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  748. if attacker.pbOwnSide.effects[PBEffects::Safeguard]>0
  749. @battle.pbDisplay(_INTL("But it failed!"))
  750. return -1
  751. end
  752. attacker.pbOwnSide.effects[PBEffects::Safeguard]=5
  753. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  754. if !@battle.pbIsOpposing?(attacker.index)
  755. @battle.pbDisplay(_INTL("Your team became cloaked in a mystical veil!"))
  756. else
  757. @battle.pbDisplay(_INTL("The opposing team became cloaked in a mystical veil!"))
  758. end
  759. return 0
  760. end
  761. end
  762.  
  763.  
  764.  
  765. ################################################################################
  766. # User passes its status problem to the target. (Psycho Shift)
  767. ################################################################################
  768. class PokeBattle_Move_01B < PokeBattle_Move
  769. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  770. if attacker.status==0 ||
  771. (attacker.status==PBStatuses::PARALYSIS && !opponent.pbCanParalyze?(attacker,false,self)) ||
  772. (attacker.status==PBStatuses::SLEEP && !opponent.pbCanSleep?(attacker,false,self)) ||
  773. (attacker.status==PBStatuses::POISON && !opponent.pbCanPoison?(attacker,false,self)) ||
  774. (attacker.status==PBStatuses::BURN && !opponent.pbCanBurn?(attacker,false,self)) ||
  775. (attacker.status==PBStatuses::FROZEN && !opponent.pbCanFreeze?(attacker,false,self))
  776. @battle.pbDisplay(_INTL("But it failed!"))
  777. return -1
  778. end
  779. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  780. case attacker.status
  781. when PBStatuses::PARALYSIS
  782. opponent.pbParalyze(attacker)
  783. opponent.pbAbilityCureCheck
  784. attacker.pbCureStatus(false)
  785. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",attacker.pbThis))
  786. when PBStatuses::SLEEP
  787. opponent.pbSleep
  788. opponent.pbAbilityCureCheck
  789. attacker.pbCureStatus(false)
  790. @battle.pbDisplay(_INTL("{1} woke up.",attacker.pbThis))
  791. when PBStatuses::POISON
  792. opponent.pbPoison(attacker,nil,attacker.statusCount!=0)
  793. opponent.pbAbilityCureCheck
  794. attacker.pbCureStatus(false)
  795. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  796. when PBStatuses::BURN
  797. opponent.pbBurn(attacker)
  798. opponent.pbAbilityCureCheck
  799. attacker.pbCureStatus(false)
  800. @battle.pbDisplay(_INTL("{1}'s burn was healed.",attacker.pbThis))
  801. when PBStatuses::FROZEN
  802. opponent.pbFreeze
  803. opponent.pbAbilityCureCheck
  804. attacker.pbCureStatus(false)
  805. @battle.pbDisplay(_INTL("{1} was thawed out.",attacker.pbThis))
  806. end
  807. return 0
  808. end
  809. end
  810.  
  811.  
  812.  
  813. ################################################################################
  814. # Increases the user's Attack by 1 stage.
  815. ################################################################################
  816. class PokeBattle_Move_01C < PokeBattle_Move
  817. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  818. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  819. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  820. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  821. ret=attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  822. return ret ? 0 : -1
  823. end
  824.  
  825. def pbAdditionalEffect(attacker,opponent)
  826. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  827. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  828. end
  829. end
  830. end
  831.  
  832.  
  833.  
  834. ################################################################################
  835. # Increases the user's Defense by 1 stage.
  836. ################################################################################
  837. class PokeBattle_Move_01D < PokeBattle_Move
  838. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  839. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  840. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  841. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  842. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  843. return ret ? 0 : -1
  844. end
  845.  
  846. def pbAdditionalEffect(attacker,opponent)
  847. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  848. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  849. end
  850. end
  851. end
  852.  
  853.  
  854.  
  855. ################################################################################
  856. # Increases the user's Defense by 1 stage. User curls up. (Defense Curl)
  857. ################################################################################
  858. class PokeBattle_Move_01E < PokeBattle_Move
  859. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  860. attacker.effects[PBEffects::DefenseCurl]=true
  861. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  862. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  863. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  864. return ret ? 0 : -1
  865. end
  866. end
  867.  
  868.  
  869.  
  870. ################################################################################
  871. # Increases the user's Speed by 1 stage.
  872. ################################################################################
  873. class PokeBattle_Move_01F < PokeBattle_Move
  874. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  875. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  876. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  877. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  878. ret=attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  879. return ret ? 0 : -1
  880. end
  881.  
  882. def pbAdditionalEffect(attacker,opponent)
  883. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  884. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  885. end
  886. end
  887. end
  888.  
  889.  
  890.  
  891. ################################################################################
  892. # Increases the user's Special Attack by 1 stage.
  893. ################################################################################
  894. class PokeBattle_Move_020 < PokeBattle_Move
  895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  896. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  897. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  898. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  899. ret=attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  900. return ret ? 0 : -1
  901. end
  902.  
  903. def pbAdditionalEffect(attacker,opponent)
  904. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  905. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  906. end
  907. end
  908. end
  909.  
  910.  
  911.  
  912. ################################################################################
  913. # Increases the user's Special Defense by 1 stage.
  914. # Charges up user's next attack if it is Electric-type. (Charge)
  915. ################################################################################
  916. class PokeBattle_Move_021 < PokeBattle_Move
  917. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  918. attacker.effects[PBEffects::Charge]=2
  919. @battle.pbDisplay(_INTL("{1} began charging power!",attacker.pbThis))
  920. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  921. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  922. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  923. end
  924. return 0
  925. end
  926. end
  927.  
  928.  
  929.  
  930. ################################################################################
  931. # Increases the user's evasion by 1 stage.
  932. ################################################################################
  933. class PokeBattle_Move_022 < PokeBattle_Move
  934. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  935. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  936. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  937. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  938. ret=attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  939. return ret ? 0 : -1
  940. end
  941.  
  942. def pbAdditionalEffect(attacker,opponent)
  943. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  944. attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  945. end
  946. end
  947. end
  948.  
  949.  
  950.  
  951. ################################################################################
  952. # Increases the user's critical hit rate. (Focus Energy)
  953. ################################################################################
  954. class PokeBattle_Move_023 < PokeBattle_Move
  955. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  956. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  957. if attacker.effects[PBEffects::FocusEnergy]>=2
  958. @battle.pbDisplay(_INTL("But it failed!"))
  959. return -1
  960. end
  961. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  962. attacker.effects[PBEffects::FocusEnergy]=2
  963. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  964. return 0
  965. end
  966.  
  967. def pbAdditionalEffect(attacker,opponent)
  968. if attacker.effects[PBEffects::FocusEnergy]<2
  969. attacker.effects[PBEffects::FocusEnergy]=2
  970. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  971. end
  972. end
  973. end
  974.  
  975.  
  976.  
  977. ################################################################################
  978. # Increases the user's Attack and Defense by 1 stage each. (Bulk Up)
  979. ################################################################################
  980. class PokeBattle_Move_024 < PokeBattle_Move
  981. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  982. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  983. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  984. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  985. return -1
  986. end
  987. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  988. showanim=true
  989. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  990. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  991. showanim=false
  992. end
  993. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  994. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  995. showanim=false
  996. end
  997. return 0
  998. end
  999. end
  1000.  
  1001.  
  1002.  
  1003. ################################################################################
  1004. # Increases the user's Attack, Defense and accuracy by 1 stage each. (Coil)
  1005. ################################################################################
  1006. class PokeBattle_Move_025 < PokeBattle_Move
  1007. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1008. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1009. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1010. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1011. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1012. return -1
  1013. end
  1014. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1015. showanim=true
  1016. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1017. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1018. showanim=false
  1019. end
  1020. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1021. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1022. showanim=false
  1023. end
  1024. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1025. attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1026. showanim=false
  1027. end
  1028. return 0
  1029. end
  1030. end
  1031.  
  1032.  
  1033.  
  1034. ################################################################################
  1035. # Increases the user's Attack and Speed by 1 stage each. (Dragon Dance)
  1036. ################################################################################
  1037. class PokeBattle_Move_026 < PokeBattle_Move
  1038. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1039. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1040. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1041. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1042. return -1
  1043. end
  1044. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1045. showanim=true
  1046. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1047. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1048. showanim=false
  1049. end
  1050. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1051. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1052. showanim=false
  1053. end
  1054. return 0
  1055. end
  1056. end
  1057.  
  1058.  
  1059.  
  1060. ################################################################################
  1061. # Increases the user's Attack and Special Attack by 1 stage each. (Work Up)
  1062. ################################################################################
  1063. class PokeBattle_Move_027 < PokeBattle_Move
  1064. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1065. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1066. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1067. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1068. return -1
  1069. end
  1070. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1071. showanim=true
  1072. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1073. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1074. showanim=false
  1075. end
  1076. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1077. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1078. showanim=false
  1079. end
  1080. return 0
  1081. end
  1082. end
  1083.  
  1084.  
  1085.  
  1086. ################################################################################
  1087. # Increases the user's Attack and Sp. Attack by 1 stage each.
  1088. # In sunny weather, increase is 2 stages each instead. (Growth)
  1089. ################################################################################
  1090. class PokeBattle_Move_028 < PokeBattle_Move
  1091. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1092. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1093. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1094. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1095. return -1
  1096. end
  1097. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1098. showanim=true
  1099. increment=1
  1100. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  1101. @battle.pbWeather==PBWeather::HARSHSUN
  1102. increment=2
  1103. end
  1104. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1105. attacker.pbIncreaseStat(PBStats::ATTACK,increment,attacker,false,self,showanim)
  1106. showanim=false
  1107. end
  1108. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1109. attacker.pbIncreaseStat(PBStats::SPATK,increment,attacker,false,self,showanim)
  1110. showanim=false
  1111. end
  1112. return 0
  1113. end
  1114. end
  1115.  
  1116.  
  1117.  
  1118. ################################################################################
  1119. # Increases the user's Attack and accuracy by 1 stage each. (Hone Claws)
  1120. ################################################################################
  1121. class PokeBattle_Move_029 < PokeBattle_Move
  1122. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1123. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  1124. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1125. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1126. return -1
  1127. end
  1128. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1129. showanim=true
  1130. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1131. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1132. showanim=false
  1133. end
  1134. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  1135. attacker.pbIncreaseStat(PBStats::ACCURACY,1,attacker,false,self,showanim)
  1136. showanim=false
  1137. end
  1138. return 0
  1139. end
  1140. end
  1141.  
  1142.  
  1143.  
  1144. ################################################################################
  1145. # Increases the user's Defense and Special Defense by 1 stage each. (Cosmic Power)
  1146. ################################################################################
  1147. class PokeBattle_Move_02A < PokeBattle_Move
  1148. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1149. if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  1150. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1151. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1152. return -1
  1153. end
  1154. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1155. showanim=true
  1156. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1157. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1158. showanim=false
  1159. end
  1160. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1161. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1162. showanim=false
  1163. end
  1164. return 0
  1165. end
  1166. end
  1167.  
  1168.  
  1169.  
  1170. ################################################################################
  1171. # Increases the user's Sp. Attack, Sp. Defense and Speed by 1 stage each. (Quiver Dance)
  1172. ################################################################################
  1173. class PokeBattle_Move_02B < PokeBattle_Move
  1174. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1175. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1176. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  1177. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1178. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1179. return -1
  1180. end
  1181. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1182. showanim=true
  1183. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1184. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1185. showanim=false
  1186. end
  1187. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1188. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1189. showanim=false
  1190. end
  1191. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1192. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1193. showanim=false
  1194. end
  1195. return 0
  1196. end
  1197. end
  1198.  
  1199.  
  1200.  
  1201. ################################################################################
  1202. # Increases the user's Sp. Attack and Sp. Defense by 1 stage each. (Calm Mind)
  1203. ################################################################################
  1204. class PokeBattle_Move_02C < PokeBattle_Move
  1205. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1206. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  1207. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1208. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1209. return -1
  1210. end
  1211. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1212. showanim=true
  1213. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1214. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1215. showanim=false
  1216. end
  1217. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1218. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1219. showanim=false
  1220. end
  1221. return 0
  1222. end
  1223. end
  1224.  
  1225.  
  1226.  
  1227. ################################################################################
  1228. # Increases the user's Attack, Defense, Speed, Special Attack and Special Defense
  1229. # by 1 stage each. (AncientPower, Ominous Wind, Silver Wind)
  1230. ################################################################################
  1231. class PokeBattle_Move_02D < PokeBattle_Move
  1232. def pbAdditionalEffect(attacker,opponent)
  1233. showanim=true
  1234. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1235. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1236. showanim=false
  1237. end
  1238. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1239. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1240. showanim=false
  1241. end
  1242. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1243. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  1244. showanim=false
  1245. end
  1246. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1247. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1248. showanim=false
  1249. end
  1250. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1251. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  1252. showanim=false
  1253. end
  1254. end
  1255. end
  1256.  
  1257.  
  1258.  
  1259. ################################################################################
  1260. # Increases the user's Attack by 2 stages.
  1261. ################################################################################
  1262. class PokeBattle_Move_02E < PokeBattle_Move
  1263. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1264. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1265. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  1266. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1267. ret=attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1268. return ret ? 0 : -1
  1269. end
  1270.  
  1271. def pbAdditionalEffect(attacker,opponent)
  1272. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1273. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1274. end
  1275. end
  1276. end
  1277.  
  1278.  
  1279.  
  1280. ################################################################################
  1281. # Increases the user's Defense by 2 stages.
  1282. ################################################################################
  1283. class PokeBattle_Move_02F < PokeBattle_Move
  1284. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1285. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1286. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1287. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1288. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1289. return ret ? 0 : -1
  1290. end
  1291.  
  1292. def pbAdditionalEffect(attacker,opponent)
  1293. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1294. attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  1295. end
  1296. end
  1297. end
  1298.  
  1299.  
  1300.  
  1301. ################################################################################
  1302. # Increases the user's Speed by 2 stages.
  1303. ################################################################################
  1304. class PokeBattle_Move_030 < PokeBattle_Move
  1305. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1306. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1307. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  1308. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1309. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1310. return ret ? 0 : -1
  1311. end
  1312.  
  1313. 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.isFainted?
  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,:RKSSYSTEM) ||
  2674. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2675. @battle.pbDisplay(_INTL("But it failed!"))
  2676. return -1
  2677. end
  2678. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2679. oldabil=opponent.ability
  2680. opponent.ability=getConst(PBAbilities,:SIMPLE) || 0
  2681. abilityname=PBAbilities.getName(getConst(PBAbilities,:SIMPLE))
  2682. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2683. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2684. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2685. opponent.effects[PBEffects::Illusion]=nil
  2686. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2687. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2688. end
  2689. return 0
  2690. end
  2691. end
  2692.  
  2693.  
  2694.  
  2695. ################################################################################
  2696. # Target's ability becomes Insomnia. (Worry Seed)
  2697. ################################################################################
  2698. class PokeBattle_Move_064 < PokeBattle_Move
  2699. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2700. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2701. @battle.pbDisplay(_INTL("But it failed!"))
  2702. return -1
  2703. end
  2704. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  2705. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2706. isConst?(opponent.ability,PBAbilities,:INSOMNIA) ||
  2707. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2708. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2709. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2710. @battle.pbDisplay(_INTL("But it failed!"))
  2711. return -1
  2712. end
  2713. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2714. oldabil=opponent.ability
  2715. opponent.ability=getConst(PBAbilities,:INSOMNIA) || 0
  2716. abilityname=PBAbilities.getName(getConst(PBAbilities,:INSOMNIA))
  2717. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2718. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2719. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2720. opponent.effects[PBEffects::Illusion]=nil
  2721. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2722. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2723. end
  2724. return 0
  2725. end
  2726. end
  2727.  
  2728.  
  2729.  
  2730. ################################################################################
  2731. # User copies target's ability. (Role Play)
  2732. ################################################################################
  2733. class PokeBattle_Move_065 < PokeBattle_Move
  2734. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2735. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2736. @battle.pbDisplay(_INTL("But it failed!"))
  2737. return -1
  2738. end
  2739. if opponent.ability==0 ||
  2740. attacker.ability==opponent.ability ||
  2741. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2742. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2743. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2744. isConst?(opponent.ability,PBAbilities,:FORECAST) ||
  2745. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2746. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2747. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2748. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2749. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2750. isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2751. isConst?(opponent.ability,PBAbilities,:ZENMODE) ||
  2752. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM)
  2753. @battle.pbDisplay(_INTL("But it failed!"))
  2754. return -1
  2755. end
  2756. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2757. oldabil=attacker.ability
  2758. attacker.ability=opponent.ability
  2759. abilityname=PBAbilities.getName(opponent.ability)
  2760. @battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),abilityname))
  2761. if attacker.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2762. PBDebug.log("[Ability triggered] #{attacker.pbThis}'s Illusion ended")
  2763. attacker.effects[PBEffects::Illusion]=nil
  2764. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  2765. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",attacker.pbThis,PBAbilities.getName(oldabil)))
  2766. end
  2767. return 0
  2768. end
  2769. end
  2770.  
  2771.  
  2772.  
  2773. ################################################################################
  2774. # Target copies user's ability. (Entrainment)
  2775. ################################################################################
  2776. class PokeBattle_Move_066 < PokeBattle_Move
  2777. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2778. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2779. @battle.pbDisplay(_INTL("But it failed!"))
  2780. return -1
  2781. end
  2782. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2783. @battle.pbDisplay(_INTL("But it failed!"))
  2784. return -1
  2785. end
  2786. if attacker.ability==0 ||
  2787. attacker.ability==opponent.ability ||
  2788. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2789. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2790. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2791. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2792. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2793. isConst?(opponent.ability,PBAbilities,:TRUANT) ||
  2794. isConst?(opponent.ability,PBAbilities,:ZENMODE) ||
  2795. isConst?(attacker.ability,PBAbilities,:FLOWERGIFT) ||
  2796. isConst?(attacker.ability,PBAbilities,:FORECAST) ||
  2797. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2798. isConst?(attacker.ability,PBAbilities,:IMPOSTER) ||
  2799. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2800. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2801. isConst?(attacker.ability,PBAbilities,:TRACE) ||
  2802. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2803. isConst?(attacker.ability,PBAbilities,:ZENMODE)
  2804. @battle.pbDisplay(_INTL("But it failed!"))
  2805. return -1
  2806. end
  2807. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2808. oldabil=opponent.ability
  2809. opponent.ability=attacker.ability
  2810. abilityname=PBAbilities.getName(attacker.ability)
  2811. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2812. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2813. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2814. opponent.effects[PBEffects::Illusion]=nil
  2815. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2816. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2817. end
  2818. return 0
  2819. end
  2820. end
  2821.  
  2822.  
  2823.  
  2824. ################################################################################
  2825. # User and target swap abilities. (Skill Swap)
  2826. ################################################################################
  2827. class PokeBattle_Move_067 < PokeBattle_Move
  2828. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2829. if (attacker.ability==0 && opponent.ability==0) ||
  2830. (attacker.ability==opponent.ability && !USENEWBATTLEMECHANICS) ||
  2831. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2832. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2833. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2834. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2835. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2836. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2837. isConst?(attacker.ability,PBAbilities,:RKSSYSTEM) ||
  2838. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2839. isConst?(attacker.ability,PBAbilities,:WONDERGUARD) ||
  2840. isConst?(opponent.ability,PBAbilities,:WONDERGUARD)
  2841. @battle.pbDisplay(_INTL("But it failed!"))
  2842. return -1
  2843. end
  2844. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2845. tmp=attacker.ability
  2846. attacker.ability=opponent.ability
  2847. opponent.ability=tmp
  2848. @battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
  2849. attacker.pbThis,PBAbilities.getName(opponent.ability),
  2850. PBAbilities.getName(attacker.ability)))
  2851. attacker.pbAbilitiesOnSwitchIn(true)
  2852. opponent.pbAbilitiesOnSwitchIn(true)
  2853. return 0
  2854. end
  2855. end
  2856.  
  2857.  
  2858.  
  2859. ################################################################################
  2860. # Target's ability is negated. (Gastro Acid)
  2861. ################################################################################
  2862. class PokeBattle_Move_068 < PokeBattle_Move
  2863. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2864. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2865. @battle.pbDisplay(_INTL("But it failed!"))
  2866. return -1
  2867. end
  2868. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2869. isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
  2870. isConst?(opponent.ability,PBAbilities,:STANCECHANGE)
  2871. @battle.pbDisplay(_INTL("But it failed!"))
  2872. return -1
  2873. end
  2874. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2875. oldabil=opponent.ability
  2876. opponent.effects[PBEffects::GastroAcid]=true
  2877. opponent.effects[PBEffects::Truant]=false
  2878. @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis))
  2879. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2880. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2881. opponent.effects[PBEffects::Illusion]=nil
  2882. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2883. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2884. end
  2885. return 0
  2886. end
  2887. end
  2888.  
  2889.  
  2890.  
  2891. ################################################################################
  2892. # User transforms into the target. (Transform)
  2893. ################################################################################
  2894. class PokeBattle_Move_069 < PokeBattle_Move
  2895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2896. blacklist=[
  2897. 0xC9, # Fly
  2898. 0xCA, # Dig
  2899. 0xCB, # Dive
  2900. 0xCC, # Bounce
  2901. 0xCD, # Shadow Force
  2902. 0xCE, # Sky Drop
  2903. 0x14D # Phantom Force
  2904. ]
  2905. if attacker.effects[PBEffects::Transform] ||
  2906. opponent.effects[PBEffects::Transform] ||
  2907. opponent.effects[PBEffects::Illusion] ||
  2908. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  2909. opponent.effects[PBEffects::SkyDrop] ||
  2910. blacklist.include?(PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function)
  2911. @battle.pbDisplay(_INTL("But it failed!"))
  2912. return -1
  2913. end
  2914. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2915. @battle.pbDisplay(_INTL("But it failed!"))
  2916. return -1
  2917. end
  2918. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2919. attacker.effects[PBEffects::Transform]=true
  2920. attacker.type1=opponent.type1
  2921. attacker.type2=opponent.type2
  2922. attacker.effects[PBEffects::Type3]=-1
  2923. attacker.ability=opponent.ability
  2924. attacker.attack=opponent.attack
  2925. attacker.defense=opponent.defense
  2926. attacker.speed=opponent.speed
  2927. attacker.spatk=opponent.spatk
  2928. attacker.spdef=opponent.spdef
  2929. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2930. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2931. attacker.stages[i]=opponent.stages[i]
  2932. end
  2933. for i in 0...4
  2934. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(
  2935. @battle,PBMove.new(opponent.moves[i].id))
  2936. attacker.moves[i].pp=5
  2937. attacker.moves[i].totalpp=5
  2938. end
  2939. attacker.effects[PBEffects::Disable]=0
  2940. attacker.effects[PBEffects::DisableMove]=0
  2941. @battle.pbDisplay(_INTL("{1} transformed into {2}!",attacker.pbThis,opponent.pbThis(true)))
  2942. return 0
  2943. end
  2944. end
  2945.  
  2946.  
  2947.  
  2948. ################################################################################
  2949. # Inflicts a fixed 20HP damage. (SonicBoom)
  2950. ################################################################################
  2951. class PokeBattle_Move_06A < PokeBattle_Move
  2952. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2953. return pbEffectFixedDamage(20,attacker,opponent,hitnum,alltargets,showanimation)
  2954. end
  2955. end
  2956.  
  2957.  
  2958.  
  2959. ################################################################################
  2960. # Inflicts a fixed 40HP damage. (Dragon Rage)
  2961. ################################################################################
  2962. class PokeBattle_Move_06B < PokeBattle_Move
  2963. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2964. return pbEffectFixedDamage(40,attacker,opponent,hitnum,alltargets,showanimation)
  2965. end
  2966. end
  2967.  
  2968.  
  2969.  
  2970. ################################################################################
  2971. # Halves the target's current HP. (Super Fang)
  2972. ################################################################################
  2973. class PokeBattle_Move_06C < PokeBattle_Move
  2974. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2975. return pbEffectFixedDamage([(opponent.hp/2).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2976. end
  2977. end
  2978.  
  2979.  
  2980.  
  2981. ################################################################################
  2982. # Inflicts damage equal to the user's level. (Night Shade, Seismic Toss)
  2983. ################################################################################
  2984. class PokeBattle_Move_06D < PokeBattle_Move
  2985. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2986. return pbEffectFixedDamage(attacker.level,attacker,opponent,hitnum,alltargets,showanimation)
  2987. end
  2988. end
  2989.  
  2990.  
  2991.  
  2992. ################################################################################
  2993. # Inflicts damage to bring the target's HP down to equal the user's HP. (Endeavor)
  2994. ################################################################################
  2995. class PokeBattle_Move_06E < PokeBattle_Move
  2996. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2997. if attacker.hp>=opponent.hp
  2998. @battle.pbDisplay(_INTL("But it failed!"))
  2999. return -1
  3000. end
  3001. return pbEffectFixedDamage(opponent.hp-attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  3002. end
  3003. end
  3004.  
  3005.  
  3006.  
  3007. ################################################################################
  3008. # Inflicts damage between 0.5 and 1.5 times the user's level. (Psywave)
  3009. ################################################################################
  3010. class PokeBattle_Move_06F < PokeBattle_Move
  3011. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3012. dmg=[(attacker.level*(@battle.pbRandom(101)+50)/100).floor,1].max
  3013. return pbEffectFixedDamage(dmg,attacker,opponent,hitnum,alltargets,showanimation)
  3014. end
  3015. end
  3016.  
  3017.  
  3018.  
  3019. ################################################################################
  3020. # OHKO. Accuracy increases by difference between levels of user and target.
  3021. ################################################################################
  3022. class PokeBattle_Move_070 < PokeBattle_Move
  3023. def pbAccuracyCheck(attacker,opponent)
  3024. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STURDY)
  3025. @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3026. return false
  3027. end
  3028. if opponent.level>attacker.level
  3029. @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
  3030. return false
  3031. end
  3032. acc=@accuracy+attacker.level-opponent.level
  3033. return @battle.pbRandom(100)<acc
  3034. end
  3035.  
  3036. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3037. damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
  3038. if opponent.isFainted?
  3039. @battle.pbDisplay(_INTL("It's a one-hit KO!"))
  3040. end
  3041. return damage
  3042. end
  3043. end
  3044.  
  3045.  
  3046. ################################################################################
  3047. # Counters a physical move used against the user this round, with 2x the power. (Counter)
  3048. ################################################################################
  3049. class PokeBattle_Move_071 < PokeBattle_Move
  3050. def pbAddTarget(targets,attacker)
  3051. if attacker.effects[PBEffects::CounterTarget]>=0 &&
  3052. attacker.pbIsOpposing?(attacker.effects[PBEffects::CounterTarget])
  3053. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::CounterTarget]])
  3054. attacker.pbRandomTarget(targets)
  3055. end
  3056. end
  3057. end
  3058.  
  3059. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3060. if attacker.effects[PBEffects::Counter]<0 || !opponent
  3061. @battle.pbDisplay(_INTL("But it failed!"))
  3062. return -1
  3063. end
  3064. ret=pbEffectFixedDamage([attacker.effects[PBEffects::Counter]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3065. return ret
  3066. end
  3067. end
  3068.  
  3069.  
  3070.  
  3071. ################################################################################
  3072. # Counters a specical move used against the user this round, with 2x the power. (Mirror Coat)
  3073. ################################################################################
  3074. class PokeBattle_Move_072 < PokeBattle_Move
  3075. def pbAddTarget(targets,attacker)
  3076. if attacker.effects[PBEffects::MirrorCoatTarget]>=0 &&
  3077. attacker.pbIsOpposing?(attacker.effects[PBEffects::MirrorCoatTarget])
  3078. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::MirrorCoatTarget]])
  3079. attacker.pbRandomTarget(targets)
  3080. end
  3081. end
  3082. end
  3083.  
  3084. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3085. if attacker.effects[PBEffects::MirrorCoat]<0 || !opponent
  3086. @battle.pbDisplay(_INTL("But it failed!"))
  3087. return -1
  3088. end
  3089. ret=pbEffectFixedDamage([attacker.effects[PBEffects::MirrorCoat]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3090. return ret
  3091. end
  3092. end
  3093.  
  3094.  
  3095.  
  3096. ################################################################################
  3097. # Counters the last damaging move used against the user this round, with 1.5x
  3098. # the power. (Metal Burst)
  3099. ################################################################################
  3100. class PokeBattle_Move_073 < PokeBattle_Move
  3101. def pbAddTarget(targets,attacker)
  3102. if attacker.lastAttacker.length>0
  3103. lastattacker=attacker.lastAttacker[attacker.lastAttacker.length-1]
  3104. if lastattacker>=0 && attacker.pbIsOpposing?(lastattacker)
  3105. if !attacker.pbAddTarget(targets,@battle.battlers[lastattacker])
  3106. attacker.pbRandomTarget(targets)
  3107. end
  3108. end
  3109. end
  3110. end
  3111.  
  3112. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3113. if attacker.lastHPLost==0 || !opponent
  3114. @battle.pbDisplay(_INTL("But it failed!"))
  3115. return -1
  3116. end
  3117. ret=pbEffectFixedDamage([(attacker.lastHPLost*1.5).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  3118. return ret
  3119. end
  3120. end
  3121.  
  3122.  
  3123.  
  3124. ################################################################################
  3125. # The target's ally loses 1/16 of its max HP. (Flame Burst)
  3126. ################################################################################
  3127. class PokeBattle_Move_074 < PokeBattle_Move
  3128. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3129. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3130. if opponent.damagestate.calcdamage>0
  3131. if opponent.pbPartner && !opponent.pbPartner.isFainted? &&
  3132. !opponent.pbPartner.hasWorkingAbility(:MAGICGUARD)
  3133. opponent.pbPartner.pbReduceHP((opponent.pbPartner.totalhp/16).floor)
  3134. @battle.pbDisplay(_INTL("The bursting flame hit {1}!",opponent.pbPartner.pbThis(true)))
  3135. end
  3136. end
  3137. return ret
  3138. end
  3139. end
  3140.  
  3141.  
  3142.  
  3143. ################################################################################
  3144. # Power is doubled if the target is using Dive. (Surf)
  3145. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3146. ################################################################################
  3147. class PokeBattle_Move_075 < PokeBattle_Move
  3148. def pbModifyDamage(damagemult,attacker,opponent)
  3149. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  3150. return (damagemult*2.0).round
  3151. end
  3152. return damagemult
  3153. end
  3154. end
  3155.  
  3156.  
  3157.  
  3158. ################################################################################
  3159. # Power is doubled if the target is using Dig. Power is halved if Grassy Terrain
  3160. # is in effect. (Earthquake)
  3161. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3162. ################################################################################
  3163. class PokeBattle_Move_076 < PokeBattle_Move
  3164. def pbModifyDamage(damagemult,attacker,opponent)
  3165. ret=damagemult
  3166. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3167. ret=(damagemult*2.0).round
  3168. end
  3169. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3170. ret=(damagemult/2.0).round
  3171. end
  3172. return ret
  3173. end
  3174. end
  3175.  
  3176.  
  3177.  
  3178. ################################################################################
  3179. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Gust)
  3180. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3181. ################################################################################
  3182. class PokeBattle_Move_077 < PokeBattle_Move
  3183. def pbBaseDamage(basedmg,attacker,opponent)
  3184. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3185. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3186. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3187. opponent.effects[PBEffects::SkyDrop]
  3188. return basedmg*2
  3189. end
  3190. return basedmg
  3191. end
  3192. end
  3193.  
  3194.  
  3195.  
  3196. ################################################################################
  3197. # Power is doubled if the target is using Bounce, Fly or Sky Drop. (Twister)
  3198. # May make the target flinch.
  3199. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3200. ################################################################################
  3201. class PokeBattle_Move_078 < PokeBattle_Move
  3202. def pbBaseDamage(basedmg,attacker,opponent)
  3203. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3204. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3205. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  3206. opponent.effects[PBEffects::SkyDrop]
  3207. return basedmg*2
  3208. end
  3209. return basedmg
  3210. end
  3211.  
  3212. def pbAdditionalEffect(attacker,opponent)
  3213. return if opponent.damagestate.substitute
  3214. opponent.pbFlinch(attacker)
  3215. end
  3216. end
  3217.  
  3218.  
  3219.  
  3220. ################################################################################
  3221. # Power is doubled if Fusion Flare has already been used this round. (Fusion Bolt)
  3222. ################################################################################
  3223. class PokeBattle_Move_079 < PokeBattle_Move
  3224. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3225. if @battle.field.effects[PBEffects::FusionBolt]
  3226. @battle.field.effects[PBEffects::FusionBolt]=false
  3227. @doubled=true
  3228. return (damagemult*2.0).round
  3229. end
  3230. return damagemult
  3231. end
  3232.  
  3233. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3234. @doubled=false
  3235. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3236. if opponent.damagestate.calcdamage>0
  3237. @battle.field.effects[PBEffects::FusionFlare]=true
  3238. end
  3239. return ret
  3240. end
  3241.  
  3242. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3243. if opponent.damagestate.critical || @doubled
  3244. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3245. end
  3246. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3247. end
  3248. end
  3249.  
  3250.  
  3251.  
  3252. ################################################################################
  3253. # Power is doubled if Fusion Bolt has already been used this round. (Fusion Flare)
  3254. ################################################################################
  3255. class PokeBattle_Move_07A < PokeBattle_Move
  3256. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3257. if @battle.field.effects[PBEffects::FusionFlare]
  3258. @battle.field.effects[PBEffects::FusionFlare]=false
  3259. return (damagemult*2.0).round
  3260. end
  3261. return damagemult
  3262. end
  3263.  
  3264. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3265. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3266. if opponent.damagestate.calcdamage>0
  3267. @battle.field.effects[PBEffects::FusionBolt]=true
  3268. end
  3269. return ret
  3270. end
  3271.  
  3272. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3273. if opponent.damagestate.critical || @doubled
  3274. return super(id,attacker,opponent,1,alltargets,showanimation) # Charged anim
  3275. end
  3276. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  3277. end
  3278. end
  3279.  
  3280.  
  3281.  
  3282. ################################################################################
  3283. # Power is doubled if the target is poisoned. (Venoshock)
  3284. ################################################################################
  3285. class PokeBattle_Move_07B < PokeBattle_Move
  3286. def pbBaseDamage(basedmg,attacker,opponent)
  3287. if opponent.status==PBStatuses::POISON &&
  3288. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3289. return basedmg*2
  3290. end
  3291. return basedmg
  3292. end
  3293. end
  3294.  
  3295.  
  3296.  
  3297. ################################################################################
  3298. # Power is doubled if the target is paralyzed. Cures the target of paralysis.
  3299. # (SmellingSalt)
  3300. ################################################################################
  3301. class PokeBattle_Move_07C < PokeBattle_Move
  3302. def pbBaseDamage(basedmg,attacker,opponent)
  3303. if opponent.status==PBStatuses::PARALYSIS &&
  3304. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3305. return basedmg*2
  3306. end
  3307. return basedmg
  3308. end
  3309.  
  3310. def pbEffectAfterHit(attacker,opponent,turneffects)
  3311. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  3312. !opponent.damagestate.substitute && opponent.status==PBStatuses::PARALYSIS
  3313. opponent.pbCureStatus
  3314. end
  3315. end
  3316. end
  3317.  
  3318.  
  3319.  
  3320. ################################################################################
  3321. # Power is doubled if the target is asleep. Wakes the target up. (Wake-Up Slap)
  3322. ################################################################################
  3323. class PokeBattle_Move_07D < PokeBattle_Move
  3324. def pbBaseDamage(basedmg,attacker,opponent)
  3325. if opponent.status==PBStatuses::SLEEP &&
  3326. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3327. return basedmg*2
  3328. end
  3329. return basedmg
  3330. end
  3331.  
  3332. def pbEffectAfterHit(attacker,opponent,turneffects)
  3333. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  3334. !opponent.damagestate.substitute && opponent.status==PBStatuses::SLEEP
  3335. opponent.pbCureStatus
  3336. end
  3337. end
  3338. end
  3339.  
  3340.  
  3341.  
  3342. ################################################################################
  3343. # Power is doubled if the user is burned, poisoned or paralyzed. (Facade)
  3344. ################################################################################
  3345. class PokeBattle_Move_07E < PokeBattle_Move
  3346. def pbBaseDamage(basedmg,attacker,opponent)
  3347. if attacker.status==PBStatuses::POISON ||
  3348. attacker.status==PBStatuses::BURN ||
  3349. attacker.status==PBStatuses::PARALYSIS
  3350. return basedmg*2
  3351. end
  3352. return basedmg
  3353. end
  3354. end
  3355.  
  3356.  
  3357.  
  3358. ################################################################################
  3359. # Power is doubled if the target has a status problem. (Hex)
  3360. ################################################################################
  3361. class PokeBattle_Move_07F < PokeBattle_Move
  3362. def pbBaseDamage(basedmg,attacker,opponent)
  3363. if opponent.status>0 &&
  3364. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  3365. return basedmg*2
  3366. end
  3367. return basedmg
  3368. end
  3369. end
  3370.  
  3371.  
  3372.  
  3373. ################################################################################
  3374. # Power is doubled if the target's HP is down to 1/2 or less. (Brine)
  3375. ################################################################################
  3376. class PokeBattle_Move_080 < PokeBattle_Move
  3377. def pbBaseDamage(basedmg,attacker,opponent)
  3378. if opponent.hp<=opponent.totalhp/2
  3379. return basedmg*2
  3380. end
  3381. return basedmg
  3382. end
  3383. end
  3384.  
  3385.  
  3386.  
  3387. ################################################################################
  3388. # Power is doubled if the user has lost HP due to the target's move this round.
  3389. # (Revenge, Avalanche)
  3390. ################################################################################
  3391. class PokeBattle_Move_081 < PokeBattle_Move
  3392. def pbBaseDamage(basedmg,attacker,opponent)
  3393. if attacker.lastHPLost>0 && attacker.lastAttacker.include?(opponent.index)
  3394. return basedmg*2
  3395. end
  3396. return basedmg
  3397. end
  3398. end
  3399.  
  3400.  
  3401.  
  3402. ################################################################################
  3403. # Power is doubled if the target has already lost HP this round. (Assurance)
  3404. ################################################################################
  3405. class PokeBattle_Move_082 < PokeBattle_Move
  3406. def pbBaseDamage(basedmg,attacker,opponent)
  3407. if opponent.tookDamage
  3408. return basedmg*2
  3409. end
  3410. return basedmg
  3411. end
  3412. end
  3413.  
  3414.  
  3415.  
  3416. ################################################################################
  3417. # Power is doubled if a user's ally has already used this move this round. (Round)
  3418. # If an ally is about to use the same move, make it go next, ignoring priority.
  3419. ################################################################################
  3420. class PokeBattle_Move_083 < PokeBattle_Move
  3421. def pbBaseDamage(basedmg,attacker,opponent)
  3422. ret=basedmg
  3423. attacker.pbOwnSide.effects[PBEffects::Round].times do
  3424. ret*=2
  3425. end
  3426. return ret
  3427. end
  3428.  
  3429. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3430. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3431. if opponent.damagestate.calcdamage>0
  3432. attacker.pbOwnSide.effects[PBEffects::Round]+=1
  3433. if attacker.pbPartner && !attacker.pbPartner.hasMovedThisRound?
  3434. if @battle.choices[attacker.pbPartner.index][0]==1 # Will use a move
  3435. partnermove=@battle.choices[attacker.pbPartner.index][2]
  3436. if partnermove.function==@function
  3437. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  3438. attacker.pbPartner.effects[PBEffects::Quash]=false
  3439. end
  3440. end
  3441. end
  3442. end
  3443. return ret
  3444. end
  3445. end
  3446.  
  3447.  
  3448.  
  3449. ################################################################################
  3450. # Power is doubled if the target has already moved this round. (Payback)
  3451. ################################################################################
  3452. class PokeBattle_Move_084 < PokeBattle_Move
  3453. def pbBaseDamage(basedmg,attacker,opponent)
  3454. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3455. opponent.hasMovedThisRound? # Used a move already
  3456. return basedmg*2
  3457. end
  3458. return basedmg
  3459. end
  3460. end
  3461.  
  3462.  
  3463.  
  3464. ################################################################################
  3465. # Power is doubled if a user's teammate fainted last round. (Retaliate)
  3466. ################################################################################
  3467. class PokeBattle_Move_085 < PokeBattle_Move
  3468. def pbBaseDamage(basedmg,attacker,opponent)
  3469. if attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]>=0 &&
  3470. attacker.pbOwnSide.effects[PBEffects::LastRoundFainted]==@battle.turncount-1
  3471. return basedmg*2
  3472. end
  3473. return basedmg
  3474. end
  3475. end
  3476.  
  3477.  
  3478.  
  3479. ################################################################################
  3480. # Power is doubled if the user has no held item. (Acrobatics)
  3481. ################################################################################
  3482. class PokeBattle_Move_086 < PokeBattle_Move
  3483. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3484. if attacker.item==0
  3485. return (damagemult*2.0).round
  3486. end
  3487. return damagemult
  3488. end
  3489. end
  3490.  
  3491.  
  3492.  
  3493. ################################################################################
  3494. # Power is doubled in weather. Type changes depending on the weather. (Weather Ball)
  3495. ################################################################################
  3496. class PokeBattle_Move_087 < PokeBattle_Move
  3497. def pbBaseDamage(basedmg,attacker,opponent)
  3498. if @battle.pbWeather!=0
  3499. return basedmg*2
  3500. end
  3501. return basedmg
  3502. end
  3503.  
  3504. def pbModifyType(type,attacker,opponent)
  3505. type=getConst(PBTypes,:NORMAL) || 0
  3506. case @battle.pbWeather
  3507. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  3508. type=(getConst(PBTypes,:FIRE) || type)
  3509. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  3510. type=(getConst(PBTypes,:WATER) || type)
  3511. when PBWeather::SANDSTORM
  3512. type=(getConst(PBTypes,:ROCK) || type)
  3513. when PBWeather::HAIL
  3514. type=(getConst(PBTypes,:ICE) || type)
  3515. end
  3516. return type
  3517. end
  3518. end
  3519.  
  3520.  
  3521.  
  3522. ################################################################################
  3523. # Power is doubled if a foe tries to switch out or use U-turn/Volt Switch/
  3524. # Parting Shot. (Pursuit)
  3525. # (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
  3526. ################################################################################
  3527. class PokeBattle_Move_088 < PokeBattle_Move
  3528. def pbBaseDamage(basedmg,attacker,opponent)
  3529. if @battle.switching
  3530. return basedmg*2
  3531. end
  3532. return basedmg
  3533. end
  3534.  
  3535. def pbAccuracyCheck(attacker,opponent)
  3536. return true if @battle.switching
  3537. return super(attacker,opponent)
  3538. end
  3539. end
  3540.  
  3541.  
  3542.  
  3543. ################################################################################
  3544. # Power increases with the user's happiness. (Return)
  3545. ################################################################################
  3546. class PokeBattle_Move_089 < PokeBattle_Move
  3547. def pbBaseDamage(basedmg,attacker,opponent)
  3548. return [(attacker.happiness*2/5).floor,1].max
  3549. end
  3550. end
  3551.  
  3552.  
  3553.  
  3554. ################################################################################
  3555. # Power decreases with the user's happiness. (Frustration)
  3556. ################################################################################
  3557. class PokeBattle_Move_08A < PokeBattle_Move
  3558. def pbBaseDamage(basedmg,attacker,opponent)
  3559. return [((255-attacker.happiness)*2/5).floor,1].max
  3560. end
  3561. end
  3562.  
  3563.  
  3564.  
  3565. ################################################################################
  3566. # Power increases with the user's HP. (Eruption, Water Spout)
  3567. ################################################################################
  3568. class PokeBattle_Move_08B < PokeBattle_Move
  3569. def pbBaseDamage(basedmg,attacker,opponent)
  3570. return [(150*attacker.hp/attacker.totalhp).floor,1].max
  3571. end
  3572. end
  3573.  
  3574.  
  3575.  
  3576. ################################################################################
  3577. # Power increases with the target's HP. (Crush Grip, Wring Out)
  3578. ################################################################################
  3579. class PokeBattle_Move_08C < PokeBattle_Move
  3580. def pbBaseDamage(basedmg,attacker,opponent)
  3581. return [(120*opponent.hp/opponent.totalhp).floor,1].max
  3582. end
  3583. end
  3584.  
  3585.  
  3586.  
  3587. ################################################################################
  3588. # Power increases the quicker the target is than the user. (Gyro Ball)
  3589. ################################################################################
  3590. class PokeBattle_Move_08D < PokeBattle_Move
  3591. def pbBaseDamage(basedmg,attacker,opponent)
  3592. return [[(25*opponent.pbSpeed/attacker.pbSpeed).floor,150].min,1].max
  3593. end
  3594. end
  3595.  
  3596.  
  3597.  
  3598. ################################################################################
  3599. # Power increases with the user's positive stat changes (ignores negative ones).
  3600. # (Stored Power)
  3601. ################################################################################
  3602. class PokeBattle_Move_08E < PokeBattle_Move
  3603. def pbBaseDamage(basedmg,attacker,opponent)
  3604. mult=1
  3605. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3606. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3607. mult+=attacker.stages[i] if attacker.stages[i]>0
  3608. end
  3609. return 20*mult
  3610. end
  3611. end
  3612.  
  3613.  
  3614.  
  3615. ################################################################################
  3616. # Power increases with the target's positive stat changes (ignores negative ones).
  3617. # (Punishment)
  3618. ################################################################################
  3619. class PokeBattle_Move_08F < PokeBattle_Move
  3620. def pbBaseDamage(basedmg,attacker,opponent)
  3621. mult=3
  3622. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3623. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3624. mult+=opponent.stages[i] if opponent.stages[i]>0
  3625. end
  3626. return [20*mult,200].min
  3627. end
  3628. end
  3629.  
  3630.  
  3631.  
  3632. ################################################################################
  3633. # Power and type depends on the user's IVs. (Hidden Power)
  3634. ################################################################################
  3635. class PokeBattle_Move_090 < PokeBattle_Move
  3636. def pbModifyType(type,attacker,opponent)
  3637. hp=pbHiddenPower(attacker.iv)
  3638. type=hp[0]
  3639. return type
  3640. end
  3641.  
  3642. def pbBaseDamage(basedmg,attacker,opponent)
  3643. return 60 if USENEWBATTLEMECHANICS
  3644. hp=pbHiddenPower(attacker.iv)
  3645. return hp[1]
  3646. end
  3647. end
  3648.  
  3649. def pbHiddenPower(iv)
  3650. powermin=30
  3651. powermax=70
  3652. type=0; base=0
  3653. types=[]
  3654. for i in 0..PBTypes.maxValue
  3655. types.push(i) if !PBTypes.isPseudoType?(i) &&
  3656. !isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
  3657. end
  3658. type|=(iv[PBStats::HP]&1)
  3659. type|=(iv[PBStats::ATTACK]&1)<<1
  3660. type|=(iv[PBStats::DEFENSE]&1)<<2
  3661. type|=(iv[PBStats::SPEED]&1)<<3
  3662. type|=(iv[PBStats::SPATK]&1)<<4
  3663. type|=(iv[PBStats::SPDEF]&1)<<5
  3664. type=(type*(types.length-1)/63).floor
  3665. hptype=types[type]
  3666. base|=(iv[PBStats::HP]&2)>>1
  3667. base|=(iv[PBStats::ATTACK]&2)
  3668. base|=(iv[PBStats::DEFENSE]&2)<<1
  3669. base|=(iv[PBStats::SPEED]&2)<<2
  3670. base|=(iv[PBStats::SPATK]&2)<<3
  3671. base|=(iv[PBStats::SPDEF]&2)<<4
  3672. base=(base*(powermax-powermin)/63).floor+powermin
  3673. return [hptype,base]
  3674. end
  3675.  
  3676. ################################################################################
  3677. # Power doubles for each consecutive use. (Fury Cutter)
  3678. ################################################################################
  3679. class PokeBattle_Move_091 < PokeBattle_Move
  3680. def pbBaseDamage(basedmg,attacker,opponent)
  3681. basedmg=basedmg<<(attacker.effects[PBEffects::FuryCutter]-1) # can be 1 to 4
  3682. return basedmg
  3683. end
  3684. end
  3685.  
  3686.  
  3687.  
  3688. ################################################################################
  3689. # Power is multiplied by the number of consecutive rounds in which this move was
  3690. # used by any Pokémon on the user's side. (Echoed Voice)
  3691. ################################################################################
  3692. class PokeBattle_Move_092 < PokeBattle_Move
  3693. def pbBaseDamage(basedmg,attacker,opponent)
  3694. basedmg*=attacker.pbOwnSide.effects[PBEffects::EchoedVoiceCounter] # can be 1 to 5
  3695. return basedmg
  3696. end
  3697. end
  3698.  
  3699.  
  3700.  
  3701. ################################################################################
  3702. # User rages until the start of a round in which they don't use this move. (Rage)
  3703. # (Handled in Battler's pbProcessMoveAgainstTarget): Ups rager's Attack by 1
  3704. # stage each time it loses HP due to a move.
  3705. ################################################################################
  3706. class PokeBattle_Move_093 < PokeBattle_Move
  3707. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3708. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3709. attacker.effects[PBEffects::Rage]=true if ret>0
  3710. return ret
  3711. end
  3712. end
  3713.  
  3714.  
  3715.  
  3716. ################################################################################
  3717. # Randomly damages or heals the target. (Present)
  3718. ################################################################################
  3719. class PokeBattle_Move_094 < PokeBattle_Move
  3720. def pbOnStartUse(attacker)
  3721. # Just to ensure that Parental Bond's second hit damages if the first hit does
  3722. @forcedamage=false
  3723. return true
  3724. end
  3725.  
  3726. def pbBaseDamage(basedmg,attacker,opponent)
  3727. @forcedamage=true
  3728. return @calcbasedmg
  3729. end
  3730.  
  3731. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3732. @calcbasedmg=1
  3733. r=@battle.pbRandom((@forcedamage) ? 8 : 10)
  3734. if r<4
  3735. @calcbasedmg=40
  3736. elsif r<7
  3737. @calcbasedmg=80
  3738. elsif r<8
  3739. @calcbasedmg=120
  3740. else
  3741. if pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)==0
  3742. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  3743. return -1
  3744. end
  3745. if opponent.hp==opponent.totalhp
  3746. @battle.pbDisplay(_INTL("But it failed!"))
  3747. return -1
  3748. end
  3749. damage=pbCalcDamage(attacker,opponent) # Consumes Gems even if it will heal
  3750. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Healing animation
  3751. opponent.pbRecoverHP((opponent.totalhp/4).floor,true)
  3752. @battle.pbDisplay(_INTL("{1} had its HP restored.",opponent.pbThis))
  3753. return 0
  3754. end
  3755. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3756. end
  3757. end
  3758.  
  3759.  
  3760.  
  3761. ################################################################################
  3762. # Power is chosen at random. Power is doubled if the target is using Dig. (Magnitude)
  3763. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3764. ################################################################################
  3765. class PokeBattle_Move_095 < PokeBattle_Move
  3766. def pbOnStartUse(attacker)
  3767. basedmg=[10,30,50,70,90,110,150]
  3768. magnitudes=[
  3769. 4,
  3770. 5,5,
  3771. 6,6,6,6,
  3772. 7,7,7,7,7,7,
  3773. 8,8,8,8,
  3774. 9,9,
  3775. 10
  3776. ]
  3777. magni=magnitudes[@battle.pbRandom(magnitudes.length)]
  3778. @calcbasedmg=basedmg[magni-4]
  3779. @battle.pbDisplay(_INTL("Magnitude {1}!",magni))
  3780. return true
  3781. end
  3782.  
  3783. def pbBaseDamage(basedmg,attacker,opponent)
  3784. ret=@calcbasedmg
  3785. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3786. ret*=2
  3787. end
  3788. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  3789. ret=(ret/2.0).round
  3790. end
  3791. return ret
  3792. end
  3793. end
  3794.  
  3795.  
  3796.  
  3797. ################################################################################
  3798. # Power and type depend on the user's held berry. Destroys the berry. (Natural Gift)
  3799. ################################################################################
  3800. class PokeBattle_Move_096 < PokeBattle_Move
  3801. def pbOnStartUse(attacker)
  3802. if !pbIsBerry?(attacker.item) ||
  3803. attacker.effects[PBEffects::Embargo]>0 ||
  3804. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  3805. attacker.hasWorkingAbility(:KLUTZ) ||
  3806. attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) ||
  3807. attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  3808. @battle.pbDisplay(_INTL("But it failed!"))
  3809. return false
  3810. end
  3811. @berry=attacker.item
  3812. return true
  3813. end
  3814.  
  3815. def pbBaseDamage(basedmg,attacker,opponent)
  3816. damagearray={
  3817. 60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
  3818. :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
  3819. :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
  3820. :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
  3821. :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
  3822. :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
  3823. :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY,:ROSELIBERRY],
  3824. 70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
  3825. :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
  3826. :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
  3827. :PAMTREBERRY],
  3828. 80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
  3829. :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
  3830. :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JABOCABERRY,:ROWAPBERRY,
  3831. :KEEBERRY,:MARANGABERRY]
  3832. }
  3833. for i in damagearray.keys
  3834. data=damagearray[i]
  3835. if data
  3836. for j in data
  3837. if isConst?(@berry,PBItems,j)
  3838. ret=i
  3839. ret+=20 if USENEWBATTLEMECHANICS
  3840. return ret
  3841. end
  3842. end
  3843. end
  3844. end
  3845. return 1
  3846. end
  3847.  
  3848. def pbModifyType(type,attacker,opponent)
  3849. type=getConst(PBTypes,:NORMAL) || 0
  3850. typearray={
  3851. :NORMAL => [:CHILANBERRY],
  3852. :FIRE => [:CHERIBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
  3853. :WATER => [:CHESTOBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
  3854. :ELECTRIC => [:PECHABERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
  3855. :GRASS => [:RAWSTBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
  3856. :ICE => [:ASPEARBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
  3857. :FIGHTING => [:LEPPABERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
  3858. :POISON => [:ORANBERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
  3859. :GROUND => [:PERSIMBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
  3860. :FLYING => [:LUMBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
  3861. :PSYCHIC => [:SITRUSBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
  3862. :BUG => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
  3863. :ROCK => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
  3864. :GHOST => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
  3865. :DRAGON => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JABOCABERRY],
  3866. :DARK => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY,:MARANGABERRY],
  3867. :STEEL => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY],
  3868. :FAIRY => [:ROSELIBERRY,:KEEBERRY]
  3869. }
  3870. for i in typearray.keys
  3871. data=typearray[i]
  3872. if data
  3873. for j in data
  3874. if isConst?(@berry,PBItems,j)
  3875. type=getConst(PBTypes,i) || type
  3876. end
  3877. end
  3878. end
  3879. end
  3880. return type
  3881. end
  3882.  
  3883. def pbEffectAfterHit(attacker,opponent,turneffects)
  3884. if turneffects[PBEffects::TotalDamage]>0>0
  3885. attacker.pbConsumeItem
  3886. end
  3887. end
  3888. end
  3889.  
  3890.  
  3891.  
  3892. ################################################################################
  3893. # Power increases the less PP this move has. (Trump Card)
  3894. ################################################################################
  3895. class PokeBattle_Move_097 < PokeBattle_Move
  3896. def pbBaseDamage(basedmg,attacker,opponent)
  3897. dmgs=[200,80,60,50,40]
  3898. ppleft=[@pp,4].min # PP is reduced before the move is used
  3899. basedmg=dmgs[ppleft]
  3900. return basedmg
  3901. end
  3902. end
  3903.  
  3904.  
  3905.  
  3906. ################################################################################
  3907. # Power increases the less HP the user has. (Flail, Reversal)
  3908. ################################################################################
  3909. class PokeBattle_Move_098 < PokeBattle_Move
  3910. def pbBaseDamage(basedmg,attacker,opponent)
  3911. n=(48*attacker.hp/attacker.totalhp).floor
  3912. ret=20
  3913. ret=40 if n<33
  3914. ret=80 if n<17
  3915. ret=100 if n<10
  3916. ret=150 if n<5
  3917. ret=200 if n<2
  3918. return ret
  3919. end
  3920. end
  3921.  
  3922.  
  3923.  
  3924. ################################################################################
  3925. # Power increases the quicker the user is than the target. (Electro Ball)
  3926. ################################################################################
  3927. class PokeBattle_Move_099 < PokeBattle_Move
  3928. def pbBaseDamage(basedmg,attacker,opponent)
  3929. n=([attacker.pbSpeed,1].max/[opponent.pbSpeed,1].max).floor
  3930. ret=60
  3931. ret=80 if n>=2
  3932. ret=120 if n>=3
  3933. ret=150 if n>=4
  3934. return ret
  3935. end
  3936. end
  3937.  
  3938.  
  3939.  
  3940. ################################################################################
  3941. # Power increases the heavier the target is. (Grass Knot, Low Kick)
  3942. ################################################################################
  3943. class PokeBattle_Move_09A < PokeBattle_Move
  3944. def pbBaseDamage(basedmg,attacker,opponent)
  3945. weight=opponent.weight(attacker)
  3946. ret=20
  3947. ret=40 if weight>=100
  3948. ret=60 if weight>=250
  3949. ret=80 if weight>=500
  3950. ret=100 if weight>=1000
  3951. ret=120 if weight>=2000
  3952. return ret
  3953. end
  3954. end
  3955.  
  3956.  
  3957.  
  3958. ################################################################################
  3959. # Power increases the heavier the user is than the target. (Heat Crash, Heavy Slam)
  3960. ################################################################################
  3961. class PokeBattle_Move_09B < PokeBattle_Move
  3962. def pbBaseDamage(basedmg,attacker,opponent)
  3963. n=(attacker.weight/opponent.weight(attacker)).floor
  3964. ret=40
  3965. ret=60 if n>=2
  3966. ret=80 if n>=3
  3967. ret=100 if n>=4
  3968. ret=120 if n>=5
  3969. return ret
  3970. end
  3971. end
  3972.  
  3973.  
  3974.  
  3975. ################################################################################
  3976. # Powers up the ally's attack this round by 1.5. (Helping Hand)
  3977. ################################################################################
  3978. class PokeBattle_Move_09C < PokeBattle_Move
  3979. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3980. if !@battle.doublebattle || opponent.isFainted? ||
  3981. @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3982. opponent.hasMovedThisRound? ||
  3983. opponent.effects[PBEffects::HelpingHand]
  3984. @battle.pbDisplay(_INTL("But it failed!"))
  3985. return -1
  3986. end
  3987. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3988. opponent.effects[PBEffects::HelpingHand]=true
  3989. @battle.pbDisplay(_INTL("{1} is ready to help {2}!",attacker.pbThis,opponent.pbThis(true)))
  3990. return 0
  3991. end
  3992. end
  3993.  
  3994.  
  3995.  
  3996. ################################################################################
  3997. # Weakens Electric attacks. (Mud Sport)
  3998. ################################################################################
  3999. class PokeBattle_Move_09D < PokeBattle_Move
  4000. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4001. if USENEWBATTLEMECHANICS
  4002. if @battle.field.effects[PBEffects::MudSportField]>0
  4003. @battle.pbDisplay(_INTL("But it failed!"))
  4004. return -1
  4005. end
  4006. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4007. @battle.field.effects[PBEffects::MudSportField]=5
  4008. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4009. return 0
  4010. else
  4011. for i in 0...4
  4012. if attacker.battle.battlers[i].effects[PBEffects::MudSport]
  4013. @battle.pbDisplay(_INTL("But it failed!"))
  4014. return -1
  4015. end
  4016. end
  4017. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4018. attacker.effects[PBEffects::MudSport]=true
  4019. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  4020. return 0
  4021. end
  4022. return -1
  4023. end
  4024. end
  4025.  
  4026.  
  4027.  
  4028. ################################################################################
  4029. # Weakens Fire attacks. (Water Sport)
  4030. ################################################################################
  4031. class PokeBattle_Move_09E < PokeBattle_Move
  4032. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4033. if USENEWBATTLEMECHANICS
  4034. if @battle.field.effects[PBEffects::WaterSportField]>0
  4035. @battle.pbDisplay(_INTL("But it failed!"))
  4036. return -1
  4037. end
  4038. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4039. @battle.field.effects[PBEffects::WaterSportField]=5
  4040. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4041. return 0
  4042. else
  4043. for i in 0...4
  4044. if attacker.battle.battlers[i].effects[PBEffects::WaterSport]
  4045. @battle.pbDisplay(_INTL("But it failed!"))
  4046. return -1
  4047. end
  4048. end
  4049. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4050. attacker.effects[PBEffects::WaterSport]=true
  4051. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  4052. return 0
  4053. end
  4054. end
  4055. end
  4056.  
  4057.  
  4058.  
  4059. ################################################################################
  4060. # Type depends on the user's held item. (Judgment, Techno Blast, Multi Attack)
  4061. ################################################################################
  4062. class PokeBattle_Move_09F < PokeBattle_Move
  4063. def pbModifyType(type,attacker,opponent)
  4064. type=getConst(PBTypes,:NORMAL) || 0
  4065. if isConst?(@id,PBMoves,:JUDGMENT)
  4066. type=(getConst(PBTypes,:FIGHTING) || 0) if attacker.hasWorkingItem(:FISTPLATE)
  4067. type=(getConst(PBTypes,:FLYING) || 0) if attacker.hasWorkingItem(:SKYPLATE)
  4068. type=(getConst(PBTypes,:POISON) || 0) if attacker.hasWorkingItem(:TOXICPLATE)
  4069. type=(getConst(PBTypes,:GROUND) || 0) if attacker.hasWorkingItem(:EARTHPLATE)
  4070. type=(getConst(PBTypes,:ROCK) || 0) if attacker.hasWorkingItem(:STONEPLATE)
  4071. type=(getConst(PBTypes,:BUG) || 0) if attacker.hasWorkingItem(:INSECTPLATE)
  4072. type=(getConst(PBTypes,:GHOST) || 0) if attacker.hasWorkingItem(:SPOOKYPLATE)
  4073. type=(getConst(PBTypes,:STEEL) || 0) if attacker.hasWorkingItem(:IRONPLATE)
  4074. type=(getConst(PBTypes,:FIRE) || 0) if attacker.hasWorkingItem(:FLAMEPLATE)
  4075. type=(getConst(PBTypes,:WATER) || 0) if attacker.hasWorkingItem(:SPLASHPLATE)
  4076. type=(getConst(PBTypes,:GRASS) || 0) if attacker.hasWorkingItem(:MEADOWPLATE)
  4077. type=(getConst(PBTypes,:ELECTRIC) || 0) if attacker.hasWorkingItem(:ZAPPLATE)
  4078. type=(getConst(PBTypes,:PSYCHIC) || 0) if attacker.hasWorkingItem(:MINDPLATE)
  4079. type=(getConst(PBTypes,:ICE) || 0) if attacker.hasWorkingItem(:ICICLEPLATE)
  4080. type=(getConst(PBTypes,:DRAGON) || 0) if attacker.hasWorkingItem(:DRACOPLATE)
  4081. type=(getConst(PBTypes,:DARK) || 0) if attacker.hasWorkingItem(:DREADPLATE)
  4082. type=(getConst(PBTypes,:FAIRY) || 0) if attacker.hasWorkingItem(:PIXIEPLATE)
  4083. elsif isConst?(@id,PBMoves,:TECHNOBLAST)
  4084. return getConst(PBTypes,:ELECTRIC) if attacker.hasWorkingItem(:SHOCKDRIVE)
  4085. return getConst(PBTypes,:FIRE) if attacker.hasWorkingItem(:BURNDRIVE)
  4086. return getConst(PBTypes,:ICE) if attacker.hasWorkingItem(:CHILLDRIVE)
  4087. return getConst(PBTypes,:WATER) if attacker.hasWorkingItem(:DOUSEDRIVE)
  4088. elsif isConst?(@id,PBMoves,:MULTIATTACK)
  4089. type=(getConst(PBTypes,:FIGHTING) || 0) if attacker.hasWorkingItem(:FIGHTINGMEMORY)
  4090. type=(getConst(PBTypes,:FLYING) || 0) if attacker.hasWorkingItem(:FLYINGMEMORY)
  4091. type=(getConst(PBTypes,:POISON) || 0) if attacker.hasWorkingItem(:POISONMEMORY)
  4092. type=(getConst(PBTypes,:GROUND) || 0) if attacker.hasWorkingItem(:GROUNDMEMORY)
  4093. type=(getConst(PBTypes,:ROCK) || 0) if attacker.hasWorkingItem(:ROCKMEMORY)
  4094. type=(getConst(PBTypes,:BUG) || 0) if attacker.hasWorkingItem(:BUGMEMORY)
  4095. type=(getConst(PBTypes,:GHOST) || 0) if attacker.hasWorkingItem(:GHOSTMEMORY)
  4096. type=(getConst(PBTypes,:STEEL) || 0) if attacker.hasWorkingItem(:STEELMEMORY)
  4097. type=(getConst(PBTypes,:FIRE) || 0) if attacker.hasWorkingItem(:FIREMEMORY)
  4098. type=(getConst(PBTypes,:WATER) || 0) if attacker.hasWorkingItem(:WATERMEMORY)
  4099. type=(getConst(PBTypes,:GRASS) || 0) if attacker.hasWorkingItem(:GRASSMEMORY)
  4100. type=(getConst(PBTypes,:ELECTRIC) || 0) if attacker.hasWorkingItem(:ELECTRICMEMORY)
  4101. type=(getConst(PBTypes,:PSYCHIC) || 0) if attacker.hasWorkingItem(:PSYCHICMEMORY)
  4102. type=(getConst(PBTypes,:ICE) || 0) if attacker.hasWorkingItem(:ICEMEMORY)
  4103. type=(getConst(PBTypes,:DRAGON) || 0) if attacker.hasWorkingItem(:DRAGONMEMORY)
  4104. type=(getConst(PBTypes,:DARK) || 0) if attacker.hasWorkingItem(:DARKMEMORY)
  4105. type=(getConst(PBTypes,:FAIRY) || 0) if attacker.hasWorkingItem(:FAIRYMEMORY)
  4106. end
  4107. return type
  4108. end
  4109.  
  4110. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4111. if isConst?(@id,PBMoves,:TECHNOBLAST)
  4112. anim=0
  4113. anim=1 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ELECTRIC)
  4114. anim=2 if isConst?(pbType(@type,attacker,opponent),PBTypes,:FIRE)
  4115. anim=3 if isConst?(pbType(@type,attacker,opponent),PBTypes,:ICE)
  4116. anim=4 if isConst?(pbType(@type,attacker,opponent),PBTypes,:WATER)
  4117. return super(id,attacker,opponent,anim,alltargets,showanimation) # Type-specific anim
  4118. end
  4119. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  4120. end
  4121. end
  4122.  
  4123.  
  4124.  
  4125. ################################################################################
  4126. # This attack is always a critical hit. (Frost Breath, Storm Throw)
  4127. ################################################################################
  4128. class PokeBattle_Move_0A0 < PokeBattle_Move
  4129. def pbCritialOverride(attacker,opponent)
  4130. return true
  4131. end
  4132. end
  4133.  
  4134.  
  4135.  
  4136. ################################################################################
  4137. # For 5 rounds, foes' attacks cannot become critical hits. (Lucky Chant)
  4138. ################################################################################
  4139. class PokeBattle_Move_0A1 < PokeBattle_Move
  4140. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4141. if attacker.pbOwnSide.effects[PBEffects::LuckyChant]>0
  4142. @battle.pbDisplay(_INTL("But it failed!"))
  4143. return -1
  4144. end
  4145. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4146. attacker.pbOwnSide.effects[PBEffects::LuckyChant]=5
  4147. if !@battle.pbIsOpposing?(attacker.index)
  4148. @battle.pbDisplay(_INTL("The Lucky Chant shielded your team from critical hits!"))
  4149. else
  4150. @battle.pbDisplay(_INTL("The Lucky Chant shielded the opposing team from critical hits!"))
  4151. end
  4152. return 0
  4153. end
  4154. end
  4155.  
  4156.  
  4157.  
  4158. ################################################################################
  4159. # For 5 rounds, lowers power of physical attacks against the user's side. (Reflect)
  4160. ################################################################################
  4161. class PokeBattle_Move_0A2 < PokeBattle_Move
  4162. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4163. if attacker.pbOwnSide.effects[PBEffects::Reflect]>0
  4164. @battle.pbDisplay(_INTL("But it failed!"))
  4165. return -1
  4166. end
  4167. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4168. attacker.pbOwnSide.effects[PBEffects::Reflect]=5
  4169. attacker.pbOwnSide.effects[PBEffects::Reflect]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4170. if !@battle.pbIsOpposing?(attacker.index)
  4171. @battle.pbDisplay(_INTL("Reflect raised your team's Defense!"))
  4172. else
  4173. @battle.pbDisplay(_INTL("Reflect raised the opposing team's Defense!"))
  4174. end
  4175. return 0
  4176. end
  4177. end
  4178.  
  4179.  
  4180.  
  4181. ################################################################################
  4182. # For 5 rounds, lowers power of special attacks against the user's side. (Light Screen)
  4183. ################################################################################
  4184. class PokeBattle_Move_0A3 < PokeBattle_Move
  4185. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4186. if attacker.pbOwnSide.effects[PBEffects::LightScreen]>0
  4187. @battle.pbDisplay(_INTL("But it failed!"))
  4188. return -1
  4189. end
  4190. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4191. attacker.pbOwnSide.effects[PBEffects::LightScreen]=5
  4192. attacker.pbOwnSide.effects[PBEffects::LightScreen]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  4193. if !@battle.pbIsOpposing?(attacker.index)
  4194. @battle.pbDisplay(_INTL("Light Screen raised your team's Special Defense!"))
  4195. else
  4196. @battle.pbDisplay(_INTL("Light Screen raised the opposing team's Special Defense!"))
  4197. end
  4198. return 0
  4199. end
  4200. end
  4201.  
  4202.  
  4203.  
  4204. ################################################################################
  4205. # Effect depends on the environment. (Secret Power)
  4206. ################################################################################
  4207. class PokeBattle_Move_0A4 < PokeBattle_Move
  4208. def pbAdditionalEffect(attacker,opponent)
  4209. return if opponent.damagestate.substitute
  4210. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4211. if opponent.pbCanParalyze?(attacker,false,self)
  4212. opponent.pbParalyze(attacker)
  4213. return
  4214. end
  4215. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4216. if opponent.pbCanSleep?(attacker,false,self)
  4217. opponent.pbSleep
  4218. return
  4219. end
  4220. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4221. if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  4222. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  4223. return
  4224. end
  4225. end
  4226. case @battle.environment
  4227. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4228. if opponent.pbCanSleep?(attacker,false,self)
  4229. opponent.pbSleep
  4230. end
  4231. when PBEnvironment::MovingWater, PBEnvironment::Underwater
  4232. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  4233. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  4234. end
  4235. when PBEnvironment::StillWater, PBEnvironment::Sky
  4236. if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  4237. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  4238. end
  4239. when PBEnvironment::Sand
  4240. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4241. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4242. end
  4243. when PBEnvironment::Rock
  4244. if USENEWBATTLEMECHANICS
  4245. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  4246. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  4247. end
  4248. else
  4249. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4250. opponent.pbFlinch(attacker)
  4251. end
  4252. end
  4253. when PBEnvironment::Cave, PBEnvironment::Graveyard, PBEnvironment::Space
  4254. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  4255. opponent.pbFlinch(attacker)
  4256. end
  4257. when PBEnvironment::Snow
  4258. if opponent.pbCanFreeze?(attacker,false,self)
  4259. opponent.pbFreeze
  4260. end
  4261. when PBEnvironment::Volcano
  4262. if opponent.pbCanBurn?(attacker,false,self)
  4263. opponent.pbBurn(attacker)
  4264. end
  4265. else
  4266. if opponent.pbCanParalyze?(attacker,false,self)
  4267. opponent.pbParalyze(attacker)
  4268. end
  4269. end
  4270. end
  4271.  
  4272. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4273. id=getConst(PBMoves,:BODYSLAM)
  4274. case @battle.environment
  4275. when PBEnvironment::Grass, PBEnvironment::TallGrass
  4276. id=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)) || id
  4277. when PBEnvironment::MovingWater; id=getConst(PBMoves,:WATERPULSE) || id
  4278. when PBEnvironment::StillWater; id=getConst(PBMoves,:MUDSHOT) || id
  4279. when PBEnvironment::Underwater; id=getConst(PBMoves,:WATERPULSE) || id
  4280. when PBEnvironment::Cave; id=getConst(PBMoves,:ROCKTHROW) || id
  4281. when PBEnvironment::Rock; id=getConst(PBMoves,:MUDSLAP) || id
  4282. when PBEnvironment::Sand; id=getConst(PBMoves,:MUDSLAP) || id
  4283. when PBEnvironment::Forest; id=getConst(PBMoves,:RAZORLEAF) || id
  4284. # Ice tiles in Gen 6 should be Ice Shard
  4285. when PBEnvironment::Snow; id=getConst(PBMoves,:AVALANCHE) || id
  4286. when PBEnvironment::Volcano; id=getConst(PBMoves,:INCINERATE) || id
  4287. when PBEnvironment::Graveyard; id=getConst(PBMoves,:SHADOWSNEAK) || id
  4288. when PBEnvironment::Sky; id=getConst(PBMoves,:GUST) || id
  4289. when PBEnvironment::Space; id=getConst(PBMoves,:SWIFT) || id
  4290. end
  4291. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4292. id=getConst(PBMoves,:THUNDERSHOCK) || id
  4293. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4294. id=getConst(PBMoves,:VINEWHIP) || id
  4295. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4296. id=getConst(PBMoves,:FAIRYWIND) || id
  4297. end
  4298. return super(id,attacker,opponent,hitnum,alltargets,showanimation) # Environment-specific anim
  4299. end
  4300. end
  4301.  
  4302.  
  4303.  
  4304. ################################################################################
  4305. # Always hits.
  4306. ################################################################################
  4307. class PokeBattle_Move_0A5 < PokeBattle_Move
  4308. def pbAccuracyCheck(attacker,opponent)
  4309. return true
  4310. end
  4311. end
  4312.  
  4313.  
  4314.  
  4315. ################################################################################
  4316. # User's attack next round against the target will definitely hit. (Lock-On, Mind Reader)
  4317. ################################################################################
  4318. class PokeBattle_Move_0A6 < PokeBattle_Move
  4319. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4320. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  4321. @battle.pbDisplay(_INTL("But it failed!"))
  4322. return -1
  4323. end
  4324. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4325. opponent.effects[PBEffects::LockOn]=2
  4326. opponent.effects[PBEffects::LockOnPos]=attacker.index
  4327. @battle.pbDisplay(_INTL("{1} took aim at {2}!",attacker.pbThis,opponent.pbThis(true)))
  4328. return 0
  4329. end
  4330. end
  4331.  
  4332.  
  4333.  
  4334. ################################################################################
  4335. # Target's evasion stat changes are ignored from now on. (Foresight, Odor Sleuth)
  4336. # Normal and Fighting moves have normal effectiveness against the Ghost-type target.
  4337. ################################################################################
  4338. class PokeBattle_Move_0A7 < PokeBattle_Move
  4339. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4340. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4341. @battle.pbDisplay(_INTL("But it failed!"))
  4342. return -1
  4343. end
  4344. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4345. opponent.effects[PBEffects::Foresight]=true
  4346. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4347. return 0
  4348. end
  4349. end
  4350.  
  4351.  
  4352.  
  4353. ################################################################################
  4354. # Target's evasion stat changes are ignored from now on. (Miracle Eye)
  4355. # Psychic moves have normal effectiveness against the Dark-type target.
  4356. ################################################################################
  4357. class PokeBattle_Move_0A8 < PokeBattle_Move
  4358. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4359. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  4360. @battle.pbDisplay(_INTL("But it failed!"))
  4361. return -1
  4362. end
  4363. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4364. opponent.effects[PBEffects::MiracleEye]=true
  4365. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  4366. return 0
  4367. end
  4368. end
  4369.  
  4370.  
  4371.  
  4372. ################################################################################
  4373. # This move ignores target's Defense, Special Defense and evasion stat changes.
  4374. # (Chip Away, Sacred Sword)
  4375. ################################################################################
  4376. class PokeBattle_Move_0A9 < PokeBattle_Move
  4377. # Handled in superclass def pbAccuracyCheck and def pbCalcDamage, do not edit!
  4378. end
  4379.  
  4380.  
  4381.  
  4382. ################################################################################
  4383. # User is protected against moves with the "B" flag this round. (Detect, Protect)
  4384. ################################################################################
  4385. class PokeBattle_Move_0AA < PokeBattle_Move
  4386. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4387. ratesharers=[
  4388. 0xAA, # Detect, Protect
  4389. 0xAB, # Quick Guard
  4390. 0xAC, # Wide Guard
  4391. 0xE8, # Endure
  4392. 0x14B, # King's Shield
  4393. 0x14C # Spiky Shield
  4394. ]
  4395. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4396. attacker.effects[PBEffects::ProtectRate]=1
  4397. end
  4398. unmoved=false
  4399. for poke in @battle.battlers
  4400. next if poke.index==attacker.index
  4401. if @battle.choices[poke.index][0]==1 && # Chose a move
  4402. !poke.hasMovedThisRound?
  4403. unmoved=true; break
  4404. end
  4405. end
  4406. if !unmoved ||
  4407. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  4408. attacker.effects[PBEffects::ProtectRate]=1
  4409. @battle.pbDisplay(_INTL("But it failed!"))
  4410. return -1
  4411. end
  4412. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4413. attacker.effects[PBEffects::Protect]=true
  4414. attacker.effects[PBEffects::ProtectRate]*=2
  4415. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  4416. return 0
  4417. end
  4418. end
  4419.  
  4420.  
  4421.  
  4422. ################################################################################
  4423. # User's side is protected against moves with priority greater than 0 this round.
  4424. # (Quick Guard)
  4425. ################################################################################
  4426. class PokeBattle_Move_0AB < PokeBattle_Move
  4427. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4428. if attacker.pbOwnSide.effects[PBEffects::QuickGuard]
  4429. @battle.pbDisplay(_INTL("But it failed!"))
  4430. return -1
  4431. end
  4432. ratesharers=[
  4433. 0xAA, # Detect, Protect
  4434. 0xAB, # Quick Guard
  4435. 0xAC, # Wide Guard
  4436. 0xE8, # Endure
  4437. 0x14B, # King's Shield
  4438. 0x14C # Spiky Shield
  4439. ]
  4440. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4441. attacker.effects[PBEffects::ProtectRate]=1
  4442. end
  4443. unmoved=false
  4444. for poke in @battle.battlers
  4445. next if poke.index==attacker.index
  4446. if @battle.choices[poke.index][0]==1 && # Chose a move
  4447. !poke.hasMovedThisRound?
  4448. unmoved=true; break
  4449. end
  4450. end
  4451. if !unmoved ||
  4452. (!USENEWBATTLEMECHANICS &&
  4453. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4454. attacker.effects[PBEffects::ProtectRate]=1
  4455. @battle.pbDisplay(_INTL("But it failed!"))
  4456. return -1
  4457. end
  4458. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4459. attacker.pbOwnSide.effects[PBEffects::QuickGuard]=true
  4460. attacker.effects[PBEffects::ProtectRate]*=2
  4461. if !@battle.pbIsOpposing?(attacker.index)
  4462. @battle.pbDisplay(_INTL("Quick Guard protected your team!"))
  4463. else
  4464. @battle.pbDisplay(_INTL("Quick Guard protected the opposing team!"))
  4465. end
  4466. return 0
  4467. end
  4468. end
  4469.  
  4470.  
  4471.  
  4472. ################################################################################
  4473. # User's side is protected against moves that target multiple battlers this round.
  4474. # (Wide Guard)
  4475. ################################################################################
  4476. class PokeBattle_Move_0AC < PokeBattle_Move
  4477. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4478. if attacker.pbOwnSide.effects[PBEffects::WideGuard]
  4479. @battle.pbDisplay(_INTL("But it failed!"))
  4480. return -1
  4481. end
  4482. ratesharers=[
  4483. 0xAA, # Detect, Protect
  4484. 0xAB, # Quick Guard
  4485. 0xAC, # Wide Guard
  4486. 0xE8, # Endure
  4487. 0x14B, # King's Shield
  4488. 0x14C # Spiky Shield
  4489. ]
  4490. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4491. attacker.effects[PBEffects::ProtectRate]=1
  4492. end
  4493. unmoved=false
  4494. for poke in @battle.battlers
  4495. next if poke.index==attacker.index
  4496. if @battle.choices[poke.index][0]==1 && # Chose a move
  4497. !poke.hasMovedThisRound?
  4498. unmoved=true; break
  4499. end
  4500. end
  4501. if !unmoved ||
  4502. (!USENEWBATTLEMECHANICS &&
  4503. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  4504. attacker.effects[PBEffects::ProtectRate]=1
  4505. @battle.pbDisplay(_INTL("But it failed!"))
  4506. return -1
  4507. end
  4508. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4509. attacker.pbOwnSide.effects[PBEffects::WideGuard]=true
  4510. attacker.effects[PBEffects::ProtectRate]*=2
  4511. if !@battle.pbIsOpposing?(attacker.index)
  4512. @battle.pbDisplay(_INTL("Wide Guard protected your team!"))
  4513. else
  4514. @battle.pbDisplay(_INTL("Wide Guard protected the opposing team!"))
  4515. end
  4516. return 0
  4517. end
  4518. end
  4519.  
  4520.  
  4521.  
  4522. ################################################################################
  4523. # Ignores target's protections. If successful, all other moves this round
  4524. # ignore them too. (Feint)
  4525. ################################################################################
  4526. class PokeBattle_Move_0AD < PokeBattle_Move
  4527. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4528. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4529. if ret>0
  4530. opponent.effects[PBEffects::ProtectNegation]=true
  4531. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  4532. end
  4533. return ret
  4534. end
  4535. end
  4536.  
  4537.  
  4538.  
  4539. ################################################################################
  4540. # Uses the last move that the target used. (Mirror Move)
  4541. ################################################################################
  4542. class PokeBattle_Move_0AE < PokeBattle_Move
  4543. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4544. if opponent.lastMoveUsed<=0 ||
  4545. (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
  4546. @battle.pbDisplay(_INTL("The mirror move failed!"))
  4547. return -1
  4548. end
  4549. attacker.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
  4550. return 0
  4551. end
  4552. end
  4553.  
  4554.  
  4555.  
  4556. ################################################################################
  4557. # Uses the last move that was used. (Copycat)
  4558. ################################################################################
  4559. class PokeBattle_Move_0AF < PokeBattle_Move
  4560. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4561. blacklist=[
  4562. 0x69, # Transform
  4563. 0x71, # Counter
  4564. 0x72, # Mirror Coat
  4565. 0x73, # Metal Burst
  4566. 0x9C, # Helping Hand
  4567. 0xAA, # Detect, Protect
  4568. 0xAD, # Feint
  4569. 0xB2, # Snatch
  4570. 0xE7, # Destiny Bond
  4571. 0xE8, # Endure
  4572. 0xEC, # Circle Throw, Dragon Tail
  4573. 0xF1, # Covet, Thief
  4574. 0xF2, # Switcheroo, Trick
  4575. 0xF3, # Bestow
  4576. 0x115, # Focus Punch
  4577. 0x117, # Follow Me, Rage Powder
  4578. 0x158 # Belch
  4579. ]
  4580. if USENEWBATTLEMECHANICS
  4581. blacklist+=[
  4582. 0xEB, # Roar, Whirlwind
  4583. # Two-turn attacks
  4584. 0xC3, # Razor Wind
  4585. 0xC4, # SolarBeam
  4586. 0xC5, # Freeze Shock
  4587. 0xC6, # Ice Burn
  4588. 0xC7, # Sky Attack
  4589. 0xC8, # Skull Bash
  4590. 0xC9, # Fly
  4591. 0xCA, # Dig
  4592. 0xCB, # Dive
  4593. 0xCC, # Bounce
  4594. 0xCD, # Shadow Force
  4595. 0xCE, # Sky Drop
  4596. 0x14D, # Phantom Force
  4597. 0x14E # Geomancy
  4598. ]
  4599. end
  4600. if @battle.lastMoveUsed<=0 ||
  4601. blacklist.include?(PBMoveData.new(@battle.lastMoveUsed).function)
  4602. @battle.pbDisplay(_INTL("But it failed!"))
  4603. return -1
  4604. end
  4605. attacker.pbUseMoveSimple(@battle.lastMoveUsed,-1,@battle.lastMoveUser)
  4606. return 0
  4607. end
  4608. end
  4609.  
  4610.  
  4611.  
  4612. ################################################################################
  4613. # Uses the move the target was about to use this round, with 1.5x power. (Me First)
  4614. ################################################################################
  4615. class PokeBattle_Move_0B0 < PokeBattle_Move
  4616. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4617. blacklist=[
  4618. 0x02, # Struggle
  4619. 0x14, # Chatter
  4620. 0x71, # Counter
  4621. 0x72, # Mirror Coat
  4622. 0x73, # Metal Burst
  4623. 0xB0, # Me First
  4624. 0xF1, # Covet, Thief
  4625. 0x115, # Focus Punch
  4626. 0x158 # Belch
  4627. ]
  4628. oppmove=@battle.choices[opponent.index][2]
  4629. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  4630. opponent.hasMovedThisRound? ||
  4631. !oppmove || oppmove.id<=0 ||
  4632. oppmove.pbIsStatus? ||
  4633. blacklist.include?(oppmove.function)
  4634. @battle.pbDisplay(_INTL("But it failed!"))
  4635. return -1
  4636. end
  4637. attacker.effects[PBEffects::MeFirst]=true
  4638. attacker.pbUseMoveSimple(oppmove.id,-1,-1)
  4639. attacker.effects[PBEffects::MeFirst]=false
  4640. return 0
  4641. end
  4642. end
  4643.  
  4644.  
  4645.  
  4646. ################################################################################
  4647. # This round, reflects all moves with the "C" flag targeting the user back at
  4648. # their origin. (Magic Coat)
  4649. ################################################################################
  4650. class PokeBattle_Move_0B1 < PokeBattle_Move
  4651. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4652. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4653. attacker.effects[PBEffects::MagicCoat]=true
  4654. @battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",attacker.pbThis))
  4655. return 0
  4656. end
  4657. end
  4658.  
  4659.  
  4660.  
  4661. ################################################################################
  4662. # This round, snatches all used moves with the "D" flag. (Snatch)
  4663. ################################################################################
  4664. class PokeBattle_Move_0B2 < PokeBattle_Move
  4665. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4666. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4667. attacker.effects[PBEffects::Snatch]=true
  4668. @battle.pbDisplay(_INTL("{1} waits for a target to make a move!",attacker.pbThis))
  4669. return 0
  4670. end
  4671. end
  4672.  
  4673.  
  4674.  
  4675. ################################################################################
  4676. # Uses a different move depending on the environment. (Nature Power)
  4677. ################################################################################
  4678. class PokeBattle_Move_0B3 < PokeBattle_Move
  4679. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4680. move=getConst(PBMoves,:TRIATTACK) || 0
  4681. case @battle.environment
  4682. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  4683. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:ENERGYBALL) : getConst(PBMoves,:SEEDBOMB)) || move
  4684. when PBEnvironment::MovingWater; move=getConst(PBMoves,:HYDROPUMP) || move
  4685. when PBEnvironment::StillWater; move=getConst(PBMoves,:MUDBOMB) || move
  4686. when PBEnvironment::Underwater; move=getConst(PBMoves,:HYDROPUMP) || move
  4687. when PBEnvironment::Cave
  4688. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:POWERGEM) : getConst(PBMoves,:ROCKSLIDE)) || move
  4689. when PBEnvironment::Rock
  4690. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:ROCKSLIDE)) || move
  4691. when PBEnvironment::Sand
  4692. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:EARTHQUAKE)) || move
  4693. # Ice tiles in Gen 6 should be Ice Beam
  4694. when PBEnvironment::Snow
  4695. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:FROSTBREATH) : getConst(PBMoves,:ICEBEAM)) || move
  4696. when PBEnvironment::Volcano; move=getConst(PBMoves,:LAVAPLUME) || move
  4697. when PBEnvironment::Graveyard; move=getConst(PBMoves,:SHADOWBALL) || move
  4698. when PBEnvironment::Sky; move=getConst(PBMoves,:AIRSLASH) || move
  4699. when PBEnvironment::Space; move=getConst(PBMoves,:DRACOMETEOR) || move
  4700. end
  4701. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  4702. move=getConst(PBMoves,:THUNDERBOLT) || move
  4703. elsif @battle.field.effects[PBEffects::GrassyTerrain]>0
  4704. move=getConst(PBMoves,:ENERGYBALL) || move
  4705. elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  4706. move=getConst(PBMoves,:MOONBLAST) || move
  4707. end
  4708. if move==0
  4709. @battle.pbDisplay(_INTL("But it failed!"))
  4710. return -1
  4711. end
  4712. thismovename=PBMoves.getName(@id)
  4713. movename=PBMoves.getName(move)
  4714. @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
  4715. target=(USENEWBATTLEMECHANICS && opponent) ? opponent.index : -1
  4716. attacker.pbUseMoveSimple(move,-1,target)
  4717. return 0
  4718. end
  4719. end
  4720.  
  4721.  
  4722.  
  4723. ################################################################################
  4724. # Uses a random move the user knows. Fails if user is not asleep. (Sleep Talk)
  4725. ################################################################################
  4726. class PokeBattle_Move_0B4 < PokeBattle_Move
  4727. def pbCanUseWhileAsleep?
  4728. return true
  4729. end
  4730.  
  4731. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4732. if attacker.status!=PBStatuses::SLEEP
  4733. @battle.pbDisplay(_INTL("But it failed!"))
  4734. return -1
  4735. end
  4736. blacklist=[
  4737. 0x02, # Struggle
  4738. 0x14, # Chatter
  4739. 0x5C, # Mimic
  4740. 0x5D, # Sketch
  4741. 0xAE, # Mirror Move
  4742. 0xAF, # Copycat
  4743. 0xB0, # Me First
  4744. 0xB3, # Nature Power
  4745. 0xB4, # Sleep Talk
  4746. 0xB5, # Assist
  4747. 0xB6, # Metronome
  4748. 0xD1, # Uproar
  4749. 0xD4, # Bide
  4750. 0x115, # Focus Punch
  4751. # Two-turn attacks
  4752. 0xC3, # Razor Wind
  4753. 0xC4, # SolarBeam
  4754. 0xC5, # Freeze Shock
  4755. 0xC6, # Ice Burn
  4756. 0xC7, # Sky Attack
  4757. 0xC8, # Skull Bash
  4758. 0xC9, # Fly
  4759. 0xCA, # Dig
  4760. 0xCB, # Dive
  4761. 0xCC, # Bounce
  4762. 0xCD, # Shadow Force
  4763. 0xCE, # Sky Drop
  4764. 0x14D, # Phantom Force
  4765. 0x14E, # Geomancy
  4766. ]
  4767. choices=[]
  4768. for i in 0...4
  4769. found=false
  4770. next if attacker.moves[i].id==0
  4771. found=true if blacklist.include?(attacker.moves[i].function)
  4772. next if found
  4773. choices.push(i) if @battle.pbCanChooseMove?(attacker.index,i,false,true)
  4774. end
  4775. if choices.length==0
  4776. @battle.pbDisplay(_INTL("But it failed!"))
  4777. return -1
  4778. end
  4779. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4780. choice=choices[@battle.pbRandom(choices.length)]
  4781. attacker.pbUseMoveSimple(attacker.moves[choice].id,choice,attacker.pbOppositeOpposing.index)
  4782. return 0
  4783. end
  4784. end
  4785.  
  4786.  
  4787.  
  4788. ################################################################################
  4789. # Uses a random move known by any non-user Pokémon in the user's party. (Assist)
  4790. ################################################################################
  4791. class PokeBattle_Move_0B5 < PokeBattle_Move
  4792. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4793. blacklist=[
  4794. 0x02, # Struggle
  4795. 0x14, # Chatter
  4796. 0x5C, # Mimic
  4797. 0x5D, # Sketch
  4798. 0x69, # Transform
  4799. 0x71, # Counter
  4800. 0x72, # Mirror Coat
  4801. 0x73, # Metal Burst
  4802. 0x9C, # Helping Hand
  4803. 0xAA, # Detect, Protect
  4804. 0xAD, # Feint
  4805. 0xAE, # Mirror Move
  4806. 0xAF, # Copycat
  4807. 0xB0, # Me First
  4808. 0xB2, # Snatch
  4809. 0xB3, # Nature Power
  4810. 0xB4, # Sleep Talk
  4811. 0xB5, # Assist
  4812. 0xB6, # Metronome
  4813. 0xCD, # Shadow Force
  4814. 0xE7, # Destiny Bond
  4815. 0xE8, # Endure
  4816. 0xEB, # Roar, Whirlwind
  4817. 0xEC, # Circle Throw, Dragon Tail
  4818. 0xF1, # Covet, Thief
  4819. 0xF2, # Switcheroo, Trick
  4820. 0xF3, # Bestow
  4821. 0x115, # Focus Punch
  4822. 0x117, # Follow Me, Rage Powder
  4823. 0x149, # Mat Block
  4824. 0x14B, # King's Shield
  4825. 0x14C, # Spiky Shield
  4826. 0x14D, # Phantom Force
  4827. 0x158 # Belch
  4828. ]
  4829. if USENEWBATTLEMECHANICS
  4830. blacklist+=[
  4831. # Two-turn attacks
  4832. 0xC3, # Razor Wind
  4833. 0xC4, # SolarBeam
  4834. 0xC5, # Freeze Shock
  4835. 0xC6, # Ice Burn
  4836. 0xC7, # Sky Attack
  4837. 0xC8, # Skull Bash
  4838. 0xC9, # Fly
  4839. 0xCA, # Dig
  4840. 0xCB, # Dive
  4841. 0xCC, # Bounce
  4842. 0xCD, # Shadow Force
  4843. 0xCE, # Sky Drop
  4844. 0x14D, # Phantom Force
  4845. 0x14E # Geomancy
  4846. ]
  4847. end
  4848. moves=[]
  4849. party=@battle.pbParty(attacker.index) # NOTE: pbParty is common to both allies in multi battles
  4850. for i in 0...party.length
  4851. if i!=attacker.pokemonIndex && party[i] && !(USENEWBATTLEMECHANICS && party[i].isEgg?)
  4852. for j in party[i].moves
  4853. next if isConst?(j.type,PBTypes,:SHADOW)
  4854. next if j.id==0
  4855. found=false
  4856. moves.push(j.id) if !blacklist.include?(PBMoveData.new(j.id).function)
  4857. end
  4858. end
  4859. end
  4860. if moves.length==0
  4861. @battle.pbDisplay(_INTL("But it failed!"))
  4862. return -1
  4863. end
  4864. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4865. move=moves[@battle.pbRandom(moves.length)]
  4866. attacker.pbUseMoveSimple(move)
  4867. return 0
  4868. end
  4869. end
  4870.  
  4871.  
  4872.  
  4873. ################################################################################
  4874. # Uses a random move that exists. (Metronome)
  4875. ################################################################################
  4876. class PokeBattle_Move_0B6 < PokeBattle_Move
  4877. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4878. blacklist=[
  4879. 0x02, # Struggle
  4880. 0x11, # Snore
  4881. 0x14, # Chatter
  4882. 0x5C, # Mimic
  4883. 0x5D, # Sketch
  4884. 0x69, # Transform
  4885. 0x71, # Counter
  4886. 0x72, # Mirror Coat
  4887. 0x73, # Metal Burst
  4888. 0x9C, # Helping Hand
  4889. 0xAA, # Detect, Protect
  4890. 0xAB, # Quick Guard
  4891. 0xAC, # Wide Guard
  4892. 0xAD, # Feint
  4893. 0xAE, # Mirror Move
  4894. 0xAF, # Copycat
  4895. 0xB0, # Me First
  4896. 0xB2, # Snatch
  4897. 0xB3, # Nature Power
  4898. 0xB4, # Sleep Talk
  4899. 0xB5, # Assist
  4900. 0xB6, # Metronome
  4901. 0xE7, # Destiny Bond
  4902. 0xE8, # Endure
  4903. 0xF1, # Covet, Thief
  4904. 0xF2, # Switcheroo, Trick
  4905. 0xF3, # Bestow
  4906. 0x115, # Focus Punch
  4907. 0x117, # Follow Me, Rage Powder
  4908. 0x11D, # After You
  4909. 0x11E # Quash
  4910. ]
  4911. blacklistmoves=[
  4912. :FREEZESHOCK,
  4913. :ICEBURN,
  4914. :RELICSONG,
  4915. :SECRETSWORD,
  4916. :SNARL,
  4917. :TECHNOBLAST,
  4918. :VCREATE,
  4919. :GEOMANCY
  4920. ]
  4921. i=0; loop do break unless i<1000
  4922. move=@battle.pbRandom(PBMoves.maxValue)+1
  4923. next if isConst?(PBMoveData.new(move).type,PBTypes,:SHADOW)
  4924. found=false
  4925. if blacklist.include?(PBMoveData.new(move).function)
  4926. found=true
  4927. else
  4928. for j in blacklistmoves
  4929. if isConst?(move,PBMoves,j)
  4930. found=true
  4931. break
  4932. end
  4933. end
  4934. end
  4935. if !found
  4936. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4937. attacker.pbUseMoveSimple(move)
  4938. return 0
  4939. end
  4940. i+=1
  4941. end
  4942. @battle.pbDisplay(_INTL("But it failed!"))
  4943. return -1
  4944. end
  4945. end
  4946.  
  4947.  
  4948.  
  4949. ################################################################################
  4950. # The target can no longer use the same move twice in a row. (Torment)
  4951. ################################################################################
  4952. class PokeBattle_Move_0B7 < PokeBattle_Move
  4953. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4954. if opponent.effects[PBEffects::Torment]
  4955. @battle.pbDisplay(_INTL("But it failed!"))
  4956. return -1
  4957. end
  4958. if !attacker.hasMoldBreaker
  4959. if opponent.hasWorkingAbility(:AROMAVEIL)
  4960. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4961. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4962. return -1
  4963. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  4964. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  4965. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  4966. return -1
  4967. end
  4968. end
  4969. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4970. opponent.effects[PBEffects::Torment]=true
  4971. @battle.pbDisplay(_INTL("{1} was subjected to torment!",opponent.pbThis))
  4972. return 0
  4973. end
  4974. end
  4975.  
  4976.  
  4977.  
  4978. ################################################################################
  4979. # Disables all target's moves that the user also knows. (Imprison)
  4980. ################################################################################
  4981. class PokeBattle_Move_0B8 < PokeBattle_Move
  4982. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4983. if attacker.effects[PBEffects::Imprison]
  4984. @battle.pbDisplay(_INTL("But it failed!"))
  4985. return -1
  4986. end
  4987. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4988. attacker.effects[PBEffects::Imprison]=true
  4989. @battle.pbDisplay(_INTL("{1} sealed the opponent's move(s)!",attacker.pbThis))
  4990. return 0
  4991. end
  4992. end
  4993.  
  4994.  
  4995.  
  4996. ################################################################################
  4997. # For 5 rounds, disables the last move the target used. (Disable)
  4998. ################################################################################
  4999. class PokeBattle_Move_0B9 < PokeBattle_Move
  5000. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5001. if opponent.effects[PBEffects::Disable]>0
  5002. @battle.pbDisplay(_INTL("But it failed!"))
  5003. return -1
  5004. end
  5005. if !attacker.hasMoldBreaker
  5006. if opponent.hasWorkingAbility(:AROMAVEIL)
  5007. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5008. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5009. return -1
  5010. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5011. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5012. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5013. return -1
  5014. end
  5015. end
  5016. for i in opponent.moves
  5017. if i.id>0 && i.id==opponent.lastMoveUsed && (i.pp>0 || i.totalpp==0)
  5018. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5019. opponent.effects[PBEffects::Disable]=5
  5020. opponent.effects[PBEffects::DisableMove]=opponent.lastMoveUsed
  5021. @battle.pbDisplay(_INTL("{1}'s {2} was disabled!",opponent.pbThis,i.name))
  5022. return 0
  5023. end
  5024. end
  5025. @battle.pbDisplay(_INTL("But it failed!"))
  5026. return -1
  5027. end
  5028. end
  5029.  
  5030.  
  5031.  
  5032. ################################################################################
  5033. # For 4 rounds, disables the target's non-damaging moves. (Taunt)
  5034. ################################################################################
  5035. class PokeBattle_Move_0BA < PokeBattle_Move
  5036. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5037. if opponent.effects[PBEffects::Taunt]>0 ||
  5038. (USENEWBATTLEMECHANICS &&
  5039. !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS))
  5040. @battle.pbDisplay(_INTL("But it failed!"))
  5041. return -1
  5042. end
  5043. if !attacker.hasMoldBreaker
  5044. if opponent.hasWorkingAbility(:AROMAVEIL)
  5045. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5046. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5047. return -1
  5048. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5049. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5050. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5051. return -1
  5052. end
  5053. end
  5054. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5055. opponent.effects[PBEffects::Taunt]=4
  5056. @battle.pbDisplay(_INTL("{1} fell for the taunt!",opponent.pbThis))
  5057. return 0
  5058. end
  5059. end
  5060.  
  5061.  
  5062.  
  5063. ################################################################################
  5064. # For 5 rounds, disables the target's healing moves. (Heal Block)
  5065. ################################################################################
  5066. class PokeBattle_Move_0BB < PokeBattle_Move
  5067. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5068. if opponent.effects[PBEffects::HealBlock]>0
  5069. @battle.pbDisplay(_INTL("But it failed!"))
  5070. return -1
  5071. end
  5072. if !attacker.hasMoldBreaker
  5073. if opponent.hasWorkingAbility(:AROMAVEIL)
  5074. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5075. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5076. return -1
  5077. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5078. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5079. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5080. return -1
  5081. end
  5082. end
  5083. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5084. opponent.effects[PBEffects::HealBlock]=5
  5085. @battle.pbDisplay(_INTL("{1} was prevented from healing!",opponent.pbThis))
  5086. return 0
  5087. end
  5088. end
  5089.  
  5090.  
  5091.  
  5092. ################################################################################
  5093. # For 4 rounds, the target must use the same move each round. (Encore)
  5094. ################################################################################
  5095. class PokeBattle_Move_0BC < PokeBattle_Move
  5096. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5097. blacklist=[
  5098. 0x02, # Struggle
  5099. 0x5C, # Mimic
  5100. 0x5D, # Sketch
  5101. 0x69, # Transform
  5102. 0xAE, # Mirror Move
  5103. 0xBC # Encore
  5104. ]
  5105. if opponent.effects[PBEffects::Encore]>0
  5106. @battle.pbDisplay(_INTL("But it failed!"))
  5107. return -1
  5108. end
  5109. if opponent.lastMoveUsed<=0 ||
  5110. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  5111. @battle.pbDisplay(_INTL("But it failed!"))
  5112. return -1
  5113. end
  5114. if !attacker.hasMoldBreaker
  5115. if opponent.hasWorkingAbility(:AROMAVEIL)
  5116. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5117. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5118. return -1
  5119. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  5120. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  5121. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  5122. return -1
  5123. end
  5124. end
  5125. for i in 0...4
  5126. if opponent.lastMoveUsed==opponent.moves[i].id &&
  5127. (opponent.moves[i].pp>0 || opponent.moves[i].totalpp==0)
  5128. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5129. opponent.effects[PBEffects::Encore]=4
  5130. opponent.effects[PBEffects::EncoreIndex]=i
  5131. opponent.effects[PBEffects::EncoreMove]=opponent.moves[i].id
  5132. @battle.pbDisplay(_INTL("{1} received an encore!",opponent.pbThis))
  5133. return 0
  5134. end
  5135. end
  5136. @battle.pbDisplay(_INTL("But it failed!"))
  5137. return -1
  5138. end
  5139. end
  5140.  
  5141.  
  5142.  
  5143. ################################################################################
  5144. # Hits twice.
  5145. ################################################################################
  5146. class PokeBattle_Move_0BD < PokeBattle_Move
  5147. def pbIsMultiHit
  5148. return true
  5149. end
  5150.  
  5151. def pbNumHits(attacker)
  5152. return 2
  5153. end
  5154. end
  5155.  
  5156.  
  5157.  
  5158. ################################################################################
  5159. # Hits twice. May poison the target on each hit. (Twineedle)
  5160. ################################################################################
  5161. class PokeBattle_Move_0BE < PokeBattle_Move
  5162. def pbIsMultiHit
  5163. return true
  5164. end
  5165.  
  5166. def pbNumHits(attacker)
  5167. return 2
  5168. end
  5169.  
  5170. def pbAdditionalEffect(attacker,opponent)
  5171. return if opponent.damagestate.substitute
  5172. if opponent.pbCanPoison?(attacker,false,self)
  5173. opponent.pbPoison(attacker)
  5174. end
  5175. end
  5176. end
  5177.  
  5178.  
  5179.  
  5180. ################################################################################
  5181. # Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
  5182. # An accuracy check is performed for each hit.
  5183. ################################################################################
  5184. class PokeBattle_Move_0BF < PokeBattle_Move
  5185. def pbIsMultiHit
  5186. return true
  5187. end
  5188.  
  5189. def pbNumHits(attacker)
  5190. return 3
  5191. end
  5192.  
  5193. def successCheckPerHit?
  5194. return @checks
  5195. end
  5196.  
  5197. def pbOnStartUse(attacker)
  5198. @calcbasedmg=@basedamage
  5199. @checks=!attacker.hasWorkingAbility(:SKILLLINK)
  5200. return true
  5201. end
  5202.  
  5203. def pbBaseDamage(basedmg,attacker,opponent)
  5204. ret=@calcbasedmg
  5205. @calcbasedmg+=basedmg
  5206. return ret
  5207. end
  5208. end
  5209.  
  5210.  
  5211.  
  5212. ################################################################################
  5213. # Hits 2-5 times.
  5214. ################################################################################
  5215. class PokeBattle_Move_0C0 < PokeBattle_Move
  5216. def pbIsMultiHit
  5217. return true
  5218. end
  5219.  
  5220. def pbNumHits(attacker)
  5221. hitchances=[2,2,3,3,4,5]
  5222. ret=hitchances[@battle.pbRandom(hitchances.length)]
  5223. ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  5224. return ret
  5225. end
  5226. end
  5227.  
  5228.  
  5229.  
  5230. ################################################################################
  5231. # Hits X times, where X is 1 (the user) plus the number of non-user unfainted
  5232. # status-free Pokémon in the user's party (the participants). Fails if X is 0.
  5233. # Base power of each hit depends on the base Attack stat for the species of that
  5234. # hit's participant. (Beat Up)
  5235. ################################################################################
  5236. class PokeBattle_Move_0C1 < PokeBattle_Move
  5237. def pbIsMultiHit
  5238. return true
  5239. end
  5240.  
  5241. def pbNumHits(attacker)
  5242. return @participants.length
  5243. end
  5244.  
  5245. def pbOnStartUse(attacker)
  5246. party=@battle.pbParty(attacker.index)
  5247. @participants=[]
  5248. for i in 0...party.length
  5249. if attacker.pokemonIndex==i
  5250. @participants.push(i)
  5251. elsif party[i] && !party[i].isEgg? && party[i].hp>0 && party[i].status==0
  5252. @participants.push(i)
  5253. end
  5254. end
  5255. if @participants.length==0
  5256. @battle.pbDisplay(_INTL("But it failed!"))
  5257. return false
  5258. end
  5259. return true
  5260. end
  5261.  
  5262. def pbBaseDamage(basedmg,attacker,opponent)
  5263. party=@battle.pbParty(attacker.index)
  5264. atk=party[@participants[0]].baseStats[1]
  5265. @participants[0]=nil; @participants.compact!
  5266. return 5+(atk/10)
  5267. end
  5268. end
  5269.  
  5270.  
  5271.  
  5272. ################################################################################
  5273. # Two turn attack. Attacks first turn, skips second turn (if successful).
  5274. ################################################################################
  5275. class PokeBattle_Move_0C2 < PokeBattle_Move
  5276. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5277. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5278. if opponent.damagestate.calcdamage>0
  5279. attacker.effects[PBEffects::HyperBeam]=2
  5280. attacker.currentMove=@id
  5281. end
  5282. return ret
  5283. end
  5284. end
  5285.  
  5286.  
  5287.  
  5288. ################################################################################
  5289. # Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
  5290. ################################################################################
  5291. class PokeBattle_Move_0C3 < PokeBattle_Move
  5292. def pbTwoTurnAttack(attacker)
  5293. @immediate=false
  5294. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5295. @immediate=true
  5296. end
  5297. return false if @immediate
  5298. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5299. end
  5300.  
  5301. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5302. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5303. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5304. @battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",attacker.pbThis))
  5305. end
  5306. if @immediate
  5307. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5308. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5309. attacker.pbConsumeItem
  5310. end
  5311. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5312. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5313. end
  5314. end
  5315.  
  5316.  
  5317.  
  5318. ################################################################################
  5319. # Two turn attack. Skips first turn, attacks second turn. (SolarBeam)
  5320. # Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
  5321. ################################################################################
  5322. class PokeBattle_Move_0C4 < PokeBattle_Move
  5323. def pbTwoTurnAttack(attacker)
  5324. @immediate=false; @sunny=false
  5325. if attacker.effects[PBEffects::TwoTurnAttack]==0
  5326. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  5327. @battle.pbWeather==PBWeather::HARSHSUN
  5328. @immediate=true; @sunny=true
  5329. end
  5330. end
  5331. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5332. @immediate=true
  5333. end
  5334. return false if @immediate
  5335. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5336. end
  5337.  
  5338. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  5339. if @battle.pbWeather!=0 &&
  5340. @battle.pbWeather!=PBWeather::SUNNYDAY &&
  5341. @battle.pbWeather!=PBWeather::HARSHSUN
  5342. return (damagemult*0.5).round
  5343. end
  5344. return damagemult
  5345. end
  5346.  
  5347. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5348. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5349. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5350. @battle.pbDisplay(_INTL("{1} took in sunlight!",attacker.pbThis))
  5351. end
  5352. if @immediate && !@sunny
  5353. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5354. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5355. attacker.pbConsumeItem
  5356. end
  5357. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5358. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5359. end
  5360. end
  5361.  
  5362.  
  5363.  
  5364.  
  5365. ################################################################################
  5366. # Two turn attack. Skips first turn, attacks second turn. (Freeze Shock)
  5367. # May paralyze the target.
  5368. ################################################################################
  5369. class PokeBattle_Move_0C5 < PokeBattle_Move
  5370. def pbTwoTurnAttack(attacker)
  5371. @immediate=false
  5372. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5373. @immediate=true
  5374. end
  5375. return false if @immediate
  5376. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5377. end
  5378.  
  5379. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5380. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5381. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5382. @battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",attacker.pbThis))
  5383. end
  5384. if @immediate
  5385. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5386. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5387. attacker.pbConsumeItem
  5388. end
  5389. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5390. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5391. end
  5392.  
  5393. def pbAdditionalEffect(attacker,opponent)
  5394. return if opponent.damagestate.substitute
  5395. if opponent.pbCanParalyze?(attacker,false,self)
  5396. opponent.pbParalyze(attacker)
  5397. end
  5398. end
  5399. end
  5400.  
  5401.  
  5402.  
  5403. ################################################################################
  5404. # Two turn attack. Skips first turn, attacks second turn. (Ice Burn)
  5405. # May burn the target.
  5406. ################################################################################
  5407. class PokeBattle_Move_0C6 < PokeBattle_Move
  5408. def pbTwoTurnAttack(attacker)
  5409. @immediate=false
  5410. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5411. @immediate=true
  5412. end
  5413. return false if @immediate
  5414. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5415. end
  5416.  
  5417. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5418. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5419. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5420. @battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",attacker.pbThis))
  5421. end
  5422. if @immediate
  5423. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5424. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5425. attacker.pbConsumeItem
  5426. end
  5427. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5428. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5429. end
  5430.  
  5431. def pbAdditionalEffect(attacker,opponent)
  5432. return if opponent.damagestate.substitute
  5433. if opponent.pbCanBurn?(attacker,false,self)
  5434. opponent.pbBurn(attacker)
  5435. end
  5436. end
  5437. end
  5438.  
  5439.  
  5440.  
  5441. ################################################################################
  5442. # Two turn attack. Skips first turn, attacks second turn. (Sky Attack)
  5443. # May make the target flinch.
  5444. ################################################################################
  5445. class PokeBattle_Move_0C7 < PokeBattle_Move
  5446. def pbTwoTurnAttack(attacker)
  5447. @immediate=false
  5448. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5449. @immediate=true
  5450. end
  5451. return false if @immediate
  5452. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5453. end
  5454.  
  5455. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5456. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5457. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5458. @battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",attacker.pbThis))
  5459. end
  5460. if @immediate
  5461. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5462. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5463. attacker.pbConsumeItem
  5464. end
  5465. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5466. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5467. end
  5468.  
  5469. def pbAdditionalEffect(attacker,opponent)
  5470. return if opponent.damagestate.substitute
  5471. opponent.pbFlinch(attacker)
  5472. end
  5473. end
  5474.  
  5475.  
  5476.  
  5477. ################################################################################
  5478. # Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
  5479. # (Skull Bash)
  5480. ################################################################################
  5481. class PokeBattle_Move_0C8 < PokeBattle_Move
  5482. def pbTwoTurnAttack(attacker)
  5483. @immediate=false
  5484. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5485. @immediate=true
  5486. end
  5487. return false if @immediate
  5488. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5489. end
  5490.  
  5491. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5492. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5493. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5494. @battle.pbDisplay(_INTL("{1} tucked in its head!",attacker.pbThis))
  5495. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5496. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  5497. end
  5498. end
  5499. if @immediate
  5500. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5501. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5502. attacker.pbConsumeItem
  5503. end
  5504. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5505. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5506. end
  5507. end
  5508.  
  5509.  
  5510.  
  5511. ################################################################################
  5512. # Two turn attack. Skips first turn, attacks second turn. (Fly)
  5513. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5514. ################################################################################
  5515. class PokeBattle_Move_0C9 < PokeBattle_Move
  5516. def unusableInGravity?
  5517. return true
  5518. end
  5519.  
  5520. def pbTwoTurnAttack(attacker)
  5521. @immediate=false
  5522. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5523. @immediate=true
  5524. end
  5525. return false if @immediate
  5526. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5527. end
  5528.  
  5529. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5530. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5531. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5532. @battle.pbDisplay(_INTL("{1} flew up high!",attacker.pbThis))
  5533. end
  5534. if @immediate
  5535. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5536. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5537. attacker.pbConsumeItem
  5538. end
  5539. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5540. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5541. end
  5542. end
  5543.  
  5544.  
  5545.  
  5546. ################################################################################
  5547. # Two turn attack. Skips first turn, attacks second turn. (Dig)
  5548. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5549. ################################################################################
  5550. class PokeBattle_Move_0CA < PokeBattle_Move
  5551. def pbTwoTurnAttack(attacker)
  5552. @immediate=false
  5553. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5554. @immediate=true
  5555. end
  5556. return false if @immediate
  5557. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5558. end
  5559.  
  5560. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5561. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5562. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5563. @battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",attacker.pbThis))
  5564. end
  5565. if @immediate
  5566. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5567. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5568. attacker.pbConsumeItem
  5569. end
  5570. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5571. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5572. end
  5573. end
  5574.  
  5575.  
  5576.  
  5577. ################################################################################
  5578. # Two turn attack. Skips first turn, attacks second turn. (Dive)
  5579. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5580. ################################################################################
  5581. class PokeBattle_Move_0CB < PokeBattle_Move
  5582. def pbTwoTurnAttack(attacker)
  5583. @immediate=false
  5584. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5585. @immediate=true
  5586. end
  5587. return false if @immediate
  5588. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5589. end
  5590.  
  5591. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5592. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5593. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5594. @battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
  5595. end
  5596. if @immediate
  5597. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5598. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5599. attacker.pbConsumeItem
  5600. end
  5601. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5602. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5603. end
  5604. end
  5605.  
  5606.  
  5607.  
  5608. ################################################################################
  5609. # Two turn attack. Skips first turn, attacks second turn. (Bounce)
  5610. # May paralyze the target.
  5611. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5612. ################################################################################
  5613. class PokeBattle_Move_0CC < PokeBattle_Move
  5614. def unusableInGravity?
  5615. return true
  5616. end
  5617.  
  5618. def pbTwoTurnAttack(attacker)
  5619. @immediate=false
  5620. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5621. @immediate=true
  5622. end
  5623. return false if @immediate
  5624. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5625. end
  5626.  
  5627. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5628. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5629. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5630. @battle.pbDisplay(_INTL("{1} sprang up!",attacker.pbThis))
  5631. end
  5632. if @immediate
  5633. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5634. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5635. attacker.pbConsumeItem
  5636. end
  5637. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5638. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5639. end
  5640.  
  5641. def pbAdditionalEffect(attacker,opponent)
  5642. return if opponent.damagestate.substitute
  5643. if opponent.pbCanParalyze?(attacker,false,self)
  5644. opponent.pbParalyze(attacker)
  5645. end
  5646. end
  5647. end
  5648.  
  5649.  
  5650.  
  5651. ################################################################################
  5652. # Two turn attack. Skips first turn, attacks second turn. (Shadow Force)
  5653. # Is invulnerable during use.
  5654. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  5655. # this round. If successful, negates them this round.
  5656. ################################################################################
  5657. class PokeBattle_Move_0CD < PokeBattle_Move
  5658. def pbTwoTurnAttack(attacker)
  5659. @immediate=false
  5660. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5661. @immediate=true
  5662. end
  5663. return false if @immediate
  5664. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5665. end
  5666.  
  5667. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5668. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5669. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5670. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  5671. end
  5672. if @immediate
  5673. @battle.pbCommonAnimation("UseItem",attacker,nil)
  5674. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  5675. attacker.pbConsumeItem
  5676. end
  5677. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5678. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5679. if ret>0
  5680. opponent.effects[PBEffects::ProtectNegation]=true
  5681. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  5682. end
  5683. return ret
  5684. end
  5685. end
  5686.  
  5687.  
  5688.  
  5689. ################################################################################
  5690. # Two turn attack. Skips first turn, attacks second turn. (Sky Drop)
  5691. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5692. # Target is also semi-invulnerable during use, and can't take any action.
  5693. # Doesn't damage airborne Pokémon (but still makes them unable to move during).
  5694. ################################################################################
  5695. class PokeBattle_Move_0CE < PokeBattle_Move
  5696. def unusableInGravity?
  5697. return true
  5698. end
  5699.  
  5700. def pbMoveFailed(attacker,opponent)
  5701. ret=false
  5702. ret=true if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  5703. ret=true if opponent.effects[PBEffects::TwoTurnAttack]>0
  5704. ret=true if opponent.effects[PBEffects::SkyDrop] && attacker.effects[PBEffects::TwoTurnAttack]>0
  5705. ret=true if !opponent.pbIsOpposing?(attacker.index)
  5706. ret=true if USENEWBATTLEMECHANICS && opponent.weight(attacker)>=2000
  5707. return ret
  5708. end
  5709.  
  5710. def pbTwoTurnAttack(attacker)
  5711. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5712. end
  5713.  
  5714. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5715. if attacker.effects[PBEffects::TwoTurnAttack]>0
  5716. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5717. @battle.pbDisplay(_INTL("{1} took {2} into the sky!",attacker.pbThis,opponent.pbThis(true)))
  5718. opponent.effects[PBEffects::SkyDrop]=true
  5719. end
  5720. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5721. ret=super
  5722. @battle.pbDisplay(_INTL("{1} was freed from the Sky Drop!",opponent.pbThis))
  5723. opponent.effects[PBEffects::SkyDrop]=false
  5724. return ret
  5725. end
  5726.  
  5727. def pbTypeModifier(type,attacker,opponent)
  5728. return 0 if opponent.pbHasType?(:FLYING)
  5729. return 0 if !attacker.hasMoldBreaker &&
  5730. opponent.hasWorkingAbility(:LEVITATE) && !opponent.effects[PBEffects::SmackDown]
  5731. return super
  5732. end
  5733. end
  5734.  
  5735.  
  5736.  
  5737. ################################################################################
  5738. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5739. # at end of each round.
  5740. ################################################################################
  5741. class PokeBattle_Move_0CF < PokeBattle_Move
  5742. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5743. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5744. if opponent.damagestate.calcdamage>0 && !opponent.isFainted? &&
  5745. !opponent.damagestate.substitute
  5746. if opponent.effects[PBEffects::MultiTurn]==0
  5747. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5748. if attacker.hasWorkingItem(:GRIPCLAW)
  5749. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5750. end
  5751. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5752. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5753. if isConst?(@id,PBMoves,:BIND)
  5754. @battle.pbDisplay(_INTL("{1} was squeezed by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5755. elsif isConst?(@id,PBMoves,:CLAMP)
  5756. @battle.pbDisplay(_INTL("{1} clamped {2}!",attacker.pbThis,opponent.pbThis(true)))
  5757. elsif isConst?(@id,PBMoves,:FIRESPIN)
  5758. @battle.pbDisplay(_INTL("{1} was trapped in the fiery vortex!",opponent.pbThis))
  5759. elsif isConst?(@id,PBMoves,:MAGMASTORM)
  5760. @battle.pbDisplay(_INTL("{1} became trapped by Magma Storm!",opponent.pbThis))
  5761. elsif isConst?(@id,PBMoves,:SANDTOMB)
  5762. @battle.pbDisplay(_INTL("{1} became trapped by Sand Tomb!",opponent.pbThis))
  5763. elsif isConst?(@id,PBMoves,:WRAP)
  5764. @battle.pbDisplay(_INTL("{1} was wrapped by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5765. elsif isConst?(@id,PBMoves,:INFESTATION)
  5766. @battle.pbDisplay(_INTL("{1} has been afflicted with an infestation by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5767. else
  5768. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5769. end
  5770. end
  5771. end
  5772. return ret
  5773. end
  5774. end
  5775.  
  5776.  
  5777.  
  5778. ################################################################################
  5779. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  5780. # at end of each round. (Whirlpool)
  5781. # Power is doubled if target is using Dive.
  5782. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  5783. ################################################################################
  5784. class PokeBattle_Move_0D0 < PokeBattle_Move
  5785. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5786. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5787. if opponent.damagestate.calcdamage>0 && !opponent.isFainted? &&
  5788. !opponent.damagestate.substitute
  5789. if opponent.effects[PBEffects::MultiTurn]==0
  5790. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  5791. if attacker.hasWorkingItem(:GRIPCLAW)
  5792. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  5793. end
  5794. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5795. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5796. @battle.pbDisplay(_INTL("{1} became trapped in the vortex!",opponent.pbThis))
  5797. end
  5798. end
  5799. return ret
  5800. end
  5801.  
  5802. def pbModifyDamage(damagemult,attacker,opponent)
  5803. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  5804. return (damagemult*2.0).round
  5805. end
  5806. return damagemult
  5807. end
  5808. end
  5809.  
  5810.  
  5811.  
  5812. ################################################################################
  5813. # User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
  5814. ################################################################################
  5815. class PokeBattle_Move_0D1 < PokeBattle_Move
  5816. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5817. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5818. if opponent.damagestate.calcdamage>0
  5819. if attacker.effects[PBEffects::Uproar]==0
  5820. attacker.effects[PBEffects::Uproar]=3
  5821. @battle.pbDisplay(_INTL("{1} caused an uproar!",attacker.pbThis))
  5822. attacker.currentMove=@id
  5823. end
  5824. end
  5825. return ret
  5826. end
  5827. end
  5828.  
  5829.  
  5830.  
  5831. ################################################################################
  5832. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  5833. # (Outrage, Petal Dange, Thrash)
  5834. ################################################################################
  5835. class PokeBattle_Move_0D2 < PokeBattle_Move
  5836. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5837. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5838. if opponent.damagestate.calcdamage>0 &&
  5839. attacker.effects[PBEffects::Outrage]==0 &&
  5840. attacker.status!=PBStatuses::SLEEP
  5841. attacker.effects[PBEffects::Outrage]=2+@battle.pbRandom(2)
  5842. attacker.currentMove=@id
  5843. elsif pbTypeModifier(@type,attacker,opponent)==0
  5844. # Cancel effect if attack is ineffective
  5845. attacker.effects[PBEffects::Outrage]=0
  5846. end
  5847. if attacker.effects[PBEffects::Outrage]>0
  5848. attacker.effects[PBEffects::Outrage]-=1
  5849. if attacker.effects[PBEffects::Outrage]==0 && attacker.pbCanConfuseSelf?(false)
  5850. attacker.pbConfuse
  5851. @battle.pbDisplay(_INTL("{1} became confused due to fatigue!",attacker.pbThis))
  5852. end
  5853. end
  5854. return ret
  5855. end
  5856. end
  5857.  
  5858.  
  5859.  
  5860. ################################################################################
  5861. # User must use this move for 4 more rounds. Power doubles each round.
  5862. # Power is also doubled if user has curled up. (Ice Ball, Rollout)
  5863. ################################################################################
  5864. class PokeBattle_Move_0D3 < PokeBattle_Move
  5865. def pbBaseDamage(basedmg,attacker,opponent)
  5866. shift=(4-attacker.effects[PBEffects::Rollout]) # from 0 through 4, 0 is most powerful
  5867. shift+=1 if attacker.effects[PBEffects::DefenseCurl]
  5868. basedmg=basedmg<<shift
  5869. return basedmg
  5870. end
  5871.  
  5872. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5873. attacker.effects[PBEffects::Rollout]=5 if attacker.effects[PBEffects::Rollout]==0
  5874. attacker.effects[PBEffects::Rollout]-=1
  5875. attacker.currentMove=thismove.id
  5876. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5877. if opponent.damagestate.calcdamage==0 ||
  5878. pbTypeModifier(@type,attacker,opponent)==0 ||
  5879. attacker.status==PBStatuses::SLEEP
  5880. # Cancel effect if attack is ineffective
  5881. attacker.effects[PBEffects::Rollout]=0
  5882. end
  5883. return ret
  5884. end
  5885. end
  5886.  
  5887.  
  5888.  
  5889. ################################################################################
  5890. # User bides its time this round and next round. The round after, deals 2x the
  5891. # total damage it took while biding to the last battler that damaged it. (Bide)
  5892. ################################################################################
  5893. class PokeBattle_Move_0D4 < PokeBattle_Move
  5894. def pbDisplayUseMessage(attacker)
  5895. if attacker.effects[PBEffects::Bide]==0
  5896. @battle.pbDisplayBrief(_INTL("{1} used\r\n{2}!",attacker.pbThis,name))
  5897. attacker.effects[PBEffects::Bide]=2
  5898. attacker.effects[PBEffects::BideDamage]=0
  5899. attacker.effects[PBEffects::BideTarget]=-1
  5900. attacker.currentMove=@id
  5901. pbShowAnimation(@id,attacker,nil)
  5902. return 1
  5903. else
  5904. attacker.effects[PBEffects::Bide]-=1
  5905. if attacker.effects[PBEffects::Bide]==0
  5906. @battle.pbDisplayBrief(_INTL("{1} unleashed energy!",attacker.pbThis))
  5907. return 0
  5908. else
  5909. @battle.pbDisplayBrief(_INTL("{1} is storing energy!",attacker.pbThis))
  5910. return 2
  5911. end
  5912. end
  5913. end
  5914.  
  5915. def pbAddTarget(targets,attacker)
  5916. if attacker.effects[PBEffects::BideTarget]>=0
  5917. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::BideTarget]])
  5918. attacker.pbRandomTarget(targets)
  5919. end
  5920. else
  5921. attacker.pbRandomTarget(targets)
  5922. end
  5923. end
  5924.  
  5925. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5926. if attacker.effects[PBEffects::BideDamage]==0 || !opponent
  5927. @battle.pbDisplay(_INTL("But it failed!"))
  5928. return -1
  5929. end
  5930. if USENEWBATTLEMECHANICS
  5931. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  5932. if typemod==0
  5933. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  5934. return -1
  5935. end
  5936. end
  5937. ret=pbEffectFixedDamage(attacker.effects[PBEffects::BideDamage]*2,attacker,opponent,hitnum,alltargets,showanimation)
  5938. return ret
  5939. end
  5940. end
  5941.  
  5942.  
  5943.  
  5944. ################################################################################
  5945. # Heals user by 1/2 of its max HP.
  5946. ################################################################################
  5947. class PokeBattle_Move_0D5 < PokeBattle_Move
  5948. def isHealingMove?
  5949. return true
  5950. end
  5951.  
  5952. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5953. if attacker.hp==attacker.totalhp
  5954. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5955. return -1
  5956. end
  5957. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5958. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5959. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5960. return 0
  5961. end
  5962. end
  5963.  
  5964.  
  5965.  
  5966. ################################################################################
  5967. # Heals user by 1/2 of its max HP. (Roost)
  5968. # User roosts, and its Flying type is ignored for attacks used against it.
  5969. ################################################################################
  5970. class PokeBattle_Move_0D6 < PokeBattle_Move
  5971. def isHealingMove?
  5972. return true
  5973. end
  5974.  
  5975. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5976. if attacker.hp==attacker.totalhp
  5977. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5978. return -1
  5979. end
  5980. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5981. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5982. attacker.effects[PBEffects::Roost]=true
  5983. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5984. return 0
  5985. end
  5986. end
  5987.  
  5988.  
  5989.  
  5990. ################################################################################
  5991. # Battler in user's position is healed by 1/2 of its max HP, at the end of the
  5992. # next round. (Wish)
  5993. ################################################################################
  5994. class PokeBattle_Move_0D7 < PokeBattle_Move
  5995. def isHealingMove?
  5996. return true
  5997. end
  5998.  
  5999. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6000. if attacker.effects[PBEffects::Wish]>0
  6001. @battle.pbDisplay(_INTL("But it failed!"))
  6002. return -1
  6003. end
  6004. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6005. attacker.effects[PBEffects::Wish]=2
  6006. attacker.effects[PBEffects::WishAmount]=((attacker.totalhp+1)/2).floor
  6007. attacker.effects[PBEffects::WishMaker]=attacker.pokemonIndex
  6008. return 0
  6009. end
  6010. end
  6011.  
  6012.  
  6013.  
  6014. ################################################################################
  6015. # Heals user by an amount depending on the weather. (Moonlight, Morning Sun,
  6016. # Synthesis)
  6017. ################################################################################
  6018. class PokeBattle_Move_0D8 < PokeBattle_Move
  6019. def isHealingMove?
  6020. return true
  6021. end
  6022.  
  6023. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6024. if attacker.hp==attacker.totalhp
  6025. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6026. return -1
  6027. end
  6028. hpgain=0
  6029. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  6030. @battle.pbWeather==PBWeather::HARSHSUN
  6031. hpgain=(attacker.totalhp*2/3).floor
  6032. elsif @battle.pbWeather!=0
  6033. hpgain=(attacker.totalhp/4).floor
  6034. else
  6035. hpgain=(attacker.totalhp/2).floor
  6036. end
  6037. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6038. attacker.pbRecoverHP(hpgain,true)
  6039. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6040. return 0
  6041. end
  6042. end
  6043.  
  6044.  
  6045.  
  6046. ################################################################################
  6047. # Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
  6048. ################################################################################
  6049. class PokeBattle_Move_0D9 < PokeBattle_Move
  6050. def isHealingMove?
  6051. return true
  6052. end
  6053.  
  6054. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6055. if !attacker.pbCanSleep?(attacker,true,self,true)
  6056. return -1
  6057. end
  6058. if attacker.status==PBStatuses::SLEEP
  6059. @battle.pbDisplay(_INTL("But it failed!"))
  6060. return -1
  6061. end
  6062. if attacker.hp==attacker.totalhp
  6063. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  6064. return -1
  6065. end
  6066. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6067. attacker.pbSleepSelf(3)
  6068. @battle.pbDisplay(_INTL("{1} slept and became healthy!",attacker.pbThis))
  6069. hp=attacker.pbRecoverHP(attacker.totalhp-attacker.hp,true)
  6070. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis)) if hp>0
  6071. return 0
  6072. end
  6073. end
  6074.  
  6075.  
  6076.  
  6077. ################################################################################
  6078. # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
  6079. # (Aqua Ring)
  6080. ################################################################################
  6081. class PokeBattle_Move_0DA < PokeBattle_Move
  6082. def isHealingMove?
  6083. return true
  6084. end
  6085.  
  6086. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6087. if attacker.effects[PBEffects::AquaRing]
  6088. @battle.pbDisplay(_INTL("But it failed!"))
  6089. return -1
  6090. end
  6091. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6092. attacker.effects[PBEffects::AquaRing]=true
  6093. @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
  6094. return 0
  6095. end
  6096. end
  6097.  
  6098.  
  6099.  
  6100. ################################################################################
  6101. # Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
  6102. # round, and cannot flee or switch out. (Ingrain)
  6103. ################################################################################
  6104. class PokeBattle_Move_0DB < PokeBattle_Move
  6105. def isHealingMove?
  6106. return true
  6107. end
  6108.  
  6109. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6110. if attacker.effects[PBEffects::Ingrain]
  6111. @battle.pbDisplay(_INTL("But it failed!"))
  6112. return -1
  6113. end
  6114. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6115. attacker.effects[PBEffects::Ingrain]=true
  6116. @battle.pbDisplay(_INTL("{1} planted its roots!",attacker.pbThis))
  6117. return 0
  6118. end
  6119. end
  6120.  
  6121.  
  6122.  
  6123. ################################################################################
  6124. # Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each round,
  6125. # and the Pokémon in the user's position gains the same amount. (Leech Seed)
  6126. ################################################################################
  6127. class PokeBattle_Move_0DC < PokeBattle_Move
  6128. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6129. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6130. @battle.pbDisplay(_INTL("But it failed!"))
  6131. return -1
  6132. end
  6133. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  6134. if opponent.effects[PBEffects::LeechSeed]>=0
  6135. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  6136. return -1
  6137. end
  6138. if opponent.pbHasType?(:GRASS)
  6139. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6140. return -1
  6141. end
  6142. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6143. opponent.effects[PBEffects::LeechSeed]=attacker.index
  6144. @battle.pbDisplay(_INTL("{1} was seeded!",opponent.pbThis))
  6145. return 0
  6146. end
  6147. end
  6148.  
  6149.  
  6150.  
  6151. ################################################################################
  6152. # User gains half the HP it inflicts as damage.
  6153. ################################################################################
  6154. class PokeBattle_Move_0DD < PokeBattle_Move
  6155. def isHealingMove?
  6156. return USENEWBATTLEMECHANICS
  6157. end
  6158.  
  6159. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6160. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6161. if opponent.damagestate.calcdamage>0
  6162. hpgain=(opponent.damagestate.hplost/2).round
  6163. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6164. attacker.pbReduceHP(hpgain,true)
  6165. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6166. elsif attacker.effects[PBEffects::HealBlock]==0
  6167. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6168. attacker.pbRecoverHP(hpgain,true)
  6169. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6170. end
  6171. end
  6172. return ret
  6173. end
  6174. end
  6175.  
  6176.  
  6177.  
  6178. ################################################################################
  6179. # User gains half the HP it inflicts as damage. (Dream Eater)
  6180. # (Handled in Battler's pbSuccessCheck): Fails if target is not asleep.
  6181. ################################################################################
  6182. class PokeBattle_Move_0DE < PokeBattle_Move
  6183. def isHealingMove?
  6184. return USENEWBATTLEMECHANICS
  6185. end
  6186.  
  6187. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6188. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6189. if opponent.damagestate.calcdamage>0
  6190. hpgain=(opponent.damagestate.hplost/2).round
  6191. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6192. attacker.pbReduceHP(hpgain,true)
  6193. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6194. elsif attacker.effects[PBEffects::HealBlock]==0
  6195. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6196. attacker.pbRecoverHP(hpgain,true)
  6197. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6198. end
  6199. end
  6200. return ret
  6201. end
  6202. end
  6203.  
  6204.  
  6205.  
  6206. ################################################################################
  6207. # Heals target by 1/2 of its max HP. (Heal Pulse)
  6208. ################################################################################
  6209. class PokeBattle_Move_0DF < PokeBattle_Move
  6210. def isHealingMove?
  6211. return true
  6212. end
  6213.  
  6214. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6215. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6216. @battle.pbDisplay(_INTL("But it failed!"))
  6217. return -1
  6218. end
  6219. if opponent.hp==opponent.totalhp
  6220. @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
  6221. return -1
  6222. end
  6223. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6224. hpgain=((opponent.totalhp+1)/2).floor
  6225. hpgain=(opponent.totalhp*3/4).round if attacker.hasWorkingAbility(:MEGALAUNCHER)
  6226. opponent.pbRecoverHP(hpgain,true)
  6227. @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
  6228. return 0
  6229. end
  6230. end
  6231.  
  6232.  
  6233.  
  6234. ################################################################################
  6235. # User faints. (Explosion, Selfdestruct)
  6236. ################################################################################
  6237. class PokeBattle_Move_0E0 < PokeBattle_Move
  6238. def pbOnStartUse(attacker)
  6239. if !attacker.hasMoldBreaker
  6240. bearer=@battle.pbCheckGlobalAbility(:DAMP)
  6241. if bearer!=nil
  6242. @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  6243. bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  6244. return false
  6245. end
  6246. end
  6247. return true
  6248. end
  6249.  
  6250. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6251. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6252. if !attacker.isFainted?
  6253. attacker.pbReduceHP(attacker.hp)
  6254. attacker.pbFaint if attacker.isFainted?
  6255. end
  6256. end
  6257. end
  6258.  
  6259.  
  6260.  
  6261. ################################################################################
  6262. # Inflicts fixed damage equal to user's current HP. (Final Gambit)
  6263. # User faints (if successful).
  6264. ################################################################################
  6265. class PokeBattle_Move_0E1 < PokeBattle_Move
  6266. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6267. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  6268. if typemod==0
  6269. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6270. return -1
  6271. end
  6272. ret=pbEffectFixedDamage(attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  6273. return ret
  6274. end
  6275.  
  6276. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6277. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  6278. if !attacker.isFainted?
  6279. attacker.pbReduceHP(attacker.hp)
  6280. attacker.pbFaint if attacker.isFainted?
  6281. end
  6282. end
  6283. end
  6284.  
  6285.  
  6286.  
  6287. ################################################################################
  6288. # Decreases the target's Attack and Special Attack by 2 stages each. (Memento)
  6289. # User faints (even if effect does nothing).
  6290. ################################################################################
  6291. class PokeBattle_Move_0E2 < PokeBattle_Move
  6292. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6293. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  6294. @battle.pbDisplay(_INTL("But it failed!"))
  6295. return -1
  6296. end
  6297. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6298. ret=-1; showanim=true
  6299. if opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  6300. ret=0; showanim=false
  6301. end
  6302. if opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self,showanim)
  6303. ret=0; showanim=false
  6304. end
  6305. attacker.pbReduceHP(attacker.hp)
  6306. return ret
  6307. end
  6308. end
  6309.  
  6310.  
  6311.  
  6312. ################################################################################
  6313. # User faints. The Pokémon that replaces the user is fully healed (HP and
  6314. # status). Fails if user won't be replaced. (Healing Wish)
  6315. ################################################################################
  6316. class PokeBattle_Move_0E3 < PokeBattle_Move
  6317. def isHealingMove?
  6318. return true
  6319. end
  6320.  
  6321. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6322. if !@battle.pbCanChooseNonActive?(attacker.index)
  6323. @battle.pbDisplay(_INTL("But it failed!"))
  6324. return -1
  6325. end
  6326. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6327. attacker.pbReduceHP(attacker.hp)
  6328. attacker.effects[PBEffects::HealingWish]=true
  6329. return 0
  6330. end
  6331. end
  6332.  
  6333.  
  6334.  
  6335. ################################################################################
  6336. # User faints. The Pokémon that replaces the user is fully healed (HP, PP and
  6337. # status). Fails if user won't be replaced. (Lunar Dance)
  6338. ################################################################################
  6339. class PokeBattle_Move_0E4 < PokeBattle_Move
  6340. def isHealingMove?
  6341. return true
  6342. end
  6343.  
  6344. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6345. if !@battle.pbCanChooseNonActive?(attacker.index)
  6346. @battle.pbDisplay(_INTL("But it failed!"))
  6347. return -1
  6348. end
  6349. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6350. attacker.pbReduceHP(attacker.hp)
  6351. attacker.effects[PBEffects::LunarDance]=true
  6352. return 0
  6353. end
  6354. end
  6355.  
  6356.  
  6357.  
  6358. ################################################################################
  6359. # All current battlers will perish after 3 more rounds. (Perish Song)
  6360. ################################################################################
  6361. class PokeBattle_Move_0E5 < PokeBattle_Move
  6362. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6363. failed=true
  6364. for i in 0...4
  6365. if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
  6366. (attacker.hasMoldBreaker ||
  6367. !@battle.battlers[i].hasWorkingAbility(:SOUNDPROOF))
  6368. failed=false; break
  6369. end
  6370. end
  6371. if failed
  6372. @battle.pbDisplay(_INTL("But it failed!"))
  6373. return -1
  6374. end
  6375. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6376. @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
  6377. for i in 0...4
  6378. if @battle.battlers[i].effects[PBEffects::PerishSong]==0
  6379. if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  6380. @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
  6381. PBAbilities.getName(@battle.battlers[i].ability),@name))
  6382. else
  6383. @battle.battlers[i].effects[PBEffects::PerishSong]=4
  6384. @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
  6385. end
  6386. end
  6387. end
  6388. return 0
  6389. end
  6390. end
  6391.  
  6392.  
  6393.  
  6394. ################################################################################
  6395. # If user is KO'd before it next moves, the attack that caused it loses all PP.
  6396. # (Grudge)
  6397. ################################################################################
  6398. class PokeBattle_Move_0E6 < PokeBattle_Move
  6399. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6400. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6401. attacker.effects[PBEffects::Grudge]=true
  6402. @battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",attacker.pbThis))
  6403. return 0
  6404. end
  6405. end
  6406.  
  6407.  
  6408.  
  6409. ################################################################################
  6410. # If user is KO'd before it next moves, the battler that caused it also faints.
  6411. # (Destiny Bond)
  6412. ################################################################################
  6413. class PokeBattle_Move_0E7 < PokeBattle_Move
  6414. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6415. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6416. attacker.effects[PBEffects::DestinyBond]=true
  6417. @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
  6418. return 0
  6419. end
  6420. end
  6421.  
  6422.  
  6423.  
  6424. ################################################################################
  6425. # If user would be KO'd this round, it survives with 1HP instead. (Endure)
  6426. ################################################################################
  6427. class PokeBattle_Move_0E8 < PokeBattle_Move
  6428. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6429. ratesharers=[
  6430. 0xAA, # Detect, Protect
  6431. 0xAB, # Quick Guard
  6432. 0xAC, # Wide Guard
  6433. 0xE8, # Endure
  6434. 0x14B, # King's Shield
  6435. 0x14C # Spiky Shield
  6436. ]
  6437. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  6438. attacker.effects[PBEffects::ProtectRate]=1
  6439. end
  6440. unmoved=false
  6441. for poke in @battle.battlers
  6442. next if poke.index==attacker.index
  6443. if @battle.choices[poke.index][0]==1 && # Chose a move
  6444. !poke.hasMovedThisRound?
  6445. unmoved=true; break
  6446. end
  6447. end
  6448. if !unmoved ||
  6449. @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  6450. attacker.effects[PBEffects::ProtectRate]=1
  6451. @battle.pbDisplay(_INTL("But it failed!"))
  6452. return -1
  6453. end
  6454. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6455. attacker.effects[PBEffects::Endure]=true
  6456. attacker.effects[PBEffects::ProtectRate]*=2
  6457. @battle.pbDisplay(_INTL("{1} braced itself!",attacker.pbThis))
  6458. return 0
  6459. end
  6460. end
  6461.  
  6462.  
  6463.  
  6464. ################################################################################
  6465. # If target would be KO'd by this attack, it survives with 1HP instead. (False Swipe)
  6466. ################################################################################
  6467. class PokeBattle_Move_0E9 < PokeBattle_Move
  6468. # Handled in superclass def pbReduceHPDamage, do not edit!
  6469. end
  6470.  
  6471.  
  6472.  
  6473. ################################################################################
  6474. # User flees from battle. Fails in trainer battles. (Teleport)
  6475. ################################################################################
  6476. class PokeBattle_Move_0EA < PokeBattle_Move
  6477. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6478. if @battle.opponent ||
  6479. !@battle.pbCanRun?(attacker.index)
  6480. @battle.pbDisplay(_INTL("But it failed!"))
  6481. return -1
  6482. end
  6483. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6484. @battle.pbDisplay(_INTL("{1} fled from battle!",attacker.pbThis))
  6485. @battle.decision=3
  6486. return 0
  6487. end
  6488. end
  6489.  
  6490.  
  6491.  
  6492. ################################################################################
  6493. # In wild battles, makes target flee. Fails if target is a higher level than the
  6494. # user.
  6495. # In trainer battles, target switches out.
  6496. # For status moves. (Roar, Whirlwind)
  6497. ################################################################################
  6498. class PokeBattle_Move_0EB < PokeBattle_Move
  6499. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6500. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:SUCTIONCUPS)
  6501. @battle.pbDisplay(_INTL("{1} anchored itself with {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  6502. return -1
  6503. end
  6504. if opponent.effects[PBEffects::Ingrain]
  6505. @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",opponent.pbThis))
  6506. return -1
  6507. end
  6508. if !@battle.opponent
  6509. if opponent.level>attacker.level
  6510. @battle.pbDisplay(_INTL("But it failed!"))
  6511. return -1
  6512. end
  6513. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6514. @battle.decision=3 # Set decision to escaped
  6515. return 0
  6516. else
  6517. choices=false
  6518. party=@battle.pbParty(opponent.index)
  6519. for i in 0...party.length
  6520. if @battle.pbCanSwitch?(opponent.index,i,false,true)
  6521. choices=true
  6522. break
  6523. end
  6524. end
  6525. if !choices
  6526. @battle.pbDisplay(_INTL("But it failed!"))
  6527. return -1
  6528. end
  6529. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6530. opponent.effects[PBEffects::Roar]=true
  6531. return 0
  6532. end
  6533. end
  6534. end
  6535.  
  6536.  
  6537.  
  6538. ################################################################################
  6539. # In wild battles, makes target flee. Fails if target is a higher level than the
  6540. # user.
  6541. # In trainer battles, target switches out.
  6542. # For damaging moves. (Circle Throw, Dragon Tail)
  6543. ################################################################################
  6544. class PokeBattle_Move_0EC < PokeBattle_Move
  6545. def pbEffectAfterHit(attacker,opponent,turneffects)
  6546. if !attacker.isFainted? && !opponent.isFainted? &&
  6547. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6548. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SUCTIONCUPS)) &&
  6549. !opponent.effects[PBEffects::Ingrain]
  6550. if !@battle.opponent
  6551. if opponent.level<=attacker.level
  6552. @battle.decision=3 # Set decision to escaped
  6553. end
  6554. else
  6555. party=@battle.pbParty(opponent.index)
  6556. for i in 0..party.length-1
  6557. if @battle.pbCanSwitch?(opponent.index,i,false)
  6558. opponent.effects[PBEffects::Roar]=true
  6559. break
  6560. end
  6561. end
  6562. end
  6563. end
  6564. end
  6565. end
  6566.  
  6567.  
  6568.  
  6569. ################################################################################
  6570. # User switches out. Various effects affecting the user are passed to the
  6571. # replacement. (Baton Pass)
  6572. ################################################################################
  6573. class PokeBattle_Move_0ED < PokeBattle_Move
  6574. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6575. if !@battle.pbCanChooseNonActive?(attacker.index)
  6576. @battle.pbDisplay(_INTL("But it failed!"))
  6577. return -1
  6578. end
  6579. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6580. attacker.effects[PBEffects::BatonPass]=true
  6581. return 0
  6582. end
  6583. end
  6584.  
  6585.  
  6586.  
  6587. ################################################################################
  6588. # After inflicting damage, user switches out. Ignores trapping moves.
  6589. # (U-turn, Volt Switch)
  6590. # TODO: Pursuit should interrupt this move.
  6591. ################################################################################
  6592. class PokeBattle_Move_0EE < PokeBattle_Move
  6593. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6594. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6595. if !attacker.isFainted? && opponent.damagestate.calcdamage>0 &&
  6596. @battle.pbCanChooseNonActive?(attacker.index) &&
  6597. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  6598. attacker.effects[PBEffects::Uturn]=true
  6599. end
  6600. return ret
  6601. end
  6602. end
  6603.  
  6604.  
  6605.  
  6606. ################################################################################
  6607. # Target can no longer switch out or flee, as long as the user remains active.
  6608. # (Block, Mean Look, Spider Web, Thousand Waves)
  6609. ################################################################################
  6610. class PokeBattle_Move_0EF < PokeBattle_Move
  6611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6612. if pbIsDamaging?
  6613. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6614. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6615. !opponent.isFainted?
  6616. if opponent.effects[PBEffects::MeanLook]<0 &&
  6617. (!USENEWBATTLEMECHANICS || !opponent.pbHasType?(:GHOST))
  6618. opponent.effects[PBEffects::MeanLook]=attacker.index
  6619. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6620. end
  6621. end
  6622. return ret
  6623. end
  6624. if opponent.effects[PBEffects::MeanLook]>=0 ||
  6625. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  6626. @battle.pbDisplay(_INTL("But it failed!"))
  6627. return -1
  6628. end
  6629. if USENEWBATTLEMECHANICS && opponent.pbHasType?(:GHOST)
  6630. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  6631. return -1
  6632. end
  6633. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6634. opponent.effects[PBEffects::MeanLook]=attacker.index
  6635. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  6636. return 0
  6637. end
  6638. end
  6639.  
  6640.  
  6641.  
  6642. ################################################################################
  6643. # Target drops its item. It regains the item at the end of the battle. (Knock Off)
  6644. # If target has a losable item, damage is multiplied by 1.5.
  6645. ################################################################################
  6646. class PokeBattle_Move_0F0 < PokeBattle_Move
  6647. def pbEffectAfterHit(attacker,opponent,turneffects)
  6648. if !attacker.isFainted? && !opponent.isFainted? && opponent.item!=0 &&
  6649. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6650. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD) || opponent.hasWorkingAbility(:RKSSYSTEM)
  6651. abilityname=PBAbilities.getName(opponent.ability)
  6652. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6653. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6654. itemname=PBItems.getName(opponent.item)
  6655. opponent.item=0
  6656. opponent.effects[PBEffects::ChoiceBand]=-1
  6657. opponent.effects[PBEffects::Unburden]=true
  6658. @battle.pbDisplay(_INTL("{1} dropped its {2}!",opponent.pbThis,itemname))
  6659. end
  6660. end
  6661. end
  6662.  
  6663. def pbModifyDamage(damagemult,attacker,opponent)
  6664. if USENEWBATTLEMECHANICS &&
  6665. !@battle.pbIsUnlosableItem(opponent,opponent.item)
  6666. # Still boosts damage even if opponent has Sticky Hold
  6667. return (damagemult*1.5).round
  6668. end
  6669. return damagemult
  6670. end
  6671. end
  6672.  
  6673.  
  6674.  
  6675. ################################################################################
  6676. # User steals the target's item, if the user has none itself. (Covet, Thief)
  6677. # Items stolen from wild Pokémon are kept after the battle.
  6678. ################################################################################
  6679. class PokeBattle_Move_0F1 < PokeBattle_Move
  6680. def pbEffectAfterHit(attacker,opponent,turneffects)
  6681. if !attacker.isFainted? && !opponent.isFainted? && opponent.item!=0 &&
  6682. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6683. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6684. abilityname=PBAbilities.getName(opponent.ability)
  6685. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6686. elsif opponent.hasWorkingAbility(:RKSSYSTEM) &&
  6687. opponent.hasWorkingItem(:FIGHTINGMEMORY) ||
  6688. opponent.hasWorkingItem(:FLYINGMEMORY) ||
  6689. opponent.hasWorkingItem(:POISONMEMORY) ||
  6690. opponent.hasWorkingItem(:GROUNDMEMORY) ||
  6691. opponent.hasWorkingItem(:ROCKMEMORY) ||
  6692. opponent.hasWorkingItem(:BUGMEMORY) ||
  6693. opponent.hasWorkingItem(:GHOSTMEMORY) ||
  6694. opponent.hasWorkingItem(:STEELMEMORY) ||
  6695. opponent.hasWorkingItem(:FIREMEMORY) ||
  6696. opponent.hasWorkingItem(:WATERMEMORY) ||
  6697. opponent.hasWorkingItem(:GRASSMEMORY) ||
  6698. opponent.hasWorkingItem(:ELECTRICMEMORY) ||
  6699. opponent.hasWorkingItem(:PSYCHICMEMORY) ||
  6700. opponent.hasWorkingItem(:ICEMEMORY) ||
  6701. opponent.hasWorkingItem(:DRAGONMEMORY) ||
  6702. opponent.hasWorkingItem(:DARKMEMORY) ||
  6703. opponent.hasWorkingItem(:FAIRYMEMORY)
  6704. @battle.pbDisplay(_INTL("{1}'s {2} can't be stolen!",opponent.pbThis,PBItems.getName(opponent.item)))
  6705. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item) &&
  6706. !@battle.pbIsUnlosableItem(attacker,opponent.item) &&
  6707. attacker.item==0 &&
  6708. (@battle.opponent || !@battle.pbIsOpposing?(attacker.index))
  6709. itemname=PBItems.getName(opponent.item)
  6710. attacker.item=opponent.item
  6711. opponent.item=0
  6712. opponent.effects[PBEffects::ChoiceBand]=-1
  6713. opponent.effects[PBEffects::Unburden]=true
  6714. if !@battle.opponent && # In a wild battle
  6715. attacker.pokemon.itemInitial==0 &&
  6716. opponent.pokemon.itemInitial==attacker.item
  6717. attacker.pokemon.itemInitial=attacker.item
  6718. opponent.pokemon.itemInitial=0
  6719. end
  6720. @battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  6721. end
  6722. end
  6723. end
  6724. end
  6725.  
  6726.  
  6727.  
  6728. ################################################################################
  6729. # User and target swap items. They remain swapped after wild battles.
  6730. # (Switcheroo, Trick)
  6731. ################################################################################
  6732. class PokeBattle_Move_0F2 < PokeBattle_Move
  6733. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6734. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6735. (attacker.item==0 && opponent.item==0) ||
  6736. (!@battle.opponent && @battle.pbIsOpposing?(attacker.index))
  6737. @battle.pbDisplay(_INTL("But it failed!"))
  6738. return -1
  6739. end
  6740. if @battle.pbIsUnlosableItem(opponent,opponent.item) ||
  6741. @battle.pbIsUnlosableItem(attacker,opponent.item) ||
  6742. @battle.pbIsUnlosableItem(opponent,attacker.item) ||
  6743. @battle.pbIsUnlosableItem(attacker,attacker.item)
  6744. @battle.pbDisplay(_INTL("But it failed!"))
  6745. return -1
  6746. end
  6747. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  6748. abilityname=PBAbilities.getName(opponent.ability)
  6749. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,name))
  6750. return -1
  6751. end
  6752. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6753. oldattitem=attacker.item
  6754. oldoppitem=opponent.item
  6755. oldattitemname=PBItems.getName(oldattitem)
  6756. oldoppitemname=PBItems.getName(oldoppitem)
  6757. tmpitem=attacker.item
  6758. attacker.item=opponent.item
  6759. opponent.item=tmpitem
  6760. if !@battle.opponent && # In a wild battle
  6761. attacker.pokemon.itemInitial==oldattitem &&
  6762. opponent.pokemon.itemInitial==oldoppitem
  6763. attacker.pokemon.itemInitial=oldoppitem
  6764. opponent.pokemon.itemInitial=oldattitem
  6765. end
  6766. @battle.pbDisplay(_INTL("{1} switched items with its opponent!",attacker.pbThis))
  6767. if oldoppitem>0 && oldattitem>0
  6768. @battle.pbDisplayPaused(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname))
  6769. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname))
  6770. else
  6771. @battle.pbDisplay(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname)) if oldoppitem>0
  6772. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname)) if oldattitem>0
  6773. end
  6774. attacker.effects[PBEffects::ChoiceBand]=-1
  6775. opponent.effects[PBEffects::ChoiceBand]=-1
  6776. return 0
  6777. end
  6778. end
  6779.  
  6780.  
  6781.  
  6782. ################################################################################
  6783. # User gives its item to the target. The item remains given after wild battles.
  6784. # (Bestow)
  6785. ################################################################################
  6786. class PokeBattle_Move_0F3 < PokeBattle_Move
  6787. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6788. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  6789. attacker.item==0 || opponent.item!=0
  6790. @battle.pbDisplay(_INTL("But it failed!"))
  6791. return -1
  6792. end
  6793. if @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6794. @battle.pbIsUnlosableItem(opponent,attacker.item)
  6795. @battle.pbDisplay(_INTL("But it failed!"))
  6796. return -1
  6797. end
  6798. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6799. itemname=PBItems.getName(attacker.item)
  6800. opponent.item=attacker.item
  6801. attacker.item=0
  6802. attacker.effects[PBEffects::ChoiceBand]=-1
  6803. attacker.effects[PBEffects::Unburden]=true
  6804. if !@battle.opponent && # In a wild battle
  6805. opponent.pokemon.itemInitial==0 &&
  6806. attacker.pokemon.itemInitial==opponent.item
  6807. opponent.pokemon.itemInitial=opponent.item
  6808. attacker.pokemon.itemInitial=0
  6809. end
  6810. @battle.pbDisplay(_INTL("{1} received {2} from {3}!",opponent.pbThis,itemname,attacker.pbThis(true)))
  6811. return 0
  6812. end
  6813. end
  6814.  
  6815.  
  6816.  
  6817. ################################################################################
  6818. # User consumes target's berry and gains its effect. (Bug Bite, Pluck)
  6819. ################################################################################
  6820. class PokeBattle_Move_0F4 < PokeBattle_Move
  6821. def pbEffectAfterHit(attacker,opponent,turneffects)
  6822. if !attacker.isFainted? && !opponent.isFainted? && pbIsBerry?(opponent.item) &&
  6823. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  6824. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:STICKYHOLD)
  6825. item=opponent.item
  6826. itemname=PBItems.getName(item)
  6827. opponent.pbConsumeItem(false,false)
  6828. @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",attacker.pbThis,itemname))
  6829. if !attacker.hasWorkingAbility(:KLUTZ) &&
  6830. attacker.effects[PBEffects::Embargo]==0
  6831. attacker.pbActivateBerryEffect(item,false)
  6832. end
  6833. # Symbiosis
  6834. if attacker.item==0 &&
  6835. attacker.pbPartner && attacker.pbPartner.hasWorkingAbility(:SYMBIOSIS)
  6836. partner=attacker.pbPartner
  6837. if partner.item>0 &&
  6838. !@battle.pbIsUnlosableItem(partner,partner.item) &&
  6839. !@battle.pbIsUnlosableItem(attacker,partner.item)
  6840. @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
  6841. partner.pbThis,PBAbilities.getName(partner.ability),
  6842. PBItems.getName(partner.item),attacker.pbThis(true)))
  6843. attacker.item=partner.item
  6844. partner.item=0
  6845. partner.effects[PBEffects::Unburden]=true
  6846. attacker.pbBerryCureCheck
  6847. end
  6848. end
  6849. end
  6850. end
  6851. end
  6852. end
  6853.  
  6854.  
  6855.  
  6856. ################################################################################
  6857. # Target's berry is destroyed. (Incinerate)
  6858. ################################################################################
  6859. class PokeBattle_Move_0F5 < PokeBattle_Move
  6860. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6861. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6862. if !attacker.isFainted? && opponent.damagestate.calcdamage>0 &&
  6863. !opponent.damagestate.substitute &&
  6864. (pbIsBerry?(opponent.item) || (USENEWBATTLEMECHANICS && pbIsGem?(opponent.item)))
  6865. itemname=PBItems.getName(opponent.item)
  6866. opponent.pbConsumeItem(false,false)
  6867. @battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",opponent.pbThis,itemname))
  6868. end
  6869. return ret
  6870. end
  6871. end
  6872.  
  6873.  
  6874.  
  6875. ################################################################################
  6876. # User recovers the last item it held and consumed. (Recycle)
  6877. ################################################################################
  6878. class PokeBattle_Move_0F6 < PokeBattle_Move
  6879. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6880. if !attacker.pokemon || attacker.pokemon.itemRecycle==0
  6881. @battle.pbDisplay(_INTL("But it failed!"))
  6882. return -1
  6883. end
  6884. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6885. item=attacker.pokemon.itemRecycle
  6886. itemname=PBItems.getName(item)
  6887. attacker.item=item
  6888. if !@battle.opponent # In a wild battle
  6889. attacker.pokemon.itemInitial=item if attacker.pokemon.itemInitial==0
  6890. end
  6891. attacker.pokemon.itemRecycle=0
  6892. attacker.effects[PBEffects::PickupItem]=0
  6893. attacker.effects[PBEffects::PickupUse]=0
  6894. @battle.pbDisplay(_INTL("{1} found one {2}!",attacker.pbThis,itemname))
  6895. return 0
  6896. end
  6897. end
  6898.  
  6899.  
  6900.  
  6901. ################################################################################
  6902. # User flings its item at the target. Power and effect depend on the item. (Fling)
  6903. ################################################################################
  6904. class PokeBattle_Move_0F7 < PokeBattle_Move
  6905. def flingarray
  6906. return {
  6907. 130 => [:IRONBALL],
  6908. 100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,
  6909. :HELIXFOSSIL,:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,
  6910. :ROOTFOSSIL,:SAILFOSSIL,:SKULLFOSSIL],
  6911. 90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,
  6912. :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,
  6913. :MEADOWPLATE,:MINDPLATE,:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,
  6914. :SPOOKYPLATE,:STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],
  6915. 80 => [:ASSAULTVEST,:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,
  6916. :ODDKEYSTONE,:OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,
  6917. :SAFETYGOGGLES,:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY],
  6918. 70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,
  6919. :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
  6920. :POWERWEIGHT,:SHOCKDRIVE],
  6921. 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LUSTROUSORB,
  6922. :MACHOBRACE,:ROCKYHELMET,:STICK],
  6923. 50 => [:DUBIOUSDISC,:SHARPBEAK],
  6924. 40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH,PROTECTIVEPADS,TERRAINEXTENDER],
  6925. 30 => [:ABILITYCAPSULE,:ABILITYURGE,:ABSORBBULB,:AMAZEMULCH,:AMULETCOIN,
  6926. :ANTIDOTE,:AWAKENING,:BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,
  6927. :BIGNUGGET,:BIGPEARL,:BINDINGBAND,:BLACKBELT,:BLACKFLUTE,
  6928. :BLACKGLASSES,:BLACKSLUDGE,:BLUEFLUTE,:BLUESHARD,:BOOSTMULCH,
  6929. :BURNHEAL,:CALCIUM,:CARBOS,:CASTELIACONE,:CELLBATTERY,
  6930. :CHARCOAL,:CLEANSETAG,:COMETSHARD,:DAMPMULCH,:DEEPSEASCALE,
  6931. :DIREHIT,:DIREHIT2,:DIREHIT3,:DRAGONSCALE,:EJECTBUTTON,
  6932. :ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ESCAPEROPE,:ETHER,
  6933. :EVERSTONE,:EXPSHARE,:FIRESTONE,:FLAMEORB,:FLOATSTONE,
  6934. :FLUFFYTAIL,:FRESHWATER,:FULLHEAL,:FULLRESTORE,:GOOEYMULCH,
  6935. :GREENSHARD,:GROWTHMULCH,:GUARDSPEC,:HEALPOWDER,:HEARTSCALE,
  6936. :HONEY,:HPUP,:HYPERPOTION,:ICEHEAL,:IRON,
  6937. :ITEMDROP,:ITEMURGE,:KINGSROCK,:LAVACOOKIE,:LEAFSTONE,
  6938. :LEMONADE,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,:LUCKYEGG,
  6939. :LUMINOUSMOSS,:LUMIOSEGALETTE,:MAGNET,:MAXELIXIR,:MAXETHER,
  6940. :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,
  6941. :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,
  6942. :NUGGET,:OLDGATEAU,:PARALYZEHEAL,:PARLYZHEAL,:PASSORB,
  6943. :PEARL,:PEARLSTRING,:POKEDOLL,:POKETOY,:POTION,
  6944. :PPMAX,:PPUP,:PRISMSCALE,:PROTEIN,:RAGECANDYBAR,
  6945. :RARECANDY,:RAZORFANG,:REDFLUTE,:REDSHARD,:RELICBAND,
  6946. :RELICCOPPER,:RELICCROWN,:RELICGOLD,:RELICSILVER,:RELICSTATUE,
  6947. :RELICVASE,:REPEL,:RESETURGE,:REVIVALHERB,:REVIVE,
  6948. :RICHMULCH,:SACHET,:SACREDASH,:SCOPELENS,:SHALOURSABLE,
  6949. :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
  6950. :SODAPOP,:SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,
  6951. :STARPIECE,:SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SURPRISEMULCH,
  6952. :SWEETHEART,:THUNDERSTONE,:TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,
  6953. :UPGRADE,:WATERSTONE,:WHIPPEDDREAM,:WHITEFLUTE,:XACCURACY,
  6954. :XACCURACY2,:XACCURACY3,:XACCURACY6,:XATTACK,:XATTACK2,
  6955. :XATTACK3,:XATTACK6,:XDEFEND,:XDEFEND2,:XDEFEND3,
  6956. :XDEFEND6,:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
  6957. :XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,:XSPATK,
  6958. :XSPATK2,:XSPATK3,:XSPATK6,:XSPECIAL,:XSPECIAL2,
  6959. :XSPECIAL3,:XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,
  6960. :XSPEED6,:YELLOWFLUTE,:YELLOWSHARD,:ZINC,:FIGHTINGMEMORY,
  6961. :FLYINGMEMORY,:POISONMEMORY,:GROUNDMEMORY,:ROCKMEMORY,:BUGMEMORY,
  6962. :GHOSTMEMORY,:STEELMEMORY,:FIREMEMORY,:WATERMEMORY,:GRASSMEMORY,
  6963. :ELECTRICMEMORY,:PSYCHICMEMORY,:ICEMEMORY,:DRAGONMEMORY,:DARKMEMORY,
  6964. :FAIRYMEMORY,:ADRENALINEORB,:BOTTLECAP,:GOLDBOTTLECAP,:ICESTONE],
  6965. 20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
  6966. :RESISTWING,:SWIFTWING],
  6967. 10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,
  6968. :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,
  6969. :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,
  6970. :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,
  6971. :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,
  6972. :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,
  6973. :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,
  6974. :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,
  6975. :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS,:BIGMALASADA,
  6976. :ELECTRICSEED,:GRASSYSEED,:MISTYSEED,:PSYCHICSEED,:REDNECTAR,
  6977. :YELLOWNECTAR,:PINKNECTAR,:PURPLENECTAR]
  6978. }
  6979. end
  6980.  
  6981. def pbMoveFailed(attacker,opponent)
  6982. return true if attacker.item==0 ||
  6983. @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6984. pbIsPokeBall?(attacker.item) ||
  6985. @battle.field.effects[PBEffects::MagicRoom]>0 ||
  6986. attacker.hasWorkingAbility(:KLUTZ) ||
  6987. attacker.effects[PBEffects::Embargo]>0
  6988. for i in flingarray.keys
  6989. if flingarray[i]
  6990. for j in flingarray[i]
  6991. return false if isConst?(attacker.item,PBItems,j)
  6992. end
  6993. end
  6994. end
  6995. return false if pbIsBerry?(attacker.item) &&
  6996. !attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) &&
  6997. !attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  6998. return true
  6999. end
  7000.  
  7001. def pbBaseDamage(basedmg,attacker,opponent)
  7002. return 10 if pbIsBerry?(attacker.item)
  7003. return 80 if pbIsMegaStone?(attacker.item)
  7004. for i in flingarray.keys
  7005. if flingarray[i]
  7006. for j in flingarray[i]
  7007. return i if isConst?(attacker.item,PBItems,j)
  7008. end
  7009. end
  7010. end
  7011. return 1
  7012. end
  7013.  
  7014. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7015. if attacker.item==0
  7016. @battle.pbDisplay(_INTL("But it failed!"))
  7017. return 0
  7018. end
  7019. attacker.effects[PBEffects::Unburden]=true
  7020. @battle.pbDisplay(_INTL("{1} flung its {2}!",attacker.pbThis,PBItems.getName(attacker.item)))
  7021. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7022. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  7023. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SHIELDDUST))
  7024. if pbIsBerry?(@item)
  7025. opponent.pbActivateBerryEffect(attacker.item,false)
  7026. elsif attacker.hasWorkingItem(:FLAMEORB)
  7027. if opponent.pbCanBurn?(attacker,false,self)
  7028. opponent.pbBurn(attacker)
  7029. end
  7030. elsif attacker.hasWorkingItem(:KINGSROCK) ||
  7031. attacker.hasWorkingItem(:RAZORFANG)
  7032. opponent.pbFlinch(attacker)
  7033. elsif attacker.hasWorkingItem(:LIGHTBALL)
  7034. if opponent.pbCanParalyze?(attacker,false,self)
  7035. opponent.pbParalyze(attacker)
  7036. end
  7037. elsif attacker.hasWorkingItem(:MENTALHERB)
  7038. if opponent.effects[PBEffects::Attract]>=0
  7039. opponent.pbCureAttract
  7040. @battle.pbDisplay(_INTL("{1} got over its infatuation.",opponent.pbThis))
  7041. end
  7042. if opponent.effects[PBEffects::Taunt]>0
  7043. opponent.effects[PBEffects::Taunt]=0
  7044. @battle.pbDisplay(_INTL("{1}'s taunt wore off!",opponent.pbThis))
  7045. end
  7046. if opponent.effects[PBEffects::Encore]>0
  7047. opponent.effects[PBEffects::Encore]=0
  7048. opponent.effects[PBEffects::EncoreMove]=0
  7049. opponent.effects[PBEffects::EncoreIndex]=0
  7050. @battle.pbDisplay(_INTL("{1}'s encore ended!",opponent.pbThis))
  7051. end
  7052. if opponent.effects[PBEffects::Torment]
  7053. opponent.effects[PBEffects::Torment]=false
  7054. @battle.pbDisplay(_INTL("{1}'s torment wore off!",opponent.pbThis))
  7055. end
  7056. if opponent.effects[PBEffects::Disable]>0
  7057. opponent.effects[PBEffects::Disable]=0
  7058. @battle.pbDisplay(_INTL("{1} is no longer disabled!",opponent.pbThis))
  7059. end
  7060. if opponent.effects[PBEffects::HealBlock]>0
  7061. opponent.effects[PBEffects::HealBlock]=0
  7062. @battle.pbDisplay(_INTL("{1}'s Heal Block wore off!",opponent.pbThis))
  7063. end
  7064. elsif attacker.hasWorkingItem(:POISONBARB)
  7065. if opponent.pbCanPoison?(attacker,false,self)
  7066. opponent.pbPoison(attacker)
  7067. end
  7068. elsif attacker.hasWorkingItem(:TOXICORB)
  7069. if opponent.pbCanPoison?(attacker,false,self)
  7070. opponent.pbPoison(attacker,nil,true)
  7071. end
  7072. elsif attacker.hasWorkingItem(:WHITEHERB)
  7073. while true
  7074. reducedstats=false
  7075. for i in [PBStats::ATTACK,PBStats::DEFENSE,
  7076. PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF,
  7077. PBStats::EVASION,PBStats::ACCURACY]
  7078. if opponent.stages[i]<0
  7079. opponent.stages[i]=0; reducedstats=true
  7080. end
  7081. end
  7082. break if !reducedstats
  7083. @battle.pbDisplay(_INTL("{1}'s status is returned to normal!",
  7084. opponent.pbThis(true)))
  7085. end
  7086. end
  7087. end
  7088. attacker.pbConsumeItem
  7089. return ret
  7090. end
  7091. end
  7092.  
  7093.  
  7094.  
  7095. ################################################################################
  7096. # For 5 rounds, the target cannnot use its held item, its held item has no
  7097. # effect, and no items can be used on it. (Embargo)
  7098. ################################################################################
  7099. class PokeBattle_Move_0F8 < PokeBattle_Move
  7100. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7101. if opponent.effects[PBEffects::Embargo]>0
  7102. @battle.pbDisplay(_INTL("But it failed!"))
  7103. return -1
  7104. end
  7105. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7106. opponent.effects[PBEffects::Embargo]=5
  7107. @battle.pbDisplay(_INTL("{1} can't use items anymore!",opponent.pbThis))
  7108. return 0
  7109. end
  7110. end
  7111.  
  7112.  
  7113.  
  7114. ################################################################################
  7115. # For 5 rounds, all held items cannot be used in any way and have no effect.
  7116. # Held items can still change hands, but can't be thrown. (Magic Room)
  7117. ################################################################################
  7118. class PokeBattle_Move_0F9 < PokeBattle_Move
  7119. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7120. if @battle.field.effects[PBEffects::MagicRoom]>0
  7121. @battle.field.effects[PBEffects::MagicRoom]=0
  7122. @battle.pbDisplay(_INTL("The area returned to normal!"))
  7123. else
  7124. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7125. @battle.field.effects[PBEffects::MagicRoom]=5
  7126. @battle.pbDisplay(_INTL("It created a bizarre area in which Pokémon's held items lose their effects!"))
  7127. end
  7128. return 0
  7129. end
  7130. end
  7131.  
  7132.  
  7133.  
  7134. ################################################################################
  7135. # User takes recoil damage equal to 1/4 of the damage this move dealt.
  7136. ################################################################################
  7137. class PokeBattle_Move_0FA < PokeBattle_Move
  7138. def isRecoilMove?
  7139. return true
  7140. end
  7141.  
  7142. def pbEffectAfterHit(attacker,opponent,turneffects)
  7143. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7144. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7145. !attacker.hasWorkingAbility(:MAGICGUARD)
  7146. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/4.0).round)
  7147. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7148. end
  7149. end
  7150. end
  7151. end
  7152.  
  7153.  
  7154.  
  7155. ################################################################################
  7156. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7157. ################################################################################
  7158. class PokeBattle_Move_0FB < PokeBattle_Move
  7159. def isRecoilMove?
  7160. return true
  7161. end
  7162.  
  7163. def pbEffectAfterHit(attacker,opponent,turneffects)
  7164. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7165. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7166. !attacker.hasWorkingAbility(:MAGICGUARD)
  7167. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7168. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7169. end
  7170. end
  7171. end
  7172. end
  7173.  
  7174.  
  7175.  
  7176. ################################################################################
  7177. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  7178. # (Head Smash)
  7179. ################################################################################
  7180. class PokeBattle_Move_0FC < PokeBattle_Move
  7181. def isRecoilMove?
  7182. return true
  7183. end
  7184.  
  7185. def pbEffectAfterHit(attacker,opponent,turneffects)
  7186. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7187. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7188. !attacker.hasWorkingAbility(:MAGICGUARD)
  7189. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
  7190. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7191. end
  7192. end
  7193. end
  7194. end
  7195.  
  7196.  
  7197.  
  7198. ################################################################################
  7199. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7200. # May paralyze the target. (Volt Tackle)
  7201. ################################################################################
  7202. class PokeBattle_Move_0FD < PokeBattle_Move
  7203. def isRecoilMove?
  7204. return true
  7205. end
  7206.  
  7207. def pbEffectAfterHit(attacker,opponent,turneffects)
  7208. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7209. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7210. !attacker.hasWorkingAbility(:MAGICGUARD)
  7211. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7212. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7213. end
  7214. end
  7215. end
  7216.  
  7217. def pbAdditionalEffect(attacker,opponent)
  7218. return if opponent.damagestate.substitute
  7219. if opponent.pbCanParalyze?(attacker,false,self)
  7220. opponent.pbParalyze(attacker)
  7221. end
  7222. end
  7223. end
  7224.  
  7225.  
  7226.  
  7227. ################################################################################
  7228. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  7229. # May burn the target. (Flare Blitz)
  7230. ################################################################################
  7231. class PokeBattle_Move_0FE < PokeBattle_Move
  7232. def isRecoilMove?
  7233. return true
  7234. end
  7235.  
  7236. def pbEffectAfterHit(attacker,opponent,turneffects)
  7237. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7238. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  7239. !attacker.hasWorkingAbility(:MAGICGUARD)
  7240. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  7241. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  7242. end
  7243. end
  7244. end
  7245.  
  7246. def pbAdditionalEffect(attacker,opponent)
  7247. return if opponent.damagestate.substitute
  7248. if opponent.pbCanBurn?(attacker,false,self)
  7249. opponent.pbBurn(attacker)
  7250. end
  7251. end
  7252. end
  7253.  
  7254.  
  7255.  
  7256. ################################################################################
  7257. # Starts sunny weather. (Sunny Day)
  7258. ################################################################################
  7259. class PokeBattle_Move_0FF < PokeBattle_Move
  7260. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7261. case @battle.weather
  7262. when PBWeather::HEAVYRAIN
  7263. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7264. return -1
  7265. when PBWeather::HARSHSUN
  7266. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7267. return -1
  7268. when PBWeather::STRONGWINDS
  7269. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7270. return -1
  7271. when PBWeather::SUNNYDAY
  7272. @battle.pbDisplay(_INTL("But it failed!"))
  7273. return -1
  7274. end
  7275. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7276. @battle.weather=PBWeather::SUNNYDAY
  7277. @battle.weatherduration=5
  7278. @battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
  7279. @battle.pbCommonAnimation("Sunny",nil,nil)
  7280. @battle.pbDisplay(_INTL("The sunlight turned harsh!"))
  7281. return 0
  7282. end
  7283. end
  7284.  
  7285.  
  7286.  
  7287. ################################################################################
  7288. # Starts rainy weather. (Rain Dance)
  7289. ################################################################################
  7290. class PokeBattle_Move_100 < PokeBattle_Move
  7291. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7292. case @battle.weather
  7293. when PBWeather::HEAVYRAIN
  7294. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7295. return -1
  7296. when PBWeather::HARSHSUN
  7297. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7298. return -1
  7299. when PBWeather::STRONGWINDS
  7300. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7301. return -1
  7302. when PBWeather::RAINDANCE
  7303. @battle.pbDisplay(_INTL("But it failed!"))
  7304. return -1
  7305. end
  7306. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7307. @battle.weather=PBWeather::RAINDANCE
  7308. @battle.weatherduration=5
  7309. @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
  7310. @battle.pbCommonAnimation("Rain",nil,nil)
  7311. @battle.pbDisplay(_INTL("It started to rain!"))
  7312. return 0
  7313. end
  7314. end
  7315.  
  7316.  
  7317.  
  7318. ################################################################################
  7319. # Starts sandstorm weather. (Sandstorm)
  7320. ################################################################################
  7321. class PokeBattle_Move_101 < PokeBattle_Move
  7322. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7323. case @battle.weather
  7324. when PBWeather::HEAVYRAIN
  7325. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7326. return -1
  7327. when PBWeather::HARSHSUN
  7328. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7329. return -1
  7330. when PBWeather::STRONGWINDS
  7331. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7332. return -1
  7333. when PBWeather::SANDSTORM
  7334. @battle.pbDisplay(_INTL("But it failed!"))
  7335. return -1
  7336. end
  7337. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7338. @battle.weather=PBWeather::SANDSTORM
  7339. @battle.weatherduration=5
  7340. @battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
  7341. @battle.pbCommonAnimation("Sandstorm",nil,nil)
  7342. @battle.pbDisplay(_INTL("A sandstorm brewed!"))
  7343. return 0
  7344. end
  7345. end
  7346.  
  7347.  
  7348.  
  7349. ################################################################################
  7350. # Starts hail weather. (Hail)
  7351. ################################################################################
  7352. class PokeBattle_Move_102 < PokeBattle_Move
  7353. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7354. case @battle.weather
  7355. when PBWeather::HEAVYRAIN
  7356. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  7357. return -1
  7358. when PBWeather::HARSHSUN
  7359. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  7360. return -1
  7361. when PBWeather::STRONGWINDS
  7362. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  7363. return -1
  7364. when PBWeather::HAIL
  7365. @battle.pbDisplay(_INTL("But it failed!"))
  7366. return -1
  7367. end
  7368. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7369. @battle.weather=PBWeather::HAIL
  7370. @battle.weatherduration=5
  7371. @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
  7372. @battle.pbCommonAnimation("Hail",nil,nil)
  7373. @battle.pbDisplay(_INTL("It started to hail!"))
  7374. return 0
  7375. end
  7376. end
  7377.  
  7378.  
  7379.  
  7380. ################################################################################
  7381. # Entry hazard. Lays spikes on the opposing side (max. 3 layers). (Spikes)
  7382. ################################################################################
  7383. class PokeBattle_Move_103 < PokeBattle_Move
  7384. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7385. if attacker.pbOpposingSide.effects[PBEffects::Spikes]>=3
  7386. @battle.pbDisplay(_INTL("But it failed!"))
  7387. return -1
  7388. end
  7389. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7390. attacker.pbOpposingSide.effects[PBEffects::Spikes]+=1
  7391. if !@battle.pbIsOpposing?(attacker.index)
  7392. @battle.pbDisplay(_INTL("Spikes were scattered all around the opposing team's feet!"))
  7393. else
  7394. @battle.pbDisplay(_INTL("Spikes were scattered all around your team's feet!"))
  7395. end
  7396. return 0
  7397. end
  7398. end
  7399.  
  7400.  
  7401.  
  7402. ################################################################################
  7403. # Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
  7404. # (Toxic Spikes)
  7405. ################################################################################
  7406. class PokeBattle_Move_104 < PokeBattle_Move
  7407. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7408. if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
  7409. @battle.pbDisplay(_INTL("But it failed!"))
  7410. return -1
  7411. end
  7412. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7413. attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]+=1
  7414. if !@battle.pbIsOpposing?(attacker.index)
  7415. @battle.pbDisplay(_INTL("Poison spikes were scattered all around the opposing team's feet!"))
  7416. else
  7417. @battle.pbDisplay(_INTL("Poison spikes were scattered all around your team's feet!"))
  7418. end
  7419. return 0
  7420. end
  7421. end
  7422.  
  7423.  
  7424.  
  7425. ################################################################################
  7426. # Entry hazard. Lays stealth rocks on the opposing side. (Stealth Rock)
  7427. ################################################################################
  7428. class PokeBattle_Move_105 < PokeBattle_Move
  7429. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7430. if attacker.pbOpposingSide.effects[PBEffects::StealthRock]
  7431. @battle.pbDisplay(_INTL("But it failed!"))
  7432. return -1
  7433. end
  7434. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7435. attacker.pbOpposingSide.effects[PBEffects::StealthRock]=true
  7436. if !@battle.pbIsOpposing?(attacker.index)
  7437. @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
  7438. else
  7439. @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
  7440. end
  7441. return 0
  7442. end
  7443. end
  7444.  
  7445.  
  7446.  
  7447. ################################################################################
  7448. # Forces ally's Pledge move to be used next, if it hasn't already. (Grass Pledge)
  7449. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7450. # causes either a sea of fire or a swamp on the opposing side.
  7451. ################################################################################
  7452. class PokeBattle_Move_106 < PokeBattle_Move
  7453. def pbOnStartUse(attacker)
  7454. @doubledamage=false; @overridetype=false
  7455. if attacker.effects[PBEffects::FirstPledge]==0x107 || # Fire Pledge
  7456. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7457. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7458. @doubledamage=true
  7459. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7460. @overridetype=true
  7461. end
  7462. end
  7463. return true
  7464. end
  7465.  
  7466. def pbBaseDamage(basedmg,attacker,opponent)
  7467. if @doubledamage
  7468. return basedmg*2
  7469. end
  7470. return basedmg
  7471. end
  7472.  
  7473. def pbModifyType(type,attacker,opponent)
  7474. if @overridetype
  7475. type=getConst(PBTypes,:FIRE) || 0
  7476. end
  7477. return super(type,attacker,opponent)
  7478. end
  7479.  
  7480. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7481. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.isFainted?
  7482. attacker.effects[PBEffects::FirstPledge]=0
  7483. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7484. end
  7485. # Combined move's effect
  7486. if attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7487. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7488. if opponent.damagestate.calcdamage>0
  7489. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7490. if !@battle.pbIsOpposing?(attacker.index)
  7491. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7492. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7493. else
  7494. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7495. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7496. end
  7497. end
  7498. attacker.effects[PBEffects::FirstPledge]=0
  7499. return ret
  7500. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7501. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7502. if opponent.damagestate.calcdamage>0
  7503. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7504. if !@battle.pbIsOpposing?(attacker.index)
  7505. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7506. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7507. else
  7508. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7509. @battle.pbCommonAnimation("Swamp",nil,nil)
  7510. end
  7511. end
  7512. attacker.effects[PBEffects::FirstPledge]=0
  7513. return ret
  7514. end
  7515. # Set up partner for a combined move
  7516. attacker.effects[PBEffects::FirstPledge]=0
  7517. partnermove=-1
  7518. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7519. if !attacker.pbPartner.hasMovedThisRound?
  7520. move=@battle.choices[attacker.pbPartner.index][2]
  7521. if move && move.id>0
  7522. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7523. end
  7524. end
  7525. end
  7526. if partnermove==0x107 || # Fire Pledge
  7527. partnermove==0x108 # Water Pledge
  7528. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7529. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7530. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7531. return 0
  7532. end
  7533. # Use the move on its own
  7534. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7535. end
  7536.  
  7537. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7538. if @overridetype
  7539. return super(getConst(PBMoves,:FIREPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7540. end
  7541. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7542. end
  7543. end
  7544.  
  7545.  
  7546.  
  7547. ################################################################################
  7548. # Forces ally's Pledge move to be used next, if it hasn't already. (Fire Pledge)
  7549. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7550. # causes either a sea of fire on the opposing side or a rainbow on the user's side.
  7551. ################################################################################
  7552. class PokeBattle_Move_107 < PokeBattle_Move
  7553. def pbOnStartUse(attacker)
  7554. @doubledamage=false; @overridetype=false
  7555. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7556. attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7557. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7558. @doubledamage=true
  7559. if attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7560. @overridetype=true
  7561. end
  7562. end
  7563. return true
  7564. end
  7565.  
  7566. def pbBaseDamage(basedmg,attacker,opponent)
  7567. if @doubledamage
  7568. return basedmg*2
  7569. end
  7570. return basedmg
  7571. end
  7572.  
  7573. def pbModifyType(type,attacker,opponent)
  7574. if @overridetype
  7575. type=getConst(PBTypes,:WATER) || 0
  7576. end
  7577. return super(type,attacker,opponent)
  7578. end
  7579.  
  7580. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7581. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.isFainted?
  7582. attacker.effects[PBEffects::FirstPledge]=0
  7583. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7584. end
  7585. # Combined move's effect
  7586. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7587. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7588. if opponent.damagestate.calcdamage>0
  7589. attacker.pbOpposingSide.effects[PBEffects::SeaOfFire]=4
  7590. if !@battle.pbIsOpposing?(attacker.index)
  7591. @battle.pbDisplay(_INTL("A sea of fire enveloped the opposing team!"))
  7592. @battle.pbCommonAnimation("SeaOfFireOpp",nil,nil)
  7593. else
  7594. @battle.pbDisplay(_INTL("A sea of fire enveloped your team!"))
  7595. @battle.pbCommonAnimation("SeaOfFire",nil,nil)
  7596. end
  7597. end
  7598. attacker.effects[PBEffects::FirstPledge]=0
  7599. return ret
  7600. elsif attacker.effects[PBEffects::FirstPledge]==0x108 # Water Pledge
  7601. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7602. if opponent.damagestate.calcdamage>0
  7603. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7604. if !@battle.pbIsOpposing?(attacker.index)
  7605. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7606. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7607. else
  7608. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7609. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7610. end
  7611. end
  7612. attacker.effects[PBEffects::FirstPledge]=0
  7613. return ret
  7614. end
  7615. # Set up partner for a combined move
  7616. attacker.effects[PBEffects::FirstPledge]=0
  7617. partnermove=-1
  7618. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7619. if !attacker.pbPartner.hasMovedThisRound?
  7620. move=@battle.choices[attacker.pbPartner.index][2]
  7621. if move && move.id>0
  7622. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7623. end
  7624. end
  7625. end
  7626. if partnermove==0x106 || # Grass Pledge
  7627. partnermove==0x108 # Water Pledge
  7628. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7629. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7630. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7631. return 0
  7632. end
  7633. # Use the move on its own
  7634. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7635. end
  7636.  
  7637. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7638. if @overridetype
  7639. return super(getConst(PBMoves,:WATERPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7640. end
  7641. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7642. end
  7643. end
  7644.  
  7645.  
  7646.  
  7647. ################################################################################
  7648. # Forces ally's Pledge move to be used next, if it hasn't already. (Water Pledge)
  7649. # Combo's with ally's Pledge move if it was just used. Power is doubled, and
  7650. # causes either a swamp on the opposing side or a rainbow on the user's side.
  7651. ################################################################################
  7652. class PokeBattle_Move_108 < PokeBattle_Move
  7653. def pbOnStartUse(attacker)
  7654. @doubledamage=false; @overridetype=false
  7655. if attacker.effects[PBEffects::FirstPledge]==0x106 || # Grass Pledge
  7656. attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7657. @battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
  7658. @doubledamage=true
  7659. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7660. @overridetype=true
  7661. end
  7662. end
  7663. return true
  7664. end
  7665.  
  7666. def pbBaseDamage(basedmg,attacker,opponent)
  7667. if @doubledamage
  7668. return basedmg*2
  7669. end
  7670. return basedmg
  7671. end
  7672.  
  7673. def pbModifyType(type,attacker,opponent)
  7674. if @overridetype
  7675. type=getConst(PBTypes,:GRASS) || 0
  7676. end
  7677. return super(type,attacker,opponent)
  7678. end
  7679.  
  7680. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7681. if !@battle.doublebattle || !attacker.pbPartner || attacker.pbPartner.isFainted?
  7682. attacker.effects[PBEffects::FirstPledge]=0
  7683. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7684. end
  7685. # Combined move's effect
  7686. if attacker.effects[PBEffects::FirstPledge]==0x106 # Grass Pledge
  7687. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7688. if opponent.damagestate.calcdamage>0
  7689. attacker.pbOpposingSide.effects[PBEffects::Swamp]=4
  7690. if !@battle.pbIsOpposing?(attacker.index)
  7691. @battle.pbDisplay(_INTL("A swamp enveloped the opposing team!"))
  7692. @battle.pbCommonAnimation("SwampOpp",nil,nil)
  7693. else
  7694. @battle.pbDisplay(_INTL("A swamp enveloped your team!"))
  7695. @battle.pbCommonAnimation("Swamp",nil,nil)
  7696. end
  7697. end
  7698. attacker.effects[PBEffects::FirstPledge]=0
  7699. return ret
  7700. elsif attacker.effects[PBEffects::FirstPledge]==0x107 # Fire Pledge
  7701. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7702. if opponent.damagestate.calcdamage>0
  7703. attacker.pbOwnSide.effects[PBEffects::Rainbow]=4
  7704. if !@battle.pbIsOpposing?(attacker.index)
  7705. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on your team's side!"))
  7706. @battle.pbCommonAnimation("Rainbow",nil,nil)
  7707. else
  7708. @battle.pbDisplay(_INTL("A rainbow appeared in the sky on the opposing team's side!"))
  7709. @battle.pbCommonAnimation("RainbowOpp",nil,nil)
  7710. end
  7711. end
  7712. attacker.effects[PBEffects::FirstPledge]=0
  7713. return ret
  7714. end
  7715. # Set up partner for a combined move
  7716. attacker.effects[PBEffects::FirstPledge]=0
  7717. partnermove=-1
  7718. if @battle.choices[attacker.pbPartner.index][0]==1 # Chose a move
  7719. if !attacker.pbPartner.hasMovedThisRound?
  7720. move=@battle.choices[attacker.pbPartner.index][2]
  7721. if move && move.id>0
  7722. partnermove=@battle.choices[attacker.pbPartner.index][2].function
  7723. end
  7724. end
  7725. end
  7726. if partnermove==0x106 || # Grass Pledge
  7727. partnermove==0x107 # Fire Pledge
  7728. @battle.pbDisplay(_INTL("{1} is waiting for {2}'s move...",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  7729. attacker.pbPartner.effects[PBEffects::FirstPledge]==@function
  7730. attacker.pbPartner.effects[PBEffects::MoveNext]=true
  7731. return 0
  7732. end
  7733. # Use the move on its own
  7734. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7735. end
  7736.  
  7737. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7738. if @overridetype
  7739. return super(getConst(PBMoves,:GRASSPLEDGE),attacker,opponent,hitnum,alltargets,showanimation)
  7740. end
  7741. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7742. end
  7743. end
  7744.  
  7745.  
  7746.  
  7747. ################################################################################
  7748. # Scatters coins that the player picks up after winning the battle. (Pay Day)
  7749. ################################################################################
  7750. class PokeBattle_Move_109 < PokeBattle_Move
  7751. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7752. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7753. if opponent.damagestate.calcdamage>0
  7754. if @battle.pbOwnedByPlayer?(attacker.index)
  7755. @battle.extramoney+=5*attacker.level
  7756. @battle.extramoney=MAXMONEY if @battle.extramoney>MAXMONEY
  7757. end
  7758. @battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
  7759. end
  7760. return ret
  7761. end
  7762. end
  7763.  
  7764.  
  7765.  
  7766. ################################################################################
  7767. # Ends the opposing side's Light Screen and Reflect. (Brick Break)
  7768. ################################################################################
  7769. class PokeBattle_Move_10A < PokeBattle_Move
  7770. def pbCalcDamage(attacker,opponent)
  7771. return super(attacker,opponent,PokeBattle_Move::NOREFLECT)
  7772. end
  7773.  
  7774. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7775. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7776. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0
  7777. attacker.pbOpposingSide.effects[PBEffects::Reflect]=0
  7778. if !@battle.pbIsOpposing?(attacker.index)
  7779. @battle.pbDisplay(_INTL("The opposing team's Reflect wore off!"))
  7780. else
  7781. @battle.pbDisplayPaused(_INTL("Your team's Reflect wore off!"))
  7782. end
  7783. end
  7784. if attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7785. attacker.pbOpposingSide.effects[PBEffects::LightScreen]=0
  7786. if !@battle.pbIsOpposing?(attacker.index)
  7787. @battle.pbDisplay(_INTL("The opposing team's Light Screen wore off!"))
  7788. else
  7789. @battle.pbDisplay(_INTL("Your team's Light Screen wore off!"))
  7790. end
  7791. end
  7792. return ret
  7793. end
  7794.  
  7795. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7796. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
  7797. attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  7798. return super(id,attacker,opponent,1,alltargets,showanimation) # Wall-breaking anim
  7799. end
  7800. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  7801. end
  7802. end
  7803.  
  7804.  
  7805.  
  7806. ################################################################################
  7807. # If attack misses, user takes crash damage of 1/2 of max HP.
  7808. # (Hi Jump Kick, Jump Kick)
  7809. ################################################################################
  7810. class PokeBattle_Move_10B < PokeBattle_Move
  7811. def isRecoilMove?
  7812. return true
  7813. end
  7814.  
  7815. def unusableInGravity?
  7816. return true
  7817. end
  7818. end
  7819.  
  7820.  
  7821.  
  7822. ################################################################################
  7823. # User turns 1/4 of max HP into a substitute. (Substitute)
  7824. ################################################################################
  7825. class PokeBattle_Move_10C < PokeBattle_Move
  7826. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7827. if attacker.effects[PBEffects::Substitute]>0
  7828. @battle.pbDisplay(_INTL("{1} already has a substitute!",attacker.pbThis))
  7829. return -1
  7830. end
  7831. sublife=[(attacker.totalhp/4).floor,1].max
  7832. if attacker.hp<=sublife
  7833. @battle.pbDisplay(_INTL("It was too weak to make a substitute!"))
  7834. return -1
  7835. end
  7836. attacker.pbReduceHP(sublife,false,false)
  7837. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7838. attacker.effects[PBEffects::MultiTurn]=0
  7839. attacker.effects[PBEffects::MultiTurnAttack]=0
  7840. attacker.effects[PBEffects::Substitute]=sublife
  7841. @battle.pbDisplay(_INTL("{1} put in a substitute!",attacker.pbThis))
  7842. return 0
  7843. end
  7844. end
  7845.  
  7846.  
  7847.  
  7848. ################################################################################
  7849. # User is not Ghost: Decreases the user's Speed, increases the user's Attack &
  7850. # Defense by 1 stage each.
  7851. # User is Ghost: User loses 1/2 of max HP, and curses the target.
  7852. # Cursed Pokémon lose 1/4 of their max HP at the end of each round.
  7853. # (Curse)
  7854. ################################################################################
  7855. class PokeBattle_Move_10D < PokeBattle_Move
  7856. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7857. failed=false
  7858. if attacker.pbHasType?(:GHOST)
  7859. if opponent.effects[PBEffects::Curse] ||
  7860. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  7861. failed=true
  7862. else
  7863. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7864. @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true)))
  7865. opponent.effects[PBEffects::Curse]=true
  7866. attacker.pbReduceHP((attacker.totalhp/2).floor)
  7867. end
  7868. else
  7869. lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  7870. raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  7871. raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  7872. if !lowerspeed && !raiseatk && !raisedef
  7873. failed=true
  7874. else
  7875. pbShowAnimation(@id,attacker,nil,1,alltargets,showanimation) # Non-Ghost move animation
  7876. if lowerspeed
  7877. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  7878. end
  7879. showanim=true
  7880. if raiseatk
  7881. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  7882. showanim=false
  7883. end
  7884. if raisedef
  7885. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  7886. showanim=false
  7887. end
  7888. end
  7889. end
  7890. if failed
  7891. @battle.pbDisplay(_INTL("But it failed!"))
  7892. end
  7893. return failed ? -1 : 0
  7894. end
  7895. end
  7896.  
  7897.  
  7898.  
  7899. ################################################################################
  7900. # Target's last move used loses 4 PP. (Spite)
  7901. ################################################################################
  7902. class PokeBattle_Move_10E < PokeBattle_Move
  7903. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7904. for i in opponent.moves
  7905. if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
  7906. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7907. reduction=[4,i.pp].min
  7908. i.pp-=reduction
  7909. @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
  7910. return 0
  7911. end
  7912. end
  7913. @battle.pbDisplay(_INTL("But it failed!"))
  7914. return -1
  7915. end
  7916. end
  7917.  
  7918.  
  7919.  
  7920. ################################################################################
  7921. # Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare)
  7922. ################################################################################
  7923. class PokeBattle_Move_10F < PokeBattle_Move
  7924. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7925. if opponent.status!=PBStatuses::SLEEP || opponent.effects[PBEffects::Nightmare] ||
  7926. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  7927. @battle.pbDisplay(_INTL("But it failed!"))
  7928. return -1
  7929. end
  7930. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7931. opponent.effects[PBEffects::Nightmare]=true
  7932. @battle.pbDisplay(_INTL("{1} began having a nightmare!",opponent.pbThis))
  7933. return 0
  7934. end
  7935. end
  7936.  
  7937.  
  7938.  
  7939. ################################################################################
  7940. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  7941. # (Rapid Spin)
  7942. ################################################################################
  7943. class PokeBattle_Move_110 < PokeBattle_Move
  7944. def pbEffectAfterHit(attacker,opponent,turneffects)
  7945. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  7946. if attacker.effects[PBEffects::MultiTurn]>0
  7947. mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
  7948. mtuser=@battle.battlers[attacker.effects[PBEffects::MultiTurnUser]]
  7949. @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
  7950. attacker.effects[PBEffects::MultiTurn]=0
  7951. attacker.effects[PBEffects::MultiTurnAttack]=0
  7952. attacker.effects[PBEffects::MultiTurnUser]=-1
  7953. end
  7954. if attacker.effects[PBEffects::LeechSeed]>=0
  7955. attacker.effects[PBEffects::LeechSeed]=-1
  7956. @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))
  7957. end
  7958. if attacker.pbOwnSide.effects[PBEffects::StealthRock]
  7959. attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
  7960. @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))
  7961. end
  7962. if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
  7963. attacker.pbOwnSide.effects[PBEffects::Spikes]=0
  7964. @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))
  7965. end
  7966. if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  7967. attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
  7968. @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))
  7969. end
  7970. if attacker.pbOwnSide.effects[PBEffects::StickyWeb]
  7971. attacker.pbOwnSide.effects[PBEffects::StickyWeb]=false
  7972. @battle.pbDisplay(_INTL("{1} blew away sticky webs!",attacker.pbThis))
  7973. end
  7974. end
  7975. end
  7976. end
  7977.  
  7978.  
  7979.  
  7980. ################################################################################
  7981. # Attacks 2 rounds in the future. (Doom Desire, Future Sight)
  7982. ################################################################################
  7983. class PokeBattle_Move_111 < PokeBattle_Move
  7984. def pbDisplayUseMessage(attacker)
  7985. return 0 if @battle.futuresight
  7986. return super(attacker)
  7987. end
  7988.  
  7989. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7990. if opponent.effects[PBEffects::FutureSight]>0
  7991. @battle.pbDisplay(_INTL("But it failed!"))
  7992. return -1
  7993. end
  7994. if @battle.futuresight
  7995. # Attack hits
  7996. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7997. end
  7998. # Attack is launched
  7999. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8000. opponent.effects[PBEffects::FutureSight]=3
  8001. opponent.effects[PBEffects::FutureSightMove]=@id
  8002. opponent.effects[PBEffects::FutureSightUser]=attacker.pokemonIndex
  8003. opponent.effects[PBEffects::FutureSightUserPos]=attacker.index
  8004. if isConst?(@id,PBMoves,:FUTURESIGHT)
  8005. @battle.pbDisplay(_INTL("{1} foresaw an attack!",attacker.pbThis))
  8006. else
  8007. @battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",attacker.pbThis))
  8008. end
  8009. return 0
  8010. end
  8011.  
  8012. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8013. if @battle.futuresight
  8014. return super(id,attacker,opponent,1,alltargets,showanimation) # Hit opponent anim
  8015. end
  8016. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  8017. end
  8018. end
  8019.  
  8020.  
  8021.  
  8022. ################################################################################
  8023. # Increases the user's Defense and Special Defense by 1 stage each. Ups the
  8024. # user's stockpile by 1 (max. 3). (Stockpile)
  8025. ################################################################################
  8026. class PokeBattle_Move_112 < PokeBattle_Move
  8027. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8028. if attacker.effects[PBEffects::Stockpile]>=3
  8029. @battle.pbDisplay(_INTL("{1} can't stockpile any more!",attacker.pbThis))
  8030. return -1
  8031. end
  8032. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8033. attacker.effects[PBEffects::Stockpile]+=1
  8034. @battle.pbDisplay(_INTL("{1} stockpiled {2}!",attacker.pbThis,
  8035. attacker.effects[PBEffects::Stockpile]))
  8036. showanim=true
  8037. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8038. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8039. attacker.effects[PBEffects::StockpileDef]+=1
  8040. showanim=false
  8041. end
  8042. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8043. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  8044. attacker.effects[PBEffects::StockpileSpDef]+=1
  8045. showanim=false
  8046. end
  8047. return 0
  8048. end
  8049. end
  8050.  
  8051.  
  8052.  
  8053. ################################################################################
  8054. # Power is 100 multiplied by the user's stockpile (X). Resets the stockpile to
  8055. # 0. Decreases the user's Defense and Special Defense by X stages each. (Spit Up)
  8056. ################################################################################
  8057. class PokeBattle_Move_113 < PokeBattle_Move
  8058. def pbMoveFailed(attacker,opponent)
  8059. return (attacker.effects[PBEffects::Stockpile]==0)
  8060. end
  8061.  
  8062. def pbBaseDamage(basedmg,attacker,opponent)
  8063. return 100*attacker.effects[PBEffects::Stockpile]
  8064. end
  8065.  
  8066. def pbEffectAfterHit(attacker,opponent,turneffects)
  8067. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  8068. showanim=true
  8069. if attacker.effects[PBEffects::StockpileDef]>0
  8070. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8071. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8072. attacker,false,self,showanim)
  8073. showanim=false
  8074. end
  8075. end
  8076. if attacker.effects[PBEffects::StockpileSpDef]>0
  8077. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8078. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8079. attacker,false,self,showanim)
  8080. showanim=false
  8081. end
  8082. end
  8083. attacker.effects[PBEffects::Stockpile]=0
  8084. attacker.effects[PBEffects::StockpileDef]=0
  8085. attacker.effects[PBEffects::StockpileSpDef]=0
  8086. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8087. end
  8088. end
  8089. end
  8090.  
  8091.  
  8092.  
  8093. ################################################################################
  8094. # Heals user depending on the user's stockpile (X). Resets the stockpile to 0.
  8095. # Decreases the user's Defense and Special Defense by X stages each. (Swallow)
  8096. ################################################################################
  8097. class PokeBattle_Move_114 < PokeBattle_Move
  8098. def isHealingMove?
  8099. return true
  8100. end
  8101.  
  8102. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8103. hpgain=0
  8104. case attacker.effects[PBEffects::Stockpile]
  8105. when 0
  8106. @battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
  8107. return -1
  8108. when 1
  8109. hpgain=(attacker.totalhp/4).floor
  8110. when 2
  8111. hpgain=(attacker.totalhp/2).floor
  8112. when 3
  8113. hpgain=attacker.totalhp
  8114. end
  8115. if attacker.hp==attacker.totalhp &&
  8116. attacker.effects[PBEffects::StockpileDef]==0 &&
  8117. attacker.effects[PBEffects::StockpileSpDef]==0
  8118. @battle.pbDisplay(_INTL("But it failed!"))
  8119. return -1
  8120. end
  8121. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8122. if attacker.pbRecoverHP(hpgain,true)>0
  8123. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  8124. end
  8125. showanim=true
  8126. if attacker.effects[PBEffects::StockpileDef]>0
  8127. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8128. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  8129. attacker,false,self,showanim)
  8130. showanim=false
  8131. end
  8132. end
  8133. if attacker.effects[PBEffects::StockpileSpDef]>0
  8134. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  8135. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  8136. attacker,false,self,showanim)
  8137. showanim=false
  8138. end
  8139. end
  8140. attacker.effects[PBEffects::Stockpile]=0
  8141. attacker.effects[PBEffects::StockpileDef]=0
  8142. attacker.effects[PBEffects::StockpileSpDef]=0
  8143. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  8144. return 0
  8145. end
  8146. end
  8147.  
  8148.  
  8149.  
  8150. ################################################################################
  8151. # Fails if user was hit by a damaging move this round. (Focus Punch)
  8152. ################################################################################
  8153. class PokeBattle_Move_115 < PokeBattle_Move
  8154. def pbDisplayUseMessage(attacker)
  8155. if attacker.lastHPLost>0
  8156. @battle.pbDisplayBrief(_INTL("{1} lost its focus and couldn't move!",attacker.pbThis))
  8157. return -1
  8158. end
  8159. return super(attacker)
  8160. end
  8161. end
  8162.  
  8163.  
  8164.  
  8165. ################################################################################
  8166. # Fails if the target didn't chose a damaging move to use this round, or has
  8167. # already moved. (Sucker Punch)
  8168. ################################################################################
  8169. class PokeBattle_Move_116 < PokeBattle_Move
  8170. def pbMoveFailed(attacker,opponent)
  8171. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8172. oppmove=@battle.choices[opponent.index][2]
  8173. return true if !oppmove || oppmove.id<=0 || oppmove.pbIsStatus?
  8174. return true if opponent.hasMovedThisRound? && oppmove.function!=0xB0 # Me First
  8175. return false
  8176. end
  8177. end
  8178.  
  8179.  
  8180.  
  8181. ################################################################################
  8182. # This round, user becomes the target of attacks that have single targets.
  8183. # (Follow Me, Rage Powder)
  8184. ################################################################################
  8185. class PokeBattle_Move_117 < PokeBattle_Move
  8186. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8187. if !@battle.doublebattle
  8188. @battle.pbDisplay(_INTL("But it failed!"))
  8189. return -1
  8190. end
  8191. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8192. attacker.effects[PBEffects::FollowMe]=1
  8193. if !attacker.pbPartner.isFainted? && attacker.pbPartner.effects[PBEffects::FollowMe]>0
  8194. attacker.effects[PBEffects::FollowMe]=attacker.pbPartner.effects[PBEffects::FollowMe]+1
  8195. end
  8196. @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
  8197. return 0
  8198. end
  8199. end
  8200.  
  8201.  
  8202.  
  8203. ################################################################################
  8204. # For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
  8205. # (Gravity)
  8206. ################################################################################
  8207. class PokeBattle_Move_118 < PokeBattle_Move
  8208. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8209. if @battle.field.effects[PBEffects::Gravity]>0
  8210. @battle.pbDisplay(_INTL("But it failed!"))
  8211. return -1
  8212. end
  8213. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8214. @battle.field.effects[PBEffects::Gravity]=5
  8215. for i in 0...4
  8216. poke=@battle.battlers[i]
  8217. next if !poke
  8218. if PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8219. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8220. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCE # Sky Drop
  8221. poke.effects[PBEffects::TwoTurnAttack]=0
  8222. end
  8223. if poke.effects[PBEffects::SkyDrop]
  8224. poke.effects[PBEffects::SkyDrop]=false
  8225. end
  8226. if poke.effects[PBEffects::MagnetRise]>0
  8227. poke.effects[PBEffects::MagnetRise]=0
  8228. end
  8229. if poke.effects[PBEffects::Telekinesis]>0
  8230. poke.effects[PBEffects::Telekinesis]=0
  8231. end
  8232. end
  8233. @battle.pbDisplay(_INTL("Gravity intensified!"))
  8234. return 0
  8235. end
  8236. end
  8237.  
  8238.  
  8239.  
  8240. ################################################################################
  8241. # For 5 rounds, user becomes airborne. (Magnet Rise)
  8242. ################################################################################
  8243. class PokeBattle_Move_119 < PokeBattle_Move
  8244. def unusableInGravity?
  8245. return true
  8246. end
  8247.  
  8248. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8249. if attacker.effects[PBEffects::Ingrain] ||
  8250. attacker.effects[PBEffects::SmackDown] ||
  8251. attacker.effects[PBEffects::MagnetRise]>0
  8252. @battle.pbDisplay(_INTL("But it failed!"))
  8253. return -1
  8254. end
  8255. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8256. attacker.effects[PBEffects::MagnetRise]=5
  8257. @battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",attacker.pbThis))
  8258. return 0
  8259. end
  8260. end
  8261.  
  8262.  
  8263.  
  8264. ################################################################################
  8265. # For 3 rounds, target becomes airborne and can always be hit. (Telekinesis)
  8266. ################################################################################
  8267. class PokeBattle_Move_11A < PokeBattle_Move
  8268. def unusableInGravity?
  8269. return true
  8270. end
  8271.  
  8272. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8273. if opponent.effects[PBEffects::Ingrain] ||
  8274. opponent.effects[PBEffects::SmackDown] ||
  8275. opponent.effects[PBEffects::Telekinesis]>0
  8276. @battle.pbDisplay(_INTL("But it failed!"))
  8277. return -1
  8278. end
  8279. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8280. opponent.effects[PBEffects::Telekinesis]=3
  8281. @battle.pbDisplay(_INTL("{1} was hurled into the air!",opponent.pbThis))
  8282. return 0
  8283. end
  8284. end
  8285.  
  8286.  
  8287.  
  8288.  
  8289. ################################################################################
  8290. # Hits airborne semi-invulnerable targets. (Sky Uppercut)
  8291. ################################################################################
  8292. class PokeBattle_Move_11B < PokeBattle_Move
  8293. # Handled in Battler's pbSuccessCheck, do not edit!
  8294. end
  8295.  
  8296.  
  8297.  
  8298. ################################################################################
  8299. # Grounds the target while it remains active. (Smack Down, Thousand Arrows)
  8300. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  8301. ################################################################################
  8302. class PokeBattle_Move_11C < PokeBattle_Move
  8303. def pbBaseDamage(basedmg,attacker,opponent)
  8304. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8305. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  8306. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE || # Sky Drop
  8307. opponent.effects[PBEffects::SkyDrop]
  8308. return basedmg*2
  8309. end
  8310. return basedmg
  8311. end
  8312.  
  8313. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8314. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  8315. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  8316. !opponent.effects[PBEffects::Roost]
  8317. opponent.effects[PBEffects::SmackDown]=true
  8318. showmsg=(opponent.pbHasType?(:FLYING) ||
  8319. opponent.hasWorkingAbility(:LEVITATE))
  8320. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  8321. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  8322. opponent.effects[PBEffects::TwoTurnAttack]=0; showmsg=true
  8323. end
  8324. if opponent.effects[PBEffects::MagnetRise]>0
  8325. opponent.effects[PBEffects::MagnetRise]=0; showmsg=true
  8326. end
  8327. if opponent.effects[PBEffects::Telekinesis]>0
  8328. opponent.effects[PBEffects::Telekinesis]=0; showmsg=true
  8329. end
  8330. @battle.pbDisplay(_INTL("{1} fell straight down!",opponent.pbThis)) if showmsg
  8331. end
  8332. return ret
  8333. end
  8334. end
  8335.  
  8336.  
  8337.  
  8338. ################################################################################
  8339. # Target moves immediately after the user, ignoring priority/speed. (After You)
  8340. ################################################################################
  8341. class PokeBattle_Move_11D < PokeBattle_Move
  8342. def pbMoveFailed(attacker,opponent)
  8343. return true if opponent.effects[PBEffects::MoveNext]
  8344. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8345. oppmove=@battle.choices[opponent.index][2]
  8346. return true if !oppmove || oppmove.id<=0
  8347. return true if opponent.hasMovedThisRound?
  8348. return false
  8349. end
  8350.  
  8351. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8352. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8353. opponent.effects[PBEffects::MoveNext]=true
  8354. opponent.effects[PBEffects::Quash]=false
  8355. @battle.pbDisplay(_INTL("{1} took the kind offer!",opponent.pbThis))
  8356. return 0
  8357. end
  8358. end
  8359.  
  8360.  
  8361.  
  8362. ################################################################################
  8363. # Target moves last this round, ignoring priority/speed. (Quash)
  8364. ################################################################################
  8365. class PokeBattle_Move_11E < PokeBattle_Move
  8366. def pbMoveFailed(attacker,opponent)
  8367. return true if opponent.effects[PBEffects::Quash]
  8368. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  8369. oppmove=@battle.choices[opponent.index][2]
  8370. return true if !oppmove || oppmove.id<=0
  8371. return true if opponent.hasMovedThisRound?
  8372. return false
  8373. end
  8374.  
  8375. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8376. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8377. opponent.effects[PBEffects::Quash]=true
  8378. opponent.effects[PBEffects::MoveNext]=false
  8379. @battle.pbDisplay(_INTL("{1}'s move was postponed!",opponent.pbThis))
  8380. return 0
  8381. end
  8382. end
  8383.  
  8384.  
  8385.  
  8386. ################################################################################
  8387. # For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
  8388. # (Trick Room)
  8389. ################################################################################
  8390. class PokeBattle_Move_11F < PokeBattle_Move
  8391. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8392. if @battle.field.effects[PBEffects::TrickRoom]>0
  8393. @battle.field.effects[PBEffects::TrickRoom]=0
  8394. @battle.pbDisplay(_INTL("{1} reverted the dimensions!",attacker.pbThis))
  8395. else
  8396. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8397. @battle.field.effects[PBEffects::TrickRoom]=5
  8398. @battle.pbDisplay(_INTL("{1} twisted the dimensions!",attacker.pbThis))
  8399. end
  8400. return 0
  8401. end
  8402. end
  8403.  
  8404.  
  8405.  
  8406. ################################################################################
  8407. # User switches places with its ally. (Ally Switch)
  8408. ################################################################################
  8409. class PokeBattle_Move_120 < PokeBattle_Move
  8410. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8411. if !@battle.doublebattle ||
  8412. !attacker.pbPartner || attacker.pbPartner.isFainted?
  8413. @battle.pbDisplay(_INTL("But it failed!"))
  8414. return -1
  8415. end
  8416. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8417. a=@battle.battlers[attacker.index]
  8418. b=@battle.battlers[attacker.pbPartner.index]
  8419. temp=a; a=b; b=temp
  8420. # Swap effects that point at the position rather than the Pokémon
  8421. # NOT PerishSongUser (no need to swap), Attract, MultiTurnUser
  8422. effectstoswap=[PBEffects::BideTarget,
  8423. PBEffects::CounterTarget,
  8424. PBEffects::LeechSeed,
  8425. PBEffects::LockOnPos,
  8426. PBEffects::MeanLook,
  8427. PBEffects::MirrorCoatTarget]
  8428. for i in effectstoswap
  8429. a.effects[i],b.effects[i]=b.effects[i],a.effects[i]
  8430. end
  8431. attacker.pbUpdate(true)
  8432. opponent.pbUpdate(true)
  8433. @battle.pbDisplay(_INTL("{1} and {2} switched places!",opponent.pbThis,attacker.pbThis(true)))
  8434. end
  8435. end
  8436.  
  8437.  
  8438.  
  8439. ################################################################################
  8440. # Target's Attack is used instead of user's Attack for this move's calculations.
  8441. # (Foul Play)
  8442. ################################################################################
  8443. class PokeBattle_Move_121 < PokeBattle_Move
  8444. # Handled in superclass def pbCalcDamage, do not edit!
  8445. end
  8446.  
  8447.  
  8448.  
  8449. ################################################################################
  8450. # Target's Defense is used instead of its Special Defense for this move's
  8451. # calculations. (Psyshock, Psystrike, Secret Sword)
  8452. ################################################################################
  8453. class PokeBattle_Move_122 < PokeBattle_Move
  8454. # Handled in superclass def pbCalcDamage, do not edit!
  8455. end
  8456.  
  8457.  
  8458.  
  8459. ################################################################################
  8460. # Only damages Pokémon that share a type with the user. (Synchronoise)
  8461. ################################################################################
  8462. class PokeBattle_Move_123 < PokeBattle_Move
  8463. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8464. if !opponent.pbHasType?(attacker.type1) &&
  8465. !opponent.pbHasType?(attacker.type2) &&
  8466. !opponent.pbHasType?(attacker.effects[PBEffects::Type3])
  8467. @battle.pbDisplay(_INTL("{1} was unaffected!",opponent.pbThis))
  8468. return -1
  8469. end
  8470. return super(attacker,opponent,hitnum,alltargets,showanimation)
  8471. end
  8472. end
  8473.  
  8474.  
  8475.  
  8476. ################################################################################
  8477. # For 5 rounds, swaps all battlers' base Defense with base Special Defense.
  8478. # (Wonder Room)
  8479. ################################################################################
  8480. class PokeBattle_Move_124 < PokeBattle_Move
  8481. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8482. if @battle.field.effects[PBEffects::WonderRoom]>0
  8483. @battle.field.effects[PBEffects::WonderRoom]=0
  8484. @battle.pbDisplay(_INTL("Wonder Room wore off, and the Defense and Sp. Def stats returned to normal!"))
  8485. else
  8486. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8487. @battle.field.effects[PBEffects::WonderRoom]=5
  8488. @battle.pbDisplay(_INTL("It created a bizarre area in which the Defense and Sp. Def stats are swapped!"))
  8489. end
  8490. return 0
  8491. end
  8492. end
  8493.  
  8494.  
  8495.  
  8496. ################################################################################
  8497. # Fails unless user has already used all other moves it knows. (Last Resort)
  8498. ################################################################################
  8499. class PokeBattle_Move_125 < PokeBattle_Move
  8500. def pbMoveFailed(attacker,opponent)
  8501. counter=0; nummoves=0
  8502. for move in attacker.moves
  8503. next if move.id<=0
  8504. counter+=1 if move.id!=@id && !attacker.movesUsed.include?(move.id)
  8505. nummoves+=1
  8506. end
  8507. return counter!=0 || nummoves==1
  8508. end
  8509. end
  8510.  
  8511.  
  8512.  
  8513. #===============================================================================
  8514. # NOTE: Shadow moves use function codes 126-132 inclusive.
  8515. #===============================================================================
  8516.  
  8517.  
  8518.  
  8519. ################################################################################
  8520. # Does absolutely nothing. (Hold Hands)
  8521. ################################################################################
  8522. class PokeBattle_Move_133 < PokeBattle_Move
  8523. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8524. if !@battle.doublebattle ||
  8525. !attacker.pbPartner || attacker.pbPartner.isFainted?
  8526. @battle.pbDisplay(_INTL("But it failed!"))
  8527. return -1
  8528. end
  8529. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8530. return 0
  8531. end
  8532. end
  8533.  
  8534.  
  8535.  
  8536. ################################################################################
  8537. # Does absolutely nothing. Shows a special message. (Celebrate)
  8538. ################################################################################
  8539. class PokeBattle_Move_134 < PokeBattle_Move
  8540. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8541. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  8542. @battle.pbDisplay(_INTL("Congratulations, {1}!",@battle.pbGetOwner(attacker.index).name))
  8543. return 0
  8544. end
  8545. end
  8546.  
  8547.  
  8548.  
  8549. ################################################################################
  8550. # Freezes the target. (Freeze-Dry)
  8551. # (Superclass's pbTypeModifier): Effectiveness against Water-type is 2x.
  8552. ################################################################################
  8553. class PokeBattle_Move_135 < PokeBattle_Move
  8554. def pbAdditionalEffect(attacker,opponent)
  8555. return if opponent.damagestate.substitute
  8556. if opponent.pbCanFreeze?(attacker,false,self)
  8557. opponent.pbFreeze
  8558. end
  8559. end
  8560. end
  8561.  
  8562.  
  8563.  
  8564. ################################################################################
  8565. # Increases the user's Defense by 1 stage for each target hit. (Diamond Storm)
  8566. ################################################################################
  8567. class PokeBattle_Move_136 < PokeBattle_Move_01D
  8568. # No difference to function code 01D. It may need to be separate in future.
  8569. end
  8570.  
  8571.  
  8572.  
  8573. ################################################################################
  8574. # Increases the user's and its ally's Defense and Special Defense by 1 stage
  8575. # each, if they have Plus or Minus. (Magnetic Flux)
  8576. ################################################################################
  8577. class PokeBattle_Move_137 < PokeBattle_Move
  8578. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8579. didsomething=false
  8580. for i in [attacker,attacker.pbPartner]
  8581. next if !i || i.isFainted?
  8582. next if !i.hasWorkingAbility(:PLUS) && !i.hasWorkingAbility(:MINUS)
  8583. next if !i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  8584. !i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8585. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8586. didsomething=true
  8587. showanim=true
  8588. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8589. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8590. showanim=false
  8591. end
  8592. if i.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8593. i.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  8594. showanim=false
  8595. end
  8596. end
  8597. if !didsomething
  8598. @battle.pbDisplay(_INTL("But it failed!"))
  8599. return -1
  8600. end
  8601. return 0
  8602. end
  8603. end
  8604.  
  8605.  
  8606.  
  8607. ################################################################################
  8608. # Increases ally's Special Defense by 1 stage. (Aromatic Mist)
  8609. ################################################################################
  8610. class PokeBattle_Move_138 < PokeBattle_Move
  8611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8612. if !@battle.doublebattle || !opponent ||
  8613. !opponent.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  8614. @battle.pbDisplay(_INTL("But it failed!"))
  8615. return -1
  8616. end
  8617. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8618. ret=attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  8619. return ret ? 0 : -1
  8620. end
  8621. end
  8622.  
  8623.  
  8624.  
  8625. ################################################################################
  8626. # Decreases the target's Attack by 1 stage. Always hits. (Play Nice)
  8627. ################################################################################
  8628. class PokeBattle_Move_139 < PokeBattle_Move
  8629. def pbAccuracyCheck(attacker,opponent)
  8630. return true
  8631. end
  8632.  
  8633. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8634. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  8635. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8636. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  8637. return ret ? 0 : -1
  8638. end
  8639. end
  8640.  
  8641.  
  8642.  
  8643. ################################################################################
  8644. # Decreases the target's Attack and Special Attack by 1 stage each. (Noble Roar)
  8645. ################################################################################
  8646. class PokeBattle_Move_13A < PokeBattle_Move
  8647. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8648. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  8649. # multiple times
  8650. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8651. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  8652. return -1
  8653. end
  8654. if opponent.pbTooLow?(PBStats::ATTACK) &&
  8655. opponent.pbTooLow?(PBStats::SPATK)
  8656. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  8657. return -1
  8658. end
  8659. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  8660. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  8661. return -1
  8662. end
  8663. if !attacker.hasMoldBreaker
  8664. if opponent.hasWorkingAbility(:CLEARBODY) ||
  8665. opponent.hasWorkingAbility(:WHITESMOKE)
  8666. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  8667. PBAbilities.getName(opponent.ability)))
  8668. return -1
  8669. end
  8670. end
  8671. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8672. ret=-1; showanim=true
  8673. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER)
  8674. abilityname=PBAbilities.getName(opponent.ability)
  8675. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  8676. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8677. ret=0; showanim=false
  8678. end
  8679. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8680. ret=0; showanim=false
  8681. end
  8682. return ret
  8683. end
  8684. end
  8685.  
  8686.  
  8687.  
  8688. ################################################################################
  8689. # Decreases the target's Defense by 1 stage. Always hits. (Hyperspace Fury)
  8690. ################################################################################
  8691. class PokeBattle_Move_13B < PokeBattle_Move
  8692. def pbMoveFailed(attacker,opponent)
  8693. return true if !isConst?(attacker.species,PBSpecies,:HOOPA)
  8694. return true if attacker.form!=1
  8695. return false
  8696. end
  8697.  
  8698. def pbAccuracyCheck(attacker,opponent)
  8699. return true
  8700. end
  8701.  
  8702. def pbAdditionalEffect(attacker,opponent)
  8703. return if opponent.damagestate.substitute
  8704. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  8705. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  8706. end
  8707. end
  8708. end
  8709.  
  8710.  
  8711.  
  8712. ################################################################################
  8713. # Decreases the target's Special Attack by 1 stage. Always hits. (Confide)
  8714. ################################################################################
  8715. class PokeBattle_Move_13C < PokeBattle_Move
  8716. def pbAccuracyCheck(attacker,opponent)
  8717. return true
  8718. end
  8719.  
  8720. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8721. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8722. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8723. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  8724. return ret ? 0 : -1
  8725. end
  8726. end
  8727.  
  8728.  
  8729.  
  8730. ################################################################################
  8731. # Decreases the target's Special Attack by 2 stages. (Eerie Impulse)
  8732. ################################################################################
  8733. class PokeBattle_Move_13D < PokeBattle_Move
  8734. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8735. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  8736. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8737. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  8738. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8739. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8740. return ret ? 0 : -1
  8741. end
  8742.  
  8743. def pbAdditionalEffect(attacker,opponent)
  8744. return if opponent.damagestate.substitute
  8745. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8746. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  8747. end
  8748. end
  8749. end
  8750.  
  8751.  
  8752.  
  8753. ################################################################################
  8754. # Increases the Attack and Special Attack of all Grass-type Pokémon on the field
  8755. # by 1 stage each. Doesn't affect airborne Pokémon. (Rototiller)
  8756. ################################################################################
  8757. class PokeBattle_Move_13E < PokeBattle_Move
  8758. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8759. didsomething=false
  8760. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8761. next if !i || i.isFainted?
  8762. next if !i.pbHasType?(:GRASS)
  8763. next if i.isAirborne?(attacker.hasMoldBreaker)
  8764. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8765. !i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8766. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8767. didsomething=true
  8768. showanim=true
  8769. if i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8770. i.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8771. showanim=false
  8772. end
  8773. if i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  8774. i.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8775. showanim=false
  8776. end
  8777. end
  8778. if !didsomething
  8779. @battle.pbDisplay(_INTL("But it failed!"))
  8780. return -1
  8781. end
  8782. return 0
  8783. end
  8784. end
  8785.  
  8786.  
  8787.  
  8788. ################################################################################
  8789. # Increases the Defense of all Grass-type Pokémon on the field by 1 stage each.
  8790. # (Flower Shield)
  8791. ################################################################################
  8792. class PokeBattle_Move_13F < PokeBattle_Move
  8793. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8794. didsomething=false
  8795. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  8796. next if !i || i.isFainted?
  8797. next if !i.pbHasType?(:GRASS)
  8798. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  8799. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8800. didsomething=true
  8801. showanim=true
  8802. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  8803. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  8804. showanim=false
  8805. end
  8806. end
  8807. if !didsomething
  8808. @battle.pbDisplay(_INTL("But it failed!"))
  8809. return -1
  8810. end
  8811. return 0
  8812. end
  8813. end
  8814.  
  8815.  
  8816.  
  8817. ################################################################################
  8818. # Decreases the Attack, Special Attack and Speed of all poisoned opponents by 1
  8819. # stage each. (Venom Drench)
  8820. ################################################################################
  8821. class PokeBattle_Move_140 < PokeBattle_Move
  8822. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8823. didsomething=false
  8824. for i in [attacker.pbOpposing1,attacker.pbOpposing2]
  8825. next if !i || i.isFainted?
  8826. next if !i.status==PBStatuses::POISON
  8827. next if !i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self) &&
  8828. !i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self) &&
  8829. !i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8830. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  8831. didsomething=true
  8832. showanim=true
  8833. if i.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  8834. i.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  8835. showanim=false
  8836. end
  8837. if i.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  8838. i.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  8839. showanim=false
  8840. end
  8841. if i.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  8842. i.pbReduceStat(PBStats::SPEED,1,attacker,false,self,showanim)
  8843. showanim=false
  8844. end
  8845. end
  8846. if !didsomething
  8847. @battle.pbDisplay(_INTL("But it failed!"))
  8848. return -1
  8849. end
  8850. return 0
  8851. end
  8852. end
  8853.  
  8854.  
  8855.  
  8856. ################################################################################
  8857. # Reverses all stat changes of the target. (Topsy-Turvy)
  8858. ################################################################################
  8859. class PokeBattle_Move_141 < PokeBattle_Move
  8860. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8861. nonzero=false
  8862. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8863. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8864. if opponent.stages[i]!=0
  8865. nonzero=true; break
  8866. end
  8867. end
  8868. if !nonzero
  8869. @battle.pbDisplay(_INTL("But it failed!"))
  8870. return -1
  8871. end
  8872. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation) if !didsomething
  8873. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  8874. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  8875. opponent.stages[i]*=-1
  8876. end
  8877. @battle.pbDisplay(_INTL("{1}'s stats were reversed!",opponent.pbThis))
  8878. return 0
  8879. end
  8880. end
  8881.  
  8882.  
  8883.  
  8884. ################################################################################
  8885. # Gives target the Ghost type. (Trick-or-Treat)
  8886. ################################################################################
  8887. class PokeBattle_Move_142 < PokeBattle_Move
  8888. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8889. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  8890. !hasConst?(PBTypes,:GHOST) || opponent.pbHasType?(:GHOST) ||
  8891. isConst?(opponent.ability,PBAbilities,:MULTITYPE) || isConst?(opponent.ability,PBAbilities,:RKSSYSTEM)
  8892. @battle.pbDisplay(_INTL("But it failed!"))
  8893. return -1
  8894. end
  8895. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8896. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GHOST)
  8897. typename=PBTypes.getName(getConst(PBTypes,:GHOST))
  8898. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8899. return 0
  8900. end
  8901. end
  8902.  
  8903.  
  8904.  
  8905. ################################################################################
  8906. # Gives target the Grass type. (Forest's Curse)
  8907. ################################################################################
  8908. class PokeBattle_Move_143 < PokeBattle_Move
  8909. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8910. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  8911. @battle.pbDisplay(_INTL("But it failed!"))
  8912. return -1
  8913. end
  8914. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8915. if opponent.effects[PBEffects::LeechSeed]>=0
  8916. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  8917. return -1
  8918. end
  8919. if !hasConst?(PBTypes,:GRASS) || opponent.pbHasType?(:GRASS) ||
  8920. isConst?(opponent.ability,PBAbilities,:MULTITYPE) || isConst?(opponent.ability,PBAbilities,:RKSSYSTEM)
  8921. @battle.pbDisplay(_INTL("But it failed!"))
  8922. return -1
  8923. end
  8924. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8925. opponent.effects[PBEffects::Type3]=getConst(PBTypes,:GRASS)
  8926. typename=PBTypes.getName(getConst(PBTypes,:GRASS))
  8927. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  8928. return 0
  8929. end
  8930. end
  8931.  
  8932.  
  8933.  
  8934. ################################################################################
  8935. # Damage is multiplied by Flying's effectiveness against the target. Does double
  8936. # damage and has perfect accuracy if the target is Minimized. (Flying Press)
  8937. ################################################################################
  8938. class PokeBattle_Move_144 < PokeBattle_Move
  8939. def pbModifyDamage(damagemult,attacker,opponent)
  8940. type=getConst(PBTypes,:FLYING) || -1
  8941. if type>=0
  8942. mult=PBTypes.getCombinedEffectiveness(type,
  8943. opponent.type1,opponent.type2,opponent.effects[PBEffects::Type3])
  8944. return ((damagemult*mult)/8).round
  8945. end
  8946. return damagemult
  8947. end
  8948.  
  8949. def tramplesMinimize?(param=1)
  8950. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  8951. return true if param==2 # Double damage
  8952. return false
  8953. end
  8954. end
  8955.  
  8956.  
  8957.  
  8958. ################################################################################
  8959. # Target's moves become Electric-type for the rest of the round. (Electrify)
  8960. ################################################################################
  8961. class PokeBattle_Move_145 < PokeBattle_Move
  8962. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8963. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  8964. if opponent.effects[PBEffects::Electrify]
  8965. @battle.pbDisplay(_INTL("But it failed!"))
  8966. return -1
  8967. end
  8968. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  8969. !@battle.choices[opponent.index][2] ||
  8970. @battle.choices[opponent.index][2].id<=0 ||
  8971. opponent.hasMovedThisRound?
  8972. @battle.pbDisplay(_INTL("But it failed!"))
  8973. return -1
  8974. end
  8975. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  8976. opponent.effects[PBEffects::Electrify]=true
  8977. @battle.pbDisplay(_INTL("{1} was electrified!",opponent.pbThis))
  8978. return 0
  8979. end
  8980. end
  8981.  
  8982.  
  8983.  
  8984. ################################################################################
  8985. # All Normal-type moves become Electric-type for the rest of the round.
  8986. # (Ion Deluge)
  8987. ################################################################################
  8988. class PokeBattle_Move_146 < PokeBattle_Move
  8989. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  8990. unmoved=false
  8991. for poke in @battle.battlers
  8992. next if poke.index==attacker.index
  8993. if @battle.choices[poke.index][0]==1 && # Chose a move
  8994. !poke.hasMovedThisRound?
  8995. unmoved=true; break
  8996. end
  8997. end
  8998. if !unmoved || @battle.field.effects[PBEffects::IonDeluge]
  8999. @battle.pbDisplay(_INTL("But it failed!"))
  9000. return -1
  9001. end
  9002. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9003. @battle.field.effects[PBEffects::IonDeluge]=true
  9004. @battle.pbDisplay(_INTL("The Ion Deluge started!"))
  9005. return 0
  9006. end
  9007. end
  9008.  
  9009.  
  9010.  
  9011. ################################################################################
  9012. # Always hits. (Hyperspace Hole)
  9013. # TODO: Hits through various shields.
  9014. ################################################################################
  9015. class PokeBattle_Move_147 < PokeBattle_Move
  9016. def pbAccuracyCheck(attacker,opponent)
  9017. return true
  9018. end
  9019. end
  9020.  
  9021.  
  9022. ################################################################################
  9023. # Powders the foe. This round, if it uses a Fire move, it loses 1/4 of its max
  9024. # HP instead. (Powder)
  9025. ################################################################################
  9026. class PokeBattle_Move_148 < PokeBattle_Move
  9027. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9028. if opponent.effects[PBEffects::Powder]
  9029. @battle.pbDisplay(_INTL("But it failed!"))
  9030. return -1
  9031. end
  9032. opponent.effects[PBEffects::Powder]=true
  9033. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9034. @battle.pbDisplay(_INTL("{1} is covered in powder!",attacker.pbThis))
  9035. return 0
  9036. end
  9037. end
  9038.  
  9039.  
  9040.  
  9041. ################################################################################
  9042. # This round, the user's side is unaffected by damaging moves. (Mat Block)
  9043. ################################################################################
  9044. class PokeBattle_Move_149 < PokeBattle_Move
  9045. def pbMoveFailed(attacker,opponent)
  9046. return (attacker.turncount>1)
  9047. end
  9048.  
  9049. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9050. attacker.pbOwnSide.effects[PBEffects::MatBlock]=true
  9051. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9052. @battle.pbDisplay(_INTL("{1} intends to flip up a mat and block incoming attacks!",attacker.pbThis))
  9053. return 0
  9054. end
  9055. end
  9056.  
  9057.  
  9058.  
  9059. ################################################################################
  9060. # User's side is protected against status moves this round. (Crafty Shield)
  9061. ################################################################################
  9062. class PokeBattle_Move_14A < PokeBattle_Move
  9063. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9064. if attacker.pbOwnSide.effects[PBEffects::CraftyShield]
  9065. @battle.pbDisplay(_INTL("But it failed!"))
  9066. return -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. @battle.pbDisplay(_INTL("But it failed!"))
  9078. return -1
  9079. end
  9080. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9081. attacker.pbOwnSide.effects[PBEffects::CraftyShield]=true
  9082. if !@battle.pbIsOpposing?(attacker.index)
  9083. @battle.pbDisplay(_INTL("Crafty Shield protected your team!"))
  9084. else
  9085. @battle.pbDisplay(_INTL("Crafty Shield protected the opposing team!"))
  9086. end
  9087. return 0
  9088. end
  9089. end
  9090.  
  9091.  
  9092.  
  9093. ################################################################################
  9094. # User is protected against damaging moves this round. Decreases the Attack of
  9095. # the user of a stopped contact move by 2 stages. (King's Shield)
  9096. ################################################################################
  9097. class PokeBattle_Move_14B < PokeBattle_Move
  9098. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9099. if attacker.effects[PBEffects::KingsShield]
  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. (!USENEWBATTLEMECHANICS &&
  9124. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor)
  9125. attacker.effects[PBEffects::ProtectRate]=1
  9126. @battle.pbDisplay(_INTL("But it failed!"))
  9127. return -1
  9128. end
  9129. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9130. attacker.effects[PBEffects::KingsShield]=true
  9131. attacker.effects[PBEffects::ProtectRate]*=2
  9132. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9133. return 0
  9134. end
  9135. end
  9136.  
  9137.  
  9138.  
  9139. ################################################################################
  9140. # User is protected against moves that target it this round. Damages the user of
  9141. # a stopped contact move by 1/8 of its max HP. (Spiky Shield)
  9142. ################################################################################
  9143. class PokeBattle_Move_14C < PokeBattle_Move
  9144. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9145. if attacker.effects[PBEffects::SpikyShield]
  9146. @battle.pbDisplay(_INTL("But it failed!"))
  9147. return -1
  9148. end
  9149. ratesharers=[
  9150. 0xAA, # Detect, Protect
  9151. 0xAB, # Quick Guard
  9152. 0xAC, # Wide Guard
  9153. 0xE8, # Endure
  9154. 0x14B, # King's Shield
  9155. 0x14C # Spiky Shield
  9156. ]
  9157. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  9158. attacker.effects[PBEffects::ProtectRate]=1
  9159. end
  9160. unmoved=false
  9161. for poke in @battle.battlers
  9162. next if poke.index==attacker.index
  9163. if @battle.choices[poke.index][0]==1 && # Chose a move
  9164. !poke.hasMovedThisRound?
  9165. unmoved=true; break
  9166. end
  9167. end
  9168. if !unmoved ||
  9169. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  9170. attacker.effects[PBEffects::ProtectRate]=1
  9171. @battle.pbDisplay(_INTL("But it failed!"))
  9172. return -1
  9173. end
  9174. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9175. attacker.effects[PBEffects::SpikyShield]=true
  9176. attacker.effects[PBEffects::ProtectRate]*=2
  9177. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  9178. return 0
  9179. end
  9180. end
  9181.  
  9182.  
  9183.  
  9184. ################################################################################
  9185. # Two turn attack. Skips first turn, attacks second turn. (Phantom Force)
  9186. # Is invulnerable during use.
  9187. # Ignores target's Detect, King's Shield, Mat Block, Protect and Spiky Shield
  9188. # this round. If successful, negates them this round.
  9189. # Does double damage and has perfect accuracy if the target is Minimized.
  9190. ################################################################################
  9191. class PokeBattle_Move_14D < PokeBattle_Move
  9192. def pbTwoTurnAttack(attacker)
  9193. @immediate=false
  9194. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9195. @immediate=true
  9196. end
  9197. return false if @immediate
  9198. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9199. end
  9200.  
  9201. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9202. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9203. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9204. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  9205. end
  9206. if @immediate
  9207. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9208. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9209. attacker.pbConsumeItem
  9210. end
  9211. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9212. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9213. if ret>0
  9214. opponent.effects[PBEffects::ProtectNegation]=true
  9215. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  9216. end
  9217. return ret
  9218. end
  9219.  
  9220. def tramplesMinimize?(param=1)
  9221. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  9222. return true if param==2 # Double damage
  9223. return false
  9224. end
  9225. end
  9226.  
  9227.  
  9228.  
  9229. ################################################################################
  9230. # Two turn attack. Skips first turn, increases the user's Special Attack,
  9231. # Special Defense and Speed by 2 stages each second turn. (Geomancy)
  9232. ################################################################################
  9233. class PokeBattle_Move_14E < PokeBattle_Move
  9234. def pbTwoTurnAttack(attacker)
  9235. @immediate=false
  9236. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9237. @immediate=true
  9238. end
  9239. return false if @immediate
  9240. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9241. end
  9242.  
  9243. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9244. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9245. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9246. @battle.pbDisplay(_INTL("{1} is absorbing power!",attacker.pbThis))
  9247. end
  9248. if @immediate
  9249. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9250. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9251. attacker.pbConsumeItem
  9252. end
  9253. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9254. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  9255. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  9256. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9257. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  9258. return -1
  9259. end
  9260. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9261. showanim=true
  9262. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  9263. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  9264. showanim=false
  9265. end
  9266. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  9267. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self,showanim)
  9268. showanim=false
  9269. end
  9270. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9271. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  9272. showanim=false
  9273. end
  9274. return 0
  9275. end
  9276. end
  9277.  
  9278.  
  9279.  
  9280. ################################################################################
  9281. # User gains 3/4 the HP it inflicts as damage. (Draining Kiss, Oblivion Wing)
  9282. ################################################################################
  9283. class PokeBattle_Move_14F < PokeBattle_Move
  9284. def isHealingMove?
  9285. return USENEWBATTLEMECHANICS
  9286. end
  9287.  
  9288. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9289. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9290. if opponent.damagestate.calcdamage>0
  9291. hpgain=(opponent.damagestate.hplost*3/4).round
  9292. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  9293. attacker.pbReduceHP(hpgain,true)
  9294. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  9295. elsif attacker.effects[PBEffects::HealBlock]==0
  9296. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  9297. attacker.pbRecoverHP(hpgain,true)
  9298. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  9299. end
  9300. end
  9301. return ret
  9302. end
  9303. end
  9304.  
  9305.  
  9306.  
  9307. ################################################################################
  9308. # If this move KO's the target, increases the user's Attack by 2 stages.
  9309. # (Fell Stinger)
  9310. ################################################################################
  9311. class PokeBattle_Move_150 < PokeBattle_Move
  9312. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9313. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9314. if opponent.damagestate.calcdamage>0 && opponent.isFainted?
  9315. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  9316. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  9317. end
  9318. end
  9319. return ret
  9320. end
  9321. end
  9322.  
  9323.  
  9324.  
  9325. ################################################################################
  9326. # Decreases the target's Attack and Special Attack by 1 stage each. Then, user
  9327. # switches out. Ignores trapping moves. (Parting Shot)
  9328. # TODO: Pursuit should interrupt this move.
  9329. ################################################################################
  9330. class PokeBattle_Move_151 < PokeBattle_Move
  9331. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9332. ret=-1
  9333. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9334. if !self.isSoundBased? ||
  9335. attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SOUNDPROOF)
  9336. showanim=true
  9337. if opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  9338. showanim=false; ret=0
  9339. end
  9340. if opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self,showanim)
  9341. showanim=false; ret=0
  9342. end
  9343. end
  9344. if !attacker.isFainted? &&
  9345. @battle.pbCanChooseNonActive?(attacker.index) &&
  9346. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  9347. attacker.effects[PBEffects::Uturn]=true; ret=0
  9348. end
  9349. return ret
  9350. end
  9351. end
  9352.  
  9353.  
  9354.  
  9355. ################################################################################
  9356. # No Pokémon can switch out or flee until the end of the next round, as long as
  9357. # the user remains active. (Fairy Lock)
  9358. ################################################################################
  9359. class PokeBattle_Move_152 < PokeBattle_Move
  9360. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9361. if @battle.field.effects[PBEffects::FairyLock]>0
  9362. @battle.pbDisplay(_INTL("But it failed!"))
  9363. return -1
  9364. end
  9365. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9366. @battle.field.effects[PBEffects::FairyLock]=2
  9367. @battle.pbDisplay(_INTL("No one will be able to run away during the next turn!"))
  9368. return 0
  9369. end
  9370. end
  9371.  
  9372.  
  9373.  
  9374. ################################################################################
  9375. # Entry hazard. Lays stealth rocks on the opposing side. (Sticky Web)
  9376. ################################################################################
  9377. class PokeBattle_Move_153 < PokeBattle_Move
  9378. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9379. if attacker.pbOpposingSide.effects[PBEffects::StickyWeb]
  9380. @battle.pbDisplay(_INTL("But it failed!"))
  9381. return -1
  9382. end
  9383. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9384. attacker.pbOpposingSide.effects[PBEffects::StickyWeb]=true
  9385. if !@battle.pbIsOpposing?(attacker.index)
  9386. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath the opposing team's feet!"))
  9387. else
  9388. @battle.pbDisplay(_INTL("A sticky web has been laid out beneath your team's feet!"))
  9389. end
  9390. return 0
  9391. end
  9392. end
  9393.  
  9394.  
  9395.  
  9396. ################################################################################
  9397. # For 5 rounds, creates a psychic terrain which boosts Psychic-type moves and
  9398. # protects Pokémon from priority moves. Affects non-airborne Pokémon only.
  9399. # (Psychic Terrain)
  9400. ################################################################################
  9401. class PokeBattle_Move_159 < PokeBattle_Move
  9402. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9403. if @battle.field.effects[PBEffects::PsychicTerrain]>0
  9404. @battle.pbDisplay(_INTL("But it failed!"))
  9405. return -1
  9406. end
  9407. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9408. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9409. @battle.field.effects[PBEffects::MistyTerrain]=0
  9410. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9411. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9412. @battle.field.effects[PBEffects::PsychicTerrain]=8
  9413. else
  9414. @battle.field.effects[PBEffects::PsychicTerrain]=5
  9415. end
  9416. @battle.pbDisplay(_INTL("The battlefield got weird!"))
  9417. if attacker.hasWorkingItem(:PSYCHICSEED)
  9418. if attacker.pbIncreaseStatWithCause(PBStats::SPDEF,1,attacker,PBItems.getName(attacker.item))
  9419. attacker.pbConsumeItem
  9420. end
  9421. end
  9422. return 0
  9423. end
  9424. end
  9425. ################################################################################
  9426. # For 5 rounds, creates a misty terrain which weakens Dragon-type moves and
  9427. # protects Pokémon from status problems. Affects non-airborne Pokémon only.
  9428. # (Misty Terrain)
  9429. ################################################################################
  9430. class PokeBattle_Move_156 < PokeBattle_Move
  9431. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9432. if @battle.field.effects[PBEffects::MistyTerrain]>0
  9433. @battle.pbDisplay(_INTL("But it failed!"))
  9434. return -1
  9435. end
  9436. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9437. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9438. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9439. @battle.field.effects[PBEffects::PsychicTerrain]=0
  9440. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9441. @battle.field.effects[PBEffects::MistyTerrain]=8
  9442. else
  9443. @battle.field.effects[PBEffects::MistyTerrain]=5
  9444. end
  9445. @battle.pbDisplay(_INTL("Mist swirled about the battlefield!"))
  9446. if attacker.hasWorkingItem(:MISTYSEED)
  9447. if attacker.pbIncreaseStatWithCause(PBStats::SPDEF,1,attacker,PBItems.getName(attacker.item))
  9448. attacker.pbConsumeItem
  9449. end
  9450. end
  9451. return 0
  9452. end
  9453. end
  9454. ################################################################################
  9455. # For 5 rounds, creates a grassy terrain which boosts Grass-type moves and heals
  9456. # Pokémon at the end of each round. Affects non-airborne Pokémon only.
  9457. # (Grassy Terrain)
  9458. ################################################################################
  9459. class PokeBattle_Move_155 < PokeBattle_Move
  9460. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9461. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  9462. @battle.pbDisplay(_INTL("But it failed!"))
  9463. return -1
  9464. end
  9465. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9466. @battle.field.effects[PBEffects::ElectricTerrain]=0
  9467. @battle.field.effects[PBEffects::MistyTerrain]=0
  9468. @battle.field.effects[PBEffects::PsychicTerrain]=0
  9469. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9470. @battle.field.effects[PBEffects::GrassyTerrain]=8
  9471. else
  9472. @battle.field.effects[PBEffects::GrassyTerrain]=5
  9473. end
  9474. @battle.pbDisplay(_INTL("Grass grew to cover the battlefield!"))
  9475. if attacker.hasWorkingItem(:GRASSYSEED)
  9476. if attacker.pbIncreaseStatWithCause(PBStats::DEFENSE,1,attacker,PBItems.getName(attacker.item))
  9477. attacker.pbConsumeItem
  9478. end
  9479. end
  9480. return 0
  9481. end
  9482. end
  9483. ################################################################################
  9484. # For 5 rounds, creates an electric terrain which boosts Electric-type moves and
  9485. # prevents Pokémon from falling asleep. Affects non-airborne Pokémon only.
  9486. # (Electric Terrain)
  9487. ################################################################################
  9488. class PokeBattle_Move_154 < PokeBattle_Move
  9489. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9490. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  9491. @battle.pbDisplay(_INTL("But it failed!"))
  9492. return -1
  9493. end
  9494. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9495. @battle.field.effects[PBEffects::GrassyTerrain]=0
  9496. @battle.field.effects[PBEffects::MistyTerrain]=0
  9497. @battle.field.effects[PBEffects::PsychicTerrain]=0
  9498. if attacker.hasWorkingItem(:TERRAINEXTENDER)
  9499. @battle.field.effects[PBEffects::ElectricTerrain]=8
  9500. else
  9501. @battle.field.effects[PBEffects::ElectricTerrain]=5
  9502. end
  9503. @battle.pbDisplay(_INTL("An electric current runs across the battlefield!"))
  9504. if attacker.hasWorkingItem(:ELECTRICSEED)
  9505. if attacker.pbIncreaseStatWithCause(PBStats::DEFENSE,1,attacker,PBItems.getName(attacker.item))
  9506. attacker.pbConsumeItem
  9507. end
  9508. end
  9509. return 0
  9510. end
  9511. end
  9512.  
  9513. ################################################################################
  9514. # Doubles the prize money the player gets after winning the battle. (Happy Hour)
  9515. ################################################################################
  9516. class PokeBattle_Move_157 < PokeBattle_Move
  9517. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9518. if @battle.pbIsOpposing?(attacker.index) || @battle.doublemoney
  9519. @battle.pbDisplay(_INTL("But it failed!"))
  9520. return -1
  9521. end
  9522. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9523. @battle.doublemoney=true
  9524. @battle.pbDisplay(_INTL("Everyone is caught up in the happy atmosphere!"))
  9525. return 0
  9526. end
  9527. end
  9528.  
  9529.  
  9530.  
  9531. ################################################################################
  9532. # Fails unless user has consumed a berry at some point. (Belch)
  9533. ################################################################################
  9534. class PokeBattle_Move_158 < PokeBattle_Move
  9535. def pbMoveFailed(attacker,opponent)
  9536. return !attacker.pokemon || !attacker.pokemon.belch
  9537. end
  9538. end
  9539.  
  9540.  
  9541. ################################################################################
  9542. # For 5 rounds, lowers power of physical and special attacks against the user's
  9543. # Side. (Aurora Veil)
  9544. ################################################################################
  9545. class PokeBattle_Move_CF6 < PokeBattle_Move
  9546. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9547. if attacker.pbOwnSide.effects[PBEffects::AuroraVeil]>0
  9548. @battle.pbDisplay(_INTL("But it failed!"))
  9549. return -1
  9550. end
  9551. if @battle.pbWeather!=PBWeather::HAIL
  9552. @battle.pbDisplay(_INTL("But it failed!"))
  9553. return -1
  9554. end
  9555. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9556. attacker.pbOwnSide.effects[PBEffects::AuroraVeil]=5
  9557. attacker.pbOwnSide.effects[PBEffects::AuroraVeil]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  9558. if !@battle.pbIsOpposing?(attacker.index)
  9559. @battle.pbDisplay(_INTL("Aurora Veil is protecting your side!"))
  9560. else
  9561. @battle.pbDisplay(_INTL("Aurora Veil is protecting the opposing team's side!"))
  9562. end
  9563. return 0
  9564. end
  9565. end
  9566.  
  9567.  
  9568. ###############################################################################
  9569. # Charges its beak and attacks second turn. (Beak Blast)
  9570. ################################################################################
  9571. class PokeBattle_Move_CF20 < PokeBattle_Move
  9572. def pbTwoTurnAttack(attacker)
  9573. @immediate=false
  9574. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9575. @immediate=true
  9576. end
  9577. return false if @immediate
  9578. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9579. end
  9580.  
  9581. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9582. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9583. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  9584. @battle.pbDisplay(_INTL("{1} is heating up its beak!",attacker.pbThis))
  9585. attacker.effects[PBEffects::BeakBlast]=1
  9586. end
  9587. if @immediate
  9588. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9589. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  9590. attacker.pbConsumeItem
  9591. attacker.effects[PBEffects::BeakBlast]=0
  9592. end
  9593. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9594. return super(attacker,opponent,hitnum,alltargets,showanimation)
  9595. end
  9596. end
  9597.  
  9598. ################################################################################
  9599. # Heals user by an amount depending on the terrain. (Floral Healing)
  9600. ################################################################################
  9601. class PokeBattle_Move_CF2 < PokeBattle_Move
  9602. def isHealingMove?
  9603. return true
  9604. end
  9605.  
  9606. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9607. if attacker.hp==attacker.totalhp
  9608. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  9609. return -1
  9610. end
  9611. hpgain=0
  9612. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  9613. hpgain=(attacker.totalhp*2/3).floor
  9614. else
  9615. hpgain=(attacker.totalhp/2).floor
  9616. end
  9617. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9618. attacker.pbRecoverHP(hpgain,true)
  9619. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  9620. return 0
  9621. end
  9622. end
  9623.  
  9624. ################################################################################
  9625. # Raises the Attack and Special Attack of an ally. (Gear Up)
  9626. ################################################################################
  9627. class PokeBattle_Move_CF12 < PokeBattle_Move
  9628. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9629. if !@battle.doublebattle || !opponent ||
  9630. !opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) ||
  9631. !opponent.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  9632. @battle.pbDisplay(_INTL("But it failed!"))
  9633. return -1
  9634. end
  9635. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9636. opponent.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  9637. opponent.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  9638. return 0
  9639. end
  9640. end
  9641.  
  9642. ################################################################################
  9643. # Fails if this isn't the user's first turn. (First Impression)
  9644. ################################################################################
  9645. class PokeBattle_Move_15A < PokeBattle_Move
  9646. def pbMoveFailed(attacker,opponent)
  9647. return (attacker.turncount>1)
  9648. end
  9649. end
  9650.  
  9651. ################################################################################
  9652. # The user's next move will be a critical hit
  9653. ################################################################################
  9654. class PokeBattle_Move_19A < PokeBattle_Move
  9655. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9656. attacker.effects[PBEffects::LaserFocus]=2
  9657. @battle.pbDisplay(_INTL("{1} began focusing hard!",attacker.pbThis))
  9658. return 0
  9659. end
  9660. end
  9661.  
  9662. ################################################################################
  9663. # If the target is an ally, heals the target for the amount of damage that would
  9664. # have been dealt. If target is an opponent, damages them normally. (Pollen Puff)
  9665. ################################################################################
  9666. class PokeBattle_Move_CF19 < PokeBattle_Move
  9667. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9668. if attacker.pbPartner != nil
  9669. if attacker.pbPartner == opponent
  9670. damage=pbCalcDamage(attacker,opponent)
  9671. opponent.pbRecoverHP(damage,true)
  9672. return 0
  9673. end
  9674. end
  9675. return super(attacker,opponent,hitnum,alltargets,showanimation)
  9676. end
  9677. end
  9678.  
  9679. ################################################################################
  9680. # Heals the target's Status condition and heals the user by 50%. (Purify)
  9681. ################################################################################
  9682. class PokeBattle_Move_CF3 < PokeBattle_Move
  9683. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=false)
  9684. if opponent.status!=PBStatuses::BURN &&
  9685. opponent.status!=PBStatuses::POISON &&
  9686. opponent.status!=PBStatuses::PARALYSIS &&
  9687. opponent.status!=PBStatuses::SLEEP &&
  9688. opponent.status!=PBStatuses::FROZEN
  9689. @battle.pbDisplay(_INTL("But it failed!"))
  9690. return -1
  9691. else
  9692. t=opponent.status
  9693. opponent.pbCureStatus(false)
  9694. if t==PBStatuses::BURN
  9695. @battle.pbDisplay(_INTL("{1}'s Purify cured {2}'s burn!",attacker.pbThis,opponent.pbThis))
  9696. elsif t==PBStatuses::POISON
  9697. @battle.pbDisplay(_INTL("{1}'s Purify cured {2}'s poison!",attacker.pbThis,opponent.pbThis))
  9698. elsif t==PBStatuses::PARALYSIS
  9699. @battle.pbDisplay(_INTL("{1}'s Purify cured {2}'s paralysis",attacker.pbThis,opponent.pbThis))
  9700. elsif t==PBStatuses::SLEEP
  9701. @battle.pbDisplay(_INTL("{1}'s Purify woke {2} up!",attacker.pbThis,opponent.pbThis))
  9702. elsif t==PBStatuses::FROZEN
  9703. @battle.pbDisplay(_INTL("{1}'s Purify thawed {2} out!",attacker.pbThis,opponent.pbThis))
  9704. end
  9705. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9706. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  9707. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  9708. return 0
  9709. end
  9710. end
  9711. end
  9712.  
  9713. ################################################################################
  9714. # Heals user by an amount depending on the weather. (Shore Up)
  9715. ################################################################################
  9716. class PokeBattle_Move_CF5 < PokeBattle_Move
  9717. def isHealingMove?
  9718. return true
  9719. end
  9720.  
  9721. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9722. if attacker.hp==attacker.totalhp
  9723. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  9724. return -1
  9725. end
  9726. hpgain=0
  9727. if @battle.pbWeather==PBWeather::SANDSTORM
  9728. hpgain=(attacker.totalhp*2/3).floor
  9729. else
  9730. hpgain=(attacker.totalhp/2).floor
  9731. end
  9732. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  9733. attacker.pbRecoverHP(hpgain,true)
  9734. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  9735. return 0
  9736. end
  9737. end
  9738.  
  9739. ################################################################################
  9740. # Charges the first turn and attacks the second turn. Will instantly attack in
  9741. # Harsh Sunlight. (Solar Blade)
  9742. ################################################################################
  9743. class PokeBattle_Move_CF7 < PokeBattle_Move
  9744. def pbTwoTurnAttack(attacker)
  9745. @immediate=false
  9746. if attacker.effects[PBEffects::TwoTurnAttack]==0
  9747. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  9748. @battle.pbWeather==PBWeather::HARSHSUN
  9749. @immediate=true
  9750. end
  9751. end
  9752. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  9753. @immediate=true
  9754. end
  9755. return false if @immediate
  9756. return attacker.effects[PBEffects::TwoTurnAttack]==0
  9757. end
  9758.  
  9759. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=false)
  9760. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  9761. @battle.pbDisplay(_INTL("{1} is gathering light!",attacker.pbThis))
  9762. end
  9763. if @immediate
  9764. @battle.pbCommonAnimation("UseItem",attacker,nil)
  9765. @battle.pbDisplay(_INTL("{1} used Solar Blade!",attacker.pbThis))
  9766. attacker.pbConsumeItem
  9767. end
  9768. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  9769. return super(attacker,opponent,hitnum,alltargets,showanimation)
  9770. end
  9771. end
  9772.  
  9773. ################################################################################
  9774. # Inflicts damage to the target. If the target is burned, the burn is healed.
  9775. # (Sparkling Aria)
  9776. ################################################################################
  9777. class PokeBattle_Move_CF8 < PokeBattle_Move
  9778. def pbEffectAfterHit(attacker,opponent,turneffects)
  9779. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  9780. !opponent.damagestate.substitute && opponent.status==PBStatuses::BURN
  9781. opponent.pbCureStatus
  9782. end
  9783. end
  9784. end
  9785.  
  9786. ################################################################################
  9787. # Copies the opponent's stat changes and then resets it. After this, it will
  9788. # Attack. (Spectral Thief)
  9789. ################################################################################
  9790. class PokeBattle_Move_CF9 < PokeBattle_Move
  9791. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9792. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  9793. @battle.pbDisplay(_INTL("But it failed!"))
  9794. return -1
  9795. end
  9796. @battle.pbDisplay(_INTL("{1} stole {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  9797. if opponent.stages[PBStats::ATTACK]>0
  9798. attacker.pbIncreaseStat(PBStats::ATTACK,opponent.stages[PBStats::ATTACK],attacker,false,self) if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  9799. opponent.stages[PBStats::ATTACK]=0
  9800. end
  9801. if opponent.stages[PBStats::DEFENSE]>0
  9802. attacker.pbIncreaseStat(PBStats::DEFENSE,opponent.stages[PBStats::DEFENSE],attacker,false,self) if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  9803. opponent.stages[PBStats::DEFENSE]=0
  9804. end
  9805. if opponent.stages[PBStats::SPATK]>0
  9806. attacker.pbIncreaseStat(PBStats::SPATK,opponent.stages[PBStats::SPATK],attacker,false,self) if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  9807. opponent.stages[PBStats::SPATK]=0
  9808. end
  9809. if opponent.stages[PBStats::SPDEF]>0
  9810. attacker.pbIncreaseStat(PBStats::SPDEF,opponent.stages[PBStats::SPDEF],attacker,false,self) if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  9811. opponent.stages[PBStats::SPDEF]=0
  9812. end
  9813. if opponent.stages[PBStats::SPEED]>0
  9814. attacker.pbIncreaseStat(PBStats::SPEED,opponent.stages[PBStats::SPEED],attacker,false,self) if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  9815. opponent.stages[PBStats::SPEED]=0
  9816. end
  9817. if opponent.stages[PBStats::ACCURACY]>0
  9818. attacker.pbIncreaseStat(PBStats::ACCURACY,opponent.stages[PBStats::ACCURACY],attacker,false,self) if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,attacker,false,self)
  9819. opponent.stages[PBStats::ACCURACY]=0
  9820. end
  9821. if opponent.stages[PBStats::EVASION]>0
  9822. attacker.pbIncreaseStat(PBStats::EVASION,opponent.stages[PBStats::EVASION],attacker,false,self) if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  9823. opponent.stages[PBStats::EVASION]=0
  9824. end
  9825. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9826. return ret
  9827. end
  9828. end
  9829.  
  9830. ################################################################################
  9831. # User and target swap their Speed stats. (Speed Swap)
  9832. ################################################################################
  9833. class PokeBattle_Move_CF10 < PokeBattle_Move
  9834. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9835. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  9836. attacker.speed,opponent.speed=opponent.speed,attacker.speed
  9837. @battle.pbDisplay(_INTL("{1} and {2} switched their Speed stats!",attacker.pbThis,opponent.pbThis))
  9838. return 0
  9839. end
  9840. end
  9841.  
  9842. ################################################################################
  9843. # Deals damage and makes the target unable to switch out. (Spirit Shackle)
  9844. ################################################################################
  9845. class PokeBattle_Move_CF11 < PokeBattle_Move
  9846. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9847. if pbIsDamaging?
  9848. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9849. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  9850. !opponent.isFainted?
  9851. if opponent.effects[PBEffects::MeanLook]<0
  9852. opponent.effects[PBEffects::MeanLook]=attacker.index
  9853. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  9854. end
  9855. end
  9856. return ret
  9857. end
  9858. end
  9859. end
  9860.  
  9861. ################################################################################
  9862. # Heals the user for an amount equal to the target's effective Attack stat
  9863. # Lowers the target's Attack by 1 stage. (Strength Sap)
  9864. ################################################################################
  9865. class PokeBattle_Move_CF13 < PokeBattle_Move
  9866. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9867. if attacker.effects[PBEffects::HealBlock]>0
  9868. bob="heal"
  9869. bob=_INTL("use {1}",name) if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
  9870. @battle.pbDisplay(_INTL("{1} can't {2} because of Heal Block!",attacker.pbThis,bob))
  9871. return -1
  9872. elsif attacker.hp==attacker.totalhp
  9873. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  9874. return -1
  9875. else
  9876. oatk=opponent.attack
  9877. attacker.pbRecoverHP(oatk,true)
  9878. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  9879. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,opponent,false,self)
  9880. opponent.pbReduceStat(PBStats::ATTACK,1,opponent,false,self)
  9881. end
  9882. end
  9883. return 0
  9884. end
  9885. end
  9886.  
  9887. ################################################################################
  9888. # Lowers the target's Attack and Special Attack. Bypasses Accuracy. (Tearful Look)
  9889. ################################################################################
  9890. class PokeBattle_Move_CF14 < PokeBattle_Move
  9891. def pbAccuracyCheck(attacker,opponent)
  9892. return true
  9893. end
  9894.  
  9895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9896. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  9897. showanim=true
  9898. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,opponent,false,self)
  9899. opponent.pbReduceStat(PBStats::ATTACK,1,opponent,false,self,showanim)
  9900. showanim=false
  9901. end
  9902. if opponent.pbCanReduceStatStage?(PBStats::SPATK,opponent,false,self)
  9903. opponent.pbReduceStat(PBStats::SPATK,1,opponent,false,self,showanim)
  9904. showanim=false
  9905. end
  9906. return ret
  9907. end
  9908. end
  9909.  
  9910. ################################################################################
  9911. # Poisons the target and lowers its speed. (Toxic Thread)
  9912. ################################################################################
  9913. class PokeBattle_Move_CF16 < PokeBattle_Move
  9914. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  9915. if opponent.pbCanPoison?(attacker,false,self)
  9916. opponent.pbPoison(attacker)
  9917. end
  9918. if opponent.pbCanReduceStatStage?(PBStats::SPEED,opponent,false,self)
  9919. opponent.pbReduceStat(PBStats::SPEED,1,opponent,false,self,showanim)
  9920. showanim=true
  9921. end
  9922. end
  9923. end
  9924.  
  9925. #===============================================================================
  9926. # NOTE: If you're inventing new move effects, use function code 159 and onwards.
  9927. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement