Advertisement
StCooler

Script.rb

Feb 5th, 2022 (edited)
1,746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 38.38 KB | None | 0 0
  1. ###############################################################################
  2. #
  3. # Pokémon Legends Arceus Content
  4. #
  5. ###############################################################################
  6. #
  7. # This script updates the scripts to account for Frostbite, Drowsy, and the
  8. # new moves for Pokémon Legends Arceus.
  9. # Copy/paste this script in a new script above Main.
  10. #
  11. ###############################################################################
  12.  
  13.  
  14. PLA_STATUS_MODE_FROSTBITE = 0
  15. PLA_STATUS_MODE_DROWSY = 0
  16. # 0 = new moves inflict Drowsy and Frostbite (respectively), old moves keep
  17. #     inflicting Sleep and Freeze.
  18. # 1 = new moves AND old moves inflict Drowsy and Frostbite.
  19. #     NB: Value 1 does not change the behaviour of Rest, Comatose and Yawn
  20. #     and I don't want to waste my time.
  21. # 2 = new moves AND old moves inflict Sleep and Freeze.
  22.  
  23.  
  24. ###############################################################################
  25. # Adding the new effects Victory Dance, Ceaseless Edge and such.
  26. ###############################################################################
  27.  
  28. module PBEffects
  29.   # Starts from 300 to avoid conflicts with other plugins.
  30.   PowerShift          = 300
  31.   StoneAxe            = 301
  32.   CeaselessEdge       = 302
  33.   VictoryDance        = 303
  34. end
  35.  
  36. class PokeBattle_Battler
  37.   alias __pla__pbInitEffects pbInitEffects
  38.   def pbInitEffects(batonPass)
  39.     __pla__pbInitEffects(batonPass)
  40.     if batonPass
  41.       if @effects[PBEffects::PowerShift]
  42.         @attack,@defense = @defense,@attack
  43.         @spatk,@spdef = @spdef,@spatk
  44.       end
  45.     else
  46.       @effects[PBEffects::VictoryDance]      = false
  47.       @effects[PBEffects::PowerShift]        = false
  48.     end
  49.    
  50.     @effects[PBEffects::StoneAxe]            = -1
  51.     @effects[PBEffects::CeaselessEdge]       = -1
  52.   end
  53. end
  54.  
  55. ###############################################################################
  56. # Adding the new statuses Frostbite and Drowsy.
  57. ###############################################################################
  58.  
  59. class PokeBattle_Battler
  60.   #=============================================================================
  61.   # Freeze
  62.   #=============================================================================
  63.   alias __pla__pbCanFreeze pbCanFreeze?
  64.   def pbCanFreeze?(user,showMessages,move=nil)
  65.     case PLA_STATUS_MODE_FROSTBITE
  66.     when 1 # Frostbite instead.
  67.       return pbCanInflictStatus?(PBStatuses::FROSTBITE,user,showMessages,move)
  68.     else
  69.       return __pla__pbCanFreeze(user,showMessages,move)
  70.     end
  71.   end
  72.  
  73.   alias __pla__pbFreeze pbFreeze
  74.   def pbFreeze(msg=nil)
  75.     case PLA_STATUS_MODE_FROSTBITE
  76.     when 1 # Frostbite instead.
  77.       pbInflictStatus(PBStatuses::FROSTBITE,0,msg)
  78.     else
  79.       __pla__pbFreeze(msg)
  80.     end
  81.   end
  82.  
  83.   #=============================================================================
  84.   # Frostbitten (Pokémon Legends: Arceus)
  85.   #=============================================================================
  86.   def frostbitten?
  87.     return pbHasStatus?(PBStatuses::FROSTBITE)
  88.   end
  89.  
  90.   def pbCanFrostbite?(user,showMessages,move=nil)
  91.     case PLA_STATUS_MODE_FROSTBITE
  92.     when 2 # Freeze instead.
  93.       return __pla__pbCanFreeze(user,showMessages,move)
  94.     else
  95.       return pbCanInflictStatus?(PBStatuses::FROSTBITE,user,showMessages,move)
  96.     end
  97.   end
  98.  
  99.   def pbCanFrostbiteSynchronize?(target)
  100.     return false if PLA_STATUS_MODE_FROSTBITE == 2 # Can't synchronize Freeze.
  101.     return pbCanSynchronizeStatus?(PBStatuses::FROSTBITE,target)
  102.   end
  103.  
  104.   def pbFrostbite(user=nil,msg=nil)
  105.     case PLA_STATUS_MODE_FROSTBITE
  106.     when 2 # Freeze instead.
  107.       __pla__pbFreeze(msg)
  108.     else
  109.       pbInflictStatus(PBStatuses::FROSTBITE,0,msg,user)
  110.     end
  111.   end
  112.   #=============================================================================
  113.   # Sleep
  114.   #=============================================================================
  115.   alias __pla__pbCanSleep pbCanSleep?
  116.   def pbCanSleep?(user,showMessages,move=nil,ignoreStatus=false)
  117.     case PLA_STATUS_MODE_DROWSY
  118.     when 1 # Drowse instead.
  119.       return pbCanInflictStatus?(PBStatuses::DROWSY,user,showMessages,move,ignoreStatus)
  120.     else
  121.       return __pla__pbCanSleep(user,showMessages,move,ignoreStatus)
  122.     end
  123.   end
  124.  
  125.   alias __pla__pbSleep pbSleep
  126.   def pbSleep(msg=nil)
  127.     case PLA_STATUS_MODE_DROWSY
  128.     when 1 # Drowse instead.
  129.       pbInflictStatus(PBStatuses::DROWSY,0,msg)
  130.     else
  131.       __pla__pbSleep(msg)
  132.     end
  133.   end
  134.  
  135.   alias __pla__pbSleepSelf pbSleepSelf
  136.   def pbSleepSelf(msg=nil,duration=-1)
  137.     case PLA_STATUS_MODE_DROWSY
  138.     when 1 # Drowse instead.
  139.       pbInflictStatus(PBStatuses::DROWSY,0,msg)
  140.     else
  141.       __pla__pbSleepSelf(msg,duration)
  142.     end
  143.   end
  144.  
  145.  
  146.   #=============================================================================
  147.   # Drowsy (Pokémon Legends: Arceus)
  148.   #=============================================================================
  149.   def drowsy?
  150.     return pbHasStatus?(PBStatuses::DROWSY)
  151.   end
  152.  
  153.   def pbCanDrowse?(user,showMessages,move=nil)
  154.     case PLA_STATUS_MODE_DROWSY
  155.     when 2 # Sleep instead.
  156.       return pbCanInflictStatus?(PBStatuses::SLEEP,user,showMessages,move)
  157.     else
  158.       return pbCanInflictStatus?(PBStatuses::DROWSY,user,showMessages,move)
  159.     end
  160.   end
  161.  
  162.   def pbCanDrowseSynchronize?(target)
  163.     return false if PLA_STATUS_MODE_DROWSY == 2 # Can't synchronize Sleep.
  164.     return pbCanSynchronizeStatus?(PBStatuses::DROWSY,target)
  165.   end
  166.  
  167.   def pbDrowse(user=nil,msg=nil)
  168.     case PLA_STATUS_MODE_DROWSY
  169.     when 2 # Sleep instead.
  170.       pbInflictStatus(PBStatuses::SLEEP,pbSleepDuration,msg)
  171.     else
  172.       pbInflictStatus(PBStatuses::DROWSY,0,msg,user)
  173.     end
  174.   end
  175.  
  176.  
  177.   #=============================================================================
  178.   # Un-drowse / de-frostbite at the end of a move.
  179.   #=============================================================================
  180.   alias __pla__pbEffectsAfterMove pbEffectsAfterMove
  181.   def pbEffectsAfterMove(user,targets,move,numHits)
  182.     # Un-drowse
  183.     if move.damagingMove?
  184.       targets.each do |b|
  185.         next if b.damageState.unaffected || b.damageState.substitute
  186.         next if b.status!=PBStatuses::DROWSY
  187.         # NOTE: non-cannon.
  188.         # I decide that Electric moves un-drowse the target.
  189.         if isConst?(move.calcType,PBTypes,:ELECTRIC) ||
  190.            (NEWEST_BATTLE_MECHANICS && move.undrowsesUser?)
  191.           b.pbCureStatus
  192.         end
  193.       end
  194.     end
  195.     # De-frostbite
  196.     if move.damagingMove?
  197.       targets.each do |b|
  198.         next if b.damageState.unaffected || b.damageState.substitute
  199.         next if b.status!=PBStatuses::FROSTBITE
  200.         # NOTE: non-cannon.
  201.         # I decide that Fire-type moves un-frostbite the target.
  202.         if isConst?(move.calcType,PBTypes,:FIRE) ||
  203.            (NEWEST_BATTLE_MECHANICS && move.thawsUser?)
  204.           b.pbCureStatus
  205.         end
  206.       end
  207.     end
  208.     __pla__pbEffectsAfterMove(user,targets,move,numHits)
  209.   end
  210. end
  211.  
  212.  
  213. # Weaken most moves if the Pokémon is Frostbitten.
  214. class PokeBattle_Move
  215.   def damageReducedByFrostbite?; return true;  end
  216.  
  217.   def undrowsesUser?
  218.     return [PBMoves::WILDCHARGE, PBMoves::SPARK, PBMoves::VOLTTACKLE].include?(@id)
  219.   end
  220. end
  221.  
  222.  
  223.  
  224. ###############################################################################
  225. # Updated moves to take into account the new statuses Drowsy and Frostbite.
  226. ###############################################################################
  227.  
  228. #===============================================================================
  229. # Cures user of burn, poison and paralysis. (Refresh)
  230. # Now also cures Frostbite and Drowsy.
  231. #===============================================================================
  232. class PokeBattle_Move_018 < PokeBattle_Move
  233.   def pbMoveFailed?(user,targets)
  234.     if user.status!=PBStatuses::BURN &&
  235.        user.status!=PBStatuses::POISON &&
  236.        user.status!=PBStatuses::PARALYSIS &&
  237.        user.status!=PBStatuses::FROSTBITE &&
  238.        user.status!=PBStatuses::DROWSY
  239.       @battle.pbDisplay(_INTL("But it failed!"))
  240.       return true
  241.     end
  242.     return false
  243.   end
  244.  
  245.   def pbEffectGeneral(user)
  246.     t = user.status
  247.     user.pbCureStatus(false)
  248.     case t
  249.     when PBStatuses::BURN
  250.       @battle.pbDisplay(_INTL("{1} healed its burn!",user.pbThis))
  251.     when PBStatuses::POISON
  252.       @battle.pbDisplay(_INTL("{1} cured its poisoning!",user.pbThis))
  253.     when PBStatuses::PARALYSIS
  254.       @battle.pbDisplay(_INTL("{1} cured its paralysis!",user.pbThis))
  255.     when PBStatuses::FROSTBITE
  256.       @battle.pbDisplay(_INTL("{1} healed its frostbite",curedName))
  257.     when PBStatuses::DROWSY
  258.       @battle.pbDisplay(_INTL("{1} is longer drowsy!",curedName))
  259.     end
  260.   end
  261. end
  262.  
  263. #===============================================================================
  264. # Cures all party Pokémon of permanent status problems. (Aromatherapy, Heal Bell)
  265. # Now also cures Frostbite and Drowsy.
  266. #===============================================================================
  267. class PokeBattle_Move_019 < PokeBattle_Move
  268.   def pbAromatherapyHeal(pkmn,battler=nil)
  269.     oldStatus = (battler) ? battler.status : pkmn.status
  270.     curedName = (battler) ? battler.pbThis : pkmn.name
  271.     if battler
  272.       battler.pbCureStatus(false)
  273.     else
  274.       pkmn.status      = PBStatuses::NONE
  275.       pkmn.statusCount = 0
  276.     end
  277.     case oldStatus
  278.     when PBStatuses::SLEEP
  279.       @battle.pbDisplay(_INTL("{1} was woken from sleep.",curedName))
  280.     when PBStatuses::POISON
  281.       @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",curedName))
  282.     when PBStatuses::BURN
  283.       @battle.pbDisplay(_INTL("{1}'s burn was healed.",curedName))
  284.     when PBStatuses::PARALYSIS
  285.       @battle.pbDisplay(_INTL("{1} was cured of paralysis.",curedName))
  286.     when PBStatuses::FROZEN
  287.       @battle.pbDisplay(_INTL("{1} was thawed out.",curedName))
  288.     when PBStatuses::FROSTBITE
  289.       @battle.pbDisplay(_INTL("{1}'s frostbite was healed.",curedName))
  290.     when PBStatuses::DROWSY
  291.       @battle.pbDisplay(_INTL("{1} was pulled out of drowsiness.",curedName))
  292.     end
  293.   end
  294. end
  295.  
  296. #===============================================================================
  297. # User passes its status problem to the target. (Psycho Shift)
  298. # Now also passes Frostbite and Drowsy.
  299. #===============================================================================
  300. class PokeBattle_Move_01B < PokeBattle_Move
  301.   def pbEffectAgainstTarget(user,target)
  302.     msg = ""
  303.     case user.status
  304.     when PBStatuses::SLEEP
  305.       target.pbSleep
  306.       msg = _INTL("{1} woke up.",user.pbThis)
  307.     when PBStatuses::POISON
  308.       target.pbPoison(user,nil,user.statusCount!=0)
  309.       msg = _INTL("{1} was cured of its poisoning.",user.pbThis)
  310.     when PBStatuses::BURN
  311.       target.pbBurn(user)
  312.       msg = _INTL("{1}'s burn was healed.",user.pbThis)
  313.     when PBStatuses::PARALYSIS
  314.       target.pbParalyze(user)
  315.       msg = _INTL("{1} was cured of paralysis.",user.pbThis)
  316.     when PBStatuses::FROZEN
  317.       target.pbFreeze
  318.       msg = _INTL("{1} was thawed out.",user.pbThis)
  319.     when PBStatuses::FROSTBITE
  320.       target.pbFrostbite(user)
  321.       msg = _INTL("{1}'s frostbite was healed.",user.pbThis)
  322.     when PBStatuses::DROWSY
  323.       target.pbDrowse(user)
  324.       msg = _INTL("{1} is no longer drowsy.",user.pbThis)
  325.     end
  326.     if msg!=""
  327.       user.pbCureStatus(false)
  328.       @battle.pbDisplay(msg)
  329.     end
  330.   end
  331. end
  332.  
  333. #===============================================================================
  334. # Power is doubled if the target is asleep. Wakes the target up. (Wake-Up Slap)
  335. # Also cures Drowsy.
  336. #===============================================================================
  337. class PokeBattle_Move_07D < PokeBattle_Move
  338.   def pbEffectAfterAllHits(user,target)
  339.     return if target.fainted?
  340.     return if target.damageState.unaffected || target.damageState.substitute
  341.     return if target.status!=PBStatuses::SLEEP && target.status!=PBStatuses::DROWSY
  342.     target.pbCureStatus
  343.   end
  344. end
  345.  
  346. #===============================================================================
  347. # User must use this move for 2 more rounds. No battlers can sleep. (Uproar)
  348. # Also cures Drowsy.
  349. #===============================================================================
  350. class PokeBattle_Move_0D1 < PokeBattle_Move
  351.   def pbEffectGeneral(user)
  352.     return if user.effects[PBEffects::Uproar]>0
  353.     user.effects[PBEffects::Uproar] = 3
  354.     user.currentMove = @id
  355.     @battle.pbDisplay(_INTL("{1} caused an uproar!",user.pbThis))
  356.     @battle.pbPriority(true).each do |b|
  357.       next if b.fainted? || (b.status!=PBStatuses::SLEEP && b.status!=PBStatuses::DROWSY)
  358.       next if b.hasActiveAbility?(:SOUNDPROOF)
  359.       b.pbCureStatus
  360.     end
  361.   end
  362. end
  363.  
  364. #===============================================================================
  365. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  366. # (Rapid Spin)
  367. # Also removes Ceaseless Edge, and Stone Axe.
  368. #===============================================================================
  369. class PokeBattle_Move_110 < PokeBattle_Move
  370.   def pbEffectAfterAllHits(user,target)
  371.     return if user.fainted? || target.damageState.unaffected
  372.     if user.effects[PBEffects::Trapping]>0
  373.       trapMove = PBMoves.getName(user.effects[PBEffects::TrappingMove])
  374.       trapUser = @battle.battlers[user.effects[PBEffects::TrappingUser]]
  375.       @battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",user.pbThis,trapUser.pbThis(true),trapMove))
  376.       user.effects[PBEffects::Trapping]     = 0
  377.       user.effects[PBEffects::TrappingMove] = 0
  378.       user.effects[PBEffects::TrappingUser] = -1
  379.     end
  380.     if user.effects[PBEffects::LeechSeed]>=0
  381.       user.effects[PBEffects::LeechSeed] = -1
  382.       @battle.pbDisplay(_INTL("{1} shed Leech Seed!",user.pbThis))
  383.     end
  384.     if user.pbOwnSide.effects[PBEffects::StealthRock]
  385.       user.pbOwnSide.effects[PBEffects::StealthRock] = false
  386.       @battle.pbDisplay(_INTL("{1} blew away stealth rocks!",user.pbThis))
  387.     end
  388.     if user.pbOwnSide.effects[PBEffects::Spikes]>0
  389.       user.pbOwnSide.effects[PBEffects::Spikes] = 0
  390.       @battle.pbDisplay(_INTL("{1} blew away spikes!",user.pbThis))
  391.     end
  392.     if user.pbOwnSide.effects[PBEffects::ToxicSpikes]>0
  393.       user.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0
  394.       @battle.pbDisplay(_INTL("{1} blew away poison spikes!",user.pbThis))
  395.     end
  396.     if user.pbOwnSide.effects[PBEffects::StickyWeb]
  397.       user.pbOwnSide.effects[PBEffects::StickyWeb] = false
  398.       user.pbOwnSide.effects[PBEffects::StickyWebUser] = -1
  399.       @battle.pbDisplay(_INTL("{1} blew away sticky webs!",user.pbThis))
  400.     end
  401.     # Pokémon Legends: Arceus
  402.     if user.effects[PBEffects::CeaselessEdge] > -1 ||
  403.       user.effects[PBEffects::StoneAxe] > -1
  404.       user.effects[PBEffects::StoneAxe] = -1
  405.       user.effects[PBEffects::CeaselessEdge] = -1
  406.       @battle.pbDisplay(_INTL("{1} blew away the splinters!",user.pbThis))
  407.     end
  408.     user.pbRaiseStatStage(PBStats::SPEED,1,user)
  409.   end
  410. end
  411.  
  412.  
  413. #===============================================================================
  414. # Cures the target's burn and frostbite. (Sparkling Aria)
  415. #===============================================================================
  416. class PokeBattle_Move_15A < PokeBattle_Move
  417.   def pbAdditionalEffect(user,target)
  418.     return if target.fainted? || target.damageState.substitute
  419.     return if target.status!=PBStatuses::BURN && target.status!=PBStatuses::FROSTBITE
  420.     target.pbCureStatus
  421.   end
  422. end
  423.  
  424.  
  425.  
  426. ###############################################################################
  427. #
  428. # New moves from Pokémon Legends Arceus
  429. #
  430. ###############################################################################
  431.  
  432. #===============================================================================
  433. # Paralyzes, poisons or forces the target to sleep. (Dire Claw)
  434. # Note: the sleep effect is adapted from Pokémon Legends: Arceus's Drowsy status.
  435. #===============================================================================
  436. class PokeBattle_Move_200 < PokeBattle_Move
  437.   def pbAdditionalEffect(user,target)
  438.     return if target.damageState.substitute
  439.     case @battle.pbRandom(3)
  440.     when 0; target.pbDrowse(user) if target.pbCanDrowse?(user,false,self)
  441.     when 1; target.pbPoison(user) if target.pbCanPoison?(user,false,self)
  442.     when 2; target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
  443.     end
  444.   end
  445. end
  446.  
  447. #===============================================================================
  448. # Swaps the user's offensive and defensive stats. (Power Shift)
  449. # Note: To me this means inverting both attack / special attack with
  450. # defense / special defense.
  451. #===============================================================================
  452. class PokeBattle_Move_201 < PokeBattle_Move
  453.   def pbEffectGeneral(user)
  454.     user.attack,user.defense = user.defense,user.attack
  455.     user.spatk,user.spdef = user.spdef,user.spatk
  456.     user.effects[PBEffects::PowerShift] = !user.effects[PBEffects::PowerShift]
  457.     @battle.pbDisplay(_INTL("{1} switched its offensive and defensive stats!",user.pbThis))
  458.   end
  459. end
  460.  
  461. #===============================================================================
  462. # After the hit, leaves a specific damaging effect. (Stone Axe, Ceaseless Edge)
  463. #===============================================================================
  464. class PokeBattle_Move_202 < PokeBattle_Move
  465.   def pbEffectAgainstTarget(user,target)
  466.     return if target.effects[PBEffects::StoneAxe] > -1
  467.     target.effects[PBEffects::StoneAxe] = 3+rand(3)
  468.     @battle.pbDisplay(_INTL("Splinters spread around {1}!",target.pbThis(true)))
  469.   end
  470. end
  471.  
  472. class PokeBattle_Move_203 < PokeBattle_Move
  473.   def pbEffectAgainstTarget(user,target)
  474.     return if target.effects[PBEffects::CeaselessEdge] > -1
  475.     target.effects[PBEffects::CeaselessEdge] = 3+rand(3)
  476.     @battle.pbDisplay(_INTL("Splinters spread around {1}!",target.pbThis(true)))
  477.   end
  478. end
  479.  
  480. #===============================================================================
  481. # Either boost the user's offensive stats, or decreases the target's defensive
  482. # stats, depending on form. (Springtide Storm)
  483. #===============================================================================
  484. class PokeBattle_Move_204 < PokeBattle_Move
  485.   def initialize(battle,move)
  486.     super
  487.     @statUp = [PBStats::ATTACK,1,PBStats::SPATK,1]
  488.     @statDown = [PBStats::DEFENSE,1,PBStats::SPDEF,1]
  489.   end
  490.  
  491.   def pbAdditionalEffect(user,target)
  492.     # return if user.species != PBSpecies::ENAMORUS # DEBUG
  493.     showAnim = true
  494.    
  495.     if user.form == 1
  496.       # Decreases the target's stats.
  497.       return if target.damageState.substitute
  498.       for i in 0...@statDown.length/2
  499.         next if !target.pbCanLowerStatStage?(@statDown[i*2],user,self)
  500.         if target.pbLowerStatStage(@statDown[i*2],@statDown[i*2+1],user,showAnim)
  501.           showAnim = false
  502.         end
  503.       end
  504.     else
  505.       # Increases the user's stats.
  506.       for i in 0...@statUp.length/2
  507.         next if !user.pbCanRaiseStatStage?(@statUp[i*2],user,self)
  508.         if user.pbRaiseStatStage(@statUp[i*2],@statUp[i*2+1],user,showAnim)
  509.           showAnim = false
  510.         end
  511.       end
  512.     end
  513.   end
  514. end
  515.  
  516. #===============================================================================
  517. # Either boost offensive stats, or defensive stats, depending on the stats of
  518. # the Pokémon. (Mystical Power)
  519. #===============================================================================
  520. class PokeBattle_Move_205 < PokeBattle_Move
  521.   def pbAdditionalEffect(user,target)
  522.     showAnim = true
  523.     statUp = []
  524.     if user.attack + user.spatk >= user.defense + user.spdef
  525.       # Increases the user's offensive stats.
  526.       statUp = [PBStats::ATTACK,1,PBStats::SPATK,1]
  527.     else
  528.       statUp = [PBStats::DEFENSE,1,PBStats::SPDEF,1]
  529.     end
  530.    
  531.     for i in 0...statUp.length/2
  532.       next if !user.pbCanRaiseStatStage?(statUp[i*2],user,self)
  533.       if user.pbRaiseStatStage(statUp[i*2],statUp[i*2+1],user,showAnim)
  534.         showAnim = false
  535.       end
  536.     end
  537.   end
  538. end
  539.  
  540. #===============================================================================
  541. # Recoil + boosts the user's speed. (Wave Crash)
  542. #===============================================================================
  543. class PokeBattle_Move_206 < PokeBattle_StatUpMove
  544.   def initialize(battle,move)
  545.     super
  546.     @statUp = [PBStats::SPEED,1]
  547.   end
  548.  
  549.   def recoilMove?;                 return true; end
  550.  
  551.   def pbRecoilDamage(user,target)
  552.     return (target.damageState.totalHPLost/4.0).round
  553.   end
  554.  
  555.   def pbEffectAfterAllHits(user,target)
  556.     return if target.damageState.unaffected
  557.     return if !user.takesIndirectDamage?
  558.     return if user.hasActiveAbility?(:ROCKHEAD)
  559.     amt = pbRecoilDamage(user,target)
  560.     amt = 1 if amt<1
  561.     user.pbReduceHP(amt,false)
  562.     @battle.pbDisplay(_INTL("{1} is damaged by recoil!",user.pbThis))
  563.     user.pbItemHPHealCheck
  564.   end
  565. end
  566.  
  567. #===============================================================================
  568. # Heavy recoil + decreases the user's speed. (Chloroblast)
  569. #===============================================================================
  570. class PokeBattle_Move_207 < PokeBattle_StatDownMove
  571.   def initialize(battle,move)
  572.     super
  573.     @statDown = [PBStats::SPEED,1]
  574.   end
  575.  
  576.   def recoilMove?;                 return true; end
  577.  
  578.   def pbRecoilDamage(user,target)
  579.     return (target.damageState.totalHPLost/2.0).round
  580.   end
  581.  
  582.   def pbEffectAfterAllHits(user,target)
  583.     return if target.damageState.unaffected
  584.     return if !user.takesIndirectDamage?
  585.     return if user.hasActiveAbility?(:ROCKHEAD)
  586.     amt = pbRecoilDamage(user,target)
  587.     amt = 1 if amt<1
  588.     user.pbReduceHP(amt,false)
  589.     @battle.pbDisplay(_INTL("{1} is damaged by recoil!",user.pbThis))
  590.     user.pbItemHPHealCheck
  591.   end
  592. end
  593.  
  594. #===============================================================================
  595. # Boosts stats + bonus effect. (Victory Dance)
  596. #===============================================================================
  597. class PokeBattle_Move_208 < PokeBattle_MultiStatUpMove
  598.   def initialize(battle,move)
  599.     super
  600.     @statUp = [PBStats::ATTACK,1,PBStats::DEFENSE,1,
  601.                PBStats::SPATK,1,PBStats::SPDEF,1]
  602.   end
  603.  
  604.   def pbAdditionalEffect(user,target)
  605.     super
  606.    
  607.     if !user.effects[PBEffects::VictoryDance]
  608.       user.effects[PBEffects::VictoryDance] = true
  609.       @battle.pbDisplay(_INTL("{1} dances in victory!", user.pbThis))
  610.     end
  611.   end
  612. end
  613.  
  614. #===============================================================================
  615. # Bonus damage if target has a status effect + can inflict status.
  616. # (Barb Barrage, Bitter Malice, Infernal Parade)
  617. #===============================================================================
  618.  
  619. class PokeBattle_StatusAndBonusDamageMove < PokeBattle_Move
  620.   def initialize(battle,move)
  621.     super
  622.     @status = PBStatuses::NONE
  623.   end
  624.  
  625.   def pbBaseDamage(baseDmg,user,target)
  626.     if target.pbHasAnyStatus? &&
  627.        (target.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(user))
  628.       baseDmg *= 2
  629.     end
  630.     return baseDmg
  631.   end
  632.  
  633.   def pbAdditionalEffect(user,target)
  634.     return if target.damageState.substitute
  635.     target.pbInflictStatus(@status,0,nil,user) if target.pbCanInflictStatus?(@status,user,false,self)
  636.   end
  637. end
  638.  
  639. # Barb Barrage
  640. class PokeBattle_Move_209 < PokeBattle_StatusAndBonusDamageMove
  641.   def initialize(battle,move)
  642.     super
  643.     @status = PBStatuses::POISON
  644.   end
  645. end
  646.  
  647. # Bitter Malice
  648. class PokeBattle_Move_210 < PokeBattle_StatusAndBonusDamageMove
  649.   def initialize(battle,move)
  650.     super
  651.     @status = PBStatuses::FROSTBITE
  652.   end
  653. end
  654.  
  655. # Infernal Parade
  656. class PokeBattle_Move_211 < PokeBattle_StatusAndBonusDamageMove
  657.   def initialize(battle,move)
  658.     super
  659.     @status = PBStatuses::BURN
  660.   end
  661. end
  662.  
  663. #===============================================================================
  664. # Raises critical hit ratio + decreases defense. (Triple Arrows)
  665. #===============================================================================
  666.  
  667. class PokeBattle_Move_212 < PokeBattle_TargetStatDownMove
  668.   def initialize(battle,move)
  669.     super
  670.     @statDown = [PBStats::DEFENSE, 1]
  671.   end
  672.  
  673.   def pbEffectAfterAllHits(user,target)
  674.     return if user.effects[PBEffects::FocusEnergy] > 2
  675.     user.effects[PBEffects::FocusEnergy] = 2
  676.     @battle.pbDisplay(_INTL("{1} is getting pumped!",user.pbThis))
  677.   end
  678. end
  679.  
  680.  
  681. #===============================================================================
  682. # Generic Frostbite-inflicting move.
  683. #===============================================================================
  684. class PokeBattle_FrostbiteMove < PokeBattle_Move
  685.   def pbFailsAgainstTarget?(user,target)
  686.     return false if damagingMove?
  687.     return !target.pbCanFrostbite?(user,true,self)
  688.   end
  689.  
  690.   def pbEffectAgainstTarget(user,target)
  691.     return if damagingMove?
  692.     target.pbFrostbite(user,nil)
  693.   end
  694.  
  695.   def pbAdditionalEffect(user,target)
  696.     return if target.damageState.substitute
  697.     target.pbFrostbite(user,nil) if target.pbCanFrostbite?(user,false,self)
  698.   end
  699. end
  700.  
  701. #===============================================================================
  702. # Generic Drowsiness-inflicting move.
  703. #===============================================================================
  704. class PokeBattle_DrowsyMove < PokeBattle_Move
  705.   def pbFailsAgainstTarget?(user,target)
  706.     return false if damagingMove?
  707.     return !target.pbCanDrowse?(user,true,self)
  708.   end
  709.  
  710.   def pbEffectAgainstTarget(user,target)
  711.     return if damagingMove?
  712.     target.pbDrowse(user,nil)
  713.   end
  714.  
  715.   def pbAdditionalEffect(user,target)
  716.     return if target.damageState.substitute
  717.     target.pbDrowse(user,nil) if target.pbCanDrowse?(user,false,self)
  718.   end
  719. end
  720.  
  721. #===============================================================================
  722. # Inflicts Frostbite. (Bleakwind Storm)
  723. #===============================================================================
  724. class PokeBattle_Move_213 < PokeBattle_FrostbiteMove
  725. end
  726.  
  727. #===============================================================================
  728. # Heals the user + cures its status. (Lunar Blessing)
  729. #===============================================================================
  730. class PokeBattle_Move_214 < PokeBattle_HealingMove
  731.   def pbHealAmount(user)
  732.     return (user.totalhp/3.0).round
  733.   end
  734.   def pbMoveFailed?(user,targets)
  735.     return false if user.pbHasAnyStatus?
  736.     return super
  737.   end
  738.   def pbEffectGeneral(user)
  739.     user.pbCureStatus
  740.     super
  741.   end
  742. end
  743.  
  744. #===============================================================================
  745. # Cures the user's status + raises its stats. (Take Heart)
  746. #===============================================================================
  747. class PokeBattle_Move_215 < PokeBattle_MultiStatUpMove
  748.   def initialize(battle,move)
  749.     super
  750.     @statUp = [PBStats::ATTACK, 1, PBStats::DEFENSE, 1,
  751.                   PBStats::SPATK, 1, PBStats::SPDEF, 1]
  752.   end
  753.  
  754.   def pbMoveFailed?(user,targets)
  755.     return false if user.pbHasAnyStatus?
  756.     return super
  757.   end
  758.  
  759.   def pbEffectGeneral(user)
  760.     user.pbCureStatus if user.pbHasAnyStatus?
  761.     super
  762.   end
  763. end
  764.  
  765.  
  766. ###############################################################################
  767. #
  768. # Update to abilities
  769. #
  770. ###############################################################################
  771.  
  772.  
  773. BattleHandlers::StatusImmunityAbility.add(:INSOMNIA,
  774.   proc { |ability,battler,status|
  775.     next true if status==PBStatuses::SLEEP
  776.     next true if status==PBStatuses::DROWSY
  777.   }
  778. )
  779.  
  780. BattleHandlers::StatusImmunityAllyAbility.add(:SWEETVEIL,
  781.   proc { |ability,battler,status|
  782.     next true if status==PBStatuses::SLEEP
  783.     next true if status==PBStatuses::DROWSY
  784.   }
  785. )
  786.  
  787.  
  788. BattleHandlers::StatusImmunityAbility.add(:MAGMAARMOR,
  789.   proc { |ability,battler,status|
  790.     next true if status==PBStatuses::FROZEN
  791.     next true if status==PBStatuses::FROSTBITE
  792.   }
  793. )
  794.  
  795.  
  796. BattleHandlers::StatusCureAbility.add(:INSOMNIA,
  797.   proc { |ability,battler|
  798.     next if (battler.status!=PBStatuses::SLEEP && battler.status!=PBStatuses::DROWSY)
  799.     battler.battle.pbShowAbilitySplash(battler)
  800.     battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
  801.     if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  802.       battler.battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,battler.abilityName))
  803.     end
  804.     battler.battle.pbHideAbilitySplash(battler)
  805.   }
  806. )
  807.  
  808. BattleHandlers::AbilityOnStatusInflicted.add(:SYNCHRONIZE,
  809.   proc { |ability,battler,user,status|
  810.     next if !user || user.index==battler.index
  811.     case status
  812.     when PBStatuses::POISON
  813.       if user.pbCanPoisonSynchronize?(battler)
  814.         battler.battle.pbShowAbilitySplash(battler)
  815.         msg = nil
  816.         if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  817.           msg = _INTL("{1}'s {2} poisoned {3}!",battler.pbThis,battler.abilityName,user.pbThis(true))
  818.         end
  819.         user.pbPoison(nil,msg,(battler.statusCount>0))
  820.         battler.battle.pbHideAbilitySplash(battler)
  821.       end
  822.     when PBStatuses::BURN
  823.       if user.pbCanBurnSynchronize?(battler)
  824.         battler.battle.pbShowAbilitySplash(battler)
  825.         msg = nil
  826.         if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  827.           msg = _INTL("{1}'s {2} burned {3}!",battler.pbThis,battler.abilityName,user.pbThis(true))
  828.         end
  829.         user.pbBurn(nil,msg)
  830.         battler.battle.pbHideAbilitySplash(battler)
  831.       end
  832.     when PBStatuses::PARALYSIS
  833.       if user.pbCanParalyzeSynchronize?(battler)
  834.         battler.battle.pbShowAbilitySplash(battler)
  835.         msg = nil
  836.         if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  837.           msg = _INTL("{1}'s {2} paralyzed {3}! It may be unable to move!",
  838.              battler.pbThis,battler.abilityName,user.pbThis(true))
  839.         end
  840.         user.pbParalyze(nil,msg)
  841.         battler.battle.pbHideAbilitySplash(battler)
  842.       end
  843.     when PBStatuses::FROSTBITE
  844.       if user.pbCanFrostbiteSynchronize?(battler)
  845.         battler.battle.pbShowAbilitySplash(battler)
  846.         msg = nil
  847.         if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  848.           msg = _INTL("{1}'s {2} frostbit {3}!",battler.pbThis,battler.abilityName,user.pbThis(true))
  849.         end
  850.         user.pbFrostbite(nil,msg)
  851.         battler.battle.pbHideAbilitySplash(battler)
  852.       end
  853.     when PBStatuses::DROWSY
  854.       if user.pbCanDrowseSynchronize?(battler)
  855.         battler.battle.pbShowAbilitySplash(battler)
  856.         msg = nil
  857.         if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  858.           msg = _INTL("{1}'s {2} made {3} drowsy!",
  859.              battler.pbThis,battler.abilityName,user.pbThis(true))
  860.         end
  861.         user.pbDrowse(nil,msg)
  862.         battler.battle.pbHideAbilitySplash(battler)
  863.       end
  864.     end
  865.   }
  866. )
  867.  
  868.  
  869. BattleHandlers::EORHealingAbility.add(:HEALER,
  870.   proc { |ability,battler,battle|
  871.     next unless battle.pbRandom(100)<30
  872.     battler.eachAlly do |b|
  873.       next if b.status==PBStatuses::NONE
  874.       battle.pbShowAbilitySplash(battler)
  875.       oldStatus = b.status
  876.       b.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
  877.       if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  878.         case oldStatus
  879.         when PBStatuses::SLEEP
  880.           battle.pbDisplay(_INTL("{1}'s {2} woke its partner up!",battler.pbThis,battler.abilityName))
  881.         when PBStatuses::POISON
  882.           battle.pbDisplay(_INTL("{1}'s {2} cured its partner's poison!",battler.pbThis,battler.abilityName))
  883.         when PBStatuses::BURN
  884.           battle.pbDisplay(_INTL("{1}'s {2} healed its partner's burn!",battler.pbThis,battler.abilityName))
  885.         when PBStatuses::PARALYSIS
  886.           battle.pbDisplay(_INTL("{1}'s {2} cured its partner's paralysis!",battler.pbThis,battler.abilityName))
  887.         when PBStatuses::FROZEN
  888.           battle.pbDisplay(_INTL("{1}'s {2} defrosted its partner!",battler.pbThis,battler.abilityName))
  889.         when PBStatuses::FROSTBITE
  890.           battle.pbDisplay(_INTL("{1}'s {2} healed its partner's frostbite!",battler.pbThis,battler.abilityName))
  891.         when PBStatuses::DROWSY
  892.           battle.pbDisplay(_INTL("{1}'s {2} pulled its partner out of drowsiness!",battler.pbThis,battler.abilityName))
  893.         end
  894.       end
  895.       battle.pbHideAbilitySplash(battler)
  896.     end
  897.   }
  898. )
  899.  
  900. BattleHandlers::EORHealingAbility.add(:HYDRATION,
  901.   proc { |ability,battler,battle|
  902.   if !battler.hasUtilityUmbrella?
  903.     next if battler.status==PBStatuses::NONE
  904.     curWeather = battle.pbWeather
  905.     next if curWeather!=PBWeather::Rain && curWeather!=PBWeather::HeavyRain
  906.     battle.pbShowAbilitySplash(battler)
  907.     oldStatus = battler.status
  908.     battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
  909.     if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  910.       case oldStatus
  911.       when PBStatuses::SLEEP
  912.         battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,battler.abilityName))
  913.       when PBStatuses::POISON
  914.         battle.pbDisplay(_INTL("{1}'s {2} cured its poison!",battler.pbThis,battler.abilityName))
  915.       when PBStatuses::BURN
  916.         battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",battler.pbThis,battler.abilityName))
  917.       when PBStatuses::PARALYSIS
  918.         battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",battler.pbThis,battler.abilityName))
  919.       when PBStatuses::FROZEN
  920.         battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,battler.abilityName))
  921.       when PBStatuses::FROSTBITE
  922.         battle.pbDisplay(_INTL("{1}'s {2} healed its frostbite!",battler.pbThis,battler.abilityName))
  923.       when PBStatuses::DROWSY
  924.         battle.pbDisplay(_INTL("{1}'s {2} pulled it out of drowsiness!",battler.pbThis,battler.abilityName))
  925.       end
  926.     end
  927.     battle.pbHideAbilitySplash(battler)
  928.   end
  929.   }
  930. )
  931.  
  932. BattleHandlers::EORHealingAbility.add(:SHEDSKIN,
  933.   proc { |ability,battler,battle|
  934.     next if battler.status==PBStatuses::NONE
  935.     next unless battle.pbRandom(100)<30
  936.     battle.pbShowAbilitySplash(battler)
  937.     oldStatus = battler.status
  938.     battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
  939.     if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
  940.       case oldStatus
  941.       when PBStatuses::SLEEP
  942.         battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,battler.abilityName))
  943.       when PBStatuses::POISON
  944.         battle.pbDisplay(_INTL("{1}'s {2} cured its poison!",battler.pbThis,battler.abilityName))
  945.       when PBStatuses::BURN
  946.         battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",battler.pbThis,battler.abilityName))
  947.       when PBStatuses::PARALYSIS
  948.         battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",battler.pbThis,battler.abilityName))
  949.       when PBStatuses::FROZEN
  950.         battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,battler.abilityName))
  951.       when PBStatuses::FROSTBITE
  952.         battle.pbDisplay(_INTL("{1}'s {2} healed its frostbite!",battler.pbThis,battler.abilityName))
  953.       when PBStatuses::DROWSY
  954.         battle.pbDisplay(_INTL("{1}'s {2} pulled it out of drowsiness!",battler.pbThis,battler.abilityName))
  955.       end
  956.     end
  957.     battle.pbHideAbilitySplash(battler)
  958.   }
  959. )
  960.  
  961. ###############################################################################
  962. #
  963. # Updated items
  964. #
  965. ###############################################################################
  966.  
  967.  
  968. BattleHandlers::StatusCureItem.add(:CHESTOBERRY,
  969.   proc { |item,battler,battle,forced|
  970.     next false if !forced && !battler.canConsumeBerry?
  971.     next false if (battler.status!=PBStatuses::SLEEP && battler.status!=PBStatuses::DROWSY)
  972.     itemName = PBItems.getName(item)
  973.     PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced
  974.     battle.pbCommonAnimation("EatBerry",battler) if !forced
  975.     battler.pbCureStatus(forced)
  976.     battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,itemName)) if !forced
  977.     next true
  978.   }
  979. )
  980.  
  981. BattleHandlers::StatusCureItem.add(:LUMBERRY,
  982.   proc { |item,battler,battle,forced|
  983.     next false if !forced && !battler.canConsumeBerry?
  984.     next false if battler.status==PBStatuses::NONE &&
  985.                   battler.effects[PBEffects::Confusion]==0
  986.     itemName = PBItems.getName(item)
  987.     PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced
  988.     battle.pbCommonAnimation("EatBerry",battler) if !forced
  989.     oldStatus = battler.status
  990.     oldConfusion = (battler.effects[PBEffects::Confusion]>0)
  991.     battler.pbCureStatus(forced)
  992.     battler.pbCureConfusion
  993.     if forced
  994.       battle.pbDisplay(_INTL("{1} snapped out of its confusion.",battler.pbThis)) if oldConfusion
  995.     else
  996.       case oldStatus
  997.       when PBStatuses::SLEEP
  998.         battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,itemName))
  999.       when PBStatuses::POISON
  1000.         battle.pbDisplay(_INTL("{1}'s {2} cured its poisoning!",battler.pbThis,itemName))
  1001.       when PBStatuses::BURN
  1002.         battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",battler.pbThis,itemName))
  1003.       when PBStatuses::PARALYSIS
  1004.         battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",battler.pbThis,itemName))
  1005.       when PBStatuses::FROZEN
  1006.         battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,itemName))
  1007.       when PBStatuses::FROSTBITE
  1008.         battle.pbDisplay(_INTL("{1}'s {2} healed its frostbite!",battler.pbThis,itemName))
  1009.       when PBStatuses::DROWSY
  1010.         battle.pbDisplay(_INTL("{1}'s {2} pulled it out of drowsiness!",battler.pbThis,itemName))
  1011.       end
  1012.       if oldConfusion
  1013.         battle.pbDisplay(_INTL("{1}'s {2} snapped it out of its confusion!",battler.pbThis,itemName))
  1014.       end
  1015.     end
  1016.     next true
  1017.   }
  1018. )
  1019.  
  1020.  
  1021. if defined?(:PokeBattle_MaxMove)
  1022. class PokeBattle_Move_D015 < PokeBattle_MaxMove
  1023.   def pbEffectGeneral(user)
  1024.     @battle.eachBattler do |b|
  1025.       next if b.opposes?(user)
  1026.       t = b.status
  1027.       b.pbCureStatus(false)
  1028.       case t
  1029.       when PBStatuses::BURN
  1030.         @battle.pbDisplay(_INTL("{1} was healed of its burn!",b.pbThis))  
  1031.       when PBStatuses::POISON
  1032.         @battle.pbDisplay(_INTL("{1} was cured of its poison!",b.pbThis))  
  1033.       when PBStatuses::PARALYSIS
  1034.         @battle.pbDisplay(_INTL("{1} was cured of its paralysis!",b.pbThis))
  1035.       when PBStatuses::SLEEP
  1036.         @battle.pbDisplay(_INTL("{1} woke up!",b.pbThis))
  1037.       when PBStatuses::FROZEN
  1038.         @battle.pbDisplay(_INTL("{1} thawed out!",b.pbThis))
  1039.       when PBStatuses::FROSTBITE
  1040.         @battle.pbDisplay(_INTL("{1} was healed of its frostbite!",b.pbThis))  
  1041.       when PBStatuses::DROWSY
  1042.         @battle.pbDisplay(_INTL("{1} was pulled out of drowsiness!",b.pbThis))  
  1043.       end
  1044.     end
  1045.   end
  1046. end
  1047. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement