• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Adding a Weather that only applies once

  • 220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    So I'm trying to add a Weather condition called "Darkness" (listed as DARKNESS). While it applies non-dark type Pokemon and those without certain abilities would lose 1 stage of accuracy. But here's where I get stuck: I want it to only apply once, and only stay applied as long as there is darkness. I tried looking at hail for examples but they apply every turn and I don't want the pokemon losing accuracy every turn. My question is thus: How would I go about implementing such a weather?

    EDIT: I was thinking, if I add a dummy effect that cancels itself once there's no longer Darkness, and had the weather reduce accuracy 1 stage (only to those applicable), then apply the dummy effect, so long as the dummy effect rendered the pokemon immune to losing accuracy, it should work shouldn't it?
     
    Last edited:
    Sunny Day does exactly the same thing as what you want, except it lowers the damage of Water moves rather than the accuracy of all moves. It doesn't change any stat stages itself, but just affects the appropriate calculation. That's a very good place to start.

    When the attacker's accuracy stages are obtained in pbAccuracyCheck, simply subtract 1 from that value if your Darkness weather is in effect (min. -6). Make sure you don't change the actual stat stage, only the number used in that particular calculation.
     
    So:
    Code:
        if @battle.pbWeather==PBWeather::DARKNESS &&
           isConst?!(type,PBTypes,:DARK))||
           isConst?!(type,PBTypes,:LIGHT))||
           isConst?!(opponent.ability,PBAbilities,:NIGHTVISION)
          return opponent.pbReduceStat(PBStats::ACCURACY,1,true,@id,attacker) ? 0 : -1
        end
    ?

    I'm really new to this incase you can't tell, I'm not even sure if isConst?!'d be read as I think it would. Are there any guides for this?
     
    it's !isConst?(type,PBTypes,:DARK).

    notice the "!"

    Code:
          if @battle.pbWeather==PBWeather::DARKNESS && !isConst?(opponent.ability,PBAbilities,:NIGHTVISION)
            accuracy=(accuracy*4/5).floor
          end
    That's what I wouldv'e tried doing for the ability... Where are you putting that code?
     
    The same place as Sunny Day's attack power manipulation. Eurgh I already see a fault from my supercollider coding. What should I put in place of the two penultimate lines for it to work as a weather?
    Code:
        if @battle.pbWeather==PBWeather::DARKNESS &&
           !isConst?(type,PBTypes,:DARK))||
           !isConst?(type,PBTypes,:LIGHT))||
           !isConst?(opponent.ability,PBAbilities,:NIGHTVISION)
          return opponent.pbReduceStat(PBStats::ACCURACY,1,true,@id,attacker) ? 0 : -1
        end
     
    Accuracy checks aren't done in the method Sunny Day appears in. They're done in the method pbAccuracyCheck (no, really!).

    Go to that def, and add in the following alongside the various other effects that change accuracy:

    Code:
    [COLOR=Black]if @battle.pbWeather==PBWeather::DARKNESS &&
       !attacker.pbHasType(:DARK) &&[/COLOR][COLOR=Black] !attacker.pbHasType(:LIGHT) &&[/COLOR]
       [COLOR=Black]!isConst?(attacker.ability,PBAbilities,:NIGHTVISION)
      [/COLOR][COLOR=Black]accuracy=(accuracy*4/5).floor
    end[/COLOR]
    I've assumed that the darkness weather does not lower the accuracy of Light-type Pokémon, Dark-type Pokémon or Pokémon with the Night Vision ability. I tweaked the code accordingly.

    This is a slight buff of what Nickalooose said. It is preferable to do this than to literally change stat stages, since it can always be applied (stat stages have a minimum value, but you can always multiply by 0.8).
     
    I'm a little late, but yeah, how Maruno done it is how I would've done it.
     
    Back
    Top