Merge branch 'dev' into ai

This commit is contained in:
Maruno17
2023-04-20 18:05:58 +01:00
35 changed files with 173 additions and 160 deletions

View File

@@ -173,8 +173,7 @@ class Battle
newLevel = growth_rate.level_from_exp(expFinal)
if newLevel < curLevel
debugInfo = "Levels: #{curLevel}->#{newLevel} | Exp: #{pkmn.exp}->#{expFinal} | gain: #{expGained}"
raise _INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
pkmn.name, debugInfo)
raise _INTL("{1}'s new level is less than its current level, which shouldn't happen.", pkmn.name) + "\r\n[#{debugInfo}]"
end
# Give Exp
if pkmn.shadowPokemon?

View File

@@ -553,7 +553,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

@@ -383,7 +383,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

@@ -234,7 +234,7 @@ class Battle::Scene
pbWaitMessage
pbShowWindow(MESSAGE_BOX)
cw = @sprites["messageWindow"]
cw.text = _INTL("{1}\1", msg)
cw.text = msg + "\1"
PBDebug.log_message(msg)
yielded = false
timer = 0.0

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

@@ -59,7 +59,7 @@ class BugContestBattle < Battle
if pbBugContestState.lastPokemon
lastPokemon = pbBugContestState.lastPokemon
pbDisplayPaused(_INTL("You already caught a {1}.", lastPokemon.name))
helptext = _INTL("STOCK POKéMON:\n {1} Lv.{2} MaxHP: {3}\nTHIS POKéMON:\n {4} Lv.{5} MaxHP: {6}",
helptext = _INTL("Stock Pokémon:\n{1} Lv.{2} Max HP: {3}\nThis Pokémon:\n{4} Lv.{5} Max HP: {6}",
lastPokemon.name, lastPokemon.level, lastPokemon.totalhp,
pkmn.name, pkmn.level, pkmn.totalhp)
@scene.pbShowHelp(helptext)

View File

@@ -177,7 +177,7 @@ class BattleArenaBattle < Battle
ratings2.each { |val| points[1] += val }
# Make judgment
if points[0] == points[1]
pbDisplay(_INTL("{1} tied the opponent\n{2} in a referee's decision!",
pbDisplay(_INTL("{1} tied the opponent {2} in a referee's decision!",
@battlers[0].name, @battlers[1].name))
# NOTE: Pokémon doesn't really lose HP, but the effect is mostly the
# same.
@@ -186,12 +186,12 @@ class BattleArenaBattle < Battle
@battlers[1].hp = 0
@battlers[1].pbFaint(false)
elsif points[0] > points[1]
pbDisplay(_INTL("{1} defeated the opponent\n{2} in a referee's decision!",
pbDisplay(_INTL("{1} defeated the opponent {2} in a referee's decision!",
@battlers[0].name, @battlers[1].name))
@battlers[1].hp = 0
@battlers[1].pbFaint(false)
else
pbDisplay(_INTL("{1} lost to the opponent\n{2} in a referee's decision!",
pbDisplay(_INTL("{1} lost to the opponent {2} in a referee's decision!",
@battlers[0].name, @battlers[1].name))
@battlers[0].hp = 0
@battlers[0].pbFaint(false)
@@ -259,8 +259,8 @@ class Battle::Scene
end
def pbBattleArenaBattlers(battler1, battler2)
pbMessage(_INTL("REFEREE: {1} VS {2}!\nCommence battling!\\wtnp[20]",
battler1.name, battler2.name)) { pbBattleArenaUpdate }
pbMessage(_INTL("REFEREE: {1} VS {2}!\nCommence battling!",
battler1.name, battler2.name) + "\\wtnp[20]") { pbBattleArenaUpdate }
end
def pbBattleArenaJudgment(battler1, battler2, ratings1, ratings2)
@@ -271,7 +271,7 @@ class Battle::Scene
msgwindow = pbCreateMessageWindow
dimmingvp = Viewport.new(0, 0, Graphics.width, Graphics.height - msgwindow.height)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!\\wtnp[20]")) do
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!") + "\\wtnp[20]") do
pbBattleArenaUpdate
dimmingvp.update
end
@@ -299,21 +299,21 @@ class Battle::Scene
end
updateJudgment(infowindow, 1, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!\\wtnp[40]")) do
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!") + "\\wtnp[40]") do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
end
updateJudgment(infowindow, 2, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!\\wtnp[40]")) do
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!") + "\\wtnp[40]") do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
end
updateJudgment(infowindow, 3, battler1, battler2, ratings1, ratings2)
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!\\wtnp[40]")) do
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!") + "\\wtnp[40]") do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
@@ -326,23 +326,23 @@ class Battle::Scene
end
if total1 == total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!\\wtnp[40]", total1, total2)) do
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!", total1, total2) + "\\wtnp[40]") do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
end
elsif total1 > total2
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}'s {4}!\\wtnp[40]",
total1, total2, @battle.pbGetOwnerName(battler1.index), battler1.name)) do
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}'s {4}!",
total1, total2, @battle.pbGetOwnerName(battler1.index), battler1.name) + "\\wtnp[40]") do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update
end
else
pbMessageDisplay(msgwindow,
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}!\\wtnp[40]",
total1, total2, battler2.name)) do
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}!",
total1, total2, battler2.name) + "\\wtnp[40]") do
pbBattleArenaUpdate
dimmingvp.update
infowindow.update