improve gang ascend modal

This commit is contained in:
Nolshine 2021-09-20 06:47:13 +01:00
parent 34313e8100
commit a9c57e23a5
2 changed files with 42 additions and 27 deletions

@ -218,28 +218,41 @@ export class GangMember {
return points.hack > 0 || points.str > 0 || points.def > 0 || points.dex > 0 || points.agi > 0 || points.cha > 0; return points.hack > 0 || points.str > 0 || points.def > 0 || points.dex > 0 || points.agi > 0 || points.cha > 0;
} }
getAscensionResults(): IMults { getCurrentAscensionMults(): IMults {
return {
hack: this.calculateAscensionMult(this.hack_asc_points),
str: this.calculateAscensionMult(this.str_asc_points),
def: this.calculateAscensionMult(this.def_asc_points),
dex: this.calculateAscensionMult(this.dex_asc_points),
agi: this.calculateAscensionMult(this.agi_asc_points),
cha: this.calculateAscensionMult(this.cha_asc_points)
}
}
getAscensionMultsAfterAscend(): IMults {
const points = this.getGainedAscensionPoints(); const points = this.getGainedAscensionPoints();
return { return {
hack: hack: this.calculateAscensionMult(this.hack_asc_points + points.hack),
this.calculateAscensionMult(this.hack_asc_points + points.hack) / str: this.calculateAscensionMult(this.str_asc_points + points.str),
this.calculateAscensionMult(this.hack_asc_points), def: this.calculateAscensionMult(this.def_asc_points + points.def),
str: dex: this.calculateAscensionMult(this.dex_asc_points + points.dex),
this.calculateAscensionMult(this.str_asc_points + points.str) / agi: this.calculateAscensionMult(this.agi_asc_points + points.agi),
this.calculateAscensionMult(this.str_asc_points), cha: this.calculateAscensionMult(this.cha_asc_points + points.cha),
def: }
this.calculateAscensionMult(this.def_asc_points + points.def) / }
this.calculateAscensionMult(this.def_asc_points),
dex: getAscensionResults(): IMults {
this.calculateAscensionMult(this.dex_asc_points + points.dex) / const postAscend = this.getAscensionMultsAfterAscend();
this.calculateAscensionMult(this.dex_asc_points), const preAscend = this.getCurrentAscensionMults();
agi:
this.calculateAscensionMult(this.agi_asc_points + points.agi) / return {
this.calculateAscensionMult(this.agi_asc_points), hack: postAscend.hack / preAscend.hack,
cha: str: postAscend.str / preAscend.str,
this.calculateAscensionMult(this.cha_asc_points + points.cha) / def: postAscend.def / preAscend.def,
this.calculateAscensionMult(this.cha_asc_points), dex: postAscend.dex / preAscend.dex,
}; agi: postAscend.agi / preAscend.agi,
cha: postAscend.cha / preAscend.cha,
}
} }
ascend(): IAscensionResult { ascend(): IAscensionResult {

@ -57,7 +57,9 @@ export function AscensionPopup(props: IProps): React.ReactElement {
removePopup(props.popupId); removePopup(props.popupId);
} }
const ascendBenefits = props.member.getAscensionResults(); // const ascendBenefits = props.member.getAscensionResults();
const preAscend = props.member.getCurrentAscensionMults();
const postAscend = props.member.getAscensionMultsAfterAscend();
return ( return (
<> <>
@ -72,17 +74,17 @@ export function AscensionPopup(props: IProps): React.ReactElement {
<br /> <br />
In return, they will gain the following permanent boost to stat multipliers: In return, they will gain the following permanent boost to stat multipliers:
<br /> <br />
Hacking: x{numeralWrapper.format(ascendBenefits.hack, "0.000")} Hacking: x{numeralWrapper.format(preAscend.hack, "0.000")} =&gt; x{numeralWrapper.format(postAscend.hack, "0.000")}
<br /> <br />
Strength: x{numeralWrapper.format(ascendBenefits.str, "0.000")} Strength: x{numeralWrapper.format(preAscend.str, "0.000")} =&gt; x{numeralWrapper.format(postAscend.str, "0.000")}
<br /> <br />
Defense: x{numeralWrapper.format(ascendBenefits.def, "0.000")} Defense: x{numeralWrapper.format(preAscend.def, "0.000")} =&gt; x{numeralWrapper.format(postAscend.def, "0.000")}
<br /> <br />
Dexterity: x{numeralWrapper.format(ascendBenefits.dex, "0.000")} Dexterity: x{numeralWrapper.format(preAscend.dex, "0.000")} =&gt; x{numeralWrapper.format(postAscend.dex, "0.000")}
<br /> <br />
Agility: x{numeralWrapper.format(ascendBenefits.agi, "0.000")} Agility: x{numeralWrapper.format(preAscend.agi, "0.000")} =&gt; x{numeralWrapper.format(postAscend.agi, "0.000")}
<br /> <br />
Charisma: x{numeralWrapper.format(ascendBenefits.cha, "0.000")} Charisma: x{numeralWrapper.format(preAscend.cha, "0.000")} =&gt; x{numeralWrapper.format(postAscend.cha, "0.000")}
<br /> <br />
</pre> </pre>
<button className="std-button" onClick={confirm}> <button className="std-button" onClick={confirm}>