Skip to content

Commit

Permalink
Added status indicators in the Pokémon widget
Browse files Browse the repository at this point in the history
Very helpful, as there was previously no way to see what status your
Pokémon had, graphically.
  • Loading branch information
varkor committed Jan 5, 2016
1 parent 86f0da7 commit f57bed3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion battle/scripts/objects/general/BattleContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,9 @@ function BattleContext (client) {
"outcome" : "opposing victory"
};
} else {
Textbos.state("Everyone forfeited the battel!");
if (!battleContext.process) {
Textbox.state("Everyone forfeited the battel!");
}
endBattleFlags = {
"outcome" : "draw"
};
Expand Down
15 changes: 15 additions & 0 deletions battle/scripts/objects/unique/Widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ Widgets.FlowGrid = {
context.arcHD(position.x + size.width / 2, position.y + size.height / 2, radius.inner, 2 * Math.PI - startAngle, 2 * Math.PI - endAngle, true);
context.arcHD(position.x + size.width / 2, position.y + size.height / 2, radius.outer, 2 * Math.PI - endAngle, 2 * Math.PI - startAngle, false);
context.fill();
// Status
if (poke.status !== "none") {
var offset = 2, cornerRadius = 4;
context.beginPath();
context.lineToHD(position.x, position.y + size.height / 4);
for (var angle = 0; angle <= 1; angle += 1 / 8) {
context.lineToHD(
position.x + size.width / 2 + (size.width / 2 - cornerRadius) * Math.sign(Math.cos((offset + 0.5) * Math.PI / 2)) + cornerRadius * Math.cos((angle + offset) * Math.PI / 2),
position.y + size.height / 2 + (size.height / 2 - cornerRadius) * Math.sign(Math.sin((offset + 0.5) * Math.PI / 2)) + cornerRadius * Math.sin((angle + offset) * Math.PI / 2)
);
}
context.lineToHD(position.x + size.width / 4, position.y);
context.fillStyle = "hsl(" + ["0, 50%, 50%", "185, 50%, 70%", "55, 70%, 50%", "280, 50%, 50%", "265, 70%, 50%", "0, 0%, 70%"][["burned", "frozen", "paralysed", "poisoned", "badly poisoned", "asleep"].indexOf(poke.status)] + ")";
context.fill();
}
// Icon
var icon = Sprite.load(poke.paths.icon(true));
if (icon) {
Expand Down

0 comments on commit f57bed3

Please sign in to comment.