Fixed various bugs found when generating Battle Frontier challenge lists

This commit is contained in:
Maruno17
2021-12-29 14:37:41 +00:00
parent a7e8005f53
commit fb29f19a28
8 changed files with 34 additions and 24 deletions

View File

@@ -346,7 +346,7 @@ class Battle
count = 0
eachInTeamFromBattlerIndex(idxBattler) do |pkmn, i|
next if !pkmn || !pkmn.able?
next if inBattleIndices.include?(idxParty)
next if inBattleIndices.include?(i)
count += 1
end
return count

View File

@@ -32,7 +32,7 @@ class Battle::Move::Confusion < Battle::Move
@category = 0
@accuracy = 100
@pp = -1
@target = 0
@target = :User
@priority = 0
@flags = []
@addlEffect = 0
@@ -61,7 +61,7 @@ class Battle::Move::Struggle < Battle::Move
@category = 0
@accuracy = 0
@pp = -1
@target = 0
@target = :NearOther
@priority = 0
@flags = ["Contact", "CanProtect"]
@addlEffect = 0

View File

@@ -1315,13 +1315,13 @@ end
#===============================================================================
class Battle::Move::TypeDependsOnUserIVs < Battle::Move
def pbBaseType(user)
hp = pbHiddenPower(user)
hp = pbHiddenPower(user.pokemon)
return hp[0]
end
def pbBaseDamage(baseDmg, user, target)
return super if Settings::MECHANICS_GENERATION >= 6
hp = pbHiddenPower(user)
hp = pbHiddenPower(user.pokemon)
return hp[1]
end
end

View File

@@ -22,19 +22,28 @@ class Battle::DebugSceneNoLogging
# Called whenever a new round begins.
def pbBeginCommandPhase; end
def pbBeginAttackPhase; end
def pbBeginEndOfRoundPhase; end
def pbShowOpponent(idxTrainer); end
def pbDamageAnimation(battler, effectiveness = 0); end
def pbCommonAnimation(animName, user = nil, target = nil); end
def pbAnimation(moveID, user, targets, hitNum = 0); end
def pbHitAndHPLossAnimation(targets); end
def pbShowPartyLineup(side, fullAnim = false); end
def pbShowAbilitySplash(battler, delay = false, logTrigger = true); end
def pbReplaceAbilitySplash(battler); end
def pbHideAbilitySplash(battler); end
def pbEndBattle(result); end
def pbWildBattleSuccess; end
def pbTrainerBattleSuccess; end
def pbBattleArenaJudgment(b1, b2, r1, r2); end
def pbBattleArenaBattlers(b1, b2); end
def pbUpdate(cw = nil); end
def pbRefresh; end
def pbRefreshOne(idxBattler); end
def pbDisplayMessage(msg, brief = false); end
alias pbDisplay pbDisplayMessage
def pbDisplayPausedMessage(msg); end
def pbDisplayConfirmMessage(msg); return true; end
def pbShowCommands(msg, commands, defaultValue); return 0; end
@@ -45,6 +54,7 @@ class Battle::DebugSceneNoLogging
def pbResetMoveIndex(idxBattler); end
def pbHPChanged(battler, oldHP, showAnim = false); end
def pbChangePokemon(idxBattler, pkmn); end
def pbFaintBattler(battler); end
def pbEXPBar(battler, startExp, endExp, tempExp1, tempExp2); end
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,

View File

@@ -1527,7 +1527,7 @@ Battle::AbilityEffects::DamageCalcFromTarget.add(:FLOWERGIFT,
Battle::AbilityEffects::DamageCalcFromTarget.add(:FLUFFY,
proc { |ability, user, target, move, mults, baseDmg, type|
mults[:final_damage_multiplier] *= 2 if move.calcType == :FIRE
mults[:final_damage_multiplier] /= 2 if move.pbContactMove?
mults[:final_damage_multiplier] /= 2 if move.pbContactMove?(user)
}
)
@@ -1711,11 +1711,11 @@ Battle::AbilityEffects::OnBeingHit.add(:ANGERPOINT,
Battle::AbilityEffects::OnBeingHit.add(:COTTONDOWN,
proc { |ability, user, target, move, battle|
next if battle.allBattlers.none? { |b| b.pbCanLowerStatStage?(:DEFENSE, target) }
battle.pbShowAbilitySplash(battler)
battle.pbShowAbilitySplash(target)
battle.allBattlers.each do |b|
b.pbLowerStatStageByAbility(:SPEED, 1, target, false)
end
battle.pbHideAbilitySplash(battler)
battle.pbHideAbilitySplash(target)
}
)
@@ -1972,7 +1972,7 @@ Battle::AbilityEffects::OnBeingHit.add(:RATTLED,
Battle::AbilityEffects::OnBeingHit.add(:SANDSPIT,
proc { |ability, user, target, move, battle|
battle.pbStartWeatherAbility(:Sandstorm, battler)
battle.pbStartWeatherAbility(:Sandstorm, target)
}
)
@@ -2907,7 +2907,7 @@ Battle::AbilityEffects::OnSwitchIn.add(:NEUTRALIZINGGAS,
# Truant - let b move on its first turn after Neutralizing Gas disappears
b.effects[PBEffects::Truant] = false
# Gorilla Tactics - end choice lock
if !hasActiveItem?([:CHOICEBAND, :CHOICESPECS, :CHOICESCARF])
if !b.hasActiveItem?([:CHOICEBAND, :CHOICESPECS, :CHOICESCARF])
b.effects[PBEffects::ChoiceBand] = nil
end
# Illusion - end illusions
@@ -2977,12 +2977,12 @@ Battle::AbilityEffects::OnSwitchIn.add(:SANDSTREAM,
Battle::AbilityEffects::OnSwitchIn.add(:SCREENCLEANER,
proc { |ability, battler, battle, switch_in|
next if target.pbOwnSide.effects[PBEffects::AuroraVeil] == 0 &&
target.pbOwnSide.effects[PBEffects::LightScreen] == 0 &&
target.pbOwnSide.effects[PBEffects::Reflect] == 0 &&
target.pbOpposingSide.effects[PBEffects::AuroraVeil] == 0 &&
target.pbOpposingSide.effects[PBEffects::LightScreen] == 0 &&
target.pbOpposingSide.effects[PBEffects::Reflect] == 0
next if battler.pbOwnSide.effects[PBEffects::AuroraVeil] == 0 &&
battler.pbOwnSide.effects[PBEffects::LightScreen] == 0 &&
battler.pbOwnSide.effects[PBEffects::Reflect] == 0 &&
battler.pbOpposingSide.effects[PBEffects::AuroraVeil] == 0 &&
battler.pbOpposingSide.effects[PBEffects::LightScreen] == 0 &&
battler.pbOpposingSide.effects[PBEffects::Reflect] == 0
battle.pbShowAbilitySplash(battler)
if battler.pbOpposingSide.effects[PBEffects::AuroraVeil] > 0
battler.pbOpposingSide.effects[PBEffects::AuroraVeil] = 0

View File

@@ -176,7 +176,7 @@ def pbGenerateChallenge(rule, tag)
rule = rule.copy.setNumber(2)
yield(nil)
party = load_data(tag + ".rxdata") rescue []
teams = load_data(tag + "teams.rxdata") rescue []
teams = load_data(tag + "_teams.rxdata") rescue []
if teams.length < 10
btpokemon = pbGetBTPokemon(tag)
if btpokemon && btpokemon.length != 0
@@ -218,7 +218,7 @@ def pbGenerateChallenge(rule, tag)
end
i += 1
end
save_data(teams, tag + "teams.rxdata")
save_data(teams, tag + "_teams.rxdata")
yield(nil)
while teams.length < maxteams
yield(nil) if teams.length % 10 == 0
@@ -256,7 +256,7 @@ def pbGenerateChallenge(rule, tag)
end
end
teams.sort! { |a, b| b.rating <=> a.rating }
save_data(teams, tag + "teams.rxdata")
save_data(teams, tag + "_teams.rxdata")
end
party = []
yield(nil)

View File

@@ -202,7 +202,7 @@ def pbTrainerInfo(pokemonlist, trfile, rules)
yield(nil) if block_given?
if trIndex < 0
info = [newbttrainers, pbpokemonlist, [trfile],
trfile + "tr.txt", trfile + "pm.txt", !hasDefault]
trfile + "_trainers.txt", trfile + "_pkmn.txt", !hasDefault]
trlists.push(info)
end
yield(nil) if block_given?

View File

@@ -380,7 +380,7 @@ def pbRuledBattle(team1, team2, rule)
trainer2 = NPCTrainer.new("PLAYER2", t_type)
items1 = []
items2 = []
team1.each_with_index do |p, i|
team1.team.each_with_index do |p, i|
next if !p
if p.level != level
p.level = level
@@ -389,7 +389,7 @@ def pbRuledBattle(team1, team2, rule)
items1[i] = p.item_id
trainer1.party.push(p)
end
team2.each_with_index do |p, i|
team2.team.each_with_index do |p, i|
next if !p
if p.level != level
p.level = level
@@ -404,12 +404,12 @@ def pbRuledBattle(team1, team2, rule)
battle.controlPlayer = true
battle.internalBattle = false
decision = battle.pbStartBattle
team1.each_with_index do |p, i|
team1.team.each_with_index do |p, i|
next if !p
p.heal
p.item = items1[i]
end
team2.each_with_index do |p, i|
team2.team.each_with_index do |p, i|
next if !p
p.heal
p.item = items2[i]