Advertisement
Vendily

Most of the DLC Move Effects

Aug 22nd, 2020
2,388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.26 KB | None | 0 0
  1. ################################################################################
  2. # Burns the target if at least one stat is raised
  3. ################################################################################
  4. class PokeBattle_Move_XXX < PokeBattle_Move
  5.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  6.     if pbIsDamaging?
  7.       ret=super(attacker,opponent,hitnum,alltargets,showanimation)
  8.       return ret
  9.     else
  10.       return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
  11.       return -1 if !opponent.pbCanBurn?(attacker,true,self)
  12.       return -1 if !opponent.stages.any?{|s| s>0}
  13.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  14.       opponent.pbBurn(attacker)
  15.       return 0
  16.     end
  17.     return -1
  18.   end
  19.  
  20.   def pbAdditionalEffect(attacker,opponent)
  21.     return if opponent.damagestate.substitute
  22.     return if !opponent.stages.any?{|s| s>0}
  23.     if opponent.pbCanBurn?(attacker,false,self)
  24.       opponent.pbBurn(attacker)
  25.     end
  26.   end
  27. end
  28.  
  29. ################################################################################
  30. # Base Damage doubled on terrain if grounded, move type changes based on
  31. # terrain
  32. ################################################################################
  33. class PokeBattle_Move_XXY < PokeBattle_Move
  34.   def pbBaseDamage(basedmg,attacker,opponent)
  35.     return basedamage if attacker.isAirborne?
  36.     if @battle.field.effects[PBEffects::GrassyTerrain]>0 ||
  37.        @battle.field.effects[PBEffects::ElectricTerrain]>0 ||
  38.        @battle.field.effects[PBEffects::MistyTerrain]>0 #||
  39.        #@battle.field.effects[PBEffects::PsychicTerrain]>0
  40.       return basedmg*2
  41.     end
  42.     return basedmg
  43.   end
  44.  
  45.   def pbModifyType(type,attacker,opponent)
  46.     type=getConst(PBTypes,:NORMAL) || 0
  47.     return type if attacker.isAirborne?
  48.     if @battle.field.effects[PBEffects::GrassyTerrain]>0
  49.       type=(getConst(PBTypes,:GRASS) || type)
  50.     elsif @battle.field.effects[PBEffects::ElectricTerrain]>0
  51.       type=(getConst(PBTypes,:ELECTRIC) || type)
  52.     elsif @battle.field.effects[PBEffects::MistyTerrain]>0
  53.       type=(getConst(PBTypes,:FAIRY) || type)
  54.     #elsif @battle.field.effects[PBEffects::PsychicTerrain]>0
  55.     #  type=(getConst(PBTypes,:PSYCHIC) || type)
  56.     end
  57.     return type
  58.   end
  59. end
  60.  
  61. ################################################################################
  62. # Priority increased by 1 if on Grassy Terrain
  63. ################################################################################
  64. class PokeBattle_Move_XXZ < PokeBattle_Move
  65.   def pbPriority(attacker)
  66.     ret=super(attacker)
  67.     ret+=1 if @battle.field.effects[PBEffects::GrassyTerrain]>0
  68.     return ret
  69.   end
  70. end
  71.  
  72. ################################################################################
  73. # Boosts Ally's Attack and defense, failes if no ally
  74. # !!!! Requires exception to crafty shield like Perish Song !!!!
  75. ################################################################################
  76. class PokeBattle_Move_XYX < PokeBattle_Move
  77.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  78.     if !@battle.doublebattle || opponent.fainted?
  79.       @battle.pbDisplay(_INTL("But it failed!"))  
  80.       return -1
  81.     end
  82.     raiseatk=opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
  83.     raisedef=opponent.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
  84.     failed=false
  85.     if !raiseatk && !raisedef
  86.       failed=true
  87.     else
  88.       pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
  89.       showanim=true
  90.       if raiseatk
  91.         opponent.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
  92.         showanim=false
  93.       end
  94.       if raisedef
  95.         opponent.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
  96.         showanim=false
  97.       end
  98.     end
  99.     if failed
  100.       @battle.pbDisplay(_INTL("But it failed!"))
  101.     end
  102.     return failed ? -1 : 0
  103.   end
  104. end
  105.  
  106. ################################################################################
  107. # Two turn attack. Raise Sp Atk first turn, attacks second turn.
  108. ################################################################################
  109. class PokeBattle_Move_XYY < PokeBattle_Move
  110.   def pbTwoTurnAttack(attacker)
  111.     @immediate=false
  112.     if !@immediate && attacker.hasWorkingItem(:POWERHERB)
  113.       @immediate=true
  114.     end
  115.     return false if @immediate
  116.     return attacker.effects[PBEffects::TwoTurnAttack]==0
  117.   end
  118.  
  119.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  120.     if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
  121.       pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
  122.       if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
  123.         attacker.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self)
  124.       end
  125.       @battle.pbDisplay(_INTL("{1} did the message!",attacker.pbThis)) # i dunno?
  126.     end
  127.     if @immediate
  128.       @battle.pbCommonAnimation("UseItem",attacker,nil)
  129.       @battle.pbDisplay(_INTL("{1} became fully charged due to its Power Herb!",attacker.pbThis))
  130.       attacker.pbConsumeItem
  131.     end
  132.     return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
  133.     return super(attacker,opponent,hitnum,alltargets,showanimation)
  134.   end
  135. end
  136.  
  137. ################################################################################
  138. # Base Damage times 1.5 on Psychic terrain if grounded.
  139. # !!!! Need to make target change, look to pbTarget in Battler!!!!
  140. ################################################################################
  141. class PokeBattle_Move_XYZ < PokeBattle_Move
  142.   def pbBaseDamage(basedmg,attacker,opponent)
  143.     return basedamage if attacker.isAirborne?
  144.     #if @battle.field.effects[PBEffects::PsychicTerrain]>0
  145.     #  return (basedmg*1.5).round
  146.     #end
  147.     return basedmg
  148.   end
  149. end
  150.  
  151. ################################################################################
  152. # Fails if opponent doesn't have an item or item is blocked.
  153. # will need to edit if Corrosive Acid effect.
  154. ################################################################################
  155. class PokeBattle_Move_XZX < PokeBattle_Move
  156.   def pbMoveFailed(attacker,opponent)
  157.     return opponent.item==0 ||
  158.            @battle.field.effects[PBEffects::MagicRoom]>0 ||
  159.            opponent.hasWorkingAbility(:KLUTZ) ||
  160.            opponent.effects[PBEffects::Embargo]>0
  161.   end
  162. end
  163.  
  164. ################################################################################
  165. # Removes all terrains, fails if there are no terrains
  166. ################################################################################
  167. class PokeBattle_Move_XZY < PokeBattle_Move
  168.   def pbMoveFailed(attacker,opponent)
  169.     return @battle.field.effects[PBEffects::ElectricTerrain]==0 ||
  170.            @battle.field.effects[PBEffects::GrassyTerrain]==0 ||
  171.            @battle.field.effects[PBEffects::MistyTerrain]==0 # ||
  172.            #@battle.field.effects[PBEffects::PsychicTerrain]==0
  173.   end
  174.  
  175.   def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  176.     return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
  177.     if @battle.field.effects[PBEffects::ElectricTerrain]==0 ||
  178.        @battle.field.effects[PBEffects::GrassyTerrain]==0 ||
  179.        @battle.field.effects[PBEffects::MistyTerrain]==0 # ||
  180.        #@battle.field.effects[PBEffects::PsychicTerrain]==0
  181.       @battle.pbDisplay(_INTL("But it failed!"))
  182.       return -1
  183.     end
  184.     pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
  185.     @battle.field.effects[PBEffects::ElectricTerrain]=0
  186.     @battle.field.effects[PBEffects::GrassyTerrain]=0
  187.     @battle.field.effects[PBEffects::MistyTerrain]=0
  188.     #@battle.field.effects[PBEffects::PsychicTerrain]=0
  189.     @battle.pbDisplay(_INTL("All terrains were removed!"))
  190.     return 0
  191.   end
  192.  
  193.   def pbAdditionalEffect(attacker,opponent)
  194.     @battle.field.effects[PBEffects::ElectricTerrain]=0
  195.     @battle.field.effects[PBEffects::GrassyTerrain]=0
  196.     @battle.field.effects[PBEffects::MistyTerrain]=0
  197.     #@battle.field.effects[PBEffects::PsychicTerrain]=0
  198.     @battle.pbDisplay(_INTL("All terrains were removed!"))
  199.   end
  200. end
  201.  
  202. ################################################################################
  203. # User faints. Power raised by 1.5x in Misty Terrain
  204. ################################################################################
  205. class PokeBattle_Move_XZZ < PokeBattle_Move
  206.   def pbBaseDamage(basedmg,attacker,opponent)
  207.     return basedamage if attacker.isAirborne?
  208.     if @battle.field.effects[PBEffects::MistyTerrain]>0
  209.       return (basedmg*1.5).round
  210.     end
  211.     return basedmg
  212.   end
  213.  
  214.   def pbOnStartUse(attacker)
  215.     if !attacker.hasMoldBreaker
  216.       bearer=@battle.pbCheckGlobalAbility(:DAMP)
  217.       if bearer!=nil
  218.         @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
  219.            bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  220.         return false
  221.       end
  222.     end
  223.     return true
  224.   end
  225.  
  226.   def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
  227.     super(id,attacker,opponent,hitnum,alltargets,showanimation)
  228.     if !attacker.fainted?
  229.       attacker.pbReduceHP(attacker.hp)
  230.       attacker.pbFaint if attacker.fainted?
  231.     end
  232.   end
  233. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement