• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Complex Scripting Question - Why does this work for everything EXCEPT Confusion and Attract?

  • 428
    Posts
    5
    Years
    Hi, I've got this code where the "Damage From Burn" code usually goes.
    My goal is to make every status effect inflict burn-like damage at the end of a turn except for Poison/Toxic Poison, which I already have working how I want it.

    The code looks fine, so it should work.
    It works for Burn, Paralysis, Freezing, and so on.
    But the code that should trigger upon an Infatuated or Confused Pokemon at the end of a turn doesn't. I have no idea why.
    What must I change for it to work as desired?

    # Damage from burn
    priority.each do |b|
    next if b.status != :BURN || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from FROZEN
    priority.each do |b|
    next if b.status != :FROZEN || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:ICEBODY)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from PARALYZE
    priority.each do |b|
    next if b.status != :PARALYSIS || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:STATIC)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from INFATUATED
    priority.each do |b|
    next if b.status != :ATTRACT || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from CONFUSION
    priority.each do |b|
    next if b.status != :CONFUSED || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from BEING SLEEPY
    priority.each do |b|
    next if b.status != :SLEEP || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:COMATOSE)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from sleep (Nightmare)
    priority.each do |b|
    b.effects[PBEffects::Nightmare] = false if !b.asleep?
    next if !b.effects[PBEffects::Nightmare] || !b.takesIndirectDamage?
    oldHP = b.hp
    b.pbReduceHP(b.totalhp/4)
    pbDisplay(_INTL("{1} is locked in a nightmare!",b.pbThis))
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
     
    Last edited:
    Because there's no such thing as statuses :ATTRACT or :CONFUSED. You just made those up, no where in the code does that exist. Only primary statuses are represented as symbols. Everything else in the game are deemed as "effects", found in PBEffects.

    Use CTRL+Shift+F to search the game scripts for "attract" and "confusion" to see how the game calls for and checks these effects
     
    I don't understand how I can get the way the game calls for and checks those effects into my script for what I want these effects to do.

    The "You still have x status effect" code isn't triggering either.

    #=============================================================================
    # Generalised status displays
    #=============================================================================
    def pbContinueStatus
    if self.status == :POISON && @statusCount > 0
    @battle.pbCommonAnimation("Toxic", self)
    else
    anim_name = GameData::Status.get(self.status).animation
    @battle.pbCommonAnimation(anim_name, self) if anim_name
    end
    yield if block_given?
    case self.status
    when :SLEEP
    @battle.pbDisplay(_INTL("{1} was hurt by sleepiness.", pbThis))
    when :POISON
    @battle.pbDisplay(_INTL("{1} was hurt by poison!", pbThis))
    when :BURN
    @battle.pbDisplay(_INTL("{1} was hurt by its burn!", pbThis))
    when :PARALYSIS
    @battle.pbDisplay(_INTL("{1} is hurt by its paralysis!", pbThis))
    when :FROZEN
    @battle.pbDisplay(_INTL("{1} is hurt by the cold!", pbThis))
    when :Confusion
    @battle.pbDisplay(_INTL("{1} is hurt by its confusion!", pbThis))
    when :ATTRACT
    @battle.pbDisplay(_INTL("{1} is hurt by love!", pbThis))
    end
    end

    def pbCureStatus(showMessages=true)
    oldStatus = status
    self.status = :NONE
    if showMessages
    case oldStatus
    when :SLEEP then @battle.pbDisplay(_INTL("{1} woke up!", pbThis))
    when :POISON then @battle.pbDisplay(_INTL("{1} was cured of its poisoning.", pbThis))
    when :BURN then @battle.pbDisplay(_INTL("{1}'s burn was healed.", pbThis))
    when :PARALYSIS then @battle.pbDisplay(_INTL("{1} was cured of paralysis.", pbThis))
    when :FROZEN then @battle.pbDisplay(_INTL("{1} thawed out!", pbThis))
    when :Confusion then @battle.pbDisplay(_INTL("{1} snapped out of it!", pbThis))
    when :ATTRACT then @battle.pbDisplay(_INTL("{1} got over its crush!", pbThis))
    end
    end
    PBDebug.log("[Status change] #{pbThis}'s status was cured") if !showMessages
    end
     
    Last edited:
    Update: Tried getting how the game calls checks for those effects. Didn't work.

    [Pokémon Essentials version 19.1]
    [Generation 8 Project v1.1.0]
    [v19.1 Hotfixes 1.0.7]

    Exception: NoMethodError
    Message: undefined method `[]' for nil:NilClass

    Backtrace:
    182:Battle_Phase_EndOfRound:404:in `block in pbEndOfRoundPhase'
    182:Battle_Phase_EndOfRound:403:in `each'
    182:Battle_Phase_EndOfRound:403:in `pbEndOfRoundPhase'
    212:PokeBattle_Clauses:40:in `pbEndOfRoundPhase'
    173:Battle_StartAndEnd:329:in `block (2 levels) in pbBattleLoop'
    012:PBDebug:6:in `logonerr'
    173:Battle_StartAndEnd:329:in `block in pbBattleLoop'
    173:Battle_StartAndEnd:311:in `loop'
    173:Battle_StartAndEnd:311:in `pbBattleLoop'
    173:Battle_StartAndEnd:303:in `pbStartBattleCore'

    ---

    This is the script I edited:

    # Damage from INFATUATED
    priority.each do |b|
    if @effects[PBEffects::Attract]>=0
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    end
    # Damage from CONFUSION
    priority.each do |b|
    if @effects[PBEffects::Confusion]>0
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    end

    If I didn't add the extra end after each segment the game wouldn't start up. But now I get this game-crashing error whenever a Pokemon is Confused or Infatuated.
     
    Update: Tried getting how the game calls checks for those effects. Didn't work.

    [Pokémon Essentials version 19.1]
    [Generation 8 Project v1.1.0]
    [v19.1 Hotfixes 1.0.7]

    Exception: NoMethodError
    Message: undefined method `[]' for nil:NilClass

    Backtrace:
    182:Battle_Phase_EndOfRound:404:in `block in pbEndOfRoundPhase'
    182:Battle_Phase_EndOfRound:403:in `each'
    182:Battle_Phase_EndOfRound:403:in `pbEndOfRoundPhase'
    212:PokeBattle_Clauses:40:in `pbEndOfRoundPhase'
    173:Battle_StartAndEnd:329:in `block (2 levels) in pbBattleLoop'
    012:PBDebug:6:in `logonerr'
    173:Battle_StartAndEnd:329:in `block in pbBattleLoop'
    173:Battle_StartAndEnd:311:in `loop'
    173:Battle_StartAndEnd:311:in `pbBattleLoop'
    173:Battle_StartAndEnd:303:in `pbStartBattleCore'

    ---

    This is the script I edited:

    # Damage from INFATUATED
    priority.each do |b|
    if @effects[PBEffects::Attract]>=0
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    end
    # Damage from CONFUSION
    priority.each do |b|
    if @effects[PBEffects::Confusion]>0
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    end

    If I didn't add the extra end after each segment the game wouldn't start up. But now I get this game-crashing error whenever a Pokemon is Confused or Infatuated.

    Because you're not calling it right. You're calling the effects, but not WHICH Pokemon to check the effects for. Which in this case, is "b", based on how you wrote the code. So you should be checking for b.effects[PBEffects::Attract]>=0.

    Also, your "continued status" and "cure status" code won't work because, obviously, Confusion and Attract ARE NOT statuses. They are effects (like Leech Seed, Imprison, Protect, etc). So they will not be recognized by that code. You'll have to whip up entirely specific code for them.
     
    Good news, your b.effects code worked! Now I've got a new error message when Confusion tries to deal damage at the end of the turn.

    [Pokémon Essentials version 19.1]
    [Generation 8 Project v1.1.0]
    [v19.1 Hotfixes 1.0.7]

    Exception: NoMethodError
    Message: undefined method `oldHP=' for 0:Integer

    Backtrace:
    182:Battle_Phase_EndOfRound:404:in `block in pbEndOfRoundPhase'
    182:Battle_Phase_EndOfRound:403:in `each'
    182:Battle_Phase_EndOfRound:403:in `pbEndOfRoundPhase'
    212:PokeBattle_Clauses:40:in `pbEndOfRoundPhase'
    173:Battle_StartAndEnd:329:in `block (2 levels) in pbBattleLoop'
    012:PBDebug:6:in `logonerr'
    173:Battle_StartAndEnd:329:in `block in pbBattleLoop'
    173:Battle_StartAndEnd:311:in `loop'
    173:Battle_StartAndEnd:311:in `pbBattleLoop'
    173:Battle_StartAndEnd:303:in `pbStartBattleCore'

    --- My code is:

    # Damage from INFATUATED
    priority.each do |b|
    next if b.effects[PBEffects::Attract]>=0.
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from CONFUSION
    priority.each do |b|
    next if b.effects[PBEffects::Confusion]>=0.
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
     
    Good news, your b.effects code worked! Now I've got a new error message when Confusion tries to deal damage at the end of the turn.

    [Pokémon Essentials version 19.1]
    [Generation 8 Project v1.1.0]
    [v19.1 Hotfixes 1.0.7]

    Exception: NoMethodError
    Message: undefined method `oldHP=' for 0:Integer

    Backtrace:
    182:Battle_Phase_EndOfRound:404:in `block in pbEndOfRoundPhase'
    182:Battle_Phase_EndOfRound:403:in `each'
    182:Battle_Phase_EndOfRound:403:in `pbEndOfRoundPhase'
    212:PokeBattle_Clauses:40:in `pbEndOfRoundPhase'
    173:Battle_StartAndEnd:329:in `block (2 levels) in pbBattleLoop'
    012:PBDebug:6:in `logonerr'
    173:Battle_StartAndEnd:329:in `block in pbBattleLoop'
    173:Battle_StartAndEnd:311:in `loop'
    173:Battle_StartAndEnd:311:in `pbBattleLoop'
    173:Battle_StartAndEnd:303:in `pbStartBattleCore'

    --- My code is:

    # Damage from INFATUATED
    priority.each do |b|
    next if b.effects[PBEffects::Attract]>=0.
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from CONFUSION
    priority.each do |b|
    next if b.effects[PBEffects::Confusion]>=0.
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end

    Several things. First of all, you've placed periods after the >=0 on the code for both effects. That's what's causing the error.
    Secondly, >=0 isn't even the right way to be searching for these effects. What this code is essentially saying is "skip the damage step of all Pokemon at the end of the turn who ARE confused". Which makes no sense, because what you're trying to do is damage Pokemon who are confused. That's the exact opposite of what you want. You should be using the opposite sign.

    Also, you're still treating them both as statuses (by calling pbContinueStatus) when they aren't statuses. So even if both of the above issues were fixed, this code still wouldn't do anything. What you should instead be doing is copying the code for an effect, and adapting that instead. For example, the damage effect for Curse is found right below where you're probably putting all this code, which is what you should be copying instead for Attract/Confusion.

    For example:
    Code:
    # Damage from CONFUSION
        priority.each do |b|
          next if b.effects[PBEffects::Confusion]<=0 || !b.takesIndirectDamage?
          oldHP = b.hp
          dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
          dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
          b.pbReduceHP(dmg)
          pbDisplay(_INTL("{1} is hurt by its confusion!",b.pbThis))
          b.pbItemHPHealCheck
          b.pbAbilitiesOnDamageTaken(oldHP)
          b.pbFaint if b.fainted?
        end
     
    That code works perfectly for Confusion but nothing triggers at the end of a turn for Infatuation. Why? Am I doing something wrong?

    # Damage from INFATUATION
    priority.each do |b|
    next if b.effects[PBEffects::Attract]<=0 || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbReduceHP(dmg)
    pbDisplay(_INTL("{1} is hurt by its confusion!",b.pbThis))
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from CONFUSION
    priority.each do |b|
    next if b.effects[PBEffects::Confusion]<=0 || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbReduceHP(dmg)
    pbDisplay(_INTL("{1} is hurt by its confusion!",b.pbThis))
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
     
    That code works perfectly for Confusion but nothing triggers at the end of a turn for Infatuation. Why? Am I doing something wrong?

    # Damage from INFATUATION
    priority.each do |b|
    next if b.effects[PBEffects::Attract]<=0 || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbReduceHP(dmg)
    pbDisplay(_INTL("{1} is hurt by its confusion!",b.pbThis))
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from CONFUSION
    priority.each do |b|
    next if b.effects[PBEffects::Confusion]<=0 || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbReduceHP(dmg)
    pbDisplay(_INTL("{1} is hurt by its confusion!",b.pbThis))
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end

    Ah, I just checked and it looks like the Attract effect is stored as -1 when the user is NOT infatuated. Which is different from Confusion which is stored as 0 when not confused. So just change the Attract effect to be equal to -1 to exclude Pokemon who aren't suffering from Infatuation.
     
    It's working! I wanted the code to only harm Pokemon who are infatuated, and this language is sort of like the only one I know so it worked.

    Anyone who wants to use this "Pokemon Status Reimagining" system is free to do so! With this system, debilitating status effects will now be more balanced instead of being so OP entire Clauses have to be invented to balance their use.

    Now Burn reduces ATK, Confusion reduces SpAtk, Freeze reduces DEF, Sleepy reduces SpDEF, Paralysis reduces Speed, and Infatuated reduces ATK,DEF,SpAtk, and SpDef to make up for how rare its usage is.

    You'll just need this script in the End Of Battle area:


    # Damage from burn
    priority.each do |b|
    next if b.status != :BURN || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from FROZEN
    priority.each do |b|
    next if b.status != :FROZEN || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:ICEBODY)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from PARALYZE
    priority.each do |b|
    next if b.status != :PARALYSIS || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:STATIC)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from INFATUATION
    priority.each do |b|
    next if b.effects[PBEffects::Attract]<=-1 || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OBLIVIOUS)
    b.pbReduceHP(dmg)
    pbDisplay(_INTL("{1} is hurt by its crush!",b.pbThis))
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from CONFUSION
    priority.each do |b|
    next if b.effects[PBEffects::Confusion]<=0 || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:OWNTEMPO)
    b.pbReduceHP(dmg)
    pbDisplay(_INTL("{1} is hurt by its confusion!",b.pbThis))
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end
    # Damage from BEING SLEEPY
    priority.each do |b|
    next if b.status != :SLEEP || !b.takesIndirectDamage?
    oldHP = b.hp
    dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
    dmg = (dmg/2.0).round if b.hasActiveAbility?(:COMATOSE)
    b.pbContinueStatus { b.pbReduceHP(dmg,false) }
    b.pbItemHPHealCheck
    b.pbAbilitiesOnDamageTaken(oldHP)
    b.pbFaint if b.fainted?
    end

    And this script in the "Move Usage Calculations" area where the Burn effect goes.

    # Burn
    if user.status == :BURN && physicalMove? && damageReducedByBurn? &&
    !user.hasActiveAbility?(:GUTS)
    multipliers[:final_damage_multiplier] /= 2
    end
    # CONFUSED
    if user.status == :CONFUSED && specialMove?
    multipliers[:final_damage_multiplier] /= 2
    end
    # FROZEN
    if user.status == :FROZEN && physicalMove?
    multipliers[:defense_multiplier] /= 2
    end
    # SLEEPY
    if user.status == :FROZEN && specialMove?
    multipliers[:defense_multiplier] /= 2
    end
    # INFATUATED
    if user.status == :ATTRACT
    multipliers[:final_damage_multiplier] /= 4
    multipliers[:defense_multiplier] /= 4
    end
     
    Last edited:
    Back
    Top