Snowstorm, forfeiting trainer battles, battle outcome values

This commit is contained in:
Maruno17
2024-06-15 21:29:00 +01:00
parent 22b33ca6c2
commit 8e9417c3b7
41 changed files with 284 additions and 214 deletions

View File

@@ -364,10 +364,10 @@ def pbDecideWinner(party0, party1, rating0, rating1)
score0 = pbDecideWinnerScore(party0, party1, rating0)
score1 = pbDecideWinnerScore(party1, party0, rating1)
if score0 == score1
return 5 if rating0 == rating1
return (rating0 > rating1) ? 1 : 2
return Battle::Outcome::DRAW if rating0 == rating1
return (rating0 > rating1) ? Battle::Outcome::WIN : Battle::Outcome::LOSE
else
return (score0 > score1) ? 1 : 2
return (score0 > score1) ? Battle::Outcome::WIN : Battle::Outcome::LOSE
end
end
@@ -375,7 +375,7 @@ end
#
#===============================================================================
def pbRuledBattle(team1, team2, rule)
decision = 0
outcome = Battle::Outcome::UNDECIDED
if rand(100) == 0
level = rule.ruleset.suggestedLevel
t_type = GameData::TrainerType.keys.first
@@ -406,7 +406,7 @@ def pbRuledBattle(team1, team2, rule)
battle.debug = true
battle.controlPlayer = true
battle.internalBattle = false
decision = battle.pbStartBattle
outcome = battle.pbStartBattle
team1.team.each_with_index do |p, i|
next if !p
p.heal
@@ -422,13 +422,13 @@ def pbRuledBattle(team1, team2, rule)
party2 = []
team1.length.times { |i| party1.push(team1[i]) }
team2.length.times { |i| party2.push(team2[i]) }
decision = pbDecideWinner(party1, party2, team1.rating, team2.rating)
outcome = pbDecideWinner(party1, party2, team1.rating, team2.rating)
end
case decision
when 1 # Team 1 wins
case outcome
when Battle::Outcome::WIN # Team 1 wins
team1.addMatch(team2, 1)
team2.addMatch(team1, 0)
when 2 # Team 2 wins
when Battle::Outcome::LOSE # Team 2 wins
team1.addMatch(team2, 0)
team2.addMatch(team1, 1)
else