mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-02-16 17:27:41 +00:00
[Enhancement] Color code for used PP in fight UI (#2014)
* Colorcode pp in fight ui if only half/quarter of maxPP is left * Use three-level color coding for remaining pp * use if/else for calculating pp color --------- Co-authored-by: Kevin Greiner <greiner@infai.org>
This commit is contained in:
parent
8807efe002
commit
aba9310ddf
@ -179,6 +179,18 @@ export default class FightUiHandler extends UiHandler {
|
||||
const pp = maxPP - pokemonMove.ppUsed;
|
||||
|
||||
this.ppText.setText(`${Utils.padInt(pp, 2, " ")}/${Utils.padInt(maxPP, 2, " ")}`);
|
||||
const ppPercentLeft = pp / maxPP;
|
||||
let ppColor = "white";
|
||||
if (ppPercentLeft <= 0.5) {
|
||||
ppColor = "yellow";
|
||||
}
|
||||
if (ppPercentLeft <= 0.25) {
|
||||
ppColor = "orange";
|
||||
}
|
||||
if (pp === 0) {
|
||||
ppColor = "red";
|
||||
}
|
||||
this.ppText.setColor(ppColor);
|
||||
this.powerText.setText(`${power >= 0 ? power : "---"}`);
|
||||
this.accuracyText.setText(`${accuracy >= 0 ? accuracy : "---"}`);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user