WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Sheer Cold and Destiny Bond had their descriptions changed. So, edit them (P.S: some of them had changes into 'move.txt' too. Check bulbapedia):

Spoiler:

Sheer Cold:
################################################################################
# OHKO. Accuracy increases by difference between levels of user and target.
################################################################################
class PokeBattle_Move_070 < PokeBattle_Move
  def pbAccuracyCheck(attacker,opponent)
    if !attacker.hasMoldBreaker && opponent.hasWorkingAbility(:STURDY)
      @battle.pbDisplay(_INTL("{1} was protected by {2}!",opponent.pbThis,PBAbilities.getName(opponent.ability)))  
      return false
    end
    if opponent.level>attacker.level
      @battle.pbDisplay(_INTL("{1} is unaffected!",opponent.pbThis))
      return false
    end
    @accuracy=20 if isConst?(@id,PBMoves,:SHEERCOLD) && !attacker.pbHasType?(:ICE)
    [email protected]+attacker.level-opponent.level
    return @battle.pbRandom(100)<acc
  end

  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if isConst?(@id,PBMoves,:SHEERCOLD) && opponent.pbHasType?(:ICE)
      @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
      return -1
    end
    damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.fainted?
      @battle.pbDisplay(_INTL("It's a one-hit KO!"))
    end
    return damage
  end
end
Destiny Bond:
################################################################################
# If user is KO'd before it next moves, the battler that caused it also faints.
# (Destiny Bond)
################################################################################
class PokeBattle_Move_0E7 < PokeBattle_Move  
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if @id==attacker.lastMoveUsed
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    attacker.effects[PBEffects::DestinyBond]=true
    @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
    return 0
  end
end


Dark Void and Hyperspace Fury: https://www.pokecommunity.com/showthread.php?p=10104293#post10104293

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Maybe we can make a better code for Instruct (last edition 12/12/2019):
Spoiler:

################################################################################
# The user instructs the target to use its last move again. (Instruct)
################################################################################
class PokeBattle_Move_16B < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    blacklist=[
       0x168, # Instruct
       0x0D4, # Bide
       0x115, # Focus Punch
       0x171, # Shell Trap
       0x172, # Beak Blast
       0x05D, # Sketch
       0x069, # Transform
       0x05C, # Mimic
       0x14B, # King's Shield
       0x002, # Struggle
  #Moves that call other moves
       0x0AE, # Mirror Move
       0x0AF, # Copycat
       0x0B0, # Me First
       0x0B3, # Nature Power
       0x0B4, # Sleep Talk
       0x0B5, # Assist
       0x0B6  # Metronome
    ]
    if opponent.lastMoveUsed<=0 ||
       isConst?(PBMoveData.new(opponent.lastMoveUsed).type,PBTypes,:SHADOW) ||
       blacklist.include?(PBMoveData.new(opponent.lastMoveUsed).function) ||
       opponent.effects[PBEffects::Bide]>0 || 
       opponent.effects[PBEffects::HyperBeam]>0 || 
       opponent.effects[PBEffects::Rollout]>0 ||
       opponent.effects[PBEffects::TwoTurnAttack]>0
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    for i in opponent.moves
      if i.id==opponent.lastMoveUsed && i.id>0 && i.pp==0
        @battle.pbDisplay(_INTL("But it failed!"))
        return -1
      end      
    end
    if opponent.lastMoveUsed!=opponent.moves[0].id &&
       opponent.lastMoveUsed!=opponent.moves[1].id &&
       opponent.lastMoveUsed!=opponent.moves[2].id &&
       opponent.lastMoveUsed!=opponent.moves[3].id
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    @battle.pbDisplay(_INTL("{1} used the move instructed by {2}!",opponent.pbThis,attacker.pbThis))
    if opponent.effects[PBEffects::Disable]>0 && opponent.lastMoveUsed==opponent.effects[PBEffects::DisableMove] ||
       opponent.effects[PBEffects::HealBlock]>0 && opponent.lastMoveUsed.isHealingMove? ||
       @battle.field.effects[PBEffects::Gravity]>0 && opponent.lastMoveUsed.unusableInGravity? ||
       opponent.effects[PBEffects::ThroatChop]>0 && opponent.lastMoveUsed.isSoundBased? ||
       opponent.effects[PBEffects::Taunt]>0 && opponent.lastMoveUsed.basedamage==0 ||
       opponent.effects[PBEffects::Imprison]
       # Won't consume PP
    else
      @battle.choices[opponent.index][2].pp-=1
    end
    opponent.pbUseMoveSimple(opponent.lastMoveUsed,-1,@battle.choices[opponent.index][3])
    return 0
  end
end

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Here what I made for Pollen Puff:

Spoiler:

################################################################################
# If the target is an ally, heals 50% of the max HP target. If target is an 
# opponent, damages them normally. (Pollen Puff)
################################################################################
class PokeBattle_Move_16F < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if opponent.hasWorkingAbility(:BULLETPROOF)      
      PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Bulletproof (made #{@name} ineffective)")
      @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",
         opponent.pbThis,PBAbilities.getName(opponent.ability),@name))
      return -1
    end
    if attacker.pbPartner == opponent
      if opponent.effects[PBEffects::HealBlock]>0
        @battle.pbDisplay(_INTL("But it failed!"))
        return -1
      elsif opponent.hp==opponent.totalhp
        @battle.pbDisplay(_INTL("{1}'s HP is full!",opponent.pbThis))
        return -1
      end
      pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
      opponent.pbRecoverHP(((opponent.totalhp)/2).floor,true)
      @battle.pbDisplay(_INTL("{1}'s HP was restored.",opponent.pbThis))
      return 0     
    else      
      return super(attacker,opponent,hitnum,alltargets,showanimation)
    end
  end
end
Now, to follow this description:
Pokémon affected by Heal Block cannot target allies with Pollen Puff (but they can target an opponent);
Go to 'def pbChooseTarget(index,targettype)' and replace for:
Spoiler:

  def pbChooseTarget(index,targettype)
    pbShowWindow(FIGHTBOX)
    cw = @sprites["fightwindow"]
    [email protected][index]
    cw.battler=battler
    [email protected][index]
    if battler.moves[lastIndex].id!=0
      cw.setIndex(lastIndex)
    else
      cw.setIndex(0)
    end
    curwindow=pbFirstTarget(index,targettype)
    if curwindow==-1
      raise RuntimeError.new(_INTL("No targets somehow..."))
    end
    loop do
      pbGraphicsUpdate
      pbInputUpdate
      pbUpdateSelected(curwindow)
      if Input.trigger?(Input::B)
        pbUpdateSelected(-1)
        return -1
      elsif Input.trigger?(Input::C)
        pbUpdateSelected(-1)
        return curwindow
      end
      if curwindow>=0
        if Input.trigger?(Input::RIGHT) || Input.trigger?(Input::DOWN)
          loop do
            case targettype
            when PBTargets::SingleNonUser
              case curwindow
              when 0; newcurwindow=2
              when 1; newcurwindow=0
              when 2; newcurwindow=3
              when 3; newcurwindow=1
              end
            when PBTargets::UserOrPartner
              newcurwindow=(curwindow+2)%4
            end
            curwindow=newcurwindow
            next if targettype==PBTargets::SingleNonUser && curwindow==index
            next if targettype==PBTargets::SingleNonUser && curwindow==(index+2)%4 &&
                    @battle.battlers[curwindow].effects[PBEffects::HealBlock]>0 &&
                    battler.moves[lastIndex].function==0x16F # Pollen Puff
            break if [email protected][curwindow].fainted?
          end
        elsif Input.trigger?(Input::LEFT) || Input.trigger?(Input::UP)
          loop do 
            case targettype
            when PBTargets::SingleNonUser
              case curwindow
              when 0; newcurwindow=1
              when 1; newcurwindow=3
              when 2; newcurwindow=0
              when 3; newcurwindow=2
              end
            when PBTargets::UserOrPartner
              newcurwindow=(curwindow+2)%4
            end
            curwindow=newcurwindow
            next if targettype==PBTargets::SingleNonUser && curwindow==index
            next if targettype==PBTargets::SingleNonUser && curwindow==(index+2)%4 &&
                    @battle.battlers[curwindow].effects[PBEffects::HealBlock]>0 &&
                    battler.moves[lastIndex].function==0x16F # Pollen Puff
            break if [email protected][curwindow].fainted?
          end
        end
      end
    end
  end

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Rage Powder:
Spoiler:

In 'PBEffects' script, add a new effect for:
    Yawn               = 108
    RagePowder         = 109
Same in 'PokeBattle_Battler' script:
    @effects[PBEffects::FollowMe]         = 0
    @effects[PBEffects::RagePowder]       = 0
    @effects[PBEffects::Foresight]        = false
Now, replace Follow Me's code for:
    # Change target to user of Follow Me/Rage Powder (overrides Magic Coat
    # because check for Magic Coat below uses this target)
    if PBTargets.targetsOneOpponent?(thismove)
      newtarget=nil; strength=100
      for i in priority # use Pokémon latest in priority
        next if !user.pbIsOpposing?(i.index)
        if !i.fainted? && [email protected] && !i.effects[PBEffects::SkyDrop]
          if i.effects[PBEffects::FollowMe]>0 && i.effects[PBEffects::FollowMe]<strength
            PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Follow Me")
            newtarget=i; strength=i.effects[PBEffects::FollowMe]; changeeffect=0
          elsif i.effects[PBEffects::RagePowder]>0 && i.effects[PBEffects::RagePowder]<strength &&
                !(user.hasWorkingItem(:SAFETYGOGGLES) || user.pbHasType?(:GRASS) || user.hasWorkingAbility(:OVERCOAT))
            PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Rage Powder")
            newtarget=i; strength=i.effects[PBEffects::RagePowder]; changeeffect=0
          end
        end        
      end
      target=newtarget if newtarget
    end
In 'PokeBattle_MoveEffects' script, replace 'class PokeBattle_Move_117 < PokeBattle_Move' for:
################################################################################
# This round, user becomes the target of attacks that have single targets.
# (Follow Me, Rage Powder)
################################################################################
class PokeBattle_Move_117 < 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)
    if isConst?(@id,PBMoves,:FOLLOWME)
      attacker.effects[PBEffects::FollowMe]=1
      if !attacker.pbPartner.fainted? && attacker.pbPartner.effects[PBEffects::FollowMe]>0
        attacker.effects[PBEffects::FollowMe]=attacker.pbPartner.effects[PBEffects::FollowMe]+1
      end
    elsif isConst?(@id,PBMoves,:RAGEPOWDER)
      attacker.effects[PBEffects::RagePowder]=1
      if !attacker.pbPartner.fainted? && attacker.pbPartner.effects[PBEffects::RagePowder]>0
        attacker.effects[PBEffects::RagePowder]=attacker.pbPartner.effects[PBEffects::RagePowder]+1
      end
    end
    @battle.pbDisplay(_INTL("{1} became the center of attention!",attacker.pbThis))
    return 0
  end
end
Finally, in 'PokeBattle_Battle' script, add '@battlers[i].effects[PBEffects::RagePowder]=0':
    # Healing Wish/Lunar Dance - should go here
    # Spikes/Toxic Spikes/Stealth Rock - should go here (in order of their 1st use)
    for i in 0...4
      if @battlers[i].turncount>0 && @battlers[i].hasWorkingAbility(:TRUANT)
        @battlers[i].effects[PBEffects::Truant][email protected][i].effects[PBEffects::Truant]
      end
      if @battlers[i].effects[PBEffects::LockOn]>0   # Also Mind Reader
        @battlers[i].effects[PBEffects::LockOn]-=1
        @battlers[i].effects[PBEffects::LockOnPos]=-1 if @battlers[i].effects[PBEffects::LockOn]==0
      end
      @battlers[i].effects[PBEffects::Flinch]=false
      @battlers[i].effects[PBEffects::FollowMe]=0
      @battlers[i].effects[PBEffects::RagePowder]=0
      @battlers[i].effects[PBEffects::HelpingHand]=false


Spotlight:
Spoiler:

In 'PBEffects' script, add a new effect for:
    Yawn               = 108
    Spotlight          = 109
Same in 'PokeBattle_Battler' script:
    @effects[PBEffects::FollowMe]         = 0
    @effects[PBEffects::Spotlight]        = false
    @effects[PBEffects::Foresight]        = false
Now, below Follow Me's code, add:
    # Change target to user of Follow Me (overrides Magic Coat
    # because check for Magic Coat below uses this target)
    if PBTargets.targetsOneOpponent?(thismove)
      newtarget=nil; strength=100
      for i in priority # use Pokémon latest in priority
        next if !user.pbIsOpposing?(i.index)
        if !i.fainted? && [email protected] && !i.effects[PBEffects::SkyDrop] &&
           i.effects[PBEffects::FollowMe]>0 && i.effects[PBEffects::FollowMe]<strength
          PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Follow Me")
          newtarget=i; strength=i.effects[PBEffects::FollowMe]
          changeeffect=0
        end
      end
      target=newtarget if newtarget
    end
    # Change target to target of Spotlight (overrides Magic Coat
    # because check for Magic Coat below uses this target)
    if PBTargets.targetsOneOpponent?(thismove)
      newtarget=nil
      for i in priority # use Pokémon latest in priority
        next if !user.pbIsOpposing?(i.index)
        if i.effects[PBEffects::Spotlight] && !i.fainted?
          PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Spotlight")
          newtarget=i
          changeeffect=0
        end
      end
      target=newtarget if newtarget
    end
    # TODO: Pressure here is incorrect if Magic Coat redirects target
In 'PokeBattle_MoveEffects' script, paste the function for Spotlight (remember to change the function inside 'move.txt'):
################################################################################
# This round, target becomes the target of attacks that have single targets.
# (Spotlight)
################################################################################
class PokeBattle_Move_16A < 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::Spotlight]=true
    @battle.pbDisplay(_INTL("{1} became the center of attention!",opponent.pbThis))
    return 0
  end
end
Finally, in 'PokeBattle_Battle' script, add '@battlers[i].effects[PBEffects::Spotlight]=false':
    # Healing Wish/Lunar Dance - should go here
    # Spikes/Toxic Spikes/Stealth Rock - should go here (in order of their 1st use)
    for i in 0...4
      if @battlers[i].turncount>0 && @battlers[i].hasWorkingAbility(:TRUANT)
        @battlers[i].effects[PBEffects::Truant][email protected][i].effects[PBEffects::Truant]
      end
      if @battlers[i].effects[PBEffects::LockOn]>0   # Also Mind Reader
        @battlers[i].effects[PBEffects::LockOn]-=1
        @battlers[i].effects[PBEffects::LockOnPos]=-1 if @battlers[i].effects[PBEffects::LockOn]==0
      end
      @battlers[i].effects[PBEffects::Flinch]=false
      @battlers[i].effects[PBEffects::FollowMe]=0
      @battlers[i].effects[PBEffects::Spotlight]=false
      @battlers[i].effects[PBEffects::HelpingHand]=false


Burn Up:
Spoiler:

For 'move.txt' ('XXX' will be your last number):
XXX,BURNUP,Burn Up,162,130,FIRE,Special,100,5,0,00,0,befg,"To inflict massive damage, the user burns itself out."
In 'PBEffects' script, add a new effect for:
    Yawn               = 108
    BurnUp             = 109
Same in 'PokeBattle_Battler' script:
    @effects[PBEffects::Yawn]             = 0
    @effects[PBEffects::BurnUp]           = false
Also, replace PROTEAN's code:
    # Protean
    if user.hasWorkingAbility(:PROTEAN) &&
       thismove.function!=0xAE && # Mirror Move
       thismove.function!=0xAF && # Copycat
       thismove.function!=0xB0 && # Me First
       thismove.function!=0xB3 && # Nature Power
       thismove.function!=0xB4 && # Sleep Talk
       thismove.function!=0xB5 && # Assist
       thismove.function!=0xB6    # Metronome
      movetype=thismove.pbType(thismove.type,user,nil)
      typeless=false
      typeless=true if !user.pbHasType?(:FIRE) && thismove.function==0x162 # Burn Up
      if !typeless
        if !user.pbHasType?(movetype)
          typename=PBTypes.getName(movetype)
          PBDebug.log("[Ability triggered] #{pbThis}'s Protean made it #{typename}-type")
          user.type1=movetype
          user.type2=movetype
          user.effects[PBEffects::Type3]=-1
          user.effects[PBEffects::BurnUp]=false
          @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typename))  
        end
      end
    end
Now, in 'PokeBattle_Move' script, inside 'def pbTypeModifier(type,attacker,opponent)', paste below Roost's code:
    # Roost
    if isConst?(otype1,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost]
      if isConst?(otype2,PBTypes,:FLYING) && isConst?(otype3,PBTypes,:FLYING)
        otype1=getConst(PBTypes,:NORMAL) || 0
      else
        otype1=otype2
      end
    end
    if isConst?(otype2,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost]
      otype2=otype1
    end
    # Burn Up
    if isConst?(otype1,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
      if isConst?(otype2,PBTypes,:FIRE)
        otype1=getConst(PBTypes,:QMARKS)
      else
        otype1=otype2
      end
    end
    if isConst?(otype2,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
      otype2=otype1
    end    
    # Get effectivenesses
Then, 'PokeBattle_MoveEffects' script to add the function:
################################################################################
# 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 (Burn Up)
################################################################################
class PokeBattle_Move_162 < PokeBattle_Move
  def pbMoveFailed(attacker,opponent)
    return !(attacker.pbHasType?(:FIRE))
  end
    
  def pbEffectAfterHit(attacker,opponent,turneffects)
    if !attacker.fainted?
      attacker.effects[PBEffects::BurnUp]=true
      @battle.pbDisplay(_INTL("{1} burned itself out!",attacker.pbThis))
    end
  end
end
Replace Reflect Type's script:
################################################################################
# User copes target's types. (Reflect Type)
################################################################################
class PokeBattle_Move_062 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if isConst?(attacker.ability,PBAbilities,:MULTITYPE)
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    if attacker.pbHasType?(opponent.type1) &&
       attacker.pbHasType?(opponent.type2) &&
       attacker.pbHasType?(opponent.effects[PBEffects::Type3]) &&
       opponent.pbHasType?(attacker.type1) &&
       opponent.pbHasType?(attacker.type2) &&
       opponent.pbHasType?(attacker.effects[PBEffects::Type3])
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    attacker.type1=opponent.type1
    attacker.type2=opponent.type2
    attacker.effects[PBEffects::Type3]=-1
    @battle.pbDisplay(_INTL("{1}'s type changed to match {2}'s!",attacker.pbThis,opponent.pbThis(true)))
    attacker.effects[PBEffects::BurnUp]=false
    return 0
  end
end
Finally, for AI, inside 'PokeBattle_AI' script, paste below Roost's code:
    # Roost
    if isConst?(otype1,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost]
      if isConst?(otype2,PBTypes,:FLYING) && isConst?(otype3,PBTypes,:FLYING)
        otype1=getConst(PBTypes,:NORMAL) || 0
      else
        otype1=otype2
      end
    end
    if isConst?(otype2,PBTypes,:FLYING) && opponent.effects[PBEffects::Roost]
      otype2=otype1
    end
    # Burn Up
    if isConst?(otype1,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
      if isConst?(otype2,PBTypes,:FIRE) && isConst?(otype3,PBTypes,:FIRE)
        otype1=getConst(PBTypes,:QMARKS)
      else
        otype1=otype2
      end
    end
    if isConst?(otype2,PBTypes,:FIRE) && opponent.effects[PBEffects::BurnUp]
      otype2=otype1
    end    
    # Get effectivenesses


Stomping Tantrum:
Spoiler:

Spoiler:

New effect on 'PBEffects':
    Yawn               = 108
    StompingTantrum    = 109
Same to 'PokeBattle_Battler':
    @effects[PBEffects::Yawn]             = 0
    @effects[PBEffects::StompingTantrum]  = false
Now, inside 'def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true)' add for the move:
      # Check success (accuracy/evasion calculation)
      if !nocheck &&
         !pbSuccessCheck(thismove,user,target,turneffects,i==0 || thismove.successCheckPerHit?)
        if thismove.function==0xBF && realnumhits>0   # Triple Kick
          break   # Considered a success if Triple Kick hits at least once
        elsif thismove.function==0x10B   # Hi Jump Kick, Jump Kick
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Move effect triggered] #{user.pbThis} took crash damage")
            # TODO: Not shown if message is "It doesn't affect XXX..."
            @battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
            damage=(user.totalhp/2).floor
            if damage>0
              @battle.scene.pbDamageAnimation(user,0)
              user.pbReduceHP(damage)
            end
            user.pbFaint if user.fainted?
          end
        end
        if ((target.effects[PBEffects::Protect] || 
           (target.pbOwnSide.effects[PBEffects::QuickGuard] && thismove.priority>0) ||
           (target.pbOwnSide.effects[PBEffects::MatBlock] && thismove.pbIsStatus?) ||
           (target.effects[PBEffects::KingsShield] && thismove.pbIsStatus?) ||
            target.effects[PBEffects::SpikyShield] ||
            target.effects[PBEffects::BanefulBunker]) && thismove.canProtectAgainst?) ||
           (target.pbOwnSide.effects[PBEffects::WideGuard] && PBTargets.hasMultipleTargets?(thismove) && 
                                                              thismove.pbIsStatus?) ||
           (target.pbOwnSide.effects[PBEffects::CraftyShield] && thismove.pbIsStatus? && 
                                                              thismove.function!=0xE5) || # Perish Song
          user.effects[PBEffects::StompingTantrum]=false
        else
          user.effects[PBEffects::StompingTantrum]=true
        end
        user.effects[PBEffects::Outrage]=0 if thismove.function==0xD2 # Outrage
        user.effects[PBEffects::Rollout]=0 if thismove.function==0xD3 # Rollout
        user.effects[PBEffects::FuryCutter]=0 if thismove.function==0x91 # Fury Cutter
        user.effects[PBEffects::Stockpile]=0 if thismove.function==0x113 # Spit Up
        return
      end
Replace 'if numhits>1 && target.damagestate.calcdamage<=0' to:
      if numhits>1 && target.damagestate.calcdamage<=0
        user.effects[PBEffects::StompingTantrum]=true
        return
      end
Below 'if !pbTryUseMove(choice,thismove,turneffects)' add:
self.effects[PBEffects::StompingTantrum]=true if self.effects[PBEffects::HyperBeam]==0
Same to 'if !thismove.pbOnStartUse(user) # Selfdestruct, Natural Gift, Beat Up can return false here'. add:
user.effects[PBEffects::StompingTantrum]=true
below 'PBDebug.log(sprintf("[Move failed] Failed pbOnStartUse (function code %02X)",thismove.function))';

Now, for '# Primordial Sea, Desolate Land' replace until Protean's code:
Spoiler:

    # Primordial Sea, Desolate Land
    if thismove.pbIsDamaging?
      case @battle.pbWeather
      when PBWeather::HEAVYRAIN
        if isConst?(thismove.pbType(thismove.type,user,nil),PBTypes,:FIRE)
          PBDebug.log("[Move failed] Primordial Sea's rain cancelled the Fire-type #{thismove.name}")
          @battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))
          user.effects[PBEffects::StompingTantrum]=true
          user.lastMoveUsed=thismove.id
          user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
          if !turneffects[PBEffects::SpecialUsage]
            user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
            user.lastRegularMoveUsed=thismove.id
          end
          @battle.lastMoveUsed=thismove.id
          @battle.lastMoveUser=user.index
          return
        end
      when PBWeather::HARSHSUN
        if isConst?(thismove.pbType(thismove.type,user,nil),PBTypes,:WATER)
          PBDebug.log("[Move failed] Desolate Land's sun cancelled the Water-type #{thismove.name}")
          @battle.pbDisplay(_INTL("The Water-type attack evaporated in the harsh sunlight!"))
          user.effects[PBEffects::StompingTantrum]=true
          user.lastMoveUsed=thismove.id
          user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
          if !turneffects[PBEffects::SpecialUsage]
            user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
            user.lastRegularMoveUsed=thismove.id
          end
          @battle.lastMoveUsed=thismove.id
          @battle.lastMoveUser=user.index
          return
        end
      end
    end
    # Powder
    if user.effects[PBEffects::Powder] && isConst?(thismove.pbType(thismove.type,user,nil),PBTypes,:FIRE)
      PBDebug.log("[Lingering effect triggered] #{pbThis}'s Powder cancelled the Fire move")
      @battle.pbCommonAnimation("Powder",user,nil)
      @battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
      user.pbReduceHP(1+(user.totalhp/4).floor) if !user.hasWorkingAbility(:MAGICGUARD)
      user.effects[PBEffects::StompingTantrum]=true
      user.lastMoveUsed=thismove.id
      user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
      if !turneffects[PBEffects::SpecialUsage]
        user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
        user.lastRegularMoveUsed=thismove.id
      end
      @battle.lastMoveUsed=thismove.id
      @battle.lastMoveUser=user.index
      user.pbFaint if user.fainted?
      pbEndTurn(choice)
      return
    end


Change the code below '# Try to use move against user if there aren't any targets' to:
    # Try to use move against user if there aren't any targets
    if targets.length==0
      user=pbChangeUser(thismove,user)
      if thismove.target==PBTargets::SingleNonUser ||
         thismove.target==PBTargets::RandomOpposing ||
         thismove.target==PBTargets::AllOpposing ||
         thismove.target==PBTargets::AllNonUsers ||
         thismove.target==PBTargets::Partner ||
         thismove.target==PBTargets::UserOrPartner ||
         thismove.target==PBTargets::SingleOpposing ||
         thismove.target==PBTargets::OppositeOpposing
        user.effects[PBEffects::StompingTantrum]=true
        @battle.pbDisplay(_INTL("But there was no target..."))
      else
        PBDebug.logonerr{
           check=thismove.pbEffect(user,nil)
           if check==-1
             user.effects[PBEffects::StompingTantrum]=true
          end
        }
      end
    else
      # We have targets
Replace the code below '# For each target in turn' to:
      # For each target in turn
      i=0; misses=0; loop do break if i>=targets.length
        # Get next target
        userandtarget=[user,targets[i]]
        success=pbChangeTarget(thismove,userandtarget,targets)
        user=userandtarget[0]
        target=userandtarget[1]
        if i==0 && thismove.target==PBTargets::AllOpposing
          # Add target's partner to list of targets
          pbAddTarget(targets,target.pbPartner)
        end
        # If couldn't get the next target
        if !success
          i+=1
          next
        end
        # Get the number of hits
        numhits=thismove.pbNumHits(user)
        # Reset damage state, set Focus Band/Focus Sash to available
        target.damagestate.reset
        # Use move against the current target
        pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,false,alltargets,showanimation)
        showanimation=false
        if target.damagestate.calcdamage>0 && 
          (thismove.target==PBTargets::AllOpposing || thismove.target==PBTargets::AllNonUsers)
          misses+=1 
        end
        i+=1
      end
      if misses>0
        user.effects[PBEffects::StompingTantrum]=false
      end
    end
    # Pokémon switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail, Red Card
Go to 'PokeBattle_Move' and replace 'def pbTypeModMessages(type,attacker,opponent)' to:
  def pbTypeModMessages(type,attacker,opponent)
    return 8 if type<0
    typemod=pbTypeModifier(type,attacker,opponent)
    if typemod==0
      @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
    else
      if pbTypeImmunityByAbility(type,attacker,opponent)
        attacker.effects[PBEffects::StompingTantrum]=true
        return 0
      end
    end
    return typemod
  end
Finally, the function for the move, in 'PokeBattle_MoveEffects':
################################################################################
# Power is doubled if the last move the user used failed or had no effect.
# Doesn't apply if that move was protected against. (Stomping Tantrum)
################################################################################
class PokeBattle_Move_166 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    if attacker.effects[PBEffects::StompingTantrum]
      attacker.effects[PBEffects::StompingTantrum]=false
      PBDebug.log("[Previous move failed] #{attacker.pbThis} double Stomping Tantrum damage")
      return basedmg*2
    else
      return basedmg
    end
  end
end

Here what I followed: https://pastebin.com/aXi24qTy

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Improve Prankster ability:
Spoiler:

In 'PokeBattle_Battler' script, inside 'def pbSuccessCheck(thismove,user,target,turneffects,accuracy=true)' look for:
    p=thismove.priority
    if USENEWBATTLEMECHANICS
      p+=1 if user.hasWorkingAbility(:PRANKSTER) && thismove.pbIsStatus?
      p+=1 if user.hasWorkingAbility(:GALEWINGS) && isConst?(thismove.type,PBTypes,:FLYING)
	  
	 etc etc
Then, below (the respective 'end' for 'if USENEWBATTLEMECHANICS"), paste:
    if p>0 
      for i in 0...4
	    [email protected][i]
        if user.hasWorkingAbility(:PRANKSTER) && thismove.pbIsStatus? &&
           pbIsOpposing?(i) && target.pbHasType?(:DARK) &&
          thismove.target!=PBTargets::BothSides && thismove.target!=PBTargets::OpposingSide
          @battle.pbDisplay(_INTL("It doesn't affect\r\n{1}...",target.pbThis(true)))
          PBDebug.log("[Move failed] Type immunity")
          return false
        end
      end
    end
    #if target.pbOwnSide.effects[PBEffects::QuickGuard] && thismove.canProtectAgainst? && # Reference
Now we need to edit Perish Song and Rototiller's code, inside 'PokeBattle_MoveEffects' script:
Spoiler:

################################################################################
# All current battlers will perish after 3 more rounds. (Perish Song)
################################################################################
class PokeBattle_Move_0E5 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    failed=true
    for i in 0...4
      if @battle.battlers[i].effects[PBEffects::PerishSong]==0 &&
         (attacker.hasMoldBreaker ||
         [email protected][i].hasWorkingAbility(:SOUNDPROOF))
        failed=false; break
      end
    end
    if failed
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    @battle.pbDisplay(_INTL("All Pokémon that hear the song will faint in three turns!"))
    for i in 0...4
      if @battle.battlers[i].effects[PBEffects::PerishSong]==0
        if !attacker.hasMoldBreaker && @battle.battlers[i].hasWorkingAbility(:SOUNDPROOF)
          @battle.pbDisplay(_INTL("{1}'s {2} blocks {3}!",@battle.battlers[i].pbThis,
             PBAbilities.getName(@battle.battlers[i].ability),@name))
        else
          if attacker.hasWorkingAbility(:PRANKSTER) && attacker.pbIsOpposing?(i) && 
             @battle.battlers[i].pbHasType?(:DARK)
            @battle.pbDisplay(_INTL("It doesn't affect\r\n{1}...",@battle.battlers[i].pbThis(true)))
          else
            @battle.battlers[i].effects[PBEffects::PerishSong]=4
            @battle.battlers[i].effects[PBEffects::PerishSongUser]=attacker.index
          end
        end
      end
    end
    return 0
  end
end
################################################################################
# Increases the Attack and Special Attack of all Grass-type Pokémon on the field
# by 1 stage each. Doesn't affect airborne Pokémon. (Rototiller)
################################################################################
class PokeBattle_Move_13E < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    didsomething=false
    for i in [attacker,attacker.pbPartner,attacker.pbOpposing1,attacker.pbOpposing2]
      next if !i || i.fainted?
      next if !i.pbHasType?(:GRASS)
      next if i.isAirborne?(attacker.hasMoldBreaker)
      next if !i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
              !i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
      if attacker.hasWorkingAbility(:PRANKSTER) && i!=attacker.pbPartner && i.pbHasType?(:DARK)
        @battle.pbDisplay(_INTL("It doesn't affect\r\n{1}...",i.pbThis(true)))
        next
      end
      pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) if !didsomething
      didsomething=true
      showanim=true
      if i.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
        i.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim)
        showanim=false
      end
      if i.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
        i.pbIncreaseStat(PBStats::SPATK,1,attacker,false,self,showanim)
        showanim=false
      end
    end
    if !didsomething
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    return 0
  end
end

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
I haven't done Pollen Puff yet, but here's Spectral Thief:

################################################################################
# Steals target's stat boosts, then attacks
################################################################################
class PokeBattle_Move_1A1 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if opponent.stages[1]>0 || opponent.stages[2]>0 || opponent.stages[3]>0 ||
       opponent.stages[4]>0 || opponent.stages[5]>0 || opponent.stages[6]>0 ||
       opponent.stages[7]>0
      stolenstats=[0,0,0,0,0,0,0,0]
      for i in 0...8
        stolenstats[i]=opponent.stages[i]*1 if opponent.stages[i]>0
        opponent.stages[i]=0 if opponent.stages[i]>0
      end
      @battle.pbDisplay(_INTL("{1} stole {2}'s stat boosts!",attacker.pbThis,opponent.pbThis(true)))
      showanim=true
      for i in 0...6
        if attacker.pbCanIncreaseStatStage?(i,true,attacker) && stolenstats[i]>0
          attacker.pbIncreaseStat(i,stolenstats[i],true,showanim,attacker)
          showanim=false
        end
      end
    end
    # actually attack now
    ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    return ret
  end
end
Someone can improve that code for v17.2? Am trying to but no success yet....

mgriffin

Seen 2 Weeks Ago
Posted 2 Weeks Ago
1,336 posts
6.6 Years
class PokeBattle_Move_000 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    showstatmessage = showanimation
    for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPATK,PBStats::SPDEF,PBStats::SPEED,PBStats::ACCURACY,PBStats::EVASION]
      if opponent.stages[i] > 0
        if attacker.pbCanIncreaseStatStage?(i,attacker)
          @battle.pbDisplay(_INTL("{1} stole {2}'s stat boosts!",attacker.pbThis,opponent.pbThis(true))) if showstatmessage
          attacker.pbIncreaseStat(i,opponent.stages[i],attacker,showanimation)
          showstatmessage = false
        end
        opponent.stages[i] = 0
      end
    end
    return super(attacker,opponent,hitnum,alltargets,showanimation)
  end
end
Steals accuracy and evasion (unlike the code you posted tries to do). Really the only non-style change is using PBStats::BLABLABLA instead of numbers.

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Steals accuracy and evasion (unlike the code you posted tries to do). Really the only non-style change is using PBStats::BLABLABLA instead of numbers.
Now it works like a charm:
Spoiler:

################################################################################
# Steals opponent's stat boosts before doing damage. (Spectral Thief)
################################################################################
class PokeBattle_Move_15D < PokeBattle_Move   
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    showanim=true
    for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPATK,PBStats::SPDEF,
              PBStats::SPEED,PBStats::ACCURACY,PBStats::EVASION]
      if opponent.stages[i] > 0
        if attacker.pbCanIncreaseStatStage?(i,attacker,false,self)
          @battle.pbDisplay(_INTL("{1} stole the target's boosted stat!",attacker.pbThis)) if showanim
          attacker.pbIncreaseStat(i,opponent.stages[i],attacker,false,self,showanim)
          showanim=false
        end
        opponent.stages[i] = 0
      end
    end
    super(attacker,opponent,hitnum,alltargets,showanimation)
  end
end


Thanks MGriffin!

Now we need to improve Stomping Tantrum (still need to code when double battle, to activate double damage the move needs to fail FOR ALL MOVE'S TARGET (like Earthquake, if failed only to Levitate target and hit your ally or the target partner, won't double damage). Here the link: https://www.pokecommunity.com/showthread.php?p=10100546#post10100546) and Dancer ability. xD

EDIT: IMPROVED POLLEN PUFF. All works fine. Check the link: https://www.pokecommunity.com/showthread.php?p=10093042#post10093042

Revelation Dance (from vanilla Essentials v17.2):
Spoiler:

And add the function in 'PokeBattle_MoveEffects':
################################################################################
#  The user's type determines the type of this move. (Revelation Dance)
################################################################################
class PokeBattle_Move_169 < PokeBattle_Move
  def pbModifyType(type,attacker,opponent)
    type=getConst(PBTypes,:NORMAL) || 0
    case attacker.type1
    when PBTypes::FIGHTING
      type=(getConst(PBTypes,:FIGHTING) || type)
    when PBTypes::FLYING
      type=(getConst(PBTypes,:FLYING) || type)
    when PBTypes::POISON
      type=(getConst(PBTypes,:POISON) || type)
    when PBTypes::GROUND
      type=(getConst(PBTypes,:GROUND) || type)
    when PBTypes::ROCK
      type=(getConst(PBTypes,:ROCK) || type)
    when PBTypes::BUG
      type=(getConst(PBTypes,:BUG) || type)
    when PBTypes::GHOST
      type=(getConst(PBTypes,:GHOST) || type)
    when PBTypes::STEEL
      type=(getConst(PBTypes,:STEEL) || type)
    when PBTypes::FIRE
      type=(getConst(PBTypes,:FIRE) || type)
    when PBTypes::QMARKS
      type=(getConst(PBTypes,:QMARKS) || type)
    when PBTypes::WATER
      type=(getConst(PBTypes,:WATER) || type)
    when PBTypes::GRASS
      type=(getConst(PBTypes,:GRASS) || type)
    when PBTypes::ELECTRIC
      type=(getConst(PBTypes,:ELECTRIC) || type)
    when PBTypes::PSYCHIC
      type=(getConst(PBTypes,:PSYCHIC) || type)
    when PBTypes::ICE
      type=(getConst(PBTypes,:ICE) || type)
    when PBTypes::DRAGON
      type=(getConst(PBTypes,:DRAGON) || type)
    when PBTypes::DARK
      type=(getConst(PBTypes,:DARK) || type)
    when PBTypes::FAIRY
      type=(getConst(PBTypes,:FAIRY) || type)
    end
    return type
  end
end
Seen October 13th, 2020
Posted December 20th, 2019
4 posts
1.9 Years
[QUOTE=WolfPP;9974953]Mind Blown (Blacephalon's signature move):
Spoiler:

move.txt (xxx=last number in you moves.txt):
xxx,MINDBLOWN,Mind Blown,1CF,150,FIRE,Special,100,5,0,00,0,bef,"The user attacks everything around it by causing its own head to explode. This also damages the user."
in 'PokeBattle_MoveEffects':

Spoiler:

################################################################################
# User takes recoil damage equal to 1/2 of the damage this move dealt.
# (Mind Blown)
################################################################################
class PokeBattle_Move_1CF < PokeBattle_Move
  def pbOnStartUse(attacker)
    if !attacker.hasMoldBreaker
      [email protected](:DAMP)
      if bearer!=nil
          @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
             bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
        end
        return false
      end
    end
    return true
  end

  def pbEffectAfterHit(attacker,opponent,turneffects)
    if !attacker.fainted?
      if !attacker.hasWorkingAbility(:MAGICGUARD)
        attacker.pbReduceHP((attacker.totalhp/2.0).round)
      end
    end
  end
end





This is weird. For the MINDBLOWN script I get a syntax error for the last "end" line.

mgriffin

Seen 2 Weeks Ago
Posted 2 Weeks Ago
1,336 posts
6.6 Years
This is weird. For the MINDBLOWN script I get a syntax error for the last "end" line.
I'm not sure why the end I've marked in red exists:
if bearer!=nil
  @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
  end
  return false
end
You probably want to delete it.

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Fixed. Thanks Frosty Raziel!

Also, I recommend you guys to check this link:
https://essentialsdocs.fandom.com/wiki/User:Maruno/Function_codes?useskin=osasis#Generation_7_moves

Some script moves you can just edit to put them to gen 7 moves (like Psychic Fang, Plasma Fist, etc).

Mind Blown
Old Version:
Spoiler:

EDIT: Man What a bad script for that move! OMG. Here a better one (following the official descriptions about the miss, Damp, Parental Bond and Flash Fire):
Spoiler:

Create a new effect in 'PBEffects':
    Yawn               = 108
    MindBlown          = 109
Same in 'PokeBattle_Battler':
    @effects[PBEffects::Yawn]             = 0
    @effects[PBEffects::MindBlown]        = false
Inside 'def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true)' add the effect (P.S: my function is 170. Pay attention with yours):
Spoiler:

      if !nocheck &&
         !pbSuccessCheck(thismove,user,target,turneffects,i==0 || thismove.successCheckPerHit?)
        if thismove.function==0xBF && realnumhits>0   # Triple Kick
          break   # Considered a success if Triple Kick hits at least once
        elsif thismove.function==0x10B   # Hi Jump Kick, Jump Kick
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Move effect triggered] #{user.pbThis} took crash damage")
            # TODO: Not shown if message is "It doesn't affect XXX..."
            @battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
            damage=(user.totalhp/2).floor
            if damage>0
              @battle.scene.pbDamageAnimation(user,0)
              user.pbReduceHP(damage)
            end
            user.pbFaint if user.fainted?
          end
        end
        user.effects[PBEffects::MindBlown]=true if thismove.function==0x170 # Mind Blown
        user.effects[PBEffects::Outrage]=0 if thismove.function==0xD2 # Outrage
        user.effects[PBEffects::Rollout]=0 if thismove.function==0xD3 # Rollout
        user.effects[PBEffects::FuryCutter]=0 if thismove.function==0x91 # Fury Cutter
        user.effects[PBEffects::Stockpile]=0 if thismove.function==0x113 # Spit Up
        return
      end


For the case when pokémon misses. Replace 'if !pbTryUseMove(choice,thismove,turneffects)':
Spoiler:

    # Try to use the move
    if !pbTryUseMove(choice,thismove,turneffects)
      self.lastMoveUsed=-1
      self.lastMoveUsedType=-1
      if !turneffects[PBEffects::SpecialUsage]
        self.lastMoveUsedSketch=-1 if self.effects[PBEffects::TwoTurnAttack]==0
        self.lastRegularMoveUsed=-1
      end
      if self.effects[PBEffects::MindBlown]
        self.effects[PBEffects::MindBlown]=false
        if !self.hasWorkingAbility(:MAGICGUARD)
          self.pbReduceHP((self.totalhp/2.0).round)
          self.pbFaint if self.fainted?
        end
      end
      pbCancelMoves
      @battle.pbGainEXP
      pbEndTurn(choice)
      @battle.pbJudge #      @battle.pbSwitch
      return
    end


Same for the code below '# Primordial Sea, Desolate Land', when 'PBWeather::HEAVYRAIN':
Spoiler:

      when PBWeather::HEAVYRAIN
        if isConst?(thismove.pbType(thismove.type,user,nil),PBTypes,:FIRE)
          PBDebug.log("[Move failed] Primordial Sea's rain cancelled the Fire-type #{thismove.name}")
          @battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))
          user.lastMoveUsed=thismove.id
          user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
          if !turneffects[PBEffects::SpecialUsage]
            user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
            user.lastRegularMoveUsed=thismove.id
          end
          @battle.lastMoveUsed=thismove.id
          @battle.lastMoveUser=user.index
          if user.effects[PBEffects::MindBlown]
            user.effects[PBEffects::MindBlown]=false
            if !user.hasWorkingAbility(:MAGICGUARD)
              user.pbReduceHP((user.totalhp/2.0).round)
              user.pbFaint if user.fainted?
            end
          end
          return
        end
      when PBWeather::HARSHSUN


Also for '# Powder':
Spoiler:

    # Powder
    if user.effects[PBEffects::Powder] && isConst?(thismove.pbType(thismove.type,user,nil),PBTypes,:FIRE)
      PBDebug.log("[Lingering effect triggered] #{pbThis}'s Powder cancelled the Fire move")
      @battle.pbCommonAnimation("Powder",user,nil)
      @battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
      user.pbReduceHP(1+(user.totalhp/4).floor) if !user.hasWorkingAbility(:MAGICGUARD)
      user.lastMoveUsed=thismove.id
      user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
      if !turneffects[PBEffects::SpecialUsage]
        user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
        user.lastRegularMoveUsed=thismove.id
      end
      if user.effects[PBEffects::MindBlown]
        user.effects[PBEffects::MindBlown]=false
        if !user.hasWorkingAbility(:MAGICGUARD)
          user.pbReduceHP((user.totalhp/2.0).round)
        end
      end
      @battle.lastMoveUsed=thismove.id
      @battle.lastMoveUser=user.index
      user.pbFaint if user.fainted?
      pbEndTurn(choice)
      return
    end


Now, inside 'if targets.length==0', above '@battle.pbDisplay(_INTL("But there was no target..."))', paste:
         thismove.target==PBTargets::OppositeOpposing
        user.effects[PBEffects::MindBlown]=false
        @battle.pbDisplay(_INTL("But there was no target..."))
      else
Above '# Pokémon switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail, Red Card', paste:
    # Mind Blown
    if user.effects[PBEffects::MindBlown]
      user.effects[PBEffects::MindBlown]=false
      if !user.hasWorkingAbility(:MAGICGUARD)
        user.pbReduceHP((user.totalhp/2.0).round)
        user.pbFaint if user.fainted?
      end
    end
    # Pokémon switching caused by Roar, Whirlwind, Circle Throw, Dragon Tail, Red Card
Then, in 'PokeBattle_Move', replace 'def pbTypeModMessages(type,attacker,opponent)' for:
  def pbTypeModMessages(type,attacker,opponent)
    return 8 if type<0
    typemod=pbTypeModifier(type,attacker,opponent)
    if typemod==0
      @battle.pbDisplay(_INTL("It doesn't affect {1}...",opponent.pbThis(true)))
    else
      if pbTypeImmunityByAbility(type,attacker,opponent)
        attacker.effects[PBEffects::MindBlown]=true
        return 0
      end
    end
    return typemod
  end
For Parental Bond case (to take recoil before the second hit), in 'PokeBattle_Move', look for 'def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)' and replace for:
  def pbShowAnimation(id,attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    return if !showanimation
    if attacker.effects[PBEffects::ParentalBond]==1
      if attacker.effects[PBEffects::MindBlown]
        attacker.effects[PBEffects::MindBlown]=false
        attacker.pbReduceHP((attacker.totalhp/2.0).round)
        attacker.pbFaint if attacker.fainted?
      end
      @battle.pbCommonAnimation("ParentalBond",attacker,opponent)
      return
    end
    @battle.pbAnimation(id,attacker,opponent,hitnum)
  end

Finally, the code for the function/move:
################################################################################
# User takes recoil damage equal to 1/2 of the damage this move dealt. (Mind Blown)
################################################################################
class PokeBattle_Move_170 < PokeBattle_Move
  def pbOnStartUse(attacker)
    if !attacker.hasMoldBreaker
      [email protected](:DAMP)
      if bearer!=nil
        @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
          bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
        return false
      end
    end
    return true
  end
  
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    attacker.effects[PBEffects::MindBlown]=true
    super(attacker,opponent,hitnum,alltargets,showanimation)
  end
end



New version: https://www.pokecommunity.com/showthread.php?p=10104293#post10104293

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Detail about Dark Void/Hyperspace Fury, that only can be used if the attacker is Darkrai (or Ditto/Mew transformed into) or Hoopa Unbound (or Ditto/Mew transfomed into):
Spoiler:

We will add two new effects, to store the species and the form. Go to 'PBEffects' and add:
    Yawn               = 108
    SpeciesTransform   = 109
    FormTransform      = 110
Same to 'PokeBattle_Battler':
    @effects[PBEffects::Transform]        = false
    @effects[PBEffects::SpeciesTransform] = 0
    @effects[PBEffects::FormTransform]    = 0
Now, replace Imposter's code (and yeah I added some details here too for Roost or Burn Up case):
    # Imposter
    if self.hasWorkingAbility(:IMPOSTER) && [email protected][PBEffects::Transform] && onactive
      choice=pbOppositeOpposing
      blacklist=[
         0xC9,    # Fly
         0xCA,    # Dig
         0xCB,    # Dive
         0xCC,    # Bounce
         0xCD,    # Shadow Force
         0xCE,    # Sky Drop
         0x14D    # Phantom Force
      ]
      if choice.effects[PBEffects::Transform] ||
         choice.effects[PBEffects::Illusion] ||
         choice.effects[PBEffects::Substitute]>0 ||
         choice.effects[PBEffects::SkyDrop] ||
         blacklist.include?(PBMoveData.new(choice.effects[PBEffects::TwoTurnAttack]).function)
        PBDebug.log("[Ability triggered] #{pbThis}'s Imposter couldn't transform")
      else
        PBDebug.log("[Ability triggered] #{pbThis}'s Imposter")
        @battle.pbAnimation(getConst(PBMoves,:TRANSFORM),self,choice)
        @effects[PBEffects::Transform]=true
        @effects[PBEffects::SpeciesTransform]=choice.species
        @effects[PBEffects::FormTransform]=choice.form
        if isConst?(choice.type1,PBTypes,:QMARKS)
          @type1=getConst(PBTypes,:NORMAL)
        else
          @type1=choice.type1
          @type2=choice.type2
        end
        @effects[PBEffects::Type3]=-1
        @ability=choice.ability
        @attack=choice.attack
        @defense=choice.defense
        @speed=choice.speed
        @spatk=choice.spatk
        @spdef=choice.spdef
        for i in [PBStats::ATTACK,PBStats::DEFENSE,PBStats::SPEED,
                  PBStats::SPATK,PBStats::SPDEF,PBStats::ACCURACY,PBStats::EVASION]
          @stages[i]=choice.stages[i]
        end
        for i in 0...4
          @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(choice.moves[i].id))
          @moves[i].pp=5
          @moves[i].totalpp=5
        end
        @effects[PBEffects::Disable]=0
        @effects[PBEffects::DisableMove]=0
        @battle.pbDisplay(_INTL("{1} transformed into {2}!",pbThis,choice.pbThis(true)))
        PBDebug.log("[Pokémon transformed] #{pbThis} transformed into #{choice.pbThis(true)}")
      end
    end
Finally, the functions inside 'PokeBattle_MoveEffects' (and yeah I added some details here too for Roost or Burn Up case):
Spoiler:

################################################################################
# Puts the target to sleep.
################################################################################
class PokeBattle_Move_003 < PokeBattle_Move
  def pbOnStartUse(attacker)
    if isConst?(@id,PBMoves,:DARKVOID) 
      if (isConst?(attacker.species,PBSpecies,:DARKRAI) ||
          isConst?(attacker.effects[PBEffects::SpeciesTransform],PBSpecies,:DARKRAI))
        return true
      else
        @battle.pbDisplay(_INTL("But {1} can't use the move!",attacker.pbThis(true)))
        return false
      end
    else
      return true
    end    
  end  
  
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?      
    return -1 if pbTypeImmunityByAbility(pbType(@type,attacker,opponent),attacker,opponent)
    if opponent.pbCanSleep?(attacker,true,self)
      pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
      opponent.pbSleep
      return 0
    end
    return -1
  end

  def pbAdditionalEffect(attacker,opponent)
    return if opponent.damagestate.substitute
    if opponent.pbCanSleep?(attacker,false,self)
      opponent.pbSleep
    end
  end

  def pbEffectAfterHit(attacker,opponent,turneffects)
    if isConst?(@id,PBMoves,:RELICSONG)
      if isConst?(attacker.species,PBSpecies,:MELOETTA) &&
         !attacker.effects[PBEffects::Transform] &&
         !(attacker.hasWorkingAbility(:SHEERFORCE) && self.addlEffect>0) &&
         !attacker.fainted?
        attacker.form=(attacker.form+1)%2
        attacker.pbUpdate(true)
        @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
        @battle.pbDisplay(_INTL("{1} transformed!",attacker.pbThis))
        PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
      end
    end
  end
end

################################################################################
# Decreases the user's Defense by 1 stage. Always hits. (Hyperspace Fury)
################################################################################
class PokeBattle_Move_13B < PokeBattle_Move
  def pbOnStartUse(attacker)
    if isConst?(attacker.species,PBSpecies,:HOOPA) && attacker.form!=0 ||
       isConst?(attacker.effects[PBEffects::SpeciesTransform],PBSpecies,:HOOPA) &&
       attacker.effects[PBEffects::FormTransform]==1
      return true
    else
      if isConst?(attacker.species,PBSpecies,:HOOPA) && attacker.form!=1 ||
         isConst?(attacker.effects[PBEffects::SpeciesTransform],PBSpecies,:HOOPA) &&
         attacker.effects[PBEffects::FormTransform]==0
        @battle.pbDisplay(_INTL("But {1} can't use it the way it is now!",attacker.pbThis(true)))
      else
        @battle.pbDisplay(_INTL("But {1} can't use the move!",attacker.pbThis(true)))
      end
      return false
    end
  end  

  def pbAccuracyCheck(attacker,opponent)
    return true
  end
  
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.damagestate.calcdamage>0
      if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
        attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self)
      end
    end
    return ret
  end
end



Little fix about Burmy and Wormadan (Burmy change its form only AFTER BATTLE and Wormadan won't change):
Spoiler:

Look for 'Pokemon_Forms' script and add a new def called 'pbOnEndingBattle(battle,pokemon)' after 'def pbOnEnteringBattle(battle,pokemon)' code:
class PokeBattle_RealBattlePeer
  def pbOnEnteringBattle(battle,pokemon)
    f=MultipleForms.call("getFormOnEnteringBattle",pokemon)
    if f
      pokemon.form=f
    end
  end
  def pbOnEndingBattle(battle,pokemon)
    f=MultipleForms.call("getFormOnEndingBattle",pokemon)
    if f
      pokemon.form=f
    end
  end
end
Now replace their codes for:
MultipleForms.register(:BURMY,{
"getFormOnEndingBattle"=>proc{|pokemon|
   env=pbGetEnvironment()
   if !pbGetMetadata($game_map.map_id,MetadataOutdoor)
     next 2 # Trash Cloak
   elsif env==PBEnvironment::Sand || env==PBEnvironment::Rock || env==PBEnvironment::Cave
     next 1 # Sandy Cloak
   else
     next 0 # Plant Cloak
   end
}
})


MultipleForms.register(:WORMADAM,{
"getMoveCompatibility"=>proc{|pokemon|
   next if pokemon.form==0
   movelist=[]
   case pokemon.form
   when 1; movelist=[# TMs
                     :TOXIC,:VENOSHOCK,:HIDDENPOWER,:SUNNYDAY,:HYPERBEAM,
                     :PROTECT,:RAINDANCE,:SAFEGUARD,:FRUSTRATION,:EARTHQUAKE,
                     :RETURN,:DIG,:PSYCHIC,:SHADOWBALL,:DOUBLETEAM,
                     :SANDSTORM,:ROCKTOMB,:FACADE,:REST,:ATTRACT,
                     :THIEF,:ROUND,:GIGAIMPACT,:FLASH,:STRUGGLEBUG,
                     :PSYCHUP,:BULLDOZE,:DREAMEATER,:SWAGGER,:SUBSTITUTE,
                     # Move Tutors
                     :BUGBITE,:EARTHPOWER,:ELECTROWEB,:ENDEAVOR,:MUDSLAP,
                     :SIGNALBEAM,:SKILLSWAP,:SLEEPTALK,:SNORE,:STEALTHROCK,
                     :STRINGSHOT,:SUCKERPUNCH,:UPROAR]
   when 2; movelist=[# TMs
                     :TOXIC,:VENOSHOCK,:HIDDENPOWER,:SUNNYDAY,:HYPERBEAM,
                     :PROTECT,:RAINDANCE,:SAFEGUARD,:FRUSTRATION,:RETURN,
                     :PSYCHIC,:SHADOWBALL,:DOUBLETEAM,:FACADE,:REST,
                     :ATTRACT,:THIEF,:ROUND,:GIGAIMPACT,:FLASH,
                     :GYROBALL,:STRUGGLEBUG,:PSYCHUP,:DREAMEATER,:SWAGGER,
                     :SUBSTITUTE,:FLASHCANNON,
                     # Move Tutors
                     :BUGBITE,:ELECTROWEB,:ENDEAVOR,:GUNKSHOT,:IRONDEFENSE,
                     :IRONHEAD,:MAGNETRISE,:SIGNALBEAM,:SKILLSWAP,:SLEEPTALK,
                     :SNORE,:STEALTHROCK,:STRINGSHOT,:SUCKERPUNCH,:UPROAR]
   end
   for i in 0...movelist.length
     movelist[i]=getConst(PBMoves,movelist[i])
   end
   next movelist
}
})
Now in 'PokeBattle_BattlePeer' script, after 'def pbOnEnteringBattle(battle,pokemon)' code, paste the def for 'pbOnEndingBattle(battle,pokemon)':
  def pbOnEndingBattle(battle,pokemon)
  end

  def pbStorePokemon(player,pokemon)
Finally, go to 'PokeBattle_Battle' script, then inside 'def pbEndOfBattle(canlose=false)' below 'for i in $Trainer.party', paste '@peer.pbOnEndingBattle(self,i)', like:
    for i in $Trainer.party
      @peer.pbOnEndingBattle(self,i)
      i.setItem(i.itemInitial)
      i.itemInitial=i.itemRecycle=0
      i.belch=false
    end


Mind Blown:
Spoiler:

In 'PokeBattle_Battler' script, inside 'if !nocheck && !pbSuccessCheck(thismove,user,target,turneffects,i==0 || thismove.successCheckPerHit?)', create a new 'elsif' after ' elsif thismove.function==0x10B # Hi Jump Kick, Jump Kick':
        elsif thismove.function==0x10B   # Hi Jump Kick, Jump Kick
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Move effect triggered] #{user.pbThis} took crash damage")
            # TODO: Not shown if message is "It doesn't affect XXX..."
            @battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
            damage=(user.totalhp/2).floor
            if damage>0
              @battle.scene.pbDamageAnimation(user,0)
              user.pbReduceHP(damage)
            end
            user.pbFaint if user.fainted?
          end
        elsif thismove.function==0x170   # Mind Blown
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Move effect triggered] #{user.pbThis} took damage")
            user.pbReduceHP((user.totalhp/2).round)
            user.pbFaint if user.fainted?
          end
        end
        user.effects[PBEffects::Outrage]=0 if thismove.function==0xD2 # Outrage
Now for the code below '# Primordial Sea, Desolate Land', 'when PBWeather::HEAVYRAIN', paste below '@battle.lastMoveUser=user.index' the code for Mind Blown:
    # Primordial Sea, Desolate Land
    if thismove.pbIsDamaging?
      case @battle.pbWeather
      when PBWeather::HEAVYRAIN
        if isConst?(thismove.pbType(thismove.type,user,nil),PBTypes,:FIRE)
          PBDebug.log("[Move failed] Primordial Sea's rain cancelled the Fire-type #{thismove.name}")
          @battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))
          user.effects[PBEffects::StompingTantrum]=true
          user.lastMoveFailed=thismove.id
          user.lastMoveUsed=thismove.id
          user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
          if !turneffects[PBEffects::SpecialUsage]
            user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
            user.lastRegularMoveUsed=thismove.id
          end
          @battle.lastMoveUsed=thismove.id
          @battle.lastMoveUser=user.index
          if thismove.function==0x170 # Mind Blown
            if !user.hasWorkingAbility(:MAGICGUARD)
              user.pbReduceHP((user.totalhp/2.0).round)
              user.pbFaint if user.fainted?
            end
          end
          return
        end
      when PBWeather::HARSHSUN
Same to '# Powder' code:
    # Powder
    if user.effects[PBEffects::Powder] && isConst?(thismove.pbType(thismove.type,user,nil),PBTypes,:FIRE)
      PBDebug.log("[Lingering effect triggered] #{pbThis}'s Powder cancelled the Fire move")
      @battle.pbCommonAnimation("Powder",user,nil)
      @battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
      user.pbReduceHP(1+(user.totalhp/4).floor) if !user.hasWorkingAbility(:MAGICGUARD)
      user.effects[PBEffects::StompingTantrum]=true
      user.lastMoveFailed=thismove.id
      user.lastMoveUsed=thismove.id
      user.lastMoveUsedType=thismove.pbType(thismove.type,user,nil)
      if !turneffects[PBEffects::SpecialUsage]
        user.lastMoveUsedSketch=thismove.id if user.effects[PBEffects::TwoTurnAttack]==0
        user.lastRegularMoveUsed=thismove.id
      end
      @battle.lastMoveUsed=thismove.id
      @battle.lastMoveUser=user.index
      if thismove.function==0x170 # Mind Blown
        user.pbReduceHP((user.totalhp/2.0).round) if !user.hasWorkingAbility(:MAGICGUARD)
      end
      user.pbFaint if user.fainted?
      pbEndTurn(choice)
      return
    end
    # Protean
Now, to always took damage after hit, look for 'def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)' in 'PokeBattle_Move' script and replace the def for:
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    return 0 if !opponent
    damage=pbCalcDamage(attacker,opponent)
    if opponent.damagestate.typemod!=0
      pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    end
    damage=pbReduceHPDamage(damage,attacker,opponent)
    if isConst?(thismove.id,PBMoves,:MINDBLOWN)
      if !attacker.hasWorkingAbility(:MAGICGUARD)
        PBDebug.log("[Move effect triggered] #{attacker.pbThis} took damage")
        if attacker.hasWorkingAbility(:PARENTALBOND)
          if attacker.effects[PBEffects::ParentalBond]==2
            attacker.pbReduceHP((attacker.totalhp/2).round)
          end
        else
          attacker.pbReduceHP((attacker.totalhp/2).round)
        end
      end
    end
    pbEffectMessages(attacker,opponent)
    pbOnDamageLost(damage,attacker,opponent)
    return damage   # The HP lost by the opponent due to this attack
  end
And finally, the code/function for the move, in 'PokeBattle_MoveEffects' script:
################################################################################
# User takes recoil damage equal to 1/2 of the damage this move dealt. (Mind Blown)
################################################################################
class PokeBattle_Move_170 < PokeBattle_Move
  def pbOnStartUse(attacker)
    if !attacker.hasMoldBreaker
      [email protected](:DAMP)
      if bearer!=nil
        @battle.pbDisplay(_INTL("{1}'s {2} prevents {3} from using {4}!",
          bearer.pbThis,PBAbilities.getName(bearer.ability),attacker.pbThis(true),@name))
        return false
      end
    end
    return true
  end
end


Berserk (last upgrade 01/16/2020):
Spoiler:

Inside 'def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true)', add 'currentHP=target.hp':
    realnumhits=0
    totaldamage=0
    destinybond=false
    currentHP=target.hp
    for i in 0...numhits
      target.damagestate.reset
      # Check success (accuracy/evasion calculation)
Now, inside 'if target.damagestate.calcdamage>0 && !target.fainted?' (where we have the codes for Defrost and Rage), paste the code for Berserk:
      if target.damagestate.calcdamage>0 && !target.fainted?
        # Defrost
        if target.status==PBStatuses::FROZEN &&
           (isConst?(thismove.pbType(thismove.type,user,target),PBTypes,:FIRE) ||
           (USENEWBATTLEMECHANICS && isConst?(thismove.id,PBMoves,:SCALD)))
          target.pbCureStatus
        end
        # Rage
        if target.effects[PBEffects::Rage] && target.pbIsOpposing?(user.index)
          # TODO: Apparently triggers if opposing Pokémon uses Future Sight after a Future Sight attack
          if target.pbIncreaseStatWithCause(PBStats::ATTACK,1,target,"",true,false)
            PBDebug.log("[Lingering effect triggered] #{target.pbThis}'s Rage (raising Attack)")
            @battle.pbDisplay(_INTL("{1}'s rage is building!",target.pbThis))
          end
        end
        # Berserk
        if target.hasWorkingAbility(:BERSERK) && !(user.hasWorkingAbility(:SHEERFORCE) && thismove.addlEffect>0)
          if thismove.pbNumHits(user)==realnumhits && currentHP>=(target.totalhp/2).floor && 
                                                      target.hp<=(target.totalhp/2).floor
            if target.pbIncreaseStatWithCause(PBStats::SPATK,1,target,PBAbilities.getName(target.ability))
              PBDebug.log("[Ability triggered] #{target.pbThis}'s Berserk (raising Special Attack)")
            end
          end
        end
      end
      target.pbFaint if target.fainted? # no return
Finally, IDK why Maruno puted 'def pbBerryCureCheck(hpcure=false)', because each hit count to trigger berry effect. So, at least inside 'def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true)' replace both '@battle.battlers[j].pbBerryCureCheck' to '@battle.battlers[j].pbBerryCureCheck(true)':
      # Berry check (maybe just called by ability effect, since only necessary Berries are checked)
      for j in 0...4
        @battle.battlers[j].pbBerryCureCheck(true) if !(@battle.battlers[j].hasWorkingItem(:LEFTOVERS) || 
                                                        @battle.battlers[j].hasWorkingItem(:BLACKSLUDGE))
      end
    pbEffectsAfterHit(user,target,thismove,turneffects)
    # Berry check
    for j in 0...4
      @battle.battlers[j].pbBerryCureCheck(true) if !(@battle.battlers[j].hasWorkingItem(:LEFTOVERS) || 
                                                      @battle.battlers[j].hasWorkingItem(:BLACKSLUDGE))
    end
    target.pbUpdateTargetedMove(thismove,user)
And done!


Dancer: https://www.pokecommunity.com/showthread.php?t=426218

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Improved Pursuit's code (improved 12/30):
Spoiler:

In 'PokeBattle_Battler' script, add 'attr_accessor :switching' below 'attr_accessor :captured';

Inside Follow Me's code, add '!target.switching':
    # Change target to user of Follow Me (overrides Magic Coat
    # because check for Magic Coat below uses this target)
    if PBTargets.targetsOneOpponent?(thismove)
      newtarget=nil; strength=100
      for i in priority # use Pokémon latest in priority
        next if !user.pbIsOpposing?(i.index)
        if !i.fainted? && [email protected] && !target.switching && !i.effects[PBEffects::SkyDrop] &&
           i.effects[PBEffects::FollowMe]>0 && i.effects[PBEffects::FollowMe]<strength
          PBDebug.log("[Lingering effect triggered] #{i.pbThis}'s Follow Me")
          newtarget=i; strength=i.effects[PBEffects::FollowMe]
          changeeffect=0
        end
      end
      target=newtarget if newtarget
    end
Now, replace the code below '# Pokémon switching caused by U-Turn, Volt Switch, Eject Button' for:
Spoiler:

    # Pokémon switching caused by U-Turn, Volt Switch, Eject Button
    switched=[]
    for i in 0...4
      pursuit=false
      if @battle.battlers[i].effects[PBEffects::Uturn]
        @battle.battlers[i].switching=true
        @battle.battlers[i].effects[PBEffects::Uturn]=false
        @battle.battlers[i].effects[PBEffects::Roar]=false
        if [email protected][i].fainted? && @battle.pbCanChooseNonActive?(i) &&
           [email protected]?(@battle.pbOpposingParty(i))
          # TODO: Pursuit should go here, and negate this effect if it KO's attacker
          for j in @battle.pbPriority
            next if [email protected][i].pbIsOpposing?(j.index)
            next if pursuit
            [email protected][j.index][1]
            # if Pursuit and this target ("i") was chosen
            if @battle.battlers[j.index].moves[oppmove].function==0x88 && !j.hasMovedThisRound? # Pursuit
             if j.status!=PBStatuses::SLEEP && j.status!=PBStatuses::FROZEN && 
                !j.effects[PBEffects::SkyDrop] && (!j.hasWorkingAbility(:TRUANT) || !j.effects[PBEffects::Truant])
                pursuit=true
                @battle.choices[j.index][3][email protected][i].index # Make sure to target the switching Pokémon
                j.pbUseMove(@battle.choices[j.index]) # This calls pbGainEXP as appropriate
                j.effects[PBEffects::Pursuit]=true
                return if @battle.decision>0
              end
            end
          end
          @battle.battlers[i].switching=false
          break if @battle.battlers[i].fainted?
          @battle.pbDisplay(_INTL("{1} went back to {2}!",@battle.battlers[i].pbThis,@battle.pbGetOwner(i).name))
          newpoke=0
          [email protected](i,true,false)
          newpokename=newpoke
          if isConst?(@battle.pbParty(i)[newpoke].ability,PBAbilities,:ILLUSION)
            newpokename=pbGetLastPokeInTeam(i)
          end
          switched.push(i)
          @battle.battlers[i].pbResetForm
          @battle.pbRecallAndReplace(i,newpoke,newpokename,@battle.battlers[i].effects[PBEffects::BatonPass])
          @battle.choices[i]=[0,0,nil,-1]   # Replacement Pokémon does nothing this round
        end
      end
    end
    for i in @battle.pbPriority
      next if !switched.include?(i.index)
      i.pbAbilitiesOnSwitchIn(true)
    end
    # Baton Pass


Finally, replace the function for Pursuit inside 'PokeBattle_MoveEffects' script:
################################################################################
# Power is doubled if a foe tries to switch out or use U-turn/Volt Switch/
# Parting Shot. (Pursuit)
# (Handled in Battle's pbAttackPhase): Makes this attack happen before switching.
################################################################################
class PokeBattle_Move_088 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    if @battle.switching || opponent.switching
      PBDebug.log("[Move Effect] #{attacker.pbThis} double Pursuit damage")
      return basedmg*2
    end
    return basedmg
  end

  def pbAccuracyCheck(attacker,opponent)
    return true if @battle.switching || opponent.switching
    return super(attacker,opponent)
  end
end



Wimp Out and Emergency Exit:
Spoiler:

In 'PokeBattle_Battler' script, look for 'def pbEffectsAfterHit(user,target,thismove,turneffects)' and replace Shell Bell's code:
      # Shell Bell
      if user.hasWorkingItem(:SHELLBELL) && user.effects[PBEffects::HealBlock]==0
        PBDebug.log("[Item triggered] #{user.pbThis}'s Shell Bell (total damage=#{turneffects[PBEffects::TotalDamage]})")
        previoushp=user.hp
        hpgain=user.pbRecoverHP((turneffects[PBEffects::TotalDamage]/8).floor,true)
        if hpgain>0
          @battle.pbDisplay(_INTL("{1} restored a little HP using its {2}!",user.pbThis,PBItems.getName(user.item)))
        end
        # Wimp Out/ Emergency Exit
        if (user.hasWorkingAbility(:WIMPOUT) || user.hasWorkingAbility(:EMERGENCYEXIT)) && !user.fainted?
          if hpgain>0 && (previoushp<=(user.totalhp/2).floor && user.hp>(user.totalhp/2).floor)
            if [email protected]
              pbSEPlay("Battle flee")
              @battle.pbDisplay(_INTL("{1} fled!",user.pbThis))
              for i in 0...4; @battle.choices[@battle.battlers[i].index][0]=-1; end
              @battle.decision=3
              PBDebug.log("[Escape] #{user.pbThis} fled")
            else
              if @battle.pbCanSwitch?(user.index,-1,false) && @battle.pbCanChooseNonActive?(user.index)
                newpoke=0
                [email protected](user.index,true,false)
                newpokename=newpoke
                if isConst?(@battle.pbParty(user.index)[newpoke].ability,PBAbilities,:ILLUSION)
                  newpokename=pbGetLastPokeInTeam(user.index)
                end
                user.pbResetForm
                @battle.pbRecallAndReplace(user.index,newpoke,newpokename) #,@battle.battlers[i].effects[PBEffects::BatonPass])
                @battle.choices[user.index]=[0,0,nil,-1]   # Replacement Pokémon does nothing this round
                user.pbAbilitiesOnSwitchIn(true)
              end
            end
          end
        end
      end
      # Life Orb
Also, I edited the codes for Red Card and Eject Button. If you want:
Spoiler:

  def pbEffectsAfterHit(user,target,thismove,turneffects)
    return if turneffects[PBEffects::TotalDamage]==0
    if !(user.hasWorkingAbility(:SHEERFORCE) && thismove.addlEffect>0)
      # Target's held items:
      # Red Card
      if target.hasWorkingItem(:REDCARD) && @battle.pbCanSwitch?(user.index,-1,false) &&
         !user.fainted? && @battle.pbCanChooseNonActive?(user.index)
        @battle.pbDisplay(_INTL("{1} held up its {2} against the {3}!",target.pbThis,PBItems.getName(target.item),user.pbThis(true)))
        target.pbConsumeItem
        choices=[]
        [email protected](user.index)
        for j in 0...party.length
          choices.push(j) if @battle.pbCanSwitchLax?(user.index,j,false)
        end
        if choices.length>0
          newpoke=choices[@battle.pbRandom(choices.length)]
          newpokename=newpoke
          if isConst?(party[newpoke].ability,PBAbilities,:ILLUSION)
            newpokename=pbGetLastPokeInTeam(user.index)
          end
          user.pbResetForm
          @battle.pbRecallAndReplace(user.index,newpoke,newpokename,false,
                                      user.hasMoldBreaker || thismove.ignoresAbilities?)
          @battle.pbDisplay(_INTL("{1} was dragged out!",user.pbThis))
          @battle.choices[user.index]=[0,0,nil,-1]   # Replacement Pokémon does nothing this round
          user.pbAbilitiesOnSwitchIn(true)
        end
      # Eject Button
      elsif target.hasWorkingItem(:EJECTBUTTON) && @battle.pbCanChooseNonActive?(target.index)
        @battle.pbDisplay(_INTL("{1} is switched out with the {2}!",target.pbThis,PBItems.getName(target.item)))
        target.pbConsumeItem(false,true)
        newpoke=0
        [email protected](target.index,true,false)
        newpokename=newpoke
        if isConst?(@battle.pbParty(target.index)[newpoke].ability,PBAbilities,:ILLUSION)
          newpokename=pbGetLastPokeInTeam(i)
        end
        @battle.battlers[target.index].pbResetForm
        @battle.pbRecallAndReplace(target.index,newpoke,newpokename,@battle.battlers[i].effects[PBEffects::BatonPass])
        @battle.choices[target.index]=[0,0,nil,-1]   # Replacement Pokémon does nothing this round
        target.pbAbilitiesOnSwitchIn(true)
      end
      # User's held items:
      # Shell Bell


Now, add the code for these abilities, below Color Change's code:
      # Wimp Out/ Emergency Exit
      if (target.hasWorkingAbility(:WIMPOUT) || target.hasWorkingAbility(:EMERGENCYEXIT)) &&
         !target.effects[PBEffects::SkyDrop] && thismove.function!=0x0EC # Circle Throw, Dragon Tail
        if target.hp+turneffects[PBEffects::TotalDamage]>(target.totalhp/2).floor && 
           target.hp<=(target.totalhp/2).floor
          PBDebug.log("[Ability triggered] #{target.pbThis}'s #{PBAbilities.getName(target.ability)}")
          if [email protected]
            pbSEPlay("Battle flee"); @battle.pbDisplay(_INTL("{1} fled!",target.pbThis))
            for i in 0...4
              @battle.choices[@battle.battlers[i].index][0]=-1
            end
            @battle.decision=3
            PBDebug.log("[Escape] #{target.pbThis} fled")
          else
            if @battle.pbCanSwitch?(target.index,-1,false) &&@battle.pbCanChooseNonActive?(target.index)
              newpoke=0
              [email protected](target.index,true,false)
              newpokename=newpoke
              if isConst?(@battle.pbParty(target.index)[newpoke].ability,PBAbilities,:ILLUSION)
                newpokename=pbGetLastPokeInTeam(target.index)
              end
              target.pbResetForm
              @battle.pbRecallAndReplace(target.index,newpoke,newpokename)
              @battle.choices[target.index]=[0,0,nil,-1]   # Replacement Pokémon does nothing this round
              target.pbAbilitiesOnSwitchIn(true)
            end
          end
        end
      end
    end
    # Moxie
Then, we need add these abilities inside Stealth Rock and Spike code:
Spoiler:

      # Spikes
      if pkmn.pbOwnSide.effects[PBEffects::Spikes]>0 && !pkmn.isAirborne?(moldbreaker)
        if !pkmn.hasWorkingAbility(:MAGICGUARD)
          PBDebug.log("[Entry hazard] #{pkmn.pbThis} triggered Spikes")
          spikesdiv=[8,6,4][pkmn.pbOwnSide.effects[PBEffects::Spikes]-1]          
          @scene.pbDamageAnimation(pkmn,0)
          currentHP=pkmn.hp
          pkmn.pbReduceHP((pkmn.totalhp/spikesdiv).floor)
          pbDisplayPaused(_INTL("{1} is hurt by the spikes!",pkmn.pbThis))
          if (pkmn.hasWorkingAbility(:WIMPOUT) || pkmn.hasWorkingAbility(:EMERGENCYEXIT)) && !pkmn.fainted?
            pkmn.pbBerryCureCheck(true)
            if currentHP>=(pkmn.totalhp/2).floor && pkmn.hp<=(pkmn.totalhp/2).floor
              PBDebug.log("[Ability triggered] #{pkmn.pbThis}'s #{PBAbilities.getName(pkmn.ability)}")
              if [email protected]
                pbSEPlay("Battle flee"); @battle.pbDisplay(_INTL("{1} fled!",pkmn.pbThis))
                for i in 0...4; @battle.choices[@battle.battlers[i].index][0]=-1; end
                @decision=3
                PBDebug.log("[Escape] #{pkmn.pbThis} fled")
              else
                if pbCanSwitch?(pkmn.index,-1,false) && @battle.pbCanChooseNonActive?(pkmn.index)
                  newpoke=0
                  newpoke=pbSwitchInBetween(pkmn.index,true,false)
                  newpokename=newpoke
                  if isConst?(pbParty(pkmn.index)[newpoke].ability,PBAbilities,:ILLUSION)
                    newpokename=pbGetLastPokeInTeam(pkmn.index)
                  end
                  pkmn.pbResetForm
                  pbRecallAndReplace(pkmn.index,newpoke,newpokename)
                  @choices[pkmn.index]=[0,0,nil,-1]   # Replacement Pokémon does nothing this round
                  pkmn.pbAbilitiesOnSwitchIn(true)
                end
              end
            end
          end
        end
      end
      pkmn.pbFaint if pkmn.fainted?
      # Stealth Rock
      if pkmn.pbOwnSide.effects[PBEffects::StealthRock] && !pkmn.fainted?
        if !pkmn.hasWorkingAbility(:MAGICGUARD)
          atype=getConst(PBTypes,:ROCK) || 0
          eff=PBTypes.getCombinedEffectiveness(atype,pkmn.type1,pkmn.type2,pkmn.effects[PBEffects::Type3])
          if eff>0
            PBDebug.log("[Entry hazard] #{pkmn.pbThis} triggered Stealth Rock")
            @scene.pbDamageAnimation(pkmn,0)
            currentHP=pkmn.hp
            pkmn.pbReduceHP(((pkmn.totalhp*eff)/64).floor)
            pbDisplayPaused(_INTL("Pointed stones dug into {1}!",pkmn.pbThis))
            if (pkmn.hasWorkingAbility(:WIMPOUT) || pkmn.hasWorkingAbility(:EMERGENCYEXIT)) && !pkmn.fainted?
              pkmn.pbBerryCureCheck(true)
              if currentHP>=(pkmn.totalhp/2).floor && pkmn.hp<=(pkmn.totalhp/2).floor
                PBDebug.log("[Ability triggered] #{pkmn.pbThis}'s #{PBAbilities.getName(pkmn.ability)}")
                if [email protected]
                  pbSEPlay("Battle flee"); @battle.pbDisplay(_INTL("{1} fled!",pkmn.pbThis))
                  for i in 0...4; @battle.choices[@battle.battlers[i].index][0]=-1; end
                  @decision=3
                  PBDebug.log("[Escape] #{pkmn.pbThis} fled")
                else
                  if pbCanSwitch?(pkmn.index,-1,false) && @battle.pbCanChooseNonActive?(pkmn.index)
                    newpoke=0
                    newpoke=pbSwitchInBetween(pkmn.index,true,false)
                    newpokename=newpoke
                    if isConst?(pbParty(pkmn.index)[newpoke].ability,PBAbilities,:ILLUSION)
                      newpokename=pbGetLastPokeInTeam(pkmn.index)
                    end
                    pkmn.pbResetForm
                    pbRecallAndReplace(pkmn.index,newpoke,newpokename)
                    @choices[pkmn.index]=[0,0,nil,-1]   # Replacement Pokémon does nothing this round
                    pkmn.pbAbilitiesOnSwitchIn(true)
                  end
                end
              end
            end
          end
        end
      end
      pkmn.pbFaint if pkmn.fainted?
      # Toxic Spikes


And finally, replace the code for the move, inside 'PokeBattle_MoveEffects':
################################################################################
# After inflicting damage, user switches out. Ignores trapping moves.
# (U-turn, Volt Switch)
# TODO: Pursuit should interrupt this move.
################################################################################
class PokeBattle_Move_0EE < PokeBattle_Move
  def pbEffectAfterHit(attacker,opponent,turneffects)
    if !attacker.fainted? && opponent.damagestate.calcdamage>0 && 
       @battle.pbCanChooseNonActive?(attacker.index) && [email protected]?(@battle.pbParty(opponent.index))
      if (opponent.hasWorkingAbility(:WIMPOUT) || opponent.hasWorkingAbility(:EMERGENCYEXIT)) && 
          opponent.hp+turneffects[PBEffects::TotalDamage]>(opponent.totalhp/2).floor &&
          opponent.hp<=(opponent.totalhp/2).floor
        attacker.effects[PBEffects::Uturn]=false
      else
        attacker.effects[PBEffects::Uturn]=true
      end
    end
  end
end


Hyperspace Hole:
Spoiler:

################################################################################
# Always hits. (Hyperspace Hole)
################################################################################
class PokeBattle_Move_147 < PokeBattle_Move
  def pbAccuracyCheck(attacker,opponent)
    return true
  end
  
  def pbEffectAfterHit(attacker,opponent,turneffects)
    if !opponent.fainted? && opponent.damagestate.calcdamage>0
      opponent.effects[PBEffects::Protect]=false
      opponent.effects[PBEffects::KingsShield]=false
      opponent.effects[PBEffects::SpikyShield]=false
      opponent.effects[PBEffects::BanefulBunker]=false
      opponent.pbOwnSide.effects[PBEffects::QuickGuard]=false
      opponent.pbOwnSide.effects[PBEffects::WideGuard]=false
      opponent.pbOwnSide.effects[PBEffects::CraftyShield]=false
      opponent.pbOwnSide.effects[PBEffects::MatBlock]=false
    end
  end
end

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
I just realized that the Battle Bond script doesn't change Water Shuriken's base power. Anyway to implement this?
Since you're using the function '0C0' for Water Shuriken, just replace the code inside 'MoveEffect' script:
################################################################################
# Hits 2-5 times.
################################################################################
class PokeBattle_Move_0C0 < PokeBattle_Move
  def pbIsMultiHit
    return true
  end

  def pbBaseDamage(basedmg,attacker,opponent)
        basedmg=20 if isConst?(@id,PBMoves,:WATERSHURIKEN) && 
                      attacker.hasWorkingAbility(:BATTLEBOND) && 
                      isConst?(attacker.species,PBSpecies,:GRENINJA) &&
                      attacker.form==1
      return basedmg
  end
  
  def pbNumHits(attacker)
    hitchances=[2,2,3,3,4,5]
    ret=hitchances[@battle.pbRandom(hitchances.length)]
    ret=5 if attacker.hasWorkingAbility(:SKILLLINK)
    ret=3 if isConst?(@id,PBMoves,:WATERSHURIKEN) && 
             attacker.hasWorkingAbility(:BATTLEBOND) && 
             isConst?(attacker.species,PBSpecies,:GRENINJA) &&
             attacker.form==1
    return ret
  end
end

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Fluffy:
Inside 'PokeBattle_Move' script, above Metronome's code (inside 'if !attacker.hasMoldBreaker'), paste:
      if opponent.hasWorkingAbility(:FLUFFY) && !attacker.hasWorkingAbility(:LONGREACH)
        if isContactMove? && !isConst?(type,PBTypes,:FIRE)
          finaldamagemult=(finaldamagemult*0.5).round
        elsif isConst?(type,PBTypes,:FIRE) && !isContactMove?
          finaldamagemult=(finaldamagemult*2.0).round
        end
      end
    end
    if attacker.hasWorkingItem(:METRONOME)
Seen September 6th, 2020
Posted February 19th, 2020
4 posts
331 Days
Disclaimer:: this is on v17.2
But throat chop seems pretty straight forward, like a combination of imprison and healblock is how I did it (avoided looking into disable because it was referenced too many times lol)

First thing you need to do is add an effect to PBEffects
ThroatChop         = 109 # use whatever is the next lowest value for you
And obviously add a def to Move_effects:
class PokeBattle_Move_CF15 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.damagestate.calcdamage>0 && !opponent.damagestate.substitute &&
        !opponent.isFainted?
      opponent.effects[PBEffects::ThroatChop]=2
      @battle.pbDisplay(_INTL("{1} can't use sound based moves!",opponent.pbThis))
    end
    return ret
  end
end
Then you just have a few things left to

first find pbTryUseMove in PokeBattle_battler and add this (I added mine below the imprison code)
if @effects[PBEffects::ThroatChop]>0 && !pbOpposing1.fainted?
      if thismove.isSoundBased?
        @battle.pbDisplay(_INTL("{1} can't use {2} because they were Throat Chopped!",pbThis,thismove.name))
        PBDebug.log("[Move failed] #{pbThis} can't use #{thismove.name} because they were Throat chopped!")
        return false
      end
    end
The previous block prevents an already selected move from being used. This next block will prevent them from choosing it: put in PokeBattle_Battle in pbCanChooseMove (again I put it below imprison)

if thispkmn.effects[PBEffects::ThroatChop]>0 && thismove.isSoundBased?
      if showMessages
        pbDisplayPaused(_INTL("{1} can't use {2} because they are throat chopped!",thispkmn.pbThis,thismove.name))
      end
      return false
    end
And lastly decrement the value if it's more than 0 in PokeBattle_Battle in pbEndofRoundPhase (this time I put it below Heal bell because it works similar)
# Throat Chop
    for i in priority
      next if i.fainted?
      if i.effects[PBEffects::ThroatChop]>0
        i.effects[PBEffects::ThroatChop]-=1
        if i.effects[PBEffects::ThroatChop]==0
          pbDisplay(_INTL("{1}'s can use sound based moves again!",i.pbThis))
          PBDebug.log("[End of effect] #{i.pbThis} is no longer Throat chopped")
        end
      end
    end
I just tested on an Exploud that knows only sound moves and it prevented an already selected move and also prevented move selection causing it to struggle. If anyone happens to know the real lines pokemon displays when throat chop effects happen please let me know!



If you could post either/both of those I'd appreciate it. I only started looking into pokemon essentials a few days ago and dancer especially is eluding me.
For some reason, anytime I try to put in the 3rd through 5th parts of the script, it will give me these following errors:

---------------------------
Pokemon Mythos
---------------------------
[Pokémon Essentials version 17.2]

Exception: NoMethodError

Message: undefined method `>' for nil:NilClass

PokeBattle_Battle:875:in `pbCanChooseMove?'

PokeBattle_Battle:800:in `pbCanShowFightMenu?'

PokeBattle_Battle:2601:in `pbCommandPhase'

PokeBattle_Battle:2598:in `loop'

PokeBattle_Battle:2688:in `pbCommandPhase'

PokeBattle_Battle:2587:in `each'

PokeBattle_Battle:2587:in `pbCommandPhase'

PokeBattle_Battle:2534:in `pbStartBattleCore'

PokeBattle_Battle:2533:in `logonerr'

PokeBattle_Battle:2533:in `pbStartBattleCore'



This exception was logged in

C:\Users\GAMER\Saved Games\Pokemon Mythos\errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
---------------------------
Pokemon Mythos
---------------------------
[Pokémon Essentials version 17.2]

Exception: NoMethodError

Message: undefined method `>' for nil:NilClass

PokeBattle_Battle:3485:in `__clauses__pbEndOfRoundPhase'

PokeBattle_Battle:3483:in `each'

PokeBattle_Battle:3483:in `__clauses__pbEndOfRoundPhase'

PokeBattle_Clauses:42:in `pbEndOfRoundPhase'

PokeBattle_Battle:2542:in `pbStartBattleCore'

PokeBattle_Battle:2541:in `logonerr'

PokeBattle_Battle:2541:in `pbStartBattleCore'

PokeBattle_Battle:2523:in `loop'

PokeBattle_Battle:2546:in `pbStartBattleCore'

PokeBattle_Battle:2346:in `pbStartBattle'



This exception was logged in

C:\Users\GAMER\Saved Games\Pokemon Mythos\errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
This will occur if I ever press the fight button, wont even let me choose moves, just essentially skips them. I put in the script exactly how you described, yet no matter what ive tried so far I cant get it to work. Any idea what I can do to fix this? I hella appreciate the help

mgriffin

Seen 2 Weeks Ago
Posted 2 Weeks Ago
1,336 posts
6.6 Years
@weezyfish I think you also need to make sure to initialize effects[PBEffects::ThroatChop] to 0. The function to make that change in is called something to do with switching, IIRC it takes "batonpass" as a parameter, and most of the code is setting effects to 0 or false etc.
.

mgriffin

Seen 2 Weeks Ago
Posted 2 Weeks Ago
1,336 posts
6.6 Years
I was thinking of pbInitEffects in the PokeBattle_Battler section. I think you need a line like:
@effects[PBEffects::ThroatChop] = 0
.

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 5 Hours Ago
Posted 3 Weeks Ago
1,242 posts
2.3 Years
Plasma Fist

Replace Ion Deluge's code inside _MoveEffects script:
################################################################################
# All Normal-type moves become Electric-type for the rest of the round.
# (Ion Deluge/ Plasma Fist)
################################################################################
class PokeBattle_Move_146 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if pbIsDamaging?
      ret=super(attacker,opponent,hitnum,alltargets,showanimation)
      for poke in @battle.battlers
        next if poke.index==attacker.index
        if @battle.choices[poke.index][0]==1 && # Chose a move
           !poke.hasMovedThisRound? && [email protected][PBEffects::IonDeluge]
          @battle.field.effects[PBEffects::IonDeluge]=true
          @battle.pbDisplay(_INTL("A deluge of ions showers the battlefield!"))
          return ret
        end
      end
    end
    unmoved=false
    for poke in @battle.battlers
      next if poke.index==attacker.index
      if @battle.choices[poke.index][0]==1 && # Chose a move
          !poke.hasMovedThisRound?
        unmoved=true; break
      end
    end
    if !unmoved || @battle.field.effects[PBEffects::IonDeluge]
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    end
    pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
    @battle.field.effects[PBEffects::IonDeluge]=true
    @battle.pbDisplay(_INTL("A deluge of ions showers the battlefield!"))
    return 0
  end
end

SuzuiXii

Age 20
Male
Spain
Seen 14 Hours Ago
Posted 4 Weeks Ago
27 posts
278 Days
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.
I'm not an expert, but I think it is because the script itself changes type 2 too. Correct me if I'm wrong.