Advertiser Content
Male
Canada
Seen 4 Days Ago
Posted 5 Days Ago
28 posts
3.8 Years
So I want to make it so that sandstorm and hail take into account the types of the Pokémon taking damage. Sort of like how stealth rock does more damage to Fire types and less to Ground types for example. Basically I want it so that Hail would do 1/16 HP damage if an Ice type attack would do regular damage to that pokémon, 1/8 HP to a Pokémon that's x2 weak to Ice, 1/4 to a Pokémon that's x4 weak to Ice (like Flying/Dragon types for example), 1/32 HP damage to Pokémon that are x2 resistant Ice, and 1/64 HP damage to Pokémon that are x4 resistant to ice. And the same sort of thing for sandstorm, obviously. And I still want Ice types to be immune to damage from hail, and Ground, Rock, and Steel types to be immune to Sandstorm. I'm not very good at scripting, though, so any help would be appreciated!

mgriffin

Seen 1 Hour Ago
Posted 1 Hour Ago
932 posts
5.8 Years
So I guess there's two things to do: a) find where Stealth Rock damage happens so that you can see how to make the damage based on the effectiveness of rock, b) find where Hail/Sandstorm damage happens and modify it so that once it's decided the Pokémon is not immune to damage that the damage is multiplied by the effectiveness of Ice/Rock.

You can use Ctrl-Shift-F to search in all files, I'd recommend searching for StealthRock, HAIL and SANDSTORM.

hirokimura

Miltank's Fanboy Number One

Age 24
Male
France
Seen 1 Week Ago
Posted December 15th, 2019
95 posts
2 Years
Hello,
I'm interested, so I gave it a try and it works. Maybe I should post it as a resource too ^^

EDIT : posted it as a resource with screenshots : https://www.pokecommunity.com/showthread.php?p=10100092#post10100092

In pokebattle_battle, locate this
pbCommonAnimation("Rain",nil,nil)
#        pbDisplay(_INTL("Rain continues to fall."))
      end
Select the code starting from :
"when PBWeather::SANDSTORM"
until :
"when PBWeather::HEAVYRAIN"
excluded. Your selection should end with lot of end.

Paste this:

    when PBWeather::SANDSTORM
      @[email protected] if @weatherduration>0
      if @weatherduration==0
        pbDisplay(_INTL("The sandstorm subsided."))
        @weather=0
        PBDebug.log("[End of effect] Sandstorm weather ended")
      else
        pbCommonAnimation("Sandstorm",nil,nil)
#        pbDisplay(_INTL("The sandstorm rages."))
        if pbWeather==PBWeather::SANDSTORM
          PBDebug.log("[Lingering effect triggered] Sandstorm weather damage")
          for i in priority
            next if i.fainted?
            if !i.pbHasType?(:GROUND) && !i.pbHasType?(:ROCK) && !i.pbHasType?(:STEEL) &&
               !i.hasWorkingAbility(:SANDVEIL) &&
               !i.hasWorkingAbility(:SANDRUSH) &&
               !i.hasWorkingAbility(:SANDFORCE) &&
               !i.hasWorkingAbility(:MAGICGUARD) &&
               !i.hasWorkingAbility(:OVERCOAT) &&
               !i.hasWorkingItem(:SAFETYGOGGLES) &&
               ![0xCA,0xCB].include?(PBMoveData.new(i.effects[PBEffects::TwoTurnAttack]).function) # Dig, Dive
              atype=getConst(PBTypes,:GROUND) || 0
               eff=PBTypes.getCombinedEffectiveness(atype,i.type1,i.type2,i.effects[PBEffects::Type3])
               @scene.pbDamageAnimation(i,0)
              i.pbReduceHP(((i.totalhp*eff)/64).floor)
              pbDisplay(_INTL("{1} is buffeted by the sandstorm!",i.pbThis))
              if i.fainted?
                return if !i.pbFaint
              end
            end
          end
        end
      end
    when PBWeather::HAIL
      @[email protected] if @weatherduration>0
      if @weatherduration==0
        pbDisplay(_INTL("The hail stopped."))
        @weather=0
        PBDebug.log("[End of effect] Hail weather ended")
      else
        pbCommonAnimation("Hail",nil,nil)
#        pbDisplay(_INTL("Hail continues to fall."))
        if pbWeather==PBWeather::HAIL
          PBDebug.log("[Lingering effect triggered] Hail weather damage")
          for i in priority
            next if i.fainted?
            if !i.pbHasType?(:ICE) &&
               !i.hasWorkingAbility(:ICEBODY) &&
               !i.hasWorkingAbility(:SNOWCLOAK) &&
               !i.hasWorkingAbility(:MAGICGUARD) &&
               !i.hasWorkingAbility(:OVERCOAT) &&
               !i.hasWorkingItem(:SAFETYGOGGLES) &&
               ![0xCA,0xCB].include?(PBMoveData.new(i.effects[PBEffects::TwoTurnAttack]).function) # Dig, Dive
               atype=getConst(PBTypes,:ICE) || 0
               eff=PBTypes.getCombinedEffectiveness(atype,i.type1,i.type2,i.effects[PBEffects::Type3])
               @scene.pbDamageAnimation(i,0)
              i.pbReduceHP(((i.totalhp*eff)/64).floor)
              pbDisplay(_INTL("{1} is buffeted by the hail!",i.pbThis))
              if i.fainted?
                return if !i.pbFaint
              end
            end
          end
        end
      end

And enjoy
Advertiser Content