Advertisement
Guest User

Script.rb

a guest
Feb 9th, 2022
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 11.62 KB | None | 0 0
  1. ###############################################################################
  2. # Adding the new effects Victory Dance, Ceaseless Edge and such.
  3. ###############################################################################
  4.  
  5. module PBEffects
  6.   # Starts from 300 to avoid conflicts with other plugins.
  7.   PowerShift          = 300
  8.   Splinters           = 301
  9.   VictoryDance        = 302
  10. end
  11.  
  12. class PokeBattle_Battler
  13.   alias __pla__pbInitEffects pbInitEffects
  14.   def pbInitEffects(batonPass)
  15.     __pla__pbInitEffects(batonPass)
  16.     if batonPass
  17.       if @effects[PBEffects::PowerShift]
  18.         @attack,@defense = @defense,@attack
  19.         @spatk,@spdef = @spdef,@spatk
  20.       end
  21.     else
  22.       @effects[PBEffects::VictoryDance]      = false
  23.       @effects[PBEffects::PowerShift]        = false
  24.     end
  25.    
  26.     @effects[PBEffects::Splinters]           = -1
  27.   end
  28. end
  29.  
  30. #===============================================================================
  31. # Removes trapping moves, entry hazards and Leech Seed on user/user's side.
  32. # (Rapid Spin)
  33. # Recommended you add the Splinters code after old Rapid Spin code!
  34. # Also removes Ceaseless Edge, and Stone Axe.
  35. #===============================================================================
  36. class PokeBattle_Move_110 < PokeBattle_Move
  37.   def pbEffectAfterAllHits(user,target)
  38.     return if user.fainted? || target.damageState.unaffected
  39.     # ... skip code until
  40.     if user.pbOwnSide.effects[PBEffects::StickyWeb]
  41.       user.pbOwnSide.effects[PBEffects::StickyWeb] = false
  42.       user.pbOwnSide.effects[PBEffects::StickyWebUser] = -1
  43.       @battle.pbDisplay(_INTL("{1} blew away sticky webs!",user.pbThis))
  44.     end
  45.     # Pokémon Legends: Arceus
  46.     if user.effects[PBEffects::Splinters] > -1
  47.       user.pbOwnSide.effects[PBEffects::Splinters] = -1
  48.       @battle.pbDisplay(_INTL("{1} blew away the splinters!",user.pbThis))
  49.     end
  50.     user.pbRaiseStatStage(PBStats::SPEED,1,user)
  51.   end
  52. end
  53.  
  54. ###############################################################################
  55. #
  56. # New moves from Pokémon Legends Arceus
  57. #
  58. ###############################################################################
  59.  
  60. #===============================================================================
  61. # Paralyzes, poisons or forces the target to sleep. (Dire Claw)
  62. # Note: the sleep effect is adapted from Pokémon Legends: Arceus's Drowsy status.
  63. #===============================================================================
  64. class PokeBattle_Move_200 < PokeBattle_Move
  65.   def pbAdditionalEffect(user,target)
  66.     return if target.damageState.substitute
  67.     case @battle.pbRandom(3)
  68.     #when 0 then target.pbDrowse(user) if target.pbCanSleepYawn?(user,false,self)
  69.     when 0 then target.effects[PBEffects::Yawn] = 2 if target.pbCanSleepYawn?(user,false,self)
  70.     when 1 then target.pbPoison(user) if target.pbCanPoison?(user,false,self)
  71.     when 2 then target.pbParalyze(user) if target.pbCanParalyze?(user,false,self)
  72.     end
  73.   end
  74. end
  75.  
  76. #===============================================================================
  77. # Swaps the user's offensive and defensive stats. (Power Shift)
  78. # Note: To me this means inverting both attack / special attack with
  79. # defense / special defense.
  80. #===============================================================================
  81. class PokeBattle_Move_201 < PokeBattle_Move
  82.   def pbEffectGeneral(user)
  83.     user.attack,user.defense = user.defense,user.attack
  84.     user.spatk,user.spdef = user.spdef,user.spatk
  85.     user.effects[PBEffects::PowerShift] = !user.effects[PBEffects::PowerShift]
  86.     @battle.pbDisplay(_INTL("{1} switched its offensive and defensive stats!",user.pbThis))
  87.   end
  88. end
  89.  
  90. #===============================================================================
  91. # After the hit, leaves a specific damaging effect. (Stone Axe, Ceaseless Edge)
  92. #===============================================================================
  93. class PokeBattle_Move_202 < PokeBattle_Move
  94.   def pbEffectAgainstTarget(user,target)
  95.     return if target.effects[PBEffects::Splinters] > -1
  96.     target.effects[PBEffects::Splinters] = 3+rand(3)
  97.     @battle.pbDisplay(_INTL("Splinters spread around {1}!",target.pbThis(true)))
  98.   end
  99. end
  100.  
  101. #===============================================================================
  102. # Either boost the user's offensive stats, or decreases the target's defensive
  103. # stats, depending on form. (Springtide Storm)
  104. #===============================================================================
  105. class PokeBattle_Move_203 < PokeBattle_Move
  106.   def initialize(battle,move)
  107.     super
  108.     @statUp = [PBStats::ATTACK,1,PBStats::SPATK,1]
  109.     @statDown = [PBStats::DEFENSE,1,PBStats::SPDEF,1]
  110.   end
  111.  
  112.   def pbAdditionalEffect(user,target)
  113.     # return if user.species != PBSpecies::ENAMORUS # DEBUG
  114.     showAnim = true
  115.    
  116.     if user.form == 1
  117.       # Decreases the target's stats.
  118.       return if target.damageState.substitute
  119.       for i in 0...@statDown.length/2
  120.         next if !target.pbCanLowerStatStage?(@statDown[i*2],user,self)
  121.         if target.pbLowerStatStage(@statDown[i*2],@statDown[i*2+1],user,showAnim)
  122.           showAnim = false
  123.         end
  124.       end
  125.     else
  126.       # Increases the user's stats.
  127.       for i in 0...@statUp.length/2
  128.         next if !user.pbCanRaiseStatStage?(@statUp[i*2],user,self)
  129.         if user.pbRaiseStatStage(@statUp[i*2],@statUp[i*2+1],user,showAnim)
  130.           showAnim = false
  131.         end
  132.       end
  133.     end
  134.   end
  135. end
  136.  
  137. #===============================================================================
  138. # Either boost offensive stats, or defensive stats, depending on the stats of
  139. # the Pokémon. (Mystical Power)
  140. #===============================================================================
  141. class PokeBattle_Move_204 < PokeBattle_Move
  142.   def pbAdditionalEffect(user,target)
  143.     showAnim = true
  144.     statUp = []
  145.     if user.attack + user.spatk >= user.defense + user.spdef
  146.       # Increases the user's offensive stats.
  147.       statUp = [PBStats::ATTACK,1,PBStats::SPATK,1]
  148.     else
  149.       statUp = [PBStats::DEFENSE,1,PBStats::SPDEF,1]
  150.     end
  151.    
  152.     for i in 0...statUp.length/2
  153.       next if !user.pbCanRaiseStatStage?(statUp[i*2],user,self)
  154.       if user.pbRaiseStatStage(statUp[i*2],statUp[i*2+1],user,showAnim)
  155.         showAnim = false
  156.       end
  157.     end
  158.   end
  159. end
  160.  
  161. #===============================================================================
  162. # Recoil + boosts the user's speed. (Wave Crash)
  163. #===============================================================================
  164. class PokeBattle_Move_205 < PokeBattle_StatUpMove
  165.   def initialize(battle,move)
  166.     super
  167.     @statUp = [PBStats::SPEED,1]
  168.   end
  169.  
  170.   def recoilMove?;                 return true; end
  171.  
  172.   def pbRecoilDamage(user,target)
  173.     return (target.damageState.totalHPLost/4.0).round
  174.   end
  175.  
  176.   def pbEffectAfterAllHits(user,target)
  177.     return if target.damageState.unaffected
  178.     return if !user.takesIndirectDamage?
  179.     return if user.hasActiveAbility?(:ROCKHEAD)
  180.     amt = pbRecoilDamage(user,target)
  181.     amt = 1 if amt<1
  182.     user.pbReduceHP(amt,false)
  183.     @battle.pbDisplay(_INTL("{1} is damaged by recoil!",user.pbThis))
  184.     user.pbItemHPHealCheck
  185.   end
  186. end
  187.  
  188. #===============================================================================
  189. # Heavy recoil + decreases the user's speed. (Chloroblast)
  190. #===============================================================================
  191. class PokeBattle_Move_206 < PokeBattle_StatDownMove
  192.   def initialize(battle,move)
  193.     super
  194.     @statDown = [PBStats::SPEED,1]
  195.   end
  196.  
  197.   def recoilMove?;                 return true; end
  198.  
  199.   def pbRecoilDamage(user,target)
  200.     return (target.damageState.totalHPLost/2.0).round
  201.   end
  202.  
  203.   def pbEffectAfterAllHits(user,target)
  204.     return if target.damageState.unaffected
  205.     return if !user.takesIndirectDamage?
  206.     return if user.hasActiveAbility?(:ROCKHEAD)
  207.     amt = pbRecoilDamage(user,target)
  208.     amt = 1 if amt<1
  209.     user.pbReduceHP(amt,false)
  210.     @battle.pbDisplay(_INTL("{1} is damaged by recoil!",user.pbThis))
  211.     user.pbItemHPHealCheck
  212.   end
  213. end
  214.  
  215. #===============================================================================
  216. # Boosts stats + bonus effect. (Victory Dance)
  217. #===============================================================================
  218. class PokeBattle_Move_207 < PokeBattle_MultiStatUpMove
  219.   def initialize(battle,move)
  220.     super
  221.     @statUp = [PBStats::ATTACK,1,PBStats::DEFENSE,1,
  222.                PBStats::SPATK,1,PBStats::SPDEF,1]
  223.   end
  224.  
  225.   def pbAdditionalEffect(user,target)
  226.     super
  227.    
  228.     if !user.effects[PBEffects::VictoryDance]
  229.       user.effects[PBEffects::VictoryDance] = true
  230.       @battle.pbDisplay(_INTL("{1} dances in victory!", user.pbThis))
  231.     end
  232.   end
  233. end
  234.  
  235. #===============================================================================
  236. # Bonus damage if target has a status effect + can inflict status.
  237. # (Barb Barrage, Bitter Malice, Infernal Parade)
  238. #===============================================================================
  239.  
  240. class PokeBattle_StatusAndBonusDamageMove < PokeBattle_Move
  241.   def initialize(battle,move)
  242.     super
  243.     @status = PBStatuses::NONE
  244.   end
  245.  
  246.   def pbBaseDamage(baseDmg,user,target)
  247.     if target.pbHasAnyStatus? &&
  248.        (target.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(user))
  249.       baseDmg *= 2
  250.     end
  251.     return baseDmg
  252.   end
  253.  
  254.   def pbAdditionalEffect(user,target)
  255.     return if target.damageState.substitute
  256.     target.pbInflictStatus(@status,0,nil,user) if target.pbCanInflictStatus?(@status,user,false,self)
  257.   end
  258. end
  259.  
  260. # Barb Barrage
  261. class PokeBattle_Move_208 < PokeBattle_StatusAndBonusDamageMove
  262.   def initialize(battle,move)
  263.     super
  264.     @status = PBStatuses::POISON
  265.   end
  266. end
  267.  
  268. # Infernal Parade
  269. class PokeBattle_Move_209 < PokeBattle_StatusAndBonusDamageMove
  270.   def initialize(battle,move)
  271.     super
  272.     @status = PBStatuses::BURN
  273.   end
  274. end
  275.  
  276. #===============================================================================
  277. # Raises critical hit ratio + decreases defense. (Triple Arrows)
  278. #===============================================================================
  279.  
  280. class PokeBattle_Move_20A < PokeBattle_TargetStatDownMove
  281.   def initialize(battle,move)
  282.     super
  283.     @statDown = [PBStats::DEFENSE, 1]
  284.   end
  285.  
  286.   def pbEffectAfterAllHits(user,target)
  287.     return if user.effects[PBEffects::FocusEnergy] > 2
  288.     user.effects[PBEffects::FocusEnergy] = 2
  289.     @battle.pbDisplay(_INTL("{1} is getting pumped!",user.pbThis))
  290.   end
  291. end
  292.  
  293. #===============================================================================
  294. # Heals the user + cures its status. (Lunar Blessing)
  295. #===============================================================================
  296. class PokeBattle_Move_20B < PokeBattle_HealingMove
  297.   def pbHealAmount(user)
  298.     return (user.totalhp/3.0).round
  299.   end
  300.   def pbMoveFailed?(user,targets)
  301.     return false if user.pbHasAnyStatus?
  302.     return super
  303.   end
  304.   def pbEffectGeneral(user)
  305.     user.pbCureStatus
  306.     super
  307.   end
  308. end
  309.  
  310. #===============================================================================
  311. # Cures the user's status + raises its stats. (Take Heart)
  312. #===============================================================================
  313. class PokeBattle_Move_20C < PokeBattle_MultiStatUpMove
  314.   def initialize(battle,move)
  315.     super
  316.     @statUp = [PBStats::ATTACK, 1, PBStats::DEFENSE, 1,
  317.                   PBStats::SPATK, 1, PBStats::SPDEF, 1]
  318.   end
  319.  
  320.   def pbMoveFailed?(user,targets)
  321.     return false if user.pbHasAnyStatus?
  322.     return super
  323.   end
  324.  
  325.   def pbEffectGeneral(user)
  326.     user.pbCureStatus if user.pbHasAnyStatus?
  327.     super
  328.   end
  329. end
  330.  
  331. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement