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

Gen VII Scripts (Z-Moves, Abilities and Moves,)

824
Posts
8
Years
  • Pollen Puff
    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
            damage=pbCalcDamage(attacker,opponent,0,hitnum)
            opponent.pbRecoverHP(damage,true)
            return 0
          end
        end
        return super(attacker,opponent,hitnum,alltargets,showanimation)
      end
    end

    Floral Healing
    Code:
    ################################################################################
    # Heals target by 1/2 of its max HP.
    # In Grassy Terrain, heals target by 3/4 of its max HP.
    ################################################################################
    class PokeBattle_Move_1B4 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if opponent.effects[PBEffects::HealBlock]>0
          @battle.pbDisplay(_INTL("{1} can't use {2} because of Heal Block!",attacker.pbThis,name))
          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)
        inc=0.5
        inc=0.75 if @battle.field.effects[PBEffects::GrassyTerrain]>0
        opponent.pbRecoverHP(((opponent.totalhp+1)*inc).floor,true)
        @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
        return 0
      end
    end

    Strength Sap
    Code:
    ################################################################################
    # Heals the user for an amount equal to the target's effective Attack stat
    # Lowers the target's Attack by 1 stage
    ################################################################################
    class PokeBattle_Move_1B5 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::HealBlock]>0
          bob="heal"
          bob=_INTL("use {1}",name) if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
          @battle.pbDisplay(_INTL("{1} can't {2} because of Heal Block!",attacker.pbThis,bob))
          return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
        elsif attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
          return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
        else
          oatk=opponent.attack
          attacker.pbRecoverHP(oatk,true)
          @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        end
        if opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
          opponent.pbReduceStat(PBStats::ATTACK,1,true,true,false,attacker)
        end
        return 0
      end
    end

    Gear Up
    Code:
    ################################################################################
    # Gear Up
    ################################################################################
    class PokeBattle_Move_1B6 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.pbPartner
          if attacker.pbPartner.hasWorkingAbility(:PLUS) ||
             attacker.pbPartner.hasWorkingAbility(:MINUS)
            anim=true
            if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::ATTACK,true)
              attacker.pbPartner.pbIncreaseStat(PBStats::ATTACK,1,true,anim)
              anim=false
            end
            if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::SPATK,true)
              attacker.pbPartner.pbIncreaseStat(PBStats::SPATK,1,true,anim)
            end
          end
        end
        return 0
      end
    end

    Speed Swap
    Code:
    ################################################################################
    # User and target swap their Speed stats
    ################################################################################
    class PokeBattle_Move_1B7 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        attacker.speed,opponent.speed=opponent.speed,attacker.speed
        @battle.pbDisplay(_INTL("{1} switched their Speed stats!",attacker.pbThis))
        return 0
      end
    end

    Shore Up
    Code:
    ################################################################################
    # Heals user by 1/2 of its max HP.
    # In a sandstorm, heals user by 3/4 of its max HP.
    ################################################################################
    class PokeBattle_Move_1A3 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::HealBlock]>0
          @battle.pbDisplay(_INTL("{1} can't use {2} because of Heal Block!",attacker.pbThis,name))
          return -1
        end
        if attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        inc=0.5
        inc=0.75 if @battle.pbWeather==PBWeather::SANDSTORM
        attacker.pbRecoverHP(((attacker.totalhp+1)*inc).floor,true)
        @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        return 0
      end
    end

    Spotlight
    Code:
    ################################################################################
    # This round, target becomes the target of attacks that have single targets.
    ################################################################################
    class PokeBattle_Move_1A6 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if [email protected]
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        opponent.effects[PBEffects::FollowMe]=true
        if !opponent.pbPartner.isFainted?
          opponent.pbPartner.effects[PBEffects::FollowMe]=false
        end
        @battle.pbDisplay(_INTL("{1} shone a spotlight on {2}!",attacker.pbThis,opponent.pbThis))
        return 0
      end
    end

    Revelation Dance
    Code:
    ################################################################################
    # Move type changes based on user's primary type
    ################################################################################
    class PokeBattle_Move_192 < PokeBattle_Move
      def pbType(type,attacker,opponent)
        return attacker.type1
      end
    end
    (originally had this one coded a lot more complicated, where it checks to be sure the attacker is Oricorio, then goes by the form's primary type. Turns out it goes by primary type regardless of species.)

    Instruct
    Code:
    ################################################################################
    # Instructs the target to use the move it last used again.
    ################################################################################
    class PokeBattle_Move_194 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if opponent.lastMoveUsed<=0 ||
           (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
          @battle.pbDisplay(_INTL("The instruction failed!"))
          return -1
        end
        opponent.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
        return 0
      end
    end
     
    Last edited:
    15
    Posts
    7
    Years
    • Age 36
    • Seen Apr 21, 2023
    Pollen Puff
    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
            damage=pbCalcDamage(attacker,opponent,0,hitnum)
            opponent.pbRecoverHP(damage,true)
            return 0
          end
        end
        return super(attacker,opponent,hitnum,alltargets,showanimation)
      end
    end

    Floral Healing
    Code:
    ################################################################################
    # Heals target by 1/2 of its max HP.
    # In Grassy Terrain, heals target by 3/4 of its max HP.
    ################################################################################
    class PokeBattle_Move_1B4 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if opponent.effects[PBEffects::HealBlock]>0
          @battle.pbDisplay(_INTL("{1} can't use {2} because of Heal Block!",attacker.pbThis,name))
          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)
        inc=0.5
        inc=0.75 if @battle.field.effects[PBEffects::GrassyTerrain]>0
        opponent.pbRecoverHP(((opponent.totalhp+1)*inc).floor,true)
        @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
        return 0
      end
    end

    Strength Sap
    Code:
    ################################################################################
    # Heals the user for an amount equal to the target's effective Attack stat
    # Lowers the target's Attack by 1 stage
    ################################################################################
    class PokeBattle_Move_1B5 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::HealBlock]>0
          bob="heal"
          bob=_INTL("use {1}",name) if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
          @battle.pbDisplay(_INTL("{1} can't {2} because of Heal Block!",attacker.pbThis,bob))
          return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
        elsif attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
          return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
        else
          oatk=opponent.attack
          attacker.pbRecoverHP(oatk,true)
          @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        end
        if opponent.pbCanReduceStatStage?(PBStats::ATTACK,true,false,attacker)
          opponent.pbReduceStat(PBStats::ATTACK,1,true,true,false,attacker)
        end
        return 0
      end
    end

    Gear Up
    Code:
    ################################################################################
    # Gear Up
    ################################################################################
    class PokeBattle_Move_1B6 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.pbPartner
          if attacker.pbPartner.hasWorkingAbility(:PLUS) ||
             attacker.pbPartner.hasWorkingAbility(:MINUS)
            anim=true
            if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::ATTACK,true)
              attacker.pbPartner.pbIncreaseStat(PBStats::ATTACK,1,true,anim)
              anim=false
            end
            if attacker.pbPartner.pbCanIncreaseStatStage?(PBStats::SPATK,true)
              attacker.pbPartner.pbIncreaseStat(PBStats::SPATK,1,true,anim)
            end
          end
        end
        return 0
      end
    end

    Speed Swap
    Code:
    ################################################################################
    # User and target swap their Speed stats
    ################################################################################
    class PokeBattle_Move_1B7 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        attacker.speed,opponent.speed=opponent.speed,attacker.speed
        @battle.pbDisplay(_INTL("{1} switched their Speed stats!",attacker.pbThis))
        return 0
      end
    end

    Shore Up
    Code:
    ################################################################################
    # Heals user by 1/2 of its max HP.
    # In a sandstorm, heals user by 3/4 of its max HP.
    ################################################################################
    class PokeBattle_Move_1A3 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::HealBlock]>0
          @battle.pbDisplay(_INTL("{1} can't use {2} because of Heal Block!",attacker.pbThis,name))
          return -1
        end
        if attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        inc=0.5
        inc=0.75 if @battle.pbWeather==PBWeather::SANDSTORM
        attacker.pbRecoverHP(((attacker.totalhp+1)*inc).floor,true)
        @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        return 0
      end
    end

    Spotlight
    Code:
    ################################################################################
    # This round, target becomes the target of attacks that have single targets.
    ################################################################################
    class PokeBattle_Move_1A6 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if [email protected]
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        opponent.effects[PBEffects::FollowMe]=true
        if !opponent.pbPartner.isFainted?
          opponent.pbPartner.effects[PBEffects::FollowMe]=false
        end
        @battle.pbDisplay(_INTL("{1} shone a spotlight on {2}!",attacker.pbThis,opponent.pbThis))
        return 0
      end
    end

    Revelation Dance
    Code:
    ################################################################################
    # Move type changes based on user's primary type
    ################################################################################
    class PokeBattle_Move_192 < PokeBattle_Move
      def pbType(type,attacker,opponent)
        return attacker.type1
      end
    end
    (originally had this one coded a lot more complicated, where it checks to be sure the attacker is Oricorio, then goes by the form's primary type. Turns out it goes by primary type regardless of species.)

    Instruct
    Code:
    ################################################################################
    # Instructs the target to use the move it last used again.
    ################################################################################
    class PokeBattle_Move_194 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if opponent.lastMoveUsed<=0 ||
           (PBMoveData.new(opponent.lastMoveUsed).flags&0x10)==0 # flag e: Copyable by Mirror Move
          @battle.pbDisplay(_INTL("The instruction failed!"))
          return -1
        end
        opponent.pbUseMoveSimple(opponent.lastMoveUsed,-1,opponent.index)
        return 0
      end
    end

    Brilliant work, Rot8er_ConeX! Thanks a lot for all those moves! However, I did notice you hasn't posted "Core Enforcer", and since you said you'd have trouble with it, I wonder if you made it or not. Anyway, after that tip you gave me (I had completely forgotten about "Gastro Acid") I just combined Payback + Gastro Acid and it seems to be working perfectly. I'm sure you've already done it by now, but just in case, that's my suggestion.
     
    824
    Posts
    8
    Years
  • Brilliant work, Rot8er_ConeX! Thanks a lot for all those moves! However, I did notice you hasn't posted "Core Enforcer", and since you said you'd have trouble with it, I wonder if you made it or not. Anyway, after that tip you gave me (I had completely forgotten about "Gastro Acid") I just combined Payback + Gastro Acid and it seems to be working perfectly. I'm sure you've already done it by now, but just in case, that's my suggestion.

    Thanks for the tip. Because of that, I created this:

    Code:
    ################################################################################
    # If the target has already moved this round, suppresses target's ability
    ################################################################################
    class PokeBattle_Move_1B8 < PokeBattle_Move
      def pbAdditionalEffect(attacker,opponent)
        if opponent.hasMovedThisRound? && opponent.lastMoveUsed<=0
          if isConst?(opponent.ability,PBAbilities,:MULTITYPE) ||
             isConst?(opponent.ability,PBAbilities,:RKSSYSTEM) ||
             isConst?(opponent.ability,PBAbilities,:STANCECHANGE) ||
             isConst?(opponent.ability,PBAbilities,:DELTASTREAM) ||
             isConst?(opponent.ability,PBAbilities,:PRIMORDIALSEA) ||
             isConst?(opponent.ability,PBAbilities,:DESOLATELAND)
            return false
          end
          opponent.effects[PBEffects::GastroAcid]=true
          opponent.effects[PBEffects::Truant]=false
          @battle.pbDisplay(_INTL("{1}'s ability was suppressed!",opponent.pbThis)) 
          if opponent.effects[PBEffects::Illusion]!=nil #ILLUSION
            # Animation should go here
            # Break the illusion
            opponent.effects[PBEffects::Illusion]=nil
            @battle.pbDisplayEffect(opponent)
            @battle.scene.pbChangePokemon(opponent,opponent.pokemon)
            if EFFECTMESSAGES
              @battle.pbDisplay(_INTL("{1}'s {2} wore off!",opponent.pbThis,
                  PBAbilities.getName(opponent.ability)))
            else
              @battle.pbDisplay(_INTL("{1}'s {2} was broken!",opponent.pbThis,
                  PBAbilities.getName(opponent.ability)))
            end
          end #ILLUSION
          return true
        end
      end
    end
     
    824
    Posts
    8
    Years
  • Toxic Thread
    Code:
    ################################################################################
    # Poisons the target
    # Decreases the target's Speed by 1 stage.
    ################################################################################
    class PokeBattle_Move_1B9 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,true,false,attacker) && !opponent.pbCanPoison(false,@id,attacker)
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        opponent.pbReduceStat(PBStats::SPEED,1,true,true,false,attacker) if opponent.pbCanReduceStatStage?(PBStats::SPEED,true,false,attacker)
        if opponent.pbCanPoison(false,@id,attacker)
          opponent.pbPoison(attacker)
          @battle.pbDisplay(_INTL("{1} is poisoned!",opponent.pbThis))
        end
        return 0
      end
    end

    Burnup
    Code:
    ################################################################################
    # After attacking, the user removes this move's type from their own typing
    # This move cannot be used for a Pokemon for which the move isn't STAB
    ################################################################################
    class PokeBattle_Move_1B9 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        type=@type
        return -1 if !attacker.pbHasType?(type)
        ret=super(attacker,opponent,hitnum,alltargets,showanimation)
        if attacker.effects[PBEffects::Type3]==type
          attacker.effects[PBEffects::Type3]=-1
        end
        if attacker.type1==type && attacker.type2==type
          attacker.type1=getConst(PBTypes,:QMARKS)
          attacker.type2=getConst(PBTypes,:QMARKS)
        elsif attacker.type1==type  
          attacker.type1=attacker.type2
        elsif attacker.type2==type
          attacker.type2=attacker.type1
        end
      end
    end
    (Note that I coded it in such a way that the Fire type is never mentioned. People can use this code to make Burn-Out-type moves with other types.)
     
    Last edited:
    15
    Posts
    7
    Years
    • Age 36
    • Seen Apr 21, 2023
    Toxic Thread
    Code:
    ################################################################################
    # Poisons the target
    # Decreases the target's Speed by 1 stage.
    ################################################################################
    class PokeBattle_Move_1B9 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,true,false,attacker) && !opponent.pbCanPoison(false,@id,attacker)
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        opponent.pbReduceStat(PBStats::SPEED,1,true,true,false,attacker) if opponent.pbCanReduceStatStage?(PBStats::SPEED,true,false,attacker)
        if opponent.pbCanPoison(false,@id,attacker)
          opponent.pbPoison(attacker)
          @battle.pbDisplay(_INTL("{1} is poisoned!",opponent.pbThis))
        end
        return 0
      end
    end

    Burnup
    Code:
    ################################################################################
    # After attacking, the user removes this move's type from their own typing
    # This move cannot be used for a Pokemon for which the move isn't STAB
    ################################################################################
    class PokeBattle_Move_1B9 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        type=@type
        return -1 if !attacker.pbHasType?(type)
        ret=super(attacker,opponent,hitnum,alltargets,showanimation)
        if attacker.effects[PBEffects::Type3]==type
          attacker.effects[PBEffects::Type3]=-1
        end
        if attacker.type1==type && attacker.type2==type
          attacker.type1=getConst(PBTypes,:QMARKS)
          attacker.type2=getConst(PBTypes,:QMARKS)
        elsif attacker.type1==type  
          attacker.type1=attacker.type2
        elsif attacker.type2==type
          attacker.type2=attacker.type1
        end
      end
    end
    (Note that I coded it in such a way that the Fire type is never mentioned. People can use this code to make Burn-Out-type moves with other types.)

    When I made burn up (using soak as a base), it seems to work perfectly for arcanine and typhlosion. However, for moltres, there is a problemas. Judging by the description of the move on serebii.net, it was supposed to remove only the fire type, which means moltres would become pure flying. But using my code it becomes "qmark" just like arcanine and typhlosion. Does your code solves that problem? Thanks for your hardwork.
     
    824
    Posts
    8
    Years
  • When I made burn up (using soak as a base), it seems to work perfectly for arcanine and typhlosion. However, for moltres, there is a problemas. Judging by the description of the move on serebii.net, it was supposed to remove only the fire type, which means moltres would become pure flying. But using my code it becomes "qmark" just like arcanine and typhlosion. Does your code solves that problem? Thanks for your hardwork.

    Yes, my code solves that problem. It only makes it QMark type if both type1 and type2 are Fire type. If one isn't Fire, than it sets the one that is Fire to be the same as the one that isn't. (It also removes Fire as the third type.)
     
    824
    Posts
    8
    Years
  • Purify
    Code:
    ################################################################################
    # User heals target's status condition
    # If successful, user heals itself by 50% of its max HP.
    ################################################################################
    class PokeBattle_Move_1BB < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        return -1 if opponent.status==0
        case opponent.status
        when PBStatuses::PARALYSIS
          @battle.pbDisplay(_INTL("{1} was cured of its paralysis.",opponent.pbThis))
        when PBStatuses::SLEEP
          @battle.pbDisplay(_INTL("{1} was woken from its sleep.",opponent.pbThis))
        when PBStatuses::POISON
          @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",opponent.pbThis))
        when PBStatuses::BURN
          @battle.pbDisplay(_INTL("{1} was cured of its burn.",opponent.pbThis))
        when PBStatuses::FROZEN
          @battle.pbDisplay(_INTL("{1} was defrosted.",opponent.pbThis))
        end
        opponent.status=0
        opponent.statusCount=0
        if attacker.effects[PBEffects::HealBlock]>0
          @battle.pbDisplay(_INTL("{1} can't heal because of Heal Block!",attacker.pbThis))
        elsif attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
        else
          attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
          @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        end
      end
    end





    Shell Trap and Beak Blast are interesting to code. I will be grouping them together.

    1.) The main effect codes. These go in PokeBattle_MoveEffects
    Code:
    ################################################################################
    # Shell Trap
    ################################################################################
    class PokeBattle_Move_193 < PokeBattle_Move
      def pbMoveFailed(attacker,opponent)
        return !attacker.effects[PBEffects::ShellTrap]
      end
    end
    
    ################################################################################
    # (handled elsewhere) If anyone makes contact with the Pokemon while they are
    #    charging this move, they will be inflicted with a burn
    ################################################################################
    class PokeBattle_Move_1BC < PokeBattle_Move
    end

    2.) In PokeBattle_Battler (with the R), search for the following code and add the red stuff below it:
    Code:
            if target.hasWorkingItem(:ROCKYHELMET,true) && !user.isFainted? && 
                move.function != 0xC1
              PBDebug.log("[#{user.pbThis} hurt by Rocky Helmet]")
              @battle.scene.pbDamageAnimation(user,0)
              user.pbReduceHP((user.totalhp/6).floor)
              @battle.pbDisplay(_INTL("{1} was hurt by the {2}!",user.pbThis,
                 PBItems.getName(target.item)))
            end
    [COLOR="Red"]        [email protected][target.index][2]
            if movex.function==0x192 && # Shell Trap
                 move.pbisPhysical?(move.type,user,target)
              target.effects[PBEffects::ShellTrap]=true
            end
            if movex.function==0x1BC && # Beak Blast
                 move.isContactMove? && user.pbCanBurn?(false,movex,target)
              user.pbBurn(target)
            end[/COLOR]

    3.) In PokeBattle_Battle (without the R), search for the following code and add the red stuff below it:
    Code:
        for i in priority
          if pbChoseMoveFunctionCode?(i.index,0x115) # Focus Punch
            pbCommonAnimation("FocusPunch",i,nil)
            pbDisplay(_INTL("{1} is tightening its focus!",i.pbThis))
          [COLOR="red"]elsif pbChoseMoveFunctionCode?(i.index,0x1BC) # Beak Blast
            pbCommonAnimation("Burn",i,nil)
            pbDisplay(_INTL("{1} started heating up its beak!",i.pbThis))[/COLOR]
          end
        end

    4a.) You still need to initialize the Shell Trap effect. In PBEffects, in with all the other variables, add this line:
    Code:
        ShellTrap         = 121

    4b.) In PokeBattle_Battler (with the R), find the function pbInitEffects, add this line:
    Code:
          @effects[PBEffects::ShellTrap]      = false

    4c.) In PokeBattle_Battle (without the R), find the following code and add the red line:
    Code:
          [COLOR="red"]@battlers[i].effects[PBEffects::ShellTrap]=false[/COLOR]
          @battlers[i].effects[PBEffects::Flinch]=false
          @battlers[i].effects[PBEffects::FollowMe]=false
          @battlers[i].effects[PBEffects::HelpingHand]=false
          @battlers[i].effects[PBEffects::MagicCoat]=false
          @battlers[i].effects[PBEffects::Snatch]=false
          @battlers[i].effects[PBEffects::Charge]-=1 if @battlers[i].effects[PBEffects::Charge]>0
          @battlers[i].lastHPLost=0
          @battlers[i].lastAttacker=-1
          @battlers[i].effects[PBEffects::Counter]=-1
          @battlers[i].effects[PBEffects::CounterTarget]=-1
          @battlers[i].effects[PBEffects::MirrorCoat]=-1
          @battlers[i].effects[PBEffects::MirrorCoatTarget]=-1
     
    Last edited:
    6
    Posts
    7
    Years
    • Age 35
    • Seen Dec 1, 2016
    Purify
    Code:
    ################################################################################
    # User heals target's status condition
    # If successful, user heals itself by 50% of its max HP.
    ################################################################################
    class PokeBattle_Move_1BB < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        return -1 if opponent.status==0
        case opponent.status
        when PBStatuses::PARALYSIS
          @battle.pbDisplay(_INTL("{1} was cured of its paralysis.",opponent.pbThis))
        when PBStatuses::SLEEP
          @battle.pbDisplay(_INTL("{1} was woken from its sleep.",opponent.pbThis))
        when PBStatuses::POISON
          @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",opponent.pbThis))
        when PBStatuses::BURN
          @battle.pbDisplay(_INTL("{1} was cured of its burn.",opponent.pbThis))
        when PBStatuses::FROZEN
          @battle.pbDisplay(_INTL("{1} was defrosted.",opponent.pbThis))
        end
        opponent.status=0
        opponent.statusCount=0
        if attacker.effects[PBEffects::HealBlock]>0
          @battle.pbDisplay(_INTL("{1} can't heal because of Heal Block!",attacker.pbThis))
        elsif attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
        else
          attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
          @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        end
      end
    end





    Shell Trap and Beak Blast are interesting to code. I will be grouping them together.

    1.) The main effect codes. These go in PokeBattle_MoveEffects
    Code:
    ################################################################################
    # Shell Trap
    ################################################################################
    class PokeBattle_Move_193 < PokeBattle_Move
      def pbMoveFailed(attacker,opponent)
        return !attacker.effects[PBEffects::ShellTrap]
      end
    end
    
    ################################################################################
    # (handled elsewhere) If anyone makes contact with the Pokemon while they are
    #    charging this move, they will be inflicted with a burn
    ################################################################################
    class PokeBattle_Move_1BC < PokeBattle_Move
    end

    2.) In PokeBattle_Battler (with the R), search for the following code and add the red stuff below it:
    Code:
            if target.hasWorkingItem(:ROCKYHELMET,true) && !user.isFainted? && 
                move.function != 0xC1
              PBDebug.log("[#{user.pbThis} hurt by Rocky Helmet]")
              @battle.scene.pbDamageAnimation(user,0)
              user.pbReduceHP((user.totalhp/6).floor)
              @battle.pbDisplay(_INTL("{1} was hurt by the {2}!",user.pbThis,
                 PBItems.getName(target.item)))
            end
    [COLOR="Red"]        [email protected][target.index][2]
            if movex.function==0x192 && # Shell Trap
                 move.pbisPhysical?(move.type,user,target)
              target.effects[PBEffects::ShellTrap]=true
            end
            if movex.function==0x1BC && # Beak Blast
                 move.isContactMove? && user.pbCanBurn?(false,movex,target)
              user.pbBurn(target)
            end[/COLOR]

    3.) In PokeBattle_Battle (without the R), search for the following code and add the red stuff below it:
    Code:
        for i in priority
          if pbChoseMoveFunctionCode?(i.index,0x115) # Focus Punch
            pbCommonAnimation("FocusPunch",i,nil)
            pbDisplay(_INTL("{1} is tightening its focus!",i.pbThis))
          [COLOR="red"]elsif pbChoseMoveFunctionCode?(i.index,0x1BC) # Beak Blast
            pbCommonAnimation("Burn",i,nil)
            pbDisplay(_INTL("{1} started heating up its beak!",i.pbThis))[/COLOR]
          end
        end

    4a.) You still need to initialize the Shell Trap effect. In PBEffects, in with all the other variables, add this line:
    Code:
        ShellTrap         = 121

    4b.) In PokeBattle_Battler (with the R), find the function pbInitEffects, add this line:
    Code:
          @effects[PBEffects::ShellTrap]      = false

    4c.) In PokeBattle_Battle (without the R), find the following code and add the red line:
    Code:
          [COLOR="red"]@battlers[i].effects[PBEffects::ShellTrap]=false[/COLOR]
          @battlers[i].effects[PBEffects::Flinch]=false
          @battlers[i].effects[PBEffects::FollowMe]=false
          @battlers[i].effects[PBEffects::HelpingHand]=false
          @battlers[i].effects[PBEffects::MagicCoat]=false
          @battlers[i].effects[PBEffects::Snatch]=false
          @battlers[i].effects[PBEffects::Charge]-=1 if @battlers[i].effects[PBEffects::Charge]>0
          @battlers[i].lastHPLost=0
          @battlers[i].lastAttacker=-1
          @battlers[i].effects[PBEffects::Counter]=-1
          @battlers[i].effects[PBEffects::CounterTarget]=-1
          @battlers[i].effects[PBEffects::MirrorCoat]=-1
          @battlers[i].effects[PBEffects::MirrorCoatTarget]=-1

    Can you help me with Emergency Exit? I'm having trouble with that.
     
    824
    Posts
    8
    Years
  • Can you help me with Emergency Exit? I'm having trouble with that.

    1.) Add this function anywhere in PokeBattle_Battler (with the R) :
    Code:
      def pbEffectsOnMoveEnd(move,user,target,damage)
        damage=0 if damage==nil
        if damage>0
          if !target.damagestate.substitute
            if target.hasWorkingAbility(:WIMPOUT) &&
                target.hp<target.totalhp/2 && target.hp+damage>target.totalhp/2
              PBDebug.log("[#{target.pbThis}'s #{PBAbilities.getName(target.ability)} triggered]")
              choices=[]
              [email protected](target.index)
              for i in 0...party.length
                choices[choices.length]=i if @battle.pbCanSwitchLax?(target.index,i,false)
              end
              if choices.length>0
                newpoke=choices[@battle.pbRandom(choices.length)]
                target.pbResetForm
                @battle.pbReplace(target.index,newpoke,false)
                @battle.pbDisplay(_INTL("{1} was dragged out!",target.pbThis))
                @battle.pbOnActiveOne(target)
                target.pbAbilitiesOnSwitchIn(true)
              elsif [email protected]
                @battle.decision=3
              end
            elsif target.hasWorkingAbility(:EMERGENCYEXIT) &&
                target.hp<target.totalhp/2 && target.hp+damage>target.totalhp/2
              PBDebug.log("[#{target.pbThis}'s #{PBAbilities.getName(target.ability)} triggered]")
              choices=[]
              [email protected](target.index)
              for i in 0...party.length
                choices[choices.length]=i if @battle.pbCanSwitchLax?(target.index,i,false)
              end
              if choices.length>0
                newpoke=choices[@battle.pbRandom(choices.length)]
                target.pbResetForm
                @battle.pbReplace(target.index,newpoke,false)
                @battle.pbDisplay(_INTL("{1} was dragged out!",target.pbThis))
                @battle.pbOnActiveOne(target)
                target.pbAbilitiesOnSwitchIn(true)
              elsif [email protected]
                @battle.decision=3
              end
            end
          end
        end
      end
    (note that the two abilities were programmed as two separate entities when I was under the impression that Emergency Exit had a Baton Pass effect. But nope, EE is literally a direct copy of WO.)

    2.) Search for this code, still in PokeBattle_Battler, and add the red part:
    Code:
                elsif user.hasWorkingAbility(:STENCH) &&
                      thismove.function != 0x09 && # Thunder Fang
                      thismove.function != 0x0B && # Fire Fang
                      thismove.function != 0x0E && # Ice Fang
                      thismove.function != 0x0F && # flinch-inducing moves
                      thismove.function != 0x10 && # Stomp
                      thismove.function != 0x11 && # Snore
                      thismove.function != 0x12 && # Fake Out
                      thismove.function != 0x78 && # Twister
                      thismove.function != 0xC7    # Sky Attack
                  if @battle.pbRandom(10)==0
                    target.effects[PBEffects::Flinch]=true
                    PBDebug.log("[#{user.pbThis}'s Stench triggered]")
                  end
                end
              end
            end
          end
          [COLOR="Red"]pbEffectsOnMoveEnd(thismove,user,target,damage)[/COLOR]
          break if user.isFainted?
          break if target.isFainted?

    3.) In PokeBattle_Battle (without the R), find this function and add the red lines of code:
    Code:
      def pbCanRun?(idxPokemon)
        return false if @opponent
        thispkmn=@battlers[idxPokemon]
        return true if thispkmn.hasWorkingItem(:SMOKEBALL)
        return true if thispkmn.hasWorkingAbility(:RUNAWAY)
    [COLOR="red"]    return true if thispkmn.hasWorkingAbility(:EMERGENCYEXIT) && thispkmn.hp<=thispkmn.totalhp/2
        return true if thispkmn.hasWorkingAbility(:WIMPOUT) && thispkmn.hp<=thispkmn.totalhp/2[/COLOR]
        return pbCanSwitch?(idxPokemon,-1,false)
      end

    4.) Still in PokeBattle_Battle, find this line of code - should be in the function just below the one in the previous step - and add the red.
    Code:
        if thispkmn.hasWorkingAbility(:RUNAWAY)
          if duringBattle
            pbDisplayPaused(_INTL("Got away safely!"))
          else
            pbDisplayEffect(thispkmn)
            pbDisplayPaused(_INTL("{1} fled using Run Away!",thispkmn.pbThis))
          end
          @decision=3
          return 1
        end
    [COLOR="red"]    if thispkmn.hasWorkingAbility(:WIMPOUT) && thispkmn.hp<=thispkmn.totalhp/2
          if duringBattle
            pbDisplayPaused(_INTL("Got away safely!"))
          else
            pbDisplayEffect(thispkmn)
            pbDisplayPaused(_INTL("{1} Wimped Out!",thispkmn.pbThis))
          end
          @decision=3
          return 1
        end
        if thispkmn.hasWorkingAbility(:EMERGENCYEXIT) && thispkmn.hp<=thispkmn.totalhp/2
          if duringBattle
            pbDisplayPaused(_INTL("Got away safely!"))
          else
            pbDisplayEffect(thispkmn)
            pbDisplayPaused(_INTL("{1} took an Emergency Exit!",thispkmn.pbThis))
          end
          @decision=3
          return 1
        end[/COLOR]
     
    6
    Posts
    7
    Years
    • Age 35
    • Seen Dec 1, 2016
    1.) Add this function anywhere in PokeBattle_Battler (with the R) :
    Code:
      def pbEffectsOnMoveEnd(move,user,target,damage)
        damage=0 if damage==nil
        if damage>0
          if !target.damagestate.substitute
            if target.hasWorkingAbility(:WIMPOUT) &&
                target.hp<target.totalhp/2 && target.hp+damage>target.totalhp/2
              PBDebug.log("[#{target.pbThis}'s #{PBAbilities.getName(target.ability)} triggered]")
              choices=[]
              [email protected](target.index)
              for i in 0...party.length
                choices[choices.length]=i if @battle.pbCanSwitchLax?(target.index,i,false)
              end
              if choices.length>0
                newpoke=choices[@battle.pbRandom(choices.length)]
                target.pbResetForm
                @battle.pbReplace(target.index,newpoke,false)
                @battle.pbDisplay(_INTL("{1} was dragged out!",target.pbThis))
                @battle.pbOnActiveOne(target)
                target.pbAbilitiesOnSwitchIn(true)
              elsif [email protected]
                @battle.decision=3
              end
            elsif target.hasWorkingAbility(:EMERGENCYEXIT) &&
                target.hp<target.totalhp/2 && target.hp+damage>target.totalhp/2
              PBDebug.log("[#{target.pbThis}'s #{PBAbilities.getName(target.ability)} triggered]")
              choices=[]
              [email protected](target.index)
              for i in 0...party.length
                choices[choices.length]=i if @battle.pbCanSwitchLax?(target.index,i,false)
              end
              if choices.length>0
                newpoke=choices[@battle.pbRandom(choices.length)]
                target.pbResetForm
                @battle.pbReplace(target.index,newpoke,false)
                @battle.pbDisplay(_INTL("{1} was dragged out!",target.pbThis))
                @battle.pbOnActiveOne(target)
                target.pbAbilitiesOnSwitchIn(true)
              elsif [email protected]
                @battle.decision=3
              end
            end
          end
        end
      end
    (note that the two abilities were programmed as two separate entities when I was under the impression that Emergency Exit had a Baton Pass effect. But nope, EE is literally a direct copy of WO.)

    2.) Search for this code, still in PokeBattle_Battler, and add the red part:
    Code:
                elsif user.hasWorkingAbility(:STENCH) &&
                      thismove.function != 0x09 && # Thunder Fang
                      thismove.function != 0x0B && # Fire Fang
                      thismove.function != 0x0E && # Ice Fang
                      thismove.function != 0x0F && # flinch-inducing moves
                      thismove.function != 0x10 && # Stomp
                      thismove.function != 0x11 && # Snore
                      thismove.function != 0x12 && # Fake Out
                      thismove.function != 0x78 && # Twister
                      thismove.function != 0xC7    # Sky Attack
                  if @battle.pbRandom(10)==0
                    target.effects[PBEffects::Flinch]=true
                    PBDebug.log("[#{user.pbThis}'s Stench triggered]")
                  end
                end
              end
            end
          end
          [COLOR="Red"]pbEffectsOnMoveEnd(thismove,user,target,damage)[/COLOR]
          break if user.isFainted?
          break if target.isFainted?

    3.) In PokeBattle_Battle (without the R), find this function and add the red lines of code:
    Code:
      def pbCanRun?(idxPokemon)
        return false if @opponent
        thispkmn=@battlers[idxPokemon]
        return true if thispkmn.hasWorkingItem(:SMOKEBALL)
        return true if thispkmn.hasWorkingAbility(:RUNAWAY)
    [COLOR="red"]    return true if thispkmn.hasWorkingAbility(:EMERGENCYEXIT) && thispkmn.hp<=thispkmn.totalhp/2
        return true if thispkmn.hasWorkingAbility(:WIMPOUT) && thispkmn.hp<=thispkmn.totalhp/2[/COLOR]
        return pbCanSwitch?(idxPokemon,-1,false)
      end

    4.) Still in PokeBattle_Battle, find this line of code - should be in the function just below the one in the previous step - and add the red.
    Code:
        if thispkmn.hasWorkingAbility(:RUNAWAY)
          if duringBattle
            pbDisplayPaused(_INTL("Got away safely!"))
          else
            pbDisplayEffect(thispkmn)
            pbDisplayPaused(_INTL("{1} fled using Run Away!",thispkmn.pbThis))
          end
          @decision=3
          return 1
        end
    [COLOR="red"]    if thispkmn.hasWorkingAbility(:WIMPOUT) && thispkmn.hp<=thispkmn.totalhp/2
          if duringBattle
            pbDisplayPaused(_INTL("Got away safely!"))
          else
            pbDisplayEffect(thispkmn)
            pbDisplayPaused(_INTL("{1} Wimped Out!",thispkmn.pbThis))
          end
          @decision=3
          return 1
        end
        if thispkmn.hasWorkingAbility(:EMERGENCYEXIT) && thispkmn.hp<=thispkmn.totalhp/2
          if duringBattle
            pbDisplayPaused(_INTL("Got away safely!"))
          else
            pbDisplayEffect(thispkmn)
            pbDisplayPaused(_INTL("{1} took an Emergency Exit!",thispkmn.pbThis))
          end
          @decision=3
          return 1
        end[/COLOR]

    break if user.isFainted?
    break if target.isFainted?

    This part is missing under the stench part.

    Edit. Nvm found it but for some reason the pokemon that comes in gets to attack.
     
    15
    Posts
    7
    Years
    • Age 36
    • Seen Apr 21, 2023
    Last question, I swear! I ended up creating a Laser Focus using Focus Energy and Lock-on as a base, but I noticed your code is way more simple. However, when I was creating mine, I remember that I had to modify some section (battler or battle) in order to subtract -1 on "Laser Focus" effect at the start/end of each round in battle. Otherwise, moves would land critical hits on EVERY turn. I haven't tried your code, but in case there are other people using it, does he works just like it is or it requires that modification as well?
     
    155
    Posts
    9
    Years
    • Age 31
    • Seen Jun 11, 2021
    Just tested Wimp Out on Version 16. It works, but not as intended. When battling a wild Ekans, the Pokemon with Wimp Out ended up switching out rather than running away from the battle. Unless that only happens with wild Pokemon who have Wimp Out.

    Edit: Beak Blast and Shell Trap don't exactly work in 16.2 either. When using Beak Blast in battle, it just skips the move entirely. Also, whenever a Pokemon takes damage after switching out, this error pops up:
    Code:
    Exception: NoMethodError
    Message: undefined method `function' for nil:NilClass
    PokeBattle_Battler:1530:in `pbEffectsOnDealingDamage'
    PokeBattle_Battler:3160:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3079:in `each'
    PokeBattle_Battler:3079:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3604:in `pbUseMove'
    PokeBattle_Battler:3584:in `loop'
    PokeBattle_Battler:3607:in `pbUseMove'
    PokeBattle_Battler:3805:in `pbProcessTurn'
    PokeBattle_Battler:3804:in `logonerr'
    PokeBattle_Battler:3804:in `pbProcessTurn'
     
    Last edited:
    81
    Posts
    8
    Years
    • Age 22
    • Seen Sep 7, 2019
    Purify
    Code:
    ################################################################################
    # User heals target's status condition
    # If successful, user heals itself by 50% of its max HP.
    ################################################################################
    class PokeBattle_Move_1BB < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        return -1 if opponent.status==0
        case opponent.status
        when PBStatuses::PARALYSIS
          @battle.pbDisplay(_INTL("{1} was cured of its paralysis.",opponent.pbThis))
        when PBStatuses::SLEEP
          @battle.pbDisplay(_INTL("{1} was woken from its sleep.",opponent.pbThis))
        when PBStatuses::POISON
          @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",opponent.pbThis))
        when PBStatuses::BURN
          @battle.pbDisplay(_INTL("{1} was cured of its burn.",opponent.pbThis))
        when PBStatuses::FROZEN
          @battle.pbDisplay(_INTL("{1} was defrosted.",opponent.pbThis))
        end
        opponent.status=0
        opponent.statusCount=0
        if attacker.effects[PBEffects::HealBlock]>0
          @battle.pbDisplay(_INTL("{1} can't heal because of Heal Block!",attacker.pbThis))
        elsif attacker.hp==attacker.totalhp
          @battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
        else
          attacker.pbRecoverHP(((attacker.totalhp+1)/2).floor,true)
          @battle.pbDisplay(_INTL("{1}'s HP was restored.",attacker.pbThis))
        end
      end
    end





    Shell Trap and Beak Blast are interesting to code. I will be grouping them together.

    1.) The main effect codes. These go in PokeBattle_MoveEffects
    Code:
    ################################################################################
    # Shell Trap
    ################################################################################
    class PokeBattle_Move_193 < PokeBattle_Move
      def pbMoveFailed(attacker,opponent)
        return !attacker.effects[PBEffects::ShellTrap]
      end
    end
    
    ################################################################################
    # (handled elsewhere) If anyone makes contact with the Pokemon while they are
    #    charging this move, they will be inflicted with a burn
    ################################################################################
    class PokeBattle_Move_1BC < PokeBattle_Move
    end

    2.) In PokeBattle_Battler (with the R), search for the following code and add the red stuff below it:
    Code:
            if target.hasWorkingItem(:ROCKYHELMET,true) && !user.isFainted? && 
                move.function != 0xC1
              PBDebug.log("[#{user.pbThis} hurt by Rocky Helmet]")
              @battle.scene.pbDamageAnimation(user,0)
              user.pbReduceHP((user.totalhp/6).floor)
              @battle.pbDisplay(_INTL("{1} was hurt by the {2}!",user.pbThis,
                 PBItems.getName(target.item)))
            end
    [COLOR="Red"]        [email protected][target.index][2]
            if movex.function==0x192 && # Shell Trap
                 move.pbisPhysical?(move.type,user,target)
              target.effects[PBEffects::ShellTrap]=true
            end
            if movex.function==0x1BC && # Beak Blast
                 move.isContactMove? && user.pbCanBurn?(false,movex,target)
              user.pbBurn(target)
            end[/COLOR]

    3.) In PokeBattle_Battle (without the R), search for the following code and add the red stuff below it:
    Code:
        for i in priority
          if pbChoseMoveFunctionCode?(i.index,0x115) # Focus Punch
            pbCommonAnimation("FocusPunch",i,nil)
            pbDisplay(_INTL("{1} is tightening its focus!",i.pbThis))
          [COLOR="red"]elsif pbChoseMoveFunctionCode?(i.index,0x1BC) # Beak Blast
            pbCommonAnimation("Burn",i,nil)
            pbDisplay(_INTL("{1} started heating up its beak!",i.pbThis))[/COLOR]
          end
        end

    4a.) You still need to initialize the Shell Trap effect. In PBEffects, in with all the other variables, add this line:
    Code:
        ShellTrap         = 121

    4b.) In PokeBattle_Battler (with the R), find the function pbInitEffects, add this line:
    Code:
          @effects[PBEffects::ShellTrap]      = false

    4c.) In PokeBattle_Battle (without the R), find the following code and add the red line:
    Code:
          [COLOR="red"]@battlers[i].effects[PBEffects::ShellTrap]=false[/COLOR]
          @battlers[i].effects[PBEffects::Flinch]=false
          @battlers[i].effects[PBEffects::FollowMe]=false
          @battlers[i].effects[PBEffects::HelpingHand]=false
          @battlers[i].effects[PBEffects::MagicCoat]=false
          @battlers[i].effects[PBEffects::Snatch]=false
          @battlers[i].effects[PBEffects::Charge]-=1 if @battlers[i].effects[PBEffects::Charge]>0
          @battlers[i].lastHPLost=0
          @battlers[i].lastAttacker=-1
          @battlers[i].effects[PBEffects::Counter]=-1
          @battlers[i].effects[PBEffects::CounterTarget]=-1
          @battlers[i].effects[PBEffects::MirrorCoat]=-1
          @battlers[i].effects[PBEffects::MirrorCoatTarget]=-1

    Why set-up Shell trap that way when it can easily be a counter?
    For example: In the PBS set it up as 01 instead of 00 for No Target,

    Under the Blast Beak message
    Code:
    elsif pbChoseMoveFunctionCode?(i.index,0x1AE) # Shell Trap
            pbDisplay(_INTL("{1} set up a Shell-Trap!",i.pbThis))
    Then search for opponent.effects[PBEffects::CounterTarget]=attacker.index and under add opponent.effects[PBEffects::ShellTrap]=attacker.index
    and in PBEffects have it modified like Counter. Then for the actualy script function.

    Code:
    ################################################################################
    # Counters a physical move used against the user this round, with an explosion.
    ################################################################################
    class PokeBattle_Move_1AE < PokeBattle_Move
      def pbAddTarget(targets,attacker)
        if attacker.effects[PBEffects::ShellTrap]>=0 &&
           attacker.pbIsOpposing?(attacker.effects[PBEffects::ShellTrap])
          if !attacker.pbAddTarget(targets,@battle.battlers[attacker.effects[PBEffects::ShellTrap]])
            attacker.pbRandomTarget(targets)
          end
        end
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::Counter]<=0 || !opponent
          @battle.pbDisplay(_INTL("Shell Trap failed!"))
          return -1
        end
        ret=pbEffectFixedDamage(150,attacker,opponent,hitnum,alltargets,showanimation)
        return ret
      end
    end
     

    TheShinyMew

    Wild Challenger appeared!
    125
    Posts
    13
    Years
  • You do not have to use Soak as a base. You have to use Roost as a base.
    Here:
    Code:
    ################################################################################
    # User attacks, and its Fire type is ignored for attacks used against it.
    # (Burn Up)
    ################################################################################
    class PokeBattle_Move_169 < PokeBattle_Move
      def pbEffectAfterHit(attacker,opponent,turneffects)
        if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
           !opponent.damagestate.substitute
          attacker.effects[PBEffects::BurnUp]=true
        end
      end
    end

    Add the BurnUp effect first in PBEffects, then in PokeBattle_Battler, put "@effects[PBEffects::BurnUp] = false" under "@effects[PBEffects::Roost] = false"

    In PokeBattle_Move, in the def pbTypeModifier put this code after the Roost effect.
    Code:
        # Burn Up
        if isConst?(otype1,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
          if isConst?(otype2,PBTypes,:FIRE) && isConst?(otype3,PBTypes,:FIRE)
            otype1=getConst(PBTypes,:NORMAL) || 0
          else
            otype1=otype2
          end
        end
        if isConst?(otype2,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
          otype2=otype1
        end

    I'm guarantee that you can use Roost as a base, not Soak!
    270
     
    15
    Posts
    7
    Years
    • Age 36
    • Seen Apr 21, 2023
    You do not have to use Soak as a base. You have to use Roost as a base.
    Here:
    Code:
    ################################################################################
    # User attacks, and its Fire type is ignored for attacks used against it.
    # (Burn Up)
    ################################################################################
    class PokeBattle_Move_169 < PokeBattle_Move
      def pbEffectAfterHit(attacker,opponent,turneffects)
        if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
           !opponent.damagestate.substitute
          attacker.effects[PBEffects::BurnUp]=true
        end
      end
    end

    Add the BurnUp effect first in PBEffects, then in PokeBattle_Battler, put "@effects[PBEffects::BurnUp] = false" under "@effects[PBEffects::Roost] = false"

    In PokeBattle_Move, in the def pbTypeModifier put this code after the Roost effect.
    Code:
        # Burn Up
        if isConst?(otype1,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
          if isConst?(otype2,PBTypes,:FIRE) && isConst?(otype3,PBTypes,:FIRE)
            otype1=getConst(PBTypes,:NORMAL) || 0
          else
            otype1=otype2
          end
        end
        if isConst?(otype2,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
          otype2=otype1
        end

    I'm guarantee that you can use Roost as a base, not Soak!
    270

    Thanks for the reply! I had forgotten completely about roost. Your code is miles better than mine, no doubt about it. But, just for the record, it seems burn up changes the user type to "???" And not to "Normal". I suppose you have to put "QMARKS" instead of "NORMAL" in your code.
     
    824
    Posts
    8
    Years
  • There's no need to base it on Roost. Just change the type in the effect code. Unlike Roost, Burn Up's type change lasts the entire battle until you switch out.
     
    58
    Posts
    8
    Years
    • Age 32
    • Seen Oct 6, 2019
    Has anybody figured out how to code the following abilities?

    - the terrain Surges
    - Dazzling
    - Stamina
    - Triage
    - Merciless

    Thanks.
     
    824
    Posts
    8
    Years
  • Has anybody figured out how to code the following abilities?

    - the terrain Surges
    - Dazzling
    - Stamina
    - Triage
    - Merciless

    Thanks.

    Terrain Surges - Includes the Terrain Seeds. Assumes that you have already created a PsychicTerrain effect:
    Code:
          if self.hasWorkingItem(:ELECTRICSEED) && !self.pbTooHigh?(PBStats::DEFENSE) &&
                @battle.field.effects[PBEffects::ElectricTerrain]>0
            pbIncreaseStatBasic(PBStats::DEFENSE,1)
            @battle.pbDisplay(_INTL("{1}'s {2} boosted its Defense!",
                  pbThis,PBItems.getName(@item)))
          end
          if self.hasWorkingItem(:GRASSYSEED) && !self.pbTooHigh?(PBStats::DEFENSE) &&
                @battle.field.effects[PBEffects::GrassyTerrain]>0
            pbIncreaseStatBasic(PBStats::DEFENSE,1)
            @battle.pbDisplay(_INTL("{1}'s {2} boosted its Defense!",
                  pbThis,PBItems.getName(@item)))
          end
          if self.hasWorkingItem(:PSYCHICSEED) && !self.pbTooHigh?(PBStats::SPDEF) &&
                @battle.field.effects[PBEffects::PsychicTerrain]>0
            pbIncreaseStatBasic(PBStats::SPDEF,1)
            @battle.pbDisplay(_INTL("{1}'s {2} boosted its Special Defense!",
                  pbThis,PBItems.getName(@item)))
          end
          if self.hasWorkingItem(:MISTYSEED) && !self.pbTooHigh?(PBStats::SPDEF) &&
                @battle.field.effects[PBEffects::MistyTerrain]>0
            pbIncreaseStatBasic(PBStats::SPDEF,1)
            @battle.pbDisplay(_INTL("{1}'s {2} boosted its Special Defense!",
                  pbThis,PBItems.getName(@item)))
          end
          # Surge abilities
          if self.hasWorkingAbility(:ELECTRICSURGE) && @battle.field.effects[PBEffects::ElectricTerrain]<=0
            @battle.field.effects[PBEffects::ElectricTerrain]=5
            @battle.field.effects[PBEffects::ElectricTerrain]=8 if self.hasWorkingItem(:TERRAINEXTENDER)
           # @battle.pbDisplayEffect(self,false)
           # @battle.pbHideEffect(self)
            @battle.pbDisplay(_INTL("An electric current runs across the battlefield!"))
            PBDebug.log("[#{pbThis}: Elekimaker made Electric Terrain]") # Kept Japanese name in Debug log
            for i in 0...4
              [email protected][i]
              if user.hasWorkingItem(:ELECTRICSEED) && !user.pbTooHigh?(PBStats::DEFENSE)
                user.pbIncreaseStatBasic(PBStats::DEFENSE,1)
                @battle.pbDisplay(_INTL("{1}'s {2} boosted its Defense!",
                     user.pbThis,PBItems.getName(user.item)))
              end
            end
          end
          if self.hasWorkingAbility(:PSYCHICSURGE) && @battle.field.effects[PBEffects::PsychicTerrain]<=0
            @battle.field.effects[PBEffects::PsychicTerrain]=5
            @battle.field.effects[PBEffects::PsychicTerrain]=8 if self.hasWorkingItem(:TERRAINEXTENDER)
           # @battle.pbDisplayEffect(self,false)
           # @battle.pbHideEffect(self)
            @battle.pbDisplay(_INTL("The battlefield got weird!"))
            PBDebug.log("[#{pbThis}: Psychic Surge made Psychic Terrain]")
            for i in 0...4
              [email protected][i]
              if user.hasWorkingItem(:PSYCHICSEED) && !user.pbTooHigh?(PBStats::SPDEF)
                user.pbIncreaseStatBasic(PBStats::SPDEF,1)
                @battle.pbDisplay(_INTL("{1}'s {2} boosted its Special Defense!",
                     user.pbThis,PBItems.getName(user.item)))
              end
            end
          end
          if self.hasWorkingAbility(:GRASSYSURGE) && @battle.field.effects[PBEffects::GrassyTerrain]<=0
            @battle.field.effects[PBEffects::GrassyTerrain]=5
            @battle.field.effects[PBEffects::GrassyTerrain]=8 if self.hasWorkingItem(:TERRAINEXTENDER)
           # @battle.pbDisplayEffect(self,false)
           # @battle.pbHideEffect(self)
            @battle.pbDisplay(_INTL("Grass grew to cover the battlefield!"))
            PBDebug.log("[#{pbThis}: Grassy Surge made Grassy Terrain]")
            for i in 0...4
              [email protected][i]
              if user.hasWorkingItem(:GRASSYSEED) && !user.pbTooHigh?(PBStats::DEFENSE)
                user.pbIncreaseStatBasic(PBStats::DEFENSE,1)
                @battle.pbDisplay(_INTL("{1}'s {2} boosted its Defense!",
                     user.pbThis,PBItems.getName(user.item)))
              end
            end
          end
          if self.hasWorkingAbility(:MISTYSURGE) && @battle.field.effects[PBEffects::MistyTerrain]<=0
            @battle.field.effects[PBEffects::MistyTerrain]=5
            @battle.field.effects[PBEffects::MistyTerrain]=8 if self.hasWorkingItem(:TERRAINEXTENDER)
           # @battle.pbDisplayEffect(self,false)
           # @battle.pbHideEffect(self)
            @battle.pbDisplay(_INTL("Mist swirls around the battlefield!"))
            PBDebug.log("[#{pbThis}: Misty Surge made Misty Terrain]")
            for i in 0...4
              [email protected][i]
              if user.hasWorkingItem(:MISTYSEED) && !user.pbTooHigh?(PBStats::SPDEF)
                user.pbIncreaseStatBasic(PBStats::SPDEF,1)
                @battle.pbDisplay(_INTL("{1}'s {2} boosted its Special Defense!",
                     user.pbThis,PBItems.getName(user.item)))
              end
            end
          end
    Add this just above the Pressure message, in PokeBattle_Battler (with the R).


    Stamina
    Code:
            if target.hasWorkingAbility(:STAMINA)
              if target.pbCanIncreaseStatStage?(PBStats::DEFENSE)
                @battle.pbDisplayEffect(target)
                target.pbIncreaseStatBasic(PBStats::DEFENSE,1)
              end
              PBDebug.log("[#{target.pbThis}'s #{PBAbilities.getName(target.ability)} triggered]")
              @battle.pbDisplay(_INTL("{1}'s {2} raised its Defense!",target.pbThis,
                    PBAbilities.getName(target.ability)))
            end
            if target.hasWorkingAbility(:BERSERK) &&
                target.hp+damage>target.totalhp/2 &&
                target.hp<target.totalhp/2
              if target.pbCanIncreaseStatStage?(PBStats::SPATK)
                @battle.pbDisplayEffect(target)
                target.pbIncreaseStatBasic(PBStats::SPATK,1)
              end
              PBDebug.log("[#{target.pbThis}'s #{PBAbilities.getName(target.ability)} triggered]")
              target.effects[PBEffects::Berserk]==true
              @battle.pbDisplay(_INTL("{1}'s {2} raised its Special Attack!",target.pbThis,
                    PBAbilities.getName(target.ability)))
            end
    Add that just above the Cursed Body effects, in PokeBattle_Battle (without the R)


    Triage:
    Add this above the code for type effectiveness, found in PokeBattle_Move:
    Code:
      def isTriageBoosted?
        healingfunctions=[0x0D5,0x0D6,0x0D7,0x0D8,0x0D9,0x0DD,0x0DE,0x114,0x138,
                          0x171,0x179,0x1A3,0x1B5,0x1BB,0x1B4,0x0E3,0x0E4,0x0DF]
        return healingfunctions.include?(@function)
      end
    Add this above the code for Prankster, found in PokeBattle_Battle (without the R) :
    Code:
            pri+=3 if @battlers[i].hasWorkingAbility(:TRIAGE) &&
                      @choices[i][2].isTriageBoosted?


    Merciless
    In PokeBattle_Move, the function "pbIsCritical?" looks like this. Add the red line:
    Code:
      def pbIsCritical?(attacker,opponent)
        return false if opponent.hasWorkingAbility(:SHELLARMOR) && !attacker.hasBypassingAbility
        return false if opponent.pbOwnSide.effects[PBEffects::LuckyChant]>0
        return true if @function==0xA0 # Frost Breath
        [COLOR="Red"]return true if attacker.hasWorkingAbility(:MERCILESS) && opponent.status==PBStatus::POISON[/COLOR]
        return true if attacker.effects[PBEffects::LaserFocus]>0
        c=0
        ratios=[16,8,2,1]
        c+=attacker.effects[PBEffects::FocusEnergy]
        c+=1 if hasHighCriticalRate?
        c+=1 if attacker.hasWorkingAbility(:SUPERLUCK)
        if attacker.hasWorkingItem(:STICK) &&
           isConst?(attacker.species,PBSpecies,:FARFETCHD)
          c+=2
        end
        if attacker.hasWorkingItem(:LUCKYPUNCH) &&
           isConst?(attacker.species,PBSpecies,:CHANSEY)
          c+=2
        end
        c+=1 if attacker.hasWorkingItem(:RAZORCLAW)
        c+=1 if attacker.hasWorkingItem(:SCOPELENS)
        c=3 if c>3
        return @battle.pbRandom(ratios[c])==0
      end
     
    Back
    Top