Skip to content

Commit

Permalink
Added a forfeit flag to the end-battle flags
Browse files Browse the repository at this point in the history
At this stage, primarily for use in the Battle Factory.
  • Loading branch information
varkor committed Jan 8, 2016
1 parent cc8c64e commit a3345dc
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions battle/scripts/objects/general/BattleContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -1705,22 +1705,25 @@ function BattleContext (client) {
Textbox.state(opponents + " forfeited the battle!");
}
endBattleFlags = {
"outcome" : "allied victory"
"outcome" : "allied victory",
"forfeit" : true
};
} else if (forfeiters.length === 1 && forfeiters.first() === battleContext.alliedTrainers.first().identification) {
if (!battleContext.process) {
var playerName = !battleContext.process ? battleContext.alliedTrainers.first().pronoun(true) : null;
Textbox.state(playerName + " forfeited the battle!");
}
endBattleFlags = {
"outcome" : "opposing victory"
"outcome" : "opposing victory",
"forfeit" : true
};
} else {
if (!battleContext.process) {
Textbox.state("Everyone forfeited the battle!");
}
endBattleFlags = {
"outcome" : "draw"
"outcome" : "draw",
"forfeit" : true
};
}
if (battleContext.state.kind === "waiting") {
Expand Down Expand Up @@ -2698,7 +2701,8 @@ function BattleContext (client) {
}
var effect = function () {
battleContext.end({
"outcome" : "draw"
"outcome" : "draw",
"forfeit" : false
});
};
if (!battleContext.process)
Expand Down Expand Up @@ -2940,7 +2944,8 @@ function BattleContext (client) {
if (!battleContext.process) Textbox.state(playerName + " blacked out!");
}
endBattleFlags = {
"outcome" : "opposing victory"
"outcome" : "opposing victory",
"forfeit" : false
};
} else {
if (!battleContext.process) Textbox.state(playerName + " " + (battleContext.alliedTrainers.first() !== Game.player ? "has" : "have") + " defeated " + (trainerBattle ? opponents : "the wild Pokémon") + "!");
Expand Down Expand Up @@ -2969,7 +2974,8 @@ function BattleContext (client) {
}
}
endBattleFlags = {
"outcome" : "allied victory"
"outcome" : "allied victory",
"forfeit" : false
};
}
battleContext.endingFlags = endBattleFlags;
Expand Down

0 comments on commit a3345dc

Please sign in to comment.