mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-10 22:54:59 +00:00
Merge branch 'dev' into ai
This commit is contained in:
@@ -166,11 +166,11 @@ class Battle
|
||||
@runCommand = 0
|
||||
@nextPickupUse = 0
|
||||
if GameData::Move.exists?(:STRUGGLE)
|
||||
@struggle = Move.from_pokemon_move(self, Pokemon::Move.new(:STRUGGLE))
|
||||
@struggle = Move.from_pokemon_move(self, Pokemon::Move.new(:STRUGGLE))
|
||||
else
|
||||
@struggle = Move::Struggle.new(self, nil)
|
||||
@struggle = Move::Struggle.new(self, nil)
|
||||
end
|
||||
@mega_rings = []
|
||||
@mega_rings = []
|
||||
GameData::Item.each { |item| @mega_rings.push(item.id) if item.has_flag?("MegaRing") }
|
||||
@battleAI = AI.new(self)
|
||||
end
|
||||
|
||||
@@ -211,9 +211,7 @@ class Battle
|
||||
oldSpAtk = pkmn.spatk
|
||||
oldSpDef = pkmn.spdef
|
||||
oldSpeed = pkmn.speed
|
||||
if battler&.pokemon
|
||||
battler.pokemon.changeHappiness("levelup")
|
||||
end
|
||||
battler.pokemon.changeHappiness("levelup") if battler&.pokemon
|
||||
pkmn.calc_stats
|
||||
battler&.pbUpdate(false)
|
||||
@scene.pbRefreshOne(battler.index) if battler
|
||||
|
||||
@@ -227,7 +227,7 @@ class Battle
|
||||
end
|
||||
# Reorder the priority array
|
||||
if needRearranging
|
||||
@priority.sort! { |a, b|
|
||||
@priority.sort! do |a, b|
|
||||
if a[5] != b[5]
|
||||
# Sort by priority (highest value first)
|
||||
b[5] <=> a[5]
|
||||
@@ -241,7 +241,7 @@ class Battle
|
||||
# Sort by speed (highest first), and use tie-breaker if necessary
|
||||
(a[1] == b[1]) ? b[6] <=> a[6] : b[1] <=> a[1]
|
||||
end
|
||||
}
|
||||
end
|
||||
# Write the priority order to the debug log
|
||||
if fullCalc && $INTERNAL
|
||||
logMsg = "[Round order] "
|
||||
|
||||
@@ -111,7 +111,7 @@ class Battle
|
||||
# all instances where the party screen is opened.
|
||||
def pbPartyScreen(idxBattler, checkLaxOnly = false, canCancel = false, shouldRegister = false)
|
||||
ret = -1
|
||||
@scene.pbPartyScreen(idxBattler, canCancel) { |idxParty, partyScene|
|
||||
@scene.pbPartyScreen(idxBattler, canCancel) do |idxParty, partyScene|
|
||||
if checkLaxOnly
|
||||
next false if !pbCanSwitchLax?(idxBattler, idxParty, partyScene)
|
||||
elsif !pbCanSwitch?(idxBattler, idxParty, partyScene)
|
||||
@@ -122,7 +122,7 @@ class Battle
|
||||
end
|
||||
ret = idxParty
|
||||
next true
|
||||
}
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class Battle
|
||||
return true if pbAutoFightMenu(idxBattler)
|
||||
# Regular move selection
|
||||
ret = false
|
||||
@scene.pbFightMenu(idxBattler, pbCanMegaEvolve?(idxBattler)) { |cmd|
|
||||
@scene.pbFightMenu(idxBattler, pbCanMegaEvolve?(idxBattler)) do |cmd|
|
||||
case cmd
|
||||
when -1 # Cancel
|
||||
when -2 # Toggle Mega Evolution
|
||||
@@ -83,7 +83,7 @@ class Battle
|
||||
ret = true
|
||||
end
|
||||
next true
|
||||
}
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -103,7 +103,7 @@ class Battle
|
||||
return false
|
||||
end
|
||||
ret = false
|
||||
@scene.pbItemMenu(idxBattler, firstAction) { |item, useType, idxPkmn, idxMove, itemScene|
|
||||
@scene.pbItemMenu(idxBattler, firstAction) do |item, useType, idxPkmn, idxMove, itemScene|
|
||||
next false if !item
|
||||
battler = pkmn = nil
|
||||
case useType
|
||||
@@ -133,7 +133,7 @@ class Battle
|
||||
next false if !pbRegisterItem(idxBattler, item, idxPkmn, idxMove)
|
||||
ret = true
|
||||
next true
|
||||
}
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ class Battle
|
||||
pbPursuit(b.index)
|
||||
return if @decision > 0
|
||||
# Switch Pokémon
|
||||
allBattlers.each do |b|
|
||||
b.droppedBelowHalfHP = false
|
||||
b.statsDropped = false
|
||||
allBattlers.each do |b2|
|
||||
b2.droppedBelowHalfHP = false
|
||||
b2.statsDropped = false
|
||||
end
|
||||
pbRecallAndReplace(b.index, idxNewPkmn)
|
||||
pbOnBattlerEnteringBattle(b.index, true)
|
||||
|
||||
@@ -143,9 +143,9 @@ class Battle
|
||||
next if battler.opposes?(side)
|
||||
next if !battler.takesIndirectDamage? || battler.pbHasType?(:FIRE)
|
||||
@scene.pbDamageAnimation(battler)
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 8, false) { |hp_lost|
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 8, false) do |hp_lost|
|
||||
pbDisplay(_INTL("{1} is hurt by the sea of fire!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -192,11 +192,11 @@ class Battle
|
||||
recipient = @battlers[battler.effects[PBEffects::LeechSeed]]
|
||||
next if !recipient || recipient.fainted?
|
||||
pbCommonAnimation("LeechSeed", recipient, battler)
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 8) { |hp_lost|
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 8) do |hp_lost|
|
||||
recipient.pbRecoverHPFromDrain(hp_lost, battler,
|
||||
_INTL("{1}'s health is sapped by Leech Seed!", battler.pbThis))
|
||||
recipient.pbAbilitiesOnDamageTaken
|
||||
}
|
||||
end
|
||||
recipient.pbFaint if recipient.fainted?
|
||||
end
|
||||
end
|
||||
@@ -259,16 +259,16 @@ class Battle
|
||||
priority.each do |battler|
|
||||
battler.effects[PBEffects::Nightmare] = false if !battler.asleep?
|
||||
next if !battler.effects[PBEffects::Nightmare] || !battler.takesIndirectDamage?
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 4) { |hp_lost|
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 4) do |hp_lost|
|
||||
pbDisplay(_INTL("{1} is locked in a nightmare!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
end
|
||||
# Curse
|
||||
priority.each do |battler|
|
||||
next if !battler.effects[PBEffects::Curse] || !battler.takesIndirectDamage?
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 4) { |hp_lost|
|
||||
battler.pbTakeEffectDamage(battler.totalhp / 4) do |hp_lost|
|
||||
pbDisplay(_INTL("{1} is afflicted by the curse!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -301,9 +301,9 @@ class Battle
|
||||
hpLoss = (Settings::MECHANICS_GENERATION >= 6) ? battler.totalhp / 6 : battler.totalhp / 8
|
||||
end
|
||||
@scene.pbDamageAnimation(battler)
|
||||
battler.pbTakeEffectDamage(hpLoss, false) { |hp_lost|
|
||||
battler.pbTakeEffectDamage(hpLoss, false) do |hp_lost|
|
||||
pbDisplay(_INTL("{1} is hurt by {2}!", battler.pbThis, move_name))
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -319,9 +319,9 @@ class Battle
|
||||
|
||||
def pbEOREndBattlerEffects(priority)
|
||||
# Taunt
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Taunt) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Taunt) do |battler|
|
||||
pbDisplay(_INTL("{1}'s taunt wore off!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
# Encore
|
||||
priority.each do |battler|
|
||||
next if battler.fainted? || battler.effects[PBEffects::Encore] == 0
|
||||
@@ -339,34 +339,34 @@ class Battle
|
||||
end
|
||||
end
|
||||
# Disable/Cursed Body
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Disable) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Disable) do |battler|
|
||||
battler.effects[PBEffects::DisableMove] = nil
|
||||
pbDisplay(_INTL("{1} is no longer disabled!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
# Magnet Rise
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::MagnetRise) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::MagnetRise) do |battler|
|
||||
pbDisplay(_INTL("{1}'s electromagnetism wore off!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
# Telekinesis
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Telekinesis) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Telekinesis) do |battler|
|
||||
pbDisplay(_INTL("{1} was freed from the telekinesis!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
# Heal Block
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::HealBlock) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::HealBlock) do |battler|
|
||||
pbDisplay(_INTL("{1}'s Heal Block wore off!", battler.pbThis))
|
||||
}
|
||||
end
|
||||
# Embargo
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Embargo) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Embargo) do |battler|
|
||||
pbDisplay(_INTL("{1} can use items again!", battler.pbThis))
|
||||
battler.pbItemTerrainStatBoostCheck
|
||||
}
|
||||
end
|
||||
# Yawn
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Yawn) { |battler|
|
||||
pbEORCountDownBattlerEffect(priority, PBEffects::Yawn) do |battler|
|
||||
if battler.pbCanSleepYawn?
|
||||
PBDebug.log("[Lingering effect] #{battler.pbThis} fell asleep because of Yawn")
|
||||
battler.pbSleep
|
||||
end
|
||||
}
|
||||
end
|
||||
# Perish Song
|
||||
perishSongUsers = []
|
||||
priority.each do |battler|
|
||||
|
||||
Reference in New Issue
Block a user