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
def takesShadowSkyDamage?
return false if fainted?
return false if !takesIndirectDamage?
return false if shadowPokemon?
return true
end

View File

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

View File

@@ -370,7 +370,7 @@ class Battle::Battler
end
target.damageState.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)
user.pbReduceHP(user.totalhp / 8, false)
@battle.pbDisplay(_INTL("{1} was hurt!", user.pbThis))

View File

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

View File

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

View File

@@ -669,7 +669,13 @@ def pbItemBall(item, quantity = 1)
if item == :DNASPLICERS
pbMessage("\\me[#{meName}]" + _INTL("You found \\c[1]{1}\\c[0]!", itemname) + "\\wtnp[30]")
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
pbMessage("\\me[#{meName}]" + _INTL("You found {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]")
elsif itemname.starts_with_vowel?
@@ -683,7 +689,11 @@ def pbItemBall(item, quantity = 1)
end
# Can't add the item
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
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]")
elsif itemname.starts_with_vowel?
@@ -708,7 +718,13 @@ def pbReceiveItem(item, quantity = 1)
if item == :DNASPLICERS
pbMessage("\\me[#{meName}]" + _INTL("You obtained \\c[1]{1}\\c[0]!", itemname) + "\\wtnp[30]")
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
pbMessage("\\me[#{meName}]" + _INTL("You obtained {1} \\c[1]{2}\\c[0]!", quantity, itemname) + "\\wtnp[30]")
elsif itemname.starts_with_vowel?