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

Need Help Implementing Pollen Puff

14
Posts
7
Years
    • Seen May 6, 2024
    Hey! I was working on implementing the new Seventh-Gen moves into Pokemon Essentials, but I'm having a little trouble with Pollen Puff. So far, I've got this:
    Code:
    class PokeBattle_Move_165 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=false)
        if [email protected]?(attacker.index)
          if opponent.effects[PBEffects::Substitute]>0
            @battle.pbDisplay(_INTL("But it failed!"))  
            return -1
          end
          if opponent.hp==opponent.totalhp
            @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))  
            return -1
          end
          pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
          hpgain=((opponent.totalhp+1)/2).floor)
          opponent.pbRecoverHP(hpgain,true)
          @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))  
          return 0
        else
          pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        end
      end
    end

    However, I'm worried that this implementation will still injure allies before healing them. Could somebody give me feedback on it? Sorry to be a bother!
     
    824
    Posts
    8
    Years
  • The way you have it coded, it will not damage allies. However, it won't damage enemies either. It'll show the move animation, but nothing will happen.

    Here's how I have it coded. Note that this is me assuming that it heals your ally for how much damage it should have dealt (something I like to call "reverse damage output").

    Code:
    ################################################################################
    # If the target is an ally, heals the target for the amount of damage that would
    #     have been dealt.  If target is an opponent, damages them normally.
    ################################################################################
    class PokeBattle_Move_1B3 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.pbPartner != nil
          if attacker.pbPartner == opponent && opponent.hp>0
            damage=pbCalcDamage(attacker,opponent,0,hitnum)
            opponent.pbRecoverHP(damage,true)
            return 0
          end
        end
        return super(attacker,opponent,hitnum,alltargets,showanimation)
      end
    end
     
    14
    Posts
    7
    Years
    • Seen May 6, 2024
    Thank you for your feedback! While I was waiting, I decided to look at the code for a similar move (more specifically, Present) and came up with what I think is another way to solve the damage problem. Here's what I got now:
    Code:
    class PokeBattle_Move_165 < PokeBattle_Move
      @calcbasedmg=1
      def pbBaseDamage(basedmg,attacker,opponent)
        return @calcbasedmg 
      end
      
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=false)
        if [email protected]?(attacker.index)
          @calcbasedmg=0
          if opponent.effects[PBEffects::Substitute]>0
            @battle.pbDisplay(_INTL("But it failed!"))  
            return -1
          end
          if opponent.hp==opponent.totalhp
            @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))  
            return -1
          end
          pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
          hpgain=((opponent.totalhp+1)/2).floor
          opponent.pbRecoverHP(hpgain,true)
          @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))  
          return 0
        else
          @calcbasedmg=90
        end
        return super(attacker,opponent,hitnum,alltargets,showanimation)
      end
    end

    Basically, what I'm trying to do is make it so that the move does no damage when targeting an ally, and does 90 damage when targeting an enemy. Does it work like I want it to? If not, I'll probably just scrap it. Sorry to be a bother, and thank you for helping!
     
    Back
    Top