Fixed Magic Guard not being checked for damage from Shadow Sky weather/Spiky Shield/Dry Skin/Solar Power, fixed As One not having Unnerve's effect, fixed Gulp Missile paralysing the wrong Pokémon, added message for obtaining multiple machine items at once

This commit is contained in:
Maruno17
2023-04-20 18:04:15 +01:00
parent b9bf3e8b83
commit 4bab130785
6 changed files with 41 additions and 21 deletions

View File

@@ -547,7 +547,7 @@ class Battle::Battler
end end
def takesShadowSkyDamage? def takesShadowSkyDamage?
return false if fainted? return false if !takesIndirectDamage?
return false if shadowPokemon? return false if shadowPokemon?
return true return true
end end

View File

@@ -13,7 +13,7 @@ class Battle::Battler
@fainted = true @fainted = true
# Check for end of Neutralizing Gas/Unnerve # Check for end of Neutralizing Gas/Unnerve
pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true) pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true)
pbItemsOnUnnerveEnding if hasActiveAbility?(:UNNERVE, true) pbItemsOnUnnerveEnding if hasActiveAbility?([:UNNERVE, :ASONECHILLINGNEIGH, :ASONEGRIMNEIGH], true)
# Check for end of primordial weather # Check for end of primordial weather
@battle.pbEndPrimordialWeather @battle.pbEndPrimordialWeather
end end
@@ -29,7 +29,7 @@ class Battle::Battler
Battle::AbilityEffects.triggerOnBattlerFainting(b.ability, b, self, @battle) Battle::AbilityEffects.triggerOnBattlerFainting(b.ability, b, self, @battle)
end end
pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true) pbAbilitiesOnNeutralizingGasEnding if hasActiveAbility?(:NEUTRALIZINGGAS, true)
pbItemsOnUnnerveEnding if hasActiveAbility?(:UNNERVE, true) pbItemsOnUnnerveEnding if hasActiveAbility?([:UNNERVE, :ASONECHILLINGNEIGH, :ASONEGRIMNEIGH], true)
end end
# Used for Emergency Exit/Wimp Out. Returns whether self has switched out. # Used for Emergency Exit/Wimp Out. Returns whether self has switched out.
@@ -162,7 +162,8 @@ class Battle::Battler
def pbOnLosingAbility(oldAbil, suppressed = false) def pbOnLosingAbility(oldAbil, suppressed = false)
if oldAbil == :NEUTRALIZINGGAS && (suppressed || !@effects[PBEffects::GastroAcid]) if oldAbil == :NEUTRALIZINGGAS && (suppressed || !@effects[PBEffects::GastroAcid])
pbAbilitiesOnNeutralizingGasEnding pbAbilitiesOnNeutralizingGasEnding
elsif oldAbil == :UNNERVE && (suppressed || !@effects[PBEffects::GastroAcid]) elsif [:UNNERVE, :ASONECHILLINGNEIGH, :ASONEGRIMNEIGH].include?(oldAbil) &&
(suppressed || !@effects[PBEffects::GastroAcid])
pbItemsOnUnnerveEnding pbItemsOnUnnerveEnding
elsif oldAbil == :ILLUSION && @effects[PBEffects::Illusion] elsif oldAbil == :ILLUSION && @effects[PBEffects::Illusion]
@effects[PBEffects::Illusion] = nil @effects[PBEffects::Illusion] = nil
@@ -200,7 +201,7 @@ class Battle::Battler
# Held item consuming/removing # Held item consuming/removing
#============================================================================= #=============================================================================
def canConsumeBerry? def canConsumeBerry?
return false if @battle.pbCheckOpposingAbility(:UNNERVE, @index) return false if @battle.pbCheckOpposingAbility([:UNNERVE, :ASONECHILLINGNEIGH, :ASONEGRIMNEIGH], @index)
return true return true
end end

View File

@@ -370,7 +370,7 @@ class Battle::Battler
end end
target.damageState.protected = true target.damageState.protected = true
@battle.successStates[user.index].protected = true @battle.successStates[user.index].protected = true
if move.pbContactMove?(user) && user.affectedByContactEffect? if move.pbContactMove?(user) && user.affectedByContactEffect? && user.takesIndirectDamage?
@battle.scene.pbDamageAnimation(user) @battle.scene.pbDamageAnimation(user)
user.pbReduceHP(user.totalhp / 8, false) user.pbReduceHP(user.totalhp / 8, false)
@battle.pbDisplay(_INTL("{1} was hurt!", user.pbThis)) @battle.pbDisplay(_INTL("{1} was hurt!", user.pbThis))

View File

@@ -26,7 +26,7 @@ class Battle::Battler
when 1 # Gulping Form when 1 # Gulping Form
user.pbLowerStatStageByAbility(:DEFENSE, 1, target, false) user.pbLowerStatStageByAbility(:DEFENSE, 1, target, false)
when 2 # Gorging Form when 2 # Gorging Form
target.pbParalyze(user) if target.pbCanParalyze?(user, false) user.pbParalyze(target) if user.pbCanParalyze?(target, false)
end end
@battle.pbHideAbilitySplash(target) @battle.pbHideAbilitySplash(target)
user.pbItemHPHealCheck if user.hp < oldHP user.pbItemHPHealCheck if user.hp < oldHP

View File

@@ -2251,12 +2251,14 @@ Battle::AbilityEffects::EndOfRoundWeather.add(:DRYSKIN,
proc { |ability, weather, battler, battle| proc { |ability, weather, battler, battle|
case weather case weather
when :Sun, :HarshSun when :Sun, :HarshSun
battle.pbShowAbilitySplash(battler) if battler.takesIndirectDamage?
battle.scene.pbDamageAnimation(battler) battle.pbShowAbilitySplash(battler)
battler.pbReduceHP(battler.totalhp / 8, false) battle.scene.pbDamageAnimation(battler)
battle.pbDisplay(_INTL("{1} was hurt by the sunlight!", battler.pbThis)) battler.pbReduceHP(battler.totalhp / 8, false)
battle.pbHideAbilitySplash(battler) battle.pbDisplay(_INTL("{1} was hurt by the sunlight!", battler.pbThis))
battler.pbItemHPHealCheck battle.pbHideAbilitySplash(battler)
battler.pbItemHPHealCheck
end
when :Rain, :HeavyRain when :Rain, :HeavyRain
next if !battler.canHeal? next if !battler.canHeal?
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
@@ -2301,7 +2303,7 @@ Battle::AbilityEffects::EndOfRoundWeather.add(:ICEFACE,
Battle::AbilityEffects::EndOfRoundWeather.add(:RAINDISH, Battle::AbilityEffects::EndOfRoundWeather.add(:RAINDISH,
proc { |ability, weather, battler, battle| proc { |ability, weather, battler, battle|
next unless [:Rain, :HeavyRain].include?(weather) next if ![:Rain, :HeavyRain].include?(weather)
next if !battler.canHeal? next if !battler.canHeal?
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battler.pbRecoverHP(battler.totalhp / 16) battler.pbRecoverHP(battler.totalhp / 16)
@@ -2316,7 +2318,8 @@ Battle::AbilityEffects::EndOfRoundWeather.add(:RAINDISH,
Battle::AbilityEffects::EndOfRoundWeather.add(:SOLARPOWER, Battle::AbilityEffects::EndOfRoundWeather.add(:SOLARPOWER,
proc { |ability, weather, battler, battle| proc { |ability, weather, battler, battle|
next unless [:Sun, :HarshSun].include?(weather) next if ![:Sun, :HarshSun].include?(weather)
next if !battler.takesIndirectDamage?
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battle.scene.pbDamageAnimation(battler) battle.scene.pbDamageAnimation(battler)
battler.pbReduceHP(battler.totalhp / 8, false) battler.pbReduceHP(battler.totalhp / 8, false)
@@ -2332,7 +2335,7 @@ Battle::AbilityEffects::EndOfRoundWeather.add(:SOLARPOWER,
Battle::AbilityEffects::EndOfRoundHealing.add(:HEALER, Battle::AbilityEffects::EndOfRoundHealing.add(:HEALER,
proc { |ability, battler, battle| proc { |ability, battler, battle|
next unless battle.pbRandom(100) < 30 next if battle.pbRandom(100) >= 30
battler.allAllies.each do |b| battler.allAllies.each do |b|
next if b.status == :NONE next if b.status == :NONE
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
@@ -2920,9 +2923,9 @@ Battle::AbilityEffects::OnSwitchIn.add(:NEUTRALIZINGGAS,
end end
# Trigger items upon Unnerve being negated # Trigger items upon Unnerve being negated
battler.ability_id = nil # Allows checking if Unnerve was active before battler.ability_id = nil # Allows checking if Unnerve was active before
had_unnerve = battle.pbCheckGlobalAbility(:UNNERVE) had_unnerve = battle.pbCheckGlobalAbility([:UNNERVE, :ASONECHILLINGNEIGH, :ASONEGRIMNEIGH])
battler.ability_id = :NEUTRALIZINGGAS battler.ability_id = :NEUTRALIZINGGAS
if had_unnerve && !battle.pbCheckGlobalAbility(:UNNERVE) if had_unnerve && !battle.pbCheckGlobalAbility([:UNNERVE, :ASONECHILLINGNEIGH, :ASONEGRIMNEIGH])
battle.allBattlers.each { |b| b.pbItemsOnUnnerveEnding } battle.allBattlers.each { |b| b.pbItemsOnUnnerveEnding }
end end
} }

View File

@@ -669,7 +669,13 @@ def pbItemBall(item, quantity = 1)
if item == :DNASPLICERS if item == :DNASPLICERS
pbMessage("\\me[#{meName}]" + _INTL("You found \\c[1]{1}\\c[0]!", itemname) + "\\wtnp[30]") pbMessage("\\me[#{meName}]" + _INTL("You found \\c[1]{1}\\c[0]!", itemname) + "\\wtnp[30]")
elsif item.is_machine? # TM or HM elsif item.is_machine? # TM or HM
pbMessage("\\me[#{meName}]" + _INTL("You found \\c[1]{1} {2}\\c[0]!", itemname, GameData::Move.get(move).name) + "\\wtnp[30]") if quantity > 1
pbMessage("\\me[#{meName}]" + _INTL("You found {1} \\c[1]{2} {3}\\c[0]!",
quantity, itemname, GameData::Move.get(move).name) + "\\wtnp[30]")
else
pbMessage("\\me[#{meName}]" + _INTL("You found \\c[1]{1} {2}\\c[0]!",
itemname, GameData::Move.get(move).name) + "\\wtnp[30]")
end
elsif quantity > 1 elsif quantity > 1
pbMessage("\\me[#{meName}]" + _INTL("You found {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]") pbMessage("\\me[#{meName}]" + _INTL("You found {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]")
elsif itemname.starts_with_vowel? elsif itemname.starts_with_vowel?
@@ -683,7 +689,11 @@ def pbItemBall(item, quantity = 1)
end end
# Can't add the item # Can't add the item
if item.is_machine? # TM or HM if item.is_machine? # TM or HM
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!", itemname, GameData::Move.get(move).name) + "\\wtnp[30]") if quantity > 1
pbMessage(_INTL("You found {1} \\c[1]{2} {3}\\c[0]!", quantity, itemname, GameData::Move.get(move).name) + "\\wtnp[30]")
else
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!", itemname, GameData::Move.get(move).name) + "\\wtnp[30]")
end
elsif quantity > 1 elsif quantity > 1
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]") pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]")
elsif itemname.starts_with_vowel? elsif itemname.starts_with_vowel?
@@ -708,7 +718,13 @@ def pbReceiveItem(item, quantity = 1)
if item == :DNASPLICERS if item == :DNASPLICERS
pbMessage("\\me[#{meName}]" + _INTL("You obtained \\c[1]{1}\\c[0]!", itemname) + "\\wtnp[30]") pbMessage("\\me[#{meName}]" + _INTL("You obtained \\c[1]{1}\\c[0]!", itemname) + "\\wtnp[30]")
elsif item.is_machine? # TM or HM elsif item.is_machine? # TM or HM
pbMessage("\\me[#{meName}]" + _INTL("You obtained \\c[1]{1} {2}\\c[0]!", itemname, GameData::Move.get(move).name) + "\\wtnp[30]") if quantity > 1
pbMessage("\\me[#{meName}]" + _INTL("You obtained {1} \\c[1]{2} {3}\\c[0]!",
quantity, itemname, GameData::Move.get(move).name) + "\\wtnp[30]")
else
pbMessage("\\me[#{meName}]" + _INTL("You obtained \\c[1]{1} {2}\\c[0]!",
itemname, GameData::Move.get(move).name) + "\\wtnp[30]")
end
elsif quantity > 1 elsif quantity > 1
pbMessage("\\me[#{meName}]" + _INTL("You obtained {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]") pbMessage("\\me[#{meName}]" + _INTL("You obtained {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]")
elsif itemname.starts_with_vowel? elsif itemname.starts_with_vowel?