Advertisement
M3rein

Untitled

Mar 25th, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 264.74 KB | None | 0 0
  1. # Already Known Edits:
  2. # - pbCalcDamage: Foul Play, Psystrike, Chip Away
  3. # - pbSuccessCheck: Smack Down, Sky Drop, Hurricane
  4. # - pbAccuracyCheck: Chip Away
  5.  
  6. ################################################################################
  7. # Superclass that handles moves using a non-existent function code.
  8. # Damaging moves just do damage with no additional effect.
  9. # Non-damaging moves always fail.
  10. ################################################################################
  11. class PokeBattle_UnimplementedMove < PokeBattle_Move
  12. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  13. if pbIsDamaging?
  14. return super(attacker,opponent,hitnum,alltargets,showanimation)
  15. else
  16. @battle.pbDisplay("But it failed!")
  17. return -1
  18. end
  19. end
  20. end
  21. ################################################################################
  22. # Superclass for a failed move. Always fails.
  23. # This class is unused.
  24. ################################################################################
  25. class PokeBattle_FailedMove < PokeBattle_Move
  26. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  27. @battle.pbDisplay("But it failed!")
  28. return -1
  29. end
  30. end
  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); return true; end
  51. def pbIsSpecial?(type); return false; end
  52.  
  53. def pbCalcDamage(attacker,opponent)
  54. return super(attacker,opponent,
  55. PokeBattle_Move::NOCRITICAL|PokeBattle_Move::SELFCONFUSE|PokeBattle_Move::NOTYPE|PokeBattle_Move::NOWEIGHTING)
  56. end
  57.  
  58. def pbEffectMessages(attacker,opponent,ignoretype=false)
  59. return super(attacker,opponent,true)
  60. end
  61. end
  62. ################################################################################
  63. # Implements the move Struggle.
  64. # For cases where the real move named Struggle is not defined.
  65. ################################################################################
  66. class PokeBattle_Struggle < PokeBattle_Move
  67. def initialize(battle,move)
  68. @id = -1 # doesn't work if 0
  69. @battle = battle
  70. @name = _INTL("Struggle")
  71. @basedamage = 50
  72. @type = -1
  73. @accuracy = 0
  74. @addlEffect = 0
  75. @target = 0
  76. @priority = 0
  77. @flags = 0
  78. @thismove = nil # not associated with a move
  79. @pp = -1
  80. @totalpp = 0
  81. if move
  82. @id = move.id
  83. @name = PBMoves.getName(id)
  84. end
  85. end
  86.  
  87. def pbIsPhysical?(type); return true; end
  88. def pbIsSpecial?(type); return false; end
  89.  
  90. def pbEffectAfterHit(attacker,opponent,turneffects)
  91. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  92. attacker.pbReduceHP((attacker.totalhp/4.0).round)
  93. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  94. end
  95. end
  96.  
  97. def pbCalcDamage(attacker,opponent)
  98. return super(attacker,opponent,PokeBattle_Move::IGNOREPKMNTYPES)
  99. end
  100. end
  101. ################################################################################
  102. # No additional effect.
  103. ################################################################################
  104. class PokeBattle_Move_000 < PokeBattle_Move
  105. end
  106. ################################################################################
  107. # Does absolutely nothing. (Splash)
  108. ################################################################################
  109. class PokeBattle_Move_001 < PokeBattle_Move
  110. def unusableInGravity?
  111. return true
  112. end
  113.  
  114. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  115. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  116. @battle.pbDisplay(_INTL("But nothing happened!"))
  117. return 0
  118. end
  119. end
  120. ################################################################################
  121. # Struggle. Overrides the default Struggle effect above.
  122. ################################################################################
  123. class PokeBattle_Move_002 < PokeBattle_Struggle
  124. end
  125. ################################################################################
  126. # Puts the target to sleep.
  127. ################################################################################
  128. class PokeBattle_Move_003 < PokeBattle_Move
  129. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  130. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  131. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  132. if opponent.pbCanSleep?(attacker,true,self)
  133. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  134. opponent.pbSleep
  135. return 0
  136. end
  137. return -1
  138. end
  139.  
  140. def pbAdditionalEffect(attacker,opponent)
  141. return if opponent.damagestate.substitute
  142. if opponent.pbCanSleep?(attacker,false,self)
  143. opponent.pbSleep
  144. end
  145. end
  146. end
  147. ################################################################################
  148. # Makes the target drowsy; it will fall asleep at the end of the next turn. (Yawn)
  149. ################################################################################
  150. class PokeBattle_Move_004 < PokeBattle_Move
  151. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  152. return -1 if !opponent.pbCanSleep?(attacker,true,self)
  153. if opponent.effects[PBEffects::Yawn]>0
  154. @battle.pbDisplay(_INTL("But it failed!"))
  155. return -1
  156. end
  157. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  158. opponent.effects[PBEffects::Yawn]=2
  159. @battle.pbDisplay(_INTL("{1} made {2} drowsy!",attacker.pbThis,opponent.pbThis(true)))
  160. return 0
  161. end
  162. end
  163. ################################################################################
  164. # Poisons the target.
  165. ################################################################################
  166. class PokeBattle_Move_005 < PokeBattle_Move
  167. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  168. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  169. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  170. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  171. opponent.pbPoison(attacker)
  172. return 0
  173. end
  174.  
  175. def pbAdditionalEffect(attacker,opponent)
  176. return if opponent.damagestate.substitute
  177. if opponent.pbCanPoison?(attacker,false,self)
  178. opponent.pbPoison(attacker)
  179. end
  180. end
  181. end
  182. ################################################################################
  183. # Badly poisons the target. (Poison Fang, Toxic)
  184. # (Handled in Battler's pbSuccessCheck): Hits semi-invulnerable targets if user
  185. # is Poison-type and move is status move.
  186. ################################################################################
  187. class PokeBattle_Move_006 < PokeBattle_Move
  188. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  189. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  190. return -1 if !opponent.pbCanPoison?(attacker,true,self)
  191. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  192. opponent.pbPoison(attacker,nil,true)
  193. return 0
  194. end
  195.  
  196. def pbAdditionalEffect(attacker,opponent)
  197. return if opponent.damagestate.substitute
  198. if opponent.pbCanPoison?(attacker,false,self)
  199. opponent.pbPoison(attacker,nil,true)
  200. end
  201. end
  202. end
  203. ################################################################################
  204. # Paralyzes the target.
  205. # Thunder Wave: Doesn't affect target if move's type has no effect on it.
  206. ################################################################################
  207. class PokeBattle_Move_007 < PokeBattle_Move
  208. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  209. if pbIsDamaging?
  210. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  211. return ret
  212. else
  213. if isConst?(@id,PBMoves,:THUNDERWAVE)
  214. if pbTypeModifier(type,attacker,opponent)==0
  215. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  216. return -1
  217. end
  218. end
  219. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  220. return -1 if !opponent.pbCanParalyze?(attacker,true,self)
  221. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  222. opponent.pbParalyze(attacker)
  223. return 0
  224. end
  225. return -1
  226. end
  227.  
  228. def pbAdditionalEffect(attacker,opponent)
  229. return if opponent.damagestate.substitute
  230. if opponent.pbCanParalyze?(attacker,false,self)
  231. opponent.pbParalyze(attacker)
  232. end
  233. end
  234. end
  235. ################################################################################
  236. # Paralyzes the target. Accuracy perfect in rain, 50% in sunshine. (Thunder)
  237. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  238. ################################################################################
  239. class PokeBattle_Move_008 < PokeBattle_Move
  240. def pbAdditionalEffect(attacker,opponent)
  241. return if opponent.damagestate.substitute
  242. if opponent.pbCanParalyze?(attacker,false,self)
  243. opponent.pbParalyze(attacker)
  244. end
  245. end
  246.  
  247. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  248. case @battle.pbWeather
  249. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  250. return 0
  251. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  252. return 50
  253. end
  254. return baseaccuracy
  255. end
  256. end
  257. ################################################################################
  258. # Paralyzes the target. May cause the target to flinch. (Thunder Fang)
  259. ################################################################################
  260. class PokeBattle_Move_009 < PokeBattle_Move
  261. def pbAdditionalEffect(attacker,opponent)
  262. return if opponent.damagestate.substitute
  263. if @battle.pbRandom(10)==0
  264. if opponent.pbCanParalyze?(attacker,false,self)
  265. opponent.pbParalyze(attacker)
  266. end
  267. end
  268. if @battle.pbRandom(10)==0
  269. opponent.pbFlinch(attacker)
  270. end
  271. end
  272. end
  273. ################################################################################
  274. # Burns the target.
  275. ################################################################################
  276. class PokeBattle_Move_00A < PokeBattle_Move
  277. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  278. if pbIsDamaging?
  279. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  280. return ret
  281. else
  282. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  283. return -1 if !opponent.pbCanBurn?(attacker,true,self)
  284. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  285. opponent.pbBurn(attacker)
  286. return 0
  287. end
  288. return -1
  289. end
  290.  
  291. def pbAdditionalEffect(attacker,opponent)
  292. return if opponent.damagestate.substitute
  293. if opponent.pbCanBurn?(attacker,false,self)
  294. opponent.pbBurn(attacker)
  295. end
  296. end
  297. end
  298. ################################################################################
  299. # Burns the target. May cause the target to flinch. (Fire Fang)
  300. ################################################################################
  301. class PokeBattle_Move_00B < PokeBattle_Move
  302. def pbAdditionalEffect(attacker,opponent)
  303. return if opponent.damagestate.substitute
  304. if @battle.pbRandom(10)==0
  305. if opponent.pbCanBurn?(attacker,false,self)
  306. opponent.pbBurn(attacker)
  307. end
  308. end
  309. if @battle.pbRandom(10)==0
  310. opponent.pbFlinch(attacker)
  311. end
  312. end
  313. end
  314. ################################################################################
  315. # Freezes the target.
  316. ################################################################################
  317. class PokeBattle_Move_00C < PokeBattle_Move
  318. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  319. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  320. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  321. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  322. opponent.pbFreeze
  323. return 0
  324. end
  325.  
  326. def pbAdditionalEffect(attacker,opponent)
  327. return if opponent.damagestate.substitute
  328. if opponent.pbCanFreeze?(attacker,false,self)
  329. opponent.pbFreeze
  330. end
  331. end
  332. end
  333. ################################################################################
  334. # Freezes the target. Accuracy perfect in hail. (Blizzard)
  335. ################################################################################
  336. class PokeBattle_Move_00D < PokeBattle_Move
  337. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  338. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  339. return -1 if !opponent.pbCanFreeze?(attacker,true,self)
  340. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  341. opponent.pbFreeze
  342. return 0
  343. end
  344.  
  345. def pbAdditionalEffect(attacker,opponent)
  346. return if opponent.damagestate.substitute
  347. if opponent.pbCanFreeze?(attacker,false,self)
  348. opponent.pbFreeze
  349. end
  350. end
  351.  
  352. def pbModifyBaseAccuracy(baseaccuracy,attacker,opponent)
  353. if @battle.pbWeather==PBWeather::HAIL
  354. return 0
  355. end
  356. return baseaccuracy
  357. end
  358. end
  359. ################################################################################
  360. # Freezes the target. May cause the target to flinch. (Ice Fang)
  361. ################################################################################
  362. class PokeBattle_Move_00E < PokeBattle_Move
  363. def pbAdditionalEffect(attacker,opponent)
  364. return if opponent.damagestate.substitute
  365. if @battle.pbRandom(10)==0
  366. if opponent.pbCanFreeze?(attacker,false,self)
  367. opponent.pbFreeze
  368. end
  369. end
  370. if @battle.pbRandom(10)==0
  371. opponent.pbFlinch(attacker)
  372. end
  373. end
  374. end
  375. ################################################################################
  376. # Causes the target to flinch.
  377. ################################################################################
  378. class PokeBattle_Move_00F < PokeBattle_Move
  379. def pbAdditionalEffect(attacker,opponent)
  380. return if opponent.damagestate.substitute
  381. opponent.pbFlinch(attacker)
  382. end
  383. end
  384. ################################################################################
  385. # Causes the target to flinch. Does double damage and has perfect accuracy if
  386. # the target is Minimized.
  387. ################################################################################
  388. class PokeBattle_Move_010 < PokeBattle_Move
  389. def pbAdditionalEffect(attacker,opponent)
  390. return if opponent.damagestate.substitute
  391. opponent.pbFlinch(attacker)
  392. end
  393.  
  394. def tramplesMinimize?(param=1)
  395. return false if isConst?(@id,PBMoves,:DRAGONRUSH) && !USENEWBATTLEMECHANICS
  396. return true if param==1 && USENEWBATTLEMECHANICS # Perfect accuracy
  397. return true if param==2 # Double damage
  398. return false
  399. end
  400. end
  401. ################################################################################
  402. # Causes the target to flinch. Fails if the user is not asleep. (Snore)
  403. ################################################################################
  404. class PokeBattle_Move_011 < PokeBattle_Move
  405. def pbCanUseWhileAsleep?
  406. return true
  407. end
  408.  
  409. def pbMoveFailed(attacker,opponent)
  410. return (attacker.status!=PBStatuses::SLEEP)
  411. end
  412.  
  413. def pbAdditionalEffect(attacker,opponent)
  414. return if opponent.damagestate.substitute
  415. opponent.pbFlinch(attacker)
  416. end
  417. end
  418. ################################################################################
  419. # Causes the target to flinch. Fails if this isn't the user's first turn. (Fake Out)
  420. ################################################################################
  421. class PokeBattle_Move_012 < PokeBattle_Move
  422. def pbMoveFailed(attacker,opponent)
  423. return (attacker.turncount>1)
  424. end
  425.  
  426. def pbAdditionalEffect(attacker,opponent)
  427. return if opponent.damagestate.substitute
  428. opponent.pbFlinch(attacker)
  429. end
  430. end
  431. ################################################################################
  432. # Confuses the target.
  433. ################################################################################
  434. class PokeBattle_Move_013 < PokeBattle_Move
  435. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  436. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  437. if opponent.pbCanConfuse?(attacker,true,self)
  438. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  439. opponent.pbConfuse
  440. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  441. return 0
  442. end
  443. return -1
  444. end
  445.  
  446. def pbAdditionalEffect(attacker,opponent)
  447. return if opponent.damagestate.substitute
  448. if opponent.pbCanConfuse?(attacker,false,self)
  449. opponent.pbConfuse
  450. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  451. end
  452. end
  453. end
  454. ################################################################################
  455. # Confuses the target. Chance of causing confusion depends on the cry's volume.
  456. # Confusion chance is 0% if user doesn't have a recorded cry. (Chatter)
  457. # TODO: Play the actual chatter cry as part of the move animation
  458. # @battle.scene.pbChatter(attacker,opponent) # Just plays cry
  459. ################################################################################
  460. class PokeBattle_Move_014 < PokeBattle_Move
  461. def addlEffect
  462. return 100 if USENEWBATTLEMECHANICS
  463. if attacker.pokemon && attacker.pokemon.chatter
  464. return attacker.pokemon.chatter.intensity*10/127
  465. end
  466. return 0
  467. end
  468.  
  469. def pbAdditionalEffect(attacker,opponent)
  470. return if opponent.damagestate.substitute
  471. if opponent.pbCanConfuse?(attacker,false,self)
  472. opponent.pbConfuse
  473. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  474. end
  475. end
  476. end
  477. ################################################################################
  478. # Attracts the target. (Attract)
  479. ################################################################################
  480. class PokeBattle_Move_016 < PokeBattle_Move
  481. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  482. if !opponent.pbCanAttract?(attacker)
  483. return -1
  484. end
  485. if !attacker.hasMoldBreaker
  486. if opponent.hasWorkingAbility(:AROMAVEIL)
  487. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  488. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  489. return -1
  490. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  491. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  492. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  493. return -1
  494. end
  495. end
  496. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  497. opponent.pbAttract(attacker)
  498. return 0
  499. end
  500. end
  501. ################################################################################
  502. # Burns, freezes or paralyzes the target. (Tri Attack)
  503. ################################################################################
  504. class PokeBattle_Move_017 < PokeBattle_Move
  505. def pbAdditionalEffect(attacker,opponent)
  506. return if opponent.damagestate.substitute
  507. case @battle.pbRandom(3)
  508. when 0
  509. if opponent.pbCanBurn?(attacker,false,self)
  510. opponent.pbBurn(attacker)
  511. end
  512. when 1
  513. if opponent.pbCanFreeze?(attacker,false,self)
  514. opponent.pbFreeze
  515. end
  516. when 2
  517. if opponent.pbCanParalyze?(attacker,false,self)
  518. opponent.pbParalyze(attacker)
  519. end
  520. end
  521. end
  522. end
  523. ################################################################################
  524. # Cures user of burn, poison and paralysis. (Refresh)
  525. ################################################################################
  526. class PokeBattle_Move_018 < PokeBattle_Move
  527. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  528. if attacker.status!=PBStatuses::BURN &&
  529. attacker.status!=PBStatuses::POISON &&
  530. attacker.status!=PBStatuses::PARALYSIS
  531. @battle.pbDisplay(_INTL("But it failed!"))
  532. return -1
  533. else
  534. t=attacker.status
  535. attacker.pbCureStatus(false)
  536. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  537. if t==PBStatuses::BURN
  538. @battle.pbDisplay(_INTL("{1} healed its burn!",attacker.pbThis))
  539. elsif t==PBStatuses::POISON
  540. @battle.pbDisplay(_INTL("{1} cured its poisoning!",attacker.pbThis))
  541. elsif t==PBStatuses::PARALYSIS
  542. @battle.pbDisplay(_INTL("{1} cured its paralysis!",attacker.pbThis))
  543. end
  544. return 0
  545. end
  546. end
  547. end
  548. ################################################################################
  549. # Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
  550. ################################################################################
  551. class PokeBattle_Move_019 < PokeBattle_Move
  552. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  553. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  554. if isConst?(@id,PBMoves,:AROMATHERAPY)
  555. @battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
  556. else
  557. @battle.pbDisplay(_INTL("A bell chimed!"))
  558. end
  559. activepkmn=[]
  560. for i in @battle.battlers
  561. next if attacker.pbIsOpposing?(i.index) || i.isFainted?
  562. activepkmn.push(i.pokemonIndex)
  563. next if USENEWBATTLEMECHANICS && i.index!=attacker.index &&
  564. pbTypeImmunityByAbility(pbType(@type,attacker,i),attacker,i)
  565. case i.status
  566. when PBStatuses::PARALYSIS
  567. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",i.pbThis))
  568. when PBStatuses::SLEEP
  569. @battle.pbDisplay(_INTL("{1}'s sleep was woken.",i.pbThis))
  570. when PBStatuses::POISON
  571. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",i.pbThis))
  572. when PBStatuses::BURN
  573. @battle.pbDisplay(_INTL("{1}'s burn was healed.",i.pbThis))
  574. when PBStatuses::FROZEN
  575. @battle.pbDisplay(_INTL("{1} was thawed out.",i.pbThis))
  576. end
  577. i.pbCureStatus(false)
  578. end
  579. party=@battle.pbParty(attacker.index) # NOTE: Considers both parties in multi battles
  580. for i in 0...party.length
  581. next if activepkmn.include?(i)
  582. next if !party[i] || party[i].isEgg? || party[i].hp<=0
  583. case party[i].status
  584. when PBStatuses::PARALYSIS
  585. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",party[i].name))
  586. when PBStatuses::SLEEP
  587. @battle.pbDisplay(_INTL("{1} was woken from its sleep.",party[i].name))
  588. when PBStatuses::POISON
  589. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",party[i].name))
  590. when PBStatuses::BURN
  591. @battle.pbDisplay(_INTL("{1}'s burn was healed.",party[i].name))
  592. when PBStatuses::FROZEN
  593. @battle.pbDisplay(_INTL("{1} was thawed out.",party[i].name))
  594. end
  595. party[i].status=0
  596. party[i].statusCount=0
  597. end
  598. return 0
  599. end
  600. end
  601. ################################################################################
  602. # Safeguards the user's side from being inflicted with status problems. (Safeguard)
  603. ################################################################################
  604. class PokeBattle_Move_01A < PokeBattle_Move
  605. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  606. if attacker.pbOwnSide.effects[PBEffects::Safeguard]>0
  607. @battle.pbDisplay(_INTL("But it failed!"))
  608. return -1
  609. end
  610. attacker.pbOwnSide.effects[PBEffects::Safeguard]=5
  611. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  612. if !@battle.pbIsOpposing?(attacker.index)
  613. @battle.pbDisplay(_INTL("Your team became cloaked in a mystical veil!"))
  614. else
  615. @battle.pbDisplay(_INTL("The opposing team became cloaked in a mystical veil!"))
  616. end
  617. return 0
  618. end
  619. end
  620. ################################################################################
  621. # User passes its status problem to the target. (Psycho Shift)
  622. ################################################################################
  623. class PokeBattle_Move_01B < PokeBattle_Move
  624. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  625. if attacker.status==0 ||
  626. (attacker.status==PBStatuses::PARALYSIS && !opponent.pbCanParalyze?(attacker,false,self)) ||
  627. (attacker.status==PBStatuses::SLEEP && !opponent.pbCanSleep?(attacker,false,self)) ||
  628. (attacker.status==PBStatuses::POISON && !opponent.pbCanPoison?(attacker,false,self)) ||
  629. (attacker.status==PBStatuses::BURN && !opponent.pbCanBurn?(attacker,false,self)) ||
  630. (attacker.status==PBStatuses::FROZEN && !opponent.pbCanFreeze?(attacker,false,self))
  631. @battle.pbDisplay(_INTL("But it failed!"))
  632. return -1
  633. end
  634. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  635. case attacker.status
  636. when PBStatuses::PARALYSIS
  637. opponent.pbParalyze(attacker)
  638. opponent.pbAbilityCureCheck
  639. attacker.pbCureStatus(false)
  640. @battle.pbDisplay(_INTL("{1} was cured of paralysis.",attacker.pbThis))
  641. when PBStatuses::SLEEP
  642. opponent.pbSleep
  643. opponent.pbAbilityCureCheck
  644. attacker.pbCureStatus(false)
  645. @battle.pbDisplay(_INTL("{1} woke up.",attacker.pbThis))
  646. when PBStatuses::POISON
  647. opponent.pbPoison(attacker,nil,attacker.statusCount!=0)
  648. opponent.pbAbilityCureCheck
  649. attacker.pbCureStatus(false)
  650. @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",attacker.pbThis))
  651. when PBStatuses::BURN
  652. opponent.pbBurn(attacker)
  653. opponent.pbAbilityCureCheck
  654. attacker.pbCureStatus(false)
  655. @battle.pbDisplay(_INTL("{1}'s burn was healed.",attacker.pbThis))
  656. when PBStatuses::FROZEN
  657. opponent.pbFreeze
  658. opponent.pbAbilityCureCheck
  659. attacker.pbCureStatus(false)
  660. @battle.pbDisplay(_INTL("{1} was thawed out.",attacker.pbThis))
  661. end
  662. return 0
  663. end
  664. end
  665. ################################################################################
  666. # Increases the user's Attack by 1 stage.
  667. ################################################################################
  668. class PokeBattle_Move_01C < PokeBattle_Move
  669. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  670. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  671. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  672. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  673. ret=attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  674. return ret ? 0 : -1
  675. end
  676.  
  677. def pbAdditionalEffect(attacker,opponent)
  678. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  679. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self)
  680. end
  681. end
  682. end
  683. ################################################################################
  684. # Increases the user's Defense by 1 stage.
  685. ################################################################################
  686. class PokeBattle_Move_01D < PokeBattle_Move
  687. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  688. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  689. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  690. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  691. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  692. return ret ? 0 : -1
  693. end
  694.  
  695. def pbAdditionalEffect(attacker,opponent)
  696. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  697. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  698. end
  699. end
  700. end
  701. ################################################################################
  702. # Increases the user's Defense by 1 stage. User curls up. (Defense Curl)
  703. ################################################################################
  704. class PokeBattle_Move_01E < PokeBattle_Move
  705. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  706. attacker.effects[PBEffects::DefenseCurl]=true
  707. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  708. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  709. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  710. return ret ? 0 : -1
  711. end
  712. end
  713. ################################################################################
  714. # Increases the user's Speed by 1 stage.
  715. ################################################################################
  716. class PokeBattle_Move_01F < PokeBattle_Move
  717. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  718. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  719. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  720. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  721. ret=attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  722. return ret ? 0 : -1
  723. end
  724.  
  725. def pbAdditionalEffect(attacker,opponent)
  726. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  727. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self)
  728. end
  729. end
  730. end
  731. ################################################################################
  732. # Increases the user's Special Attack by 1 stage.
  733. ################################################################################
  734. class PokeBattle_Move_020 < PokeBattle_Move
  735. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  736. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  737. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  738. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  739. ret=attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  740. return ret ? 0 : -1
  741. end
  742.  
  743. def pbAdditionalEffect(attacker,opponent)
  744. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  745. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  746. end
  747. end
  748. end
  749. ################################################################################
  750. # Increases the user's Special Defense by 1 stage.
  751. # Charges up user's next attack if it is Electric-type. (Charge)
  752. ################################################################################
  753. class PokeBattle_Move_021 < PokeBattle_Move
  754. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  755. attacker.effects[PBEffects::Charge]=2
  756. @battle.pbDisplay(_INTL("{1} began charging power!",attacker.pbThis))
  757. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  758. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  759. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  760. end
  761. return 0
  762. end
  763. end
  764. ################################################################################
  765. # Increases the user's evasion by 1 stage.
  766. ################################################################################
  767. class PokeBattle_Move_022 < PokeBattle_Move
  768. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  769. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  770. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  771. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  772. ret=attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  773. return ret ? 0 : -1
  774. end
  775.  
  776. def pbAdditionalEffect(attacker,opponent)
  777. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  778. attacker.pbIncreaseStat(PBStats::EVASION,1,attacker,false,self)
  779. end
  780. end
  781. end
  782. ################################################################################
  783. # Increases the user's critical hit rate. (Focus Energy)
  784. ################################################################################
  785. class PokeBattle_Move_023 < PokeBattle_Move
  786. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  787. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  788. if attacker.effects[PBEffects::FocusEnergy]>=2
  789. @battle.pbDisplay(_INTL("But it failed!"))
  790. return -1
  791. end
  792. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  793. attacker.effects[PBEffects::FocusEnergy]=2
  794. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  795. return 0
  796. end
  797.  
  798. def pbAdditionalEffect(attacker,opponent)
  799. if attacker.effects[PBEffects::FocusEnergy]<2
  800. attacker.effects[PBEffects::FocusEnergy]=2
  801. @battle.pbDisplay(_INTL("{1} is getting pumped!",attacker.pbThis))
  802. end
  803. end
  804. end
  805. ################################################################################
  806. # Increases the user's Attack and Defense by 1 stage each. (Bulk Up)
  807. ################################################################################
  808. class PokeBattle_Move_024 < PokeBattle_Move
  809. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  810. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  811. !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  812. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  813. return -1
  814. end
  815. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  816. showanim=true
  817. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  818. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  819. showanim=false
  820. end
  821. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  822. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  823. showanim=false
  824. end
  825. return 0
  826. end
  827. end
  828. ################################################################################
  829. # Increases the user's Attack and Speed by 1 stage each. (Dragon Dance)
  830. ################################################################################
  831. class PokeBattle_Move_026 < PokeBattle_Move
  832. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  833. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  834. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  835. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  836. return -1
  837. end
  838. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  839. showanim=true
  840. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  841. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  842. showanim=false
  843. end
  844. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  845. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  846. showanim=false
  847. end
  848. return 0
  849. end
  850. end
  851. ################################################################################
  852. # Increases the user's Attack and Sp. Attack by 1 stage each.
  853. # In sunny weather, increase is 2 stages each instead. (Growth)
  854. ################################################################################
  855. class PokeBattle_Move_028 < PokeBattle_Move
  856. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  857. if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
  858. !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  859. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  860. return -1
  861. end
  862. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  863. showanim=true
  864. increment=1
  865. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  866. @battle.pbWeather==PBWeather::HARSHSUN
  867. increment=2
  868. end
  869. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  870. attacker.pbIncreaseStat(PBStats::ATTACK,increment,attacker,false,self,showanim)
  871. showanim=false
  872. end
  873. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  874. attacker.pbIncreaseStat(PBStats::SPATK,increment,attacker,false,self,showanim)
  875. showanim=false
  876. end
  877. return 0
  878. end
  879. end
  880. ################################################################################
  881. # Increases the user's Defense and Special Defense by 1 stage each. (Cosmic Power)
  882. ################################################################################
  883. class PokeBattle_Move_02A < PokeBattle_Move
  884. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  885. if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
  886. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  887. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  888. return -1
  889. end
  890. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  891. showanim=true
  892. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  893. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  894. showanim=false
  895. end
  896. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  897. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  898. showanim=false
  899. end
  900. return 0
  901. end
  902. end
  903. ################################################################################
  904. # Increases the user's Sp. Attack and Sp. Defense by 1 stage each. (Calm Mind)
  905. ################################################################################
  906. class PokeBattle_Move_02C < PokeBattle_Move
  907. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  908. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  909. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  910. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  911. return -1
  912. end
  913. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  914. showanim=true
  915. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  916. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  917. showanim=false
  918. end
  919. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  920. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  921. showanim=false
  922. end
  923. return 0
  924. end
  925. end
  926. ################################################################################
  927. # Increases the user's Attack, Defense, Speed, Special Attack and Special Defense
  928. # by 1 stage each. (AncientPower, Ominous Wind, Silver Wind)
  929. ################################################################################
  930. class PokeBattle_Move_02D < PokeBattle_Move
  931. def pbAdditionalEffect(attacker,opponent)
  932. showanim=true
  933. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  934. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  935. showanim=false
  936. end
  937. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  938. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  939. showanim=false
  940. end
  941. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  942. attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
  943. showanim=false
  944. end
  945. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  946. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  947. showanim=false
  948. end
  949. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  950. attacker.pbIncreaseStat(PBStats::SPEED,1,attacker,false,self,showanim)
  951. showanim=false
  952. end
  953. end
  954. end
  955. ################################################################################
  956. # Increases the user's Attack by 2 stages.
  957. ################################################################################
  958. class PokeBattle_Move_02E < PokeBattle_Move
  959. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  960. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  961. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,true,self)
  962. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  963. ret=attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  964. return ret ? 0 : -1
  965. end
  966.  
  967. def pbAdditionalEffect(attacker,opponent)
  968. if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  969. attacker.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  970. end
  971. end
  972. end
  973. ################################################################################
  974. # Increases the user's Defense by 2 stages.
  975. ################################################################################
  976. class PokeBattle_Move_02F < PokeBattle_Move
  977. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  978. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  979. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  980. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  981. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  982. return ret ? 0 : -1
  983. end
  984.  
  985. def pbAdditionalEffect(attacker,opponent)
  986. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  987. attacker.pbIncreaseStat(PBStats::DEFENSE,2,attacker,false,self)
  988. end
  989. end
  990. end
  991. ################################################################################
  992. # Increases the user's Speed by 2 stages.
  993. ################################################################################
  994. class PokeBattle_Move_030 < PokeBattle_Move
  995. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  996. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  997. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,true,self)
  998. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  999. ret=attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1000. return ret ? 0 : -1
  1001. end
  1002.  
  1003. def pbAdditionalEffect(attacker,opponent)
  1004. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  1005. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self)
  1006. end
  1007. end
  1008. end
  1009. ################################################################################
  1010. # Increases the user's Special Attack by 2 stages.
  1011. ################################################################################
  1012. class PokeBattle_Move_032 < PokeBattle_Move
  1013. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1014. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1015. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1016. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1017. ret=attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1018. return ret ? 0 : -1
  1019. end
  1020.  
  1021. def pbAdditionalEffect(attacker,opponent)
  1022. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1023. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self)
  1024. end
  1025. end
  1026. end
  1027. ################################################################################
  1028. # Increases the user's Special Defense by 2 stages.
  1029. ################################################################################
  1030. class PokeBattle_Move_033 < PokeBattle_Move
  1031. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1032. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1033. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,true,self)
  1034. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1035. ret=attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1036. return ret ? 0 : -1
  1037. end
  1038.  
  1039. def pbAdditionalEffect(attacker,opponent)
  1040. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  1041. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self)
  1042. end
  1043. end
  1044. end
  1045. ################################################################################
  1046. # Increases the user's evasion by 2 stages. Minimizes the user. (Minimize)
  1047. ################################################################################
  1048. class PokeBattle_Move_034 < PokeBattle_Move
  1049. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1050. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1051. attacker.effects[PBEffects::Minimize]=true
  1052. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,true,self)
  1053. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1054. ret=attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1055. return ret ? 0 : -1
  1056. end
  1057.  
  1058. def pbAdditionalEffect(attacker,opponent)
  1059. attacker.effects[PBEffects::Minimize]=true
  1060. if attacker.pbCanIncreaseStatStage?(PBStats::EVASION,attacker,false,self)
  1061. attacker.pbIncreaseStat(PBStats::EVASION,2,attacker,false,self)
  1062. end
  1063. end
  1064. end
  1065. ################################################################################
  1066. # Increases one random stat of the user by 2 stages (except HP). (Acupressure)
  1067. ################################################################################
  1068. class PokeBattle_Move_037 < PokeBattle_Move
  1069. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1070. if attacker.index!=opponent.index
  1071. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  1072. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1073. @battle.pbDisplay(_INTL("But it failed!"))
  1074. return -1
  1075. end
  1076. end
  1077. array=[]
  1078. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1079. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1080. array.push(i) if opponent.pbCanIncreaseStatStage?(i,attacker,false,self)
  1081. end
  1082. if array.length==0
  1083. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",opponent.pbThis))
  1084. return -1
  1085. end
  1086. stat=array[@battle.pbRandom(array.length)]
  1087. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1088. ret=opponent.pbIncreaseStat(stat,2,attacker,false,self)
  1089. return 0
  1090. end
  1091. end
  1092. ################################################################################
  1093. # Increases the user's Defense by 3 stages.
  1094. ################################################################################
  1095. class PokeBattle_Move_038 < PokeBattle_Move
  1096. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1097. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1098. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,true,self)
  1099. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1100. ret=attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1101. return ret ? 0 : -1
  1102. end
  1103.  
  1104. def pbAdditionalEffect(attacker,opponent)
  1105. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1106. attacker.pbIncreaseStat(PBStats::DEFENSE,3,attacker,false,self)
  1107. end
  1108. end
  1109. end
  1110. ################################################################################
  1111. # Increases the user's Special Attack by 3 stages.
  1112. ################################################################################
  1113. class PokeBattle_Move_039 < PokeBattle_Move
  1114. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1115. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1116. return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,true,self)
  1117. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1118. ret=attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1119. return ret ? 0 : -1
  1120. end
  1121.  
  1122. def pbAdditionalEffect(attacker,opponent)
  1123. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  1124. attacker.pbIncreaseStat(PBStats::SPATK,3,attacker,false,self)
  1125. end
  1126. end
  1127. end
  1128. ################################################################################
  1129. # Reduces the user's HP by half of max, and sets its Attack to maximum. (Belly Drum)
  1130. ################################################################################
  1131. class PokeBattle_Move_03A < PokeBattle_Move
  1132. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1133. if attacker.hp<=(attacker.totalhp/2).floor ||
  1134. !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1135. @battle.pbDisplay(_INTL("But it failed!"))
  1136. return -1
  1137. end
  1138. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1139. attacker.pbReduceHP((attacker.totalhp/2).floor)
  1140. if attacker.hasWorkingAbility(:CONTRARY)
  1141. attacker.stages[PBStats::ATTACK]=-6
  1142. @battle.pbCommonAnimation("StatDown",attacker,nil)
  1143. @battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",attacker.pbThis))
  1144. else
  1145. attacker.stages[PBStats::ATTACK]=6
  1146. @battle.pbCommonAnimation("StatUp",attacker,nil)
  1147. @battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",attacker.pbThis))
  1148. end
  1149. return 0
  1150. end
  1151. end
  1152. ################################################################################
  1153. # Decreases the user's Attack and Defense by 1 stage each. (Superpower)
  1154. ################################################################################
  1155. class PokeBattle_Move_03B < PokeBattle_Move
  1156. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1157. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1158. if opponent.damagestate.calcdamage>0
  1159. showanim=true
  1160. if attacker.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1161. attacker.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1162. showanim=false
  1163. end
  1164. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1165. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1166. showanim=false
  1167. end
  1168. end
  1169. return ret
  1170. end
  1171. end
  1172. ################################################################################
  1173. # Decreases the user's Defense and Special Defense by 1 stage each. (Close Combat)
  1174. ################################################################################
  1175. class PokeBattle_Move_03C < PokeBattle_Move
  1176. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1177. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1178. if opponent.damagestate.calcdamage>0
  1179. showanim=true
  1180. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1181. attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1182. showanim=false
  1183. end
  1184. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1185. attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  1186. showanim=false
  1187. end
  1188. end
  1189. return ret
  1190. end
  1191. end
  1192. ################################################################################
  1193. # Decreases the user's Speed by 1 stage.
  1194. ################################################################################
  1195. class PokeBattle_Move_03E < PokeBattle_Move
  1196. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1197. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1198. if opponent.damagestate.calcdamage>0
  1199. if attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1200. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1201. end
  1202. end
  1203. return ret
  1204. end
  1205. end
  1206. ################################################################################
  1207. # Decreases the user's Special Attack by 2 stages.
  1208. ################################################################################
  1209. class PokeBattle_Move_03F < PokeBattle_Move
  1210. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1211. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  1212. if opponent.damagestate.calcdamage>0
  1213. if attacker.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1214. attacker.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  1215. end
  1216. end
  1217. return ret
  1218. end
  1219. end
  1220. ################################################################################
  1221. # Increases the target's Special Attack by 1 stage. Confuses the target. (Flatter)
  1222. ################################################################################
  1223. class PokeBattle_Move_040 < PokeBattle_Move
  1224. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1225. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1226. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1227. return -1
  1228. end
  1229. ret=-1
  1230. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1231. if opponent.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  1232. opponent.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  1233. ret=0
  1234. end
  1235. if opponent.pbCanConfuse?(attacker,true,self)
  1236. opponent.pbConfuse
  1237. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1238. ret=0
  1239. end
  1240. return ret
  1241. end
  1242. end
  1243. ################################################################################
  1244. # Increases the target's Attack by 2 stages. Confuses the target. (Swagger)
  1245. ################################################################################
  1246. class PokeBattle_Move_041 < PokeBattle_Move
  1247. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1248. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1249. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1250. return -1
  1251. end
  1252. ret=-1
  1253. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1254. if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  1255. opponent.pbIncreaseStat(PBStats::ATTACK,2,attacker,false,self)
  1256. ret=0
  1257. end
  1258. if opponent.pbCanConfuse?(attacker,true,self)
  1259. opponent.pbConfuse
  1260. @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
  1261. ret=0
  1262. end
  1263. return ret
  1264. end
  1265. end
  1266. ################################################################################
  1267. # Decreases the target's Attack by 1 stage.
  1268. ################################################################################
  1269. class PokeBattle_Move_042 < PokeBattle_Move
  1270. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1271. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1272. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  1273. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1274. ret=opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1275. return ret ? 0 : -1
  1276. end
  1277.  
  1278. def pbAdditionalEffect(attacker,opponent)
  1279. return if opponent.damagestate.substitute
  1280. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1281. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  1282. end
  1283. end
  1284. end
  1285. ################################################################################
  1286. # Decreases the target's Defense by 1 stage.
  1287. ################################################################################
  1288. class PokeBattle_Move_043 < PokeBattle_Move
  1289. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1290. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1291. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  1292. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1293. ret=opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1294. return ret ? 0 : -1
  1295. end
  1296.  
  1297. def pbAdditionalEffect(attacker,opponent)
  1298. return if opponent.damagestate.substitute
  1299. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1300. opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
  1301. end
  1302. end
  1303. end
  1304. ################################################################################
  1305. # Decreases the target's Speed by 1 stage.
  1306. ################################################################################
  1307. class PokeBattle_Move_044 < PokeBattle_Move
  1308. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1309. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1310. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  1311. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1312. ret=opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1313. return ret ? 0 : -1
  1314. end
  1315.  
  1316. def pbAdditionalEffect(attacker,opponent)
  1317. return if opponent.damagestate.substitute
  1318. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1319. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  1320. end
  1321. end
  1322. end
  1323. ################################################################################
  1324. # Decreases the target's Special Attack by 1 stage.
  1325. ################################################################################
  1326. class PokeBattle_Move_045 < PokeBattle_Move
  1327. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1328. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1329. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  1330. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1331. ret=opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1332. return ret ? 0 : -1
  1333. end
  1334.  
  1335. def pbAdditionalEffect(attacker,opponent)
  1336. return if opponent.damagestate.substitute
  1337. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1338. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  1339. end
  1340. end
  1341. end
  1342. ################################################################################
  1343. # Decreases the target's Special Defense by 1 stage.
  1344. ################################################################################
  1345. class PokeBattle_Move_046 < PokeBattle_Move
  1346. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1347. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1348. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  1349. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1350. ret=opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1351. return ret ? 0 : -1
  1352. end
  1353.  
  1354. def pbAdditionalEffect(attacker,opponent)
  1355. return if opponent.damagestate.substitute
  1356. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1357. opponent.pbReduceStat(PBStats::SPDEF,1,attacker,false,self)
  1358. end
  1359. end
  1360. end
  1361. ################################################################################
  1362. # Decreases the target's accuracy by 1 stage.
  1363. ################################################################################
  1364. class PokeBattle_Move_047 < PokeBattle_Move
  1365. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1366. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1367. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,true,self)
  1368. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1369. ret=opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1370. return ret ? 0 : -1
  1371. end
  1372.  
  1373. def pbAdditionalEffect(attacker,opponent)
  1374. return if opponent.damagestate.substitute
  1375. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  1376. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  1377. end
  1378. end
  1379. end
  1380. ################################################################################
  1381. # Decreases the target's evasion by 1 stage OR 2 stages. (Sweet Scent)
  1382. ################################################################################
  1383. class PokeBattle_Move_048 < PokeBattle_Move
  1384. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1385. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1386. return -1 if !opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,true,self)
  1387. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1388. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1389. ret=opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1390. return ret ? 0 : -1
  1391. end
  1392.  
  1393. def pbAdditionalEffect(attacker,opponent)
  1394. return if opponent.damagestate.substitute
  1395. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1396. increment=(USENEWBATTLEMECHANICS) ? 2 : 1
  1397. opponent.pbReduceStat(PBStats::EVASION,increment,attacker,false,self)
  1398. end
  1399. end
  1400. end
  1401. ################################################################################
  1402. # Decreases the target's evasion by 1 stage. Ends all barriers and entry
  1403. # hazards for the target's side OR on both sides. (Defog)
  1404. ################################################################################
  1405. class PokeBattle_Move_049 < PokeBattle_Move
  1406. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1407. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1408. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1409. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1410. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1411. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1412. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1413. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1414. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1415. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1416. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1417. if USENEWBATTLEMECHANICS
  1418. opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
  1419. opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1420. opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
  1421. opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
  1422. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1423. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1424. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1425. end
  1426. return 0
  1427. end
  1428.  
  1429. def pbAdditionalEffect(attacker,opponent)
  1430. if !opponent.damagestate.substitute
  1431. if opponent.pbCanReduceStatStage?(PBStats::EVASION,attacker,false,self)
  1432. opponent.pbReduceStat(PBStats::EVASION,1,attacker,false,self)
  1433. end
  1434. end
  1435. opponent.pbOwnSide.effects[PBEffects::Reflect] = 0
  1436. opponent.pbOwnSide.effects[PBEffects::LightScreen] = 0
  1437. opponent.pbOwnSide.effects[PBEffects::Mist] = 0
  1438. opponent.pbOwnSide.effects[PBEffects::Safeguard] = 0
  1439. opponent.pbOwnSide.effects[PBEffects::Spikes] = 0
  1440. opponent.pbOwnSide.effects[PBEffects::StealthRock] = false
  1441. opponent.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  1442. if USENEWBATTLEMECHANICS
  1443. opponent.pbOpposingSide.effects[PBEffects::Reflect] = 0
  1444. opponent.pbOpposingSide.effects[PBEffects::LightScreen] = 0
  1445. opponent.pbOpposingSide.effects[PBEffects::Mist] = 0
  1446. opponent.pbOpposingSide.effects[PBEffects::Safeguard] = 0
  1447. opponent.pbOpposingSide.effects[PBEffects::Spikes] = 0
  1448. opponent.pbOpposingSide.effects[PBEffects::StealthRock] = false
  1449. opponent.pbOpposingSide.effects[PBEffects::ToxicSpikes] = 0
  1450. end
  1451. end
  1452. end
  1453. ################################################################################
  1454. # Decreases the target's Attack and Defense by 1 stage each. (Tickle)
  1455. ################################################################################
  1456. class PokeBattle_Move_04A < PokeBattle_Move
  1457. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1458. # Replicates def pbCanReduceStatStage? so that certain messages aren't shown
  1459. # multiple times
  1460. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1461. @battle.pbDisplay(_INTL("{1}'s attack missed!",attacker.pbThis))
  1462. return -1
  1463. end
  1464. if opponent.pbTooLow?(PBStats::ATTACK) &&
  1465. opponent.pbTooLow?(PBStats::DEFENSE)
  1466. @battle.pbDisplay(_INTL("{1}'s stats won't go any lower!",opponent.pbThis))
  1467. return -1
  1468. end
  1469. if opponent.pbOwnSide.effects[PBEffects::Mist]>0
  1470. @battle.pbDisplay(_INTL("{1} is protected by Mist!",opponent.pbThis))
  1471. return -1
  1472. end
  1473. if !attacker.hasMoldBreaker
  1474. if opponent.hasWorkingAbility(:CLEARBODY) ||
  1475. opponent.hasWorkingAbility(:WHITESMOKE)
  1476. @battle.pbDisplay(_INTL("{1}'s {2} prevents stat loss!",opponent.pbThis,
  1477. PBAbilities.getName(opponent.ability)))
  1478. return -1
  1479. end
  1480. end
  1481. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1482. ret=-1; showanim=true
  1483. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:HYPERCUTTER) &&
  1484. !opponent.pbTooLow?(PBStats::ATTACK)
  1485. abilityname=PBAbilities.getName(opponent.ability)
  1486. @battle.pbDisplay(_INTL("{1}'s {2} prevents Attack loss!",opponent.pbThis,abilityname))
  1487. elsif opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  1488. ret=0; showanim=false
  1489. end
  1490. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:BIGPECKS) &&
  1491. !opponent.pbTooLow?(PBStats::DEFENSE)
  1492. abilityname=PBAbilities.getName(opponent.ability)
  1493. @battle.pbDisplay(_INTL("{1}'s {2} prevents Defense loss!",opponent.pbThis,abilityname))
  1494. elsif opponent.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  1495. ret=0; showanim=false
  1496. end
  1497. return ret
  1498. end
  1499. end
  1500. ################################################################################
  1501. # Decreases the target's Attack by 2 stages.
  1502. ################################################################################
  1503. class PokeBattle_Move_04B < PokeBattle_Move
  1504. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1505. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1506. return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,true,self)
  1507. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1508. ret=opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  1509. return ret ? 0 : -1
  1510. end
  1511.  
  1512. def pbAdditionalEffect(attacker,opponent)
  1513. return if opponent.damagestate.substitute
  1514. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  1515. opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self)
  1516. end
  1517. end
  1518. end
  1519. ################################################################################
  1520. # Decreases the target's Defense by 2 stages. (Screech)
  1521. ################################################################################
  1522. class PokeBattle_Move_04C < PokeBattle_Move
  1523. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1524. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1525. return -1 if !opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,true,self)
  1526. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1527. ret=opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  1528. return ret ? 0 : -1
  1529. end
  1530.  
  1531. def pbAdditionalEffect(attacker,opponent)
  1532. return if opponent.damagestate.substitute
  1533. if opponent.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  1534. opponent.pbReduceStat(PBStats::DEFENSE,2,attacker,false,self)
  1535. end
  1536. end
  1537. end
  1538. ################################################################################
  1539. # Decreases the target's Speed by 2 stages. (Cotton Spore, Scary Face, String Shot)
  1540. ################################################################################
  1541. class PokeBattle_Move_04D < PokeBattle_Move
  1542. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1543. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1544. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  1545. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,true,self)
  1546. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1547. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  1548. ret=opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  1549. return ret ? 0 : -1
  1550. end
  1551.  
  1552. def pbAdditionalEffect(attacker,opponent)
  1553. return if opponent.damagestate.substitute
  1554. if opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  1555. increment=(isConst?(@id,PBMoves,:STRINGSHOT) && !USENEWBATTLEMECHANICS) ? 1 : 2
  1556. opponent.pbReduceStat(PBStats::SPEED,increment,attacker,false,self)
  1557. end
  1558. end
  1559. end
  1560. ################################################################################
  1561. # Decreases the target's Special Attack by 2 stages. Only works on the opposite
  1562. # gender. (Captivate)
  1563. ################################################################################
  1564. class PokeBattle_Move_04E < PokeBattle_Move
  1565. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1566. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1567. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,true,self)
  1568. if attacker.gender==2 || opponent.gender==2 || attacker.gender==opponent.gender
  1569. @battle.pbDisplay(_INTL("But it failed!"))
  1570. return -1
  1571. end
  1572. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS)
  1573. @battle.pbDisplay(_INTL("{1}'s {2} prevents romance!",opponent.pbThis,
  1574. PBAbilities.getName(opponent.ability)))
  1575. return -1
  1576. end
  1577. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1578. ret=opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  1579. return ret ? 0 : -1
  1580. end
  1581.  
  1582. def pbAdditionalEffect(attacker,opponent)
  1583. return if opponent.damagestate.substitute
  1584. if attacker.gender!=2 && opponent.gender!=2 && attacker.gender!=opponent.gender
  1585. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:OBLIVIOUS)
  1586. if opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  1587. opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self)
  1588. end
  1589. end
  1590. end
  1591. end
  1592. end
  1593. ################################################################################
  1594. # Decreases the target's Special Defense by 2 stages.
  1595. ################################################################################
  1596. class PokeBattle_Move_04F < PokeBattle_Move
  1597. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1598. return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  1599. return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,true,self)
  1600. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1601. ret=opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  1602. return ret ? 0 : -1
  1603. end
  1604.  
  1605. def pbAdditionalEffect(attacker,opponent)
  1606. return if opponent.damagestate.substitute
  1607. if opponent.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  1608. opponent.pbReduceStat(PBStats::SPDEF,2,attacker,false,self)
  1609. end
  1610. end
  1611. end
  1612. ################################################################################
  1613. # Resets all stat stages for all battlers to 0. (Haze)
  1614. ################################################################################
  1615. class PokeBattle_Move_051 < PokeBattle_Move
  1616. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1617. for i in 0...4
  1618. @battle.battlers[i].stages[PBStats::ATTACK] = 0
  1619. @battle.battlers[i].stages[PBStats::DEFENSE] = 0
  1620. @battle.battlers[i].stages[PBStats::SPEED] = 0
  1621. @battle.battlers[i].stages[PBStats::SPATK] = 0
  1622. @battle.battlers[i].stages[PBStats::SPDEF] = 0
  1623. @battle.battlers[i].stages[PBStats::ACCURACY] = 0
  1624. @battle.battlers[i].stages[PBStats::EVASION] = 0
  1625. end
  1626. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1627. @battle.pbDisplay(_INTL("All stat changes were eliminated!"))
  1628. return 0
  1629. end
  1630. end
  1631. ################################################################################
  1632. # User and target swap their Attack and Special Attack stat stages. (Power Swap)
  1633. ################################################################################
  1634. class PokeBattle_Move_052 < PokeBattle_Move
  1635. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1636. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1637. astage=attacker.stages
  1638. ostage=opponent.stages
  1639. astage[PBStats::ATTACK],ostage[PBStats::ATTACK]=ostage[PBStats::ATTACK],astage[PBStats::ATTACK]
  1640. astage[PBStats::SPATK],ostage[PBStats::SPATK]=ostage[PBStats::SPATK],astage[PBStats::SPATK]
  1641. @battle.pbDisplay(_INTL("{1} switched all changes to its Attack and Sp. Atk with the target!",attacker.pbThis))
  1642. return 0
  1643. end
  1644. end
  1645. ################################################################################
  1646. # User and target swap their Defense and Special Defense stat stages. (Guard Swap)
  1647. ################################################################################
  1648. class PokeBattle_Move_053 < PokeBattle_Move
  1649. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1650. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1651. astage=attacker.stages
  1652. ostage=opponent.stages
  1653. astage[PBStats::DEFENSE],ostage[PBStats::DEFENSE]=ostage[PBStats::DEFENSE],astage[PBStats::DEFENSE]
  1654. astage[PBStats::SPDEF],ostage[PBStats::SPDEF]=ostage[PBStats::SPDEF],astage[PBStats::SPDEF]
  1655. @battle.pbDisplay(_INTL("{1} switched all changes to its Defense and Sp. Def with the target!",attacker.pbThis))
  1656. return 0
  1657. end
  1658. end
  1659. ################################################################################
  1660. # User and target swap all their stat stages. (Heart Swap)
  1661. ################################################################################
  1662. class PokeBattle_Move_054 < PokeBattle_Move
  1663. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1664. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1665. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1666. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1667. attacker.stages[i],opponent.stages[i]=opponent.stages[i],attacker.stages[i]
  1668. end
  1669. @battle.pbDisplay(_INTL("{1} switched stat changes with the target!",attacker.pbThis))
  1670. return 0
  1671. end
  1672. end
  1673. ################################################################################
  1674. # User copies the target's stat stages. (Psych Up)
  1675. ################################################################################
  1676. class PokeBattle_Move_055 < PokeBattle_Move
  1677. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1678. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1679. @battle.pbDisplay(_INTL("But it failed!"))
  1680. return -1
  1681. end
  1682. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1683. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  1684. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  1685. attacker.stages[i]=opponent.stages[i]
  1686. end
  1687. @battle.pbDisplay(_INTL("{1} copied {2}'s stat changes!",attacker.pbThis,opponent.pbThis(true)))
  1688. return 0
  1689. end
  1690. end
  1691. ################################################################################
  1692. # For 5 rounds, user's and ally's stat stages cannot be lowered by foes. (Mist)
  1693. ################################################################################
  1694. class PokeBattle_Move_056 < PokeBattle_Move
  1695. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1696. if attacker.pbOwnSide.effects[PBEffects::Mist]>0
  1697. @battle.pbDisplay(_INTL("But it failed!"))
  1698. return -1
  1699. end
  1700. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1701. attacker.pbOwnSide.effects[PBEffects::Mist]=5
  1702. if !@battle.pbIsOpposing?(attacker.index)
  1703. @battle.pbDisplay(_INTL("Your team became shrouded in mist!"))
  1704. else
  1705. @battle.pbDisplay(_INTL("The opposing team became shrouded in mist!"))
  1706. end
  1707. return 0
  1708. end
  1709. end
  1710. ################################################################################
  1711. # Swaps the user's Attack and Defense stats. (Power Trick)
  1712. ################################################################################
  1713. class PokeBattle_Move_057 < PokeBattle_Move
  1714. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1715. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  1716. attacker.attack,attacker.defense=attacker.defense,attacker.attack
  1717. attacker.effects[PBEffects::PowerTrick]=!attacker.effects[PBEffects::PowerTrick]
  1718. @battle.pbDisplay(_INTL("{1} switched its Attack and Defense!",attacker.pbThis))
  1719. return 0
  1720. end
  1721. end
  1722. ################################################################################
  1723. # Averages the user's and target's current HP. (Pain Split)
  1724. ################################################################################
  1725. class PokeBattle_Move_05A < PokeBattle_Move
  1726. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1727. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1728. @battle.pbDisplay(_INTL("But it failed!"))
  1729. return -1
  1730. end
  1731. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1732. olda=attacker.hp
  1733. oldo=opponent.hp
  1734. avhp=((attacker.hp+opponent.hp)/2).floor
  1735. attacker.hp=[avhp,attacker.totalhp].min
  1736. opponent.hp=[avhp,opponent.totalhp].min
  1737. @battle.scene.pbHPChanged(attacker,olda)
  1738. @battle.scene.pbHPChanged(opponent,oldo)
  1739. @battle.pbDisplay(_INTL("The battlers shared their pain!"))
  1740. return 0
  1741. end
  1742. end
  1743. ################################################################################
  1744. # For 4 rounds, doubles the Speed of all battlers on the user's side. (Tailwind)
  1745. ################################################################################
  1746. class PokeBattle_Move_05B < PokeBattle_Move
  1747. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1748. if attacker.pbOwnSide.effects[PBEffects::Tailwind]>0
  1749. @battle.pbDisplay(_INTL("But it failed!"))
  1750. return -1
  1751. end
  1752. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  1753. attacker.pbOwnSide.effects[PBEffects::Tailwind]=4
  1754. if !@battle.pbIsOpposing?(attacker.index)
  1755. @battle.pbDisplay(_INTL("The tailwind blew from behind your team!"))
  1756. else
  1757. @battle.pbDisplay(_INTL("The tailwind blew from behind the opposing team!"))
  1758. end
  1759. return 0
  1760. end
  1761. end
  1762. ################################################################################
  1763. # This move turns into the last move used by the target, until user switches
  1764. # out. (Mimic)
  1765. ################################################################################
  1766. class PokeBattle_Move_05C < PokeBattle_Move
  1767. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1768. blacklist=[
  1769. 0x02, # Struggle
  1770. 0x14, # Chatter
  1771. 0x5C, # Mimic
  1772. 0x5D, # Sketch
  1773. 0xB6 # Metronome
  1774. ]
  1775. if attacker.effects[PBEffects::Transform] ||
  1776. opponent.lastMoveUsed<=0 ||
  1777. isConst?(PBMoveData.new(opponent.lastMoveUsed).type,PBTypes,:SHADOW) ||
  1778. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  1779. @battle.pbDisplay(_INTL("But it failed!"))
  1780. return -1
  1781. end
  1782. for i in attacker.moves
  1783. if i.id==opponent.lastMoveUsed
  1784. @battle.pbDisplay(_INTL("But it failed!"))
  1785. return -1
  1786. end
  1787. end
  1788. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1789. for i in 0...attacker.moves.length
  1790. if attacker.moves[i].id==@id
  1791. newmove=PBMove.new(opponent.lastMoveUsed)
  1792. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  1793. movename=PBMoves.getName(opponent.lastMoveUsed)
  1794. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  1795. return 0
  1796. end
  1797. end
  1798. @battle.pbDisplay(_INTL("But it failed!"))
  1799. return -1
  1800. end
  1801. end
  1802. ################################################################################
  1803. # This move permanently turns into the last move used by the target. (Sketch)
  1804. ################################################################################
  1805. class PokeBattle_Move_05D < PokeBattle_Move
  1806. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1807. blacklist=[
  1808. 0x02, # Struggle
  1809. 0x14, # Chatter
  1810. 0x5D # Sketch
  1811. ]
  1812. if attacker.effects[PBEffects::Transform] ||
  1813. opponent.lastMoveUsedSketch<=0 ||
  1814. isConst?(PBMoveData.new(opponent.lastMoveUsedSketch).type,PBTypes,:SHADOW) ||
  1815. blacklist.include?(PBMoveData.new(opponent.lastMoveUsedSketch).function)
  1816. @battle.pbDisplay(_INTL("But it failed!"))
  1817. return -1
  1818. end
  1819. for i in attacker.moves
  1820. if i.id==opponent.lastMoveUsedSketch
  1821. @battle.pbDisplay(_INTL("But it failed!"))
  1822. return -1
  1823. end
  1824. end
  1825. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1826. @battle.pbDisplay(_INTL("But it failed!"))
  1827. return -1
  1828. end
  1829. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1830. for i in 0...attacker.moves.length
  1831. if attacker.moves[i].id==@id
  1832. newmove=PBMove.new(opponent.lastMoveUsedSketch)
  1833. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)
  1834. party=@battle.pbParty(attacker.index)
  1835. party[attacker.pokemonIndex].moves[i]=newmove
  1836. movename=PBMoves.getName(opponent.lastMoveUsedSketch)
  1837. @battle.pbDisplay(_INTL("{1} learned {2}!",attacker.pbThis,movename))
  1838. return 0
  1839. end
  1840. end
  1841. @battle.pbDisplay(_INTL("But it failed!"))
  1842. return -1
  1843. end
  1844. end
  1845. ################################################################################
  1846. # Changes user's type to that of a random user's move, except this one, OR the
  1847. # user's first move's type. (Conversion)
  1848. ################################################################################
  1849. class PokeBattle_Move_05E < PokeBattle_Move
  1850. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1851. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  1852. @battle.pbDisplay(_INTL("But it failed!"))
  1853. return -1
  1854. end
  1855. types=[]
  1856. for i in attacker.moves
  1857. next if i.id==@id
  1858. next if PBTypes.isPseudoType?(i.type)
  1859. next if attacker.pbHasType?(i.type)
  1860. if !types.include?(i.type)
  1861. types.push(i.type)
  1862. break if USENEWBATTLEMECHANICS
  1863. end
  1864. end
  1865. if types.length==0
  1866. @battle.pbDisplay(_INTL("But it failed!"))
  1867. return -1
  1868. end
  1869. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  1870. newtype=types[@battle.pbRandom(types.length)]
  1871. attacker.type1=newtype
  1872. attacker.type2=newtype
  1873. attacker.effects[PBEffects::Type3]=-1
  1874. typename=PBTypes.getName(newtype)
  1875. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  1876. end
  1877. end
  1878. ################################################################################
  1879. # Changes user's type to a random one that resists/is immune to the last move
  1880. # used by the target. (Conversion 2)
  1881. ################################################################################
  1882. class PokeBattle_Move_05F < PokeBattle_Move
  1883. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1884. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  1885. @battle.pbDisplay(_INTL("But it failed!"))
  1886. return -1
  1887. end
  1888. if opponent.lastMoveUsed<=0 ||
  1889. PBTypes.isPseudoType?(PBMoveData.new(opponent.lastMoveUsed).type)
  1890. @battle.pbDisplay(_INTL("But it failed!"))
  1891. return -1
  1892. end
  1893. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  1894. @battle.pbDisplay(_INTL("But it failed!"))
  1895. return -1
  1896. end
  1897. types=[]
  1898. atype=opponent.lastMoveUsedType
  1899. if atype<0
  1900. @battle.pbDisplay(_INTL("But it failed!"))
  1901. return -1
  1902. end
  1903. for i in 0..PBTypes.maxValue
  1904. next if PBTypes.isPseudoType?(i)
  1905. next if attacker.pbHasType?(i)
  1906. types.push(i) if PBTypes.getEffectiveness(atype,i)<2
  1907. end
  1908. if types.length==0
  1909. @battle.pbDisplay(_INTL("But it failed!"))
  1910. return -1
  1911. end
  1912. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1913. newtype=types[@battle.pbRandom(types.length)]
  1914. attacker.type1=newtype
  1915. attacker.type2=newtype
  1916. attacker.effects[PBEffects::Type3]=-1
  1917. typename=PBTypes.getName(newtype)
  1918. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  1919. return 0
  1920. end
  1921. end
  1922. ################################################################################
  1923. # Changes user's type depending on the environment. (Camouflage)
  1924. ################################################################################
  1925. class PokeBattle_Move_060 < PokeBattle_Move
  1926. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1927. if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
  1928. @battle.pbDisplay(_INTL("But it failed!"))
  1929. return -1
  1930. end
  1931. type=getConst(PBTypes,:NORMAL) || 0
  1932. case @battle.environment
  1933. when PBEnvironment::None; type=getConst(PBTypes,:NORMAL) || 0
  1934. when PBEnvironment::Grass; type=getConst(PBTypes,:GRASS) || 0
  1935. when PBEnvironment::TallGrass; type=getConst(PBTypes,:GRASS) || 0
  1936. when PBEnvironment::MovingWater; type=getConst(PBTypes,:WATER) || 0
  1937. when PBEnvironment::StillWater; type=getConst(PBTypes,:WATER) || 0
  1938. when PBEnvironment::Underwater; type=getConst(PBTypes,:WATER) || 0
  1939. when PBEnvironment::Cave; type=getConst(PBTypes,:ROCK) || 0
  1940. when PBEnvironment::Rock; type=getConst(PBTypes,:GROUND) || 0
  1941. when PBEnvironment::Sand; type=getConst(PBTypes,:GROUND) || 0
  1942. when PBEnvironment::Forest; type=getConst(PBTypes,:BUG) || 0
  1943. when PBEnvironment::Snow; type=getConst(PBTypes,:ICE) || 0
  1944. when PBEnvironment::Volcano; type=getConst(PBTypes,:FIRE) || 0
  1945. when PBEnvironment::Graveyard; type=getConst(PBTypes,:GHOST) || 0
  1946. when PBEnvironment::Sky; type=getConst(PBTypes,:FLYING) || 0
  1947. when PBEnvironment::Space; type=getConst(PBTypes,:DRAGON) || 0
  1948. end
  1949. if @battle.field.effects[PBEffects::MistyTerrain]>0
  1950. type=getConst(PBTypes,:FAIRY) if hasConst?(PBTypes,:FAIRY)
  1951. end
  1952. if attacker.pbHasType?(type)
  1953. @battle.pbDisplay(_INTL("But it failed!"))
  1954. return -1
  1955. end
  1956. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  1957. attacker.type1=type
  1958. attacker.type2=type
  1959. attacker.effects[PBEffects::Type3]=-1
  1960. typename=PBTypes.getName(type)
  1961. @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename))
  1962. return 0
  1963. end
  1964. end
  1965. ################################################################################
  1966. # Target's ability becomes Insomnia. (Worry Seed)
  1967. ################################################################################
  1968. class PokeBattle_Move_064 < PokeBattle_Move
  1969. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  1970. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  1971. @battle.pbDisplay(_INTL("But it failed!"))
  1972. return -1
  1973. end
  1974. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  1975. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  1976. isConst?(opponent.ability,PBAbilities,:INSOMNIA) ||
  1977. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  1978. isConst?(opponent.ability,PBAbilities,:TRUANT)
  1979. @battle.pbDisplay(_INTL("But it failed!"))
  1980. return -1
  1981. end
  1982. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  1983. oldabil=opponent.ability
  1984. opponent.ability=getConst(PBAbilities,:INSOMNIA) || 0
  1985. abilityname=PBAbilities.getName(getConst(PBAbilities,:INSOMNIA))
  1986. @battle.pbDisplay(_INTL("{1} acquired {2}!",opponent.pbThis,abilityname))
  1987. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  1988. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  1989. opponent.effects[PBEffects::Illusion]=nil
  1990. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  1991. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  1992. end
  1993. return 0
  1994. end
  1995. end
  1996. ################################################################################
  1997. # User copies target's ability. (Role Play)
  1998. ################################################################################
  1999. class PokeBattle_Move_065 < PokeBattle_Move
  2000. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2001. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2002. @battle.pbDisplay(_INTL("But it failed!"))
  2003. return -1
  2004. end
  2005. if opponent.ability==0 ||
  2006. attacker.ability==opponent.ability ||
  2007. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2008. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2009. isConst?(opponent.ability,PBAbilities,:FLOWERGIFT) ||
  2010. isConst?(opponent.ability,PBAbilities,:FORECAST) ||
  2011. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2012. isConst?(opponent.ability,PBAbilities,:IMPOSTER) ||
  2013. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2014. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2015. isConst?(opponent.ability,PBAbilities,:TRACE) ||
  2016. isConst?(opponent.ability,PBAbilities,:WONDERGUARD) ||
  2017. isConst?(opponent.ability,PBAbilities,:ZENMODE)
  2018. @battle.pbDisplay(_INTL("But it failed!"))
  2019. return -1
  2020. end
  2021. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2022. oldabil=attacker.ability
  2023. attacker.ability=opponent.ability
  2024. abilityname=PBAbilities.getName(opponent.ability)
  2025. @battle.pbDisplay(_INTL("{1} copied {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),abilityname))
  2026. if attacker.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2027. PBDebug.log("[Ability triggered] #{attacker.pbThis}'s Illusion ended")
  2028. attacker.effects[PBEffects::Illusion]=nil
  2029. @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
  2030. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",attacker.pbThis,PBAbilities.getName(oldabil)))
  2031. end
  2032. return 0
  2033. end
  2034. end
  2035. ################################################################################
  2036. # User and target swap abilities. (Skill Swap)
  2037. ################################################################################
  2038. class PokeBattle_Move_067 < PokeBattle_Move
  2039. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2040. if (attacker.ability==0 && opponent.ability==0) ||
  2041. (attacker.ability==opponent.ability && !USENEWBATTLEMECHANICS) ||
  2042. isConst?(attacker.ability,PBAbilities,:ILLUSION) ||
  2043. isConst?(opponent.ability,PBAbilities,:ILLUSION) ||
  2044. isConst?(attacker.ability,PBAbilities,:MULTITYPE) ||
  2045. isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2046. isConst?(attacker.ability,PBAbilities,:STANCECHANGE) ||
  2047. isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
  2048. isConst?(attacker.ability,PBAbilities,:WONDERGUARD) ||
  2049. isConst?(opponent.ability,PBAbilities,:WONDERGUARD)
  2050. @battle.pbDisplay(_INTL("But it failed!"))
  2051. return -1
  2052. end
  2053. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2054. tmp=attacker.ability
  2055. attacker.ability=opponent.ability
  2056. opponent.ability=tmp
  2057. @battle.pbDisplay(_INTL("{1} swapped its {2} Ability with its target's {3} Ability!",
  2058. attacker.pbThis,PBAbilities.getName(opponent.ability),
  2059. PBAbilities.getName(attacker.ability)))
  2060. attacker.pbAbilitiesOnSwitchIn(true)
  2061. opponent.pbAbilitiesOnSwitchIn(true)
  2062. return 0
  2063. end
  2064. end
  2065. ################################################################################
  2066. # Target's ability is negated. (Gastro Acid)
  2067. ################################################################################
  2068. class PokeBattle_Move_068 < PokeBattle_Move
  2069. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2070. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  2071. @battle.pbDisplay(_INTL("But it failed!"))
  2072. return -1
  2073. end
  2074. if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
  2075. isConst?(opponent.ability,PBAbilities,:STANCECHANGE)
  2076. @battle.pbDisplay(_INTL("But it failed!"))
  2077. return -1
  2078. end
  2079. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2080. oldabil=opponent.ability
  2081. opponent.effects[PBEffects::GastroAcid]=true
  2082. opponent.effects[PBEffects::Truant]=false
  2083. @battle.pbDisplay(_INTL("{1}'s Ability was suppressed!",opponent.pbThis))
  2084. if opponent.effects[PBEffects::Illusion] && isConst?(oldabil,PBAbilities,:ILLUSION)
  2085. PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Illusion ended")
  2086. opponent.effects[PBEffects::Illusion]=nil
  2087. @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
  2088. @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,PBAbilities.getName(oldabil)))
  2089. end
  2090. return 0
  2091. end
  2092. end
  2093. ################################################################################
  2094. # User transforms into the target. (Transform)
  2095. ################################################################################
  2096. class PokeBattle_Move_069 < PokeBattle_Move
  2097. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2098. blacklist=[
  2099. 0xC9, # Fly
  2100. 0xCA, # Dig
  2101. 0xCB, # Dive
  2102. 0xCC # Bounce
  2103. ]
  2104. if attacker.effects[PBEffects::Transform] ||
  2105. opponent.effects[PBEffects::Transform] ||
  2106. opponent.effects[PBEffects::Illusion] ||
  2107. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  2108. blacklist.include?(PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function)
  2109. @battle.pbDisplay(_INTL("But it failed!"))
  2110. return -1
  2111. end
  2112. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  2113. @battle.pbDisplay(_INTL("But it failed!"))
  2114. return -1
  2115. end
  2116. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2117. attacker.effects[PBEffects::Transform]=true
  2118. attacker.type1=opponent.type1
  2119. attacker.type2=opponent.type2
  2120. attacker.effects[PBEffects::Type3]=-1
  2121. attacker.ability=opponent.ability
  2122. attacker.attack=opponent.attack
  2123. attacker.defense=opponent.defense
  2124. attacker.speed=opponent.speed
  2125. attacker.spatk=opponent.spatk
  2126. attacker.spdef=opponent.spdef
  2127. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2128. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2129. attacker.stages[i]=opponent.stages[i]
  2130. end
  2131. for i in 0...4
  2132. attacker.moves[i]=PokeBattle_Move.pbFromPBMove(
  2133. @battle,PBMove.new(opponent.moves[i].id))
  2134. attacker.moves[i].pp=5
  2135. attacker.moves[i].totalpp=5
  2136. end
  2137. attacker.effects[PBEffects::Disable]=0
  2138. attacker.effects[PBEffects::DisableMove]=0
  2139. @battle.pbDisplay(_INTL("{1} transformed into {2}!",attacker.pbThis,opponent.pbThis(true)))
  2140. return 0
  2141. end
  2142. end
  2143. ################################################################################
  2144. # Inflicts a fixed 20HP damage. (SonicBoom)
  2145. ################################################################################
  2146. class PokeBattle_Move_06A < PokeBattle_Move
  2147. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2148. return pbEffectFixedDamage(20,attacker,opponent,hitnum,alltargets,showanimation)
  2149. end
  2150. end
  2151. ################################################################################
  2152. # Inflicts a fixed 40HP damage. (Dragon Rage)
  2153. ################################################################################
  2154. class PokeBattle_Move_06B < PokeBattle_Move
  2155. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2156. return pbEffectFixedDamage(40,attacker,opponent,hitnum,alltargets,showanimation)
  2157. end
  2158. end
  2159. ################################################################################
  2160. # Halves the target's current HP. (Super Fang)
  2161. ################################################################################
  2162. class PokeBattle_Move_06C < PokeBattle_Move
  2163. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2164. return pbEffectFixedDamage([(opponent.hp/2).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2165. end
  2166. end
  2167. ################################################################################
  2168. # Inflicts damage equal to the user's level. (Night Shade, Seismic Toss)
  2169. ################################################################################
  2170. class PokeBattle_Move_06D < PokeBattle_Move
  2171. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2172. return pbEffectFixedDamage(attacker.level,attacker,opponent,hitnum,alltargets,showanimation)
  2173. end
  2174. end
  2175. ################################################################################
  2176. # Inflicts damage to bring the target's HP down to equal the user's HP. (Endeavor)
  2177. ################################################################################
  2178. class PokeBattle_Move_06E < PokeBattle_Move
  2179. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2180. if attacker.hp>=opponent.hp
  2181. @battle.pbDisplay(_INTL("But it failed!"))
  2182. return -1
  2183. end
  2184. return pbEffectFixedDamage(opponent.hp-attacker.hp,attacker,opponent,hitnum,alltargets,showanimation)
  2185. end
  2186. end
  2187. ################################################################################
  2188. # Inflicts damage between 0.5 and 1.5 times the user's level. (Psywave)
  2189. ################################################################################
  2190. class PokeBattle_Move_06F < PokeBattle_Move
  2191. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2192. dmg=[(attacker.level*(@battle.pbRandom(101)+50)/100).floor,1].max
  2193. return pbEffectFixedDamage(dmg,attacker,opponent,hitnum,alltargets,showanimation)
  2194. end
  2195. end
  2196. ################################################################################
  2197. # OHKO. Accuracy increases by difference between levels of user and target.
  2198. ################################################################################
  2199. class PokeBattle_Move_070 < PokeBattle_Move
  2200. def pbAccuracyCheck(attacker,opponent)
  2201. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STURDY)
  2202. @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  2203. return false
  2204. end
  2205. if opponent.level>attacker.level
  2206. @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
  2207. return false
  2208. end
  2209. acc=@accuracy+attacker.level-opponent.level
  2210. return @battle.pbRandom(100)<acc
  2211. end
  2212.  
  2213. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2214. damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
  2215. if opponent.isFainted?
  2216. @battle.pbDisplay(_INTL("It's a one-hit KO!"))
  2217. end
  2218. return damage
  2219. end
  2220. end
  2221. ################################################################################
  2222. # Counters a physical move used against the user this round, with 2x the power. (Counter)
  2223. ################################################################################
  2224. class PokeBattle_Move_071 < PokeBattle_Move
  2225. def pbAddTarget(targets,attacker)
  2226. if attacker.effects[PBEffects::CounterTarget]>=0 &&
  2227. attacker.pbIsOpposing?(attacker.effects[PBEffects::CounterTarget])
  2228. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::CounterTarget]])
  2229. attacker.pbRandomTarget(targets)
  2230. end
  2231. end
  2232. end
  2233.  
  2234. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2235. if attacker.effects[PBEffects::Counter]<0 || !opponent
  2236. @battle.pbDisplay(_INTL("But it failed!"))
  2237. return -1
  2238. end
  2239. ret=pbEffectFixedDamage([attacker.effects[PBEffects::Counter]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2240. return ret
  2241. end
  2242. end
  2243. ################################################################################
  2244. # Counters a specical move used against the user this round, with 2x the power. (Mirror Coat)
  2245. ################################################################################
  2246. class PokeBattle_Move_072 < PokeBattle_Move
  2247. def pbAddTarget(targets,attacker)
  2248. if attacker.effects[PBEffects::MirrorCoatTarget]>=0 &&
  2249. attacker.pbIsOpposing?(attacker.effects[PBEffects::MirrorCoatTarget])
  2250. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::MirrorCoatTarget]])
  2251. attacker.pbRandomTarget(targets)
  2252. end
  2253. end
  2254. end
  2255.  
  2256. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2257. if attacker.effects[PBEffects::MirrorCoat]<0 || !opponent
  2258. @battle.pbDisplay(_INTL("But it failed!"))
  2259. return -1
  2260. end
  2261. ret=pbEffectFixedDamage([attacker.effects[PBEffects::MirrorCoat]*2,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2262. return ret
  2263. end
  2264. end
  2265. ################################################################################
  2266. # Counters the last damaging move used against the user this round, with 1.5x
  2267. # the power. (Metal Burst)
  2268. ################################################################################
  2269. class PokeBattle_Move_073 < PokeBattle_Move
  2270. def pbAddTarget(targets,attacker)
  2271. if attacker.lastAttacker.length>0
  2272. lastattacker=attacker.lastAttacker[attacker.lastAttacker.length-1]
  2273. if lastattacker>=0 && attacker.pbIsOpposing?(lastattacker)
  2274. if !attacker.pbAddTarget(targets,@battle.battlers[lastattacker])
  2275. attacker.pbRandomTarget(targets)
  2276. end
  2277. end
  2278. end
  2279. end
  2280.  
  2281. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2282. if attacker.lastHPLost==0 || !opponent
  2283. @battle.pbDisplay(_INTL("But it failed!"))
  2284. return -1
  2285. end
  2286. ret=pbEffectFixedDamage([(attacker.lastHPLost*1.5).floor,1].max,attacker,opponent,hitnum,alltargets,showanimation)
  2287. return ret
  2288. end
  2289. end
  2290. ################################################################################
  2291. # Power is doubled if the target is using Dive. (Surf)
  2292. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  2293. ################################################################################
  2294. class PokeBattle_Move_075 < PokeBattle_Move
  2295. def pbModifyDamage(damagemult,attacker,opponent)
  2296. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  2297. return (damagemult*2.0).round
  2298. end
  2299. return damagemult
  2300. end
  2301. end
  2302. ################################################################################
  2303. # Power is doubled if the target is using Dig. (Earthquake)
  2304. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  2305. ################################################################################
  2306. class PokeBattle_Move_076 < PokeBattle_Move
  2307. def pbModifyDamage(damagemult,attacker,opponent)
  2308. ret=damagemult
  2309. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  2310. ret=(damagemult*2.0).round
  2311. end
  2312. return ret
  2313. end
  2314. end
  2315. ################################################################################
  2316. # Power is doubled if the target is using Bounce or Fly. (Gust)
  2317. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  2318. ################################################################################
  2319. class PokeBattle_Move_077 < PokeBattle_Move
  2320. def pbBaseDamage(basedmg,attacker,opponent)
  2321. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  2322. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  2323. return basedmg*2
  2324. end
  2325. return basedmg
  2326. end
  2327. end
  2328. ################################################################################
  2329. # Power is doubled if the target is using Bounce or Fly. (Twister)
  2330. # May make the target flinch.
  2331. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  2332. ################################################################################
  2333. class PokeBattle_Move_078 < PokeBattle_Move
  2334. def pbBaseDamage(basedmg,attacker,opponent)
  2335. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  2336. PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  2337. return basedmg*2
  2338. end
  2339. return basedmg
  2340. end
  2341.  
  2342. def pbAdditionalEffect(attacker,opponent)
  2343. return if opponent.damagestate.substitute
  2344. opponent.pbFlinch(attacker)
  2345. end
  2346. end
  2347. ################################################################################
  2348. # Power is doubled if the target is paralyzed. Cures the target of paralysis.
  2349. # (SmellingSalt)
  2350. ################################################################################
  2351. class PokeBattle_Move_07C < PokeBattle_Move
  2352. def pbBaseDamage(basedmg,attacker,opponent)
  2353. if opponent.status==PBStatuses::PARALYSIS &&
  2354. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  2355. return basedmg*2
  2356. end
  2357. return basedmg
  2358. end
  2359.  
  2360. def pbEffectAfterHit(attacker,opponent,turneffects)
  2361. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  2362. !opponent.damagestate.substitute && opponent.status==PBStatuses::PARALYSIS
  2363. opponent.pbCureStatus
  2364. end
  2365. end
  2366. end
  2367. ################################################################################
  2368. # Power is doubled if the target is asleep. Wakes the target up. (Wake-Up Slap)
  2369. ################################################################################
  2370. class PokeBattle_Move_07D < PokeBattle_Move
  2371. def pbBaseDamage(basedmg,attacker,opponent)
  2372. if opponent.status==PBStatuses::SLEEP &&
  2373. (opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker))
  2374. return basedmg*2
  2375. end
  2376. return basedmg
  2377. end
  2378.  
  2379. def pbEffectAfterHit(attacker,opponent,turneffects)
  2380. if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
  2381. !opponent.damagestate.substitute && opponent.status==PBStatuses::SLEEP
  2382. opponent.pbCureStatus
  2383. end
  2384. end
  2385. end
  2386. ################################################################################
  2387. # Power is doubled if the user is burned, poisoned or paralyzed. (Facade)
  2388. ################################################################################
  2389. class PokeBattle_Move_07E < PokeBattle_Move
  2390. def pbBaseDamage(basedmg,attacker,opponent)
  2391. if attacker.status==PBStatuses::POISON ||
  2392. attacker.status==PBStatuses::BURN ||
  2393. attacker.status==PBStatuses::PARALYSIS
  2394. return basedmg*2
  2395. end
  2396. return basedmg
  2397. end
  2398. end
  2399. ################################################################################
  2400. # Power is doubled if the target's HP is down to 1/2 or less. (Brine)
  2401. ################################################################################
  2402. class PokeBattle_Move_080 < PokeBattle_Move
  2403. def pbBaseDamage(basedmg,attacker,opponent)
  2404. if opponent.hp<=opponent.totalhp/2
  2405. return basedmg*2
  2406. end
  2407. return basedmg
  2408. end
  2409. end
  2410. ################################################################################
  2411. # Power is doubled if the user has lost HP due to the target's move this round.
  2412. # (Revenge, Avalanche)
  2413. ################################################################################
  2414. class PokeBattle_Move_081 < PokeBattle_Move
  2415. def pbBaseDamage(basedmg,attacker,opponent)
  2416. if attacker.lastHPLost>0 && attacker.lastAttacker.include?(opponent.index)
  2417. return basedmg*2
  2418. end
  2419. return basedmg
  2420. end
  2421. end
  2422. ################################################################################
  2423. # Power is doubled if the target has already lost HP this round. (Assurance)
  2424. ################################################################################
  2425. class PokeBattle_Move_082 < PokeBattle_Move
  2426. def pbBaseDamage(basedmg,attacker,opponent)
  2427. if opponent.tookDamage
  2428. return basedmg*2
  2429. end
  2430. return basedmg
  2431. end
  2432. end
  2433. ################################################################################
  2434. # Power is doubled if the target has already moved this round. (Payback)
  2435. ################################################################################
  2436. class PokeBattle_Move_084 < PokeBattle_Move
  2437. def pbBaseDamage(basedmg,attacker,opponent)
  2438. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  2439. opponent.hasMovedThisRound? # Used a move already
  2440. return basedmg*2
  2441. end
  2442. return basedmg
  2443. end
  2444. end
  2445. ################################################################################
  2446. # Power is doubled in weather. Type changes depending on the weather. (Weather Ball)
  2447. ################################################################################
  2448. class PokeBattle_Move_087 < PokeBattle_Move
  2449. def pbBaseDamage(basedmg,attacker,opponent)
  2450. if @battle.pbWeather!=0
  2451. return basedmg*2
  2452. end
  2453. return basedmg
  2454. end
  2455.  
  2456. def pbModifyType(type,attacker,opponent)
  2457. type=getConst(PBTypes,:NORMAL) || 0
  2458. case @battle.pbWeather
  2459. when PBWeather::SUNNYDAY, PBWeather::HARSHSUN
  2460. type=(getConst(PBTypes,:FIRE) || type)
  2461. when PBWeather::RAINDANCE, PBWeather::HEAVYRAIN
  2462. type=(getConst(PBTypes,:WATER) || type)
  2463. when PBWeather::SANDSTORM
  2464. type=(getConst(PBTypes,:ROCK) || type)
  2465. when PBWeather::HAIL
  2466. type=(getConst(PBTypes,:ICE) || type)
  2467. end
  2468. return type
  2469. end
  2470. end
  2471. ################################################################################
  2472. # Power is doubled if a foe tries to switch out or use U-turn. (Pursuit)
  2473. # (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
  2474. ################################################################################
  2475. class PokeBattle_Move_088 < PokeBattle_Move
  2476. def pbBaseDamage(basedmg,attacker,opponent)
  2477. if @battle.switching
  2478. return basedmg*2
  2479. end
  2480. return basedmg
  2481. end
  2482.  
  2483. def pbAccuracyCheck(attacker,opponent)
  2484. return true if @battle.switching
  2485. return super(attacker,opponent)
  2486. end
  2487. end
  2488. ################################################################################
  2489. # Power increases with the user's happiness. (Return)
  2490. ################################################################################
  2491. class PokeBattle_Move_089 < PokeBattle_Move
  2492. def pbBaseDamage(basedmg,attacker,opponent)
  2493. return [(attacker.happiness*2/5).floor,1].max
  2494. end
  2495. end
  2496. ################################################################################
  2497. # Power decreases with the user's happiness. (Frustration)
  2498. ################################################################################
  2499. class PokeBattle_Move_08A < PokeBattle_Move
  2500. def pbBaseDamage(basedmg,attacker,opponent)
  2501. return [((255-attacker.happiness)*2/5).floor,1].max
  2502. end
  2503. end
  2504. ################################################################################
  2505. # Power increases with the user's HP. (Eruption, Water Spout)
  2506. ################################################################################
  2507. class PokeBattle_Move_08B < PokeBattle_Move
  2508. def pbBaseDamage(basedmg,attacker,opponent)
  2509. return [(150*attacker.hp/attacker.totalhp).floor,1].max
  2510. end
  2511. end
  2512. ################################################################################
  2513. # Power increases with the target's HP. (Crush Grip, Wring Out)
  2514. ################################################################################
  2515. class PokeBattle_Move_08C < PokeBattle_Move
  2516. def pbBaseDamage(basedmg,attacker,opponent)
  2517. return [(120*opponent.hp/opponent.totalhp).floor,1].max
  2518. end
  2519. end
  2520. ################################################################################
  2521. # Power increases the quicker the target is than the user. (Gyro Ball)
  2522. ################################################################################
  2523. class PokeBattle_Move_08D < PokeBattle_Move
  2524. def pbBaseDamage(basedmg,attacker,opponent)
  2525. return [[(25*opponent.pbSpeed/attacker.pbSpeed).floor,150].min,1].max
  2526. end
  2527. end
  2528. ################################################################################
  2529. # Power increases with the target's positive stat changes (ignores negative ones).
  2530. # (Punishment)
  2531. ################################################################################
  2532. class PokeBattle_Move_08F < PokeBattle_Move
  2533. def pbBaseDamage(basedmg,attacker,opponent)
  2534. mult=3
  2535. for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
  2536. PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
  2537. mult+=opponent.stages[i] if opponent.stages[i]>0
  2538. end
  2539. return [20*mult,200].min
  2540. end
  2541. end
  2542. ################################################################################
  2543. # Power and type depends on the user's IVs. (Hidden Power)
  2544. ################################################################################
  2545. class PokeBattle_Move_090 < PokeBattle_Move
  2546. def pbModifyType(type,attacker,opponent)
  2547. hp=pbHiddenPower(attacker.iv)
  2548. type=hp[0]
  2549. return type
  2550. end
  2551.  
  2552. def pbBaseDamage(basedmg,attacker,opponent)
  2553. return 60 if USENEWBATTLEMECHANICS
  2554. hp=pbHiddenPower(attacker.iv)
  2555. return hp[1]
  2556. end
  2557. end
  2558.  
  2559. def pbHiddenPower(iv)
  2560. powermin=30
  2561. powermax=70
  2562. type=0; base=0
  2563. types=[]
  2564. for i in 0..PBTypes.maxValue
  2565. types.push(i) if !PBTypes.isPseudoType?(i) &&
  2566. !isConst?(i,PBTypes,:NORMAL) && !isConst?(i,PBTypes,:SHADOW)
  2567. end
  2568. type|=(iv[PBStats::HP]&1)
  2569. type|=(iv[PBStats::ATTACK]&1)<<1
  2570. type|=(iv[PBStats::DEFENSE]&1)<<2
  2571. type|=(iv[PBStats::SPEED]&1)<<3
  2572. type|=(iv[PBStats::SPATK]&1)<<4
  2573. type|=(iv[PBStats::SPDEF]&1)<<5
  2574. type=(type*(types.length-1)/63).floor
  2575. hptype=types[type]
  2576. base|=(iv[PBStats::HP]&2)>>1
  2577. base|=(iv[PBStats::ATTACK]&2)
  2578. base|=(iv[PBStats::DEFENSE]&2)<<1
  2579. base|=(iv[PBStats::SPEED]&2)<<2
  2580. base|=(iv[PBStats::SPATK]&2)<<3
  2581. base|=(iv[PBStats::SPDEF]&2)<<4
  2582. base=(base*(powermax-powermin)/63).floor+powermin
  2583. return [hptype,base]
  2584. end
  2585. ################################################################################
  2586. # Power doubles for each consecutive use. (Fury Cutter)
  2587. ################################################################################
  2588. class PokeBattle_Move_091 < PokeBattle_Move
  2589. def pbBaseDamage(basedmg,attacker,opponent)
  2590. basedmg=basedmg<<(attacker.effects[PBEffects::FuryCutter]-1) # can be 1 to 4
  2591. return basedmg
  2592. end
  2593. end
  2594. ################################################################################
  2595. # User rages until the start of a round in which they don't use this move. (Rage)
  2596. # (Handled in Battler's pbProcessMoveAgainstTarget): Ups rager's Attack by 1
  2597. # stage each time it loses HP due to a move.
  2598. ################################################################################
  2599. class PokeBattle_Move_093 < PokeBattle_Move
  2600. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2601. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  2602. attacker.effects[PBEffects::Rage]=true if ret>0
  2603. return ret
  2604. end
  2605. end
  2606. ################################################################################
  2607. # Randomly damages or heals the target. (Present)
  2608. ################################################################################
  2609. class PokeBattle_Move_094 < PokeBattle_Move
  2610. def pbOnStartUse(attacker)
  2611. # Just to ensure that Parental Bond's second hit damages if the first hit does
  2612. @forcedamage=false
  2613. return true
  2614. end
  2615.  
  2616. def pbBaseDamage(basedmg,attacker,opponent)
  2617. @forcedamage=true
  2618. return @calcbasedmg
  2619. end
  2620.  
  2621. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2622. @calcbasedmg=1
  2623. r=@battle.pbRandom((@forcedamage) ? 8 : 10)
  2624. if r<4
  2625. @calcbasedmg=40
  2626. elsif r<7
  2627. @calcbasedmg=80
  2628. elsif r<8
  2629. @calcbasedmg=120
  2630. else
  2631. if pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)==0
  2632. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  2633. return -1
  2634. end
  2635. if opponent.hp==opponent.totalhp
  2636. @battle.pbDisplay(_INTL("But it failed!"))
  2637. return -1
  2638. end
  2639. damage=pbCalcDamage(attacker,opponent) # Consumes Gems even if it will heal
  2640. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Healing animation
  2641. opponent.pbRecoverHP((opponent.totalhp/4).floor,true)
  2642. @battle.pbDisplay(_INTL("{1} had its HP restored.",opponent.pbThis))
  2643. return 0
  2644. end
  2645. return super(attacker,opponent,hitnum,alltargets,showanimation)
  2646. end
  2647. end
  2648. ################################################################################
  2649. # Power is chosen at random. Power is doubled if the target is using Dig. (Magnitude)
  2650. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  2651. ################################################################################
  2652. class PokeBattle_Move_095 < PokeBattle_Move
  2653. def pbOnStartUse(attacker)
  2654. basedmg=[10,30,50,70,90,110,150]
  2655. magnitudes=[
  2656. 4,
  2657. 5,5,
  2658. 6,6,6,6,
  2659. 7,7,7,7,7,7,
  2660. 8,8,8,8,
  2661. 9,9,
  2662. 10
  2663. ]
  2664. magni=magnitudes[@battle.pbRandom(magnitudes.length)]
  2665. @calcbasedmg=basedmg[magni-4]
  2666. @battle.pbDisplay(_INTL("Magnitude {1}!",magni))
  2667. return true
  2668. end
  2669.  
  2670. def pbBaseDamage(basedmg,attacker,opponent)
  2671. ret=@calcbasedmg
  2672. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCA # Dig
  2673. ret*=2
  2674. end
  2675. return ret
  2676. end
  2677. end
  2678. ################################################################################
  2679. # Power and type depend on the user's held berry. Destroys the berry. (Natural Gift)
  2680. ################################################################################
  2681. class PokeBattle_Move_096 < PokeBattle_Move
  2682. def pbOnStartUse(attacker)
  2683. if !pbIsBerry?(attacker.item) ||
  2684. attacker.effects[PBEffects::Embargo]>0 ||
  2685. attacker.hasWorkingAbility(:KLUTZ) ||
  2686. attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) ||
  2687. attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  2688. @battle.pbDisplay(_INTL("But it failed!"))
  2689. return false
  2690. end
  2691. @berry=attacker.item
  2692. return true
  2693. end
  2694.  
  2695. def pbBaseDamage(basedmg,attacker,opponent)
  2696. damagearray={
  2697. 60 => [:CHERIBERRY,:CHESTOBERRY,:PECHABERRY,:RAWSTBERRY,:ASPEARBERRY,
  2698. :LEPPABERRY,:ORANBERRY,:PERSIMBERRY,:LUMBERRY,:SITRUSBERRY,
  2699. :FIGYBERRY,:WIKIBERRY,:MAGOBERRY,:AGUAVBERRY,:IAPAPABERRY,
  2700. :RAZZBERRY,:OCCABERRY,:PASSHOBERRY,:WACANBERRY,:RINDOBERRY,
  2701. :YACHEBERRY,:CHOPLEBERRY,:KEBIABERRY,:SHUCABERRY,:COBABERRY,
  2702. :PAYAPABERRY,:TANGABERRY,:CHARTIBERRY,:KASIBBERRY,:HABANBERRY,
  2703. :COLBURBERRY,:BABIRIBERRY,:CHILANBERRY,:ROSELIBERRY],
  2704. 70 => [:BLUKBERRY,:NANABBERRY,:WEPEARBERRY,:PINAPBERRY,:POMEGBERRY,
  2705. :KELPSYBERRY,:QUALOTBERRY,:HONDEWBERRY,:GREPABERRY,:TAMATOBERRY,
  2706. :CORNNBERRY,:MAGOSTBERRY,:RABUTABERRY,:NOMELBERRY,:SPELONBERRY,
  2707. :PAMTREBERRY],
  2708. 80 => [:WATMELBERRY,:DURINBERRY,:BELUEBERRY,:LIECHIBERRY,:GANLONBERRY,
  2709. :SALACBERRY,:PETAYABERRY,:APICOTBERRY,:LANSATBERRY,:STARFBERRY,
  2710. :ENIGMABERRY,:MICLEBERRY,:CUSTAPBERRY,:JABOCABERRY,:ROWAPBERRY,
  2711. :KEEBERRY,:MARANGABERRY]
  2712. }
  2713. for i in damagearray.keys
  2714. data=damagearray[i]
  2715. if data
  2716. for j in data
  2717. if isConst?(@berry,PBItems,j)
  2718. ret=i
  2719. ret+=20 if USENEWBATTLEMECHANICS
  2720. return ret
  2721. end
  2722. end
  2723. end
  2724. end
  2725. return 1
  2726. end
  2727.  
  2728. def pbModifyType(type,attacker,opponent)
  2729. type=getConst(PBTypes,:NORMAL) || 0
  2730. typearray={
  2731. :NORMAL => [:CHILANBERRY],
  2732. :FIRE => [:CHERIBERRY,:BLUKBERRY,:WATMELBERRY,:OCCABERRY],
  2733. :WATER => [:CHESTOBERRY,:NANABBERRY,:DURINBERRY,:PASSHOBERRY],
  2734. :ELECTRIC => [:PECHABERRY,:WEPEARBERRY,:BELUEBERRY,:WACANBERRY],
  2735. :GRASS => [:RAWSTBERRY,:PINAPBERRY,:RINDOBERRY,:LIECHIBERRY],
  2736. :ICE => [:ASPEARBERRY,:POMEGBERRY,:YACHEBERRY,:GANLONBERRY],
  2737. :FIGHTING => [:LEPPABERRY,:KELPSYBERRY,:CHOPLEBERRY,:SALACBERRY],
  2738. :POISON => [:ORANBERRY,:QUALOTBERRY,:KEBIABERRY,:PETAYABERRY],
  2739. :GROUND => [:PERSIMBERRY,:HONDEWBERRY,:SHUCABERRY,:APICOTBERRY],
  2740. :FLYING => [:LUMBERRY,:GREPABERRY,:COBABERRY,:LANSATBERRY],
  2741. :PSYCHIC => [:SITRUSBERRY,:TAMATOBERRY,:PAYAPABERRY,:STARFBERRY],
  2742. :BUG => [:FIGYBERRY,:CORNNBERRY,:TANGABERRY,:ENIGMABERRY],
  2743. :ROCK => [:WIKIBERRY,:MAGOSTBERRY,:CHARTIBERRY,:MICLEBERRY],
  2744. :GHOST => [:MAGOBERRY,:RABUTABERRY,:KASIBBERRY,:CUSTAPBERRY],
  2745. :DRAGON => [:AGUAVBERRY,:NOMELBERRY,:HABANBERRY,:JABOCABERRY],
  2746. :DARK => [:IAPAPABERRY,:SPELONBERRY,:COLBURBERRY,:ROWAPBERRY,:MARANGABERRY],
  2747. :STEEL => [:RAZZBERRY,:PAMTREBERRY,:BABIRIBERRY],
  2748. :FAIRY => [:ROSELIBERRY,:KEEBERRY]
  2749. }
  2750. for i in typearray.keys
  2751. data=typearray[i]
  2752. if data
  2753. for j in data
  2754. if isConst?(@berry,PBItems,j)
  2755. type=getConst(PBTypes,i) || type
  2756. end
  2757. end
  2758. end
  2759. end
  2760. return type
  2761. end
  2762.  
  2763. def pbEffectAfterHit(attacker,opponent,turneffects)
  2764. if turneffects[PBEffects::TotalDamage]>0>0
  2765. attacker.pbConsumeItem
  2766. end
  2767. end
  2768. end
  2769. ################################################################################
  2770. # Power increases the less PP this move has. (Trump Card)
  2771. ################################################################################
  2772. class PokeBattle_Move_097 < PokeBattle_Move
  2773. def pbBaseDamage(basedmg,attacker,opponent)
  2774. dmgs=[200,80,60,50,40]
  2775. ppleft=[@pp,4].min # PP is reduced before the move is used
  2776. basedmg=dmgs[ppleft]
  2777. return basedmg
  2778. end
  2779. end
  2780. ################################################################################
  2781. # Power increases the less HP the user has. (Flail, Reversal)
  2782. ################################################################################
  2783. class PokeBattle_Move_098 < PokeBattle_Move
  2784. def pbBaseDamage(basedmg,attacker,opponent)
  2785. n=(48*attacker.hp/attacker.totalhp).floor
  2786. ret=20
  2787. ret=40 if n<33
  2788. ret=80 if n<17
  2789. ret=100 if n<10
  2790. ret=150 if n<5
  2791. ret=200 if n<2
  2792. return ret
  2793. end
  2794. end
  2795. ################################################################################
  2796. # Power increases the heavier the target is. (Grass Knot, Low Kick)
  2797. ################################################################################
  2798. class PokeBattle_Move_09A < PokeBattle_Move
  2799. def pbBaseDamage(basedmg,attacker,opponent)
  2800. weight=opponent.weight(attacker)
  2801. ret=20
  2802. ret=40 if weight>=100
  2803. ret=60 if weight>=250
  2804. ret=80 if weight>=500
  2805. ret=100 if weight>=1000
  2806. ret=120 if weight>=2000
  2807. return ret
  2808. end
  2809. end
  2810. ################################################################################
  2811. # Powers up the ally's attack this round by 1.5. (Helping Hand)
  2812. ################################################################################
  2813. class PokeBattle_Move_09C < PokeBattle_Move
  2814. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2815. if !@battle.doublebattle || opponent.isFainted? ||
  2816. @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  2817. opponent.hasMovedThisRound? ||
  2818. opponent.effects[PBEffects::HelpingHand]
  2819. @battle.pbDisplay(_INTL("But it failed!"))
  2820. return -1
  2821. end
  2822. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2823. opponent.effects[PBEffects::HelpingHand]=true
  2824. @battle.pbDisplay(_INTL("{1} is ready to help {2}!",attacker.pbThis,opponent.pbThis(true)))
  2825. return 0
  2826. end
  2827. end
  2828. ################################################################################
  2829. # Weakens Electric attacks. (Mud Sport)
  2830. ################################################################################
  2831. class PokeBattle_Move_09D < PokeBattle_Move
  2832. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2833. if USENEWBATTLEMECHANICS
  2834. if @battle.field.effects[PBEffects::MudSportField]>0
  2835. @battle.pbDisplay(_INTL("But it failed!"))
  2836. return -1
  2837. end
  2838. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2839. @battle.field.effects[PBEffects::MudSportField]=5
  2840. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  2841. return 0
  2842. else
  2843. for i in 0...4
  2844. if attacker.battle.battlers[i].effects[PBEffects::MudSport]
  2845. @battle.pbDisplay(_INTL("But it failed!"))
  2846. return -1
  2847. end
  2848. end
  2849. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2850. attacker.effects[PBEffects::MudSport]=true
  2851. @battle.pbDisplay(_INTL("Electricity's power was weakened!"))
  2852. return 0
  2853. end
  2854. return -1
  2855. end
  2856. end
  2857. ################################################################################
  2858. # Weakens Fire attacks. (Water Sport)
  2859. ################################################################################
  2860. class PokeBattle_Move_09E < PokeBattle_Move
  2861. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2862. if USENEWBATTLEMECHANICS
  2863. if @battle.field.effects[PBEffects::WaterSportField]>0
  2864. @battle.pbDisplay(_INTL("But it failed!"))
  2865. return -1
  2866. end
  2867. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2868. @battle.field.effects[PBEffects::WaterSportField]=5
  2869. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  2870. return 0
  2871. else
  2872. for i in 0...4
  2873. if attacker.battle.battlers[i].effects[PBEffects::WaterSport]
  2874. @battle.pbDisplay(_INTL("But it failed!"))
  2875. return -1
  2876. end
  2877. end
  2878. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2879. attacker.effects[PBEffects::WaterSport]=true
  2880. @battle.pbDisplay(_INTL("Fire's power was weakened!"))
  2881. return 0
  2882. end
  2883. end
  2884. end
  2885. ################################################################################
  2886. # Type depends on the user's held item. (Judgment)
  2887. ################################################################################
  2888. class PokeBattle_Move_09F < PokeBattle_Move
  2889. def pbModifyType(type,attacker,opponent)
  2890. type=getConst(PBTypes,:NORMAL) || 0
  2891. if isConst?(@id,PBMoves,:JUDGMENT)
  2892. type=(getConst(PBTypes,:FIGHTING) || 0) if attacker.hasWorkingItem(:FISTPLATE)
  2893. type=(getConst(PBTypes,:FLYING) || 0) if attacker.hasWorkingItem(:SKYPLATE)
  2894. type=(getConst(PBTypes,:POISON) || 0) if attacker.hasWorkingItem(:TOXICPLATE)
  2895. type=(getConst(PBTypes,:GROUND) || 0) if attacker.hasWorkingItem(:EARTHPLATE)
  2896. type=(getConst(PBTypes,:ROCK) || 0) if attacker.hasWorkingItem(:STONEPLATE)
  2897. type=(getConst(PBTypes,:BUG) || 0) if attacker.hasWorkingItem(:INSECTPLATE)
  2898. type=(getConst(PBTypes,:GHOST) || 0) if attacker.hasWorkingItem(:SPOOKYPLATE)
  2899. type=(getConst(PBTypes,:STEEL) || 0) if attacker.hasWorkingItem(:IRONPLATE)
  2900. type=(getConst(PBTypes,:FIRE) || 0) if attacker.hasWorkingItem(:FLAMEPLATE)
  2901. type=(getConst(PBTypes,:WATER) || 0) if attacker.hasWorkingItem(:SPLASHPLATE)
  2902. type=(getConst(PBTypes,:GRASS) || 0) if attacker.hasWorkingItem(:MEADOWPLATE)
  2903. type=(getConst(PBTypes,:ELECTRIC) || 0) if attacker.hasWorkingItem(:ZAPPLATE)
  2904. type=(getConst(PBTypes,:PSYCHIC) || 0) if attacker.hasWorkingItem(:MINDPLATE)
  2905. type=(getConst(PBTypes,:ICE) || 0) if attacker.hasWorkingItem(:ICICLEPLATE)
  2906. type=(getConst(PBTypes,:DRAGON) || 0) if attacker.hasWorkingItem(:DRACOPLATE)
  2907. type=(getConst(PBTypes,:DARK) || 0) if attacker.hasWorkingItem(:DREADPLATE)
  2908. type=(getConst(PBTypes,:FAIRY) || 0) if attacker.hasWorkingItem(:PIXIEPLATE)
  2909. end
  2910. return type
  2911. end
  2912.  
  2913. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2914. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  2915. end
  2916. end
  2917. ################################################################################
  2918. # For 5 rounds, foes' attacks cannot become critical hits. (Lucky Chant)
  2919. ################################################################################
  2920. class PokeBattle_Move_0A1 < PokeBattle_Move
  2921. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2922. if attacker.pbOwnSide.effects[PBEffects::LuckyChant]>0
  2923. @battle.pbDisplay(_INTL("But it failed!"))
  2924. return -1
  2925. end
  2926. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2927. attacker.pbOwnSide.effects[PBEffects::LuckyChant]=5
  2928. if !@battle.pbIsOpposing?(attacker.index)
  2929. @battle.pbDisplay(_INTL("The Lucky Chant shielded your team from critical hits!"))
  2930. else
  2931. @battle.pbDisplay(_INTL("The Lucky Chant shielded the opposing team from critical hits!"))
  2932. end
  2933. return 0
  2934. end
  2935. end
  2936. ################################################################################
  2937. # For 5 rounds, lowers power of physical attacks against the user's side. (Reflect)
  2938. ################################################################################
  2939. class PokeBattle_Move_0A2 < PokeBattle_Move
  2940. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2941. if attacker.pbOwnSide.effects[PBEffects::Reflect]>0
  2942. @battle.pbDisplay(_INTL("But it failed!"))
  2943. return -1
  2944. end
  2945. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2946. attacker.pbOwnSide.effects[PBEffects::Reflect]=5
  2947. attacker.pbOwnSide.effects[PBEffects::Reflect]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  2948. if !@battle.pbIsOpposing?(attacker.index)
  2949. @battle.pbDisplay(_INTL("Reflect raised your team's Defense!"))
  2950. else
  2951. @battle.pbDisplay(_INTL("Reflect raised the opposing team's Defense!"))
  2952. end
  2953. return 0
  2954. end
  2955. end
  2956. ################################################################################
  2957. # For 5 rounds, lowers power of special attacks against the user's side. (Light Screen)
  2958. ################################################################################
  2959. class PokeBattle_Move_0A3 < PokeBattle_Move
  2960. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  2961. if attacker.pbOwnSide.effects[PBEffects::LightScreen]>0
  2962. @battle.pbDisplay(_INTL("But it failed!"))
  2963. return -1
  2964. end
  2965. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  2966. attacker.pbOwnSide.effects[PBEffects::LightScreen]=5
  2967. attacker.pbOwnSide.effects[PBEffects::LightScreen]=8 if attacker.hasWorkingItem(:LIGHTCLAY)
  2968. if !@battle.pbIsOpposing?(attacker.index)
  2969. @battle.pbDisplay(_INTL("Light Screen raised your team's Special Defense!"))
  2970. else
  2971. @battle.pbDisplay(_INTL("Light Screen raised the opposing team's Special Defense!"))
  2972. end
  2973. return 0
  2974. end
  2975. end
  2976. ################################################################################
  2977. # Effect depends on the environment. (Secret Power)
  2978. ################################################################################
  2979. class PokeBattle_Move_0A4 < PokeBattle_Move
  2980. def pbAdditionalEffect(attacker,opponent)
  2981. return if opponent.damagestate.substitute
  2982. if @battle.field.effects[PBEffects::MistyTerrain]>0
  2983. if !opponent.pbCanReduceStatStage?(PBStats::SPATK,attacker,false,self)
  2984. opponent.pbReduceStat(PBStats::SPATK,1,attacker,false,self)
  2985. return
  2986. end
  2987. end
  2988. case @battle.environment
  2989. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  2990. if opponent.pbCanSleep?(attacker,false,self)
  2991. opponent.pbSleep
  2992. end
  2993. when PBEnvironment::MovingWater, PBEnvironment::Underwater
  2994. if opponent.pbCanReduceStatStage?(PBStats::ATTACK,attacker,false,self)
  2995. opponent.pbReduceStat(PBStats::ATTACK,1,attacker,false,self)
  2996. end
  2997. when PBEnvironment::StillWater, PBEnvironment::Sky
  2998. if !opponent.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  2999. opponent.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  3000. end
  3001. when PBEnvironment::Sand
  3002. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  3003. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  3004. end
  3005. when PBEnvironment::Rock
  3006. if USENEWBATTLEMECHANICS
  3007. if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
  3008. opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
  3009. end
  3010. else
  3011. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  3012. opponent.pbFlinch(attacker)
  3013. end
  3014. end
  3015. when PBEnvironment::Cave, PBEnvironment::Graveyard, PBEnvironment::Space
  3016. if opponent.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(attacker)
  3017. opponent.pbFlinch(attacker)
  3018. end
  3019. when PBEnvironment::Snow
  3020. if opponent.pbCanFreeze?(attacker,false,self)
  3021. opponent.pbFreeze
  3022. end
  3023. when PBEnvironment::Volcano
  3024. if opponent.pbCanBurn?(attacker,false,self)
  3025. opponent.pbBurn(attacker)
  3026. end
  3027. else
  3028. if opponent.pbCanParalyze?(attacker,false,self)
  3029. opponent.pbParalyze(attacker)
  3030. end
  3031. end
  3032. end
  3033.  
  3034. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3035. id=getConst(PBMoves,:BODYSLAM)
  3036. case @battle.environment
  3037. when PBEnvironment::Grass, PBEnvironment::TallGrass
  3038. id=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:VINEWHIP) : getConst(PBMoves,:NEEDLEARM)) || id
  3039. when PBEnvironment::MovingWater; id=getConst(PBMoves,:WATERPULSE) || id
  3040. when PBEnvironment::StillWater; id=getConst(PBMoves,:MUDSHOT) || id
  3041. when PBEnvironment::Underwater; id=getConst(PBMoves,:WATERPULSE) || id
  3042. when PBEnvironment::Cave; id=getConst(PBMoves,:ROCKTHROW) || id
  3043. when PBEnvironment::Rock; id=getConst(PBMoves,:MUDSLAP) || id
  3044. when PBEnvironment::Sand; id=getConst(PBMoves,:MUDSLAP) || id
  3045. when PBEnvironment::Forest; id=getConst(PBMoves,:RAZORLEAF) || id
  3046. when PBEnvironment::Snow; id=getConst(PBMoves,:AVALANCHE) || id
  3047. when PBEnvironment::Graveyard; id=getConst(PBMoves,:SHADOWSNEAK) || id
  3048. when PBEnvironment::Sky; id=getConst(PBMoves,:GUST) || id
  3049. when PBEnvironment::Space; id=getConst(PBMoves,:SWIFT) || id
  3050. end
  3051. if @battle.field.effects[PBEffects::MistyTerrain]>0
  3052. id=getConst(PBMoves,:FAIRYWIND) || id
  3053. end
  3054. return super(id,attacker,opponent,hitnum,alltargets,showanimation) # Environment-specific anim
  3055. end
  3056. end
  3057. ################################################################################
  3058. # Always hits.
  3059. ################################################################################
  3060. class PokeBattle_Move_0A5 < PokeBattle_Move
  3061. def pbAccuracyCheck(attacker,opponent)
  3062. return true
  3063. end
  3064. end
  3065. ################################################################################
  3066. # User's attack next round against the target will definitely hit. (Lock-On, Mind Reader)
  3067. ################################################################################
  3068. class PokeBattle_Move_0A6 < PokeBattle_Move
  3069. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3070. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  3071. @battle.pbDisplay(_INTL("But it failed!"))
  3072. return -1
  3073. end
  3074. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3075. opponent.effects[PBEffects::LockOn]=2
  3076. opponent.effects[PBEffects::LockOnPos]=attacker.index
  3077. @battle.pbDisplay(_INTL("{1} took aim at {2}!",attacker.pbThis,opponent.pbThis(true)))
  3078. return 0
  3079. end
  3080. end
  3081. ################################################################################
  3082. # Target's evasion stat changes are ignored from now on. (Foresight, Odor Sleuth)
  3083. # Normal and Fighting moves have normal effectiveness against the Ghost-type target.
  3084. ################################################################################
  3085. class PokeBattle_Move_0A7 < PokeBattle_Move
  3086. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3087. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  3088. @battle.pbDisplay(_INTL("But it failed!"))
  3089. return -1
  3090. end
  3091. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3092. opponent.effects[PBEffects::Foresight]=true
  3093. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  3094. return 0
  3095. end
  3096. end
  3097. ################################################################################
  3098. # Target's evasion stat changes are ignored from now on. (Miracle Eye)
  3099. # Psychic moves have normal effectiveness against the Dark-type target.
  3100. ################################################################################
  3101. class PokeBattle_Move_0A8 < PokeBattle_Move
  3102. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3103. if opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  3104. @battle.pbDisplay(_INTL("But it failed!"))
  3105. return -1
  3106. end
  3107. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3108. opponent.effects[PBEffects::MiracleEye]=true
  3109. @battle.pbDisplay(_INTL("{1} was identified!",opponent.pbThis))
  3110. return 0
  3111. end
  3112. end
  3113. #HERE
  3114. ################################################################################
  3115. # User is protected against moves with the "B" flag this round. (Detect, Protect)
  3116. ################################################################################
  3117. class PokeBattle_Move_0AA < PokeBattle_Move
  3118. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3119. ratesharers=[
  3120. 0xAA, # Detect, Protect
  3121. 0xE8 # Endure
  3122. ]
  3123. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  3124. attacker.effects[PBEffects::ProtectRate]=1
  3125. end
  3126. unmoved=false
  3127. for poke in @battle.battlers
  3128. next if poke.index==attacker.index
  3129. if @battle.choices[poke.index][0]==1 && # Chose a move
  3130. !poke.hasMovedThisRound?
  3131. unmoved=true; break
  3132. end
  3133. end
  3134. if !unmoved ||
  3135. @battle.pbRandom(65536)>=(65536/attacker.effects[PBEffects::ProtectRate]).floor
  3136. attacker.effects[PBEffects::ProtectRate]=1
  3137. @battle.pbDisplay(_INTL("But it failed!"))
  3138. return -1
  3139. end
  3140. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  3141. attacker.effects[PBEffects::Protect]=true
  3142. attacker.effects[PBEffects::ProtectRate]*=2
  3143. @battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
  3144. return 0
  3145. end
  3146. end
  3147. ################################################################################
  3148. # Ignores target's protections. If successful, all other moves this round
  3149. # ignore them too. (Feint)
  3150. ################################################################################
  3151. class PokeBattle_Move_0AD < PokeBattle_Move
  3152. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3153. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3154. if ret>0
  3155. opponent.effects[PBEffects::ProtectNegation]=true
  3156. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  3157. end
  3158. return ret
  3159. end
  3160. end
  3161. ################################################################################
  3162. # Uses the last move that the target used. (Mirror Move)
  3163. ################################################################################
  3164. class PokeBattle_Move_0AE < PokeBattle_Move
  3165. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3166. if opponent.lastMoveUsed<=0 ||
  3167. (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
  3168. @battle.pbDisplay(_INTL("The mirror move failed!"))
  3169. return -1
  3170. end
  3171. attacker.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
  3172. return 0
  3173. end
  3174. end
  3175. ################################################################################
  3176. # Uses the last move that was used. (Copycat)
  3177. ################################################################################
  3178. class PokeBattle_Move_0AF < PokeBattle_Move
  3179. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3180. blacklist=[
  3181. 0x69, # Transform
  3182. 0x71, # Counter
  3183. 0x72, # Mirror Coat
  3184. 0x73, # Metal Burst
  3185. 0x9C, # Helping Hand
  3186. 0xAA, # Detect, Protect
  3187. 0xAD, # Feint
  3188. 0xB2, # Snatch
  3189. 0xE7, # Destiny Bond
  3190. 0xE8, # Endure
  3191. 0xF1, # Covet, Thief
  3192. 0xF2, # Switcheroo, Trick
  3193. 0x115, # Focus Punch
  3194. 0x117 # Follow Me, Rage Powder
  3195. ]
  3196. if USENEWBATTLEMECHANICS
  3197. blacklist+=[
  3198. 0xEB, # Roar, Whirlwind
  3199. 0xC3, # Razor Wind
  3200. 0xC4, # SolarBeam
  3201. 0xC7, # Sky Attack
  3202. 0xC8, # Skull Bash
  3203. 0xC9, # Fly
  3204. 0xCA, # Dig
  3205. 0xCB, # Dive
  3206. 0xCC, # Bounce
  3207. 0xCD, # Shadow Force
  3208. 0x14E # Geomancy
  3209. ]
  3210. end
  3211. if @battle.lastMoveUsed<=0 ||
  3212. blacklist.include?(PBMoveData.new(@battle.lastMoveUsed).function)
  3213. @battle.pbDisplay(_INTL("But it failed!"))
  3214. return -1
  3215. end
  3216. attacker.pbUseMoveSimple(@battle.lastMoveUsed,-1,@battle.lastMoveUser)
  3217. return 0
  3218. end
  3219. end
  3220. ################################################################################
  3221. # Uses the move the target was about to use this round, with 1.5x power. (Me First)
  3222. ################################################################################
  3223. class PokeBattle_Move_0B0 < PokeBattle_Move
  3224. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3225. blacklist=[
  3226. 0x02, # Struggle
  3227. 0x14, # Chatter
  3228. 0x71, # Counter
  3229. 0x72, # Mirror Coat
  3230. 0x73, # Metal Burst
  3231. 0xB0, # Me First
  3232. 0xF1, # Covet, Thief
  3233. 0x11 , # Focus Punch
  3234. ]
  3235. oppmove=@battle.choices[opponent.index][2]
  3236. if @battle.choices[opponent.index][0]!=1 || # Didn't choose a move
  3237. opponent.hasMovedThisRound? ||
  3238. !oppmove || oppmove.id<=0 ||
  3239. oppmove.pbIsStatus? ||
  3240. blacklist.include?(oppmove.function)
  3241. @battle.pbDisplay(_INTL("But it failed!"))
  3242. return -1
  3243. end
  3244. attacker.effects[PBEffects::MeFirst]=true
  3245. attacker.pbUseMoveSimple(oppmove.id,-1,-1)
  3246. attacker.effects[PBEffects::MeFirst]=false
  3247. return 0
  3248. end
  3249. end
  3250. ################################################################################
  3251. # This round, reflects all moves with the "C" flag targeting the user back at
  3252. # their origin. (Magic Coat)
  3253. ################################################################################
  3254. class PokeBattle_Move_0B1 < PokeBattle_Move
  3255. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3256. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  3257. attacker.effects[PBEffects::MagicCoat]=true
  3258. @battle.pbDisplay(_INTL("{1} shrouded itself with Magic Coat!",attacker.pbThis))
  3259. return 0
  3260. end
  3261. end
  3262. ################################################################################
  3263. # This round, snatches all used moves with the "D" flag. (Snatch)
  3264. ################################################################################
  3265. class PokeBattle_Move_0B2 < PokeBattle_Move
  3266. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3267. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  3268. attacker.effects[PBEffects::Snatch]=true
  3269. @battle.pbDisplay(_INTL("{1} waits for a target to make a move!",attacker.pbThis))
  3270. return 0
  3271. end
  3272. end
  3273. ################################################################################
  3274. # Uses a different move depending on the environment. (Nature Power)
  3275. ################################################################################
  3276. class PokeBattle_Move_0B3 < PokeBattle_Move
  3277. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3278. move=getConst(PBMoves,:TRIATTACK) || 0
  3279. case @battle.environment
  3280. when PBEnvironment::Grass, PBEnvironment::TallGrass, PBEnvironment::Forest
  3281. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:ENERGYBALL) : getConst(PBMoves,:SEEDBOMB)) || move
  3282. when PBEnvironment::MovingWater; move=getConst(PBMoves,:HYDROPUMP) || move
  3283. when PBEnvironment::StillWater; move=getConst(PBMoves,:MUDBOMB) || move
  3284. when PBEnvironment::Underwater; move=getConst(PBMoves,:HYDROPUMP) || move
  3285. when PBEnvironment::Cave
  3286. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:POWERGEM) : getConst(PBMoves,:ROCKSLIDE)) || move
  3287. when PBEnvironment::Rock
  3288. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:ROCKSLIDE)) || move
  3289. when PBEnvironment::Sand
  3290. move=((USENEWBATTLEMECHANICS) ? getConst(PBMoves,:EARTHPOWER) : getConst(PBMoves,:EARTHQUAKE)) || move
  3291. when PBEnvironment::Snow; move=getConst(PBMoves,:ICEBEAM) || move
  3292. when PBEnvironment::Volcano; move=getConst(PBMoves,:LAVAPLUME) || move
  3293. when PBEnvironment::Graveyard; move=getConst(PBMoves,:SHADOWBALL) || move
  3294. when PBEnvironment::Sky; move=getConst(PBMoves,:AIRSLASH) || move
  3295. when PBEnvironment::Space; move=getConst(PBMoves,:DRACOMETEOR) || move
  3296. end
  3297. if @battle.field.effects[PBEffects::MistyTerrain]>0
  3298. move=getConst(PBMoves,:MOONBLAST) || move
  3299. end
  3300. if move==0
  3301. @battle.pbDisplay(_INTL("But it failed!"))
  3302. return -1
  3303. end
  3304. thismovename=PBMoves.getName(@id)
  3305. movename=PBMoves.getName(move)
  3306. @battle.pbDisplay(_INTL("{1} turned into {2}!",thismovename,movename))
  3307. target=(USENEWBATTLEMECHANICS && opponent) ? opponent.index : -1
  3308. attacker.pbUseMoveSimple(move,-1,target)
  3309. return 0
  3310. end
  3311. end
  3312. ################################################################################
  3313. # Uses a random move the user knows. Fails if user is not asleep. (Sleep Talk)
  3314. ################################################################################
  3315. class PokeBattle_Move_0B4 < PokeBattle_Move
  3316. def pbCanUseWhileAsleep?
  3317. return true
  3318. end
  3319.  
  3320. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3321. if attacker.status!=PBStatuses::SLEEP
  3322. @battle.pbDisplay(_INTL("But it failed!"))
  3323. return -1
  3324. end
  3325. blacklist=[
  3326. 0x02, # Struggle
  3327. 0x14, # Chatter
  3328. 0x5C, # Mimic
  3329. 0x5D, # Sketch
  3330. 0xAE, # Mirror Move
  3331. 0xAF, # Copycat
  3332. 0xB0, # Me First
  3333. 0xB3, # Nature Power
  3334. 0xB4, # Sleep Talk
  3335. 0xB5, # Assist
  3336. 0xB6, # Metronome
  3337. 0xD1, # Uproar
  3338. 0xD4, # Bide
  3339. 0x115, # Focus Punch
  3340. 0xC3, # Razor Wind
  3341. 0xC4, # SolarBeam
  3342. 0xC7, # Sky Attack
  3343. 0xC8, # Skull Bash
  3344. 0xC9, # Fly
  3345. 0xCA, # Dig
  3346. 0xCB, # Dive
  3347. 0xCC, # Bounce
  3348. 0xCD, # Shadow Force
  3349. 0x14E # Geomancy
  3350. ]
  3351. choices=[]
  3352. for i in 0...4
  3353. found=false
  3354. next if attacker.moves[i].id==0
  3355. found=true if blacklist.include?(attacker.moves[i].function)
  3356. next if found
  3357. choices.push(i) if @battle.pbCanChooseMove?(attacker.index,i,false,true)
  3358. end
  3359. if choices.length==0
  3360. @battle.pbDisplay(_INTL("But it failed!"))
  3361. return -1
  3362. end
  3363. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  3364. choice=choices[@battle.pbRandom(choices.length)]
  3365. attacker.pbUseMoveSimple(attacker.moves[choice].id,choice,attacker.pbOppositeOpposing.index)
  3366. return 0
  3367. end
  3368. end
  3369. ################################################################################
  3370. # Uses a random move known by any non-user Pokémon in the user's party. (Assist)
  3371. ################################################################################
  3372. class PokeBattle_Move_0B5 < PokeBattle_Move
  3373. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3374. blacklist=[
  3375. 0x02, # Struggle
  3376. 0x14, # Chatter
  3377. 0x5C, # Mimic
  3378. 0x5D, # Sketch
  3379. 0x69, # Transform
  3380. 0x71, # Counter
  3381. 0x72, # Mirror Coat
  3382. 0x73, # Metal Burst
  3383. 0x9C, # Helping Hand
  3384. 0xAA, # Detect, Protect
  3385. 0xAD, # Feint
  3386. 0xAE, # Mirror Move
  3387. 0xAF, # Copycat
  3388. 0xB0, # Me First
  3389. 0xB2, # Snatch
  3390. 0xB3, # Nature Power
  3391. 0xB4, # Sleep Talk
  3392. 0xB5, # Assist
  3393. 0xB6, # Metronome
  3394. 0xCD, # Shadow Force
  3395. 0xE7, # Destiny Bond
  3396. 0xE8, # Endure
  3397. 0xEB, # Roar, Whirlwind
  3398. 0xF1, # Covet, Thief
  3399. 0xF2, # Switcheroo, Trick
  3400. 0x115, # Focus Punch
  3401. 0x117 # Follow Me, Rage Powder
  3402. ]
  3403. if USENEWBATTLEMECHANICS
  3404. blacklist+=[
  3405. # Two-turn attacks
  3406. 0xC3, # Razor Wind
  3407. 0xC4, # SolarBeam
  3408. 0xC7, # Sky Attack
  3409. 0xC8, # Skull Bash
  3410. 0xC9, # Fly
  3411. 0xCA, # Dig
  3412. 0xCB, # Dive
  3413. 0xCC, # Bounce
  3414. 0xCD, # Shadow Force
  3415. 0x14E # Geomancy
  3416. ]
  3417. end
  3418. moves=[]
  3419. party=@battle.pbParty(attacker.index) # NOTE: pbParty is common to both allies in multi battles
  3420. for i in 0...party.length
  3421. if i!=attacker.pokemonIndex && party[i] && !(USENEWBATTLEMECHANICS && party[i].isEgg?)
  3422. for j in party[i].moves
  3423. next if j.id==0
  3424. found=false
  3425. moves.push(j.id) if !blacklist.include?(PBMoveData.new(j.id).function)
  3426. end
  3427. end
  3428. end
  3429. if moves.length==0
  3430. @battle.pbDisplay(_INTL("But it failed!"))
  3431. return -1
  3432. end
  3433. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  3434. move=moves[@battle.pbRandom(moves.length)]
  3435. attacker.pbUseMoveSimple(move)
  3436. return 0
  3437. end
  3438. end
  3439. ################################################################################
  3440. # Uses a random move that exists. (Metronome)
  3441. ################################################################################
  3442. class PokeBattle_Move_0B6 < PokeBattle_Move
  3443. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3444. blacklist=[
  3445. 0x02, # Struggle
  3446. 0x11, # Snore
  3447. 0x14, # Chatter
  3448. 0x5C, # Mimic
  3449. 0x5D, # Sketch
  3450. 0x69, # Transform
  3451. 0x71, # Counter
  3452. 0x72, # Mirror Coat
  3453. 0x73, # Metal Burst
  3454. 0x9C, # Helping Hand
  3455. 0xAA, # Detect, Protect
  3456. 0xAD, # Feint
  3457. 0xAE, # Mirror Move
  3458. 0xAF, # Copycat
  3459. 0xB0, # Me First
  3460. 0xB2, # Snatch
  3461. 0xB3, # Nature Power
  3462. 0xB4, # Sleep Talk
  3463. 0xB5, # Assist
  3464. 0xB6, # Metronome
  3465. 0xE7, # Destiny Bond
  3466. 0xE8, # Endure
  3467. 0xF1, # Covet, Thief
  3468. 0xF2, # Switcheroo, Trick
  3469. 0x115, # Focus Punch
  3470. 0x117 # Follow Me, Rage Powder
  3471. ]
  3472. blacklistmoves=[
  3473. :GEOMANCY
  3474. ]
  3475. i=0; loop do break unless i<1000
  3476. move=@battle.pbRandom(PBMoves.maxValue)+1
  3477. next if isConst?(PBMoveData.new(move).type,PBTypes,:SHADOW)
  3478. found=false
  3479. if blacklist.include?(PBMoveData.new(move).function)
  3480. found=true
  3481. else
  3482. for j in blacklistmoves
  3483. if isConst?(move,PBMoves,j)
  3484. found=true
  3485. break
  3486. end
  3487. end
  3488. end
  3489. if !found
  3490. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  3491. attacker.pbUseMoveSimple(move)
  3492. return 0
  3493. end
  3494. i+=1
  3495. end
  3496. @battle.pbDisplay(_INTL("But it failed!"))
  3497. return -1
  3498. end
  3499. end
  3500. ################################################################################
  3501. # The target can no longer use the same move twice in a row. (Torment)
  3502. ################################################################################
  3503. class PokeBattle_Move_0B7 < PokeBattle_Move
  3504. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3505. if opponent.effects[PBEffects::Torment]
  3506. @battle.pbDisplay(_INTL("But it failed!"))
  3507. return -1
  3508. end
  3509. if !attacker.hasMoldBreaker
  3510. if opponent.hasWorkingAbility(:AROMAVEIL)
  3511. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3512. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3513. return -1
  3514. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  3515. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3516. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  3517. return -1
  3518. end
  3519. end
  3520. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3521. opponent.effects[PBEffects::Torment]=true
  3522. @battle.pbDisplay(_INTL("{1} was subjected to torment!",opponent.pbThis))
  3523. return 0
  3524. end
  3525. end
  3526. ################################################################################
  3527. # Disables all target's moves that the user also knows. (Imprison)
  3528. ################################################################################
  3529. class PokeBattle_Move_0B8 < PokeBattle_Move
  3530. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3531. if attacker.effects[PBEffects::Imprison]
  3532. @battle.pbDisplay(_INTL("But it failed!"))
  3533. return -1
  3534. end
  3535. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3536. attacker.effects[PBEffects::Imprison]=true
  3537. @battle.pbDisplay(_INTL("{1} sealed the opponent's move(s)!",attacker.pbThis))
  3538. return 0
  3539. end
  3540. end
  3541. ################################################################################
  3542. # For 5 rounds, disables the last move the target used. (Disable)
  3543. ################################################################################
  3544. class PokeBattle_Move_0B9 < PokeBattle_Move
  3545. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3546. if opponent.effects[PBEffects::Disable]>0
  3547. @battle.pbDisplay(_INTL("But it failed!"))
  3548. return -1
  3549. end
  3550. if !attacker.hasMoldBreaker
  3551. if opponent.hasWorkingAbility(:AROMAVEIL)
  3552. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3553. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3554. return -1
  3555. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  3556. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3557. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  3558. return -1
  3559. end
  3560. end
  3561. for i in opponent.moves
  3562. if i.id>0 && i.id==opponent.lastMoveUsed && (i.pp>0 || i.totalpp==0)
  3563. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3564. opponent.effects[PBEffects::Disable]=5
  3565. opponent.effects[PBEffects::DisableMove]=opponent.lastMoveUsed
  3566. @battle.pbDisplay(_INTL("{1}'s {2} was disabled!",opponent.pbThis,i.name))
  3567. return 0
  3568. end
  3569. end
  3570. @battle.pbDisplay(_INTL("But it failed!"))
  3571. return -1
  3572. end
  3573. end
  3574. ################################################################################
  3575. # For 4 rounds, disables the target's non-damaging moves. (Taunt)
  3576. ################################################################################
  3577. class PokeBattle_Move_0BA < PokeBattle_Move
  3578. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3579. if opponent.effects[PBEffects::Taunt]>0 ||
  3580. (USENEWBATTLEMECHANICS &&
  3581. !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:OBLIVIOUS))
  3582. @battle.pbDisplay(_INTL("But it failed!"))
  3583. return -1
  3584. end
  3585. if !attacker.hasMoldBreaker
  3586. if opponent.hasWorkingAbility(:AROMAVEIL)
  3587. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3588. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3589. return -1
  3590. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  3591. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3592. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  3593. return -1
  3594. end
  3595. end
  3596. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3597. opponent.effects[PBEffects::Taunt]=4
  3598. @battle.pbDisplay(_INTL("{1} fell for the taunt!",opponent.pbThis))
  3599. return 0
  3600. end
  3601. end
  3602. ################################################################################
  3603. # For 5 rounds, disables the target's healing moves. (Heal Block)
  3604. ################################################################################
  3605. class PokeBattle_Move_0BB < PokeBattle_Move
  3606. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3607. if opponent.effects[PBEffects::HealBlock]>0
  3608. @battle.pbDisplay(_INTL("But it failed!"))
  3609. return -1
  3610. end
  3611. if !attacker.hasMoldBreaker
  3612. if opponent.hasWorkingAbility(:AROMAVEIL)
  3613. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3614. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3615. return -1
  3616. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  3617. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3618. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  3619. return -1
  3620. end
  3621. end
  3622. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3623. opponent.effects[PBEffects::HealBlock]=5
  3624. @battle.pbDisplay(_INTL("{1} was prevented from healing!",opponent.pbThis))
  3625. return 0
  3626. end
  3627. end
  3628. ################################################################################
  3629. # For 4 rounds, the target must use the same move each round. (Encore)
  3630. ################################################################################
  3631. class PokeBattle_Move_0BC < PokeBattle_Move
  3632. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3633. blacklist=[
  3634. 0x02, # Struggle
  3635. 0x5C, # Mimic
  3636. 0x5D, # Sketch
  3637. 0x69, # Transform
  3638. 0xAE, # Mirror Move
  3639. 0xBC # Encore
  3640. ]
  3641. if opponent.effects[PBEffects::Encore]>0
  3642. @battle.pbDisplay(_INTL("But it failed!"))
  3643. return -1
  3644. end
  3645. if opponent.lastMoveUsed<=0 ||
  3646. blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function)
  3647. @battle.pbDisplay(_INTL("But it failed!"))
  3648. return -1
  3649. end
  3650. if !attacker.hasMoldBreaker
  3651. if opponent.hasWorkingAbility(:AROMAVEIL)
  3652. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3653. opponent.pbThis,PBAbilities.getName(opponent.ability)))
  3654. return -1
  3655. elsif opponent.pbPartner.hasWorkingAbility(:AROMAVEIL)
  3656. @battle.pbDisplay(_INTL("But it failed because of {1}'s {2}!",
  3657. opponent.pbPartner.pbThis,PBAbilities.getName(opponent.pbPartner.ability)))
  3658. return -1
  3659. end
  3660. end
  3661. for i in 0...4
  3662. if opponent.lastMoveUsed==opponent.moves[i].id &&
  3663. (opponent.moves[i].pp>0 || opponent.moves[i].totalpp==0)
  3664. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  3665. opponent.effects[PBEffects::Encore]=4
  3666. opponent.effects[PBEffects::EncoreIndex]=i
  3667. opponent.effects[PBEffects::EncoreMove]=opponent.moves[i].id
  3668. @battle.pbDisplay(_INTL("{1} received an encore!",opponent.pbThis))
  3669. return 0
  3670. end
  3671. end
  3672. @battle.pbDisplay(_INTL("But it failed!"))
  3673. return -1
  3674. end
  3675. end
  3676. ################################################################################
  3677. # Hits twice.
  3678. ################################################################################
  3679. class PokeBattle_Move_0BD < PokeBattle_Move
  3680. def pbIsMultiHit
  3681. return true
  3682. end
  3683.  
  3684. def pbNumHits(attacker)
  3685. return 2
  3686. end
  3687. end
  3688. ################################################################################
  3689. # Hits twice. May poison the target on each hit. (Twineedle)
  3690. ################################################################################
  3691. class PokeBattle_Move_0BE < PokeBattle_Move
  3692. def pbIsMultiHit
  3693. return true
  3694. end
  3695.  
  3696. def pbNumHits(attacker)
  3697. return 2
  3698. end
  3699.  
  3700. def pbAdditionalEffect(attacker,opponent)
  3701. return if opponent.damagestate.substitute
  3702. if opponent.pbCanPoison?(attacker,false,self)
  3703. opponent.pbPoison(attacker)
  3704. end
  3705. end
  3706. end
  3707. ################################################################################
  3708. # Hits 3 times. Power is multiplied by the hit number. (Triple Kick)
  3709. # An accuracy check is performed for each hit.
  3710. ################################################################################
  3711. class PokeBattle_Move_0BF < PokeBattle_Move
  3712. def pbIsMultiHit
  3713. return true
  3714. end
  3715.  
  3716. def pbNumHits(attacker)
  3717. return 3
  3718. end
  3719.  
  3720. def successCheckPerHit?
  3721. return @checks
  3722. end
  3723.  
  3724. def pbOnStartUse(attacker)
  3725. @calcbasedmg=@basedamage
  3726. @checks=!attacker.hasWorkingAbility(:SKILLLINK)
  3727. return true
  3728. end
  3729.  
  3730. def pbBaseDamage(basedmg,attacker,opponent)
  3731. ret=@calcbasedmg
  3732. @calcbasedmg+=basedmg
  3733. return ret
  3734. end
  3735. end
  3736. ################################################################################
  3737. # Hits 2-5 times.
  3738. ################################################################################
  3739. class PokeBattle_Move_0C0 < PokeBattle_Move
  3740. def pbIsMultiHit
  3741. return true
  3742. end
  3743.  
  3744. def pbNumHits(attacker)
  3745. hitchances=[2,2,3,3,4,5]
  3746. ret=hitchances[@battle.pbRandom(hitchances.length)]
  3747. ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
  3748. return ret
  3749. end
  3750. end
  3751. ################################################################################
  3752. # Hits X times, where X is 1 (the user) plus the number of non-user unfainted
  3753. # status-free Pokémon in the user's party (the participants). Fails if X is 0.
  3754. # Base power of each hit depends on the base Attack stat for the species of that
  3755. # hit's participant. (Beat Up)
  3756. ################################################################################
  3757. class PokeBattle_Move_0C1 < PokeBattle_Move
  3758. def pbIsMultiHit
  3759. return true
  3760. end
  3761.  
  3762. def pbNumHits(attacker)
  3763. return @participants.length
  3764. end
  3765.  
  3766. def pbOnStartUse(attacker)
  3767. party=@battle.pbParty(attacker.index)
  3768. @participants=[]
  3769. for i in 0...party.length
  3770. if attacker.pokemonIndex==i
  3771. @participants.push(i)
  3772. elsif party[i] && !party[i].isEgg? && party[i].hp>0 && party[i].status==0
  3773. @participants.push(i)
  3774. end
  3775. end
  3776. if @participants.length==0
  3777. @battle.pbDisplay(_INTL("But it failed!"))
  3778. return false
  3779. end
  3780. return true
  3781. end
  3782.  
  3783. def pbBaseDamage(basedmg,attacker,opponent)
  3784. party=@battle.pbParty(attacker.index)
  3785. atk=party[@participants[0]].baseStats[1]
  3786. @participants[0]=nil; @participants.compact!
  3787. return 5+(atk/10)
  3788. end
  3789. end
  3790. ################################################################################
  3791. # Two turn attack. Attacks first turn, skips second turn (if successful).
  3792. ################################################################################
  3793. class PokeBattle_Move_0C2 < PokeBattle_Move
  3794. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3795. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  3796. if opponent.damagestate.calcdamage>0
  3797. attacker.effects[PBEffects::HyperBeam]=2
  3798. attacker.currentMove=@id
  3799. end
  3800. return ret
  3801. end
  3802. end
  3803. ################################################################################
  3804. # Two turn attack. Skips first turn, attacks second turn. (Razor Wind)
  3805. ################################################################################
  3806. class PokeBattle_Move_0C3 < PokeBattle_Move
  3807. def pbTwoTurnAttack(attacker)
  3808. @immediate=false
  3809. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  3810. @immediate=true
  3811. end
  3812. return false if @immediate
  3813. return attacker.effects[PBEffects::TwoTurnAttack]==0
  3814. end
  3815.  
  3816. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3817. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  3818. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  3819. @battle.pbDisplay(_INTL("{1} whipped up a whirlwind!",attacker.pbThis))
  3820. end
  3821. if @immediate
  3822. @battle.pbCommonAnimation("UseItem",attacker,nil)
  3823. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  3824. attacker.pbConsumeItem
  3825. end
  3826. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  3827. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3828. end
  3829. end
  3830. ################################################################################
  3831. # Two turn attack. Skips first turn, attacks second turn. (SolarBeam)
  3832. # Power halved in all weather except sunshine. In sunshine, takes 1 turn instead.
  3833. ################################################################################
  3834. class PokeBattle_Move_0C4 < PokeBattle_Move
  3835. def pbTwoTurnAttack(attacker)
  3836. @immediate=false; @sunny=false
  3837. if attacker.effects[PBEffects::TwoTurnAttack]==0
  3838. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  3839. @battle.pbWeather==PBWeather::HARSHSUN
  3840. @immediate=true; @sunny=true
  3841. end
  3842. end
  3843. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  3844. @immediate=true
  3845. end
  3846. return false if @immediate
  3847. return attacker.effects[PBEffects::TwoTurnAttack]==0
  3848. end
  3849.  
  3850. def pbBaseDamageMultiplier(damagemult,attacker,opponent)
  3851. if @battle.pbWeather!=0 &&
  3852. @battle.pbWeather!=PBWeather::SUNNYDAY &&
  3853. @battle.pbWeather!=PBWeather::HARSHSUN
  3854. return (damagemult*0.5).round
  3855. end
  3856. return damagemult
  3857. end
  3858.  
  3859. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3860. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  3861. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  3862. @battle.pbDisplay(_INTL("{1} took in sunlight!",attacker.pbThis))
  3863. end
  3864. if @immediate && !@sunny
  3865. @battle.pbCommonAnimation("UseItem",attacker,nil)
  3866. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  3867. attacker.pbConsumeItem
  3868. end
  3869. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  3870. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3871. end
  3872. end
  3873. ################################################################################
  3874. # Two turn attack. Skips first turn, attacks second turn. (Sky Attack)
  3875. # May make the target flinch.
  3876. ################################################################################
  3877. class PokeBattle_Move_0C7 < PokeBattle_Move
  3878. def pbTwoTurnAttack(attacker)
  3879. @immediate=false
  3880. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  3881. @immediate=true
  3882. end
  3883. return false if @immediate
  3884. return attacker.effects[PBEffects::TwoTurnAttack]==0
  3885. end
  3886.  
  3887. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3888. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  3889. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  3890. @battle.pbDisplay(_INTL("{1} became cloaked in a harsh light!",attacker.pbThis))
  3891. end
  3892. if @immediate
  3893. @battle.pbCommonAnimation("UseItem",attacker,nil)
  3894. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  3895. attacker.pbConsumeItem
  3896. end
  3897. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  3898. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3899. end
  3900.  
  3901. def pbAdditionalEffect(attacker,opponent)
  3902. return if opponent.damagestate.substitute
  3903. opponent.pbFlinch(attacker)
  3904. end
  3905. end
  3906. ################################################################################
  3907. # Two turn attack. Ups user's Defense by 1 stage first turn, attacks second turn.
  3908. # (Skull Bash)
  3909. ################################################################################
  3910. class PokeBattle_Move_0C8 < PokeBattle_Move
  3911. def pbTwoTurnAttack(attacker)
  3912. @immediate=false
  3913. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  3914. @immediate=true
  3915. end
  3916. return false if @immediate
  3917. return attacker.effects[PBEffects::TwoTurnAttack]==0
  3918. end
  3919.  
  3920. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3921. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  3922. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  3923. @battle.pbDisplay(_INTL("{1} tucked in its head!",attacker.pbThis))
  3924. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  3925. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self)
  3926. end
  3927. end
  3928. if @immediate
  3929. @battle.pbCommonAnimation("UseItem",attacker,nil)
  3930. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  3931. attacker.pbConsumeItem
  3932. end
  3933. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  3934. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3935. end
  3936. end
  3937. ################################################################################
  3938. # Two turn attack. Skips first turn, attacks second turn. (Fly)
  3939. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  3940. ################################################################################
  3941. class PokeBattle_Move_0C9 < PokeBattle_Move
  3942. def unusableInGravity?
  3943. return true
  3944. end
  3945.  
  3946. def pbTwoTurnAttack(attacker)
  3947. @immediate=false
  3948. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  3949. @immediate=true
  3950. end
  3951. return false if @immediate
  3952. return attacker.effects[PBEffects::TwoTurnAttack]==0
  3953. end
  3954.  
  3955. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3956. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  3957. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  3958. @battle.pbDisplay(_INTL("{1} flew up high!",attacker.pbThis))
  3959. end
  3960. if @immediate
  3961. @battle.pbCommonAnimation("UseItem",attacker,nil)
  3962. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  3963. attacker.pbConsumeItem
  3964. end
  3965. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  3966. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3967. end
  3968. end
  3969. ################################################################################
  3970. # Two turn attack. Skips first turn, attacks second turn. (Dig)
  3971. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  3972. ################################################################################
  3973. class PokeBattle_Move_0CA < PokeBattle_Move
  3974. def pbTwoTurnAttack(attacker)
  3975. @immediate=false
  3976. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  3977. @immediate=true
  3978. end
  3979. return false if @immediate
  3980. return attacker.effects[PBEffects::TwoTurnAttack]==0
  3981. end
  3982.  
  3983. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  3984. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  3985. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  3986. @battle.pbDisplay(_INTL("{1} burrowed its way under the ground!",attacker.pbThis))
  3987. end
  3988. if @immediate
  3989. @battle.pbCommonAnimation("UseItem",attacker,nil)
  3990. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  3991. attacker.pbConsumeItem
  3992. end
  3993. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  3994. return super(attacker,opponent,hitnum,alltargets,showanimation)
  3995. end
  3996. end
  3997. ################################################################################
  3998. # Two turn attack. Skips first turn, attacks second turn. (Dive)
  3999. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  4000. ################################################################################
  4001. class PokeBattle_Move_0CB < PokeBattle_Move
  4002. def pbTwoTurnAttack(attacker)
  4003. @immediate=false
  4004. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4005. @immediate=true
  4006. end
  4007. return false if @immediate
  4008. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4009. end
  4010.  
  4011. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4012. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4013. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4014. @battle.pbDisplay(_INTL("{1} hid underwater!",attacker.pbThis))
  4015. end
  4016. if @immediate
  4017. @battle.pbCommonAnimation("UseItem",attacker,nil)
  4018. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  4019. attacker.pbConsumeItem
  4020. end
  4021. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4022. return super(attacker,opponent,hitnum,alltargets,showanimation)
  4023. end
  4024. end
  4025. ################################################################################
  4026. # Two turn attack. Skips first turn, attacks second turn. (Bounce)
  4027. # May paralyze the target.
  4028. # (Handled in Battler's pbSuccessCheck): Is semi-invulnerable during use.
  4029. ################################################################################
  4030. class PokeBattle_Move_0CC < PokeBattle_Move
  4031. def unusableInGravity?
  4032. return true
  4033. end
  4034.  
  4035. def pbTwoTurnAttack(attacker)
  4036. @immediate=false
  4037. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4038. @immediate=true
  4039. end
  4040. return false if @immediate
  4041. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4042. end
  4043.  
  4044. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4045. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4046. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4047. @battle.pbDisplay(_INTL("{1} sprang up!",attacker.pbThis))
  4048. end
  4049. if @immediate
  4050. @battle.pbCommonAnimation("UseItem",attacker,nil)
  4051. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  4052. attacker.pbConsumeItem
  4053. end
  4054. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4055. return super(attacker,opponent,hitnum,alltargets,showanimation)
  4056. end
  4057.  
  4058. def pbAdditionalEffect(attacker,opponent)
  4059. return if opponent.damagestate.substitute
  4060. if opponent.pbCanParalyze?(attacker,false,self)
  4061. opponent.pbParalyze(attacker)
  4062. end
  4063. end
  4064. end
  4065. ################################################################################
  4066. # Two turn attack. Skips first turn, attacks second turn. (Shadow Force)
  4067. # Is invulnerable during use.
  4068. # Ignores target's Detect and Protect this round. If successful, negates them this round.
  4069. ################################################################################
  4070. class PokeBattle_Move_0CD < PokeBattle_Move
  4071. def pbTwoTurnAttack(attacker)
  4072. @immediate=false
  4073. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  4074. @immediate=true
  4075. end
  4076. return false if @immediate
  4077. return attacker.effects[PBEffects::TwoTurnAttack]==0
  4078. end
  4079.  
  4080. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4081. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  4082. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  4083. @battle.pbDisplay(_INTL("{1} vanished instantly!",attacker.pbThis))
  4084. end
  4085. if @immediate
  4086. @battle.pbCommonAnimation("UseItem",attacker,nil)
  4087. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  4088. attacker.pbConsumeItem
  4089. end
  4090. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  4091. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4092. if ret>0
  4093. opponent.effects[PBEffects::ProtectNegation]=true
  4094. opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
  4095. end
  4096. return ret
  4097. end
  4098. end
  4099. ################################################################################
  4100. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  4101. # at end of each round.
  4102. ################################################################################
  4103. class PokeBattle_Move_0CF < PokeBattle_Move
  4104. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4105. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4106. if opponent.damagestate.calcdamage>0 && !opponent.isFainted? &&
  4107. !opponent.damagestate.substitute
  4108. if opponent.effects[PBEffects::MultiTurn]==0
  4109. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  4110. if attacker.hasWorkingItem(:GRIPCLAW)
  4111. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  4112. end
  4113. opponent.effects[PBEffects::MultiTurnAttack]=@id
  4114. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  4115. if isConst?(@id,PBMoves,:BIND)
  4116. @battle.pbDisplay(_INTL("{1} was squeezed by {2}!",opponent.pbThis,attacker.pbThis(true)))
  4117. elsif isConst?(@id,PBMoves,:CLAMP)
  4118. @battle.pbDisplay(_INTL("{1} clamped {2}!",attacker.pbThis,opponent.pbThis(true)))
  4119. elsif isConst?(@id,PBMoves,:FIRESPIN)
  4120. @battle.pbDisplay(_INTL("{1} was trapped in the fiery vortex!",opponent.pbThis))
  4121. elsif isConst?(@id,PBMoves,:MAGMASTORM)
  4122. @battle.pbDisplay(_INTL("{1} became trapped by Magma Storm!",opponent.pbThis))
  4123. elsif isConst?(@id,PBMoves,:SANDTOMB)
  4124. @battle.pbDisplay(_INTL("{1} became trapped by Sand Tomb!",opponent.pbThis))
  4125. elsif isConst?(@id,PBMoves,:WRAP)
  4126. @battle.pbDisplay(_INTL("{1} was wrapped by {2}!",opponent.pbThis,attacker.pbThis(true)))
  4127. else
  4128. @battle.pbDisplay(_INTL("{1} was trapped in the vortex!",opponent.pbThis))
  4129. end
  4130. end
  4131. end
  4132. return ret
  4133. end
  4134. end
  4135. ################################################################################
  4136. # Trapping move. Traps for 5 or 6 rounds. Trapped Pokémon lose 1/16 of max HP
  4137. # at end of each round. (Whirlpool)
  4138. # Power is doubled if target is using Dive.
  4139. # (Handled in Battler's pbSuccessCheck): Hits some semi-invulnerable targets.
  4140. ################################################################################
  4141. class PokeBattle_Move_0D0 < PokeBattle_Move
  4142. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4143. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4144. if opponent.damagestate.calcdamage>0 && !opponent.isFainted? &&
  4145. !opponent.damagestate.substitute
  4146. if opponent.effects[PBEffects::MultiTurn]==0
  4147. opponent.effects[PBEffects::MultiTurn]=5+@battle.pbRandom(2)
  4148. if attacker.hasWorkingItem(:GRIPCLAW)
  4149. opponent.effects[PBEffects::MultiTurn]=(USENEWBATTLEMECHANICS) ? 8 : 6
  4150. end
  4151. opponent.effects[PBEffects::MultiTurnAttack]=@id
  4152. opponent.effects[PBEffects::MultiTurnUser]=attacker.index
  4153. @battle.pbDisplay(_INTL("{1} became trapped in the vortex!",opponent.pbThis))
  4154. end
  4155. end
  4156. return ret
  4157. end
  4158.  
  4159. def pbModifyDamage(damagemult,attacker,opponent)
  4160. if PBMoveData.new(opponent.effects[PBEffects::TwoTurnAttack]).function==0xCB # Dive
  4161. return (damagemult*2.0).round
  4162. end
  4163. return damagemult
  4164. end
  4165. end
  4166. ################################################################################
  4167. # User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
  4168. ################################################################################
  4169. class PokeBattle_Move_0D1 < PokeBattle_Move
  4170. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4171. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4172. if opponent.damagestate.calcdamage>0
  4173. if attacker.effects[PBEffects::Uproar]==0
  4174. attacker.effects[PBEffects::Uproar]=3
  4175. @battle.pbDisplay(_INTL("{1} caused an uproar!",attacker.pbThis))
  4176. attacker.currentMove=@id
  4177. end
  4178. end
  4179. return ret
  4180. end
  4181. end
  4182. ################################################################################
  4183. # User must use this move for 1 or 2 more rounds. At end, user becomes confused.
  4184. # (Outrage, Petal Dange, Thrash)
  4185. ################################################################################
  4186. class PokeBattle_Move_0D2 < PokeBattle_Move
  4187. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4188. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4189. if opponent.damagestate.calcdamage>0 &&
  4190. attacker.effects[PBEffects::Outrage]==0 &&
  4191. attacker.status!=PBStatuses::SLEEP
  4192. attacker.effects[PBEffects::Outrage]=2+@battle.pbRandom(2)
  4193. attacker.currentMove=@id
  4194. elsif pbTypeModifier(@type,attacker,opponent)==0
  4195. # Cancel effect if attack is ineffective
  4196. attacker.effects[PBEffects::Outrage]=0
  4197. end
  4198. if attacker.effects[PBEffects::Outrage]>0
  4199. attacker.effects[PBEffects::Outrage]-=1
  4200. if attacker.effects[PBEffects::Outrage]==0 && attacker.pbCanConfuseSelf?(false)
  4201. attacker.pbConfuse
  4202. @battle.pbDisplay(_INTL("{1} became confused due to fatigue!",attacker.pbThis))
  4203. end
  4204. end
  4205. return ret
  4206. end
  4207. end
  4208. ################################################################################
  4209. # User must use this move for 4 more rounds. Power doubles each round.
  4210. # Power is also doubled if user has curled up. (Ice Ball, Rollout)
  4211. ################################################################################
  4212. class PokeBattle_Move_0D3 < PokeBattle_Move
  4213. def pbBaseDamage(basedmg,attacker,opponent)
  4214. shift=(4-attacker.effects[PBEffects::Rollout])
  4215. shift+=1 if attacker.effects[PBEffects::DefenseCurl]
  4216. basedmg=basedmg<<shift
  4217. return basedmg
  4218. end
  4219.  
  4220. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4221. attacker.effects[PBEffects::Rollout]=5 if attacker.effects[PBEffects::Rollout]==0
  4222. attacker.effects[PBEffects::Rollout]-=1
  4223. attacker.currentMove=thismove.id
  4224. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4225. if opponent.damagestate.calcdamage==0 ||
  4226. pbTypeModifier(@type,attacker,opponent)==0 ||
  4227. attacker.status==PBStatuses::SLEEP
  4228. attacker.effects[PBEffects::Rollout]=0
  4229. end
  4230. return ret
  4231. end
  4232. end
  4233. ################################################################################
  4234. # User bides its time this round and next round. The round after, deals 2x the
  4235. # total damage it took while biding to the last battler that damaged it. (Bide)
  4236. ################################################################################
  4237. class PokeBattle_Move_0D4 < PokeBattle_Move
  4238. def pbDisplayUseMessage(attacker)
  4239. if attacker.effects[PBEffects::Bide]==0
  4240. @battle.pbDisplayBrief(_INTL("{1} used\r\n{2}!",attacker.pbThis,name))
  4241. attacker.effects[PBEffects::Bide]=2
  4242. attacker.effects[PBEffects::BideDamage]=0
  4243. attacker.effects[PBEffects::BideTarget]=-1
  4244. attacker.currentMove=@id
  4245. pbShowAnimation(@id,attacker,nil)
  4246. return 1
  4247. else
  4248. attacker.effects[PBEffects::Bide]-=1
  4249. if attacker.effects[PBEffects::Bide]==0
  4250. @battle.pbDisplayBrief(_INTL("{1} unleashed energy!",attacker.pbThis))
  4251. return 0
  4252. else
  4253. @battle.pbDisplayBrief(_INTL("{1} is storing energy!",attacker.pbThis))
  4254. return 2
  4255. end
  4256. end
  4257. end
  4258.  
  4259. def pbAddTarget(targets,attacker)
  4260. if attacker.effects[PBEffects::BideTarget]>=0
  4261. if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::BideTarget]])
  4262. attacker.pbRandomTarget(targets)
  4263. end
  4264. else
  4265. attacker.pbRandomTarget(targets)
  4266. end
  4267. end
  4268.  
  4269. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4270. if attacker.effects[PBEffects::BideDamage]==0 || !opponent
  4271. @battle.pbDisplay(_INTL("But it failed!"))
  4272. return -1
  4273. end
  4274. if USENEWBATTLEMECHANICS
  4275. typemod=pbTypeModifier(pbType(@type,attacker,opponent),attacker,opponent)
  4276. if typemod==0
  4277. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  4278. return -1
  4279. end
  4280. end
  4281. ret=pbEffectFixedDamage(attacker.effects[PBEffects::BideDamage]*2,attacker,opponent,hitnum,alltargets,showanimation)
  4282. return ret
  4283. end
  4284. end
  4285. ################################################################################
  4286. # Heals user by 1/2 of its max HP.
  4287. ################################################################################
  4288. class PokeBattle_Move_0D5 < PokeBattle_Move
  4289. def isHealingMove?
  4290. return true
  4291. end
  4292.  
  4293. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4294. if attacker.hp==attacker.totalhp
  4295. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  4296. return -1
  4297. end
  4298. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4299. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  4300. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  4301. return 0
  4302. end
  4303. end
  4304. ################################################################################
  4305. # Heals user by 1/2 of its max HP. (Roost)
  4306. # User roosts, and its Flying type is ignored for attacks used against it.
  4307. ################################################################################
  4308. class PokeBattle_Move_0D6 < PokeBattle_Move
  4309. def isHealingMove?
  4310. return true
  4311. end
  4312.  
  4313. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4314. if attacker.hp==attacker.totalhp
  4315. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  4316. return -1
  4317. end
  4318. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4319. attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
  4320. attacker.effects[PBEffects::Roost]=true
  4321. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  4322. return 0
  4323. end
  4324. end
  4325. ################################################################################
  4326. # Battler in user's position is healed by 1/2 of its max HP, at the end of the
  4327. # next round. (Wish)
  4328. ################################################################################
  4329. class PokeBattle_Move_0D7 < PokeBattle_Move
  4330. def isHealingMove?
  4331. return true
  4332. end
  4333.  
  4334. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4335. if attacker.effects[PBEffects::Wish]>0
  4336. @battle.pbDisplay(_INTL("But it failed!"))
  4337. return -1
  4338. end
  4339. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4340. attacker.effects[PBEffects::Wish]=2
  4341. attacker.effects[PBEffects::WishAmount]=((attacker.totalhp+1)/2).floor
  4342. attacker.effects[PBEffects::WishMaker]=attacker.pokemonIndex
  4343. return 0
  4344. end
  4345. end
  4346. ################################################################################
  4347. # Heals user by an amount depending on the weather. (Moonlight, Morning Sun,
  4348. # Synthesis)
  4349. ################################################################################
  4350. class PokeBattle_Move_0D8 < PokeBattle_Move
  4351. def isHealingMove?
  4352. return true
  4353. end
  4354.  
  4355. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4356. if attacker.hp==attacker.totalhp
  4357. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  4358. return -1
  4359. end
  4360. hpgain=0
  4361. if @battle.pbWeather==PBWeather::SUNNYDAY ||
  4362. @battle.pbWeather==PBWeather::HARSHSUN
  4363. hpgain=(attacker.totalhp*2/3).floor
  4364. elsif @battle.pbWeather!=0
  4365. hpgain=(attacker.totalhp/4).floor
  4366. else
  4367. hpgain=(attacker.totalhp/2).floor
  4368. end
  4369. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4370. attacker.pbRecoverHP(hpgain,true)
  4371. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  4372. return 0
  4373. end
  4374. end
  4375. ################################################################################
  4376. # Heals user to full HP. User falls asleep for 2 more rounds. (Rest)
  4377. ################################################################################
  4378. class PokeBattle_Move_0D9 < PokeBattle_Move
  4379. def isHealingMove?
  4380. return true
  4381. end
  4382.  
  4383. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4384. if !attacker.pbCanSleep?(attacker,true,self,true)
  4385. return -1
  4386. end
  4387. if attacker.status==PBStatuses::SLEEP
  4388. @battle.pbDisplay(_INTL("But it failed!"))
  4389. return -1
  4390. end
  4391. if attacker.hp==attacker.totalhp
  4392. @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
  4393. return -1
  4394. end
  4395. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4396. attacker.pbSleepSelf(3)
  4397. @battle.pbDisplay(_INTL("{1} slept and became healthy!",attacker.pbThis))
  4398. hp=attacker.pbRecoverHP(attacker.totalhp-attacker.hp,true)
  4399. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis)) if hp>0
  4400. return 0
  4401. end
  4402. end
  4403. ################################################################################
  4404. # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round.
  4405. # (Aqua Ring)
  4406. ################################################################################
  4407. class PokeBattle_Move_0DA < PokeBattle_Move
  4408. def isHealingMove?
  4409. return true
  4410. end
  4411.  
  4412. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4413. if attacker.effects[PBEffects::AquaRing]
  4414. @battle.pbDisplay(_INTL("But it failed!"))
  4415. return -1
  4416. end
  4417. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4418. attacker.effects[PBEffects::AquaRing]=true
  4419. @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
  4420. return 0
  4421. end
  4422. end
  4423. ################################################################################
  4424. # Ingrains the user. Ingrained Pokémon gain 1/16 of max HP at the end of each
  4425. # round, and cannot flee or switch out. (Ingrain)
  4426. ################################################################################
  4427. class PokeBattle_Move_0DB < PokeBattle_Move
  4428. def isHealingMove?
  4429. return true
  4430. end
  4431.  
  4432. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4433. if attacker.effects[PBEffects::Ingrain]
  4434. @battle.pbDisplay(_INTL("But it failed!"))
  4435. return -1
  4436. end
  4437. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4438. attacker.effects[PBEffects::Ingrain]=true
  4439. @battle.pbDisplay(_INTL("{1} planted its roots!",attacker.pbThis))
  4440. return 0
  4441. end
  4442. end
  4443. ################################################################################
  4444. # Seeds the target. Seeded Pokémon lose 1/8 of max HP at the end of each round,
  4445. # and the Pokémon in the user's position gains the same amount. (Leech Seed)
  4446. ################################################################################
  4447. class PokeBattle_Move_0DC < PokeBattle_Move
  4448. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4449. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  4450. @battle.pbDisplay(_INTL("But it failed!"))
  4451. return -1
  4452. end
  4453. return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  4454. if opponent.effects[PBEffects::LeechSeed]>=0
  4455. @battle.pbDisplay(_INTL("{1} evaded the attack!",opponent.pbThis))
  4456. return -1
  4457. end
  4458. if opponent.pbHasType?(:GRASS)
  4459. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  4460. return -1
  4461. end
  4462. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4463. opponent.effects[PBEffects::LeechSeed]=attacker.index
  4464. @battle.pbDisplay(_INTL("{1} was seeded!",opponent.pbThis))
  4465. return 0
  4466. end
  4467. end
  4468. ################################################################################
  4469. # User gains half the HP it inflicts as damage.
  4470. ################################################################################
  4471. class PokeBattle_Move_0DD < PokeBattle_Move
  4472. def isHealingMove?
  4473. return USENEWBATTLEMECHANICS
  4474. end
  4475.  
  4476. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4477. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4478. if opponent.damagestate.calcdamage>0
  4479. hpgain=(opponent.damagestate.hplost/2).round
  4480. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  4481. attacker.pbReduceHP(hpgain,true)
  4482. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  4483. elsif attacker.effects[PBEffects::HealBlock]==0
  4484. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  4485. attacker.pbRecoverHP(hpgain,true)
  4486. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  4487. end
  4488. end
  4489. return ret
  4490. end
  4491. end
  4492. ################################################################################
  4493. # User gains half the HP it inflicts as damage. (Dream Eater)
  4494. # (Handled in Battler's pbSuccessCheck): Fails if target is not asleep.
  4495. ################################################################################
  4496. class PokeBattle_Move_0DE < PokeBattle_Move
  4497. def isHealingMove?
  4498. return USENEWBATTLEMECHANICS
  4499. end
  4500.  
  4501. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4502. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4503. if opponent.damagestate.calcdamage>0
  4504. hpgain=(opponent.damagestate.hplost/2).round
  4505. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  4506. attacker.pbReduceHP(hpgain,true)
  4507. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  4508. elsif attacker.effects[PBEffects::HealBlock]==0
  4509. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  4510. attacker.pbRecoverHP(hpgain,true)
  4511. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  4512. end
  4513. end
  4514. return ret
  4515. end
  4516. end
  4517. ################################################################################
  4518. # User faints. (Explosion, Selfdestruct)
  4519. ################################################################################
  4520. class PokeBattle_Move_0E0 < PokeBattle_Move
  4521. def pbOnStartUse(attacker)
  4522. if !attacker.hasMoldBreaker
  4523. bearer=@battle.pbCheckGlobalAbility(:DAMP)
  4524. if bearer!=nil
  4525. @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  4526. bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  4527. return false
  4528. end
  4529. end
  4530. return true
  4531. end
  4532.  
  4533. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4534. super(id,attacker,opponent,hitnum,alltargets,showanimation)
  4535. if !attacker.isFainted?
  4536. attacker.pbReduceHP(attacker.hp)
  4537. attacker.pbFaint if attacker.isFainted?
  4538. end
  4539. end
  4540. end
  4541. ################################################################################
  4542. # Decreases the target's Attack and Special Attack by 2 stages each. (Memento)
  4543. # User faints (even if effect does nothing).
  4544. ################################################################################
  4545. class PokeBattle_Move_0E2 < PokeBattle_Move
  4546. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4547. if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
  4548. @battle.pbDisplay(_INTL("But it failed!"))
  4549. return -1
  4550. end
  4551. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4552. ret=-1; showanim=true
  4553. if opponent.pbReduceStat(PBStats::ATTACK,2,attacker,false,self,showanim)
  4554. ret=0; showanim=false
  4555. end
  4556. if opponent.pbReduceStat(PBStats::SPATK,2,attacker,false,self,showanim)
  4557. ret=0; showanim=false
  4558. end
  4559. attacker.pbReduceHP(attacker.hp)
  4560. return ret
  4561. end
  4562. end
  4563. ################################################################################
  4564. # User faints. The Pokémon that replaces the user is fully healed (HP and
  4565. # status). Fails if user won't be replaced. (Healing Wish)
  4566. ################################################################################
  4567. class PokeBattle_Move_0E3 < PokeBattle_Move
  4568. def isHealingMove?
  4569. return true
  4570. end
  4571.  
  4572. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4573. if !@battle.pbCanChooseNonActive?(attacker.index)
  4574. @battle.pbDisplay(_INTL("But it failed!"))
  4575. return -1
  4576. end
  4577. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4578. attacker.pbReduceHP(attacker.hp)
  4579. attacker.effects[PBEffects::HealingWish]=true
  4580. return 0
  4581. end
  4582. end
  4583. ################################################################################
  4584. # User faints. The Pokémon that replaces the user is fully healed (HP, PP and
  4585. # status). Fails if user won't be replaced. (Lunar Dance)
  4586. ################################################################################
  4587. class PokeBattle_Move_0E4 < PokeBattle_Move
  4588. def isHealingMove?
  4589. return true
  4590. end
  4591.  
  4592. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4593. if !@battle.pbCanChooseNonActive?(attacker.index)
  4594. @battle.pbDisplay(_INTL("But it failed!"))
  4595. return -1
  4596. end
  4597. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4598. attacker.pbReduceHP(attacker.hp)
  4599. attacker.effects[PBEffects::LunarDance]=true
  4600. return 0
  4601. end
  4602. end
  4603. ################################################################################
  4604. # All current battlers will perish after 3 more rounds. (Perish Song)
  4605. ################################################################################
  4606. class PokeBattle_Move_0E5 < PokeBattle_Move
  4607. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4608. failed=true
  4609. for i in 0...4
  4610. if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
  4611. (attacker.hasMoldBreaker ||
  4612. !@battle.battlers[i].hasWorkingAbility(:SOUNDPROOF))
  4613. failed=false; break
  4614. end
  4615. end
  4616. if failed
  4617. @battle.pbDisplay(_INTL("But it failed!"))
  4618. return -1
  4619. end
  4620. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4621. @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
  4622. for i in 0...4
  4623. if @battle.battlers[i].effects[PBEffects::PerishSong]==0
  4624. if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
  4625. @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
  4626. PBAbilities.getName(@battle.battlers[i].ability),@name))
  4627. else
  4628. @battle.battlers[i].effects[PBEffects::PerishSong]=4
  4629. @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
  4630. end
  4631. end
  4632. end
  4633. return 0
  4634. end
  4635. end
  4636. ################################################################################
  4637. # If user is KO'd before it next moves, the attack that caused it loses all PP.
  4638. # (Grudge)
  4639. ################################################################################
  4640. class PokeBattle_Move_0E6 < PokeBattle_Move
  4641. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4642. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4643. attacker.effects[PBEffects::Grudge]=true
  4644. @battle.pbDisplay(_INTL("{1} wants its target to bear a grudge!",attacker.pbThis))
  4645. return 0
  4646. end
  4647. end
  4648. ################################################################################
  4649. # If user is KO'd before it next moves, the battler that caused it also faints.
  4650. # (Destiny Bond)
  4651. ################################################################################
  4652. class PokeBattle_Move_0E7 < PokeBattle_Move
  4653. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4654. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4655. attacker.effects[PBEffects::DestinyBond]=true
  4656. @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
  4657. return 0
  4658. end
  4659. end
  4660. ################################################################################
  4661. # If user would be KO'd this round, it survives with 1HP instead. (Endure)
  4662. ################################################################################
  4663. class PokeBattle_Move_0E8 < PokeBattle_Move
  4664. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4665. ratesharers=[
  4666. 0xAA, # Detect, Protect
  4667. 0xE8 # Endure
  4668. ]
  4669. if !ratesharers.include?(PBMoveData.new(attacker.lastMoveUsed).function)
  4670. attacker.effects[PBEffects::ProtectRate]=1
  4671. end
  4672. unmoved=false
  4673. for poke in @battle.battlers
  4674. next if poke.index==attacker.index
  4675. if @battle.choices[poke.index][0]==1 && # Chose a move
  4676. !poke.hasMovedThisRound?
  4677. unmoved=true; break
  4678. end
  4679. end
  4680. if !unmoved ||
  4681. @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
  4682. attacker.effects[PBEffects::ProtectRate]=1
  4683. @battle.pbDisplay(_INTL("But it failed!"))
  4684. return -1
  4685. end
  4686. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4687. attacker.effects[PBEffects::Endure]=true
  4688. attacker.effects[PBEffects::ProtectRate]*=2
  4689. @battle.pbDisplay(_INTL("{1} braced itself!",attacker.pbThis))
  4690. return 0
  4691. end
  4692. end
  4693. ################################################################################
  4694. # If target would be KO'd by this attack, it survives with 1HP instead. (False Swipe)
  4695. ################################################################################
  4696. class PokeBattle_Move_0E9 < PokeBattle_Move
  4697. # Handled in superclass def pbReduceHPDamage, do not edit!
  4698. end
  4699. ################################################################################
  4700. # User flees from battle. Fails in trainer battles. (Teleport)
  4701. ################################################################################
  4702. class PokeBattle_Move_0EA < PokeBattle_Move
  4703. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4704. if @battle.opponent ||
  4705. !@battle.pbCanRun?(attacker.index)
  4706. @battle.pbDisplay(_INTL("But it failed!"))
  4707. return -1
  4708. end
  4709. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4710. @battle.pbDisplay(_INTL("{1} fled from battle!",attacker.pbThis))
  4711. @battle.decision=3
  4712. return 0
  4713. end
  4714. end
  4715. ################################################################################
  4716. # In wild battles, makes target flee. Fails if target is a higher level than the
  4717. # user.
  4718. # In trainer battles, target switches out.
  4719. # For status moves. (Roar, Whirlwind)
  4720. ################################################################################
  4721. class PokeBattle_Move_0EB < PokeBattle_Move
  4722. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4723. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:SUCTIONCUPS)
  4724. @battle.pbDisplay(_INTL("{1} anchored itself with {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))
  4725. return -1
  4726. end
  4727. if opponent.effects[PBEffects::Ingrain]
  4728. @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",opponent.pbThis))
  4729. return -1
  4730. end
  4731. if !@battle.opponent
  4732. if opponent.level>attacker.level
  4733. @battle.pbDisplay(_INTL("But it failed!"))
  4734. return -1
  4735. end
  4736. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4737. @battle.decision=3 # Set decision to escaped
  4738. return 0
  4739. else
  4740. choices=false
  4741. party=@battle.pbParty(opponent.index)
  4742. for i in 0...party.length
  4743. if @battle.pbCanSwitch?(opponent.index,i,false,true)
  4744. choices=true
  4745. break
  4746. end
  4747. end
  4748. if !choices
  4749. @battle.pbDisplay(_INTL("But it failed!"))
  4750. return -1
  4751. end
  4752. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4753. opponent.effects[PBEffects::Roar]=true
  4754. return 0
  4755. end
  4756. end
  4757. end
  4758. ################################################################################
  4759. # User switches out. Various effects affecting the user are passed to the
  4760. # replacement. (Baton Pass)
  4761. ################################################################################
  4762. class PokeBattle_Move_0ED < PokeBattle_Move
  4763. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4764. if !@battle.pbCanChooseNonActive?(attacker.index)
  4765. @battle.pbDisplay(_INTL("But it failed!"))
  4766. return -1
  4767. end
  4768. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4769. attacker.effects[PBEffects::BatonPass]=true
  4770. return 0
  4771. end
  4772. end
  4773. ################################################################################
  4774. # After inflicting damage, user switches out. Ignores trapping moves.
  4775. # (U-turn)
  4776. # TODO: Pursuit should interrupt this move.
  4777. ################################################################################
  4778. class PokeBattle_Move_0EE < PokeBattle_Move
  4779. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4780. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4781. if !attacker.isFainted? && opponent.damagestate.calcdamage>0 &&
  4782. @battle.pbCanChooseNonActive?(attacker.index) &&
  4783. !@battle.pbAllFainted?(@battle.pbParty(opponent.index))
  4784. attacker.effects[PBEffects::Uturn]=true
  4785. end
  4786. return ret
  4787. end
  4788. end
  4789. ################################################################################
  4790. # Target can no longer switch out or flee, as long as the user remains active.
  4791. # (Block, Mean Look, Spider Web)
  4792. ################################################################################
  4793. class PokeBattle_Move_0EF < PokeBattle_Move
  4794. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4795. if pbIsDamaging?
  4796. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  4797. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  4798. !opponent.isFainted?
  4799. if opponent.effects[PBEffects::MeanLook]<0 &&
  4800. (!USENEWBATTLEMECHANICS || !opponent.pbHasType?(:GHOST))
  4801. opponent.effects[PBEffects::MeanLook]=attacker.index
  4802. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  4803. end
  4804. end
  4805. return ret
  4806. end
  4807. if opponent.effects[PBEffects::MeanLook]>=0 ||
  4808. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  4809. @battle.pbDisplay(_INTL("But it failed!"))
  4810. return -1
  4811. end
  4812. if USENEWBATTLEMECHANICS && opponent.pbHasType?(:GHOST)
  4813. @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
  4814. return -1
  4815. end
  4816. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4817. opponent.effects[PBEffects::MeanLook]=attacker.index
  4818. @battle.pbDisplay(_INTL("{1} can no longer escape!",opponent.pbThis))
  4819. return 0
  4820. end
  4821. end
  4822. ################################################################################
  4823. # Target drops its item. It regains the item at the end of the battle. (Knock Off)
  4824. # If target has a losable item, damage is multiplied by 1.5.
  4825. ################################################################################
  4826. class PokeBattle_Move_0F0 < PokeBattle_Move
  4827. def pbEffectAfterHit(attacker,opponent,turneffects)
  4828. if !attacker.isFainted? && !opponent.isFainted? && opponent.item!=0 &&
  4829. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  4830. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  4831. abilityname=PBAbilities.getName(opponent.ability)
  4832. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  4833. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item)
  4834. itemname=PBItems.getName(opponent.item)
  4835. opponent.item=0
  4836. opponent.effects[PBEffects::ChoiceBand]=-1
  4837. opponent.effects[PBEffects::Unburden]=true
  4838. @battle.pbDisplay(_INTL("{1} dropped its {2}!",opponent.pbThis,itemname))
  4839. end
  4840. end
  4841. end
  4842.  
  4843. def pbModifyDamage(damagemult,attacker,opponent)
  4844. if USENEWBATTLEMECHANICS &&
  4845. !@battle.pbIsUnlosableItem(opponent,opponent.item)
  4846. # Still boosts damage even if opponent has Sticky Hold
  4847. return (damagemult*1.5).round
  4848. end
  4849. return damagemult
  4850. end
  4851. end
  4852. ################################################################################
  4853. # User steals the target's item, if the user has none itself. (Covet, Thief)
  4854. # Items stolen from wild Pokémon are kept after the battle.
  4855. ################################################################################
  4856. class PokeBattle_Move_0F1 < PokeBattle_Move
  4857. def pbEffectAfterHit(attacker,opponent,turneffects)
  4858. if !attacker.isFainted? && !opponent.isFainted? && opponent.item!=0 &&
  4859. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  4860. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  4861. abilityname=PBAbilities.getName(opponent.ability)
  4862. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name))
  4863. elsif !@battle.pbIsUnlosableItem(opponent,opponent.item) &&
  4864. !@battle.pbIsUnlosableItem(attacker,opponent.item) &&
  4865. attacker.item==0 &&
  4866. (@battle.opponent || !@battle.pbIsOpposing?(attacker.index))
  4867. itemname=PBItems.getName(opponent.item)
  4868. attacker.item=opponent.item
  4869. opponent.item=0
  4870. opponent.effects[PBEffects::ChoiceBand]=-1
  4871. opponent.effects[PBEffects::Unburden]=true
  4872. if !@battle.opponent && # In a wild battle
  4873. attacker.pokemon.itemInitial==0 &&
  4874. opponent.pokemon.itemInitial==attacker.item
  4875. attacker.pokemon.itemInitial=attacker.item
  4876. opponent.pokemon.itemInitial=0
  4877. end
  4878. @battle.pbDisplay(_INTL("{1} stole {2}'s {3}!",attacker.pbThis,opponent.pbThis(true),itemname))
  4879. end
  4880. end
  4881. end
  4882. end
  4883. ################################################################################
  4884. # User and target swap items. They remain swapped after wild battles.
  4885. # (Switcheroo, Trick)
  4886. ################################################################################
  4887. class PokeBattle_Move_0F2 < PokeBattle_Move
  4888. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4889. if (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)) ||
  4890. (attacker.item==0 && opponent.item==0) ||
  4891. (!@battle.opponent && @battle.pbIsOpposing?(attacker.index))
  4892. @battle.pbDisplay(_INTL("But it failed!"))
  4893. return -1
  4894. end
  4895. if @battle.pbIsUnlosableItem(opponent,opponent.item) ||
  4896. @battle.pbIsUnlosableItem(attacker,opponent.item) ||
  4897. @battle.pbIsUnlosableItem(opponent,attacker.item) ||
  4898. @battle.pbIsUnlosableItem(attacker,attacker.item)
  4899. @battle.pbDisplay(_INTL("But it failed!"))
  4900. return -1
  4901. end
  4902. if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STICKYHOLD)
  4903. abilityname=PBAbilities.getName(opponent.ability)
  4904. @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,name))
  4905. return -1
  4906. end
  4907. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  4908. oldattitem=attacker.item
  4909. oldoppitem=opponent.item
  4910. oldattitemname=PBItems.getName(oldattitem)
  4911. oldoppitemname=PBItems.getName(oldoppitem)
  4912. tmpitem=attacker.item
  4913. attacker.item=opponent.item
  4914. opponent.item=tmpitem
  4915. if !@battle.opponent && # In a wild battle
  4916. attacker.pokemon.itemInitial==oldattitem &&
  4917. opponent.pokemon.itemInitial==oldoppitem
  4918. attacker.pokemon.itemInitial=oldoppitem
  4919. opponent.pokemon.itemInitial=oldattitem
  4920. end
  4921. @battle.pbDisplay(_INTL("{1} switched items with its opponent!",attacker.pbThis))
  4922. if oldoppitem>0 && oldattitem>0
  4923. @battle.pbDisplayPaused(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname))
  4924. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname))
  4925. else
  4926. @battle.pbDisplay(_INTL("{1} obtained {2}.",attacker.pbThis,oldoppitemname)) if oldoppitem>0
  4927. @battle.pbDisplay(_INTL("{1} obtained {2}.",opponent.pbThis,oldattitemname)) if oldattitem>0
  4928. end
  4929. attacker.effects[PBEffects::ChoiceBand]=-1
  4930. opponent.effects[PBEffects::ChoiceBand]=-1
  4931. return 0
  4932. end
  4933. end
  4934. ################################################################################
  4935. # User consumes target's berry and gains its effect. (Bug Bite, Pluck)
  4936. ################################################################################
  4937. class PokeBattle_Move_0F4 < PokeBattle_Move
  4938. def pbEffectAfterHit(attacker,opponent,turneffects)
  4939. if !attacker.isFainted? && !opponent.isFainted? && pbIsBerry?(opponent.item) &&
  4940. opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute
  4941. if attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:STICKYHOLD)
  4942. item=opponent.item
  4943. itemname=PBItems.getName(item)
  4944. opponent.pbConsumeItem(false,false)
  4945. @battle.pbDisplay(_INTL("{1} stole and ate its target's {2}!",attacker.pbThis,itemname))
  4946. if !attacker.hasWorkingAbility(:KLUTZ) &&
  4947. attacker.effects[PBEffects::Embargo]==0
  4948. attacker.pbActivateBerryEffect(item,false)
  4949. end
  4950. # Symbiosis
  4951. if attacker.item==0 &&
  4952. attacker.pbPartner && attacker.pbPartner.hasWorkingAbility(:SYMBIOSIS)
  4953. partner=attacker.pbPartner
  4954. if partner.item>0 &&
  4955. !@battle.pbIsUnlosableItem(partner,partner.item) &&
  4956. !@battle.pbIsUnlosableItem(attacker,partner.item)
  4957. @battle.pbDisplay(_INTL("{1}'s {2} let it share its {3} with {4}!",
  4958. partner.pbThis,PBAbilities.getName(partner.ability),
  4959. PBItems.getName(partner.item),attacker.pbThis(true)))
  4960. attacker.item=partner.item
  4961. partner.item=0
  4962. partner.effects[PBEffects::Unburden]=true
  4963. attacker.pbBerryCureCheck
  4964. end
  4965. end
  4966. end
  4967. end
  4968. end
  4969. end
  4970. ################################################################################
  4971. # User recovers the last item it held and consumed. (Recycle)
  4972. ################################################################################
  4973. class PokeBattle_Move_0F6 < PokeBattle_Move
  4974. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  4975. if !attacker.pokemon || attacker.pokemon.itemRecycle==0
  4976. @battle.pbDisplay(_INTL("But it failed!"))
  4977. return -1
  4978. end
  4979. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  4980. item=attacker.pokemon.itemRecycle
  4981. itemname=PBItems.getName(item)
  4982. attacker.item=item
  4983. if !@battle.opponent # In a wild battle
  4984. attacker.pokemon.itemInitial=item if attacker.pokemon.itemInitial==0
  4985. end
  4986. attacker.pokemon.itemRecycle=0
  4987. attacker.effects[PBEffects::PickupItem]=0
  4988. attacker.effects[PBEffects::PickupUse]=0
  4989. @battle.pbDisplay(_INTL("{1} found one {2}!",attacker.pbThis,itemname))
  4990. return 0
  4991. end
  4992. end
  4993. ################################################################################
  4994. # User flings its item at the target. Power and effect depend on the item. (Fling)
  4995. ################################################################################
  4996. class PokeBattle_Move_0F7 < PokeBattle_Move
  4997. def flingarray
  4998. return {
  4999. 130 => [:IRONBALL],
  5000. 100 => [:ARMORFOSSIL,:CLAWFOSSIL,:COVERFOSSIL,:DOMEFOSSIL,:HARDSTONE,
  5001. :HELIXFOSSIL,:JAWFOSSIL,:OLDAMBER,:PLUMEFOSSIL,:RAREBONE,
  5002. :ROOTFOSSIL,:SAILFOSSIL,:SKULLFOSSIL],
  5003. 90 => [:DEEPSEATOOTH,:DRACOPLATE,:DREADPLATE,:EARTHPLATE,:FISTPLATE,
  5004. :FLAMEPLATE,:GRIPCLAW,:ICICLEPLATE,:INSECTPLATE,:IRONPLATE,
  5005. :MEADOWPLATE,:MINDPLATE,:PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,
  5006. :SPOOKYPLATE,:STONEPLATE,:THICKCLUB,:TOXICPLATE,:ZAPPLATE],
  5007. 80 => [:ASSAULTVEST,:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER,
  5008. :ODDKEYSTONE,:OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,
  5009. :SAFETYGOGGLES,:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY],
  5010. 70 => [:BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:DRAGONFANG,:POISONBARB,
  5011. :POWERANKLET,:POWERBAND,:POWERBELT,:POWERBRACER,:POWERLENS,
  5012. :POWERWEIGHT,:SHOCKDRIVE],
  5013. 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LUSTROUSORB,
  5014. :MACHOBRACE,:ROCKYHELMET,:STICK],
  5015. 50 => [:DUBIOUSDISC,:SHARPBEAK],
  5016. 40 => [:EVIOLITE,:ICYROCK,:LUCKYPUNCH],
  5017. 30 => [:ABILITYCAPSULE,:ABILITYURGE,:ABSORBBULB,:AMAZEMULCH,:AMULETCOIN,
  5018. :ANTIDOTE,:AWAKENING,:BALMMUSHROOM,:BERRYJUICE,:BIGMUSHROOM,
  5019. :BIGNUGGET,:BIGPEARL,:BINDINGBAND,:BLACKBELT,:BLACKFLUTE,
  5020. :BLACKGLASSES,:BLACKSLUDGE,:BLUEFLUTE,:BLUESHARD,:BOOSTMULCH,
  5021. :BURNHEAL,:CALCIUM,:CARBOS,:CASTELIACONE,:CELLBATTERY,
  5022. :CHARCOAL,:CLEANSETAG,:COMETSHARD,:DAMPMULCH,:DEEPSEASCALE,
  5023. :DIREHIT,:DIREHIT2,:DIREHIT3,:DRAGONSCALE,:EJECTBUTTON,
  5024. :ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ESCAPEROPE,:ETHER,
  5025. :EVERSTONE,:EXPSHARE,:FIRESTONE,:FLAMEORB,:FLOATSTONE,
  5026. :FLUFFYTAIL,:FRESHWATER,:FULLHEAL,:FULLRESTORE,:GOOEYMULCH,
  5027. :GREENSHARD,:GROWTHMULCH,:GUARDSPEC,:HEALPOWDER,:HEARTSCALE,
  5028. :HONEY,:HPUP,:HYPERPOTION,:ICEHEAL,:IRON,
  5029. :ITEMDROP,:ITEMURGE,:KINGSROCK,:LAVACOOKIE,:LEAFSTONE,
  5030. :LEMONADE,:LIFEORB,:LIGHTBALL,:LIGHTCLAY,:LUCKYEGG,
  5031. :LUMINOUSMOSS,:LUMIOSEGALETTE,:MAGNET,:MAXELIXIR,:MAXETHER,
  5032. :MAXPOTION,:MAXREPEL,:MAXREVIVE,:METALCOAT,:METRONOME,
  5033. :MIRACLESEED,:MOOMOOMILK,:MOONSTONE,:MYSTICWATER,:NEVERMELTICE,
  5034. :NUGGET,:OLDGATEAU,:PARALYZEHEAL,:PARLYZHEAL,:PASSORB,
  5035. :PEARL,:PEARLSTRING,:POKEDOLL,:POKETOY,:POTION,
  5036. :PPMAX,:PPUP,:PRISMSCALE,:PROTEIN,:RAGECANDYBAR,
  5037. :RARECANDY,:RAZORFANG,:REDFLUTE,:REDSHARD,:RELICBAND,
  5038. :RELICCOPPER,:RELICCROWN,:RELICGOLD,:RELICSILVER,:RELICSTATUE,
  5039. :RELICVASE,:REPEL,:RESETURGE,:REVIVALHERB,:REVIVE,
  5040. :RICHMULCH,:SACHET,:SACREDASH,:SCOPELENS,:SHALOURSABLE,
  5041. :SHELLBELL,:SHOALSALT,:SHOALSHELL,:SMOKEBALL,:SNOWBALL,
  5042. :SODAPOP,:SOULDEW,:SPELLTAG,:STABLEMULCH,:STARDUST,
  5043. :STARPIECE,:SUNSTONE,:SUPERPOTION,:SUPERREPEL,:SURPRISEMULCH,
  5044. :SWEETHEART,:THUNDERSTONE,:TINYMUSHROOM,:TOXICORB,:TWISTEDSPOON,
  5045. :UPGRADE,:WATERSTONE,:WHIPPEDDREAM,:WHITEFLUTE,:XACCURACY,
  5046. :XACCURACY2,:XACCURACY3,:XACCURACY6,:XATTACK,:XATTACK2,
  5047. :XATTACK3,:XATTACK6,:XDEFEND,:XDEFEND2,:XDEFEND3,
  5048. :XDEFEND6,:XDEFENSE,:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,
  5049. :XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6,:XSPATK,
  5050. :XSPATK2,:XSPATK3,:XSPATK6,:XSPECIAL,:XSPECIAL2,
  5051. :XSPECIAL3,:XSPECIAL6,:XSPEED,:XSPEED2,:XSPEED3,
  5052. :XSPEED6,:YELLOWFLUTE,:YELLOWSHARD,:ZINC],
  5053. 20 => [:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
  5054. :RESISTWING,:SWIFTWING],
  5055. 10 => [:AIRBALLOON,:BIGROOT,:BLUESCARF,:BRIGHTPOWDER,:CHOICEBAND,
  5056. :CHOICESCARF,:CHOICESPECS,:DESTINYKNOT,:EXPERTBELT,:FOCUSBAND,
  5057. :FOCUSSASH,:FULLINCENSE,:GREENSCARF,:LAGGINGTAIL,:LAXINCENSE,
  5058. :LEFTOVERS,:LUCKINCENSE,:MENTALHERB,:METALPOWDER,:MUSCLEBAND,
  5059. :ODDINCENSE,:PINKSCARF,:POWERHERB,:PUREINCENSE,:QUICKPOWDER,
  5060. :REAPERCLOTH,:REDCARD,:REDSCARF,:RINGTARGET,:ROCKINCENSE,
  5061. :ROSEINCENSE,:SEAINCENSE,:SHEDSHELL,:SILKSCARF,:SILVERPOWDER,
  5062. :SMOOTHROCK,:SOFTSAND,:SOOTHEBELL,:WAVEINCENSE,:WHITEHERB,
  5063. :WIDELENS,:WISEGLASSES,:YELLOWSCARF,:ZOOMLENS]
  5064. }
  5065. end
  5066.  
  5067. def pbMoveFailed(attacker,opponent)
  5068. return true if attacker.item==0 ||
  5069. @battle.pbIsUnlosableItem(attacker,attacker.item) ||
  5070. pbIsPokeBall?(attacker.item) ||
  5071. attacker.hasWorkingAbility(:KLUTZ) ||
  5072. attacker.effects[PBEffects::Embargo]>0
  5073. for i in flingarray.keys
  5074. if flingarray[i]
  5075. for j in flingarray[i]
  5076. return false if isConst?(attacker.item,PBItems,j)
  5077. end
  5078. end
  5079. end
  5080. return false if pbIsBerry?(attacker.item) &&
  5081. !attacker.pbOpposing1.hasWorkingAbility(:UNNERVE) &&
  5082. !attacker.pbOpposing2.hasWorkingAbility(:UNNERVE)
  5083. return true
  5084. end
  5085.  
  5086. def pbBaseDamage(basedmg,attacker,opponent)
  5087. return 10 if pbIsBerry?(attacker.item)
  5088. return 80 if pbIsMegaStone?(attacker.item)
  5089. for i in flingarray.keys
  5090. if flingarray[i]
  5091. for j in flingarray[i]
  5092. return i if isConst?(attacker.item,PBItems,j)
  5093. end
  5094. end
  5095. end
  5096. return 1
  5097. end
  5098.  
  5099. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5100. if attacker.item==0
  5101. @battle.pbDisplay(_INTL("But it failed!"))
  5102. return 0
  5103. end
  5104. attacker.effects[PBEffects::Unburden]=true
  5105. @battle.pbDisplay(_INTL("{1} flung its {2}!",attacker.pbThis,PBItems.getName(attacker.item)))
  5106. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5107. if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
  5108. (attacker.hasMoldBreaker || !opponent.hasWorkingAbility(:SHIELDDUST))
  5109. if pbIsBerry?(@item)
  5110. opponent.pbActivateBerryEffect(attacker.item,false)
  5111. elsif attacker.hasWorkingItem(:FLAMEORB)
  5112. if opponent.pbCanBurn?(attacker,false,self)
  5113. opponent.pbBurn(attacker)
  5114. end
  5115. elsif attacker.hasWorkingItem(:KINGSROCK) ||
  5116. attacker.hasWorkingItem(:RAZORFANG)
  5117. opponent.pbFlinch(attacker)
  5118. elsif attacker.hasWorkingItem(:LIGHTBALL)
  5119. if opponent.pbCanParalyze?(attacker,false,self)
  5120. opponent.pbParalyze(attacker)
  5121. end
  5122. elsif attacker.hasWorkingItem(:MENTALHERB)
  5123. if opponent.effects[PBEffects::Attract]>=0
  5124. opponent.pbCureAttract
  5125. @battle.pbDisplay(_INTL("{1} got over its infatuation.",opponent.pbThis))
  5126. end
  5127. if opponent.effects[PBEffects::Taunt]>0
  5128. opponent.effects[PBEffects::Taunt]=0
  5129. @battle.pbDisplay(_INTL("{1}'s taunt wore off!",opponent.pbThis))
  5130. end
  5131. if opponent.effects[PBEffects::Encore]>0
  5132. opponent.effects[PBEffects::Encore]=0
  5133. opponent.effects[PBEffects::EncoreMove]=0
  5134. opponent.effects[PBEffects::EncoreIndex]=0
  5135. @battle.pbDisplay(_INTL("{1}'s encore ended!",opponent.pbThis))
  5136. end
  5137. if opponent.effects[PBEffects::Torment]
  5138. opponent.effects[PBEffects::Torment]=false
  5139. @battle.pbDisplay(_INTL("{1}'s torment wore off!",opponent.pbThis))
  5140. end
  5141. if opponent.effects[PBEffects::Disable]>0
  5142. opponent.effects[PBEffects::Disable]=0
  5143. @battle.pbDisplay(_INTL("{1} is no longer disabled!",opponent.pbThis))
  5144. end
  5145. if opponent.effects[PBEffects::HealBlock]>0
  5146. opponent.effects[PBEffects::HealBlock]=0
  5147. @battle.pbDisplay(_INTL("{1}'s Heal Block wore off!",opponent.pbThis))
  5148. end
  5149. elsif attacker.hasWorkingItem(:POISONBARB)
  5150. if opponent.pbCanPoison?(attacker,false,self)
  5151. opponent.pbPoison(attacker)
  5152. end
  5153. elsif attacker.hasWorkingItem(:TOXICORB)
  5154. if opponent.pbCanPoison?(attacker,false,self)
  5155. opponent.pbPoison(attacker,nil,true)
  5156. end
  5157. elsif attacker.hasWorkingItem(:WHITEHERB)
  5158. while true
  5159. reducedstats=false
  5160. for i in [PBStats::ATTACK,PBStats::DEFENSE,
  5161. PBStats::SPEED,PBStats::SPATK,PBStats::SPDEF,
  5162. PBStats::EVASION,PBStats::ACCURACY]
  5163. if opponent.stages[i]<0
  5164. opponent.stages[i]=0; reducedstats=true
  5165. end
  5166. end
  5167. break if !reducedstats
  5168. @battle.pbDisplay(_INTL("{1}'s status is returned to normal!",
  5169. opponent.pbThis(true)))
  5170. end
  5171. end
  5172. end
  5173. attacker.pbConsumeItem
  5174. return ret
  5175. end
  5176. end
  5177. ################################################################################
  5178. # For 5 rounds, the target cannnot use its held item, its held item has no
  5179. # effect, and no items can be used on it. (Embargo)
  5180. ################################################################################
  5181. class PokeBattle_Move_0F8 < PokeBattle_Move
  5182. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5183. if opponent.effects[PBEffects::Embargo]>0
  5184. @battle.pbDisplay(_INTL("But it failed!"))
  5185. return -1
  5186. end
  5187. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5188. opponent.effects[PBEffects::Embargo]=5
  5189. @battle.pbDisplay(_INTL("{1} can't use items anymore!",opponent.pbThis))
  5190. return 0
  5191. end
  5192. end
  5193. ################################################################################
  5194. # User takes recoil damage equal to 1/4 of the damage this move dealt.
  5195. ################################################################################
  5196. class PokeBattle_Move_0FA < PokeBattle_Move
  5197. def isRecoilMove?
  5198. return true
  5199. end
  5200.  
  5201. def pbEffectAfterHit(attacker,opponent,turneffects)
  5202. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  5203. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  5204. !attacker.hasWorkingAbility(:MAGICGUARD)
  5205. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/4.0).round)
  5206. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  5207. end
  5208. end
  5209. end
  5210. end
  5211. ################################################################################
  5212. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  5213. ################################################################################
  5214. class PokeBattle_Move_0FB < PokeBattle_Move
  5215. def isRecoilMove?
  5216. return true
  5217. end
  5218.  
  5219. def pbEffectAfterHit(attacker,opponent,turneffects)
  5220. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  5221. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  5222. !attacker.hasWorkingAbility(:MAGICGUARD)
  5223. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  5224. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  5225. end
  5226. end
  5227. end
  5228. end
  5229. ################################################################################
  5230. # User takes recoil damage equal to 1/2 of the damage this move dealt.
  5231. # (Head Smash)
  5232. ################################################################################
  5233. class PokeBattle_Move_0FC < PokeBattle_Move
  5234. def isRecoilMove?
  5235. return true
  5236. end
  5237.  
  5238. def pbEffectAfterHit(attacker,opponent,turneffects)
  5239. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  5240. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  5241. !attacker.hasWorkingAbility(:MAGICGUARD)
  5242. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/2.0).round)
  5243. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  5244. end
  5245. end
  5246. end
  5247. end
  5248. ################################################################################
  5249. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  5250. # May paralyze the target. (Volt Tackle)
  5251. ################################################################################
  5252. class PokeBattle_Move_0FD < PokeBattle_Move
  5253. def isRecoilMove?
  5254. return true
  5255. end
  5256.  
  5257. def pbEffectAfterHit(attacker,opponent,turneffects)
  5258. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  5259. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  5260. !attacker.hasWorkingAbility(:MAGICGUARD)
  5261. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  5262. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  5263. end
  5264. end
  5265. end
  5266.  
  5267. def pbAdditionalEffect(attacker,opponent)
  5268. return if opponent.damagestate.substitute
  5269. if opponent.pbCanParalyze?(attacker,false,self)
  5270. opponent.pbParalyze(attacker)
  5271. end
  5272. end
  5273. end
  5274. ################################################################################
  5275. # User takes recoil damage equal to 1/3 of the damage this move dealt.
  5276. # May burn the target. (Flare Blitz)
  5277. ################################################################################
  5278. class PokeBattle_Move_0FE < PokeBattle_Move
  5279. def isRecoilMove?
  5280. return true
  5281. end
  5282.  
  5283. def pbEffectAfterHit(attacker,opponent,turneffects)
  5284. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  5285. if !attacker.hasWorkingAbility(:ROCKHEAD) &&
  5286. !attacker.hasWorkingAbility(:MAGICGUARD)
  5287. attacker.pbReduceHP((turneffects[PBEffects::TotalDamage]/3.0).round)
  5288. @battle.pbDisplay(_INTL("{1} is damaged by recoil!",attacker.pbThis))
  5289. end
  5290. end
  5291. end
  5292.  
  5293. def pbAdditionalEffect(attacker,opponent)
  5294. return if opponent.damagestate.substitute
  5295. if opponent.pbCanBurn?(attacker,false,self)
  5296. opponent.pbBurn(attacker)
  5297. end
  5298. end
  5299. end
  5300. ################################################################################
  5301. # Starts sunny weather. (Sunny Day)
  5302. ################################################################################
  5303. class PokeBattle_Move_0FF < PokeBattle_Move
  5304. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5305. case @battle.weather
  5306. when PBWeather::HEAVYRAIN
  5307. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  5308. return -1
  5309. when PBWeather::HARSHSUN
  5310. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  5311. return -1
  5312. when PBWeather::STRONGWINDS
  5313. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  5314. return -1
  5315. when PBWeather::SUNNYDAY
  5316. @battle.pbDisplay(_INTL("But it failed!"))
  5317. return -1
  5318. end
  5319. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5320. @battle.weather=PBWeather::SUNNYDAY
  5321. @battle.weatherduration=5
  5322. @battle.weatherduration=8 if attacker.hasWorkingItem(:HEATROCK)
  5323. @battle.pbCommonAnimation("Sunny",nil,nil)
  5324. @battle.pbDisplay(_INTL("The sunlight turned harsh!"))
  5325. return 0
  5326. end
  5327. end
  5328. ################################################################################
  5329. # Starts rainy weather. (Rain Dance)
  5330. ################################################################################
  5331. class PokeBattle_Move_100 < PokeBattle_Move
  5332. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5333. case @battle.weather
  5334. when PBWeather::HEAVYRAIN
  5335. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  5336. return -1
  5337. when PBWeather::HARSHSUN
  5338. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  5339. return -1
  5340. when PBWeather::STRONGWINDS
  5341. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  5342. return -1
  5343. when PBWeather::RAINDANCE
  5344. @battle.pbDisplay(_INTL("But it failed!"))
  5345. return -1
  5346. end
  5347. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5348. @battle.weather=PBWeather::RAINDANCE
  5349. @battle.weatherduration=5
  5350. @battle.weatherduration=8 if attacker.hasWorkingItem(:DAMPROCK)
  5351. @battle.pbCommonAnimation("Rain",nil,nil)
  5352. @battle.pbDisplay(_INTL("It started to rain!"))
  5353. return 0
  5354. end
  5355. end
  5356. ################################################################################
  5357. # Starts sandstorm weather. (Sandstorm)
  5358. ################################################################################
  5359. class PokeBattle_Move_101 < PokeBattle_Move
  5360. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5361. case @battle.weather
  5362. when PBWeather::HEAVYRAIN
  5363. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  5364. return -1
  5365. when PBWeather::HARSHSUN
  5366. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  5367. return -1
  5368. when PBWeather::STRONGWINDS
  5369. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  5370. return -1
  5371. when PBWeather::SANDSTORM
  5372. @battle.pbDisplay(_INTL("But it failed!"))
  5373. return -1
  5374. end
  5375. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5376. @battle.weather=PBWeather::SANDSTORM
  5377. @battle.weatherduration=5
  5378. @battle.weatherduration=8 if attacker.hasWorkingItem(:SMOOTHROCK)
  5379. @battle.pbCommonAnimation("Sandstorm",nil,nil)
  5380. @battle.pbDisplay(_INTL("A sandstorm brewed!"))
  5381. return 0
  5382. end
  5383. end
  5384. ################################################################################
  5385. # Starts hail weather. (Hail)
  5386. ################################################################################
  5387. class PokeBattle_Move_102 < PokeBattle_Move
  5388. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5389. case @battle.weather
  5390. when PBWeather::HEAVYRAIN
  5391. @battle.pbDisplay(_INTL("There is no relief from this heavy rain!"))
  5392. return -1
  5393. when PBWeather::HARSHSUN
  5394. @battle.pbDisplay(_INTL("The extremely harsh sunlight was not lessened at all!"))
  5395. return -1
  5396. when PBWeather::STRONGWINDS
  5397. @battle.pbDisplay(_INTL("The mysterious air current blows on regardless!"))
  5398. return -1
  5399. when PBWeather::HAIL
  5400. @battle.pbDisplay(_INTL("But it failed!"))
  5401. return -1
  5402. end
  5403. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5404. @battle.weather=PBWeather::HAIL
  5405. @battle.weatherduration=5
  5406. @battle.weatherduration=8 if attacker.hasWorkingItem(:ICYROCK)
  5407. @battle.pbCommonAnimation("Hail",nil,nil)
  5408. @battle.pbDisplay(_INTL("It started to hail!"))
  5409. return 0
  5410. end
  5411. end
  5412. ################################################################################
  5413. # Entry hazard. Lays spikes on the opposing side (max. 3 layers). (Spikes)
  5414. ################################################################################
  5415. class PokeBattle_Move_103 < PokeBattle_Move
  5416. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5417. if attacker.pbOpposingSide.effects[PBEffects::Spikes]>=3
  5418. @battle.pbDisplay(_INTL("But it failed!"))
  5419. return -1
  5420. end
  5421. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5422. attacker.pbOpposingSide.effects[PBEffects::Spikes]+=1
  5423. if !@battle.pbIsOpposing?(attacker.index)
  5424. @battle.pbDisplay(_INTL("Spikes were scattered all around the opposing team's feet!"))
  5425. else
  5426. @battle.pbDisplay(_INTL("Spikes were scattered all around your team's feet!"))
  5427. end
  5428. return 0
  5429. end
  5430. end
  5431. ################################################################################
  5432. # Entry hazard. Lays poison spikes on the opposing side (max. 2 layers).
  5433. # (Toxic Spikes)
  5434. ################################################################################
  5435. class PokeBattle_Move_104 < PokeBattle_Move
  5436. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5437. if attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]>=2
  5438. @battle.pbDisplay(_INTL("But it failed!"))
  5439. return -1
  5440. end
  5441. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5442. attacker.pbOpposingSide.effects[PBEffects::ToxicSpikes]+=1
  5443. if !@battle.pbIsOpposing?(attacker.index)
  5444. @battle.pbDisplay(_INTL("Poison spikes were scattered all around the opposing team's feet!"))
  5445. else
  5446. @battle.pbDisplay(_INTL("Poison spikes were scattered all around your team's feet!"))
  5447. end
  5448. return 0
  5449. end
  5450. end
  5451. ################################################################################
  5452. # Entry hazard. Lays stealth rocks on the opposing side. (Stealth Rock)
  5453. ################################################################################
  5454. class PokeBattle_Move_105 < PokeBattle_Move
  5455. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5456. if attacker.pbOpposingSide.effects[PBEffects::StealthRock]
  5457. @battle.pbDisplay(_INTL("But it failed!"))
  5458. return -1
  5459. end
  5460. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5461. attacker.pbOpposingSide.effects[PBEffects::StealthRock]=true
  5462. if !@battle.pbIsOpposing?(attacker.index)
  5463. @battle.pbDisplay(_INTL("Pointed stones float in the air around the opposing team!"))
  5464. else
  5465. @battle.pbDisplay(_INTL("Pointed stones float in the air around your team!"))
  5466. end
  5467. return 0
  5468. end
  5469. end
  5470. ################################################################################
  5471. # Scatters coins that the player picks up after winning the battle. (Pay Day)
  5472. ################################################################################
  5473. class PokeBattle_Move_109 < PokeBattle_Move
  5474. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5475. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5476. if opponent.damagestate.calcdamage>0
  5477. if @battle.pbOwnedByPlayer?(attacker.index)
  5478. @battle.extramoney+=5*attacker.level
  5479. @battle.extramoney=MAXMONEY if @battle.extramoney>MAXMONEY
  5480. end
  5481. @battle.pbDisplay(_INTL("Coins were scattered everywhere!"))
  5482. end
  5483. return ret
  5484. end
  5485. end
  5486. ################################################################################
  5487. # Ends the opposing side's Light Screen and Reflect. (Brick Break)
  5488. ################################################################################
  5489. class PokeBattle_Move_10A < PokeBattle_Move
  5490. def pbCalcDamage(attacker,opponent)
  5491. return super(attacker,opponent,PokeBattle_Move::NOREFLECT)
  5492. end
  5493.  
  5494. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5495. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  5496. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0
  5497. attacker.pbOpposingSide.effects[PBEffects::Reflect]=0
  5498. if !@battle.pbIsOpposing?(attacker.index)
  5499. @battle.pbDisplay(_INTL("The opposing team's Reflect wore off!"))
  5500. else
  5501. @battle.pbDisplayPaused(_INTL("Your team's Reflect wore off!"))
  5502. end
  5503. end
  5504. if attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  5505. attacker.pbOpposingSide.effects[PBEffects::LightScreen]=0
  5506. if !@battle.pbIsOpposing?(attacker.index)
  5507. @battle.pbDisplay(_INTL("The opposing team's Light Screen wore off!"))
  5508. else
  5509. @battle.pbDisplay(_INTL("Your team's Light Screen wore off!"))
  5510. end
  5511. end
  5512. return ret
  5513. end
  5514.  
  5515. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5516. if attacker.pbOpposingSide.effects[PBEffects::Reflect]>0 ||
  5517. attacker.pbOpposingSide.effects[PBEffects::LightScreen]>0
  5518. return super(id,attacker,opponent,1,alltargets,showanimation) # Wall-breaking anim
  5519. end
  5520. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  5521. end
  5522. end
  5523. ################################################################################
  5524. # If attack misses, user takes crash damage of 1/2 of max HP.
  5525. # (Hi Jump Kick, Jump Kick)
  5526. ################################################################################
  5527. class PokeBattle_Move_10B < PokeBattle_Move
  5528. def isRecoilMove?
  5529. return true
  5530. end
  5531.  
  5532. def unusableInGravity?
  5533. return true
  5534. end
  5535. end
  5536. ################################################################################
  5537. # User turns 1/4 of max HP into a substitute. (Substitute)
  5538. ################################################################################
  5539. class PokeBattle_Move_10C < PokeBattle_Move
  5540. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5541. if attacker.effects[PBEffects::Substitute]>0
  5542. @battle.pbDisplay(_INTL("{1} already has a substitute!",attacker.pbThis))
  5543. return -1
  5544. end
  5545. sublife=[(attacker.totalhp/4).floor,1].max
  5546. if attacker.hp<=sublife
  5547. @battle.pbDisplay(_INTL("It was too weak to make a substitute!"))
  5548. return -1
  5549. end
  5550. attacker.pbReduceHP(sublife,false,false)
  5551. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5552. attacker.effects[PBEffects::MultiTurn]=0
  5553. attacker.effects[PBEffects::MultiTurnAttack]=0
  5554. attacker.effects[PBEffects::Substitute]=sublife
  5555. @battle.pbDisplay(_INTL("{1} put in a substitute!",attacker.pbThis))
  5556. return 0
  5557. end
  5558. end
  5559. ################################################################################
  5560. # User is not Ghost: Decreases the user's Speed, increases the user's Attack &
  5561. # Defense by 1 stage each.
  5562. # User is Ghost: User loses 1/2 of max HP, and curses the target.
  5563. # Cursed Pokémon lose 1/4 of their max HP at the end of each round.
  5564. # (Curse)
  5565. ################################################################################
  5566. class PokeBattle_Move_10D < PokeBattle_Move
  5567. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5568. failed=false
  5569. if attacker.pbHasType?(:GHOST)
  5570. if opponent.effects[PBEffects::Curse] ||
  5571. opponent.pbOwnSide.effects[PBEffects::CraftyShield]
  5572. failed=true
  5573. else
  5574. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5575. @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true)))
  5576. opponent.effects[PBEffects::Curse]=true
  5577. attacker.pbReduceHP((attacker.totalhp/2).floor)
  5578. end
  5579. else
  5580. lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self)
  5581. raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  5582. raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5583. if !lowerspeed && !raiseatk && !raisedef
  5584. failed=true
  5585. else
  5586. pbShowAnimation(@id,attacker,nil,1,alltargets,showanimation) # Non-Ghost move animation
  5587. if lowerspeed
  5588. attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self)
  5589. end
  5590. showanim=true
  5591. if raiseatk
  5592. attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  5593. showanim=false
  5594. end
  5595. if raisedef
  5596. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  5597. showanim=false
  5598. end
  5599. end
  5600. end
  5601. if failed
  5602. @battle.pbDisplay(_INTL("But it failed!"))
  5603. end
  5604. return failed ? -1 : 0
  5605. end
  5606. end
  5607. ################################################################################
  5608. # Target's last move used loses 4 PP. (Spite)
  5609. ################################################################################
  5610. class PokeBattle_Move_10E < PokeBattle_Move
  5611. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5612. for i in opponent.moves
  5613. if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
  5614. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5615. reduction=[4,i.pp].min
  5616. i.pp-=reduction
  5617. @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
  5618. return 0
  5619. end
  5620. end
  5621. @battle.pbDisplay(_INTL("But it failed!"))
  5622. return -1
  5623. end
  5624. end
  5625. ################################################################################
  5626. # Target will lose 1/4 of max HP at end of each round, while asleep. (Nightmare)
  5627. ################################################################################
  5628. class PokeBattle_Move_10F < PokeBattle_Move
  5629. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5630. if opponent.status!=PBStatuses::SLEEP || opponent.effects[PBEffects::Nightmare] ||
  5631. (opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker))
  5632. @battle.pbDisplay(_INTL("But it failed!"))
  5633. return -1
  5634. end
  5635. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5636. opponent.effects[PBEffects::Nightmare]=true
  5637. @battle.pbDisplay(_INTL("{1} began having a nightmare!",opponent.pbThis))
  5638. return 0
  5639. end
  5640. end
  5641. ################################################################################
  5642. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  5643. # (Rapid Spin)
  5644. ################################################################################
  5645. class PokeBattle_Move_110 < PokeBattle_Move
  5646. def pbEffectAfterHit(attacker,opponent,turneffects)
  5647. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  5648. if attacker.effects[PBEffects::MultiTurn]>0
  5649. mtattack=PBMoves.getName(attacker.effects[PBEffects::MultiTurnAttack])
  5650. mtuser=@battle.battlers[attacker.effects[PBEffects::MultiTurnUser]]
  5651. @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",attacker.pbThis,mtuser.pbThis(true),mtattack))
  5652. attacker.effects[PBEffects::MultiTurn]=0
  5653. attacker.effects[PBEffects::MultiTurnAttack]=0
  5654. attacker.effects[PBEffects::MultiTurnUser]=-1
  5655. end
  5656. if attacker.effects[PBEffects::LeechSeed]>=0
  5657. attacker.effects[PBEffects::LeechSeed]=-1
  5658. @battle.pbDisplay(_INTL("{1} shed Leech Seed!",attacker.pbThis))
  5659. end
  5660. if attacker.pbOwnSide.effects[PBEffects::StealthRock]
  5661. attacker.pbOwnSide.effects[PBEffects::StealthRock]=false
  5662. @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",attacker.pbThis))
  5663. end
  5664. if attacker.pbOwnSide.effects[PBEffects::Spikes]>0
  5665. attacker.pbOwnSide.effects[PBEffects::Spikes]=0
  5666. @battle.pbDisplay(_INTL("{1} blew away Spikes!",attacker.pbThis))
  5667. end
  5668. if attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  5669. attacker.pbOwnSide.effects[PBEffects::ToxicSpikes]=0
  5670. @battle.pbDisplay(_INTL("{1} blew away poison spikes!",attacker.pbThis))
  5671. end
  5672. end
  5673. end
  5674. end
  5675. ################################################################################
  5676. # Attacks 2 rounds in the future. (Doom Desire, Future Sight)
  5677. ################################################################################
  5678. class PokeBattle_Move_111 < PokeBattle_Move
  5679. def pbDisplayUseMessage(attacker)
  5680. return 0 if @battle.futuresight
  5681. return super(attacker)
  5682. end
  5683.  
  5684. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5685. if opponent.effects[PBEffects::FutureSight]>0
  5686. @battle.pbDisplay(_INTL("But it failed!"))
  5687. return -1
  5688. end
  5689. if @battle.futuresight
  5690. # Attack hits
  5691. return super(attacker,opponent,hitnum,alltargets,showanimation)
  5692. end
  5693. # Attack is launched
  5694. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5695. opponent.effects[PBEffects::FutureSight]=3
  5696. opponent.effects[PBEffects::FutureSightMove]=@id
  5697. opponent.effects[PBEffects::FutureSightUser]=attacker.pokemonIndex
  5698. opponent.effects[PBEffects::FutureSightUserPos]=attacker.index
  5699. if isConst?(@id,PBMoves,:FUTURESIGHT)
  5700. @battle.pbDisplay(_INTL("{1} foresaw an attack!",attacker.pbThis))
  5701. else
  5702. @battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",attacker.pbThis))
  5703. end
  5704. return 0
  5705. end
  5706.  
  5707. def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5708. if @battle.futuresight
  5709. return super(id,attacker,opponent,1,alltargets,showanimation) # Hit opponent anim
  5710. end
  5711. return super(id,attacker,opponent,hitnum,alltargets,showanimation)
  5712. end
  5713. end
  5714.  
  5715.  
  5716.  
  5717. ################################################################################
  5718. # Increases the user's Defense and Special Defense by 1 stage each. Ups the
  5719. # user's stockpile by 1 (max. 3). (Stockpile)
  5720. ################################################################################
  5721. class PokeBattle_Move_112 < PokeBattle_Move
  5722. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5723. if attacker.effects[PBEffects::Stockpile]>=3
  5724. @battle.pbDisplay(_INTL("{1} can't stockpile any more!",attacker.pbThis))
  5725. return -1
  5726. end
  5727. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5728. attacker.effects[PBEffects::Stockpile]+=1
  5729. @battle.pbDisplay(_INTL("{1} stockpiled {2}!",attacker.pbThis,
  5730. attacker.effects[PBEffects::Stockpile]))
  5731. showanim=true
  5732. if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5733. attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  5734. attacker.effects[PBEffects::StockpileDef]+=1
  5735. showanim=false
  5736. end
  5737. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  5738. attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self,showanim)
  5739. attacker.effects[PBEffects::StockpileSpDef]+=1
  5740. showanim=false
  5741. end
  5742. return 0
  5743. end
  5744. end
  5745. ################################################################################
  5746. # Power is 100 multiplied by the user's stockpile (X). Resets the stockpile to
  5747. # 0. Decreases the user's Defense and Special Defense by X stages each. (Spit Up)
  5748. ################################################################################
  5749. class PokeBattle_Move_113 < PokeBattle_Move
  5750. def pbMoveFailed(attacker,opponent)
  5751. return (attacker.effects[PBEffects::Stockpile]==0)
  5752. end
  5753.  
  5754. def pbBaseDamage(basedmg,attacker,opponent)
  5755. return 100*attacker.effects[PBEffects::Stockpile]
  5756. end
  5757.  
  5758. def pbEffectAfterHit(attacker,opponent,turneffects)
  5759. if !attacker.isFainted? && turneffects[PBEffects::TotalDamage]>0
  5760. showanim=true
  5761. if attacker.effects[PBEffects::StockpileDef]>0
  5762. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  5763. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  5764. attacker,false,self,showanim)
  5765. showanim=false
  5766. end
  5767. end
  5768. if attacker.effects[PBEffects::StockpileSpDef]>0
  5769. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  5770. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  5771. attacker,false,self,showanim)
  5772. showanim=false
  5773. end
  5774. end
  5775. attacker.effects[PBEffects::Stockpile]=0
  5776. attacker.effects[PBEffects::StockpileDef]=0
  5777. attacker.effects[PBEffects::StockpileSpDef]=0
  5778. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  5779. end
  5780. end
  5781. end
  5782. ################################################################################
  5783. # Heals user depending on the user's stockpile (X). Resets the stockpile to 0.
  5784. # Decreases the user's Defense and Special Defense by X stages each. (Swallow)
  5785. ################################################################################
  5786. class PokeBattle_Move_114 < PokeBattle_Move
  5787. def isHealingMove?
  5788. return true
  5789. end
  5790.  
  5791. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5792. hpgain=0
  5793. case attacker.effects[PBEffects::Stockpile]
  5794. when 0
  5795. @battle.pbDisplay(_INTL("But it failed to swallow a thing!"))
  5796. return -1
  5797. when 1
  5798. hpgain=(attacker.totalhp/4).floor
  5799. when 2
  5800. hpgain=(attacker.totalhp/2).floor
  5801. when 3
  5802. hpgain=attacker.totalhp
  5803. end
  5804. if attacker.hp==attacker.totalhp &&
  5805. attacker.effects[PBEffects::StockpileDef]==0 &&
  5806. attacker.effects[PBEffects::StockpileSpDef]==0
  5807. @battle.pbDisplay(_INTL("But it failed!"))
  5808. return -1
  5809. end
  5810. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5811. if attacker.pbRecoverHP(hpgain,true)>0
  5812. @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
  5813. end
  5814. showanim=true
  5815. if attacker.effects[PBEffects::StockpileDef]>0
  5816. if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
  5817. attacker.pbReduceStat(PBStats::DEFENSE,attacker.effects[PBEffects::StockpileDef],
  5818. attacker,false,self,showanim)
  5819. showanim=false
  5820. end
  5821. end
  5822. if attacker.effects[PBEffects::StockpileSpDef]>0
  5823. if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
  5824. attacker.pbReduceStat(PBStats::SPDEF,attacker.effects[PBEffects::StockpileSpDef],
  5825. attacker,false,self,showanim)
  5826. showanim=false
  5827. end
  5828. end
  5829. attacker.effects[PBEffects::Stockpile]=0
  5830. attacker.effects[PBEffects::StockpileDef]=0
  5831. attacker.effects[PBEffects::StockpileSpDef]=0
  5832. @battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",attacker.pbThis))
  5833. return 0
  5834. end
  5835. end
  5836. ################################################################################
  5837. # Fails if user was hit by a damaging move this round. (Focus Punch)
  5838. ################################################################################
  5839. class PokeBattle_Move_115 < PokeBattle_Move
  5840. def pbDisplayUseMessage(attacker)
  5841. if attacker.lastHPLost>0
  5842. @battle.pbDisplayBrief(_INTL("{1} lost its focus and couldn't move!",attacker.pbThis))
  5843. return -1
  5844. end
  5845. return super(attacker)
  5846. end
  5847. end
  5848. ################################################################################
  5849. # Fails if the target didn't chose a damaging move to use this round, or has
  5850. # already moved. (Sucker Punch)
  5851. ################################################################################
  5852. class PokeBattle_Move_116 < PokeBattle_Move
  5853. def pbMoveFailed(attacker,opponent)
  5854. return true if @battle.choices[opponent.index][0]!=1 # Didn't choose a move
  5855. oppmove=@battle.choices[opponent.index][2]
  5856. return true if !oppmove || oppmove.id<=0 || oppmove.pbIsStatus?
  5857. return true if opponent.hasMovedThisRound? && oppmove.function!=0xB0 # Me First
  5858. return false
  5859. end
  5860. end
  5861. ################################################################################
  5862. # This round, user becomes the target of attacks that have single targets.
  5863. # (Follow Me, Rage Powder)
  5864. ################################################################################
  5865. class PokeBattle_Move_117 < PokeBattle_Move
  5866. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5867. if !@battle.doublebattle
  5868. @battle.pbDisplay(_INTL("But it failed!"))
  5869. return -1
  5870. end
  5871. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5872. attacker.effects[PBEffects::FollowMe]=1
  5873. if !attacker.pbPartner.isFainted? && attacker.pbPartner.effects[PBEffects::FollowMe]>0
  5874. attacker.effects[PBEffects::FollowMe]=attacker.pbPartner.effects[PBEffects::FollowMe]+1
  5875. end
  5876. @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
  5877. return 0
  5878. end
  5879. end
  5880. ################################################################################
  5881. # For 5 rounds, increases gravity on the field. Pokémon cannot become airborne.
  5882. # (Gravity)
  5883. ################################################################################
  5884. class PokeBattle_Move_118 < PokeBattle_Move
  5885. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5886. if @battle.field.effects[PBEffects::Gravity]>0
  5887. @battle.pbDisplay(_INTL("But it failed!"))
  5888. return -1
  5889. end
  5890. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5891. @battle.field.effects[PBEffects::Gravity]=5
  5892. for i in 0...4
  5893. poke=@battle.battlers[i]
  5894. next if !poke
  5895. if PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xC9 || # Fly
  5896. PBMoveData.new(poke.effects[PBEffects::TwoTurnAttack]).function==0xCC # Bounce
  5897. end
  5898. if poke.effects[PBEffects::MagnetRise]>0
  5899. poke.effects[PBEffects::MagnetRise]=0
  5900. end
  5901. end
  5902. @battle.pbDisplay(_INTL("Gravity intensified!"))
  5903. return 0
  5904. end
  5905. end
  5906. ################################################################################
  5907. # For 5 rounds, user becomes airborne. (Magnet Rise)
  5908. ################################################################################
  5909. class PokeBattle_Move_119 < PokeBattle_Move
  5910. def unusableInGravity?
  5911. return true
  5912. end
  5913.  
  5914. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5915. if attacker.effects[PBEffects::Ingrain] ||
  5916. attacker.effects[PBEffects::MagnetRise]>0
  5917. @battle.pbDisplay(_INTL("But it failed!"))
  5918. return -1
  5919. end
  5920. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  5921. attacker.effects[PBEffects::MagnetRise]=5
  5922. @battle.pbDisplay(_INTL("{1} levitated with electromagnetism!",attacker.pbThis))
  5923. return 0
  5924. end
  5925. end
  5926. ################################################################################
  5927. # Hits airborne semi-invulnerable targets. (Sky Uppercut)
  5928. ################################################################################
  5929. class PokeBattle_Move_11B < PokeBattle_Move
  5930. # Handled in Battler's pbSuccessCheck, do not edit!
  5931. end
  5932. ################################################################################
  5933. # For 5 rounds, for each priority bracket, slow Pokémon move before fast ones.
  5934. # (Trick Room)
  5935. ################################################################################
  5936. class PokeBattle_Move_11F < PokeBattle_Move
  5937. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5938. if @battle.field.effects[PBEffects::TrickRoom]>0
  5939. @battle.field.effects[PBEffects::TrickRoom]=0
  5940. @battle.pbDisplay(_INTL("{1} reverted the dimensions!",attacker.pbThis))
  5941. else
  5942. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5943. @battle.field.effects[PBEffects::TrickRoom]=5
  5944. @battle.pbDisplay(_INTL("{1} twisted the dimensions!",attacker.pbThis))
  5945. end
  5946. return 0
  5947. end
  5948. end
  5949. ################################################################################
  5950. # Fails unless user has already used all other moves it knows. (Last Resort)
  5951. ################################################################################
  5952. class PokeBattle_Move_125 < PokeBattle_Move
  5953. def pbMoveFailed(attacker,opponent)
  5954. counter=0; nummoves=0
  5955. for move in attacker.moves
  5956. next if move.id<=0
  5957. counter+=1 if move.id!=@id && !attacker.movesUsed.include?(move.id)
  5958. nummoves+=1
  5959. end
  5960. return counter!=0 || nummoves==1
  5961. end
  5962. end
  5963. ################################################################################
  5964. # Increases ally's Special Defense by 1 stage. (Aromatic Mist)
  5965. ################################################################################
  5966. class PokeBattle_Move_138 < PokeBattle_Move
  5967. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5968. if !@battle.doublebattle || !opponent ||
  5969. !opponent.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  5970. @battle.pbDisplay(_INTL("But it failed!"))
  5971. return -1
  5972. end
  5973. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  5974. ret=attacker.pbIncreaseStat(PBStats::SPDEF,1,attacker,false,self)
  5975. return ret ? 0 : -1
  5976. end
  5977. end
  5978. ################################################################################
  5979. # Increases the Defense of all Grass-type Pokémon on the field by 1 stage each.
  5980. # (Flower Shield)
  5981. ################################################################################
  5982. class PokeBattle_Move_13F < PokeBattle_Move
  5983. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  5984. didsomething=false
  5985. for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
  5986. next if !i || i.isFainted?
  5987. next if !i.pbHasType?(:GRASS)
  5988. next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  5989. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
  5990. didsomething=true
  5991. showanim=true
  5992. if i.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  5993. i.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  5994. showanim=false
  5995. end
  5996. end
  5997. if !didsomething
  5998. @battle.pbDisplay(_INTL("But it failed!"))
  5999. return -1
  6000. end
  6001. return 0
  6002. end
  6003. end
  6004. ################################################################################
  6005. # User's side is protected against status moves this round. (Crafty Shield)
  6006. ################################################################################
  6007. class PokeBattle_Move_14A < PokeBattle_Move
  6008. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6009. if attacker.pbOwnSide.effects[PBEffects::CraftyShield]
  6010. @battle.pbDisplay(_INTL("But it failed!"))
  6011. return -1
  6012. end
  6013. unmoved=false
  6014. for poke in @battle.battlers
  6015. next if poke.index==attacker.index
  6016. if @battle.choices[poke.index][0]==1 && # Chose a move
  6017. !poke.hasMovedThisRound?
  6018. unmoved=true; break
  6019. end
  6020. end
  6021. if !unmoved
  6022. @battle.pbDisplay(_INTL("But it failed!"))
  6023. return -1
  6024. end
  6025. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6026. attacker.pbOwnSide.effects[PBEffects::CraftyShield]=true
  6027. if !@battle.pbIsOpposing?(attacker.index)
  6028. @battle.pbDisplay(_INTL("Crafty Shield protected your team!"))
  6029. else
  6030. @battle.pbDisplay(_INTL("Crafty Shield protected the opposing team!"))
  6031. end
  6032. return 0
  6033. end
  6034. end
  6035. ################################################################################
  6036. # Two turn attack. Skips first turn, increases the user's Special Attack,
  6037. # Special Defense and Speed by 2 stages each second turn. (Geomancy)
  6038. ################################################################################
  6039. class PokeBattle_Move_14E < PokeBattle_Move
  6040. def pbTwoTurnAttack(attacker)
  6041. @immediate=false
  6042. if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  6043. @immediate=true
  6044. end
  6045. return false if @immediate
  6046. return attacker.effects[PBEffects::TwoTurnAttack]==0
  6047. end
  6048.  
  6049. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6050. if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  6051. pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  6052. @battle.pbDisplay(_INTL("{1} is absorbing power!",attacker.pbThis))
  6053. end
  6054. if @immediate
  6055. @battle.pbCommonAnimation("UseItem",attacker,nil)
  6056. @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  6057. attacker.pbConsumeItem
  6058. end
  6059. return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  6060. if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
  6061. !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
  6062. !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  6063. @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
  6064. return -1
  6065. end
  6066. pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  6067. showanim=true
  6068. if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  6069. attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
  6070. showanim=false
  6071. end
  6072. if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
  6073. attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self,showanim)
  6074. showanim=false
  6075. end
  6076. if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
  6077. attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
  6078. showanim=false
  6079. end
  6080. return 0
  6081. end
  6082. end
  6083. ################################################################################
  6084. # User gains 3/4 the HP it inflicts as damage. (Draining Kiss)
  6085. ################################################################################
  6086. class PokeBattle_Move_14F < PokeBattle_Move
  6087. def isHealingMove?
  6088. return USENEWBATTLEMECHANICS
  6089. end
  6090.  
  6091. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6092. ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  6093. if opponent.damagestate.calcdamage>0
  6094. hpgain=(opponent.damagestate.hplost*3/4).round
  6095. if opponent.hasWorkingAbility(:LIQUIDOOZE)
  6096. attacker.pbReduceHP(hpgain,true)
  6097. @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
  6098. elsif attacker.effects[PBEffects::HealBlock]==0
  6099. hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
  6100. attacker.pbRecoverHP(hpgain,true)
  6101. @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
  6102. end
  6103. end
  6104. return ret
  6105. end
  6106. end
  6107. ################################################################################
  6108. # No Pokémon can switch out or flee until the end of the next round, as long as
  6109. # the user remains active. (Fairy Lock)
  6110. ################################################################################
  6111. class PokeBattle_Move_152 < PokeBattle_Move
  6112. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6113. if @battle.field.effects[PBEffects::FairyLock]>0
  6114. @battle.pbDisplay(_INTL("But it failed!"))
  6115. return -1
  6116. end
  6117. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6118. @battle.field.effects[PBEffects::FairyLock]=2
  6119. @battle.pbDisplay(_INTL("No one will be able to run away during the next turn!"))
  6120. return 0
  6121. end
  6122. end
  6123. ################################################################################
  6124. # For 5 rounds, creates a misty terrain which weakens Dragon-type moves and
  6125. # protects Pokémon from status problems. Affects non-airborne Pokémon only.
  6126. # (Misty Terrain)
  6127. ################################################################################
  6128. class PokeBattle_Move_156 < PokeBattle_Move
  6129. def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6130. if @battle.field.effects[PBEffects::MistyTerrain]>0
  6131. @battle.pbDisplay(_INTL("But it failed!"))
  6132. return -1
  6133. end
  6134. pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  6135. @battle.field.effects[PBEffects::MistyTerrain]=5
  6136. @battle.pbDisplay(_INTL("Mist swirled about the battlefield!"))
  6137. return 0
  6138. end
  6139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement