• 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.

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

sonicfan7895

Just a dude, I guess
  • 122
    Posts
    14
    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!
     
    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.
     
    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