- 428
- Posts
- 5
- Years
- Zekko
- Seen Nov 21, 2023
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
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: