Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 302.77 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 @basedamage>0
  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. ################################################################################
  22. class PokeBattle_FailedMove < PokeBattle_Move
  23. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  24. @battle.pbDisplay("But it failed!")
  25. return -1
  26. end
  27. end
  28.  
  29.  
  30.  
  31. ################################################################################
  32. # Pseudomove for confusion damage
  33. ################################################################################
  34. class PokeBattle_Confusion < PokeBattle_Move
  35. def initialize(battle,move)
  36. @battle = battle
  37. @basedamage = 40
  38. @type = -1
  39. @accuracy = 100
  40. @pp = -1
  41. @addlEffect = 0
  42. @target = 0
  43. @priority = 0
  44. @flags = 0
  45. @thismove = move
  46. @name = ""
  47. @id = 0
  48. end
  49.  
  50. def pbIsPhysical?(type)
  51. return true
  52. end
  53.  
  54. def pbIsSpecial?(type)
  55. return false
  56. end
  57.  
  58. def pbCalcDamage(attacker,opponent)
  59. return super(attacker,opponent,
  60. PokeBattle_Move::NOCRITICAL|PokeBattle_Move::SELFCONFUSE|PokeBattle_Move::NOTYPE|PokeBattle_Move::NOWEIGHTING)
  61. end
  62.  
  63. def pbEffectMessages(attacker,opponent,ignoretype=false)
  64. return super(attacker,opponent,true)
  65. end
  66. end
  67.  
  68.  
  69.  
  70. ################################################################################
  71. # Implements the move Struggle.
  72. # For cases where the real move named Struggle is not defined.
  73. ################################################################################
  74. class PokeBattle_Struggle < PokeBattle_Move
  75. def initialize(battle,move)
  76. @battle = battle
  77. @basedamage = 50
  78. @type = -1
  79. @accuracy = 100
  80. @pp = -1
  81. @totalpp = 0
  82. @addlEffect = 0
  83. @target = 0
  84. @priority = 0
  85. @flags = 0
  86. @thismove = nil # not associated with a move
  87. @name = ""
  88. @id = -1 # doesn't work if 0
  89. end
  90.  
  91. def pbIsPhysical?(type)
  92. return true
  93. end
  94.  
  95. def pbIsSpecial?(type)
  96. return false
  97. end
  98.  
  99. def pbDisplayUseMessage(attacker)
  100. @battle.pbDisplayBrief(_INTL("{1} is struggling!",attacker.pbThis))
  101. return 0
  102. end
  103.  
  104. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  105. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  106. if opponent.damagestate.calcdamage>0
  107. attacker.pbReduceHP((attacker.totalhp/4).floor)
  108. @battle.pbDisplay(_INTL("{1} is damaged by the recoil!",attacker.pbThis))
  109. end
  110. return ret
  111. end
  112.  
  113. def pbCalcDamage(attacker,opponent)
  114. return super(attacker,opponent,PokeBattle_Move::IGNOREPKMNTYPES)
  115. end
  116. end
  117.  
  118.  
  119.  
  120. ################################################################################
  121. # No additional effect.
  122. ################################################################################
  123. class PokeBattle_Move_000 < PokeBattle_Move
  124. end
  125.  
  126.  
  127.  
  128. ################################################################################
  129. # Does absolutely nothing (Splash).
  130. ################################################################################
  131. class PokeBattle_Move_001 < PokeBattle_Move
  132. def pbMoveFailed(attacker,opponent)
  133. return @battle.field.effects[PBEffects::Gravity]>0
  134. end
  135.  
  136. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  137. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  138. @battle.pbDisplay(_INTL("But nothing happened!"))
  139. return 0
  140. end
  141. end
  142.  
  143.  
  144.  
  145. ################################################################################
  146. # Struggle. Overrides the default Struggle effect above.
  147. ################################################################################
  148. class PokeBattle_Move_002 < PokeBattle_Struggle
  149. end
  150.  
  151.  
  152.  
  153. ################################################################################
  154. # Puts the target to sleep.
  155. ################################################################################
  156. class PokeBattle_Move_003 < PokeBattle_Move
  157. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  158. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  159. if opponent.pbCanSleep?(true)
  160. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  161. opponent.pbSleep
  162. @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
  163. return 0
  164. end
  165. return -1
  166. end
  167.  
  168. def pbAdditionalEffect(attacker,opponent)
  169. if opponent.pbCanSleep?(false)
  170. opponent.pbSleep
  171. @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
  172. return true
  173. end
  174. return false
  175. end
  176. end
  177.  
  178.  
  179.  
  180. ################################################################################
  181. # Makes the target drowsy. It will fall asleep at the end of the next turn.
  182. ################################################################################
  183. class PokeBattle_Move_004 < PokeBattle_Move
  184. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  185. return -1 if !opponent.pbCanSleep?(true)
  186. if opponent.effects[PBEffects::Yawn]>0
  187. @battle.pbDisplay(_INTL("But it failed!"))
  188. return -1
  189. end
  190. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  191. opponent.effects[PBEffects::Yawn]=2
  192. @battle.pbDisplay(_INTL("{1} made {2} drowsy!",attacker.pbThis,opponent.pbThis(true)))
  193. return 0
  194. end
  195. end
  196.  
  197.  
  198.  
  199. ################################################################################
  200. # Poisons the target.
  201. ################################################################################
  202. class PokeBattle_Move_005 < PokeBattle_Move
  203. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  204. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  205. return -1 if !opponent.pbCanPoison?(true)
  206. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  207. opponent.pbPoison(attacker)
  208. @battle.pbDisplay(_INTL("{1} is poisoned!",opponent.pbThis))
  209. return 0
  210. end
  211.  
  212. def pbAdditionalEffect(attacker,opponent)
  213. return false if !opponent.pbCanPoison?(false)
  214. opponent.pbPoison(attacker)
  215. @battle.pbDisplay(_INTL("{1} was poisoned!",opponent.pbThis))
  216. return true
  217. end
  218. end
  219.  
  220.  
  221.  
  222. ################################################################################
  223. # Badly poisons the target.
  224. ################################################################################
  225. class PokeBattle_Move_006 < PokeBattle_Move
  226. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  227. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  228. return -1 if !opponent.pbCanPoison?(true)
  229. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  230. opponent.pbPoison(attacker,true)
  231. @battle.pbDisplay(_INTL("{1} is badly poisoned!",opponent.pbThis))
  232. return 0
  233. end
  234.  
  235. def pbAdditionalEffect(attacker,opponent)
  236. return false if !opponent.pbCanPoison?(false)
  237. opponent.pbPoison(attacker,true)
  238. @battle.pbDisplay(_INTL("{1} was badly poisoned!",opponent.pbThis))
  239. return true
  240. end
  241. end
  242.  
  243.  
  244.  
  245. ################################################################################
  246. # Paralyzes the target.
  247. ################################################################################
  248. class PokeBattle_Move_007 < PokeBattle_Move
  249. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  250. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  251. return -1 if !opponent.pbCanParalyze?(true)
  252. if isConst?(@id,PBMoves,:THUNDERWAVE)
  253. typemod=pbTypeModifier(@type,attacker,opponent)
  254. if typemod==0
  255. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  256. return -1
  257. end
  258. end
  259. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  260. opponent.pbParalyze(attacker)
  261. @battle.pbDisplay(_INTL("{1} is paralyzed! It may be unable to move!",opponent.pbThis))
  262. return 0
  263. end
  264.  
  265. def pbAdditionalEffect(attacker,opponent)
  266. return false if !opponent.pbCanParalyze?(false)
  267. opponent.pbParalyze(attacker)
  268. @battle.pbDisplay(_INTL("{1} was paralyzed! It may be unable to move!",opponent.pbThis))
  269. return true
  270. end
  271. end
  272.  
  273.  
  274.  
  275. ################################################################################
  276. # Paralyzes the target. (Thunder)
  277. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  278. # (Handled in pbAccuracyCheck): Accuracy perfect in rain, 50% in sunshine.
  279. ################################################################################
  280. class PokeBattle_Move_008 < PokeBattle_Move
  281. def pbAdditionalEffect(attacker,opponent)
  282. return false if !opponent.pbCanParalyze?(false)
  283. opponent.pbParalyze(attacker)
  284. @battle.pbDisplay(_INTL("{1} was paralyzed! It may be unable to move!",opponent.pbThis))
  285. return true
  286. end
  287. end
  288.  
  289.  
  290.  
  291. ################################################################################
  292. # Paralyzes the target. May cause the target to flinch.
  293. ################################################################################
  294. class PokeBattle_Move_009 < PokeBattle_Move
  295. def pbAdditionalEffect(attacker,opponent)
  296. hadeffect=false
  297. if @battle.pbRandom(10)==0
  298. break if !opponent.pbCanParalyze?(false)
  299. opponent.pbParalyze(attacker)
  300. @battle.pbDisplay(_INTL("{1} was paralyzed! It may be unable to move!",opponent.pbThis))
  301. hadeffect=true
  302. end
  303. if @battle.pbRandom(10)==0
  304. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  305. opponent.effects[PBEffects::Substitute]==0
  306. opponent.effects[PBEffects::Flinch]=true
  307. hadeffect=true
  308. end
  309. end
  310. return hadeffect
  311. end
  312. end
  313.  
  314.  
  315.  
  316. ################################################################################
  317. # Burns the target.
  318. ################################################################################
  319. class PokeBattle_Move_00A < PokeBattle_Move
  320. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  321. return super(attacker,opponent,hitnum) if @basedamage>0
  322. return -1 if !opponent.pbCanBurnFromFireMove?(self,true)
  323. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  324. opponent.pbBurn(attacker)
  325. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  326. return 0
  327. end
  328.  
  329. def pbAdditionalEffect(attacker,opponent)
  330. return false if !opponent.pbCanBurn?(false)
  331. opponent.pbBurn(attacker)
  332. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  333. return true
  334. end
  335. end
  336.  
  337.  
  338.  
  339. ################################################################################
  340. # Burns the target. May cause the target to flinch.
  341. ################################################################################
  342. class PokeBattle_Move_00B < PokeBattle_Move
  343. def pbAdditionalEffect(attacker,opponent)
  344. hadeffect=false
  345. if @battle.pbRandom(10)==0
  346. break if !opponent.pbCanBurn?(false)
  347. opponent.pbBurn(attacker)
  348. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  349. hadeffect=true
  350. end
  351. if @battle.pbRandom(10)==0
  352. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  353. opponent.effects[PBEffects::Substitute]==0
  354. opponent.effects[PBEffects::Flinch]=true
  355. hadeffect=true
  356. end
  357. end
  358. return hadeffect
  359. end
  360. end
  361.  
  362.  
  363.  
  364. ################################################################################
  365. # Freezes the target.
  366. ################################################################################
  367. class PokeBattle_Move_00C < PokeBattle_Move
  368. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  369. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  370. return -1 if !opponent.pbCanFreeze?(true)
  371. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  372. opponent.pbFreeze
  373. @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
  374. return 0
  375. end
  376.  
  377. def pbAdditionalEffect(attacker,opponent)
  378. if opponent.pbCanFreeze?(false)
  379. opponent.pbFreeze
  380. @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
  381. return true
  382. end
  383. return false
  384. end
  385. end
  386.  
  387.  
  388.  
  389. ################################################################################
  390. # Freezes the target.
  391. # (Handled in pbAccuracyCheck): Accuracy perfect in hail.
  392. ################################################################################
  393. class PokeBattle_Move_00D < PokeBattle_Move
  394. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  395. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  396. return -1 if !opponent.pbCanFreeze?(true)
  397. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  398. opponent.pbFreeze
  399. @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
  400. return 0
  401. end
  402.  
  403. def pbAdditionalEffect(attacker,opponent)
  404. if opponent.pbCanFreeze?(false)
  405. opponent.pbFreeze
  406. @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
  407. return true
  408. end
  409. return false
  410. end
  411. end
  412.  
  413.  
  414.  
  415. ################################################################################
  416. # Freezes the target. May cause the target to flinch.
  417. ################################################################################
  418. class PokeBattle_Move_00E < PokeBattle_Move
  419. def pbAdditionalEffect(attacker,opponent)
  420. hadeffect=false
  421. if @battle.pbRandom(10)==0
  422. break if !opponent.pbCanFreeze?(false)
  423. opponent.pbFreeze
  424. @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
  425. hadeffect=true
  426. end
  427. if @battle.pbRandom(10)==0
  428. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  429. opponent.effects[PBEffects::Substitute]==0
  430. opponent.effects[PBEffects::Flinch]=true
  431. hadeffect=true
  432. end
  433. end
  434. return hadeffect
  435. end
  436. end
  437.  
  438.  
  439.  
  440. ################################################################################
  441. # Causes the target to flinch.
  442. ################################################################################
  443. class PokeBattle_Move_00F < PokeBattle_Move
  444. def pbAdditionalEffect(attacker,opponent)
  445. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  446. opponent.effects[PBEffects::Substitute]==0
  447. opponent.effects[PBEffects::Flinch]=true
  448. return true
  449. end
  450. return false
  451. end
  452. end
  453.  
  454.  
  455.  
  456. ################################################################################
  457. # Causes the target to flinch. Does double damage if the target is Minimized.
  458. ################################################################################
  459. class PokeBattle_Move_010 < PokeBattle_Move
  460. def pbAdditionalEffect(attacker,opponent)
  461. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  462. opponent.effects[PBEffects::Substitute]==0
  463. opponent.effects[PBEffects::Flinch]=true
  464. return true
  465. end
  466. return false
  467. end
  468.  
  469. def pbModifyDamage(damagemult,attacker,opponent)
  470. if opponent.effects[PBEffects::Minimize]
  471. return (damagemult*2.0).round
  472. end
  473. return damagemult
  474. end
  475. end
  476.  
  477.  
  478.  
  479. ################################################################################
  480. # Causes the target to flinch. Fails if the user is not asleep.
  481. ################################################################################
  482. class PokeBattle_Move_011 < PokeBattle_Move
  483. def pbCanUseWhileAsleep?
  484. return true
  485. end
  486.  
  487. def pbAdditionalEffect(attacker,opponent)
  488. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  489. opponent.effects[PBEffects::Substitute]==0
  490. opponent.effects[PBEffects::Flinch]=true
  491. return true
  492. end
  493. return false
  494. end
  495.  
  496. def pbMoveFailed(attacker,opponent)
  497. return (attacker.status!=PBStatuses::SLEEP)
  498. end
  499. end
  500.  
  501.  
  502.  
  503. ################################################################################
  504. # Causes the target to flinch. Fails if this isn't the user's first turn.
  505. ################################################################################
  506. class PokeBattle_Move_012 < PokeBattle_Move
  507. def pbAdditionalEffect(attacker,opponent)
  508. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  509. opponent.effects[PBEffects::Substitute]==0
  510. opponent.effects[PBEffects::Flinch]=true
  511. return true
  512. end
  513. return false
  514. end
  515.  
  516. def pbMoveFailed(attacker,opponent)
  517. return (attacker.turncount!=1)
  518. end
  519. end
  520.  
  521.  
  522.  
  523. ################################################################################
  524. # Confuses the target.
  525. ################################################################################
  526. class PokeBattle_Move_013 < PokeBattle_Move
  527. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  528. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  529. if opponent.pbCanConfuse?(true)
  530. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  531. opponent.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  532. @battle.pbCommonAnimation("Confusion",opponent,nil)
  533. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  534. return 0
  535. end
  536. return -1
  537. end
  538.  
  539. def pbAdditionalEffect(attacker,opponent)
  540. if opponent.pbCanConfuse?(false)
  541. opponent.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  542. @battle.pbCommonAnimation("Confusion",opponent,nil)
  543. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  544. return true
  545. end
  546. return false
  547. end
  548. end
  549.  
  550.  
  551.  
  552. ################################################################################
  553. # Confuses the target. Chance of causing confusion depends on the cry's volume.
  554. # Confusion chance is 0% if user is not Chatot. (Chatter)
  555. ################################################################################
  556. class PokeBattle_Move_014 < PokeBattle_Move
  557. #TODO: Play the actual chatter cry as part of the move animation
  558. # @battle.scene.pbChatter(attacker,opponent) # Just plays cry
  559. def pbAdditionalEffect(attacker,opponent)
  560. if opponent.pbCanConfuse?(false)
  561. if isConst?(attacker.species,PBSpecies,:CHATOT) &&
  562. !attacker.effects[PBEffects::Transform] &&
  563. !opponent.hasWorkingAbility(:SHIELDDUST)
  564. chance=0
  565. if attacker.pokemon && attacker.pokemon.chatter
  566. chance+=attacker.pokemon.chatter.intensity*10/127
  567. end
  568. if rand(100)<chance
  569. opponent.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  570. @battle.pbCommonAnimation("Confusion",opponent,nil)
  571. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  572. return true
  573. end
  574. end
  575. end
  576. return false
  577. end
  578. end
  579.  
  580.  
  581.  
  582. ################################################################################
  583. # Confuses the target. (Hurricane)
  584. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  585. # (Handled in pbAccuracyCheck): Accuracy perfect in rain, 50% in sunshine.
  586. ################################################################################
  587. class PokeBattle_Move_015 < PokeBattle_Move
  588. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  589. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  590. if opponent.pbCanConfuse?(true)
  591. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  592. opponent.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  593. @battle.pbCommonAnimation("Confusion",opponent,nil)
  594. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  595. return 0
  596. end
  597. return -1
  598. end
  599.  
  600. def pbAdditionalEffect(attacker,opponent)
  601. if opponent.pbCanConfuse?(false)
  602. opponent.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  603. @battle.pbCommonAnimation("Confusion",opponent,nil)
  604. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  605. return true
  606. end
  607. return false
  608. end
  609. end
  610.  
  611.  
  612.  
  613. ################################################################################
  614. # Attracts the target.
  615. ################################################################################
  616. class PokeBattle_Move_016 < PokeBattle_Move
  617. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  618. if !opponent.pbCanAttract?(attacker)
  619. return -1
  620. end
  621. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  622. opponent.effects[PBEffects::Attract]=attacker.index
  623. @battle.pbCommonAnimation("Attract",opponent,nil)
  624. @battle.pbDisplay(_INTL("{1} fell in love!",opponent.pbThis))
  625. if opponent.hasWorkingItem(:DESTINYKNOT) &&
  626. !attacker.hasWorkingAbility(:OBLIVIOUS) &&
  627. attacker.effects[PBEffects::Attract]<0
  628. attacker.effects[PBEffects::Attract]=user.index
  629. @battle.pbCommonAnimation("Attract",attacker,nil)
  630. pbDisplay(_INTL("{1}'s {2} infatuated {3}!",opponent.pbThis,
  631. PBItems.getName(opponent.item),attacker.pbThis(true)))
  632. end
  633. return 0
  634. end
  635. end
  636.  
  637.  
  638.  
  639. ################################################################################
  640. # Burns, freezes or paralyzes the target.
  641. ################################################################################
  642. class PokeBattle_Move_017 < PokeBattle_Move
  643. def pbAdditionalEffect(attacker,opponent)
  644. rnd=@battle.pbRandom(3)
  645. case rnd
  646. when 0
  647. return false if !opponent.pbCanBurn?(false)
  648. opponent.pbBurn(attacker)
  649. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  650. when 1
  651. return false if !opponent.pbCanFreeze?(false)
  652. opponent.pbFreeze
  653. @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
  654. when 2
  655. return false if !opponent.pbCanParalyze?(false)
  656. opponent.pbParalyze(attacker)
  657. @battle.pbDisplay(_INTL("{1} is paralyzed! It may be unable to move!",opponent.pbThis))
  658. end
  659. return true
  660. end
  661. end
  662.  
  663.  
  664.  
  665. ################################################################################
  666. # Cures user of burn, poison and paralysis.
  667. ################################################################################
  668. class PokeBattle_Move_018 < PokeBattle_Move
  669. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  670. if attacker.status!=PBStatuses::BURN &&
  671. attacker.status!=PBStatuses::POISON &&
  672. attacker.status!=PBStatuses::PARALYSIS
  673. @battle.pbDisplay(_INTL("But it failed!"))
  674. return -1
  675. else
  676. t=attacker.status
  677. attacker.status=0
  678. attacker.statusCount=0
  679. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  680. if t==PBStatuses::BURN
  681. @battle.pbDisplay(_INTL("{1} was cured of its burn.",attacker.pbThis))
  682. elsif t==PBStatuses::POISON
  683. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  684. elsif t==PBStatuses::PARALYSIS
  685. @battle.pbDisplay(_INTL("{1} was cured of its paralysis.",attacker.pbThis))
  686. end
  687. return 0
  688. end
  689. end
  690. end
  691.  
  692.  
  693.  
  694. ################################################################################
  695. # Cures all party Pokémon of permanent status problems.
  696. ################################################################################
  697. class PokeBattle_Move_019 < PokeBattle_Move
  698. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  699. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  700. if isConst?(@id,PBMoves,:AROMATHERAPY)
  701. @battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
  702. else
  703. @battle.pbDisplay(_INTL("A bell chimed!"))
  704. end
  705. activepkmn=[]
  706. for i in @battle.battlers
  707. next if attacker.pbIsOpposing?(i.index)
  708. case i.status
  709. when PBStatuses::PARALYSIS
  710. @battle.pbDisplay(_INTL("{1} was cured of its paralysis.",i.pbThis))
  711. when PBStatuses::SLEEP
  712. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",i.pbThis))
  713. when PBStatuses::POISON
  714. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",i.pbThis))
  715. when PBStatuses::BURN
  716. @battle.pbDisplay(_INTL("{1} was cured of its burn.",i.pbThis))
  717. when PBStatuses::FROZEN
  718. @battle.pbDisplay(_INTL("{1} was defrosted.",i.pbThis))
  719. end
  720. i.status=0
  721. i.statusCount=0
  722. activepkmn.push(i.pokemonIndex)
  723. end
  724. party=@battle.pbParty(attacker.index) # NOTE: Considers both parties in multi battles
  725. for i in 0...party.length
  726. next if activepkmn.include?(i)
  727. next if !party[i] || party[i].isEgg?
  728. case party[i].status
  729. when PBStatuses::PARALYSIS
  730. @battle.pbDisplay(_INTL("{1} was cured of its paralysis.",party[i].name))
  731. when PBStatuses::SLEEP
  732. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",party[i].name))
  733. when PBStatuses::POISON
  734. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",party[i].name))
  735. when PBStatuses::BURN
  736. @battle.pbDisplay(_INTL("{1} was cured of its burn.",party[i].name))
  737. when PBStatuses::FROZEN
  738. @battle.pbDisplay(_INTL("{1} was defrosted.",party[i].name))
  739. end
  740. party[i].status=0
  741. party[i].statusCount=0
  742. end
  743. return 0
  744. end
  745. end
  746.  
  747.  
  748.  
  749. ################################################################################
  750. # Safeguards the user's side from being inflicted with status problems.
  751. ################################################################################
  752. class PokeBattle_Move_01A < PokeBattle_Move
  753. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  754. if attacker.pbOwnSide.effects[PBEffects::Safeguard]>0
  755. @battle.pbDisplay(_INTL("But it failed!"))
  756. return -1
  757. end
  758. attacker.pbOwnSide.effects[PBEffects::Safeguard]=5
  759. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  760. if !@battle.pbIsOpposing?(attacker.index)
  761. @battle.pbDisplay(_INTL("Your team became cloaked in a mystical veil!"))
  762. else
  763. @battle.pbDisplay(_INTL("The foe's team became cloaked in a mystical veil!"))
  764. end
  765. return 0
  766. end
  767. end
  768.  
  769.  
  770.  
  771. ################################################################################
  772. # User passes its status problem to the target.
  773. ################################################################################
  774. class PokeBattle_Move_01B < PokeBattle_Move
  775. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  776. if attacker.status==0 ||
  777. (attacker.status==PBStatuses::PARALYSIS && !opponent.pbCanParalyze?(false)) ||
  778. (attacker.status==PBStatuses::SLEEP && !opponent.pbCanSleep?(false)) ||
  779. (attacker.status==PBStatuses::POISON && !opponent.pbCanPoison?(false)) ||
  780. (attacker.status==PBStatuses::BURN && !opponent.pbCanBurn?(false)) ||
  781. (attacker.status==PBStatuses::FROZEN && !opponent.pbCanFreeze?(false))
  782. @battle.pbDisplay(_INTL("But it failed!"))
  783. return -1
  784. end
  785. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  786. case attacker.status
  787. when PBStatuses::PARALYSIS
  788. opponent.pbParalyze(attacker)
  789. @battle.pbDisplay(_INTL("{1} is paralyzed! It may be unable to move!",opponent.pbThis))
  790. opponent.pbAbilityCureCheck
  791. @battle.synchronize=[-1,-1,0] if opponent.status!=PBStatuses::PARALYSIS
  792. attacker.status=0
  793. @battle.pbDisplay(_INTL("{1} was cured of its paralysis.",attacker.pbThis))
  794. when PBStatuses::SLEEP
  795. opponent.pbSleep(attacker)
  796. @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
  797. opponent.pbAbilityCureCheck
  798. @battle.synchronize=[-1,-1,0] if opponent.status!=PBStatuses::SLEEP
  799. attacker.status=0
  800. attacker.statusCount=0
  801. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",attacker.pbThis))
  802. when PBStatuses::POISON
  803. opponent.pbPoison(attacker,attacker.statusCount!=0)
  804. if attacker.statusCount!=0
  805. @battle.pbDisplay(_INTL("{1} is badly poisoned!",opponent.pbThis))
  806. else
  807. @battle.pbDisplay(_INTL("{1} is poisoned!",opponent.pbThis))
  808. end
  809. opponent.pbAbilityCureCheck
  810. @battle.synchronize=[-1,-1,0] if opponent.status!=PBStatuses::POISON
  811. attacker.status=0
  812. attacker.statusCount=0
  813. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  814. when PBStatuses::BURN
  815. opponent.pbBurn(attacker)
  816. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  817. opponent.pbAbilityCureCheck
  818. @battle.synchronize=[-1,-1,0] if opponent.status!=PBStatuses::BURN
  819. attacker.status=0
  820. @battle.pbDisplay(_INTL("{1} was cured of its burn.",attacker.pbThis))
  821. when PBStatuses::FROZEN
  822. opponent.pbFreeze(attacker)
  823. @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
  824. opponent.pbAbilityCureCheck
  825. @battle.synchronize=[-1,-1,0] if opponent.status!=PBStatuses::FROZEN
  826. attacker.status=0
  827. @battle.pbDisplay(_INTL("{1} was defrosted.",attacker.pbThis))
  828. end
  829. return 0
  830. end
  831. end
  832.  
  833.  
  834.  
  835. ################################################################################
  836. # Increases the user's Attack by 1 stage.
  837. ################################################################################
  838. class PokeBattle_Move_01C < PokeBattle_Move
  839. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  840. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  841. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,true)
  842. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  843. ret=attacker.pbIncreaseStat(PBStats::ATTACK,1,false)
  844. return ret ? 0 : -1
  845. end
  846.  
  847. def pbAdditionalEffect(attacker,opponent)
  848. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  849. attacker.pbIncreaseStat(PBStats::ATTACK,1,false)
  850. end
  851. return true
  852. end
  853. end
  854.  
  855.  
  856.  
  857. ################################################################################
  858. # Increases the user's Defense by 1 stage.
  859. ################################################################################
  860. class PokeBattle_Move_01D < PokeBattle_Move
  861. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  862. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  863. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,true)
  864. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  865. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,false)
  866. return ret ? 0 : -1
  867. end
  868.  
  869. def pbAdditionalEffect(attacker,opponent)
  870. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  871. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false)
  872. end
  873. return true
  874. end
  875. end
  876.  
  877.  
  878.  
  879. ################################################################################
  880. # Increases the user's Defense by 1 stage. User curls up.
  881. ################################################################################
  882. class PokeBattle_Move_01E < PokeBattle_Move
  883. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  884. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,true)
  885. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  886. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,false)
  887. attacker.effects[PBEffects::DefenseCurl]=true if ret
  888. return ret ? 0 : -1
  889. end
  890. end
  891.  
  892.  
  893.  
  894. ################################################################################
  895. # Increases the user's Speed by 1 stage.
  896. ################################################################################
  897. class PokeBattle_Move_01F < PokeBattle_Move
  898. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  899. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  900. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,true)
  901. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  902. ret=attacker.pbIncreaseStat(PBStats::SPEED,1,false)
  903. return ret ? 0 : -1
  904. end
  905.  
  906. def pbAdditionalEffect(attacker,opponent)
  907. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  908. attacker.pbIncreaseStat(PBStats::SPEED,1,false)
  909. end
  910. return true
  911. end
  912. end
  913.  
  914.  
  915.  
  916. ################################################################################
  917. # Increases the user's Special Attack by 1 stage.
  918. ################################################################################
  919. class PokeBattle_Move_020 < PokeBattle_Move
  920. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  921. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  922. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,true)
  923. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  924. ret=attacker.pbIncreaseStat(PBStats::SPATK,1,false)
  925. return ret ? 0 : -1
  926. end
  927.  
  928. def pbAdditionalEffect(attacker,opponent)
  929. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  930. attacker.pbIncreaseStat(PBStats::SPATK,1,false)
  931. end
  932. return true
  933. end
  934. end
  935.  
  936.  
  937.  
  938. ################################################################################
  939. # Increases the user's Special Defense by 1 stage. Charges up Electric attacks.
  940. ################################################################################
  941. class PokeBattle_Move_021 < PokeBattle_Move
  942. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  943. attacker.effects[PBEffects::Charge]=2
  944. @battle.pbDisplay(_INTL("{1} began charging power!",attacker.pbThis))
  945. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,true)
  946. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  947. attacker.pbIncreaseStat(PBStats::SPDEF,1,false)
  948. end
  949. return 0
  950. end
  951. end
  952.  
  953.  
  954.  
  955. ################################################################################
  956. # Increases the user's evasion by 1 stage.
  957. ################################################################################
  958. class PokeBattle_Move_022 < PokeBattle_Move
  959. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  960. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  961. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,true)
  962. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  963. ret=attacker.pbIncreaseStat(PBStats::EVASION,1,false)
  964. return ret ? 0 : -1
  965. end
  966.  
  967. def pbAdditionalEffect(attacker,opponent)
  968. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,false)
  969. attacker.pbIncreaseStat(PBStats::EVASION,1,false)
  970. end
  971. return true
  972. end
  973. end
  974.  
  975.  
  976.  
  977. ################################################################################
  978. # Increases the user's critical hit rate.
  979. ################################################################################
  980. class PokeBattle_Move_023 < PokeBattle_Move
  981. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  982. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  983. if attacker.effects[PBEffects::FocusEnergy]>=2
  984. @battle.pbDisplay(_INTL("But it failed!"))
  985. return -1
  986. end
  987. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  988. attacker.effects[PBEffects::FocusEnergy]=2
  989. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  990. return 0
  991. end
  992.  
  993. def pbAdditionalEffect(attacker,opponent)
  994. if attacker.effects[PBEffects::FocusEnergy]<2
  995. attacker.effects[PBEffects::FocusEnergy]=2
  996. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  997. end
  998. return true
  999. end
  1000. end
  1001.  
  1002.  
  1003.  
  1004. ################################################################################
  1005. # Increases the user's Attack and Defense by 1 stage each.
  1006. ################################################################################
  1007. class PokeBattle_Move_024 < PokeBattle_Move
  1008. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1009. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1010. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  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,false)
  1017. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  1018. showanim=false
  1019. end
  1020. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  1021. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false,showanim)
  1022. showanim=false
  1023. end
  1024. return 0
  1025. end
  1026. end
  1027.  
  1028.  
  1029.  
  1030. ################################################################################
  1031. # Increases the user's Attack, Defense and accuracy by 1 stage each.
  1032. ################################################################################
  1033. class PokeBattle_Move_025 < PokeBattle_Move
  1034. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1035. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1036. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false) &&
  1037. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,false)
  1038. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1039. return -1
  1040. end
  1041. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1042. showanim=true
  1043. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1044. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  1045. showanim=false
  1046. end
  1047. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  1048. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false,showanim)
  1049. showanim=false
  1050. end
  1051. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,false)
  1052. attacker.pbIncreaseStat(PBStats::ACCURACY,1,false,showanim)
  1053. showanim=false
  1054. end
  1055. return 0
  1056. end
  1057. end
  1058.  
  1059.  
  1060.  
  1061. ################################################################################
  1062. # Increases the user's Attack and Speed by 1 stage each.
  1063. ################################################################################
  1064. class PokeBattle_Move_026 < PokeBattle_Move
  1065. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1066. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1067. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1068. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1069. return -1
  1070. end
  1071. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1072. showanim=true
  1073. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1074. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  1075. showanim=false
  1076. end
  1077. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1078. attacker.pbIncreaseStat(PBStats::SPEED,1,false,showanim)
  1079. showanim=false
  1080. end
  1081. return 0
  1082. end
  1083. end
  1084.  
  1085.  
  1086.  
  1087. ################################################################################
  1088. # Increases the user's Attack and Special Attack by 1 stage each.
  1089. ################################################################################
  1090. class PokeBattle_Move_027 < PokeBattle_Move
  1091. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1092. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1093. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  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. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1100. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  1101. showanim=false
  1102. end
  1103. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1104. attacker.pbIncreaseStat(PBStats::SPATK,1,false,showanim)
  1105. showanim=false
  1106. end
  1107. return 0
  1108. end
  1109. end
  1110.  
  1111.  
  1112.  
  1113. ################################################################################
  1114. # Increases the user's Attack and Sp. Attack by 1 stage each (2 each in sunshine).
  1115. ################################################################################
  1116. class PokeBattle_Move_028 < PokeBattle_Move
  1117. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1118. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1119. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1120. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1121. return -1
  1122. end
  1123. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1124. showanim=true
  1125. increment=(@battle.weather==PBWeather::SUNNYDAY) ? 2 : 1
  1126. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1127. attacker.pbIncreaseStat(PBStats::ATTACK,increment,false,showanim)
  1128. showanim=false
  1129. end
  1130. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1131. attacker.pbIncreaseStat(PBStats::SPATK,increment,false,showanim)
  1132. showanim=false
  1133. end
  1134. return 0
  1135. end
  1136. end
  1137.  
  1138.  
  1139.  
  1140. ################################################################################
  1141. # Increases the user's Attack and accuracy by 1 stage each.
  1142. ################################################################################
  1143. class PokeBattle_Move_029 < PokeBattle_Move
  1144. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1145. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1146. !attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,false)
  1147. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1148. return -1
  1149. end
  1150. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1151. showanim=true
  1152. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1153. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  1154. showanim=false
  1155. end
  1156. if attacker.pbCanIncreaseStatStage?(PBStats::ACCURACY,false)
  1157. attacker.pbIncreaseStat(PBStats::ACCURACY,1,false,showanim)
  1158. showanim=false
  1159. end
  1160. return 0
  1161. end
  1162. end
  1163.  
  1164.  
  1165.  
  1166. ################################################################################
  1167. # Increases the user's Defense and Special Defense by 1 stage each.
  1168. ################################################################################
  1169. class PokeBattle_Move_02A < PokeBattle_Move
  1170. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1171. if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false) &&
  1172. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  1173. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1174. return -1
  1175. end
  1176. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1177. showanim=true
  1178. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  1179. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false,showanim)
  1180. showanim=false
  1181. end
  1182. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  1183. attacker.pbIncreaseStat(PBStats::SPDEF,1,false,showanim)
  1184. showanim=false
  1185. end
  1186. return 0
  1187. end
  1188. end
  1189.  
  1190.  
  1191.  
  1192. ################################################################################
  1193. # Increases the user's Special Attack, Special Defense and Speed by 1 stage each.
  1194. ################################################################################
  1195. class PokeBattle_Move_02B < PokeBattle_Move
  1196. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1197. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false) &&
  1198. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false) &&
  1199. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1200. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1201. return -1
  1202. end
  1203. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1204. showanim=true
  1205. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1206. attacker.pbIncreaseStat(PBStats::SPATK,1,false,showanim)
  1207. showanim=false
  1208. end
  1209. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  1210. attacker.pbIncreaseStat(PBStats::SPDEF,1,false,showanim)
  1211. showanim=false
  1212. end
  1213. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1214. attacker.pbIncreaseStat(PBStats::SPEED,1,false,showanim)
  1215. showanim=false
  1216. end
  1217. return 0
  1218. end
  1219. end
  1220.  
  1221.  
  1222.  
  1223. ################################################################################
  1224. # Increases the user's Special Attack and Special Defense by 1 stage each.
  1225. ################################################################################
  1226. class PokeBattle_Move_02C < PokeBattle_Move
  1227. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1228. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false) &&
  1229. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  1230. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1231. return -1
  1232. end
  1233. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1234. showanim=true
  1235. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1236. attacker.pbIncreaseStat(PBStats::SPATK,1,false,showanim)
  1237. showanim=false
  1238. end
  1239. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  1240. attacker.pbIncreaseStat(PBStats::SPDEF,1,false,showanim)
  1241. showanim=false
  1242. end
  1243. return 0
  1244. end
  1245. end
  1246.  
  1247.  
  1248.  
  1249. ################################################################################
  1250. # Increases the user's Attack, Defense, Speed, Special Attack and Special Defense
  1251. # by 1 stage each.
  1252. ################################################################################
  1253. class PokeBattle_Move_02D < PokeBattle_Move
  1254. def pbAdditionalEffect(attacker,opponent)
  1255. showanim=true
  1256. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1257. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  1258. showanim=false
  1259. end
  1260. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  1261. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false,showanim)
  1262. showanim=false
  1263. end
  1264. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1265. attacker.pbIncreaseStat(PBStats::SPATK,1,false,showanim)
  1266. showanim=false
  1267. end
  1268. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  1269. attacker.pbIncreaseStat(PBStats::SPDEF,1,false,showanim)
  1270. showanim=false
  1271. end
  1272. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1273. attacker.pbIncreaseStat(PBStats::SPEED,1,false,showanim)
  1274. showanim=false
  1275. end
  1276. return true
  1277. end
  1278. end
  1279.  
  1280.  
  1281.  
  1282. ################################################################################
  1283. # Increases the user's Attack by 2 stages.
  1284. ################################################################################
  1285. class PokeBattle_Move_02E < PokeBattle_Move
  1286. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1287. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1288. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,true)
  1289. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1290. ret=attacker.pbIncreaseStat(PBStats::ATTACK,2,false)
  1291. return ret ? 0 : -1
  1292. end
  1293.  
  1294. def pbAdditionalEffect(attacker,opponent)
  1295. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1296. attacker.pbIncreaseStat(PBStats::ATTACK,2,false)
  1297. end
  1298. return true
  1299. end
  1300. end
  1301.  
  1302.  
  1303.  
  1304. ################################################################################
  1305. # Increases the user's Defense by 2 stages.
  1306. ################################################################################
  1307. class PokeBattle_Move_02F < PokeBattle_Move
  1308. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1309. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1310. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,true)
  1311. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1312. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,2,false)
  1313. return ret ? 0 : -1
  1314. end
  1315.  
  1316. def pbAdditionalEffect(attacker,opponent)
  1317. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  1318. attacker.pbIncreaseStat(PBStats::DEFENSE,2,false)
  1319. end
  1320. return true
  1321. end
  1322. end
  1323.  
  1324.  
  1325.  
  1326. ################################################################################
  1327. # Increases the user's Speed by 2 stages.
  1328. ################################################################################
  1329. class PokeBattle_Move_030 < PokeBattle_Move
  1330. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1331. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1332. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,true)
  1333. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1334. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,false)
  1335. return ret ? 0 : -1
  1336. end
  1337.  
  1338. def pbAdditionalEffect(attacker,opponent)
  1339. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1340. attacker.pbIncreaseStat(PBStats::SPEED,2,false)
  1341. end
  1342. return true
  1343. end
  1344. end
  1345.  
  1346.  
  1347.  
  1348. ################################################################################
  1349. # Increases the user's Speed by 2 stages. Halves the user's weight.
  1350. ################################################################################
  1351. class PokeBattle_Move_031 < PokeBattle_Move
  1352. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1353. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,true)
  1354. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1355. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,false)
  1356. if ret
  1357. attacker.effects[PBEffects::WeightMultiplier]/=2
  1358. @battle.pbDisplay(_INTL("{1} became nimble!",attacker.pbThis))
  1359. end
  1360. return ret ? 0 : -1
  1361. end
  1362. end
  1363.  
  1364.  
  1365.  
  1366. ################################################################################
  1367. # Increases the user's Special Attack by 2 stages.
  1368. ################################################################################
  1369. class PokeBattle_Move_032 < PokeBattle_Move
  1370. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1371. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1372. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,true)
  1373. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1374. ret=attacker.pbIncreaseStat(PBStats::SPATK,2,false)
  1375. return ret ? 0 : -1
  1376. end
  1377.  
  1378. def pbAdditionalEffect(attacker,opponent)
  1379. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1380. attacker.pbIncreaseStat(PBStats::SPATK,2,false)
  1381. end
  1382. return true
  1383. end
  1384. end
  1385.  
  1386.  
  1387.  
  1388. ################################################################################
  1389. # Increases the user's Special Defense by 2 stages.
  1390. ################################################################################
  1391. class PokeBattle_Move_033 < PokeBattle_Move
  1392. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1393. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1394. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,true)
  1395. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1396. ret=attacker.pbIncreaseStat(PBStats::SPDEF,2,false)
  1397. return ret ? 0 : -1
  1398. end
  1399.  
  1400. def pbAdditionalEffect(attacker,opponent)
  1401. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  1402. attacker.pbIncreaseStat(PBStats::SPDEF,2,false)
  1403. end
  1404. return true
  1405. end
  1406. end
  1407.  
  1408.  
  1409.  
  1410. ################################################################################
  1411. # Increases the user's evasion by 2 stages. Minimizes the user.
  1412. ################################################################################
  1413. class PokeBattle_Move_034 < PokeBattle_Move
  1414. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1415. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1416. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,true)
  1417. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1418. ret=attacker.pbIncreaseStat(PBStats::EVASION,2,false)
  1419. attacker.effects[PBEffects::Minimize]=true if ret
  1420. return ret ? 0 : -1
  1421. end
  1422.  
  1423. def pbAdditionalEffect(attacker,opponent)
  1424. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,false)
  1425. attacker.pbIncreaseStat(PBStats::EVASION,2,false)
  1426. attacker.effects[PBEffects::Minimize]=true
  1427. end
  1428. return true
  1429. end
  1430. end
  1431.  
  1432.  
  1433.  
  1434. ################################################################################
  1435. # Decreases the user's Defense and Special Defense by 1 stage each.
  1436. # Increases the user's Attack, Speed and Special Attack by 2 stages each.
  1437. ################################################################################
  1438. class PokeBattle_Move_035 < PokeBattle_Move
  1439. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1440. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1441. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false) &&
  1442. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1443. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1444. return -1
  1445. end
  1446. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1447. showanim=true
  1448. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,false,true)
  1449. attacker.pbReduceStat(PBStats::DEFENSE,1,false,showanim,true)
  1450. showanim=false
  1451. end
  1452. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,false,true)
  1453. attacker.pbReduceStat(PBStats::SPDEF,1,false,showanim,true)
  1454. showanim=false
  1455. end
  1456. showanim=true
  1457. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1458. attacker.pbIncreaseStat(PBStats::ATTACK,2,false,showanim)
  1459. showanim=false
  1460. end
  1461. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,false)
  1462. attacker.pbIncreaseStat(PBStats::SPATK,2,false,showanim)
  1463. showanim=false
  1464. end
  1465. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1466. attacker.pbIncreaseStat(PBStats::SPEED,2,false,showanim)
  1467. showanim=false
  1468. end
  1469. return 0
  1470. end
  1471. end
  1472.  
  1473.  
  1474.  
  1475. ################################################################################
  1476. # Increases the user's Speed by 2 stages, and its Attack by 1 stage.
  1477. ################################################################################
  1478. class PokeBattle_Move_036 < PokeBattle_Move
  1479. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1480. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) &&
  1481. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1482. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  1483. return -1
  1484. end
  1485. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1486. showanim=true
  1487. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1488. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  1489. showanim=false
  1490. end
  1491. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,false)
  1492. attacker.pbIncreaseStat(PBStats::SPEED,2,false,showanim)
  1493. showanim=false
  1494. end
  1495. return 0
  1496. end
  1497. end
  1498.  
  1499.  
  1500.  
  1501. ################################################################################
  1502. # Increases one random stat of the user by 2 stages (except HP).
  1503. ################################################################################
  1504. class PokeBattle_Move_037 < PokeBattle_Move
  1505. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1506. if attacker.index!=opponent.index && opponent.effects[PBEffects::Substitute]>0
  1507. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1508. return -1
  1509. end
  1510. array=[]
  1511. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1512. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1513. array.push(i) if opponent.pbCanIncreaseStatStage?(i)
  1514. end
  1515. if array.length==0
  1516. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",opponent.pbThis))
  1517. return -1
  1518. end
  1519. stat=array[@battle.pbRandom(array.length)]
  1520. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1521. ret=opponent.pbIncreaseStat(stat,2,false)
  1522. return 0
  1523. end
  1524. end
  1525.  
  1526.  
  1527.  
  1528. ################################################################################
  1529. # Increases the user's Defense by 3 stages.
  1530. ################################################################################
  1531. class PokeBattle_Move_038 < PokeBattle_Move
  1532. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1533. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1534. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,true)
  1535. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1536. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,3,false)
  1537. return ret ? 0 : -1
  1538. end
  1539.  
  1540. def pbAdditionalEffect(attacker,opponent)
  1541. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  1542. attacker.pbIncreaseStat(PBStats::DEFENSE,3,false)
  1543. end
  1544. return true
  1545. end
  1546. end
  1547.  
  1548.  
  1549.  
  1550. ################################################################################
  1551. # Increases the user's Special Attack by 3 stages.
  1552. ################################################################################
  1553. class PokeBattle_Move_039 < PokeBattle_Move
  1554. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1555. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1556. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,true)
  1557. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1558. ret=attacker.pbIncreaseStat(PBStats::SPATK,3,false)
  1559. return ret ? 0 : -1
  1560. end
  1561.  
  1562. def pbAdditionalEffect(attacker,opponent)
  1563. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  1564. attacker.pbIncreaseStat(PBStats::SPATK,3,false)
  1565. end
  1566. return true
  1567. end
  1568. end
  1569.  
  1570.  
  1571.  
  1572. ################################################################################
  1573. # Reduces the user's HP by half of max, and sets its Attack to maximum.
  1574. ################################################################################
  1575. class PokeBattle_Move_03A < PokeBattle_Move
  1576. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1577. if attacker.hp<=(attacker.totalhp/2).floor ||
  1578. !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  1579. @battle.pbDisplay(_INTL("But it failed!"))
  1580. return -1
  1581. end
  1582. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1583. attacker.pbReduceHP((attacker.totalhp/2).floor)
  1584. attacker.stages[PBStats::ATTACK]=6
  1585. @battle.pbCommonAnimation("StatUp",attacker,nil)
  1586. @battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",attacker.pbThis))
  1587. return 0
  1588. end
  1589. end
  1590.  
  1591.  
  1592.  
  1593. ################################################################################
  1594. # Decreases the user's Attack and Defense by 1 stage each.
  1595. ################################################################################
  1596. class PokeBattle_Move_03B < PokeBattle_Move
  1597. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1598. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1599. if opponent.damagestate.calcdamage>0
  1600. showanim=true
  1601. if attacker.pbCanReduceStatStage?(PBStats::ATTACK,false,true)
  1602. attacker.pbReduceStat(PBStats::ATTACK,1,false,showanim,true)
  1603. showanim=false
  1604. end
  1605. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,false,true)
  1606. attacker.pbReduceStat(PBStats::DEFENSE,1,false,showanim,true)
  1607. showanim=false
  1608. end
  1609. end
  1610. return ret
  1611. end
  1612. end
  1613.  
  1614.  
  1615.  
  1616. ################################################################################
  1617. # Decreases the user's Defense and Special Defense by 1 stage each.
  1618. ################################################################################
  1619. class PokeBattle_Move_03C < PokeBattle_Move
  1620. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1621. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1622. if opponent.damagestate.calcdamage>0
  1623. showanim=true
  1624. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,false,true)
  1625. attacker.pbReduceStat(PBStats::DEFENSE,1,false,showanim,true)
  1626. showanim=false
  1627. end
  1628. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,false,true)
  1629. attacker.pbReduceStat(PBStats::SPDEF,1,false,showanim,true)
  1630. showanim=false
  1631. end
  1632. end
  1633. return ret
  1634. end
  1635. end
  1636.  
  1637.  
  1638.  
  1639. ################################################################################
  1640. # Decreases the user's Defense, Special Defense and Speed by 1 stage each.
  1641. # User's ally loses 1/16 of its total HP.
  1642. ################################################################################
  1643. class PokeBattle_Move_03D < PokeBattle_Move
  1644. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1645. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1646. if opponent.damagestate.calcdamage>0
  1647. showanim=true
  1648. if attacker.pbCanReduceStatStage?(PBStats::SPEED,false,true)
  1649. attacker.pbReduceStat(PBStats::SPEED,1,false,showanim,true)
  1650. showanim=false
  1651. end
  1652. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,false,true)
  1653. attacker.pbReduceStat(PBStats::DEFENSE,1,false,showanim,true)
  1654. showanim=false
  1655. end
  1656. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,false,true)
  1657. attacker.pbReduceStat(PBStats::SPDEF,1,false,showanim,true)
  1658. showanim=false
  1659. end
  1660. end
  1661. return ret
  1662. end
  1663. end
  1664.  
  1665.  
  1666.  
  1667. ################################################################################
  1668. # Decreases the user's Speed by 1 stage.
  1669. ################################################################################
  1670. class PokeBattle_Move_03E < PokeBattle_Move
  1671. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1672. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1673. if opponent.damagestate.calcdamage>0
  1674. if attacker.pbCanReduceStatStage?(PBStats::SPEED,false,true)
  1675. attacker.pbReduceStat(PBStats::SPEED,1,false,true,true)
  1676. end
  1677. end
  1678. return ret
  1679. end
  1680. end
  1681.  
  1682.  
  1683.  
  1684. ################################################################################
  1685. # Decreases the user's Special Attack by 2 stages.
  1686. ################################################################################
  1687. class PokeBattle_Move_03F < PokeBattle_Move
  1688. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1689. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1690. if opponent.damagestate.calcdamage>0
  1691. if attacker.pbCanReduceStatStage?(PBStats::SPATK,false,true)
  1692. attacker.pbReduceStat(PBStats::SPATK,2,false,true,true)
  1693. end
  1694. end
  1695. return ret
  1696. end
  1697. end
  1698.  
  1699.  
  1700.  
  1701. ################################################################################
  1702. # Increases the target's Special Attack by 1 stage. Confuses the target.
  1703. ################################################################################
  1704. class PokeBattle_Move_040 < PokeBattle_Move
  1705. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1706. if opponent.effects[PBEffects::Substitute]>0
  1707. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1708. return -1
  1709. end
  1710. ret=-1
  1711. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1712. if opponent.pbCanIncreaseStatStage?(PBStats::SPATK)
  1713. opponent.pbIncreaseStat(PBStats::SPATK,1,false)
  1714. ret=0
  1715. end
  1716. if opponent.pbCanConfuse?(true)
  1717. opponent.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  1718. @battle.pbCommonAnimation("Confusion",opponent,nil)
  1719. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1720. ret=0
  1721. end
  1722. return ret
  1723. end
  1724. end
  1725.  
  1726.  
  1727.  
  1728. ################################################################################
  1729. # Increases the target's Attack by 2 stages. Confuses the target.
  1730. ################################################################################
  1731. class PokeBattle_Move_041 < PokeBattle_Move
  1732. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1733. if opponent.effects[PBEffects::Substitute]>0
  1734. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1735. return -1
  1736. end
  1737. ret=-1
  1738. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1739. if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK)
  1740. opponent.pbIncreaseStat(PBStats::ATTACK,2,false)
  1741. ret=0
  1742. end
  1743. if opponent.pbCanConfuse?(true)
  1744. opponent.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  1745. @battle.pbCommonAnimation("Confusion",opponent,nil)
  1746. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1747. ret=0
  1748. end
  1749. return ret
  1750. end
  1751. end
  1752.  
  1753.  
  1754.  
  1755. ################################################################################
  1756. # Decreases the target's Attack by 1 stage.
  1757. ################################################################################
  1758. class PokeBattle_Move_042 < PokeBattle_Move
  1759. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1760. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1761. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true)
  1762. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1763. ret=opponent.pbReduceStat(PBStats::ATTACK,1,false)
  1764. return ret ? 0 : -1
  1765. end
  1766.  
  1767. def pbAdditionalEffect(attacker,opponent)
  1768. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,false)
  1769. opponent.pbReduceStat(PBStats::ATTACK,1,false)
  1770. end
  1771. return true
  1772. end
  1773. end
  1774.  
  1775.  
  1776.  
  1777. ################################################################################
  1778. # Decreases the target's Defense by 1 stage.
  1779. ################################################################################
  1780. class PokeBattle_Move_043 < PokeBattle_Move
  1781. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1782. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1783. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,true)
  1784. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1785. ret=opponent.pbReduceStat(PBStats::DEFENSE,1,false)
  1786. return ret ? 0 : -1
  1787. end
  1788.  
  1789. def pbAdditionalEffect(attacker,opponent)
  1790. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,false)
  1791. opponent.pbReduceStat(PBStats::DEFENSE,1,false)
  1792. end
  1793. return true
  1794. end
  1795. end
  1796.  
  1797.  
  1798.  
  1799. ################################################################################
  1800. # Decreases the target's Speed by 1 stage.
  1801. ################################################################################
  1802. class PokeBattle_Move_044 < PokeBattle_Move
  1803. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1804. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1805. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,true)
  1806. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1807. ret=opponent.pbReduceStat(PBStats::SPEED,1,false)
  1808. return ret ? 0 : -1
  1809. end
  1810.  
  1811. def pbAdditionalEffect(attacker,opponent)
  1812. if opponent.pbCanReduceStatStage?(PBStats::SPEED,false)
  1813. opponent.pbReduceStat(PBStats::SPEED,1,false)
  1814. end
  1815. return true
  1816. end
  1817. end
  1818.  
  1819.  
  1820.  
  1821. ################################################################################
  1822. # Decreases the target's Special Attack by 1 stage.
  1823. ################################################################################
  1824. class PokeBattle_Move_045 < PokeBattle_Move
  1825. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1826. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1827. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,true)
  1828. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1829. ret=opponent.pbReduceStat(PBStats::SPATK,1,false)
  1830. return ret ? 0 : -1
  1831. end
  1832.  
  1833. def pbAdditionalEffect(attacker,opponent)
  1834. if opponent.pbCanReduceStatStage?(PBStats::SPATK,false)
  1835. opponent.pbReduceStat(PBStats::SPATK,1,false)
  1836. end
  1837. return true
  1838. end
  1839. end
  1840.  
  1841.  
  1842.  
  1843. ################################################################################
  1844. # Decreases the target's Special Defense by 1 stage.
  1845. ################################################################################
  1846. class PokeBattle_Move_046 < PokeBattle_Move
  1847. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1848. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1849. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,true)
  1850. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1851. ret=opponent.pbReduceStat(PBStats::SPDEF,1,false)
  1852. return ret ? 0 : -1
  1853. end
  1854.  
  1855. def pbAdditionalEffect(attacker,opponent)
  1856. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,false)
  1857. opponent.pbReduceStat(PBStats::SPDEF,1,false)
  1858. end
  1859. return true
  1860. end
  1861. end
  1862.  
  1863.  
  1864.  
  1865. ################################################################################
  1866. # Decreases the target's accuracy by 1 stage.
  1867. ################################################################################
  1868. class PokeBattle_Move_047 < PokeBattle_Move
  1869. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1870. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1871. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,true)
  1872. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1873. ret=opponent.pbReduceStat(PBStats::ACCURACY,1,false)
  1874. return ret ? 0 : -1
  1875. end
  1876.  
  1877. def pbAdditionalEffect(attacker,opponent)
  1878. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,false)
  1879. opponent.pbReduceStat(PBStats::ACCURACY,1,false)
  1880. end
  1881. return true
  1882. end
  1883. end
  1884.  
  1885.  
  1886.  
  1887. ################################################################################
  1888. # Decreases the target's evasion by 1 stage.
  1889. ################################################################################
  1890. class PokeBattle_Move_048 < PokeBattle_Move
  1891. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1892. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1893. return -1 if !opponent.pbCanReduceStatStage?(PBStats::EVASION,true)
  1894. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1895. ret=opponent.pbReduceStat(PBStats::EVASION,1,false)
  1896. return ret ? 0 : -1
  1897. end
  1898.  
  1899. def pbAdditionalEffect(attacker,opponent)
  1900. if opponent.pbCanReduceStatStage?(PBStats::EVASION,false)
  1901. opponent.pbReduceStat(PBStats::EVASION,1,false)
  1902. end
  1903. return true
  1904. end
  1905. end
  1906.  
  1907.  
  1908.  
  1909. ################################################################################
  1910. # Decreases the target's evasion by 1 stage. Ends all barriers and entry
  1911. # hazards for the target's side.
  1912. ################################################################################
  1913. class PokeBattle_Move_049 < PokeBattle_Move
  1914. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1915. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1916. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1917. ret=opponent.pbReduceStat(PBStats::EVASION,1,false)
  1918. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1919. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1920. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1921. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1922. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1923. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1924. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1925. return 0
  1926. end
  1927.  
  1928. def pbAdditionalEffect(attacker,opponent)
  1929. if opponent.pbCanReduceStatStage?(PBStats::EVASION,false)
  1930. opponent.pbReduceStat(PBStats::EVASION,1,false)
  1931. end
  1932. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1933. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1934. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1935. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1936. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1937. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1938. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1939. return true
  1940. end
  1941. end
  1942.  
  1943.  
  1944.  
  1945. ################################################################################
  1946. # Decreases the target's Attack and Defense by 1 stage each.
  1947. ################################################################################
  1948. class PokeBattle_Move_04A < PokeBattle_Move
  1949. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1950. if opponent.effects[PBEffects::Substitute]>0
  1951. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1952. return -1
  1953. end
  1954. if opponent.pbTooLow?(PBStats::ATTACK) &&
  1955. opponent.pbTooLow?(PBStats::DEFENSE)
  1956. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  1957. return -1
  1958. end
  1959. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  1960. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  1961. return -1
  1962. end
  1963. if opponent.hasWorkingAbility(:CLEARBODY) ||
  1964. opponent.hasWorkingAbility(:WHITESMOKE)
  1965. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  1966. PBAbilities.getName(opponent.ability)))
  1967. return -1
  1968. end
  1969. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1970. ret=-1; showanim=true
  1971. if opponent.pbReduceStat(PBStats::ATTACK,1,false,showanim)
  1972. ret=0; showanim=false
  1973. end
  1974. if opponent.pbReduceStat(PBStats::DEFENSE,1,false,showanim)
  1975. ret=0; showanim=false
  1976. end
  1977. return ret
  1978. end
  1979. end
  1980.  
  1981.  
  1982.  
  1983. ################################################################################
  1984. # Decreases the target's Attack by 2 stages.
  1985. ################################################################################
  1986. class PokeBattle_Move_04B < PokeBattle_Move
  1987. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1988. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  1989. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true)
  1990. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1991. ret=opponent.pbReduceStat(PBStats::ATTACK,2,false)
  1992. return ret ? 0 : -1
  1993. end
  1994.  
  1995. def pbAdditionalEffect(attacker,opponent)
  1996. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,false)
  1997. opponent.pbReduceStat(PBStats::ATTACK,2,false)
  1998. end
  1999. return true
  2000. end
  2001. end
  2002.  
  2003.  
  2004.  
  2005. ################################################################################
  2006. # Decreases the target's Defense by 2 stages.
  2007. ################################################################################
  2008. class PokeBattle_Move_04C < PokeBattle_Move
  2009. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2010. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  2011. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,true)
  2012. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2013. ret=opponent.pbReduceStat(PBStats::DEFENSE,2,false)
  2014. return ret ? 0 : -1
  2015. end
  2016.  
  2017. def pbAdditionalEffect(attacker,opponent)
  2018. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,false)
  2019. opponent.pbReduceStat(PBStats::DEFENSE,2,false)
  2020. end
  2021. return true
  2022. end
  2023. end
  2024.  
  2025.  
  2026.  
  2027. ################################################################################
  2028. # Decreases the target's Speed by 2 stages.
  2029. ################################################################################
  2030. class PokeBattle_Move_04D < PokeBattle_Move
  2031. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2032. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  2033. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,true)
  2034. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2035. ret=opponent.pbReduceStat(PBStats::SPEED,2,false)
  2036. return ret ? 0 : -1
  2037. end
  2038.  
  2039. def pbAdditionalEffect(attacker,opponent)
  2040. if opponent.pbCanReduceStatStage?(PBStats::SPEED,false)
  2041. opponent.pbReduceStat(PBStats::SPEED,2,false)
  2042. end
  2043. return true
  2044. end
  2045. end
  2046.  
  2047.  
  2048.  
  2049. ################################################################################
  2050. # Decreases the target's Special Attack by 2 stages. Only works on the opposite
  2051. # gender.
  2052. ################################################################################
  2053. class PokeBattle_Move_04E < PokeBattle_Move
  2054. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2055. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  2056. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,true)
  2057. if attacker.gender==2 || opponent.gender==2 ||
  2058. attacker.gender==opponent.gender
  2059. @battle.pbDisplay(_INTL("But it failed!"))
  2060. return -1
  2061. end
  2062. if opponent.hasWorkingAbility(:OBLIVIOUS)
  2063. @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",opponent.pbThis,
  2064. PBAbilities.getName(opponent.ability)))
  2065. return -1
  2066. end
  2067. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2068. ret=opponent.pbReduceStat(PBStats::SPATK,2,false)
  2069. return ret ? 0 : -1
  2070. end
  2071.  
  2072. def pbAdditionalEffect(attacker,opponent)
  2073. return false if attacker.gender==2 || opponent.gender==2 ||
  2074. attacker.gender==opponent.gender
  2075. return false if opponent.hasWorkingAbility(:OBLIVIOUS)
  2076. if opponent.pbCanReduceStatStage?(PBStats::SPATK,false)
  2077. opponent.pbReduceStat(PBStats::SPATK,2,false)
  2078. end
  2079. return true
  2080. end
  2081. end
  2082.  
  2083.  
  2084.  
  2085. ################################################################################
  2086. # Decreases the target's Special Defense by 2 stages.
  2087. ################################################################################
  2088. class PokeBattle_Move_04F < PokeBattle_Move
  2089. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2090. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  2091. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,true)
  2092. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2093. ret=opponent.pbReduceStat(PBStats::SPDEF,2,false)
  2094. return ret ? 0 : -1
  2095. end
  2096.  
  2097. def pbAdditionalEffect(attacker,opponent)
  2098. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,false)
  2099. opponent.pbReduceStat(PBStats::SPDEF,2,false)
  2100. end
  2101. return true
  2102. end
  2103. end
  2104.  
  2105.  
  2106.  
  2107. ################################################################################
  2108. # Resets all target's stat stages to 0.
  2109. ################################################################################
  2110. class PokeBattle_Move_050 < PokeBattle_Move
  2111. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2112. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  2113. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  2114. opponent.stages[PBStats::ATTACK] = 0
  2115. opponent.stages[PBStats::DEFENSE] = 0
  2116. opponent.stages[PBStats::SPEED] = 0
  2117. opponent.stages[PBStats::SPATK] = 0
  2118. opponent.stages[PBStats::SPDEF] = 0
  2119. opponent.stages[PBStats::ACCURACY] = 0
  2120. opponent.stages[PBStats::EVASION] = 0
  2121. @battle.pbDisplay(_INTL("{1}'s stat changes were removed!",opponent.pbThis))
  2122. end
  2123. return ret
  2124. end
  2125. end
  2126.  
  2127.  
  2128.  
  2129. ################################################################################
  2130. # Resets all stat stages for all battlers to 0.
  2131. ################################################################################
  2132. class PokeBattle_Move_051 < PokeBattle_Move
  2133. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2134. for i in 0...4
  2135. @battle.battlers[i].stages[PBStats::ATTACK] = 0
  2136. @battle.battlers[i].stages[PBStats::DEFENSE] = 0
  2137. @battle.battlers[i].stages[PBStats::SPEED] = 0
  2138. @battle.battlers[i].stages[PBStats::SPATK] = 0
  2139. @battle.battlers[i].stages[PBStats::SPDEF] = 0
  2140. @battle.battlers[i].stages[PBStats::ACCURACY] = 0
  2141. @battle.battlers[i].stages[PBStats::EVASION] = 0
  2142. end
  2143. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2144. @battle.pbDisplay(_INTL("All stat changes were eliminated!"))
  2145. return 0
  2146. end
  2147. end
  2148.  
  2149.  
  2150.  
  2151. ################################################################################
  2152. # User and target swap their Attack and Special Attack stat stages.
  2153. ################################################################################
  2154. class PokeBattle_Move_052 < PokeBattle_Move
  2155. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2156. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2157. astage=attacker.stages
  2158. ostage=opponent.stages
  2159. astage[PBStats::ATTACK],ostage[PBStats::ATTACK]=ostage[PBStats::ATTACK],astage[PBStats::ATTACK]
  2160. astage[PBStats::SPATK],ostage[PBStats::SPATK]=ostage[PBStats::SPATK],astage[PBStats::SPATK]
  2161. @battle.pbDisplay(_INTL("{1} switched all changes to its Attack and Sp. Atk with the target!",attacker.pbThis))
  2162. return 0
  2163. end
  2164. end
  2165.  
  2166.  
  2167.  
  2168. ################################################################################
  2169. # User and target swap their Defense and Special Defense stat stages.
  2170. ################################################################################
  2171. class PokeBattle_Move_053 < PokeBattle_Move
  2172. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2173. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2174. astage=attacker.stages
  2175. ostage=opponent.stages
  2176. astage[PBStats::DEFENSE],ostage[PBStats::DEFENSE]=ostage[PBStats::DEFENSE],astage[PBStats::DEFENSE]
  2177. astage[PBStats::SPDEF],ostage[PBStats::SPDEF]=ostage[PBStats::SPDEF],astage[PBStats::SPDEF]
  2178. @battle.pbDisplay(_INTL("{1} switched all changes to its Defense and Sp. Def with the target!",attacker.pbThis))
  2179. return 0
  2180. end
  2181. end
  2182.  
  2183.  
  2184.  
  2185. ################################################################################
  2186. # User and target swap all their stat stages.
  2187. ################################################################################
  2188. class PokeBattle_Move_054 < PokeBattle_Move
  2189. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2190. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2191. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2192. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2193. attacker.stages[i],opponent.stages[i]=opponent.stages[i],attacker.stages[i]
  2194. end
  2195. @battle.pbDisplay(_INTL("{1} switched stat changes with the target!",attacker.pbThis))
  2196. return 0
  2197. end
  2198. end
  2199.  
  2200.  
  2201.  
  2202. ################################################################################
  2203. # User copies the target's stat stages.
  2204. ################################################################################
  2205. class PokeBattle_Move_055 < PokeBattle_Move
  2206. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2207. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2208. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2209. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2210. attacker.stages[i]=opponent.stages[i]
  2211. end
  2212. @battle.pbDisplay(_INTL("{1} copied {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  2213. return 0
  2214. end
  2215. end
  2216.  
  2217.  
  2218.  
  2219. ################################################################################
  2220. # For 5 rounds, user's and ally's stat stages cannot be lowered by foes.
  2221. ################################################################################
  2222. class PokeBattle_Move_056 < PokeBattle_Move
  2223. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2224. if attacker.pbOwnSide.effects[PBEffects::Mist]>0
  2225. @battle.pbDisplay(_INTL("But it failed!"))
  2226. return -1
  2227. end
  2228. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2229. attacker.pbOwnSide.effects[PBEffects::Mist]=5
  2230. if !@battle.pbIsOpposing?(attacker.index)
  2231. @battle.pbDisplay(_INTL("Your team became shrouded in mist!"))
  2232. else
  2233. @battle.pbDisplay(_INTL("The foe's team became shrouded in mist!"))
  2234. end
  2235. return 0
  2236. end
  2237. end
  2238.  
  2239.  
  2240.  
  2241. ################################################################################
  2242. # Swaps the user's Attack and Defense.
  2243. ################################################################################
  2244. class PokeBattle_Move_057 < PokeBattle_Move
  2245. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2246. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2247. attacker.attack,attacker.defense=attacker.defense,attacker.attack
  2248. attacker.effects[PBEffects::PowerTrick]=!attacker.effects[PBEffects::PowerTrick]
  2249. @battle.pbDisplay(_INTL("{1} switched its Attack and Defense!",attacker.pbThis))
  2250. return 0
  2251. end
  2252. end
  2253.  
  2254.  
  2255.  
  2256. ################################################################################
  2257. # Averages the user's and target's Attack and Special Attack (separately).
  2258. ################################################################################
  2259. class PokeBattle_Move_058 < PokeBattle_Move
  2260. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2261. if opponent.effects[PBEffects::Substitute]>0
  2262. @battle.pbDisplay(_INTL("But it failed!"))
  2263. return -1
  2264. end
  2265. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2266. avatk=((attacker.attack+opponent.attack)/2).floor
  2267. avspatk=((attacker.spatk+opponent.spatk)/2).floor
  2268. attacker.attack=avatk
  2269. opponent.attack=avatk
  2270. attacker.spatk=avspatk
  2271. opponent.spatk=avspatk
  2272. @battle.pbDisplay(_INTL("{1} shared its power with the target!",attacker.pbThis))
  2273. return 0
  2274. end
  2275. end
  2276.  
  2277.  
  2278.  
  2279. ################################################################################
  2280. # Averages the user's and target's Defense and Special Defense (separately).
  2281. ################################################################################
  2282. class PokeBattle_Move_059 < PokeBattle_Move
  2283. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2284. if opponent.effects[PBEffects::Substitute]>0
  2285. @battle.pbDisplay(_INTL("But it failed!"))
  2286. return -1
  2287. end
  2288. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2289. avdef=((attacker.defense+opponent.defense)/2).floor
  2290. avspdef=((attacker.spdef+opponent.spdef)/2).floor
  2291. attacker.defense=avdef
  2292. opponent.defense=avdef
  2293. attacker.spdef=avspdef
  2294. opponent.spdef=avspdef
  2295. @battle.pbDisplay(_INTL("{1} shared its guard with the target!",attacker.pbThis))
  2296. return 0
  2297. end
  2298. end
  2299.  
  2300.  
  2301.  
  2302. ################################################################################
  2303. # Averages the user's and target's current HP.
  2304. ################################################################################
  2305. class PokeBattle_Move_05A < PokeBattle_Move
  2306. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2307. if opponent.effects[PBEffects::Substitute]>0
  2308. @battle.pbDisplay(_INTL("But it failed!"))
  2309. return -1
  2310. end
  2311. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2312. olda=attacker.hp
  2313. oldo=opponent.hp
  2314. avhp=((attacker.hp+opponent.hp)/2).floor
  2315. attacker.hp=[avhp,attacker.totalhp].min
  2316. opponent.hp=[avhp,opponent.totalhp].min
  2317. @battle.scene.pbHPChanged(attacker,olda)
  2318. @battle.scene.pbHPChanged(opponent,oldo)
  2319. @battle.pbDisplay(_INTL("The battlers shared their pain!"))
  2320. return 0
  2321. end
  2322. end
  2323.  
  2324.  
  2325.  
  2326. ################################################################################
  2327. # For 4 more rounds, doubles the Speed of all battlers on the user's side.
  2328. ################################################################################
  2329. class PokeBattle_Move_05B < PokeBattle_Move
  2330. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2331. if attacker.pbOwnSide.effects[PBEffects::Tailwind]>0
  2332. @battle.pbDisplay(_INTL("But it failed!"))
  2333. return -1
  2334. end
  2335. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2336. attacker.pbOwnSide.effects[PBEffects::Tailwind]=4
  2337. if !@battle.pbIsOpposing?(attacker.index)
  2338. @battle.pbDisplay(_INTL("The tailwind blew from behind your team!"))
  2339. else
  2340. @battle.pbDisplay(_INTL("The tailwind blew from behind the opposing team!"))
  2341. end
  2342. return 0
  2343. end
  2344. end
  2345.  
  2346.  
  2347.  
  2348. ################################################################################
  2349. # This move turns into the last move used by the target, until user switches out.
  2350. ################################################################################
  2351. class PokeBattle_Move_05C < PokeBattle_Move
  2352. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2353. blacklist=[
  2354. 0x02, # Struggle
  2355. 0x14, # Chatter
  2356. 0x5C, # Mimic
  2357. 0x5D, # Sketch
  2358. 0xB6 # Metronome
  2359. ]
  2360. if attacker.effects[PBEffects::Transform] ||
  2361. opponent.lastMoveUsed<=0 ||
  2362. isConst?(PBMoveData.new(opponent.lastMoveUsed).type,PBTypes,:SHADOW) ||
  2363. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  2364. @battle.pbDisplay(_INTL("But it failed!"))
  2365. return -1
  2366. end
  2367. for i in attacker.moves
  2368. if i.id==opponent.lastMoveUsed
  2369. @battle.pbDisplay(_INTL("But it failed!"))
  2370. return -1
  2371. end
  2372. end
  2373. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2374. for i in 0...attacker.moves.length
  2375. if attacker.moves[i].id==@id
  2376. newmove=PBMove.new(opponent.lastMoveUsed)
  2377. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2378. movename=PBMoves.getName(opponent.lastMoveUsed)
  2379. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  2380. return 0
  2381. end
  2382. end
  2383. @battle.pbDisplay(_INTL("But it failed!"))
  2384. return -1
  2385. end
  2386. end
  2387.  
  2388.  
  2389.  
  2390. ################################################################################
  2391. # This move permanently turns into the last move used by the target.
  2392. ################################################################################
  2393. class PokeBattle_Move_05D < PokeBattle_Move
  2394. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2395. blacklist=[
  2396. 0x02, # Struggle
  2397. 0x14, # Chatter
  2398. 0x5D # Sketch
  2399. ]
  2400. if attacker.effects[PBEffects::Transform] ||
  2401. opponent.lastMoveUsedSketch<=0 ||
  2402. isConst?(PBMoveData.new(opponent.lastMoveUsedSketch).type,PBTypes,:SHADOW) ||
  2403. blacklist.include?(PBMoveData.new(opponent.lastMoveUsedSketch).function)
  2404. @battle.pbDisplay(_INTL("But it failed!"))
  2405. return -1
  2406. end
  2407. for i in attacker.moves
  2408. if i.id==opponent.lastMoveUsedSketch
  2409. @battle.pbDisplay(_INTL("But it failed!"))
  2410. return -1
  2411. end
  2412. end
  2413. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2414. for i in 0...attacker.moves.length
  2415. if attacker.moves[i].id==@id
  2416. newmove=PBMove.new(opponent.lastMoveUsedSketch)
  2417. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  2418. party=@battle.pbParty(attacker.index)
  2419. party[attacker.pokemonIndex].moves[i]=newmove
  2420. movename=PBMoves.getName(opponent.lastMoveUsedSketch)
  2421. @battle.pbDisplay(_INTL("{1} sketched {2}!",attacker.pbThis,movename))
  2422. return 0
  2423. end
  2424. end
  2425. @battle.pbDisplay(_INTL("But it failed!"))
  2426. return -1
  2427. end
  2428. end
  2429.  
  2430.  
  2431.  
  2432. ################################################################################
  2433. # Changes user's type to that of a random move of the user, ignoring this one.
  2434. ################################################################################
  2435. class PokeBattle_Move_05E < PokeBattle_Move
  2436. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2437. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2438. @battle.pbDisplay(_INTL("But it failed!"))
  2439. return -1
  2440. end
  2441. types=[]
  2442. for i in attacker.moves
  2443. next if i.id==@id
  2444. next if PBTypes.isPseudoType?(i.type)
  2445. next if attacker.pbHasType?(i.type)
  2446. found=false
  2447. types.push(i.type) if !types.include?(i.type)
  2448. end
  2449. if types.length==0
  2450. @battle.pbDisplay(_INTL("But it failed!"))
  2451. return -1
  2452. end
  2453. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2454. newtype=types[@battle.pbRandom(types.length)]
  2455. attacker.type1=newtype
  2456. attacker.type2=newtype
  2457. typename=PBTypes.getName(newtype)
  2458. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2459. end
  2460. end
  2461.  
  2462.  
  2463.  
  2464. ################################################################################
  2465. # Changes user's type to a random one that resists the last attack used by target.
  2466. ################################################################################
  2467. class PokeBattle_Move_05F < PokeBattle_Move
  2468. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2469. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2470. @battle.pbDisplay(_INTL("But it failed!"))
  2471. return -1
  2472. end
  2473. if opponent.lastMoveUsed<=0 ||
  2474. PBTypes.isPseudoType?(PBMoveData.new(opponent.lastMoveUsed).type)
  2475. @battle.pbDisplay(_INTL("But it failed!"))
  2476. return -1
  2477. end
  2478. types=[]
  2479. atype=-1
  2480. for i in opponent.moves
  2481. if i.id==opponent.lastMoveUsed
  2482. atype=i.pbType
  2483. break
  2484. end
  2485. end
  2486. if atype<0
  2487. @battle.pbDisplay(_INTL("But it failed!"))
  2488. return -1
  2489. end
  2490. for i in 0..PBTypes.maxValue
  2491. next if attacker.pbHasType?(i)
  2492. types.push(i) if PBTypes.getEffectiveness(atype,i)<2
  2493. end
  2494. if types.length==0
  2495. @battle.pbDisplay(_INTL("But it failed!"))
  2496. return -1
  2497. end
  2498. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2499. newtype=types[@battle.pbRandom(types.length)]
  2500. attacker.type1=newtype
  2501. attacker.type2=newtype
  2502. typename=PBTypes.getName(newtype)
  2503. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2504. return 0
  2505. end
  2506. end
  2507.  
  2508.  
  2509.  
  2510. ################################################################################
  2511. # Changes user's type depending on the environment.
  2512. ################################################################################
  2513. class PokeBattle_Move_060 < PokeBattle_Move
  2514. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2515. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2516. @battle.pbDisplay(_INTL("But it failed!"))
  2517. return -1
  2518. end
  2519. envtypes=[
  2520. :NORMAL, # None
  2521. :GRASS, # Grass
  2522. :GRASS, # Tall grass
  2523. :WATER, # Moving water
  2524. :WATER, # Still water
  2525. :WATER, # Underwater
  2526. :ROCK, # Rock
  2527. :ROCK, # Cave
  2528. :GROUND # Sand
  2529. ]
  2530. type=envtypes[@battle.environment]
  2531. if attacker.pbHasType?(type)
  2532. @battle.pbDisplay(_INTL("But it failed!"))
  2533. return -1
  2534. end
  2535. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  2536. newtype=getConst(PBTypes,type) || 0
  2537. attacker.type1=newtype
  2538. attacker.type2=newtype
  2539. typename=PBTypes.getName(newtype)
  2540. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  2541. return 0
  2542. end
  2543. end
  2544.  
  2545.  
  2546.  
  2547. ################################################################################
  2548. # Target becomes Water type.
  2549. ################################################################################
  2550. class PokeBattle_Move_061 < PokeBattle_Move
  2551. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2552. if opponent.effects[PBEffects::Substitute]>0
  2553. @battle.pbDisplay(_INTL("But it failed!"))
  2554. return -1
  2555. end
  2556. if isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  2557. @battle.pbDisplay(_INTL("But it failed!"))
  2558. return -1
  2559. end
  2560. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2561. opponent.type1=getConst(PBTypes,:WATER)
  2562. opponent.type2=getConst(PBTypes,:WATER)
  2563. typename=PBTypes.getName(getConst(PBTypes,:WATER))
  2564. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  2565. return 0
  2566. end
  2567. end
  2568.  
  2569.  
  2570.  
  2571. ################################################################################
  2572. # User copes target's types.
  2573. ################################################################################
  2574. class PokeBattle_Move_062 < PokeBattle_Move
  2575. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2576. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  2577. @battle.pbDisplay(_INTL("But it failed!"))
  2578. return -1
  2579. end
  2580. if attacker.pbHasType?(opponent.type1) &&
  2581. attacker.pbHasType?(opponent.type2) &&
  2582. opponent.pbHasType?(attacker.type1) &&
  2583. opponent.pbHasType?(attacker.type2)
  2584. @battle.pbDisplay(_INTL("But it failed!"))
  2585. return -1
  2586. end
  2587. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2588. attacker.type1=opponent.type1
  2589. attacker.type2=opponent.type2
  2590. @battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",attacker.pbThis,opponent.pbThis(true)))
  2591. return 0
  2592. end
  2593. end
  2594.  
  2595.  
  2596.  
  2597. ################################################################################
  2598. # Target's ability becomes Simple.
  2599. ################################################################################
  2600. class PokeBattle_Move_063 < PokeBattle_Move
  2601. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2602. if opponent.effects[PBEffects::Substitute]>0
  2603. @battle.pbDisplay(_INTL("But it failed!"))
  2604. return -1
  2605. end
  2606. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2607. isConst?(opponent.ability,PBAbilities,:SIMPLE) ||
  2608. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2609. @battle.pbDisplay(_INTL("But it failed!"))
  2610. return -1
  2611. end
  2612. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2613. opponent.ability=getConst(PBAbilities,:SIMPLE) || 0
  2614. abilityname=PBAbilities.getName(getConst(PBAbilities,:SIMPLE))
  2615. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2616. return 0
  2617. end
  2618. end
  2619.  
  2620.  
  2621.  
  2622. ################################################################################
  2623. # Target's ability becomes Insomnia.
  2624. ################################################################################
  2625. class PokeBattle_Move_064 < PokeBattle_Move
  2626. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2627. if opponent.effects[PBEffects::Substitute]>0
  2628. @battle.pbDisplay(_INTL("But it failed!"))
  2629. return -1
  2630. end
  2631. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2632. isConst?(opponent.ability,PBAbilities,:INSOMNIA) ||
  2633. isConst?(opponent.ability,PBAbilities,:TRUANT)
  2634. @battle.pbDisplay(_INTL("But it failed!"))
  2635. return -1
  2636. end
  2637. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2638. opponent.ability=getConst(PBAbilities,:INSOMNIA) || 0
  2639. abilityname=PBAbilities.getName(getConst(PBAbilities,:INSOMNIA))
  2640. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2641. return 0
  2642. end
  2643. end
  2644.  
  2645.  
  2646.  
  2647. ################################################################################
  2648. # User copes target's ability.
  2649. ################################################################################
  2650. class PokeBattle_Move_065 < PokeBattle_Move
  2651. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2652. if opponent.ability==0 ||
  2653. attacker.ability==opponent.ability ||
  2654. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2655. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2656. isConst?(opponent.ability,PBAbilities,:FORECAST) ||
  2657. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2658. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2659. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2660. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2661. isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2662. isConst?(opponent.ability,PBAbilities,:ZENMODE)
  2663. @battle.pbDisplay(_INTL("But it failed!"))
  2664. return -1
  2665. end
  2666. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2667. attacker.ability=opponent.ability
  2668. abilityname=PBAbilities.getName(opponent.ability)
  2669. @battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),abilityname))
  2670. return 0
  2671. end
  2672. end
  2673.  
  2674.  
  2675.  
  2676. ################################################################################
  2677. # Target copies user's ability.
  2678. ################################################################################
  2679. class PokeBattle_Move_066 < PokeBattle_Move
  2680. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2681. if opponent.effects[PBEffects::Substitute]>0
  2682. @battle.pbDisplay(_INTL("But it failed!"))
  2683. return -1
  2684. end
  2685. if attacker.ability==0 ||
  2686. attacker.ability==opponent.ability ||
  2687. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2688. isConst?(opponent.ability,PBAbilities,:TRUANT) ||
  2689. isConst?(attacker.ability,PBAbilities,:FLOWERGIFT) ||
  2690. isConst?(attacker.ability,PBAbilities,:FORECAST) ||
  2691. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2692. isConst?(attacker.ability,PBAbilities,:IMPOSTER) ||
  2693. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2694. isConst?(attacker.ability,PBAbilities,:TRACE) ||
  2695. isConst?(attacker.ability,PBAbilities,:ZENMODE)
  2696. @battle.pbDisplay(_INTL("But it failed!"))
  2697. return -1
  2698. end
  2699. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2700. opponent.ability=attacker.ability
  2701. abilityname=PBAbilities.getName(attacker.ability)
  2702. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  2703. return 0
  2704. end
  2705. end
  2706.  
  2707.  
  2708.  
  2709. ################################################################################
  2710. # User and target swap abilities.
  2711. ################################################################################
  2712. class PokeBattle_Move_067 < PokeBattle_Move
  2713. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2714. if (attacker.ability==0 && opponent.ability==0) ||
  2715. attacker.ability==opponent.ability ||
  2716. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2717. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2718. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2719. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2720. isConst?(attacker.ability,PBAbilities,:WONDERGUARD) ||
  2721. isConst?(opponent.ability,PBAbilities,:WONDERGUARD)
  2722. @battle.pbDisplay(_INTL("But it failed!"))
  2723. return -1
  2724. end
  2725. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2726. tmp=attacker.ability
  2727. attacker.ability=opponent.ability
  2728. opponent.ability=tmp
  2729. @battle.pbDisplay(_INTL("{1} swapped its {2} ability with its target's {3} ability!",
  2730. attacker.pbThis,PBAbilities.getName(opponent.ability),
  2731. PBAbilities.getName(attacker.ability)))
  2732. attacker.pbAbilitiesOnSwitchIn(true)
  2733. opponent.pbAbilitiesOnSwitchIn(true)
  2734. return 0
  2735. end
  2736. end
  2737.  
  2738.  
  2739.  
  2740. ################################################################################
  2741. # Target's ability is negated.
  2742. ################################################################################
  2743. class PokeBattle_Move_068 < PokeBattle_Move
  2744. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2745. if opponent.effects[PBEffects::Substitute]>0
  2746. @battle.pbDisplay(_INTL("But it failed!"))
  2747. return -1
  2748. end
  2749. if isConst?(opponent.ability,PBAbilities,:MULTITYPE)
  2750. @battle.pbDisplay(_INTL("But it failed!"))
  2751. return -1
  2752. end
  2753. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2754. opponent.effects[PBEffects::GastroAcid]=true
  2755. opponent.effects[PBEffects::Truant]=false
  2756. @battle.pbDisplay(_INTL("{1}'s ability was suppressed!",opponent.pbThis))
  2757. return 0
  2758. end
  2759. end
  2760.  
  2761.  
  2762.  
  2763. ################################################################################
  2764. # User transforms into the target.
  2765. ################################################################################
  2766. class PokeBattle_Move_069 < PokeBattle_Move
  2767. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2768. blacklist=[
  2769. 0xC9, # Fly
  2770. 0xCA, # Dig
  2771. 0xCB, # Dive
  2772. 0xCC, # Bounce
  2773. 0xCD, # Shadow Force
  2774. 0xCE # Sky Drop
  2775. ]
  2776. if attacker.effects[PBEffects::Transform] ||
  2777. opponent.effects[PBEffects::Transform] ||
  2778. opponent.effects[PBEffects::Substitute]>0 ||
  2779. blacklist.include?(PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function)
  2780. @battle.pbDisplay(_INTL("But it failed!"))
  2781. return -1
  2782. end
  2783. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2784. attacker.effects[PBEffects::Transform]=true
  2785. attacker.species=opponent.species
  2786. attacker.type1=opponent.type1
  2787. attacker.type2=opponent.type2
  2788. # attacker.ability=opponent.ability
  2789. attacker.attack=opponent.attack
  2790. attacker.defense=opponent.defense
  2791. attacker.speed=opponent.speed
  2792. attacker.spatk=opponent.spatk
  2793. attacker.spdef=opponent.spdef
  2794. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2795. PBStats::SPATK,PBStats::SPDEF,PBStats::EVASION,PBStats::ACCURACY]
  2796. attacker.stages[i]=opponent.stages[i]
  2797. end
  2798. for i in 0...4
  2799. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(
  2800. @battle,PBMove.new(opponent.moves[i].id))
  2801. attacker.moves[i].pp=5
  2802. attacker.moves[i].totalpp=5
  2803. end
  2804. attacker.effects[PBEffects::Disable]=0
  2805. attacker.effects[PBEffects::DisableMove]=0
  2806. @battle.pbDisplay(_INTL("{1} transformed into {2}!",attacker.pbThis,opponent.pbThis(true)))
  2807. return 0
  2808. end
  2809. end
  2810.  
  2811.  
  2812.  
  2813. ################################################################################
  2814. # Inflicts a fixed 20HP damage.
  2815. ################################################################################
  2816. class PokeBattle_Move_06A < PokeBattle_Move
  2817. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2818. return pbEffectFixedDamage(20,attacker,opponent,hitnum,alltargets,showanimation)
  2819. end
  2820. end
  2821.  
  2822.  
  2823.  
  2824. ################################################################################
  2825. # Inflicts a fixed 40HP damage.
  2826. ################################################################################
  2827. class PokeBattle_Move_06B < PokeBattle_Move
  2828. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2829. return pbEffectFixedDamage(40,attacker,opponent,hitnum,alltargets,showanimation)
  2830. end
  2831. end
  2832.  
  2833.  
  2834.  
  2835. ################################################################################
  2836. # Halves the target's current HP.
  2837. ################################################################################
  2838. class PokeBattle_Move_06C < PokeBattle_Move
  2839. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2840. return pbEffectFixedDamage((opponent.hp/2).floor,attacker,opponent,hitnum,alltargets,showanimation)
  2841. end
  2842. end
  2843.  
  2844.  
  2845.  
  2846. ################################################################################
  2847. # Inflicts damage equal to the user's level.
  2848. ################################################################################
  2849. class PokeBattle_Move_06D < PokeBattle_Move
  2850. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2851. return pbEffectFixedDamage(attacker.level,attacker,opponent,hitnum,alltargets,showanimation)
  2852. end
  2853. end
  2854.  
  2855.  
  2856.  
  2857. ################################################################################
  2858. # Inflicts damage to bring the target's HP down to equal the user's HP.
  2859. ################################################################################
  2860. class PokeBattle_Move_06E < PokeBattle_Move
  2861. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2862. if attacker.hp>=opponent.hp
  2863. @battle.pbDisplay(_INTL("But it failed!"))
  2864. return -1
  2865. end
  2866. return pbEffectFixedDamage(opponent.hp-attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  2867. end
  2868. end
  2869.  
  2870.  
  2871.  
  2872. ################################################################################
  2873. # Inflicts damage between 0.5 and 1.5 times the user's level.
  2874. ################################################################################
  2875. class PokeBattle_Move_06F < PokeBattle_Move
  2876. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2877. dmg=(attacker.level*(@battle.pbRandom(101)+50)/100).floor
  2878. return pbEffectFixedDamage(dmg,attacker,opponent,hitnum,alltargets,showanimation)
  2879. end
  2880. end
  2881.  
  2882.  
  2883.  
  2884. ################################################################################
  2885. # OHKO. Accuracy increases by difference between levels of user and target.
  2886. ################################################################################
  2887. class PokeBattle_Move_070 < PokeBattle_Move
  2888. def pbAccuracyCheck(attacker,opponent)
  2889. if opponent.hasWorkingAbility(:STURDY)
  2890. @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  2891. return false
  2892. end
  2893. if opponent.level>attacker.level
  2894. @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
  2895. return false
  2896. end
  2897. acc=@accuracy+attacker.level-opponent.level
  2898. return @battle.pbRandom(100)<acc
  2899. end
  2900.  
  2901. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2902. damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
  2903. if opponent.isFainted?
  2904. @battle.pbDisplay(_INTL("It's a one-hit KO!"))
  2905. end
  2906. return damage
  2907. end
  2908. end
  2909.  
  2910.  
  2911. ################################################################################
  2912. # Counters a physical move used against the user this round, with 2x the power.
  2913. ################################################################################
  2914. class PokeBattle_Move_071 < PokeBattle_Move
  2915. def pbAddTarget(targets,attacker)
  2916. if attacker.effects[PBEffects::CounterTarget]>=0 &&
  2917. attacker.pbIsOpposing?(attacker.effects[PBEffects::CounterTarget])
  2918. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::CounterTarget]])
  2919. attacker.pbRandomTarget(targets)
  2920. end
  2921. end
  2922. end
  2923.  
  2924. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2925. if attacker.effects[PBEffects::Counter]<=0 || !opponent
  2926. @battle.pbDisplay(_INTL("But it failed!"))
  2927. return -1
  2928. end
  2929. ret=pbEffectFixedDamage(attacker.effects[PBEffects::Counter]*2,attacker,opponent,hitnum,alltargets,showanimation)
  2930. return ret
  2931. end
  2932. end
  2933.  
  2934.  
  2935.  
  2936. ################################################################################
  2937. # Counters a specical move used against the user this round, with 2x the power.
  2938. ################################################################################
  2939. class PokeBattle_Move_072 < PokeBattle_Move
  2940. def pbAddTarget(targets,attacker)
  2941. if attacker.effects[PBEffects::MirrorCoatTarget]>=0 &&
  2942. attacker.pbIsOpposing?(attacker.effects[PBEffects::MirrorCoatTarget])
  2943. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::MirrorCoatTarget]])
  2944. attacker.pbRandomTarget(targets)
  2945. end
  2946. end
  2947. end
  2948.  
  2949. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2950. if attacker.effects[PBEffects::MirrorCoat]<=0 || !opponent
  2951. @battle.pbDisplay(_INTL("But it failed!"))
  2952. return -1
  2953. end
  2954. ret=pbEffectFixedDamage(attacker.effects[PBEffects::MirrorCoat]*2,attacker,opponent,hitnum,alltargets,showanimation)
  2955. return ret
  2956. end
  2957. end
  2958.  
  2959.  
  2960.  
  2961. ################################################################################
  2962. # Counters the last damaging move used against the user this round, with 1.5x
  2963. # the power.
  2964. ################################################################################
  2965. class PokeBattle_Move_073 < PokeBattle_Move
  2966. def pbAddTarget(targets,attacker)
  2967. if attacker.lastAttacker>=0 && attacker.pbIsOpposing?(attacker.lastAttacker)
  2968. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.lastAttacker])
  2969. attacker.pbRandomTarget(targets)
  2970. end
  2971. end
  2972. end
  2973.  
  2974. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2975. if attacker.lastHPLost==0 || !opponent
  2976. @battle.pbDisplay(_INTL("But it failed!"))
  2977. return -1
  2978. end
  2979. ret=pbEffectFixedDamage((attacker.lastHPLost*1.5).floor,attacker,opponent,hitnum,alltargets,showanimation)
  2980. return ret
  2981. end
  2982. end
  2983.  
  2984.  
  2985.  
  2986. ################################################################################
  2987. # The target's ally loses 1/16 of its max HP.
  2988. ################################################################################
  2989. class PokeBattle_Move_074 < PokeBattle_UnimplementedMove
  2990. # Not implemented yet.
  2991. end
  2992.  
  2993.  
  2994.  
  2995. ################################################################################
  2996. # Power is doubled if the target is using Dive.
  2997. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  2998. ################################################################################
  2999. class PokeBattle_Move_075 < PokeBattle_Move
  3000. def pbModifyDamage(damagemult,attacker,opponent)
  3001. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  3002. return (damagemult*2.0).round
  3003. end
  3004. return damagemult
  3005. end
  3006. end
  3007.  
  3008.  
  3009.  
  3010. ################################################################################
  3011. # Power is doubled if the target is using Dig.
  3012. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3013. ################################################################################
  3014. class PokeBattle_Move_076 < PokeBattle_Move
  3015. def pbModifyDamage(damagemult,attacker,opponent)
  3016. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3017. return (damagemult*2.0).round
  3018. end
  3019. return damagemult
  3020. end
  3021. end
  3022.  
  3023.  
  3024.  
  3025. ################################################################################
  3026. # Power is doubled if the target is using Bounce, Fly or Sky Drop.
  3027. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3028. ################################################################################
  3029. class PokeBattle_Move_077 < PokeBattle_Move
  3030. def pbBaseDamage(basedmg,attacker,opponent)
  3031. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3032. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3033. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE # Sky Drop
  3034. return basedmg*2
  3035. end
  3036. return basedmg
  3037. end
  3038. end
  3039.  
  3040.  
  3041.  
  3042. ################################################################################
  3043. # Power is doubled if the target is using Bounce, Fly or Sky Drop.
  3044. # May make the target flinch.
  3045. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3046. ################################################################################
  3047. class PokeBattle_Move_078 < PokeBattle_Move
  3048. def pbBaseDamage(basedmg,attacker,opponent)
  3049. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  3050. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  3051. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCE # Sky Drop
  3052. return basedmg*2
  3053. end
  3054. return basedmg
  3055. end
  3056.  
  3057. def pbAdditionalEffect(attacker,opponent)
  3058. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  3059. opponent.effects[PBEffects::Substitute]==0
  3060. opponent.effects[PBEffects::Flinch]=true
  3061. return true
  3062. end
  3063. return false
  3064. end
  3065. end
  3066.  
  3067.  
  3068.  
  3069. ################################################################################
  3070. # Power is doubled if the target has already used Fusion Flare this round.
  3071. ################################################################################
  3072. class PokeBattle_Move_079 < PokeBattle_UnimplementedMove
  3073. # Not implemented yet.
  3074. # Uses pbBaseDamageMultiplier
  3075. end
  3076.  
  3077.  
  3078.  
  3079. ################################################################################
  3080. # Power is doubled if the target has already used Fusion Bolt this round.
  3081. ################################################################################
  3082. class PokeBattle_Move_07A < PokeBattle_UnimplementedMove
  3083. # Not implemented yet.
  3084. # Uses pbBaseDamageMultiplier
  3085. end
  3086.  
  3087.  
  3088.  
  3089. ################################################################################
  3090. # Power is doubled if the target is poisoned.
  3091. ################################################################################
  3092. class PokeBattle_Move_07B < PokeBattle_Move
  3093. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3094. if opponent.status==PBStatuses::POISON &&
  3095. opponent.effects[PBEffects::Substitute]==0
  3096. return (damagemult*2.0).round
  3097. end
  3098. return damagemult
  3099. end
  3100. end
  3101.  
  3102.  
  3103.  
  3104. ################################################################################
  3105. # Power is doubled if the target is paralyzed. Cures the target of paralysis.
  3106. ################################################################################
  3107. class PokeBattle_Move_07C < PokeBattle_Move
  3108. def pbBaseDamage(basedmg,attacker,opponent)
  3109. if opponent.status==PBStatuses::PARALYSIS &&
  3110. opponent.effects[PBEffects::Substitute]==0
  3111. return basedmg*2
  3112. end
  3113. return basedmg
  3114. end
  3115.  
  3116. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3117. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3118. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  3119. opponent.status==PBStatuses::PARALYSIS
  3120. opponent.status=0
  3121. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",opponent.pbThis))
  3122. end
  3123. return ret
  3124. end
  3125. end
  3126.  
  3127.  
  3128.  
  3129. ################################################################################
  3130. # Power is doubled if the target is asleep. Wakes the target up.
  3131. ################################################################################
  3132. class PokeBattle_Move_07D < PokeBattle_Move
  3133. def pbBaseDamage(basedmg,attacker,opponent)
  3134. if opponent.status==PBStatuses::SLEEP &&
  3135. opponent.effects[PBEffects::Substitute]==0
  3136. return basedmg*2
  3137. end
  3138. return basedmg
  3139. end
  3140.  
  3141. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3142. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3143. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  3144. opponent.status==PBStatuses::SLEEP
  3145. opponent.pbCureStatus
  3146. end
  3147. return ret
  3148. end
  3149. end
  3150.  
  3151.  
  3152.  
  3153. ################################################################################
  3154. # Power is doubled if the user is burned, poisoned or paralyzed.
  3155. ################################################################################
  3156. class PokeBattle_Move_07E < PokeBattle_Move
  3157. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3158. if attacker.status==PBStatuses::POISON ||
  3159. attacker.status==PBStatuses::BURN ||
  3160. attacker.status==PBStatuses::PARALYSIS
  3161. return (damagemult*2.0).round
  3162. end
  3163. return damagemult
  3164. end
  3165. end
  3166.  
  3167.  
  3168.  
  3169. ################################################################################
  3170. # Power is doubled if the target has a status problem.
  3171. ################################################################################
  3172. class PokeBattle_Move_07F < PokeBattle_Move
  3173. def pbBaseDamage(basedmg,attacker,opponent)
  3174. if opponent.status>0 &&
  3175. opponent.effects[PBEffects::Substitute]==0
  3176. return basedmg*2
  3177. end
  3178. return basedmg
  3179. end
  3180. end
  3181.  
  3182.  
  3183.  
  3184. ################################################################################
  3185. # Power is doubled if the target's HP is down to 1/2 or less.
  3186. ################################################################################
  3187. class PokeBattle_Move_080 < PokeBattle_Move
  3188. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3189. if opponent.hp<=opponent.totalhp/2
  3190. return (damagemult*2.0).round
  3191. end
  3192. return damagemult
  3193. end
  3194. end
  3195.  
  3196.  
  3197.  
  3198. ################################################################################
  3199. # Power is doubled if the user has lost HP due to the target's move this round.
  3200. ################################################################################
  3201. class PokeBattle_Move_081 < PokeBattle_Move
  3202. def pbBaseDamage(basedmg,attacker,opponent)
  3203. if attacker.lastHPLost>0 && attacker.lastAttacker==opponent.index
  3204. return basedmg*2
  3205. end
  3206. return basedmg
  3207. end
  3208. end
  3209.  
  3210.  
  3211.  
  3212. ################################################################################
  3213. # Power is doubled if the target has already lost HP this round.
  3214. ################################################################################
  3215. class PokeBattle_Move_082 < PokeBattle_Move
  3216. def pbBaseDamage(basedmg,attacker,opponent)
  3217. if opponent.lastHPLost>0
  3218. return basedmg*2
  3219. end
  3220. return basedmg
  3221. end
  3222. end
  3223.  
  3224.  
  3225.  
  3226. ################################################################################
  3227. # Power is doubled if the user's ally has already used this move this round.
  3228. # This move goes immediately after the ally, ignoring priority.
  3229. ################################################################################
  3230. class PokeBattle_Move_083 < PokeBattle_UnimplementedMove
  3231. # Not implemented yet.
  3232. # Uses pbBaseDamage
  3233. end
  3234.  
  3235.  
  3236.  
  3237. ################################################################################
  3238. # Power is doubled if the target has already moved this round.
  3239. ################################################################################
  3240. class PokeBattle_Move_084 < PokeBattle_UnimplementedMove
  3241. # Not implemented yet.
  3242. # Uses pbBaseDamage
  3243. end
  3244.  
  3245.  
  3246.  
  3247. ################################################################################
  3248. # Power is doubled if a user's teammate fainted last round.
  3249. ################################################################################
  3250. class PokeBattle_Move_085 < PokeBattle_UnimplementedMove
  3251. # Not implemented yet.
  3252. # Uses pbBaseDamageMultiplier
  3253. end
  3254.  
  3255.  
  3256.  
  3257. ################################################################################
  3258. # Power is doubled if the user has no held item.
  3259. ################################################################################
  3260. class PokeBattle_Move_086 < PokeBattle_Move
  3261. def pbBaseDamage(basedmg,attacker,opponent)
  3262. # TODO: Should also double damage if held item is a Gem that will be consumed
  3263. if attacker.item==0
  3264. return basedmg*2
  3265. end
  3266. return basedmg
  3267. end
  3268. end
  3269.  
  3270.  
  3271.  
  3272. ################################################################################
  3273. # Power is doubled in weather. Type changes depending on the weather.
  3274. ################################################################################
  3275. class PokeBattle_Move_087 < PokeBattle_Move
  3276. def pbBaseDamage(basedmg,attacker,opponent)
  3277. if @battle.pbWeather!=0
  3278. return basedmg*2
  3279. end
  3280. return basedmg
  3281. end
  3282.  
  3283. def pbType(type,attacker,opponent)
  3284. weather=@battle.pbWeather
  3285. type=getConst(PBTypes,:NORMAL) || 0
  3286. type=(getConst(PBTypes,:FIRE) || type) if weather==PBWeather::SUNNYDAY
  3287. type=(getConst(PBTypes,:WATER) || type) if weather==PBWeather::RAINDANCE
  3288. type=(getConst(PBTypes,:ROCK) || type) if weather==PBWeather::SANDSTORM
  3289. type=(getConst(PBTypes,:ICE) || type) if weather==PBWeather::HAIL
  3290. return type
  3291. end
  3292. end
  3293.  
  3294.  
  3295.  
  3296. ################################################################################
  3297. # Power is doubled if a foe tries to switch out.
  3298. # (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
  3299. ################################################################################
  3300. class PokeBattle_Move_088 < PokeBattle_Move
  3301. def pbBaseDamage(basedmg,attacker,opponent)
  3302. if @battle.switching
  3303. return basedmg*2
  3304. end
  3305. return basedmg
  3306. end
  3307. end
  3308.  
  3309.  
  3310.  
  3311. ################################################################################
  3312. # Power increases with the user's happiness.
  3313. ################################################################################
  3314. class PokeBattle_Move_089 < PokeBattle_Move
  3315. def pbBaseDamage(basedmg,attacker,opponent)
  3316. return [(attacker.happiness*2/5).floor,1].max
  3317. end
  3318. end
  3319.  
  3320.  
  3321.  
  3322. ################################################################################
  3323. # Power decreases with the user's happiness.
  3324. ################################################################################
  3325. class PokeBattle_Move_08A < PokeBattle_Move
  3326. def pbBaseDamage(basedmg,attacker,opponent)
  3327. return [((255-attacker.happiness)*2/5).floor,1].max
  3328. end
  3329. end
  3330.  
  3331.  
  3332.  
  3333. ################################################################################
  3334. # Power increases with the user's HP.
  3335. ################################################################################
  3336. class PokeBattle_Move_08B < PokeBattle_Move
  3337. def pbBaseDamage(basedmg,attacker,opponent)
  3338. return [(150*attacker.hp/attacker.totalhp).floor,1].max
  3339. end
  3340. end
  3341.  
  3342.  
  3343.  
  3344. ################################################################################
  3345. # Power increases with the target's HP.
  3346. ################################################################################
  3347. class PokeBattle_Move_08C < PokeBattle_Move
  3348. def pbBaseDamage(basedmg,attacker,opponent)
  3349. return [(120*opponent.hp/opponent.totalhp).floor,1].max
  3350. end
  3351. end
  3352.  
  3353.  
  3354.  
  3355. ################################################################################
  3356. # Power increases the quicker the target is than the user.
  3357. ################################################################################
  3358. class PokeBattle_Move_08D < PokeBattle_Move
  3359. def pbBaseDamage(basedmg,attacker,opponent)
  3360. return [[(25*opponent.pbSpeed/attacker.pbSpeed).floor,150].min,1].max
  3361. end
  3362. end
  3363.  
  3364.  
  3365.  
  3366. ################################################################################
  3367. # Power increases with the user's positive stat changes (ignores negative ones).
  3368. ################################################################################
  3369. class PokeBattle_Move_08E < PokeBattle_Move
  3370. def pbBaseDamage(basedmg,attacker,opponent)
  3371. mult=0
  3372. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3373. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3374. mult+=attacker.stages[i] if attacker.stages[i]>0
  3375. end
  3376. return 20*(mult+1)
  3377. end
  3378. end
  3379.  
  3380.  
  3381.  
  3382. ################################################################################
  3383. # Power increases with the target's positive stat changes (ignores negative ones).
  3384. ################################################################################
  3385. class PokeBattle_Move_08F < PokeBattle_Move
  3386. def pbBaseDamage(basedmg,attacker,opponent)
  3387. mult=0
  3388. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  3389. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  3390. mult+=opponent.stages[i] if opponent.stages[i]>0
  3391. end
  3392. return [20*(mult+3),200].min
  3393. end
  3394. end
  3395.  
  3396.  
  3397.  
  3398. ################################################################################
  3399. # Power and type depends on the user's IVs.
  3400. ################################################################################
  3401. class PokeBattle_Move_090 < PokeBattle_Move
  3402. def pbType(type,attacker,opponent)
  3403. hp=pbHiddenPower(attacker.iv)
  3404. return hp[0]
  3405. end
  3406.  
  3407. def pbBaseDamage(basedmg,attacker,opponent)
  3408. hp=pbHiddenPower(attacker.iv)
  3409. return hp[1]
  3410. end
  3411. end
  3412.  
  3413. def pbHiddenPower(iv)
  3414. powermin=30
  3415. powermax=70
  3416. type=0; base=0
  3417. types=[]
  3418. for i in 0..PBTypes.maxValue
  3419. types.push(i) if !PBTypes.isPseudoType?(i) &&
  3420. !isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
  3421. end
  3422. type|=(iv[PBStats::HP]&1)
  3423. type|=(iv[PBStats::ATTACK]&1)<<1
  3424. type|=(iv[PBStats::DEFENSE]&1)<<2
  3425. type|=(iv[PBStats::SPEED]&1)<<3
  3426. type|=(iv[PBStats::SPATK]&1)<<4
  3427. type|=(iv[PBStats::SPDEF]&1)<<5
  3428. type=(type*(types.length-1)/63).floor
  3429. hptype=types[type]
  3430. base|=(iv[PBStats::HP]&2)>>1
  3431. base|=(iv[PBStats::ATTACK]&2)
  3432. base|=(iv[PBStats::DEFENSE]&2)<<1
  3433. base|=(iv[PBStats::SPEED]&2)<<2
  3434. base|=(iv[PBStats::SPATK]&2)<<3
  3435. base|=(iv[PBStats::SPDEF]&2)<<4
  3436. base=(base*(powermax-powermin)/63).floor+powermin
  3437. return [hptype,base]
  3438. end
  3439.  
  3440. ################################################################################
  3441. # Power doubles for each consecutive use.
  3442. ################################################################################
  3443. class PokeBattle_Move_091 < PokeBattle_Move
  3444. def pbBaseDamage(basedmg,attacker,opponent)
  3445. basedmg=basedmg<<(attacker.effects[PBEffects::FuryCutter]-1) # can be 1 to 4
  3446. return basedmg
  3447. end
  3448. end
  3449.  
  3450.  
  3451.  
  3452. ################################################################################
  3453. # Power doubles for each consecutive use.
  3454. ################################################################################
  3455. class PokeBattle_Move_092 < PokeBattle_Move
  3456. def pbBaseDamage(basedmg,attacker,opponent)
  3457. basedmg*=attacker.effects[PBEffects::EchoedVoice] # can be 1 to 5
  3458. return basedmg
  3459. end
  3460. end
  3461.  
  3462.  
  3463.  
  3464. ################################################################################
  3465. # User rages until the start of a round in which they don't use this move.
  3466. # Handled in Battler class: Ups rager's Attack by 1 stage each time it loses HP due to a move.
  3467. ################################################################################
  3468. class PokeBattle_Move_093 < PokeBattle_Move
  3469. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3470. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3471. attacker.effects[PBEffects::Rage]=true if ret>0
  3472. return ret
  3473. end
  3474. end
  3475.  
  3476.  
  3477.  
  3478. ################################################################################
  3479. # Randomly damages or heals the target.
  3480. ################################################################################
  3481. class PokeBattle_Move_094 < PokeBattle_Move
  3482. def pbBaseDamage(basedmg,attacker,opponent)
  3483. return @calcbasedmg
  3484. end
  3485.  
  3486. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3487. @calcbasedmg=1
  3488. r=@battle.pbRandom(10)
  3489. if r<4
  3490. @calcbasedmg=40
  3491. elsif r<7
  3492. @calcbasedmg=80
  3493. elsif r<8
  3494. @calcbasedmg=120
  3495. else
  3496. if pbTypeModifier(@type,attacker,opponent)==0
  3497. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  3498. return -1
  3499. end
  3500. if opponent.hp==opponent.totalhp
  3501. @battle.pbDisplay(_INTL("But it failed!"))
  3502. return -1
  3503. end
  3504. damage=pbCalcDamage(attacker,opponent) # Must do this even if it will heal
  3505. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation) # Healing animation
  3506. opponent.pbRecoverHP([1,(opponent.totalhp/4).floor].max,true)
  3507. @battle.pbDisplay(_INTL("{1} had its HP restored.",opponent.pbThis))
  3508. return 0
  3509. end
  3510. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3511. end
  3512. end
  3513.  
  3514.  
  3515.  
  3516. ################################################################################
  3517. # Power is chosen at random. Power is doubled if the target is using Dig.
  3518. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  3519. ################################################################################
  3520. class PokeBattle_Move_095 < PokeBattle_Move
  3521. @calcbasedmg=0
  3522.  
  3523. def pbOnStartUse(attacker)
  3524. basedmg=[10,30,50,70,90,110,150]
  3525. magnitudes=[
  3526. 4,
  3527. 5,5,
  3528. 6,6,6,6,
  3529. 7,7,7,7,7,7,
  3530. 8,8,8,8,
  3531. 9,9,
  3532. 10
  3533. ]
  3534. magni=magnitudes[@battle.pbRandom(magnitudes.length)]
  3535. @calcbasedmg=basedmg[magni-4]
  3536. @battle.pbDisplay(_INTL("Magnitude {1}!",magni))
  3537. return true
  3538. end
  3539.  
  3540. def pbBaseDamage(basedmg,attacker,opponent)
  3541. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  3542. return @calcbasedmg*2
  3543. end
  3544. return @calcbasedmg
  3545. end
  3546. end
  3547.  
  3548.  
  3549.  
  3550. ################################################################################
  3551. # Power and type depend on the user's held berry. Destroys the berry.
  3552. ################################################################################
  3553. class PokeBattle_Move_096 < PokeBattle_Move
  3554. @berry=0
  3555.  
  3556. def pbOnStartUse(attacker)
  3557. if !pbIsBerry?(attacker.item)
  3558. @battle.pbDisplay(_INTL("But it failed!"))
  3559. return false
  3560. end
  3561. @berry=attacker.item
  3562. return true
  3563. end
  3564.  
  3565. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3566. if attacker.item==0
  3567. @battle.pbDisplay(_INTL("But it failed!"))
  3568. return 0
  3569. end
  3570. attacker.pokemon.itemRecycle=attacker.item
  3571. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  3572. attacker.item=0
  3573. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3574. end
  3575.  
  3576. def pbBaseDamage(basedmg,attacker,opponent)
  3577. damagearray={
  3578. 60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
  3579. :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
  3580. :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
  3581. :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
  3582. :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
  3583. :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
  3584. :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY],
  3585. 70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
  3586. :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
  3587. :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
  3588. :PAMTREBERRY],
  3589. 80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
  3590. :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
  3591. :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JACOBABERRY,:ROWAPBERRY]
  3592. }
  3593. for i in damagearray.keys
  3594. data=damagearray[i]
  3595. if data
  3596. for j in data
  3597. return i if isConst?(@berry,PBItems,j)
  3598. end
  3599. end
  3600. end
  3601. return 1
  3602. end
  3603.  
  3604. def pbType(type,attacker,opponent)
  3605. typearray={
  3606. :NORMAL => [:CHILANBERRY],
  3607. :FIRE => [:CHERIBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
  3608. :WATER => [:CHESTOBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
  3609. :ELECTRIC => [:PECHABERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
  3610. :GRASS => [:RAWSTBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
  3611. :ICE => [:ASPEARBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
  3612. :FIGHTING => [:LEPPABERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
  3613. :POISON => [:ORANBERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
  3614. :GROUND => [:PERSIMBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
  3615. :FLYING => [:LUMBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
  3616. :PSYCHIC => [:SITRUSBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
  3617. :BUG => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
  3618. :ROCK => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
  3619. :GHOST => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
  3620. :DRAGON => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JACOBABERRY],
  3621. :DARK => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY],
  3622. :STEEL => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY]
  3623. }
  3624. for i in typearray.keys
  3625. data=typearray[i]
  3626. if data
  3627. for j in data
  3628. return getConst(PBTypes,i) if isConst?(@berry,PBItems,j)
  3629. end
  3630. end
  3631. end
  3632. return getConst(PBTypes,:NORMAL)
  3633. end
  3634. end
  3635.  
  3636.  
  3637.  
  3638. ################################################################################
  3639. # Power increases the less PP this move has.
  3640. ################################################################################
  3641. class PokeBattle_Move_097 < PokeBattle_Move
  3642. def pbBaseDamage(basedmg,attacker,opponent)
  3643. dmgs=[200,80,60,50,40]
  3644. ppleft=[@pp,4].min # PP is reduced before the move is used
  3645. basedmg=dmgs[ppleft]
  3646. return basedmg
  3647. end
  3648. end
  3649.  
  3650.  
  3651.  
  3652. ################################################################################
  3653. # Power increases the less HP the user has.
  3654. ################################################################################
  3655. class PokeBattle_Move_098 < PokeBattle_Move
  3656. def pbBaseDamage(basedmg,attacker,opponent)
  3657. n=(48*attacker.hp/attacker.totalhp).floor
  3658. ret=20
  3659. ret=40 if n<33
  3660. ret=80 if n<17
  3661. ret=100 if n<10
  3662. ret=150 if n<5
  3663. ret=200 if n<2
  3664. return ret
  3665. end
  3666. end
  3667.  
  3668.  
  3669.  
  3670. ################################################################################
  3671. # Power increases the quicker the user is than the target.
  3672. ################################################################################
  3673. class PokeBattle_Move_099 < PokeBattle_Move
  3674. def pbBaseDamage(basedmg,attacker,opponent)
  3675. n=(attacker.pbSpeed/opponent.pbSpeed).floor
  3676. ret=40
  3677. ret=60 if n>=1
  3678. ret=80 if n>=2
  3679. ret=120 if n>=3
  3680. ret=150 if n>=4
  3681. return ret
  3682. end
  3683. end
  3684.  
  3685.  
  3686.  
  3687. ################################################################################
  3688. # Power increases the heavier the target is.
  3689. ################################################################################
  3690. class PokeBattle_Move_09A < PokeBattle_Move
  3691. def pbBaseDamage(basedmg,attacker,opponent)
  3692. weight=opponent.weight
  3693. ret=20
  3694. ret=40 if weight>100
  3695. ret=60 if weight>250
  3696. ret=80 if weight>500
  3697. ret=100 if weight>1000
  3698. ret=120 if weight>2000
  3699. return ret
  3700. end
  3701. end
  3702.  
  3703.  
  3704.  
  3705. ################################################################################
  3706. # Power increases the heavier the user is than the target.
  3707. ################################################################################
  3708. class PokeBattle_Move_09B < PokeBattle_Move
  3709. def pbBaseDamage(basedmg,attacker,opponent)
  3710. n=(attacker.weight/opponent.weight).floor
  3711. ret=40
  3712. ret=60 if n>=2
  3713. ret=80 if n>=3
  3714. ret=100 if n>=4
  3715. ret=120 if n>=5
  3716. return ret
  3717. end
  3718. end
  3719.  
  3720.  
  3721.  
  3722. ################################################################################
  3723. # Powers up the ally's attack this round by 1.5.
  3724. ################################################################################
  3725. class PokeBattle_Move_09C < PokeBattle_Move
  3726. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3727. if attacker.pbPartner.isFainted? ||
  3728. attacker.pbPartner.effects[PBEffects::HelpingHand]
  3729. @battle.pbDisplay(_INTL("But it failed!"))
  3730. return -1
  3731. end
  3732. pbShowAnimation(@id,attacker,attacker.pbPartner,hitnum,alltargets,showanimation)
  3733. attacker.pbPartner.effects[PBEffects::HelpingHand]=true
  3734. @battle.pbDisplay(_INTL("{1} is ready to help {2}!",attacker.pbThis,attacker.pbPartner.pbThis(true)))
  3735. return 0
  3736. end
  3737. end
  3738.  
  3739.  
  3740.  
  3741. ################################################################################
  3742. # Weakens Electric attacks.
  3743. ################################################################################
  3744. class PokeBattle_Move_09D < PokeBattle_Move
  3745. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3746. for i in 0...4
  3747. if attacker.battle.battlers[i].effects[PBEffects::MudSport]
  3748. @battle.pbDisplay(_INTL("But it failed!"))
  3749. return -1
  3750. end
  3751. end
  3752. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3753. attacker.effects[PBEffects::MudSport]=true
  3754. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  3755. return 0
  3756. end
  3757. end
  3758.  
  3759.  
  3760.  
  3761. ################################################################################
  3762. # Weakens Fire attacks.
  3763. ################################################################################
  3764. class PokeBattle_Move_09E < PokeBattle_Move
  3765. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3766. for i in 0...4
  3767. if attacker.battle.battlers[i].effects[PBEffects::WaterSport]
  3768. @battle.pbDisplay(_INTL("But it failed!"))
  3769. return -1
  3770. end
  3771. end
  3772. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3773. attacker.effects[PBEffects::WaterSport]=true
  3774. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  3775. return 0
  3776. end
  3777. end
  3778.  
  3779.  
  3780.  
  3781. ################################################################################
  3782. # Type depends on the user's held item.
  3783. ################################################################################
  3784. class PokeBattle_Move_09F < PokeBattle_Move
  3785. def pbType(type,attacker,opponent)
  3786. if isConst?(@id,PBMoves,:JUDGMENT)
  3787. return getConst(PBTypes,:FIGHTING) if attacker.hasWorkingItem(:FISTPLATE)
  3788. return getConst(PBTypes,:FLYING) if attacker.hasWorkingItem(:SKYPLATE)
  3789. return getConst(PBTypes,:POISON) if attacker.hasWorkingItem(:TOXICPLATE)
  3790. return getConst(PBTypes,:GROUND) if attacker.hasWorkingItem(:EARTHPLATE)
  3791. return getConst(PBTypes,:ROCK) if attacker.hasWorkingItem(:STONEPLATE)
  3792. return getConst(PBTypes,:BUG) if attacker.hasWorkingItem(:INSECTPLATE)
  3793. return getConst(PBTypes,:GHOST) if attacker.hasWorkingItem(:SPOOKYPLATE)
  3794. return getConst(PBTypes,:STEEL) if attacker.hasWorkingItem(:IRONPLATE)
  3795. return getConst(PBTypes,:FIRE) if attacker.hasWorkingItem(:FLAMEPLATE)
  3796. return getConst(PBTypes,:WATER) if attacker.hasWorkingItem(:SPLASHPLATE)
  3797. return getConst(PBTypes,:GRASS) if attacker.hasWorkingItem(:MEADOWPLATE)
  3798. return getConst(PBTypes,:ELECTRIC) if attacker.hasWorkingItem(:ZAPPLATE)
  3799. return getConst(PBTypes,:PSYCHIC) if attacker.hasWorkingItem(:MINDPLATE)
  3800. return getConst(PBTypes,:ICE) if attacker.hasWorkingItem(:ICICLEPLATE)
  3801. return getConst(PBTypes,:DRAGON) if attacker.hasWorkingItem(:DRACOPLATE)
  3802. return getConst(PBTypes,:DARK) if attacker.hasWorkingItem(:DREADPLATE)
  3803. elsif isConst?(@id,PBMoves,:TECHNOBLAST)
  3804. return getConst(PBTypes,:ELECTRIC) if attacker.hasWorkingItem(:SHOCKDRIVE)
  3805. return getConst(PBTypes,:FIRE) if attacker.hasWorkingItem(:BURNDRIVE)
  3806. return getConst(PBTypes,:ICE) if attacker.hasWorkingItem(:CHILLDRIVE)
  3807. return getConst(PBTypes,:WATER) if attacker.hasWorkingItem(:DOUSEDRIVE)
  3808. end
  3809. return getConst(PBTypes,:NORMAL)
  3810. end
  3811. end
  3812.  
  3813.  
  3814.  
  3815. ################################################################################
  3816. # This attack is always a critical hit, if successful.
  3817. ################################################################################
  3818. class PokeBattle_Move_0A0 < PokeBattle_Move
  3819. # Handled in superclass, do not edit!
  3820. end
  3821.  
  3822.  
  3823.  
  3824. ################################################################################
  3825. # For 5 rounds, foes' attacks cannot become critical hits.
  3826. ################################################################################
  3827. class PokeBattle_Move_0A1 < PokeBattle_Move
  3828. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3829. if attacker.pbOwnSide.effects[PBEffects::LuckyChant]>0
  3830. @battle.pbDisplay(_INTL("But it failed!"))
  3831. return -1
  3832. end
  3833. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3834. attacker.pbOwnSide.effects[PBEffects::LuckyChant]=5
  3835. if !@battle.pbIsOpposing?(attacker.index)
  3836. @battle.pbDisplay(_INTL("The Lucky Chant shielded your team from critical hits!"))
  3837. else
  3838. @battle.pbDisplay(_INTL("The Lucky Chant shielded the foe's team from critical hits!"))
  3839. end
  3840. return 0
  3841. end
  3842. end
  3843.  
  3844.  
  3845.  
  3846. ################################################################################
  3847. # For 5 rounds, lowers power of physical attacks against the user's side.
  3848. ################################################################################
  3849. class PokeBattle_Move_0A2 < PokeBattle_Move
  3850. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3851. if attacker.pbOwnSide.effects[PBEffects::Reflect]>0
  3852. @battle.pbDisplay(_INTL("But it failed!"))
  3853. return -1
  3854. end
  3855. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3856. attacker.pbOwnSide.effects[PBEffects::Reflect]=5
  3857. attacker.pbOwnSide.effects[PBEffects::Reflect]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  3858. if !@battle.pbIsOpposing?(attacker.index)
  3859. @battle.pbDisplay(_INTL("Reflect raised your team's Defense!"))
  3860. else
  3861. @battle.pbDisplay(_INTL("Reflect raised the opposing team's Defense!"))
  3862. end
  3863. return 0
  3864. end
  3865. end
  3866.  
  3867.  
  3868.  
  3869. ################################################################################
  3870. # For 5 rounds, lowers power of special attacks against the user's side.
  3871. ################################################################################
  3872. class PokeBattle_Move_0A3 < PokeBattle_Move
  3873. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3874. if attacker.pbOwnSide.effects[PBEffects::LightScreen]>0
  3875. @battle.pbDisplay(_INTL("But it failed!"))
  3876. return -1
  3877. end
  3878. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3879. attacker.pbOwnSide.effects[PBEffects::LightScreen]=5
  3880. attacker.pbOwnSide.effects[PBEffects::LightScreen]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  3881. if !@battle.pbIsOpposing?(attacker.index)
  3882. @battle.pbDisplay(_INTL("Light Screen raised your team's Special Defense!"))
  3883. else
  3884. @battle.pbDisplay(_INTL("Light Screen raised the opposing team's Special Defense!"))
  3885. end
  3886. return 0
  3887. end
  3888. end
  3889.  
  3890.  
  3891.  
  3892. ################################################################################
  3893. # Effect depends on the environment.
  3894. ################################################################################
  3895. class PokeBattle_Move_0A4 < PokeBattle_Move
  3896. def pbAdditionalEffect(attacker,opponent)
  3897. case @battle.environment
  3898. when PBEnvironment::Grass, PBEnvironment::TallGrass
  3899. return false if !opponent.pbCanSleep?(false)
  3900. opponent.pbSleep
  3901. @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
  3902. when PBEnvironment::MovingWater
  3903. return false if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,1,false)
  3904. opponent.pbReduceStat(PBStats::ATTACK,1,false)
  3905. when PBEnvironment::StillWater
  3906. return false if !opponent.pbCanReduceStatStage?(PBStats::SPEED,1,false)
  3907. opponent.pbReduceStat(PBStats::SPEED,1,false)
  3908. when PBEnvironment::Underwater
  3909. return false if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,1,false)
  3910. opponent.pbReduceStat(PBStats::DEFENSE,1,false)
  3911. when PBEnvironment::Cave, PBEnvironment::Rock
  3912. return false if opponent.hasWorkingAbility(:INNERFOCUS) ||
  3913. opponent.effects[PBEffects::Substitute]>0
  3914. opponent.effects[PBEffects::Flinch]=true
  3915. when PBEnvironment::Sand
  3916. return false if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,1,false)
  3917. opponent.pbReduceStat(PBStats::ACCURACY,1,false)
  3918. else
  3919. return false if !opponent.pbCanParalyze?(false)
  3920. opponent.pbParalyze(attacker)
  3921. @battle.pbDisplay(_INTL("{1} is paralyzed! It may be unable to move!",opponent.pbThis))
  3922. end
  3923. return true
  3924. end
  3925. end
  3926.  
  3927.  
  3928.  
  3929. ################################################################################
  3930. # Always hits.
  3931. ################################################################################
  3932. class PokeBattle_Move_0A5 < PokeBattle_Move
  3933. def pbAccuracyCheck(attacker,opponent)
  3934. return true
  3935. end
  3936. end
  3937.  
  3938.  
  3939.  
  3940. ################################################################################
  3941. # User's attack next round against the target will definitely hit.
  3942. ################################################################################
  3943. class PokeBattle_Move_0A6 < PokeBattle_Move
  3944. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3945. if opponent.effects[PBEffects::Substitute]>0
  3946. @battle.pbDisplay(_INTL("But it failed!"))
  3947. return -1
  3948. end
  3949. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3950. opponent.effects[PBEffects::LockOn]=2
  3951. opponent.effects[PBEffects::LockOnPos]=attacker.index
  3952. @battle.pbDisplay(_INTL("{1} took aim at {2}!",attacker.pbThis,opponent.pbThis(true)))
  3953. return 0
  3954. end
  3955. end
  3956.  
  3957.  
  3958.  
  3959. ################################################################################
  3960. # Target's evasion stat changes are ignored from now on.
  3961. # Normal and Fighting moves have normal effectiveness against the Ghost-type target.
  3962. ################################################################################
  3963. class PokeBattle_Move_0A7 < PokeBattle_Move
  3964. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3965. if opponent.effects[PBEffects::Foresight]
  3966. @battle.pbDisplay(_INTL("But it failed!"))
  3967. return -1
  3968. end
  3969. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3970. opponent.effects[PBEffects::Foresight]=true
  3971. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  3972. return 0
  3973. end
  3974. end
  3975.  
  3976.  
  3977.  
  3978. ################################################################################
  3979. # Target's evasion stat changes are ignored from now on.
  3980. # Psychic moves have normal effectiveness against the Dark-type target.
  3981. ################################################################################
  3982. class PokeBattle_Move_0A8 < PokeBattle_Move
  3983. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3984. if opponent.effects[PBEffects::MiracleEye]
  3985. @battle.pbDisplay(_INTL("But it failed!"))
  3986. return -1
  3987. end
  3988. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3989. opponent.effects[PBEffects::MiracleEye]=true
  3990. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  3991. return 0
  3992. end
  3993. end
  3994.  
  3995.  
  3996.  
  3997. ################################################################################
  3998. # This move ignores target's Defense, Special Defense and evasion stat changes.
  3999. ################################################################################
  4000. class PokeBattle_Move_0A9 < PokeBattle_Move
  4001. # Handled in superclass, do not edit!
  4002. end
  4003.  
  4004.  
  4005.  
  4006. ################################################################################
  4007. # User is protected against moves with the "B" flag this round.
  4008. ################################################################################
  4009. class PokeBattle_Move_0AA < PokeBattle_Move
  4010. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4011. ratesharers=[
  4012. 0xAA, # Detect, Protect
  4013. 0xAB, # Quick Guard
  4014. 0xAC, # Wide Guard
  4015. 0xE8 # Endure
  4016. ]
  4017. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4018. attacker.effects[PBEffects::ProtectRate]=1
  4019. end
  4020. #TODO: Fails if this is the last attack in the round
  4021. if @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  4022. attacker.effects[PBEffects::ProtectRate]=1
  4023. @battle.pbDisplay(_INTL("But it failed!"))
  4024. return -1
  4025. end
  4026. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4027. attacker.effects[PBEffects::Protect]=true
  4028. attacker.effects[PBEffects::ProtectRate]*=2
  4029. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  4030. return 0
  4031. end
  4032. end
  4033.  
  4034.  
  4035.  
  4036. ################################################################################
  4037. # User's side is protected against moves with priority greater than 0 this round.
  4038. ################################################################################
  4039. class PokeBattle_Move_0AB < PokeBattle_UnimplementedMove
  4040. # Not implemented yet.
  4041. end
  4042.  
  4043.  
  4044.  
  4045. ################################################################################
  4046. # User's side is protected against moves that target multiple battlers this round.
  4047. ################################################################################
  4048. class PokeBattle_Move_0AC < PokeBattle_UnimplementedMove
  4049. # Not implemented yet.
  4050. end
  4051.  
  4052.  
  4053.  
  4054. ################################################################################
  4055. # Ignores target's protections. If successful, all other moves this round
  4056. # ignore them too.
  4057. ################################################################################
  4058. class PokeBattle_Move_0AD < PokeBattle_Move
  4059. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4060. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4061. opponent.effects[PBEffects::ProtectNegation]=true if ret>0
  4062. return ret
  4063. end
  4064. end
  4065.  
  4066.  
  4067.  
  4068. ################################################################################
  4069. # Uses the last move that the target used.
  4070. ################################################################################
  4071. class PokeBattle_Move_0AE < PokeBattle_Move
  4072. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4073. if opponent.lastMoveUsed<=0 ||
  4074. (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
  4075. @battle.pbDisplay(_INTL("The mirror move failed!"))
  4076. return -1
  4077. end
  4078. attacker.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
  4079. return 0
  4080. end
  4081. end
  4082.  
  4083.  
  4084.  
  4085. ################################################################################
  4086. # Uses the last move that was used.
  4087. ################################################################################
  4088. class PokeBattle_Move_0AF < PokeBattle_UnimplementedMove
  4089. # Not implemented yet.
  4090. end
  4091.  
  4092.  
  4093.  
  4094. ################################################################################
  4095. # Uses the move the target was about to use this round, with 1.5x power.
  4096. ################################################################################
  4097. class PokeBattle_Move_0B0 < PokeBattle_UnimplementedMove
  4098. # Not implemented yet.
  4099. end
  4100.  
  4101.  
  4102.  
  4103. ################################################################################
  4104. # This round, reflects all moves with the "C" flag targeting the user back at
  4105. # their origin.
  4106. ################################################################################
  4107. class PokeBattle_Move_0B1 < PokeBattle_Move
  4108. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4109. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4110. attacker.effects[PBEffects::MagicCoat]=true
  4111. @battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",attacker.pbThis))
  4112. return 0
  4113. end
  4114. end
  4115.  
  4116.  
  4117.  
  4118. ################################################################################
  4119. # This round, snatches all used moves with the "D" flag.
  4120. ################################################################################
  4121. class PokeBattle_Move_0B2 < PokeBattle_Move
  4122. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4123. # TODO: Fails if attacker is last in priority
  4124. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4125. attacker.effects[PBEffects::Snatch]=true
  4126. @battle.pbDisplay(_INTL("{1} waits for a target to make a move!",attacker.pbThis))
  4127. return 0
  4128. end
  4129. end
  4130.  
  4131.  
  4132.  
  4133. ################################################################################
  4134. # Uses a different move depending on the environment.
  4135. ################################################################################
  4136. class PokeBattle_Move_0B3 < PokeBattle_Move
  4137. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4138. move=0
  4139. case @battle.environment
  4140. when PBEnvironment::Grass, PBEnvironment::TallGrass
  4141. move=getConst(PBMoves,:SEEDBOMB) || 0
  4142. when PBEnvironment::MovingWater, PBEnvironment::Underwater
  4143. move=getConst(PBMoves,:HYDROPUMP) || 0
  4144. when PBEnvironment::StillWater
  4145. move=getConst(PBMoves,:MUDBOMB) || 0
  4146. when PBEnvironment::Rock, PBEnvironment::Cave
  4147. move=getConst(PBMoves,:ROCKSLIDE) || 0
  4148. when PBEnvironment::Sand
  4149. move=getConst(PBMoves,:EARTHQUAKE) || 0
  4150. else
  4151. move=getConst(PBMoves,:TRIATTACK) || 0
  4152. end
  4153. if move==0
  4154. @battle.pbDisplay(_INTL("But it failed!"))
  4155. return -1
  4156. end
  4157. thismovename=PBMoves.getName(@id)
  4158. movename=PBMoves.getName(move)
  4159. @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
  4160. attacker.pbUseMoveSimple(move)
  4161. return 0
  4162. end
  4163. end
  4164.  
  4165.  
  4166.  
  4167. ################################################################################
  4168. # Uses a random move the user knows. Fails if user is not asleep.
  4169. ################################################################################
  4170. class PokeBattle_Move_0B4 < PokeBattle_Move
  4171. def pbCanUseWhileAsleep?
  4172. return true
  4173. end
  4174.  
  4175. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4176. if attacker.status!=PBStatuses::SLEEP
  4177. @battle.pbDisplay(_INTL("But it failed!"))
  4178. return -1
  4179. end
  4180. blacklist=[
  4181. 0x02, # Struggle
  4182. 0x14, # Chatter
  4183. 0x5D, # Sketch
  4184. 0xAE, # Mirror Move
  4185. 0xAF, # Copycat
  4186. 0xB0, # Me First
  4187. 0xB3, # Nature Power
  4188. 0xB4, # Sleep Talk
  4189. 0xB5, # Assist
  4190. 0xB6, # Metronome
  4191. 0xD1, # Uproar
  4192. 0xD4, # Bide
  4193. 0x115, # Focus Punch
  4194. # Two-turn attacks
  4195. 0xC3, # Razor Wind
  4196. 0xC4, # SolarBeam
  4197. 0xC5, # Freeze Shock
  4198. 0xC6, # Ice Burn
  4199. 0xC7, # Sky Attack
  4200. 0xC8, # Skull Bash
  4201. 0xC9, # Fly
  4202. 0xCA, # Dig
  4203. 0xCB, # Dive
  4204. 0xCC, # Bounce
  4205. 0xCD, # Shadow Force
  4206. 0xCE # Sky Drop
  4207. ]
  4208. choices=[]
  4209. for i in 0...4
  4210. found=false
  4211. next if attacker.moves[i].id==0
  4212. found=true if blacklist.include?(attacker.moves[i].function)
  4213. next if found
  4214. choices.push(i) if @battle.pbCanChooseMove?(attacker.index,i,false,true)
  4215. end
  4216. if choices.length==0
  4217. @battle.pbDisplay(_INTL("But it failed!"))
  4218. return -1
  4219. end
  4220. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4221. choice=choices[@battle.pbRandom(choices.length)]
  4222. attacker.pbUseMoveSimple(attacker.moves[choice].id,choice,attacker.pbOppositeOpposing)
  4223. return 0
  4224. end
  4225. end
  4226.  
  4227.  
  4228.  
  4229. ################################################################################
  4230. # Uses a random move known by any non-user Pokémon in the user's party.
  4231. ################################################################################
  4232. class PokeBattle_Move_0B5 < PokeBattle_Move
  4233. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4234. blacklist=[
  4235. 0x02, # Struggle
  4236. 0x14, # Chatter
  4237. 0x5C, # Mimic
  4238. 0x5D, # Sketch
  4239. 0x69, # Transform
  4240. 0x71, # Counter
  4241. 0x72, # Mirror Coat
  4242. 0x9C, # Helping Hand
  4243. 0xAA, # Detect, Protect
  4244. 0xAD, # Feint
  4245. 0xAE, # Mirror Move
  4246. 0xAF, # Copycat
  4247. 0xB0, # Me First
  4248. 0xB2, # Snatch
  4249. 0xB3, # Nature Power
  4250. 0xB4, # Sleep Talk
  4251. 0xB5, # Assist
  4252. 0xB6, # Metronome
  4253. 0xE7, # Destiny Bond
  4254. 0xE8, # Endure
  4255. 0xEC, # Circle Throw
  4256. 0xF1, # Covet, Thief
  4257. 0xF2, # Switcheroo, Trick
  4258. 0xF3, # Bestow
  4259. 0x115, # Focus Punch
  4260. 0x117 # Follow Me, Rage Powder
  4261. ]
  4262. moves=[]
  4263. party=@battle.pbParty(attacker.index) # NOTE: pbParty is common to both allies in multi battles
  4264. for i in 0...party.length
  4265. if i!=attacker.pokemonIndex && party[i] && !party[i].isEgg?
  4266. for j in party[i].moves
  4267. next if isConst?(j.type,PBTypes,:SHADOW)
  4268. next if j.id==0
  4269. found=false
  4270. movedata=PBMoveData.new(j.id)
  4271. found=true if blacklist.include?(movedata.function)
  4272. moves.push(j.id) if !found
  4273. end
  4274. end
  4275. end
  4276. if moves.length==0
  4277. @battle.pbDisplay(_INTL("But it failed!"))
  4278. return -1
  4279. end
  4280. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4281. move=moves[@battle.pbRandom(moves.length)]
  4282. attacker.pbUseMoveSimple(move)
  4283. return 0
  4284. end
  4285. end
  4286.  
  4287.  
  4288.  
  4289. ################################################################################
  4290. # Uses a random move that exists.
  4291. ################################################################################
  4292. class PokeBattle_Move_0B6 < PokeBattle_Move
  4293. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4294. blacklist=[
  4295. 0x02, # Struggle
  4296. 0x11, # Snore
  4297. 0x14, # Chatter
  4298. 0x5C, # Mimic
  4299. 0x5D, # Sketch
  4300. 0x69, # Transform
  4301. 0x71, # Counter
  4302. 0x72, # Mirror Coat
  4303. 0x9C, # Helping Hand
  4304. 0xAA, # Detect, Protect
  4305. 0xAB, # Quick Guard
  4306. 0xAC, # Wide Guard
  4307. 0xAD, # Feint
  4308. 0xAE, # Mirror Move
  4309. 0xAF, # Copycat
  4310. 0xB0, # Me First
  4311. 0xB2, # Snatch
  4312. 0xB3, # Nature Power
  4313. 0xB4, # Sleep Talk
  4314. 0xB5, # Assist
  4315. 0xB6, # Metronome
  4316. 0xE7, # Destiny Bond
  4317. 0xE8, # Endure
  4318. 0xF1, # Covet, Thief
  4319. 0xF2, # Switcheroo, Trick
  4320. 0xF3, # Bestow
  4321. 0x115, # Focus Punch
  4322. 0x117, # Follow Me, Rage Powder
  4323. 0x11D, # After You
  4324. 0x11E # Quash
  4325. ]
  4326. blacklistmoves=[
  4327. :FREEZESHOCK,
  4328. :ICEBURN,
  4329. :RELICSONG,
  4330. :SECRETSWORD,
  4331. :SNARL,
  4332. :TECHNOBLAST,
  4333. :VCREATE
  4334. ]
  4335. i=0; loop do break unless i<1000
  4336. move=@battle.pbRandom(PBMoves.maxValue)+1
  4337. next if isConst?(PBMoveData.new(move).type,PBTypes,:SHADOW)
  4338. found=false
  4339. if blacklist.include?(PBMoveData.new(move).function)
  4340. found=true
  4341. else
  4342. for j in blacklistmoves
  4343. if isConst?(move,PBMoves,j)
  4344. found=true
  4345. break
  4346. end
  4347. end
  4348. end
  4349. if !found
  4350. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4351. attacker.pbUseMoveSimple(move)
  4352. return 0
  4353. end
  4354. i+=1
  4355. end
  4356. @battle.pbDisplay(_INTL("But it failed!"))
  4357. return -1
  4358. end
  4359. end
  4360.  
  4361.  
  4362.  
  4363. ################################################################################
  4364. # The target can no longer use the same move twice in a row.
  4365. ################################################################################
  4366. class PokeBattle_Move_0B7 < PokeBattle_Move
  4367. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4368. if opponent.effects[PBEffects::Torment]
  4369. @battle.pbDisplay(_INTL("But it failed!"))
  4370. return -1
  4371. end
  4372. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4373. opponent.effects[PBEffects::Torment]=true
  4374. @battle.pbDisplay(_INTL("{1} was subjected to torment!",opponent.pbThis))
  4375. return 0
  4376. end
  4377. end
  4378.  
  4379.  
  4380.  
  4381. ################################################################################
  4382. # Disables all target's moves that the user also knows.
  4383. ################################################################################
  4384. class PokeBattle_Move_0B8 < PokeBattle_Move
  4385. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4386. if attacker.effects[PBEffects::Imprison]
  4387. @battle.pbDisplay(_INTL("But it failed!"))
  4388. return -1
  4389. end
  4390. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4391. attacker.effects[PBEffects::Imprison]=true
  4392. @battle.pbDisplay(_INTL("{1} sealed the opponent's move(s)!",attacker.pbThis))
  4393. return 0
  4394. end
  4395. end
  4396.  
  4397.  
  4398.  
  4399. ################################################################################
  4400. # For 5 rounds, disables the last move the target used.
  4401. ################################################################################
  4402. class PokeBattle_Move_0B9 < PokeBattle_Move
  4403. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4404. if opponent.effects[PBEffects::Disable]>0
  4405. @battle.pbDisplay(_INTL("But it failed!"))
  4406. return -1
  4407. end
  4408. for i in opponent.moves
  4409. if i.id>0 && i.id==opponent.lastMoveUsed && (i.pp>0 || i.totalpp==0)
  4410. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4411. opponent.effects[PBEffects::Disable]=4
  4412. opponent.effects[PBEffects::DisableMove]=opponent.lastMoveUsed
  4413. @battle.pbDisplay(_INTL("{1}'s {2} was disabled!",opponent.pbThis,i.name))
  4414. return 0
  4415. end
  4416. end
  4417. @battle.pbDisplay(_INTL("But it failed!"))
  4418. return -1
  4419. end
  4420. end
  4421.  
  4422.  
  4423.  
  4424. ################################################################################
  4425. # For 4 rounds, disables the target's non-damaging moves.
  4426. ################################################################################
  4427. class PokeBattle_Move_0BA < PokeBattle_Move
  4428. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4429. if opponent.effects[PBEffects::Taunt]>0
  4430. @battle.pbDisplay(_INTL("But it failed!"))
  4431. return -1
  4432. end
  4433. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4434. opponent.effects[PBEffects::Taunt]=4
  4435. @battle.pbDisplay(_INTL("{1} fell for the taunt!",opponent.pbThis))
  4436. return 0
  4437. end
  4438. end
  4439.  
  4440.  
  4441.  
  4442. ################################################################################
  4443. # For 5 rounds, disables the target's healing moves.
  4444. ################################################################################
  4445. class PokeBattle_Move_0BB < PokeBattle_Move
  4446. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4447. if opponent.effects[PBEffects::HealBlock]>0
  4448. @battle.pbDisplay(_INTL("But it failed!"))
  4449. return -1
  4450. end
  4451. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4452. opponent.effects[PBEffects::HealBlock]=5
  4453. @battle.pbDisplay(_INTL("{1} was prevented from healing!",opponent.pbThis))
  4454. return 0
  4455. end
  4456. end
  4457.  
  4458.  
  4459.  
  4460. ################################################################################
  4461. # For 4 rounds, the target must use the same move each round.
  4462. ################################################################################
  4463. class PokeBattle_Move_0BC < PokeBattle_Move
  4464. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4465. blacklist=[
  4466. 0x02, # Struggle
  4467. 0x5C, # Mimic
  4468. 0x5D, # Sketch
  4469. 0x69, # Transform
  4470. 0xAE, # Mirror Move
  4471. 0xBC # Encore
  4472. ]
  4473. if opponent.effects[PBEffects::Encore]>0
  4474. @battle.pbDisplay(_INTL("But it failed!"))
  4475. return -1
  4476. end
  4477. if opponent.lastMoveUsed<=0 ||
  4478. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  4479. @battle.pbDisplay(_INTL("But it failed!"))
  4480. return -1
  4481. end
  4482. for i in 0...4
  4483. if opponent.lastMoveUsed==opponent.moves[i].id &&
  4484. (opponent.moves[i].pp>0 || opponent.moves[i].totalpp==0)
  4485. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4486. opponent.effects[PBEffects::Encore]=3
  4487. opponent.effects[PBEffects::EncoreIndex]=i
  4488. opponent.effects[PBEffects::EncoreMove]=opponent.moves[i].id
  4489. @battle.pbDisplay(_INTL("{1} received an encore!",opponent.pbThis))
  4490. return 0
  4491. end
  4492. end
  4493. @battle.pbDisplay(_INTL("But it failed!"))
  4494. return -1
  4495. end
  4496. end
  4497.  
  4498.  
  4499.  
  4500. ################################################################################
  4501. # Hits twice.
  4502. ################################################################################
  4503. class PokeBattle_Move_0BD < PokeBattle_Move
  4504. def pbIsMultiHit
  4505. return true
  4506. end
  4507.  
  4508. def pbNumHits(attacker)
  4509. return 2
  4510. end
  4511. end
  4512.  
  4513.  
  4514.  
  4515. ################################################################################
  4516. # Hits twice. May poison the targer on each hit.
  4517. ################################################################################
  4518. class PokeBattle_Move_0BE < PokeBattle_Move
  4519. def pbIsMultiHit
  4520. return true
  4521. end
  4522.  
  4523. def pbNumHits(attacker)
  4524. return 2
  4525. end
  4526.  
  4527. def pbAdditionalEffect(attacker,opponent)
  4528. return false if !opponent.pbCanPoison?(false)
  4529. opponent.pbPoison(attacker)
  4530. @battle.pbDisplay(_INTL("{1} was poisoned!",opponent.pbThis))
  4531. return true
  4532. end
  4533. end
  4534.  
  4535.  
  4536.  
  4537. ################################################################################
  4538. # Hits 3 times. Power is multiplied by the hit number.
  4539. ################################################################################
  4540. class PokeBattle_Move_0BF < PokeBattle_Move
  4541. def pbIsMultiHit
  4542. return true
  4543. end
  4544.  
  4545. def pbNumHits(attacker)
  4546. return 3
  4547. end
  4548.  
  4549. def pbOnStartUse(attacker)
  4550. @calcbasedmg=@basedamage
  4551. return true
  4552. end
  4553.  
  4554. def pbBaseDamage(basedmg,attacker,opponent)
  4555. ret=@calcbasedmg
  4556. @calcbasedmg+=basedmg
  4557. return ret
  4558. end
  4559. end
  4560.  
  4561.  
  4562.  
  4563. ################################################################################
  4564. # Hits 2-5 times.
  4565. ################################################################################
  4566. class PokeBattle_Move_0C0 < PokeBattle_Move
  4567. def pbIsMultiHit
  4568. return true
  4569. end
  4570.  
  4571. def pbNumHits(attacker)
  4572. hitchances=[2,2,3,3,4,5]
  4573. ret=hitchances[@battle.pbRandom(hitchances.length)]
  4574. ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  4575. return ret
  4576. end
  4577. end
  4578.  
  4579.  
  4580.  
  4581. ################################################################################
  4582. # Hits X times, where X is the number of unfainted status-free Pokémon in the
  4583. # user's party (the participants). Fails if X is 0.
  4584. # Base power of each hit depends on the base Attack stat for the species of that
  4585. # hit's participant.
  4586. ################################################################################
  4587. class PokeBattle_Move_0C1 < PokeBattle_Move
  4588. def pbIsMultiHit
  4589. return true
  4590. end
  4591.  
  4592. def pbNumHits(attacker)
  4593. return @participants.length
  4594. end
  4595.  
  4596. def pbOnStartUse(attacker)
  4597. party=@battle.pbParty(attacker.index)
  4598. @participants=[]
  4599. for i in 0...party.length
  4600. @participants.push(i) if party[i] && !party[i].isEgg? &&
  4601. party[i].hp>0 && party[i].status==0
  4602. end
  4603. if @participants.length==0
  4604. @battle.pbDisplay(_INTL("But it failed!"))
  4605. return false
  4606. end
  4607. return true
  4608. end
  4609.  
  4610. def pbBaseDamage(basedmg,attacker,opponent)
  4611. party=@battle.pbParty(attacker.index)
  4612. atk=party[@participants[0]].baseStats[1]
  4613. @participants[0]=nil; @participants.compact!
  4614. return 5+(atk/10)
  4615. end
  4616. end
  4617.  
  4618.  
  4619.  
  4620. ################################################################################
  4621. # Two turn attack. Attacks first turn, skips second turn (if successful).
  4622. ################################################################################
  4623. class PokeBattle_Move_0C2 < PokeBattle_Move
  4624. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4625. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4626. if opponent.damagestate.calcdamage>0
  4627. attacker.effects[PBEffects::HyperBeam]=2
  4628. attacker.currentMove=@id
  4629. end
  4630. return ret
  4631. end
  4632. end
  4633.  
  4634.  
  4635.  
  4636. ################################################################################
  4637. # Two turn attack. Skips first turn, attacks second turn.
  4638. ################################################################################
  4639. class PokeBattle_Move_0C3 < PokeBattle_Move
  4640. def pbTwoTurnAttack(attacker,checking=false)
  4641. @immediate=false
  4642. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4643. @immediate=true
  4644. if !checking
  4645. itemname=PBItems.getName(attacker.item)
  4646. attacker.pokemon.itemRecycle=attacker.item
  4647. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4648. attacker.item=0
  4649. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4650. end
  4651. end
  4652. return false if @immediate
  4653. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4654. end
  4655.  
  4656. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4657. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4658. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4659. @battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",attacker.pbThis))
  4660. end
  4661. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4662. return super
  4663. end
  4664. end
  4665.  
  4666.  
  4667.  
  4668. ################################################################################
  4669. # Two turn attack. Skips first turn, attacks second turn.
  4670. # Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
  4671. ################################################################################
  4672. class PokeBattle_Move_0C4 < PokeBattle_Move
  4673. def pbTwoTurnAttack(attacker,checking=false)
  4674. @immediate=false
  4675. if attacker.effects[PBEffects::TwoTurnAttack]==0
  4676. @immediate=true if @battle.pbWeather==PBWeather::SUNNYDAY
  4677. end
  4678. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4679. @immediate=true
  4680. if !checking
  4681. itemname=PBItems.getName(attacker.item)
  4682. attacker.pokemon.itemRecycle=attacker.item
  4683. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4684. attacker.item=0
  4685. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4686. end
  4687. end
  4688. return false if @immediate
  4689. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4690. end
  4691.  
  4692. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  4693. if @battle.pbWeather!=0 &&
  4694. @battle.pbWeather!=PBWeather::SUNNYDAY
  4695. return (damagemult*0.5).round
  4696. end
  4697. return damagemult
  4698. end
  4699.  
  4700. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4701. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4702. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4703. @battle.pbDisplay(_INTL("{1} took in sunlight!",attacker.pbThis))
  4704. end
  4705. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4706. return super
  4707. end
  4708. end
  4709.  
  4710.  
  4711.  
  4712.  
  4713. ################################################################################
  4714. # Two turn attack. Skips first turn, attacks second turn.
  4715. # May paralyze the target.
  4716. ################################################################################
  4717. class PokeBattle_Move_0C5 < PokeBattle_Move
  4718. def pbTwoTurnAttack(attacker,checking=false)
  4719. @immediate=false
  4720. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4721. @immediate=true
  4722. if !checking
  4723. itemname=PBItems.getName(attacker.item)
  4724. attacker.pokemon.itemRecycle=attacker.item
  4725. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4726. attacker.item=0
  4727. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4728. end
  4729. end
  4730. return false if @immediate
  4731. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4732. end
  4733.  
  4734. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4735. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4736. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4737. @battle.pbDisplay(_INTL("{1} became cloaked in a freezing light!",attacker.pbThis))
  4738. end
  4739. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4740. return super
  4741. end
  4742.  
  4743. def pbAdditionalEffect(attacker,opponent)
  4744. return false if !opponent.pbCanParalyze?(false)
  4745. opponent.pbParalyze(attacker)
  4746. @battle.pbDisplay(_INTL("{1} was paralyzed! It may be unable to move!",opponent.pbThis))
  4747. return true
  4748. end
  4749. end
  4750.  
  4751.  
  4752.  
  4753. ################################################################################
  4754. # Two turn attack. Skips first turn, attacks second turn.
  4755. # May burn the target.
  4756. ################################################################################
  4757. class PokeBattle_Move_0C6 < PokeBattle_Move
  4758. def pbTwoTurnAttack(attacker,checking=false)
  4759. @immediate=false
  4760. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4761. @immediate=true
  4762. if !checking
  4763. itemname=PBItems.getName(attacker.item)
  4764. attacker.pokemon.itemRecycle=attacker.item
  4765. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4766. attacker.item=0
  4767. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4768. end
  4769. end
  4770. return false if @immediate
  4771. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4772. end
  4773.  
  4774. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4775. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4776. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4777. @battle.pbDisplay(_INTL("{1} became cloaked in freezing air!",attacker.pbThis))
  4778. end
  4779. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4780. return super
  4781. end
  4782.  
  4783. def pbAdditionalEffect(attacker,opponent)
  4784. return false if !opponent.pbCanBurn?(false)
  4785. opponent.pbBurn(attacker)
  4786. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  4787. return true
  4788. end
  4789. end
  4790.  
  4791.  
  4792.  
  4793. ################################################################################
  4794. # Two turn attack. Skips first turn, attacks second turn.
  4795. # May make the target flinch.
  4796. ################################################################################
  4797. class PokeBattle_Move_0C7 < PokeBattle_Move
  4798. def pbTwoTurnAttack(attacker,checking=false)
  4799. @immediate=false
  4800. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4801. @immediate=true
  4802. if !checking
  4803. itemname=PBItems.getName(attacker.item)
  4804. attacker.pokemon.itemRecycle=attacker.item
  4805. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4806. attacker.item=0
  4807. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4808. end
  4809. end
  4810. return false if @immediate
  4811. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4812. end
  4813.  
  4814. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4815. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4816. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4817. @battle.pbDisplay(_INTL("{1} is glowing!",attacker.pbThis))
  4818. end
  4819. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4820. return super
  4821. end
  4822.  
  4823. def pbAdditionalEffect(attacker,opponent)
  4824. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  4825. opponent.effects[PBEffects::Substitute]==0
  4826. opponent.effects[PBEffects::Flinch]=true
  4827. return true
  4828. end
  4829. return false
  4830. end
  4831. end
  4832.  
  4833.  
  4834.  
  4835. ################################################################################
  4836. # Two turn attack. Ups user's Defence by 1 stage first turn, attacks second turn.
  4837. ################################################################################
  4838. class PokeBattle_Move_0C8 < PokeBattle_Move
  4839. def pbTwoTurnAttack(attacker,checking=false)
  4840. @immediate=false
  4841. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4842. @immediate=true
  4843. if !checking
  4844. itemname=PBItems.getName(attacker.item)
  4845. attacker.pokemon.itemRecycle=attacker.item
  4846. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4847. attacker.item=0
  4848. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4849. end
  4850. end
  4851. return false if @immediate
  4852. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4853. end
  4854.  
  4855. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4856. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4857. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4858. @battle.pbDisplay(_INTL("{1} lowered its head!",attacker.pbThis))
  4859. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  4860. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false)
  4861. end
  4862. end
  4863. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4864. return super
  4865. end
  4866. end
  4867.  
  4868.  
  4869.  
  4870. ################################################################################
  4871. # Two turn attack. Skips first turn, attacks second turn. (Fly)
  4872. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  4873. ################################################################################
  4874. class PokeBattle_Move_0C9 < PokeBattle_Move
  4875. def pbMoveFailed(attacker,opponent)
  4876. return @battle.field.effects[PBEffects::Gravity]>0
  4877. end
  4878.  
  4879. def pbTwoTurnAttack(attacker,checking=false)
  4880. @immediate=false
  4881. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4882. @immediate=true
  4883. if !checking
  4884. itemname=PBItems.getName(attacker.item)
  4885. attacker.pokemon.itemRecycle=attacker.item
  4886. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4887. attacker.item=0
  4888. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4889. end
  4890. end
  4891. return false if @immediate
  4892. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4893. end
  4894.  
  4895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4896. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4897. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4898. @battle.pbDisplay(_INTL("{1} flew up high!",attacker.pbThis))
  4899. end
  4900. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4901. return super
  4902. end
  4903. end
  4904.  
  4905.  
  4906.  
  4907. ################################################################################
  4908. # Two turn attack. Skips first turn, attacks second turn. (Dig)
  4909. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  4910. ################################################################################
  4911. class PokeBattle_Move_0CA < PokeBattle_Move
  4912. def pbTwoTurnAttack(attacker,checking=false)
  4913. @immediate=false
  4914. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4915. @immediate=true
  4916. if !checking
  4917. itemname=PBItems.getName(attacker.item)
  4918. attacker.pokemon.itemRecycle=attacker.item
  4919. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4920. attacker.item=0
  4921. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4922. end
  4923. end
  4924. return false if @immediate
  4925. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4926. end
  4927.  
  4928. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4929. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4930. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4931. @battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",attacker.pbThis))
  4932. end
  4933. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4934. return super
  4935. end
  4936. end
  4937.  
  4938.  
  4939.  
  4940. ################################################################################
  4941. # Two turn attack. Skips first turn, attacks second turn. (Dive)
  4942. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  4943. ################################################################################
  4944. class PokeBattle_Move_0CB < PokeBattle_Move
  4945. def pbTwoTurnAttack(attacker,checking=false)
  4946. @immediate=false
  4947. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4948. @immediate=true
  4949. if !checking
  4950. itemname=PBItems.getName(attacker.item)
  4951. attacker.pokemon.itemRecycle=attacker.item
  4952. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4953. attacker.item=0
  4954. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4955. end
  4956. end
  4957. return false if @immediate
  4958. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4959. end
  4960.  
  4961. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4962. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4963. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4964. @battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
  4965. end
  4966. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4967. return super
  4968. end
  4969. end
  4970.  
  4971.  
  4972.  
  4973. ################################################################################
  4974. # Two turn attack. Skips first turn, attacks second turn. (Bounce)
  4975. # May paralyze the target.
  4976. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  4977. ################################################################################
  4978. class PokeBattle_Move_0CC < PokeBattle_Move
  4979. def pbMoveFailed(attacker,opponent)
  4980. return @battle.field.effects[PBEffects::Gravity]>0
  4981. end
  4982.  
  4983. def pbTwoTurnAttack(attacker,checking=false)
  4984. @immediate=false
  4985. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4986. @immediate=true
  4987. if !checking
  4988. itemname=PBItems.getName(attacker.item)
  4989. attacker.pokemon.itemRecycle=attacker.item
  4990. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  4991. attacker.item=0
  4992. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  4993. end
  4994. end
  4995. return false if @immediate
  4996. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4997. end
  4998.  
  4999. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5000. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5001. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5002. @battle.pbDisplay(_INTL("{1} sprang up!",attacker.pbThis))
  5003. end
  5004. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5005. return super
  5006. end
  5007.  
  5008. def pbAdditionalEffect(attacker,opponent)
  5009. return false if !opponent.pbCanParalyze?(false)
  5010. opponent.pbParalyze(attacker)
  5011. @battle.pbDisplay(_INTL("{1} was paralyzed! It may be unable to move!",opponent.pbThis))
  5012. return true
  5013. end
  5014. end
  5015.  
  5016.  
  5017.  
  5018. ################################################################################
  5019. # Two turn attack. Skips first turn, attacks second turn. (Shadow Force)
  5020. # Is invulnerable during use.
  5021. # If successful, negates target's Detect and Protect this round.
  5022. ################################################################################
  5023. class PokeBattle_Move_0CD < PokeBattle_Move
  5024. def pbTwoTurnAttack(attacker,checking=false)
  5025. @immediate=false
  5026. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  5027. @immediate=true
  5028. if !checking
  5029. itemname=PBItems.getName(attacker.item)
  5030. attacker.pokemon.itemRecycle=attacker.item
  5031. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  5032. attacker.item=0
  5033. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  5034. end
  5035. end
  5036. return false if @immediate
  5037. return attacker.effects[PBEffects::TwoTurnAttack]==0
  5038. end
  5039.  
  5040. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5041. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  5042. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  5043. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  5044. end
  5045. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  5046. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5047. opponent.effects[PBEffects::ProtectNegation]=true if ret>0
  5048. return ret
  5049. end
  5050. end
  5051.  
  5052.  
  5053.  
  5054. ################################################################################
  5055. # Two turn attack. Skips first turn, attacks second turn. (Sky Drop)
  5056. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  5057. # Target is also semi-invulnerable during use, and can't take any action.
  5058. # Doesn't damage airborne Pokémon (but still makes them unable to move during).
  5059. ################################################################################
  5060. class PokeBattle_Move_0CE < PokeBattle_UnimplementedMove
  5061. def pbMoveFailed(attacker,opponent)
  5062. return @battle.field.effects[PBEffects::Gravity]>0
  5063. end
  5064.  
  5065. # Not implemented yet.
  5066. end
  5067.  
  5068.  
  5069.  
  5070. ################################################################################
  5071. # Trapping move. Traps for 4 or 5 rounds. Trapped Pokémon lose 1/16 of max HP
  5072. # at end of each round.
  5073. ################################################################################
  5074. class PokeBattle_Move_0CF < PokeBattle_Move
  5075. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5076. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5077. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  5078. !opponent.damagestate.substitute
  5079. if opponent.effects[PBEffects::MultiTurn]==0
  5080. opponent.effects[PBEffects::MultiTurn]=4+@battle.pbRandom(2)
  5081. opponent.effects[PBEffects::MultiTurn]=5 if attacker.hasWorkingItem(:GRIPCLAW)
  5082. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5083. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5084. if isConst?(@id,PBMoves,:BIND)
  5085. @battle.pbDisplay(_INTL("{1} was squeezed by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5086. elsif isConst?(@id,PBMoves,:CLAMP)
  5087. @battle.pbDisplay(_INTL("{1} clamped {2}!",attacker.pbThis,opponent.pbThis(true)))
  5088. elsif isConst?(@id,PBMoves,:FIRESPIN)
  5089. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5090. elsif isConst?(@id,PBMoves,:MAGMASTORM)
  5091. @battle.pbDisplay(_INTL("{1} was trapped by Magma Storm!",opponent.pbThis))
  5092. elsif isConst?(@id,PBMoves,:SANDTOMB)
  5093. @battle.pbDisplay(_INTL("{1} was trapped by Sand Tomb!",opponent.pbThis))
  5094. elsif isConst?(@id,PBMoves,:WRAP)
  5095. @battle.pbDisplay(_INTL("{1} was wrapped by {2}!",opponent.pbThis,attacker.pbThis(true)))
  5096. else
  5097. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5098. end
  5099. end
  5100. end
  5101. return ret
  5102. end
  5103. end
  5104.  
  5105.  
  5106.  
  5107. ################################################################################
  5108. # Trapping move. Traps for 4 or 5 rounds. Trapped Pokémon lose 1/16 of max HP
  5109. # at end of each round.
  5110. # Power is doubled if target is using Dive.
  5111. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  5112. ################################################################################
  5113. class PokeBattle_Move_0D0 < PokeBattle_Move
  5114. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5115. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5116. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  5117. !opponent.damagestate.substitute
  5118. if opponent.effects[PBEffects::MultiTurn]==0
  5119. opponent.effects[PBEffects::MultiTurn]=4+@battle.pbRandom(2)
  5120. opponent.effects[PBEffects::MultiTurn]=5 if attacker.hasWorkingItem(:GRIPCLAW)
  5121. opponent.effects[PBEffects::MultiTurnAttack]=@id
  5122. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  5123. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  5124. end
  5125. end
  5126. return ret
  5127. end
  5128.  
  5129. def pbModifyDamage(damagemult,attacker,opponent)
  5130. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  5131. return (damagemult*2.0).round
  5132. end
  5133. return damagemult
  5134. end
  5135. end
  5136.  
  5137.  
  5138.  
  5139. ################################################################################
  5140. # User must use this move for 2 more rounds. No battlers can sleep.
  5141. ################################################################################
  5142. class PokeBattle_Move_0D1 < PokeBattle_Move
  5143. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5144. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5145. if opponent.damagestate.calcdamage>0
  5146. if attacker.effects[PBEffects::Uproar]==0
  5147. attacker.effects[PBEffects::Uproar]=3
  5148. @battle.pbDisplay(_INTL("{1} caused an uproar!",attacker.pbThis))
  5149. attacker.currentMove=@id
  5150. end
  5151. end
  5152. return ret
  5153. end
  5154. end
  5155.  
  5156.  
  5157.  
  5158. ################################################################################
  5159. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  5160. ################################################################################
  5161. class PokeBattle_Move_0D2 < PokeBattle_Move
  5162. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5163. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5164. if opponent.damagestate.calcdamage>0 &&
  5165. attacker.effects[PBEffects::Outrage]==0 &&
  5166. attacker.status!=PBStatuses::SLEEP #TODO: Not likely what actually happens, but good enough
  5167. attacker.effects[PBEffects::Outrage]=2+@battle.pbRandom(2)
  5168. attacker.currentMove=@id
  5169. elsif pbTypeModifier(@type,attacker,opponent)==0
  5170. # Cancel effect if attack is ineffective
  5171. attacker.effects[PBEffects::Outrage]=0
  5172. end
  5173. if attacker.effects[PBEffects::Outrage]>0
  5174. attacker.effects[PBEffects::Outrage]-=1
  5175. if attacker.effects[PBEffects::Outrage]==0 && attacker.pbCanConfuseSelf?(false)
  5176. attacker.effects[PBEffects::Confusion]=2+@battle.pbRandom(4)
  5177. @battle.pbCommonAnimation("Confusion",attacker,nil)
  5178. @battle.pbDisplay(_INTL("{1} became confused due to fatigue!",attacker.pbThis))
  5179. end
  5180. end
  5181. return ret
  5182. end
  5183. end
  5184.  
  5185.  
  5186.  
  5187. ################################################################################
  5188. # User must use this move for 4 more rounds. Power doubles each round.
  5189. # Power is also doubled if user has curled up.
  5190. ################################################################################
  5191. class PokeBattle_Move_0D3 < PokeBattle_Move
  5192. def pbBaseDamage(basedmg,attacker,opponent)
  5193. shift=(4-attacker.effects[PBEffects::Rollout]) # from 0 through 4, 0 is most powerful
  5194. shift+=1 if attacker.effects[PBEffects::DefenseCurl]
  5195. basedmg=basedmg<<shift
  5196. return basedmg
  5197. end
  5198.  
  5199. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5200. attacker.effects[PBEffects::Rollout]=5 if attacker.effects[PBEffects::Rollout]==0
  5201. attacker.effects[PBEffects::Rollout]-=1
  5202. attacker.currentMove=thismove.id
  5203. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5204. if opponent.damagestate.calcdamage==0 ||
  5205. pbTypeModifier(@type,attacker,opponent)==0 ||
  5206. attacker.status==PBStatuses::SLEEP #TODO: Not likely what actually happens, but good enough
  5207. # Cancel effect if attack is ineffective
  5208. attacker.effects[PBEffects::Rollout]=0
  5209. end
  5210. return ret
  5211. end
  5212. end
  5213.  
  5214.  
  5215.  
  5216. ################################################################################
  5217. # User bides its time this round and next round. The round after, deals 2x the
  5218. # total damage it took while biding to the last battler that damaged it.
  5219. ################################################################################
  5220. class PokeBattle_Move_0D4 < PokeBattle_Move
  5221. def pbDisplayUseMessage(attacker)
  5222. if attacker.effects[PBEffects::Bide]==0
  5223. @battle.pbDisplayBrief(_INTL("{1} used\r\n{2}!",attacker.pbThis,name))
  5224. attacker.effects[PBEffects::Bide]=2
  5225. attacker.effects[PBEffects::BideDamage]=0
  5226. attacker.effects[PBEffects::BideTarget]=-1
  5227. attacker.currentMove=@id
  5228. pbShowAnimation(@id,attacker,nil)
  5229. return 1
  5230. else
  5231. attacker.effects[PBEffects::Bide]-=1
  5232. if attacker.effects[PBEffects::Bide]==0
  5233. @battle.pbDisplayBrief(_INTL("{1} unleashed energy!",attacker.pbThis))
  5234. return 0
  5235. else
  5236. @battle.pbDisplayBrief(_INTL("{1} is storing energy!",attacker.pbThis))
  5237. return 2
  5238. end
  5239. end
  5240. end
  5241.  
  5242. def pbAddTarget(targets,attacker)
  5243. if attacker.effects[PBEffects::BideTarget]>=0
  5244. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::BideTarget]])
  5245. attacker.pbRandomTarget(targets)
  5246. end
  5247. end
  5248. end
  5249.  
  5250. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5251. if attacker.effects[PBEffects::BideDamage]==0 || !opponent
  5252. @battle.pbDisplay(_INTL("But it failed!"))
  5253. return -1
  5254. end
  5255. ret=pbEffectFixedDamage(attacker.effects[PBEffects::BideDamage]*2,attacker,opponent,hitnum,alltargets,showanimation)
  5256. attacker.effects[PBEffects::BideDamage]=0
  5257. return ret
  5258. end
  5259. end
  5260.  
  5261.  
  5262.  
  5263. ################################################################################
  5264. # Heals user by 1/2 of its max HP.
  5265. ################################################################################
  5266. class PokeBattle_Move_0D5 < PokeBattle_Move
  5267. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5268. if attacker.hp==attacker.totalhp
  5269. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5270. return -1
  5271. end
  5272. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5273. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5274. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5275. return 0
  5276. end
  5277. end
  5278.  
  5279.  
  5280.  
  5281. ################################################################################
  5282. # Heals user by 1/2 of its max HP.
  5283. # User roosts, and its Flying type is ignored for attacks used against it.
  5284. ################################################################################
  5285. class PokeBattle_Move_0D6 < PokeBattle_Move
  5286. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5287. if attacker.hp==attacker.totalhp
  5288. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5289. return -1
  5290. end
  5291. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5292. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  5293. attacker.effects[PBEffects::Roost]=true
  5294. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5295. return 0
  5296. end
  5297. end
  5298.  
  5299.  
  5300.  
  5301. ################################################################################
  5302. # Battler in user's position is healed by 1/2 of its max HP, at the end of the
  5303. # next round.
  5304. ################################################################################
  5305. class PokeBattle_Move_0D7 < PokeBattle_Move
  5306. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5307. if attacker.effects[PBEffects::Wish]>0
  5308. @battle.pbDisplay(_INTL("But it failed!"))
  5309. return -1
  5310. end
  5311. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5312. attacker.effects[PBEffects::Wish]=2
  5313. attacker.effects[PBEffects::WishAmount]=((attacker.totalhp+1)/2).floor
  5314. attacker.effects[PBEffects::WishMaker]=attacker.pokemonIndex
  5315. return 0
  5316. end
  5317. end
  5318.  
  5319.  
  5320.  
  5321. ################################################################################
  5322. # Heals user by an amount depending on the weather.
  5323. ################################################################################
  5324. class PokeBattle_Move_0D8 < PokeBattle_Move
  5325. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5326. if attacker.hp==attacker.totalhp
  5327. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5328. return -1
  5329. end
  5330. hpgain=0
  5331. if @battle.pbWeather==PBWeather::SUNNYDAY
  5332. hpgain=(attacker.totalhp*2/3).floor
  5333. elsif @battle.pbWeather!=0
  5334. hpgain=(attacker.totalhp/4).floor
  5335. else
  5336. hpgain=(attacker.totalhp/2).floor
  5337. end
  5338. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5339. attacker.pbRecoverHP(hpgain,true)
  5340. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5341. return 0
  5342. end
  5343. end
  5344.  
  5345.  
  5346.  
  5347. ################################################################################
  5348. # Heals user to full HP. User falls asleep for 2 more rounds.
  5349. ################################################################################
  5350. class PokeBattle_Move_0D9 < PokeBattle_Move
  5351. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5352. if !attacker.pbCanSleep?(true,true,true)
  5353. return -1
  5354. end
  5355. if attacker.hp==attacker.totalhp
  5356. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  5357. return -1
  5358. end
  5359. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5360. attacker.pbSleepSelf(3)
  5361. @battle.pbDisplay(_INTL("{1} slept and became healthy!",attacker.pbThis))
  5362. hp=attacker.pbRecoverHP(attacker.totalhp-attacker.hp,true)
  5363. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis)) if hp>0
  5364. return 0
  5365. end
  5366. end
  5367.  
  5368.  
  5369.  
  5370. ################################################################################
  5371. # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
  5372. ################################################################################
  5373. class PokeBattle_Move_0DA < PokeBattle_Move
  5374. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5375. if attacker.effects[PBEffects::AquaRing]
  5376. @battle.pbDisplay(_INTL("But it failed!"))
  5377. return -1
  5378. end
  5379. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5380. attacker.effects[PBEffects::AquaRing]=true
  5381. @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
  5382. return 0
  5383. end
  5384. end
  5385.  
  5386.  
  5387.  
  5388. ################################################################################
  5389. # Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
  5390. # round, and cannot flee or switch out.
  5391. ################################################################################
  5392. class PokeBattle_Move_0DB < PokeBattle_Move
  5393. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5394. if attacker.effects[PBEffects::Ingrain]
  5395. @battle.pbDisplay(_INTL("But it failed!"))
  5396. return -1
  5397. end
  5398. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5399. attacker.effects[PBEffects::Ingrain]=true
  5400. @battle.pbDisplay(_INTL("{1} planted its roots!",attacker.pbThis))
  5401. return 0
  5402. end
  5403. end
  5404.  
  5405.  
  5406.  
  5407. ################################################################################
  5408. # Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each
  5409. # round, and the Pokémon in the user's position gains the same amount.
  5410. ################################################################################
  5411. class PokeBattle_Move_0DC < PokeBattle_Move
  5412. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5413. if opponent.effects[PBEffects::LeechSeed]>=0 ||
  5414. opponent.effects[PBEffects::Substitute]>0
  5415. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  5416. return -1
  5417. end
  5418. if opponent.pbHasType?(:GRASS)
  5419. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  5420. return -1
  5421. end
  5422. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5423. opponent.effects[PBEffects::LeechSeed]=attacker.index
  5424. @battle.pbDisplay(_INTL("{1} was seeded!",opponent.pbThis))
  5425. return 0
  5426. end
  5427. end
  5428.  
  5429.  
  5430.  
  5431. ################################################################################
  5432. # User gains half the HP it inflicts as damage.
  5433. ################################################################################
  5434. class PokeBattle_Move_0DD < PokeBattle_Move
  5435. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5436. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5437. if opponent.damagestate.calcdamage>0
  5438. hpgain=((opponent.damagestate.hplost+1)/2).floor
  5439. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  5440. attacker.pbReduceHP(hpgain,true)
  5441. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  5442. elsif attacker.effects[PBEffects::HealBlock]==0
  5443. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  5444. attacker.pbRecoverHP(hpgain,true)
  5445. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  5446. end
  5447. end
  5448. return ret
  5449. end
  5450. end
  5451.  
  5452.  
  5453.  
  5454. ################################################################################
  5455. # User gains half the HP it inflicts as damage.
  5456. # (Handled in Battler's pbSuccessCheck): Fails if target is not asleep.
  5457. ################################################################################
  5458. class PokeBattle_Move_0DE < PokeBattle_Move
  5459. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5460. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5461. if opponent.damagestate.calcdamage>0
  5462. hpgain=((opponent.damagestate.hplost+1)/2).floor
  5463. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  5464. attacker.pbRecoverHP(hpgain,true) if attacker.effects[PBEffects::HealBlock]==0
  5465. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  5466. end
  5467. return ret
  5468. end
  5469. end
  5470.  
  5471.  
  5472.  
  5473. ################################################################################
  5474. # Heals target by 1/2 of its max HP.
  5475. ################################################################################
  5476. class PokeBattle_Move_0DF < PokeBattle_Move
  5477. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5478. if opponent.effects[PBEffects::Substitute]>0
  5479. @battle.pbDisplay(_INTL("But it failed!"))
  5480. return -1
  5481. end
  5482. if opponent.hp==opponent.totalhp
  5483. @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
  5484. return -1
  5485. end
  5486. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5487. hpgain=((opponent.totalhp+1)/2).floor
  5488. opponent.pbRecoverHP(hpgain,true)
  5489. @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
  5490. return 0
  5491. end
  5492. end
  5493.  
  5494.  
  5495.  
  5496. ################################################################################
  5497. # User faints.
  5498. ################################################################################
  5499. class PokeBattle_Move_0E0 < PokeBattle_Move
  5500. def pbOnStartUse(attacker)
  5501. bearer=@battle.pbCheckGlobalAbility(:DAMP)
  5502. if bearer
  5503. @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  5504. bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  5505. return false
  5506. end
  5507. @battle.pbAnimation(@id,attacker,nil)
  5508. pbShowAnimation(@id,attacker,nil)
  5509. attacker.pbReduceHP(attacker.hp)
  5510. return true
  5511. end
  5512.  
  5513. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5514. return
  5515. end
  5516. end
  5517.  
  5518.  
  5519.  
  5520. ################################################################################
  5521. # Inflicts fixed damage equal to user's current HP.
  5522. # User faints (if successful).
  5523. ################################################################################
  5524. class PokeBattle_Move_0E1 < PokeBattle_UnimplementedMove
  5525. # Not implemented yet.
  5526. end
  5527.  
  5528.  
  5529.  
  5530. ################################################################################
  5531. # Decreases the target's Attack and Special Attack by 2 stages each.
  5532. # User faints (even if effect does nothing).
  5533. ################################################################################
  5534. class PokeBattle_Move_0E2 < PokeBattle_Move
  5535. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5536. ret=-1; prevented=false
  5537. if opponent.effects[PBEffects::Protect] &&
  5538. !opponent.effects[PBEffects::ProtectNegation]
  5539. @battle.pbDisplay(_INTL("{1} protected itself!",opponent.pbThis))
  5540. @battle.successStates[attacker.index].protected=true
  5541. prevented=true
  5542. end
  5543. if !prevented && opponent.effects[PBEffects::Substitute]>0
  5544. @battle.pbDisplay(_INTL("But it had no effect!"))
  5545. prevented=true
  5546. end
  5547. if !prevented && opponent.pbOwnSide.effects[PBEffects::Mist]>0
  5548. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  5549. prevented=true
  5550. end
  5551. if !prevented && (opponent.hasWorkingAbility(:CLEARBODY) ||
  5552. opponent.hasWorkingAbility(:WHITESMOKE))
  5553. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  5554. PBAbilities.getName(opponent.ability)))
  5555. prevented=true
  5556. end
  5557. if !prevented && opponent.pbTooLow?(PBStats::ATTACK) &&
  5558. opponent.pbTooLow?(PBStats::SPATK)
  5559. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  5560. prevented=true
  5561. end
  5562. if !prevented
  5563. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5564. showanim=true
  5565. if opponent.pbReduceStat(PBStats::ATTACK,2,false,showanim)
  5566. ret=0; showanim=false
  5567. end
  5568. if opponent.pbReduceStat(PBStats::SPATK,2,false,showanim)
  5569. ret=0; showanim=false
  5570. end
  5571. end
  5572. attacker.pbReduceHP(attacker.hp) # User still faints even if protected by above effects
  5573. return ret
  5574. end
  5575. end
  5576.  
  5577.  
  5578.  
  5579. ################################################################################
  5580. # User faints. The Pokémon that replaces the user is fully healed (HP and
  5581. # status). Fails if user won't be replaced.
  5582. ################################################################################
  5583. class PokeBattle_Move_0E3 < PokeBattle_Move
  5584. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5585. if !@battle.pbCanChooseNonActive?(attacker.index)
  5586. @battle.pbDisplay(_INTL("But it failed!"))
  5587. return -1
  5588. end
  5589. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5590. attacker.pbReduceHP(attacker.hp)
  5591. attacker.effects[PBEffects::HealingWish]=true
  5592. return 0
  5593. end
  5594. end
  5595.  
  5596.  
  5597.  
  5598. ################################################################################
  5599. # User faints. The Pokémon that replaces the user is fully healed (HP, PP and
  5600. # status). Fails if user won't be replaced.
  5601. ################################################################################
  5602. class PokeBattle_Move_0E4 < PokeBattle_Move
  5603. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5604. if !@battle.pbCanChooseNonActive?(attacker.index)
  5605. @battle.pbDisplay(_INTL("But it failed!"))
  5606. return -1
  5607. end
  5608. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5609. attacker.pbReduceHP(attacker.hp)
  5610. attacker.effects[PBEffects::LunarDance]=true
  5611. return 0
  5612. end
  5613. end
  5614.  
  5615.  
  5616.  
  5617. ################################################################################
  5618. # All current battlers will perish after 3 more rounds.
  5619. ################################################################################
  5620. class PokeBattle_Move_0E5 < PokeBattle_Move
  5621. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5622. failed=true
  5623. for i in 0...4
  5624. if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
  5625. !@battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  5626. failed=false; break
  5627. end
  5628. end
  5629. if failed
  5630. @battle.pbDisplay(_INTL("But it failed!"))
  5631. return -1
  5632. end
  5633. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5634. @battle.pbDisplay(_INTL("All Pokémon hearing the song will faint in three turns!"))
  5635. for i in 0...4
  5636. if @battle.battlers[i].effects[PBEffects::PerishSong]==0
  5637. if @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  5638. @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
  5639. PBAbilities.getName(@battle.battlers[i].ability),@name))
  5640. else
  5641. @battle.battlers[i].effects[PBEffects::PerishSong]=4
  5642. @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
  5643. end
  5644. end
  5645. end
  5646. return 0
  5647. end
  5648. end
  5649.  
  5650.  
  5651.  
  5652. ################################################################################
  5653. # If user is KO'd before it next moves, the attack that caused it loses all PP.
  5654. ################################################################################
  5655. class PokeBattle_Move_0E6 < PokeBattle_Move
  5656. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5657. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5658. attacker.effects[PBEffects::Grudge]=true
  5659. @battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",attacker.pbThis))
  5660. return 0
  5661. end
  5662. end
  5663.  
  5664.  
  5665.  
  5666. ################################################################################
  5667. # If user is KO'd before it next moves, the battler that caused it also faints.
  5668. ################################################################################
  5669. class PokeBattle_Move_0E7 < PokeBattle_Move
  5670. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5671. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5672. attacker.effects[PBEffects::DestinyBond]=true
  5673. @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
  5674. return 0
  5675. end
  5676. end
  5677.  
  5678.  
  5679.  
  5680. ################################################################################
  5681. # If user would be KO'd this round, it survives with 1HP instead.
  5682. ################################################################################
  5683. class PokeBattle_Move_0E8 < PokeBattle_Move
  5684. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5685. # TODO: Fails if attack strikes last
  5686. ratesharers=[
  5687. 0xAA, # Detect, Protect
  5688. 0xAB, # Quick Guard
  5689. 0xAC, # Wide Guard
  5690. 0xE8 # Endure
  5691. ]
  5692. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  5693. attacker.effects[PBEffects::ProtectRate]=1
  5694. end
  5695. if @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  5696. attacker.effects[PBEffects::ProtectRate]=1
  5697. @battle.pbDisplay(_INTL("But it failed!"))
  5698. return -1
  5699. end
  5700. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5701. attacker.effects[PBEffects::Endure]=true
  5702. attacker.effects[PBEffects::ProtectRate]*=2
  5703. @battle.pbDisplay(_INTL("{1} braced itself!",attacker.pbThis))
  5704. return 0
  5705. end
  5706. end
  5707.  
  5708.  
  5709.  
  5710. ################################################################################
  5711. # If target would be KO'd by this attack, it survives with 1HP instead.
  5712. ################################################################################
  5713. class PokeBattle_Move_0E9 < PokeBattle_Move
  5714. # Handled in superclass, do not edit!
  5715. end
  5716.  
  5717.  
  5718.  
  5719. ################################################################################
  5720. # User flees from battle. Fails in trainer battles.
  5721. ################################################################################
  5722. class PokeBattle_Move_0EA < PokeBattle_Move
  5723. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5724. if @battle.opponent
  5725. @battle.pbDisplay(_INTL("But it failed!"))
  5726. return -1
  5727. elsif @battle.pbCanRun?(attacker.index)
  5728. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5729. @battle.pbDisplay(_INTL("{1} fled from battle!",attacker.pbThis))
  5730. @battle.decision=3
  5731. return 0
  5732. else
  5733. @battle.pbDisplay(_INTL("But it failed!"))
  5734. return -1
  5735. end
  5736. end
  5737. end
  5738.  
  5739.  
  5740.  
  5741. ################################################################################
  5742. # Target flees from battle. In trainer battles, target switches out instead.
  5743. # Fails if target is a higher level than the user. For status moves.
  5744. ################################################################################
  5745. class PokeBattle_Move_0EB < PokeBattle_Move
  5746. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5747. if opponent.hasWorkingAbility(:SUCTIONCUPS)
  5748. @battle.pbDisplay(_INTL("{1} anchored itself with {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  5749. return -1
  5750. end
  5751. if opponent.effects[PBEffects::Ingrain]
  5752. @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",opponent.pbThis))
  5753. return -1
  5754. end
  5755. if !@battle.opponent
  5756. if opponent.level>=attacker.level
  5757. @battle.pbDisplay(_INTL("But it failed!"))
  5758. return -1
  5759. end
  5760. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5761. @battle.decision=3 # Set decision to escaped
  5762. return 0
  5763. else
  5764. choices=[]
  5765. party=@battle.pbParty(opponent.index)
  5766. for i in 0...party.length
  5767. choices[choices.length]=i if @battle.pbCanSwitchLax?(opponent.index,i,false)
  5768. end
  5769. if choices.length==0
  5770. @battle.pbDisplay(_INTL("But it failed!"))
  5771. return -1
  5772. end
  5773. newpoke=choices[@battle.pbRandom(choices.length)]
  5774. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5775. opponent.pbResetForm
  5776. @battle.pbReplace(opponent.index,newpoke,false)
  5777. @battle.pbDisplay(_INTL("{1} was dragged out!",opponent.pbThis))
  5778. @battle.pbOnActiveOne(opponent)
  5779. opponent.pbAbilitiesOnSwitchIn(true)
  5780. return 0
  5781. end
  5782. end
  5783. end
  5784.  
  5785.  
  5786.  
  5787. ################################################################################
  5788. # Target flees from battle. In trainer battles, target switches out instead.
  5789. # Fails if target is a higher level than the user. For damaging moves.
  5790. ################################################################################
  5791. class PokeBattle_Move_0EC < PokeBattle_Move
  5792. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5793. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5794. if !attacker.isFainted? && !opponent.isFainted? &&
  5795. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  5796. !opponent.hasWorkingAbility(:SUCTIONCUPS) &&
  5797. !opponent.effects[PBEffects::Ingrain]
  5798. if !@battle.opponent
  5799. if opponent.level<attacker.level
  5800. @battle.decision=3 # Set decision to escaped
  5801. end
  5802. else
  5803. choices=[]
  5804. party=@battle.pbParty(opponent.index)
  5805. for i in 0..party.length-1
  5806. choices[choices.length]=i if @battle.pbCanSwitchLax?(opponent.index,i,false)
  5807. end
  5808. if choices.length>0
  5809. newpoke=choices[@battle.pbRandom(choices.length)]
  5810. opponent.pbResetForm
  5811. @battle.pbReplace(opponent.index,newpoke,false)
  5812. @battle.pbDisplay(_INTL("{1} was dragged out!",opponent.pbThis))
  5813. @battle.pbOnActiveOne(opponent)
  5814. opponent.pbAbilitiesOnSwitchIn(true)
  5815. end
  5816. end
  5817. end
  5818. return ret
  5819. end
  5820. end
  5821.  
  5822.  
  5823.  
  5824. ################################################################################
  5825. # User switches out. Various effects affecting the user are passed to the
  5826. # replacement.
  5827. ################################################################################
  5828. class PokeBattle_Move_0ED < PokeBattle_Move
  5829. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5830. if !@battle.pbCanChooseNonActive?(attacker.index)
  5831. @battle.pbDisplay(_INTL("But it failed!"))
  5832. return -1
  5833. end
  5834. newpoke=0
  5835. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5836. newpoke=@battle.pbSwitchInBetween(attacker.index,true,false)
  5837. @battle.pbMessagesOnReplace(attacker.index,newpoke)
  5838. attacker.pbResetForm
  5839. @battle.pbReplace(attacker.index,newpoke,true)
  5840. @battle.pbOnActiveOne(attacker)
  5841. attacker.pbAbilitiesOnSwitchIn(true)
  5842. return 0
  5843. end
  5844. end
  5845.  
  5846.  
  5847.  
  5848. ################################################################################
  5849. # After inflicting damage, user switches out. Ignores trapping moves.
  5850. ################################################################################
  5851. class PokeBattle_Move_0EE < PokeBattle_Move
  5852. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5853. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5854. if !attacker.isFainted? && @battle.pbCanChooseNonActive?(attacker.index) &&
  5855. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  5856. # TODO: Pursuit should go here, and negate this effect if it KO's attacker
  5857. @battle.pbDisplay(_INTL("{1} went back to {2}!",attacker.pbThis,@battle.pbGetOwner(attacker.index).name))
  5858. newpoke=0
  5859. newpoke=@battle.pbSwitchInBetween(attacker.index,true,false)
  5860. @battle.pbMessagesOnReplace(attacker.index,newpoke)
  5861. attacker.pbResetForm
  5862. @battle.pbReplace(attacker.index,newpoke,true)
  5863. @battle.pbOnActiveOne(attacker)
  5864. attacker.pbAbilitiesOnSwitchIn(true)
  5865. end
  5866. return ret
  5867. end
  5868. end
  5869.  
  5870.  
  5871.  
  5872. ################################################################################
  5873. # Target can no longer switch out or flee, as long as the user remains active.
  5874. ################################################################################
  5875. class PokeBattle_Move_0EF < PokeBattle_Move
  5876. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5877. if opponent.effects[PBEffects::MeanLook]>=0 ||
  5878. opponent.effects[PBEffects::Substitute]>0
  5879. @battle.pbDisplay(_INTL("But it failed!"))
  5880. return -1
  5881. end
  5882. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5883. opponent.effects[PBEffects::MeanLook]=attacker.index
  5884. @battle.pbDisplay(_INTL("{1} can't escape now!",opponent.pbThis))
  5885. return 0
  5886. end
  5887. end
  5888.  
  5889.  
  5890.  
  5891. ################################################################################
  5892. # Target drops its item. It regains the item at the end of the battle.
  5893. ################################################################################
  5894. class PokeBattle_Move_0F0 < PokeBattle_Move
  5895. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5896. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5897. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  5898. !opponent.damagestate.substitute && opponent.item!=0
  5899. if opponent.hasWorkingAbility(:STICKYHOLD)
  5900. abilityname=PBAbilities.getName(opponent.ability)
  5901. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  5902. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item)
  5903. itemname=PBItems.getName(opponent.item)
  5904. opponent.item=0
  5905. opponent.effects[PBEffects::ChoiceBand]=-1
  5906. @battle.pbDisplay(_INTL("{1} knocked off {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  5907. end
  5908. end
  5909. return ret
  5910. end
  5911. end
  5912.  
  5913.  
  5914.  
  5915. ################################################################################
  5916. # User steals the target's item, if the user has none itself.
  5917. # Items stolen from wild Pokémon are kept after the battle.
  5918. ################################################################################
  5919. class PokeBattle_Move_0F1 < PokeBattle_Move
  5920. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5921. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5922. if opponent.damagestate.calcdamage>0 &&
  5923. !opponent.damagestate.substitute && opponent.item!=0
  5924. if opponent.hasWorkingAbility(:STICKYHOLD)
  5925. abilityname=PBAbilities.getName(opponent.ability)
  5926. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  5927. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item) &&
  5928. !@battle.pbIsUnlosableItem(attacker,opponent.item) &&
  5929. attacker.item==0 &&
  5930. (@battle.opponent || !@battle.pbIsOpposing?(attacker.index))
  5931. itemname=PBItems.getName(opponent.item)
  5932. attacker.item=opponent.item
  5933. opponent.item=0
  5934. opponent.effects[PBEffects::ChoiceBand]=-1
  5935. if !@battle.opponent && # In a wild battle
  5936. attacker.pokemon.itemInitial==0 &&
  5937. opponent.pokemon.itemInitial==attacker.item
  5938. attacker.pokemon.itemInitial=attacker.item
  5939. opponent.pokemon.itemInitial=0
  5940. end
  5941. @battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  5942. end
  5943. end
  5944. return ret
  5945. end
  5946. end
  5947.  
  5948.  
  5949.  
  5950. ################################################################################
  5951. # User and target swap items. They remain swapped after the battle.
  5952. ################################################################################
  5953. class PokeBattle_Move_0F2 < PokeBattle_Move
  5954. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5955. if opponent.effects[PBEffects::Substitute]>0
  5956. @battle.pbDisplay(_INTL("But it failed!"))
  5957. return -1
  5958. end
  5959. if (attacker.item==0 && opponent.item==0) ||
  5960. (!@battle.opponent && @battle.pbIsOpposing?(attacker.index))
  5961. @battle.pbDisplay(_INTL("But it failed!"))
  5962. return -1
  5963. end
  5964. if @battle.pbIsUnlosableItem(opponent,opponent.item) ||
  5965. @battle.pbIsUnlosableItem(attacker,opponent.item) ||
  5966. @battle.pbIsUnlosableItem(opponent,attacker.item) ||
  5967. @battle.pbIsUnlosableItem(attacker,attacker.item)
  5968. @battle.pbDisplay(_INTL("But it failed!"))
  5969. return -1
  5970. end
  5971. if opponent.hasWorkingAbility(:STICKYHOLD)
  5972. abilityname=PBAbilities.getName(opponent.ability)
  5973. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,name))
  5974. return -1
  5975. end
  5976. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5977. oldattitem=attacker.item
  5978. oldoppitem=opponent.item
  5979. oldattitemname=PBItems.getName(oldattitem)
  5980. oldoppitemname=PBItems.getName(oldoppitem)
  5981. tmpitem=attacker.item
  5982. attacker.item=opponent.item
  5983. opponent.item=tmpitem
  5984. if !@battle.opponent && # In a wild battle
  5985. attacker.pokemon.itemInitial==oldattitem &&
  5986. opponent.pokemon.itemInitial==oldoppitem
  5987. attacker.pokemon.itemInitial=oldoppitem
  5988. opponent.pokemon.itemInitial=oldattitem
  5989. end
  5990. @battle.pbDisplay(_INTL("{1} switched items with its opponent!",attacker.pbThis))
  5991. if oldoppitem>0 && oldattitem>0
  5992. @battle.pbDisplayPaused(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname))
  5993. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname))
  5994. else
  5995. @battle.pbDisplay(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname)) if oldoppitem>0
  5996. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname)) if oldattitem>0
  5997. end
  5998. if oldattitem!=oldoppitem # TODO: Not exactly correct
  5999. attacker.effects[PBEffects::ChoiceBand]=-1
  6000. end
  6001. opponent.effects[PBEffects::ChoiceBand]=-1
  6002. return 0
  6003. end
  6004. end
  6005.  
  6006.  
  6007.  
  6008. ################################################################################
  6009. # User gives its item to the target. The item remains given after the battle.
  6010. ################################################################################
  6011. class PokeBattle_Move_0F3 < PokeBattle_Move
  6012. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6013. if opponent.effects[PBEffects::Substitute]>0
  6014. @battle.pbDisplay(_INTL("But it failed!"))
  6015. return -1
  6016. end
  6017. if attacker.item==0 || opponent.item!=0
  6018. @battle.pbDisplay(_INTL("But it failed!"))
  6019. return -1
  6020. end
  6021. if @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6022. @battle.pbIsUnlosableItem(opponent,attacker.item)
  6023. @battle.pbDisplay(_INTL("But it failed!"))
  6024. return -1
  6025. end
  6026. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6027. itemname=PBItems.getName(attacker.item)
  6028. opponent.item=attacker.item
  6029. attacker.item=0
  6030. attacker.effects[PBEffects::ChoiceBand]=-1
  6031. if !@battle.opponent && # In a wild battle
  6032. opponent.pokemon.itemInitial==0 &&
  6033. attacker.pokemon.itemInitial==opponent.item
  6034. opponent.pokemon.itemInitial=opponent.item
  6035. attacker.pokemon.itemInitial=0
  6036. end
  6037. @battle.pbDisplay(_INTL("{1} received {2} from {3}!",opponent.pbThis,itemname,attacker.pbThis(true)))
  6038. return 0
  6039. end
  6040. end
  6041.  
  6042.  
  6043.  
  6044. ################################################################################
  6045. # User consumes target's berry and gains its effect.
  6046. ################################################################################
  6047. class PokeBattle_Move_0F4 < PokeBattle_Move
  6048. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6049. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6050. if !attacker.isFainted? && opponent.damagestate.calcdamage>0 &&
  6051. !opponent.damagestate.substitute && pbIsBerry?(opponent.item)
  6052. if opponent.hasWorkingAbility(:STICKYHOLD)
  6053. abilityname=PBAbilities.getName(opponent.ability)
  6054. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  6055. else
  6056. item=opponent.item
  6057. itemname=PBItems.getName(item)
  6058. opponent.item=0
  6059. opponent.pokemon.itemInitial=0 if opponent.pokemon.itemInitial==item
  6060. @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",attacker.pbThis,itemname))
  6061. if !attacker.hasWorkingAbility(:KLUTZ) &&
  6062. attacker.effects[PBEffects::Embargo]==0
  6063. # Get berry's effect here
  6064. end
  6065. end
  6066. end
  6067. return ret
  6068. end
  6069. end
  6070.  
  6071.  
  6072.  
  6073. ################################################################################
  6074. # Target's berry is destroyed.
  6075. ################################################################################
  6076. class PokeBattle_Move_0F5 < PokeBattle_Move
  6077. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6078. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6079. if !attacker.isFainted? && opponent.damagestate.calcdamage>0 &&
  6080. !opponent.damagestate.substitute && pbIsBerry?(opponent.item)
  6081. item=opponent.item
  6082. itemname=PBItems.getName(item)
  6083. opponent.item=0
  6084. opponent.pokemon.itemInitial=0 if opponent.pokemon.itemInitial==item
  6085. @battle.pbDisplay(_INTL("{1}'s {2} was incinerated!",opponent.pbThis,itemname))
  6086. end
  6087. return ret
  6088. end
  6089. end
  6090.  
  6091.  
  6092.  
  6093. ################################################################################
  6094. # User recovers the last item it held and consumed.
  6095. ################################################################################
  6096. class PokeBattle_Move_0F6 < PokeBattle_Move
  6097. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6098. if attacker.pokemon.itemRecycle==0
  6099. @battle.pbDisplay(_INTL("But it failed!"))
  6100. return -1
  6101. end
  6102. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6103. item=attacker.pokemon.itemRecycle
  6104. itemname=PBItems.getName(item)
  6105. attacker.item=item
  6106. attacker.pokemon.itemInitial=item if attacker.pokemon.itemInitial==0
  6107. attacker.pokemon.itemRecycle=0
  6108. @battle.pbDisplay(_INTL("{1} found one {2}!",attacker.pbThis,itemname))
  6109. return 0
  6110. end
  6111. end
  6112.  
  6113.  
  6114.  
  6115. ################################################################################
  6116. # User flings its item at the target. Power and effect depend on the item.
  6117. ################################################################################
  6118. class PokeBattle_Move_0F7 < PokeBattle_Move
  6119. def flingarray
  6120. return {
  6121. 130 => [:IRONBALL],
  6122. 100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,
  6123. :HELIXFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,:ROOTFOSSIL,
  6124. :SKULLFOSSIL],
  6125. 90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,
  6126. :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,
  6127. :MEADOWPLATE,:MINDPLATE,:SKYPLATE,:SPLASHPLATE,:SPOOKYPLATE,
  6128. :STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],
  6129. 80 => [:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,:ODDKEYSTONE,
  6130. :OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,:SHINYSTONE,
  6131. :STICKYBARB],
  6132. 70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,
  6133. :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
  6134. :POWERWEIGHT,:SHOCKDRIVE],
  6135. 60 => [:ADAMANTORB,:DAMPROCK,:HEATROCK,:LUSTROUSORB,:MACHOBRACE,
  6136. :ROCKYHELMET,:STICK],
  6137. 50 => [:DUBIOUSDISC,:SHARPBEAK],
  6138. 40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],
  6139. 30 => [:ABILITYURGE,:ABSORBBULB,:AMULETCOIN,:ANTIDOTE,:AWAKENING,
  6140. :BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,:BIGNUGGET,:BIGPEARL,
  6141. :BINDINGBAND,:BLACKBELT,:BLACKFLUTE,:BLACKGLASSES,:BLACKSLUDGE,
  6142. :BLUEFLUTE,:BLUESHARD,:BURNHEAL,:CALCIUM,:CARBOS,
  6143. :CASTELIACONE,:CELLBATTERY,:CHARCOAL,:CLEANSETAG,:COMETSHARD,
  6144. :DAMPMULCH,:DEEPSEASCALE,:DIREHIT,:DIREHIT2,:DIREHIT3,
  6145. :DRAGONSCALE,:EJECTBUTTON,:ELIXIR,:ENERGYPOWDER,:ENERGYROOT,
  6146. :ESCAPEROPE,:ETHER,:EVERSTONE,:EXPSHARE,:FIRESTONE,
  6147. :FLAMEORB,:FLOATSTONE,:FLUFFYTAIL,:FRESHWATER,:FULLHEAL,
  6148. :FULLRESTORE,:GOOEYMULCH,:GREENSHARD,:GROWTHMULCH,:GUARDSPEC,
  6149. :HEALPOWDER,:HEARTSCALE,:HONEY,:HPUP,:HYPERPOTION,
  6150. :ICEHEAL,:IRON,:ITEMDROP,:ITEMURGE,:KINGSROCK,
  6151. :LAVACOOKIE,:LEAFSTONE,:LEMONADE,:LIFEORB,:LIGHTBALL,
  6152. :LIGHTCLAY,:LUCKYEGG,:MAGNET,:MAXELIXIR,:MAXETHER,
  6153. :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,
  6154. :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,
  6155. :NUGGET,:OLDGATEAU,:PARLYZHEAL,:PEARL,:PEARLSTRING,
  6156. :POKEDOLL,:POKETOY,:POTION,:PPMAX,:PPUP,
  6157. :PRISMSCALE,:PROTEIN,:RAGECANDYBAR,:RARECANDY,:RAZORFANG,
  6158. :REDFLUTE,:REDSHARD,:RELICBAND,:RELICCOPPER,:RELICCROWN,
  6159. :RELICGOLD,:RELICSILVER,:RELICSTATUE,:RELICVASE,:REPEL,
  6160. :RESETURGE,:REVIVALHERB,:REVIVE,:SACREDASH,:SCOPELENS,
  6161. :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SODAPOP,
  6162. :SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,:STARPIECE,
  6163. :SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SWEETHEART,:THUNDERSTONE,
  6164. :TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,:UPGRADE,:WATERSTONE,
  6165. :WHITEFLUTE,:XACCURACY,:XACCURACY2,:XACCURACY3,:XACCURACY6,
  6166. :XATTACK,:XATTACK2,:XATTACK3,:XATTACK6,:XDEFEND,
  6167. :XDEFEND2,:XDEFEND3,:XDEFEND6,:XSPDEF,:XSPDEF2,
  6168. :XSPDEF3,:XSPDEF6,:XSPECIAL,:XSPECIAL2,:XSPECIAL3,
  6169. :XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,:XSPEED6,
  6170. :YELLOWFLUTE,:YELLOWSHARD,:ZINC],
  6171. 20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
  6172. :RESISTWING,:SWIFTWING],
  6173. 10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,
  6174. :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,
  6175. :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,
  6176. :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,
  6177. :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,
  6178. :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,
  6179. :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,
  6180. :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,
  6181. :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS]
  6182. }
  6183. end
  6184.  
  6185. def pbMoveFailed(attacker,opponent)
  6186. return true if attacker.item==0 ||
  6187. @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  6188. pbIsPokeBall?(attacker.item) ||
  6189. attacker.hasWorkingAbility(:KLUTZ) ||
  6190. attacker.effects[PBEffects::Embargo]>0
  6191. for i in flingarray.keys
  6192. data=flingarray[i]
  6193. if data
  6194. for j in data
  6195. return false if isConst?(attacker.item,PBItems,j)
  6196. end
  6197. end
  6198. end
  6199. return false if pbIsBerry?(attacker.item)
  6200. return true
  6201. end
  6202.  
  6203. def pbBaseDamage(basedmg,attacker,opponent)
  6204. for i in flingarray.keys
  6205. data=flingarray[i]
  6206. if data
  6207. for j in data
  6208. return i if isConst?(attacker.item,PBItems,j)
  6209. end
  6210. end
  6211. end
  6212. return 10 if pbIsBerry?(attacker.item)
  6213. return 1
  6214. end
  6215.  
  6216. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6217. if attacker.item==0
  6218. @battle.pbDisplay(_INTL("But it failed!"))
  6219. return 0
  6220. end
  6221. if !opponent.effects[PBEffects::Protect]
  6222. @battle.pbDisplay(_INTL("{1} flung its {2}!",attacker.pbThis,PBItems.getName(attacker.item)))
  6223. end
  6224. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6225. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6226. !opponent.hasWorkingAbility(:SHIELDDUST)
  6227. # if $ItemData[@item][ITEMPOCKET]==4
  6228. # pbSpecialBerryUse(opponent,attacker,false,true)
  6229. # end
  6230. if attacker.hasWorkingItem(:FLAMEORB)
  6231. if opponent.pbCanBurn?(false)
  6232. opponent.pbBurn(attacker)
  6233. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  6234. end
  6235. elsif attacker.hasWorkingItem(:KINGSROCK) ||
  6236. attacker.hasWorkingItem(:RAZORFANG)
  6237. if !opponent.hasWorkingAbility(:INNERFOCUS) &&
  6238. opponent.effects[PBEffects::Substitute]==0
  6239. opponent.effects[PBEffects::Flinch]=true
  6240. end
  6241. elsif attacker.hasWorkingItem(:LIGHTBALL)
  6242. if opponent.pbCanParalyze?(false)
  6243. opponent.pbParalyze(attacker)
  6244. @battle.pbDisplay(_INTL("{1} was paralyzed! It may be unable to move!",opponent.pbThis))
  6245. end
  6246. elsif attacker.hasWorkingItem(:MENTALHERB)
  6247. if opponent.effects[PBEffects::Attract]>=0
  6248. opponent.effects[PBEffects::Attract]=-1
  6249. @battle.pbDisplay(_INTL("{1}'s {2} cured {3}'s love problem!",
  6250. attacker.pbThis,PBItems.getName(attacker.item),opponent.pbThis(true)))
  6251. end
  6252. elsif attacker.hasWorkingItem(:POISONBARB)
  6253. if opponent.pbCanPoison?(false)
  6254. opponent.pbPoison(attacker)
  6255. @battle.pbDisplay(_INTL("{1} was poisoned!",opponent.pbThis))
  6256. end
  6257. elsif attacker.hasWorkingItem(:TOXICORB)
  6258. if opponent.pbCanPoison?(false)
  6259. opponent.pbPoison(attacker,true)
  6260. @battle.pbDisplay(_INTL("{1} was badly poisoned!",opponent.pbThis))
  6261. end
  6262. elsif attacker.hasWorkingItem(:WHITEHERB)
  6263. while true
  6264. reducedstats=false
  6265. for i in [PBStats::ATTACK,PBStats::DEFENSE,
  6266. PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF,
  6267. PBStats::EVASION,PBStats::ACCURACY]
  6268. if opponent.stages[i]<0
  6269. opponent.stages[i]=0; reducedstats=true
  6270. end
  6271. end
  6272. break if !reducedstats
  6273. @battle.pbDisplay(_INTL("{1}'s {2} restored {3}'s status!",
  6274. attacker.pbThis,PBItems.getName(attacker.item),opponent.pbThis(true)))
  6275. end
  6276. end
  6277. end
  6278. attacker.pokemon.itemRecycle=attacker.item
  6279. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  6280. attacker.item=0
  6281. return ret
  6282. end
  6283. end
  6284.  
  6285.  
  6286.  
  6287. ################################################################################
  6288. # For 5 rounds, the target cannnot use its held item, its held item has no
  6289. # effect, and no items can be used on it.
  6290. ################################################################################
  6291. class PokeBattle_Move_0F8 < PokeBattle_Move
  6292. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6293. if opponent.effects[PBEffects::Embargo]>0
  6294. @battle.pbDisplay(_INTL("But it failed!"))
  6295. return -1
  6296. end
  6297. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6298. opponent.effects[PBEffects::Embargo]=5
  6299. @battle.pbDisplay(_INTL("{1} can't use items anymore!",opponent.pbThis))
  6300. return 0
  6301. end
  6302. end
  6303.  
  6304.  
  6305.  
  6306. ################################################################################
  6307. # For 5 rounds, all held items cannot be used in any way and have no effect.
  6308. # Held items can still change hands, but can't be thrown.
  6309. ################################################################################
  6310. class PokeBattle_Move_0F9 < PokeBattle_Move
  6311. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6312. if @battle.field.effects[PBEffects::MagicRoom]>0
  6313. @battle.field.effects[PBEffects::MagicRoom]=0
  6314. @battle.pbDisplay(_INTL("The area returned to normal!"))
  6315. else
  6316. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6317. @battle.field.effects[PBEffects::MagicRoom]=5
  6318. @battle.pbDisplay(_INTL("It created a bizarre area in which Pokémon's held items lose their effects!"))
  6319. end
  6320. return 0
  6321. end
  6322. end
  6323.  
  6324.  
  6325.  
  6326. ################################################################################
  6327. # User takes recoil damage equal to 1/4 of the damage this move dealt.
  6328. ################################################################################
  6329. class PokeBattle_Move_0FA < PokeBattle_Move
  6330. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6331. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6332. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6333. !attacker.hasWorkingAbility(:ROCKHEAD)
  6334. attacker.pbReduceHP([1,((opponent.damagestate.hplost+2)/4).floor].max)
  6335. @battle.pbDisplay(_INTL("{1} is damaged by the recoil!",attacker.pbThis))
  6336. end
  6337. return ret
  6338. end
  6339. end
  6340.  
  6341.  
  6342.  
  6343. ################################################################################
  6344. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  6345. ################################################################################
  6346. class PokeBattle_Move_0FB < PokeBattle_Move
  6347. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6348. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6349. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6350. !attacker.hasWorkingAbility(:ROCKHEAD)
  6351. attacker.pbReduceHP([1,((opponent.damagestate.hplost+1)/3).floor].max)
  6352. @battle.pbDisplay(_INTL("{1} is damaged by the recoil!",attacker.pbThis))
  6353. end
  6354. return ret
  6355. end
  6356. end
  6357.  
  6358.  
  6359.  
  6360. ################################################################################
  6361. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  6362. ################################################################################
  6363. class PokeBattle_Move_0FC < PokeBattle_Move
  6364. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6365. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6366. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6367. !attacker.hasWorkingAbility(:ROCKHEAD)
  6368. attacker.pbReduceHP([1,((opponent.damagestate.hplost+1)/2).floor].max)
  6369. @battle.pbDisplay(_INTL("{1} is damaged by the recoil!",attacker.pbThis))
  6370. end
  6371. return ret
  6372. end
  6373. end
  6374.  
  6375.  
  6376.  
  6377. ################################################################################
  6378. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  6379. # May paralyze the target.
  6380. ################################################################################
  6381. class PokeBattle_Move_0FD < PokeBattle_Move
  6382. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6383. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6384. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6385. !attacker.hasWorkingAbility(:ROCKHEAD)
  6386. attacker.pbReduceHP([1,((opponent.damagestate.hplost+1)/3).floor].max)
  6387. @battle.pbDisplay(_INTL("{1} is damaged by the recoil!",attacker.pbThis))
  6388. end
  6389. return ret
  6390. end
  6391.  
  6392. def pbAdditionalEffect(attacker,opponent)
  6393. return false if !opponent.pbCanParalyze?(false)
  6394. opponent.pbParalyze(attacker)
  6395. @battle.pbDisplay(_INTL("{1} was paralyzed! It may be unable to move!",opponent.pbThis))
  6396. return true
  6397. end
  6398. end
  6399.  
  6400.  
  6401.  
  6402. ################################################################################
  6403. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  6404. # May burn the target.
  6405. ################################################################################
  6406. class PokeBattle_Move_0FE < PokeBattle_Move
  6407. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6408. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6409. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  6410. !attacker.hasWorkingAbility(:ROCKHEAD)
  6411. attacker.pbReduceHP([1,((opponent.damagestate.hplost+1)/3).floor].max)
  6412. @battle.pbDisplay(_INTL("{1} is damaged by the recoil!",attacker.pbThis))
  6413. end
  6414. return ret
  6415. end
  6416.  
  6417. def pbAdditionalEffect(attacker,opponent)
  6418. return false if !opponent.pbCanBurn?(false)
  6419. opponent.pbBurn(attacker)
  6420. @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
  6421. return true
  6422. end
  6423. end
  6424.  
  6425.  
  6426.  
  6427. ################################################################################
  6428. # Starts sunny weather.
  6429. ################################################################################
  6430. class PokeBattle_Move_0FF < PokeBattle_Move
  6431. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6432. if @battle.weather==PBWeather::SUNNYDAY
  6433. @battle.pbDisplay(_INTL("But it failed!"))
  6434. return -1
  6435. end
  6436. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6437. @battle.weather=PBWeather::SUNNYDAY
  6438. @battle.weatherduration=5
  6439. @battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
  6440. @battle.pbCommonAnimation("Sunny",nil,nil)
  6441. @battle.pbDisplay(_INTL("The sunlight turned harsh!"))
  6442. return 0
  6443. end
  6444. end
  6445.  
  6446.  
  6447.  
  6448. ################################################################################
  6449. # Starts rainy weather.
  6450. ################################################################################
  6451. class PokeBattle_Move_100 < PokeBattle_Move
  6452. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6453. if @battle.weather==PBWeather::RAINDANCE
  6454. @battle.pbDisplay(_INTL("But it failed!"))
  6455. return -1
  6456. end
  6457. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6458. @battle.weather=PBWeather::RAINDANCE
  6459. @battle.weatherduration=5
  6460. @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
  6461. @battle.pbCommonAnimation("Rain",nil,nil)
  6462. @battle.pbDisplay(_INTL("It started to rain!"))
  6463. return 0
  6464. end
  6465. end
  6466.  
  6467.  
  6468.  
  6469. ################################################################################
  6470. # Starts sandstorm weather.
  6471. ################################################################################
  6472. class PokeBattle_Move_101 < PokeBattle_Move
  6473. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6474. if @battle.weather==PBWeather::SANDSTORM
  6475. @battle.pbDisplay(_INTL("But it failed!"))
  6476. return -1
  6477. end
  6478. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6479. @battle.weather=PBWeather::SANDSTORM
  6480. @battle.weatherduration=5
  6481. @battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
  6482. @battle.pbCommonAnimation("Sandstorm",nil,nil)
  6483. @battle.pbDisplay(_INTL("A sandstorm brewed!"))
  6484. return 0
  6485. end
  6486. end
  6487.  
  6488.  
  6489.  
  6490. ################################################################################
  6491. # Starts hail weather.
  6492. ################################################################################
  6493. class PokeBattle_Move_102 < PokeBattle_Move
  6494. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6495. if @battle.weather==PBWeather::HAIL
  6496. @battle.pbDisplay(_INTL("But it failed!"))
  6497. return -1
  6498. end
  6499. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6500. @battle.weather=PBWeather::HAIL
  6501. @battle.weatherduration=5
  6502. @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
  6503. @battle.pbCommonAnimation("Hail",nil,nil)
  6504. @battle.pbDisplay(_INTL("It started to hail!"))
  6505. return 0
  6506. end
  6507. end
  6508.  
  6509.  
  6510.  
  6511. ################################################################################
  6512. # Entry hazard. Lays spikes on the opposing side (max. 3 layers).
  6513. ################################################################################
  6514. class PokeBattle_Move_103 < PokeBattle_Move
  6515. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6516. if attacker.pbOpposingSide.effects[PBEffects::Spikes]>=3
  6517. @battle.pbDisplay(_INTL("But it failed!"))
  6518. return -1
  6519. end
  6520. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6521. attacker.pbOpposingSide.effects[PBEffects::Spikes]+=1
  6522. if !@battle.pbIsOpposing?(attacker.index)
  6523. @battle.pbDisplay(_INTL("Spikes were scattered all around the feet of the foe's team!"))
  6524. else
  6525. @battle.pbDisplay(_INTL("Spikes were scattered all around the feet of your team!"))
  6526. end
  6527. return 0
  6528. end
  6529. end
  6530.  
  6531.  
  6532.  
  6533. ################################################################################
  6534. # Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
  6535. ################################################################################
  6536. class PokeBattle_Move_104 < PokeBattle_Move
  6537. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6538. if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
  6539. @battle.pbDisplay(_INTL("But it failed!"))
  6540. return -1
  6541. end
  6542. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6543. attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]+=1
  6544. if !@battle.pbIsOpposing?(attacker.index)
  6545. @battle.pbDisplay(_INTL("Poison spikes were scattered all around the foe's team's feet!"))
  6546. else
  6547. @battle.pbDisplay(_INTL("Poison spikes were scattered all around your team's feet!"))
  6548. end
  6549. return 0
  6550. end
  6551. end
  6552.  
  6553.  
  6554.  
  6555. ################################################################################
  6556. # Entry hazard. Lays stealth rocks on the opposing side.
  6557. ################################################################################
  6558. class PokeBattle_Move_105 < PokeBattle_Move
  6559. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6560. if attacker.pbOpposingSide.effects[PBEffects::StealthRock]
  6561. @battle.pbDisplay(_INTL("But it failed!"))
  6562. return -1
  6563. end
  6564. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6565. attacker.pbOpposingSide.effects[PBEffects::StealthRock]=true
  6566. if !@battle.pbIsOpposing?(attacker.index)
  6567. @battle.pbDisplay(_INTL("Pointed stones float in the air around your foe's team!"))
  6568. else
  6569. @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
  6570. end
  6571. return 0
  6572. end
  6573. end
  6574.  
  6575.  
  6576.  
  6577. ################################################################################
  6578. # If used after ally's Fire Pledge, makes a sea of fire on the opposing side.
  6579. ################################################################################
  6580. class PokeBattle_Move_106 < PokeBattle_UnimplementedMove
  6581. # Not implemented yet.
  6582. # Uses pbBaseDamage
  6583. end
  6584.  
  6585.  
  6586.  
  6587. ################################################################################
  6588. # If used after ally's Water Pledge, makes a rainbow appear on the user's side.
  6589. ################################################################################
  6590. class PokeBattle_Move_107 < PokeBattle_UnimplementedMove
  6591. # Not implemented yet.
  6592. # Uses pbBaseDamage
  6593. end
  6594.  
  6595.  
  6596.  
  6597. ################################################################################
  6598. # If used after ally's Grass Pledge, makes a swamp appear on the opposing side.
  6599. ################################################################################
  6600. class PokeBattle_Move_108 < PokeBattle_UnimplementedMove
  6601. # Not implemented yet.
  6602. # Uses pbBaseDamage
  6603. end
  6604.  
  6605.  
  6606.  
  6607. ################################################################################
  6608. # Scatters coins that the player picks up after winning the battle.
  6609. ################################################################################
  6610. class PokeBattle_Move_109 < PokeBattle_Move
  6611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6612. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6613. if opponent.damagestate.calcdamage>0
  6614. if @battle.pbOwnedByPlayer?(attacker.index)
  6615. @battle.extramoney+=5*attacker.level
  6616. @battle.extramoney=MAXMONEY if @battle.extramoney>MAXMONEY
  6617. end
  6618. @battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
  6619. end
  6620. return ret
  6621. end
  6622. end
  6623.  
  6624.  
  6625.  
  6626. ################################################################################
  6627. # Ends the opposing side's Light Screen and Reflect.
  6628. ################################################################################
  6629. class PokeBattle_Move_10A < PokeBattle_Move
  6630. def pbCalcDamage(attacker,opponent)
  6631. return super(attacker,opponent,PokeBattle_Move::NOREFLECT)
  6632. end
  6633.  
  6634. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6635. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6636. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0
  6637. attacker.pbOpposingSide.effects[PBEffects::Reflect]=0
  6638. if !@battle.pbIsOpposing?(attacker.index)
  6639. @battle.pbDisplay(_INTL("The opposing team's Reflect wore off!"))
  6640. else
  6641. @battle.pbDisplayPaused(_INTL("Your team's Reflect wore off!"))
  6642. end
  6643. end
  6644. if attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  6645. attacker.pbOpposingSide.effects[PBEffects::LightScreen]=0
  6646. if !@battle.pbIsOpposing?(attacker.index)
  6647. @battle.pbDisplay(_INTL("The opposing team's Light Screen wore off!"))
  6648. else
  6649. @battle.pbDisplay(_INTL("Your team's Light Screen wore off!"))
  6650. end
  6651. end
  6652. return ret
  6653. end
  6654. end
  6655.  
  6656.  
  6657.  
  6658. ################################################################################
  6659. # If attack misses, user takes crash damage of 1/2 of max HP.
  6660. ################################################################################
  6661. class PokeBattle_Move_10B < PokeBattle_Move
  6662. def pbMoveFailed(attacker,opponent)
  6663. return @battle.field.effects[PBEffects::Gravity]>0
  6664. end
  6665. end
  6666.  
  6667.  
  6668.  
  6669. ################################################################################
  6670. # User turns 1/4 of max HP into a substitute.
  6671. ################################################################################
  6672. class PokeBattle_Move_10C < PokeBattle_Move
  6673. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6674. if attacker.effects[PBEffects::Substitute]>0
  6675. @battle.pbDisplay(_INTL("{1} already has a substitute!",attacker.pbThis))
  6676. return -1
  6677. end
  6678. sublife=[(attacker.totalhp/4).floor,1].max
  6679. if attacker.hp<=sublife
  6680. @battle.pbDisplay(_INTL("It was too weak to make a substitute!"))
  6681. return -1
  6682. end
  6683. attacker.pbReduceHP(sublife)
  6684. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6685. attacker.effects[PBEffects::MultiTurn]=0
  6686. attacker.effects[PBEffects::MultiTurnAttack]=0
  6687. attacker.effects[PBEffects::Substitute]=sublife
  6688. @battle.pbDisplay(_INTL("{1} put in a substitute!",attacker.pbThis))
  6689. return 0
  6690. end
  6691. end
  6692.  
  6693.  
  6694.  
  6695. ################################################################################
  6696. # User is not Ghost: Decreases user's Speed, increases user's Attack & Defense by
  6697. # 1 stage each.
  6698. # User is Ghost: User loses 1/2 of max HP, and curses the target.
  6699. # Cursed Pokémon lose 1/4 of their max HP at the end of each round.
  6700. ################################################################################
  6701. class PokeBattle_Move_10D < PokeBattle_Move
  6702. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6703. failed=false
  6704. if !attacker.pbHasType?(:GHOST)
  6705. lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,false,true)
  6706. raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false)
  6707. raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  6708. if !lowerspeed && !raiseatk && !raisedef
  6709. failed=true
  6710. else
  6711. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) # Placeholder for alternate move animation
  6712. if lowerspeed
  6713. attacker.pbReduceStat(PBStats::SPEED,1,false,true,true)
  6714. end
  6715. showanim=true
  6716. if raiseatk
  6717. attacker.pbIncreaseStat(PBStats::ATTACK,1,false,showanim)
  6718. showanim=false
  6719. end
  6720. if raisedef
  6721. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false,showanim)
  6722. showanim=false
  6723. end
  6724. end
  6725. else
  6726. if opponent.effects[PBEffects::Curse]
  6727. failed=true
  6728. else
  6729. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6730. attacker.pbReduceHP((attacker.totalhp/2).floor)
  6731. opponent.effects[PBEffects::Curse]=true
  6732. @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true)))
  6733. end
  6734. end
  6735. if failed
  6736. @battle.pbDisplay(_INTL("But it failed!"))
  6737. end
  6738. return failed ? -1 : 0
  6739. end
  6740. end
  6741.  
  6742.  
  6743.  
  6744. ################################################################################
  6745. # Target's last move used loses 4 PP.
  6746. ################################################################################
  6747. class PokeBattle_Move_10E < PokeBattle_Move
  6748. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6749. for i in opponent.moves
  6750. if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
  6751. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6752. reduction=[4,i.pp].min
  6753. i.pp-=reduction
  6754. @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
  6755. return 0
  6756. end
  6757. end
  6758. @battle.pbDisplay(_INTL("But it failed!"))
  6759. return -1
  6760. end
  6761. end
  6762.  
  6763.  
  6764.  
  6765. ################################################################################
  6766. # Target will lose 1/4 of max HP at end of each round, while asleep.
  6767. ################################################################################
  6768. class PokeBattle_Move_10F < PokeBattle_Move
  6769. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6770. if opponent.status!=PBStatuses::SLEEP || opponent.effects[PBEffects::Nightmare] ||
  6771. opponent.effects[PBEffects::Substitute]>0
  6772. @battle.pbDisplay(_INTL("But it failed!"))
  6773. return -1
  6774. end
  6775. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6776. opponent.effects[PBEffects::Nightmare]=true
  6777. @battle.pbDisplay(_INTL("{1} began having a nightmare!",opponent.pbThis))
  6778. return 0
  6779. end
  6780. end
  6781.  
  6782.  
  6783.  
  6784. ################################################################################
  6785. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  6786. ################################################################################
  6787. class PokeBattle_Move_110 < PokeBattle_Move
  6788. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6789. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6790. if !attacker.isFainted? && opponent.damagestate.calcdamage>0
  6791. if attacker.effects[PBEffects::MultiTurn]>0
  6792. mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
  6793. mtuser=@battle.battlers[attacker.effects[PBEffects::MultiTurnUser]]
  6794. @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
  6795. attacker.effects[PBEffects::MultiTurn]=0
  6796. attacker.effects[PBEffects::MultiTurnAttack]=0
  6797. attacker.effects[PBEffects::MultiTurnUser]=-1
  6798. end
  6799. if attacker.effects[PBEffects::LeechSeed]>=0
  6800. attacker.effects[PBEffects::LeechSeed]=-1
  6801. @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))
  6802. end
  6803. if attacker.pbOwnSide.effects[PBEffects::StealthRock]
  6804. attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
  6805. @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))
  6806. end
  6807. if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
  6808. attacker.pbOwnSide.effects[PBEffects::Spikes]=0
  6809. @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))
  6810. end
  6811. if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  6812. attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
  6813. @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))
  6814. end
  6815. end
  6816. return ret
  6817. end
  6818. end
  6819.  
  6820.  
  6821.  
  6822. ################################################################################
  6823. # Attacks 2 rounds in the future.
  6824. ################################################################################
  6825. class PokeBattle_Move_111 < PokeBattle_Move
  6826. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6827. if opponent.effects[PBEffects::FutureSight]>0
  6828. @battle.pbDisplay(_INTL("But it failed!"))
  6829. return -1
  6830. end
  6831. damage=pbCalcDamage(attacker,opponent,
  6832. PokeBattle_Move::NOCRITICAL|
  6833. PokeBattle_Move::NOWEIGHTING|
  6834. PokeBattle_Move::IGNOREPKMNTYPES)
  6835. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6836. opponent.effects[PBEffects::FutureSight]=3
  6837. opponent.effects[PBEffects::FutureSightDamage]=damage
  6838. opponent.effects[PBEffects::FutureSightMove]=@id
  6839. opponent.effects[PBEffects::FutureSightUser]=attacker.index
  6840. if isConst?(@id,PBMoves,:FUTURESIGHT)
  6841. @battle.pbDisplay(_INTL("{1} foresaw an attack!",attacker.pbThis))
  6842. else
  6843. @battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",attacker.pbThis))
  6844. end
  6845. return 0
  6846. end
  6847. end
  6848.  
  6849.  
  6850.  
  6851. ################################################################################
  6852. # Increases user's Defense and Special Defense by 1 stage each. Ups user's
  6853. # stockpile by 1 (max. 3).
  6854. ################################################################################
  6855. class PokeBattle_Move_112 < PokeBattle_Move
  6856. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6857. if attacker.effects[PBEffects::Stockpile]>=3
  6858. @battle.pbDisplay(_INTL("{1} can't stockpile any more!",attacker.pbThis))
  6859. return -1
  6860. end
  6861. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6862. attacker.effects[PBEffects::Stockpile]+=1
  6863. @battle.pbDisplay(_INTL("{1} stockpiled {2}!",attacker.pbThis,
  6864. attacker.effects[PBEffects::Stockpile]))
  6865. showanim=true
  6866. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,false)
  6867. attacker.pbIncreaseStat(PBStats::DEFENSE,1,false,showanim)
  6868. attacker.effects[PBEffects::StockpileDef]+=1
  6869. showanim=false
  6870. end
  6871. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,false)
  6872. attacker.pbIncreaseStat(PBStats::SPDEF,1,false,showanim)
  6873. attacker.effects[PBEffects::StockpileSpDef]+=1
  6874. showanim=false
  6875. end
  6876. return 0
  6877. end
  6878. end
  6879.  
  6880.  
  6881.  
  6882. ################################################################################
  6883. # Power is multiplied by the user's stockpile (X). Reduces the stockpile to 0.
  6884. # Decreases user's Defense and Special Defense by X stages each.
  6885. ################################################################################
  6886. class PokeBattle_Move_113 < PokeBattle_Move
  6887. def pbBaseDamage(basedmg,attacker,opponent)
  6888. return basedmg*attacker.effects[PBEffects::Stockpile]
  6889. end
  6890.  
  6891. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6892. if attacker.effects[PBEffects::Stockpile]==0
  6893. @battle.pbDisplay(_INTL("But it failed!"))
  6894. return -1
  6895. end
  6896. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6897. showanim=true
  6898. if attacker.effects[PBEffects::StockpileDef]>0
  6899. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,false,true)
  6900. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  6901. false,showanim,true)
  6902. showanim=false
  6903. end
  6904. end
  6905. if attacker.effects[PBEffects::StockpileSpDef]>0
  6906. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,false,true)
  6907. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  6908. false,showanim,true)
  6909. showanim=false
  6910. end
  6911. end
  6912. attacker.effects[PBEffects::Stockpile]=0
  6913. attacker.effects[PBEffects::StockpileDef]=0
  6914. attacker.effects[PBEffects::StockpileSpDef]=0
  6915. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  6916. return ret
  6917. end
  6918. end
  6919.  
  6920.  
  6921.  
  6922. ################################################################################
  6923. # Heals user depending on the user's stockpile (X). Reduces the stockpile to 0.
  6924. # Decreases user's Defense and Special Defense by X stages each.
  6925. ################################################################################
  6926. class PokeBattle_Move_114 < PokeBattle_Move
  6927. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6928. hpgain=0
  6929. case attacker.effects[PBEffects::Stockpile]
  6930. when 0
  6931. @battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
  6932. return -1
  6933. when 1
  6934. hpgain=(attacker.totalhp/4).floor
  6935. when 2
  6936. hpgain=(attacker.totalhp/2).floor
  6937. when 3
  6938. hpgain=attacker.totalhp
  6939. end
  6940. if attacker.hp==attacker.totalhp &&
  6941. attacker.effects[PBEffects::StockpileDef]==0 &&
  6942. attacker.effects[PBEffects::StockpileSpDef]==0
  6943. @battle.pbDisplay(_INTL("But it failed!"))
  6944. return -1
  6945. end
  6946. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6947. if attacker.pbRecoverHP(hpgain,true)>0
  6948. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  6949. end
  6950. showanim=true
  6951. if attacker.effects[PBEffects::StockpileDef]>0
  6952. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,false,true)
  6953. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  6954. false,showanim,true)
  6955. showanim=false
  6956. end
  6957. end
  6958. if attacker.effects[PBEffects::StockpileSpDef]>0
  6959. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,false,true)
  6960. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  6961. false,showanim,true)
  6962. showanim=false
  6963. end
  6964. end
  6965. attacker.effects[PBEffects::Stockpile]=0
  6966. attacker.effects[PBEffects::StockpileDef]=0
  6967. attacker.effects[PBEffects::StockpileSpDef]=0
  6968. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  6969. return 0
  6970. end
  6971. end
  6972.  
  6973.  
  6974.  
  6975. ################################################################################
  6976. # Fails if user was hit by a damaging move this round.
  6977. ################################################################################
  6978. class PokeBattle_Move_115 < PokeBattle_Move
  6979. def pbDisplayUseMessage(attacker)
  6980. if attacker.lastHPLost>0
  6981. @battle.pbDisplayBrief(_INTL("{1} lost its focus and couldn't move!",attacker.pbThis))
  6982. return -1
  6983. end
  6984. return super(attacker)
  6985. end
  6986. end
  6987.  
  6988.  
  6989.  
  6990. ################################################################################
  6991. # Fails if the target didn't chose a damaging move to use this round, or has
  6992. # already moved.
  6993. ################################################################################
  6994. class PokeBattle_Move_116 < PokeBattle_UnimplementedMove
  6995. # Not implemented yet.
  6996. end
  6997.  
  6998.  
  6999.  
  7000. ################################################################################
  7001. # This round, user becomes the target of attacks that have single targets.
  7002. ################################################################################
  7003. class PokeBattle_Move_117 < PokeBattle_Move
  7004. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7005. if !@battle.doublebattle
  7006. @battle.pbDisplay(_INTL("But it failed!"))
  7007. return -1
  7008. end
  7009. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7010. attacker.effects[PBEffects::FollowMe]=true
  7011. if !attacker.pbPartner.isFainted?
  7012. attacker.pbPartner.effects[PBEffects::FollowMe]=false
  7013. end
  7014. @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
  7015. return 0
  7016. end
  7017. end
  7018.  
  7019.  
  7020.  
  7021. ################################################################################
  7022. # For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
  7023. ################################################################################
  7024. class PokeBattle_Move_118 < PokeBattle_Move
  7025. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7026. if @battle.field.effects[PBEffects::Gravity]>0
  7027. @battle.pbDisplay(_INTL("But it failed!"))
  7028. return -1
  7029. end
  7030. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7031. @battle.field.effects[PBEffects::Gravity]=5
  7032. for i in 0...4
  7033. poke=@battle.battlers[i]
  7034. next if !poke
  7035. if PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  7036. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCC || # Bounce
  7037. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCE # Sky Drop
  7038. poke.effects[PBEffects::TwoTurnAttack]=0
  7039. end
  7040. if poke.effects[PBEffects::SkyDrop]
  7041. poke.effects[PBEffects::SkyDrop]=false
  7042. end
  7043. if poke.effects[PBEffects::MagnetRise]>0
  7044. poke.effects[PBEffects::MagnetRise]=0
  7045. end
  7046. if poke.effects[PBEffects::Telekinesis]>0
  7047. poke.effects[PBEffects::Telekinesis]=0
  7048. end
  7049. end
  7050. @battle.pbDisplay(_INTL("Gravity intensified!"))
  7051. return 0
  7052. end
  7053. end
  7054.  
  7055.  
  7056.  
  7057. ################################################################################
  7058. # For 5 rounds, user becomes airborne.
  7059. ################################################################################
  7060. class PokeBattle_Move_119 < PokeBattle_Move
  7061. def pbMoveFailed(attacker,opponent)
  7062. return @battle.field.effects[PBEffects::Gravity]>0
  7063. end
  7064.  
  7065. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7066. if attacker.effects[PBEffects::Ingrain] ||
  7067. attacker.effects[PBEffects::SmackDown] ||
  7068. attacker.effects[PBEffects::MagnetRise]>0
  7069. @battle.pbDisplay(_INTL("But it failed!"))
  7070. return -1
  7071. end
  7072. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7073. attacker.effects[PBEffects::MagnetRise]=5
  7074. @battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",attacker.pbThis))
  7075. return 0
  7076. end
  7077. end
  7078.  
  7079.  
  7080.  
  7081. ################################################################################
  7082. # For 3 rounds, target becomes airborne and can always be hit.
  7083. ################################################################################
  7084. class PokeBattle_Move_11A < PokeBattle_Move
  7085. def pbMoveFailed(attacker,opponent)
  7086. return @battle.field.effects[PBEffects::Gravity]>0
  7087. end
  7088.  
  7089. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7090. if opponent.effects[PBEffects::Ingrain] ||
  7091. opponent.effects[PBEffects::SmackDown] ||
  7092. opponent.effects[PBEffects::Telekinesis]>0
  7093. @battle.pbDisplay(_INTL("But it failed!"))
  7094. return -1
  7095. end
  7096. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7097. opponent.effects[PBEffects::Telekinesis]=3
  7098. @battle.pbDisplay(_INTL("{1} was hurled into the air!",opponent.pbThis))
  7099. return 0
  7100. end
  7101. end
  7102.  
  7103.  
  7104.  
  7105.  
  7106. ################################################################################
  7107. # Hits airborne semi-invulnerable targets.
  7108. ################################################################################
  7109. class PokeBattle_Move_11B < PokeBattle_Move
  7110. # Handled in Battler class, do not edit!
  7111. end
  7112.  
  7113.  
  7114.  
  7115. ################################################################################
  7116. # Grounds the target while it remains active.
  7117. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  7118. ################################################################################
  7119. class PokeBattle_Move_11C < PokeBattle_Move
  7120. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7121. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7122. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  7123. !opponent.effects[PBEffects::Roost]
  7124. opponent.effects[PBEffects::SmackDown]=true
  7125. showmsg=false
  7126. showmsg=true if opponent.pbHasType?(:FLYING) ||
  7127. opponent.hasWorkingAbility(:LEVITATE)
  7128. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  7129. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  7130. opponent.effects[PBEffects::TwoTurnAttack]=0; showmsg=true
  7131. end
  7132. if opponent.effects[PBEffects::MagnetRise]>0
  7133. opponent.effects[PBEffects::MagnetRise]=0; showmsg=true
  7134. end
  7135. if opponent.effects[PBEffects::Telekinesis]>0
  7136. opponent.effects[PBEffects::Telekinesis]=0; showmsg=true
  7137. end
  7138. @battle.pbDisplay(_INTL("{1} fell straight down!",opponent.pbThis)) if showmsg
  7139. end
  7140. return ret
  7141. end
  7142. end
  7143.  
  7144.  
  7145.  
  7146. ################################################################################
  7147. # Target moves immediately after the user, ignoring priority/speed.
  7148. ################################################################################
  7149. class PokeBattle_Move_11D < PokeBattle_UnimplementedMove
  7150. # Not implemented yet.
  7151. end
  7152.  
  7153.  
  7154.  
  7155. ################################################################################
  7156. # Target moves last this round, ignoring priority/speed.
  7157. ################################################################################
  7158. class PokeBattle_Move_11E < PokeBattle_UnimplementedMove
  7159. # Not implemented yet.
  7160. end
  7161.  
  7162.  
  7163.  
  7164. ################################################################################
  7165. # For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
  7166. ################################################################################
  7167. class PokeBattle_Move_11F < PokeBattle_UnimplementedMove
  7168. # Not implemented yet.
  7169. end
  7170.  
  7171.  
  7172.  
  7173. ################################################################################
  7174. # User switches places with its ally.
  7175. ################################################################################
  7176. class PokeBattle_Move_120 < PokeBattle_UnimplementedMove
  7177. # Not implemented yet.
  7178. end
  7179.  
  7180.  
  7181.  
  7182. ################################################################################
  7183. # Target's Attack is used instead of user's Attack for this move's calculations.
  7184. ################################################################################
  7185. class PokeBattle_Move_121 < PokeBattle_Move
  7186. # Handled in superclass, do not edit!
  7187. end
  7188.  
  7189.  
  7190.  
  7191. ################################################################################
  7192. # Target's Defense is used instead of its Special Defense for this move's
  7193. # calculations.
  7194. ################################################################################
  7195. class PokeBattle_Move_122 < PokeBattle_Move
  7196. # Handled in superclass, do not edit!
  7197. end
  7198.  
  7199.  
  7200.  
  7201. ################################################################################
  7202. # Only damages Pokémon that share a type with the user.
  7203. ################################################################################
  7204. class PokeBattle_Move_123 < PokeBattle_Move
  7205. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7206. if !opponent.pbHasType?(attacker.type1) &&
  7207. !opponent.pbHasType?(attacker.type2)
  7208. @battle.pbDisplay(_INTL("{1} was unaffected!",opponent.pbThis))
  7209. return -1
  7210. end
  7211. return super(attacker,opponent,hitnum,alltargets,showanimation)
  7212. end
  7213. end
  7214.  
  7215.  
  7216.  
  7217. ################################################################################
  7218. # For 5 rounds, swaps all battlers' base Defense with base Special Defense.
  7219. ################################################################################
  7220. class PokeBattle_Move_124 < PokeBattle_UnimplementedMove
  7221. # Not implemented yet.
  7222. end
  7223.  
  7224.  
  7225.  
  7226. ################################################################################
  7227. # Fails unless user has already used all other moves it knows.
  7228. ################################################################################
  7229. class PokeBattle_Move_125 < PokeBattle_Move
  7230. def pbMoveFailed(attacker,opponent)
  7231. counter=0; nummoves=0
  7232. for move in attacker.moves
  7233. next if move.id<=0
  7234. counter+=1 if move.id!=@id && !attacker.movesUsed.include?(move.id)
  7235. nummoves+=1
  7236. end
  7237. return counter!=0 || nummoves==1
  7238. end
  7239. end
  7240.  
  7241. #===============================================================================
  7242. # NOTE: Shadow moves use function codes 126-132 inclusive. If you're inventing
  7243. # new move effects, use function code 133 and onwards.
  7244. #===============================================================================
  7245. ################################################################################
  7246. # Kings Shield.
  7247. ################################################################################
  7248. class PokeBattle_Move_133 < PokeBattle_Move
  7249. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7250. ratesharers=[
  7251. 0x133, # Kings Shield
  7252. 0xAA, # Detect, Protect
  7253. 0xAB, # Quick Guard
  7254. 0xAC, # Wide Guard
  7255. 0xE8 # Endure
  7256. ]
  7257. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  7258. attacker.effects[PBEffects::ProtectRate]=1
  7259. end
  7260. #TODO: Fails if attack strikes last
  7261. if @battle.pbRandom(65536)<(65536/attacker.effects[PBEffects::ProtectRate]).floor
  7262. attacker.effects[PBEffects::Protect]=true
  7263. attacker.effects[PBEffects::KingsShield]=true
  7264. attacker.effects[PBEffects::ProtectRate]*=2
  7265. @battle.pbAnimation(@id,attacker,nil)
  7266. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  7267. return 0
  7268. else
  7269. attacker.effects[PBEffects::ProtectRate]=1
  7270. @battle.pbDisplay(_INTL("But it failed!"))
  7271. return -1
  7272. end
  7273. end
  7274. end
  7275.  
  7276.  
  7277. ################################################################################
  7278. # Decreases the target's Evasion by 2 stages.
  7279. ################################################################################
  7280. class PokeBattle_Move_134 < PokeBattle_Move
  7281. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7282. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  7283. return -1 if !opponent.pbCanReduceStatStage?(PBStats::EVASION,true,attacker)
  7284. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7285. ret=opponent.pbReduceStat(PBStats::EVASION,2,true,true,false,attacker)
  7286. return ret ? 0 : -1
  7287. end
  7288.  
  7289. def pbAdditionalEffect(attacker,opponent)
  7290. if opponent.pbCanReduceStatStage?(PBStats::EVASION,false,attacker)
  7291. opponent.pbReduceStat(PBStats::EVASION,2,true,true,false,attacker)
  7292. end
  7293. return true
  7294. end
  7295. end
  7296.  
  7297.  
  7298. ################################################################################
  7299. # Increases the target's Special Defense by 1 stage.
  7300. ################################################################################
  7301. class PokeBattle_Move_135 < PokeBattle_Move
  7302. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7303. if !@battle.doublebattle
  7304. @battle.pbDisplay(_INTL("But it failed!"))
  7305. return -1
  7306. end
  7307. ret=-1
  7308. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7309. if opponent.pbCanIncreaseStatStage?(PBStats::SPDEF,false,attacker)
  7310. opponent.pbIncreaseStat(PBStats::SPDEF,1,true,true,attacker)
  7311. ret=0
  7312. end
  7313. return ret
  7314. end
  7315. end
  7316.  
  7317.  
  7318. ################################################################################
  7319. # Does absolutely nothing. (Celebrate)
  7320. ################################################################################
  7321. class PokeBattle_Move_136 < PokeBattle_Move
  7322. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7323. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7324. @battle.pbDisplay(_INTL("Congratulations, {1}!",$Trainer.name))
  7325. return 0
  7326. end
  7327. end
  7328.  
  7329.  
  7330. ################################################################################
  7331. # Crafty Shield
  7332. ################################################################################
  7333. class PokeBattle_Move_137 < PokeBattle_Move
  7334. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7335. if attacker.pbOwnSide.effects[PBEffects::CraftyShield]
  7336. @battle.pbDisplay(_INTL("But it failed!"))
  7337. return -1
  7338. end
  7339. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7340. attacker.pbOwnSide.effects[PBEffects::CraftyShield]=true
  7341. @battle.pbDisplay(_INTL("{1} protected it's allies from status moves",attacker.pbThis))
  7342. return 0
  7343. end
  7344. end
  7345.  
  7346.  
  7347. ################################################################################
  7348. # User gains 75% of the HP it inflicts as damage. (Draining Kiss)
  7349. ################################################################################
  7350. class PokeBattle_Move_138 < PokeBattle_Move
  7351. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7352. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7353. if opponent.damagestate.calcdamage>0
  7354. hpgain=((opponent.damagestate.hplost+1)*3/4).floor
  7355. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  7356. @battle.pbDisplayEffect(opponent)
  7357. attacker.pbReduceHP(hpgain,true)
  7358. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  7359. elsif attacker.effects[PBEffects::HealBlock]==0
  7360. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  7361. attacker.pbRecoverHP(hpgain,true)
  7362. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  7363. end
  7364. end
  7365. return ret
  7366. end
  7367. end
  7368.  
  7369. ################################################################################
  7370. # Decreases the target's Special Attack by 2 stages.
  7371. ################################################################################
  7372. class PokeBattle_Move_139 < PokeBattle_Move
  7373. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7374. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  7375. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,true,false,attacker)
  7376. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7377. ret=opponent.pbReduceStat(PBStats::SPATK,2,true,true,false,attacker)
  7378. return ret ? 0 : -1
  7379. end
  7380.  
  7381. def pbAdditionalEffect(attacker,opponent)
  7382. if opponent.pbCanReduceStatStage?(PBStats::SPATK,false,attacker)
  7383. opponent.pbReduceStat(PBStats::SPATK,2,true,true,false,attacker)
  7384. end
  7385. return true
  7386. end
  7387. end
  7388.  
  7389. ################################################################################
  7390. # Electric Terrain
  7391. ################################################################################
  7392. class PokeBattle_Move_140 < PokeBattle_Move
  7393. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7394. if @battle.field.effects[PBEffects::ElectricTerrain]>0
  7395. @battle.pbDisplay(_INTL("But it failed!"))
  7396. return -1
  7397. end
  7398. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7399. @battle.field.effects[PBEffects::ElectricTerrain]=5
  7400. @battle.pbDisplay(_INTL("An electric terrain runs across the battlefield!"))
  7401. return 0
  7402. end
  7403. end
  7404.  
  7405. ################################################################################
  7406. # User increases it's attack stat by 2 stages if opponent faints.
  7407. ################################################################################
  7408. class PokeBattle_Move_141 < PokeBattle_Move
  7409. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7410. return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
  7411. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,true)
  7412. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7413. ret=attacker.pbIncreaseStat(PBStats::ATTACK,false)
  7414. return ret ? 0 : -1
  7415. end
  7416.  
  7417. def pbAdditionalEffect(attacker,opponent)
  7418. if (attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,false) && opponent.hp<=0)
  7419. attacker.pbIncreaseStat(PBStats::ATTACK,2,false)
  7420. end
  7421. return true
  7422. end
  7423. end
  7424.  
  7425. ################################################################################
  7426. # Electrify
  7427. ################################################################################
  7428. class PokeBattle_Move_142 < PokeBattle_Move
  7429. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7430. if opponent.effects[PBEffects::Electrify]
  7431. @battle.pbDisplay(_INTL("But it failed!"))
  7432. return -1
  7433. end
  7434. if opponent.hasMovedThisRound?
  7435. @battle.pbDisplay(_INTL("But it failed!"))
  7436. return -1
  7437. end
  7438. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7439. opponent.effects[PBEffects::Electrify]=true
  7440. @battle.pbDisplay(_INTL("{1} was electrified!",opponent.pbThis))
  7441. return 0
  7442. end
  7443. end
  7444.  
  7445. ################################################################################
  7446. # Flower Shield
  7447. ################################################################################
  7448. class PokeBattle_Move_143 < PokeBattle_Move
  7449. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7450. for i in @battle.battlers
  7451. if i.pbHasType?(:GRASS) && i.pbCanIncreaseStatStage?(PBStats::DEFENSE,true)
  7452. i.pbIncreaseStat(PBStats::DEFENSE,1,true)
  7453. end
  7454. end
  7455. return 0
  7456. end
  7457. end
  7458.  
  7459. ################################################################################
  7460. # Forests Curse
  7461. ################################################################################
  7462. class PokeBattle_Move_144 < PokeBattle_Move
  7463. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7464. if opponent.effects[PBEffects::Substitute]>0
  7465. @battle.pbDisplay(_INTL("But it failed!"))
  7466. return -1
  7467. end
  7468. if opponent.hasWorkingAbility(:MULTITYPE) || opponent.pbHasType?(:GRASS)
  7469. @battle.pbDisplay(_INTL("But it failed!"))
  7470. return -1
  7471. end
  7472. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7473. opponent.type3=getConst(PBTypes,:GRASS) #override the 3rd type
  7474. typename=PBTypes.getName(getConst(PBTypes,:GRASS))
  7475. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  7476. return 0
  7477. end
  7478. end
  7479.  
  7480. ################################################################################
  7481. # Trick Or Treat
  7482. ################################################################################
  7483. class PokeBattle_Move_145 < PokeBattle_Move
  7484. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7485. if opponent.effects[PBEffects::Substitute]>0
  7486. @battle.pbDisplay(_INTL("But it failed!"))
  7487. return -1
  7488. end
  7489. if opponent.hasWorkingAbility(:MULTITYPE) || opponent.pbHasType?(:GHOST)
  7490. @battle.pbDisplay(_INTL("But it failed!"))
  7491. return -1
  7492. end
  7493. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7494. opponent.type3=getConst(PBTypes,:GHOST) #override the 3rd type
  7495. typename=PBTypes.getName(getConst(PBTypes,:GHOST))
  7496. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",opponent.pbThis,typename))
  7497. return 0
  7498. end
  7499. end
  7500.  
  7501. ################################################################################
  7502. # After lowering stats, user switches out.
  7503. #Parting Shot
  7504. ################################################################################
  7505. class PokeBattle_Move_146 < PokeBattle_Move
  7506. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7507. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7508. if opponent.effects[PBEffects::Substitute]>0
  7509. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  7510. return -1
  7511. end
  7512. if opponent.pbTooLow?(PBStats::ATTACK) &&
  7513. opponent.pbTooLow?(PBStats::SPATK)
  7514. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  7515. return -1
  7516. end
  7517. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  7518. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  7519. return -1
  7520. end
  7521. if opponent.hasWorkingAbility(:CLEARBODY) ||
  7522. opponent.hasWorkingAbility(:WHITESMOKE)
  7523. @battle.pbDisplayEffect(opponent)
  7524. if EFFECTMESSAGES
  7525. @battle.pbDisplay(_INTL("{1}'s stats were not lowered.",opponent.pbThis))
  7526. else
  7527. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  7528. PBAbilities.getName(opponent.ability)))
  7529. end
  7530. return -1
  7531. end
  7532. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7533. ret=-1; showanim=true
  7534. if opponent.pbReduceStat(PBStats::ATTACK,1,true,showanim,attacker)
  7535. ret=0; showanim=false
  7536. end
  7537. if opponent.pbReduceStat(PBStats::SPATK,1,true,showanim,attacker)
  7538. ret=0; showanim=false
  7539. end
  7540. attacker.effects[PBEffects::LetSwitch]=true
  7541. return ret
  7542. end
  7543. end
  7544.  
  7545. ################################################################################
  7546. # Skips first turn, boosts Sp.Atk, Sp.Def and Speed on the second.
  7547. # Geomancy
  7548. ################################################################################
  7549. class PokeBattle_Move_147 < PokeBattle_Move
  7550. def pbTwoTurnAttack(attacker)
  7551. @immediate=false
  7552. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  7553. itemname=PBItems.getName(attacker.item)
  7554. @immediate=true
  7555. attacker.pokemon.itemRecycle=attacker.item
  7556. attacker.pokemon.itemInitial=0 if attacker.pokemon.itemInitial==attacker.item
  7557. attacker.item=0
  7558. @battle.pbDisplay(_INTL("{1} consumed its {2}!",attacker.pbThis,itemname))
  7559. end
  7560. return false if @immediate
  7561. return attacker.effects[PBEffects::TwoTurnAttack]==0
  7562. end
  7563.  
  7564. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7565. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  7566. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation) # Placeholder for charging Common anim
  7567. @battle.pbDisplay(_INTL("{1} absorbed energy!",attacker.pbThis))
  7568. end
  7569. if attacker.effects[PBEffects::TwoTurnAttack]==0
  7570. anim=true
  7571. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,true,attacker)
  7572. attacker.pbIncreaseStat(PBStats::SPATK,2,true,anim,attacker)
  7573. anim=false
  7574. end
  7575. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,true,attacker)
  7576. attacker.pbIncreaseStat(PBStats::SPDEF,2,true,anim,attacker)
  7577. anim=false
  7578. end
  7579. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,true,attacker)
  7580. attacker.pbIncreaseStat(PBStats::SPEED,2,true,anim,attacker)
  7581. end
  7582. end
  7583. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  7584. return super
  7585. end
  7586. end
  7587.  
  7588. ################################################################################
  7589. # Decreases a poisoned target's Attack, Sp.Atk and Speed by 1 stage.
  7590. #Venom Drench
  7591. ################################################################################
  7592. class PokeBattle_Move_148 < PokeBattle_Move
  7593. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7594. if opponent.effects[PBEffects::Substitute]>0
  7595. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  7596. return -1
  7597. end
  7598. if opponent.status!=PBStatuses::POISON
  7599. @battle.pbDisplay(_INTL("But it failed!",opponent.pbThis))
  7600. return -1
  7601. end
  7602. if !(opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,opponent) &&
  7603. !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,false,false,opponent) &&
  7604. !opponent.pbCanReduceStatStage?(PBStats::SPEED,false,false,opponent))
  7605. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  7606. return -1
  7607. end
  7608. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7609. ret=-1; showanim=true
  7610. if opponent.status==PBStatuses::POISON
  7611. if opponent.pbReduceStat(PBStats::ATTACK,1,true,showanim,attacker)
  7612. ret=0; showanim=false
  7613. end
  7614. if opponent.pbReduceStat(PBStats::SPATK,1,true,showanim,attacker)
  7615. ret=0; showanim=false
  7616. end
  7617. if opponent.pbReduceStat(PBStats::SPEED,1,true,showanim,attacker)
  7618. ret=0
  7619. end
  7620. return ret
  7621. end
  7622. end
  7623. end
  7624.  
  7625.  
  7626. ################################################################################
  7627. # Grassy Terrain
  7628. ################################################################################
  7629. class PokeBattle_Move_149 < PokeBattle_Move
  7630. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7631. if @battle.field.effects[PBEffects::GrassyTerrain]>0
  7632. @battle.pbDisplay(_INTL("But it failed!"))
  7633. return -1
  7634. end
  7635. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7636. @battle.field.effects[PBEffects::GrassyTerrain]=5
  7637. @battle.pbDisplay(_INTL("A Grassy Terrain grew to cover the battlefield!"))
  7638. return 0
  7639. end
  7640. end
  7641.  
  7642. ################################################################################
  7643. # Misty Terrain
  7644. ################################################################################
  7645. class PokeBattle_Move_150 < PokeBattle_Move
  7646. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7647. if @battle.field.effects[PBEffects::MistyTerrain]>0
  7648. @battle.pbDisplay(_INTL("But it failed!"))
  7649. return -1
  7650. end
  7651. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  7652. @battle.field.effects[PBEffects::MistyTerrain]=5
  7653. @battle.pbDisplay(_INTL("The Misty Terrain started!"))
  7654. return 0
  7655. end
  7656. end
  7657.  
  7658.  
  7659. ################################################################################
  7660. # Decreases the target's Attack and Special Attack by 1 stage each. (Noble Roar)
  7661. # Noble Roar
  7662. ################################################################################
  7663. class PokeBattle_Move_151 < PokeBattle_Move
  7664. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7665. if opponent.pbTooLow?(PBStats::ATTACK) &&
  7666. opponent.pbTooLow?(PBStats::SPATK)
  7667. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  7668. return -1
  7669. end
  7670. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  7671. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  7672. return -1
  7673. end
  7674. if opponent.hasWorkingAbility(:CLEARBODY) ||
  7675. opponent.hasWorkingAbility(:WHITESMOKE)
  7676. if !attacker.hasBypassAbility
  7677. @battle.pbDisplayEffect(opponent)
  7678. if EFFECTMESSAGES
  7679. @battle.pbDisplay(_INTL("{1}'s stats were not lowered.",opponent.pbThis))
  7680. else
  7681. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  7682. PBAbilities.getName(opponent.ability)))
  7683. end
  7684. return -1
  7685. end
  7686. end
  7687. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7688. ret=-1; showanim=true
  7689. if opponent.pbReduceStat(PBStats::ATTACK,1,true,showanim,false,attacker)
  7690. ret=0; showanim=false
  7691. end
  7692. if opponent.pbReduceStat(PBStats::SPATK,1,true,showanim,false,attacker)
  7693. ret=0; showanim=false
  7694. end
  7695. return ret
  7696. end
  7697. end
  7698.  
  7699. ################################################################################
  7700. # Happy Hour
  7701. # Player wins double money after battle
  7702. ################################################################################
  7703. class PokeBattle_Move_152 < PokeBattle_Move
  7704. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7705. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7706. if @battle.pbOwnedByPlayer?(attacker.index)
  7707. if !@battle.happyhour[0]
  7708. @battle.pbDisplay(_INTL("The Happy Hour started!"))
  7709. @battle.happyhour[0]=true
  7710. else
  7711. @battle.pbDisplay(_INTL("But it failed!"))
  7712. end
  7713. end
  7714. return ret
  7715. end
  7716. end
  7717.  
  7718. ################################################################################
  7719. # Ion Deluge
  7720. ################################################################################
  7721. class PokeBattle_Move_153 < PokeBattle_Move
  7722. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7723. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7724. if !(@battle.field.effects[PBEffects::IonDeluge])
  7725. @battle.field.effects[PBEffects::IonDeluge] = true
  7726. @battle.pbDisplay(_INTL("The Ion Deluge started!"))
  7727. else
  7728. @battle.pbDisplay(_INTL("But it failed!"))
  7729. return -1
  7730. end
  7731. return ret
  7732. end
  7733. end
  7734.  
  7735. ################################################################################
  7736. # Topsy Turvy
  7737. ################################################################################
  7738. class PokeBattle_Move_154 < PokeBattle_Move
  7739. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7740. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7741. count=0
  7742. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  7743. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  7744. if opponent.stages[i]!=0
  7745. opponent.stages[i]*=-1
  7746. count+=1
  7747. end
  7748. end
  7749. if count>0
  7750. @battle.pbDisplay(_INTL("{1}'s stats were reversed!",opponent.pbThis))
  7751. else
  7752. @battle.pbDisplay(_INTL("But it failed!"))
  7753. return -1
  7754. end
  7755. return ret
  7756. end
  7757. end
  7758.  
  7759. ################################################################################
  7760. # Entry hazard. Lays a Sticky Web on the opposing side
  7761. ################################################################################
  7762. class PokeBattle_Move_155 < PokeBattle_Move
  7763. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7764. if attacker.pbOpposingSide.effects[PBEffects::StickyWeb]
  7765. @battle.pbDisplay(_INTL("But it failed!"))
  7766. return -1
  7767. end
  7768. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7769. attacker.pbOpposingSide.effects[PBEffects::StickyWeb]=true
  7770. if !@battle.pbIsOpposing?(attacker.index)
  7771. @battle.pbDisplay(_INTL("A sticky web spreads out beneath your foe's feet!"))
  7772. else
  7773. @battle.pbDisplay(_INTL("A sticky web spreads out beneath your team's feet!"))
  7774. end
  7775. return 0
  7776. end
  7777. end
  7778.  
  7779. ################################################################################
  7780. # Spiky Shield
  7781. ################################################################################
  7782. class PokeBattle_Move_156 < PokeBattle_Move
  7783. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7784. ratesharers=[
  7785. 0x156, # Spiky Shield
  7786. 0x133, # Kings Shield
  7787. 0xAA, # Detect, Protect
  7788. 0xAB, # Quick Guard
  7789. 0xAC, # Wide Guard
  7790. 0xE8 # Endure
  7791. ]
  7792. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  7793. attacker.effects[PBEffects::ProtectRate]=1
  7794. end
  7795. #TODO: Fails if attack strikes last
  7796. if @battle.pbRandom(65536)<(65536/attacker.effects[PBEffects::ProtectRate]).floor
  7797. attacker.effects[PBEffects::Protect]=true
  7798. attacker.effects[PBEffects::SpikyShield]=true
  7799. attacker.effects[PBEffects::ProtectRate]*=2
  7800. @battle.pbAnimation(@id,attacker,nil)
  7801. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  7802. return 0
  7803. else
  7804. attacker.effects[PBEffects::ProtectRate]=1
  7805. @battle.pbDisplay(_INTL("But it failed!"))
  7806. return -1
  7807. end
  7808. end
  7809. end
  7810.  
  7811. ################################################################################
  7812. # Rototiller
  7813. ################################################################################
  7814. class PokeBattle_Move_157 < PokeBattle_Move
  7815. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7816. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  7817. for battler in @battle.battlers
  7818. if battler.pbHasType?(:GRASS)
  7819. if !opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,false,attacker) &&
  7820. !opponent.pbCanIncreaseStatStage?(PBStats::SPATK,false,attacker)
  7821. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  7822. next
  7823. end
  7824. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  7825. showanim=true
  7826. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,false,attacker)
  7827. opponent.pbReduceStat(PBStats::ATTACK,1,true,showanim,attacker)
  7828. showanim=false
  7829. end
  7830. if opponent.pbCanReduceStatStage?(PBStats::SPATK,false,attacker)
  7831. opponent.pbReduceStat(PBStats::SPATK,1,true,showanim,attacker)
  7832. showanim=false
  7833. end
  7834. end
  7835. end
  7836. return ret
  7837. end
  7838. end
  7839.  
  7840.  
  7841. ################################################################################
  7842. # Mat Block
  7843. ################################################################################
  7844. class PokeBattle_Move_158 < PokeBattle_Move
  7845. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7846. #TODO: Fails if attack strikes last
  7847. attacker.effects[PBEffects::MatBlock]=true
  7848. @battle.pbAnimation(@id,attacker,nil)
  7849. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  7850. return 0
  7851. end
  7852.  
  7853. def pbMoveFailed(attacker,opponent)
  7854. return (attacker.turncount!=1)
  7855. end
  7856.  
  7857. end
  7858.  
  7859. ################################################################################
  7860. # Magnetic Flux
  7861. ################################################################################
  7862. class PokeBattle_Move_159 < PokeBattle_Move
  7863. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7864. if attacker.pbPartner
  7865. if attacker.pbPartner.hasWorkingAbility(:PLUS) || attacker.pbPartner.hasWorkingAbility(:MINUS)
  7866. anim=true
  7867. if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::DEFENSE,true)
  7868. attacker.pbPartner.pbIncreaseStat(PBStats::DEFENSE,1,true,anim)
  7869. end
  7870. if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::SPDEF,true)
  7871. attacker.pbPartner.pbIncreaseStat(PBStats::SPDEF,1,true,anim)
  7872. end
  7873. end
  7874. end
  7875. return 0
  7876. end
  7877. end
  7878.  
  7879. ################################################################################
  7880. # Pledges
  7881. ################################################################################
  7882. class PokeBattle_Move_160 < PokeBattle_Move
  7883.  
  7884. def pbMoveFailed(attacker,opponent)
  7885. if @battle.doublebattle
  7886. if @choices[attacker.pbPartner.index][2].function==0x160
  7887. if attacker.pbPartner.hasMovedThisRound? && !attacker.pbPartner.hasMovedSuccessfullyThisRound?
  7888. return true
  7889. end
  7890. end
  7891. end
  7892. return false
  7893. end
  7894.  
  7895. def pbModifyDamage(damagemult,attacker,opponent)
  7896. if @battle.doublebattle && attacker.pbPartner.hasMovedSuccessfullyThisRound? &&
  7897. @choices[attacker.pbPartner.index][2].function==0x160
  7898. return (damagemult*2.0).round
  7899. end
  7900. return damagemult
  7901. end
  7902.  
  7903. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7904. if @battle.doublebattle && attacker.pbPartner.hasMovedSuccessfullyThisRound? &&
  7905. @choices[attacker.pbPartner.index][2].function==0x160
  7906. if @type==getID(PBTypes,:GRASS)
  7907. if opponent.pbOwnSide.effects[PBEffects::GrassPledge]<=0
  7908. opponent.pbOwnSide.effects[PBEffects::GrassPledge]=4
  7909. end
  7910. elsif @type==getID(PBTypes,:FIRE)
  7911. if opponent.pbOwnSide.effects[PBEffects::FirePledge]<=0
  7912. opponent.pbOwnSide.effects[PBEffects::FirePledge]=4
  7913. end
  7914. elsif @type==getID(PBTypes,:WATER)
  7915. if opponent.pbOwnSide.effects[PBEffects::WaterPledge]<=0
  7916. opponent.pbOwnSide.effects[PBEffects::WaterPledge]=4
  7917. end
  7918. end
  7919. end
  7920. return 0
  7921. end
  7922.  
  7923. end
  7924.  
  7925.  
  7926. ################################################################################
  7927. # Powder
  7928. ################################################################################
  7929. class PokeBattle_Move_161 < PokeBattle_Move
  7930. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  7931. if opponent.effects[PBEffects::Powder]==true || opponent.hasWorkingAbility(:OVERCOAT) ||
  7932. opponent.pbHasType?(:GRASS) || opponent.hasWorkingItem(:SAFETYGOGGLES)
  7933. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  7934. return -1
  7935. end
  7936. opponent.effects[PBEffects::Powder]=true
  7937. @battle.pbAnimation(@id,opponent,nil)
  7938. @battle.pbDisplay(_INTL("{1} is covered in powder!",opponent.pbThis))
  7939. return 0
  7940. end
  7941. end
  7942.  
  7943. ################################################################################
  7944. # Belch
  7945. ################################################################################
  7946. class PokeBattle_Move_162 < PokeBattle_Move
  7947. def pbMoveFailed(attacker,opponent)
  7948. if !(attacker.effects[PBEffects::CanBelch])
  7949. @battle.pbDisplay(_INTL("But it failed!"))
  7950. return true
  7951. else
  7952. return false
  7953. end
  7954. end
  7955. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement