• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

[Scripting Question] [v20.1] Move That Damages Attracted Foes

sonicfan7895

Just a dude, I guess
122
Posts
13
Years
  • I wanted to try making a move that functions exactly like Smelling Salts. Except the difference with that and this new move is that it is supposed to deal double damage on an attracted target, and then cure the target's attraction.

    Obviously I'm not doing something right, because Attraction is totally different from most other statuses (one of them being confusion and the other being flinching), and I know I need to try and call the target.effects line, but for some reason it's still not working.

    Here's my code:

    Code:
    class Battle::Move::DoublePowerIfTargetAttractedCureTarget < Battle::Move
      def pbBaseDamage(baseDmg, user, target)
        if target.effects[PBEffects::Attract] >= 0 &&
           (target.effects[PBEffects::Substitute] == 0 || ignoresSubstitute?(user))
          baseDmg *= 2
        end
        return baseDmg
      end
    
      def pbEffectAfterAllHits(user, target)
        return if target.fainted?
        return if target.damageState.unaffected || target.damageState.substitute
        return if target.effects[PBEffects::Attract] >= 0
        target.pbCureAttract
      end
    end

    Any help to try and solve this conundrum of mine would be fantastic. Thanks!
     
    188
    Posts
    9
    Years
    • Seen Jan 21, 2024
    In def pbEffectAfterAllHits make the following change:
    Code:
      def pbEffectAfterAllHits(user, target)
        return if target.fainted?
        return if target.damageState.unaffected || target.damageState.substitute
        # return if target.effects[PBEffects::Attract] >= 0
        return if target.effects[PBEffects::Attract] == -1
        target.pbCureAttract
      end
    end
    What your code initially did was return scope if the target was Attracted before it could call pbCureAttract.
     

    sonicfan7895

    Just a dude, I guess
    122
    Posts
    13
    Years
  • In def pbEffectAfterAllHits make the following change:
    Code:
      def pbEffectAfterAllHits(user, target)
        return if target.fainted?
        return if target.damageState.unaffected || target.damageState.substitute
        # return if target.effects[PBEffects::Attract] >= 0
        return if target.effects[PBEffects::Attract] == -1
        target.pbCureAttract
      end
    end
    What your code initially did was return scope if the target was Attracted before it could call pbCureAttract.

    Alas, such a simple addition, but even today I wouldn't have thought what to do. Thank you for your help. I had tried to do something similar, but I was doing it all wrong. Now I'm guessing I can add something like flavor text after the "pbCureAttract" or something?
     
    Back
    Top