[Bug] Fix DNA splicers broken from the strictnull check (#3454)
This makes DNA-splicer work again
This commit is contained in:
parent
b794662776
commit
30cc6aba89
|
@ -115,11 +115,11 @@ export function getRandomStatusEffect(statusEffectA: StatusEffect, statusEffectB
|
|||
* @param statusA The first Status
|
||||
* @param statusB The second Status
|
||||
*/
|
||||
export function getRandomStatus(statusA: Status, statusB: Status): Status {
|
||||
if (statusA === undefined || statusA.effect === StatusEffect.NONE || statusA.effect === StatusEffect.FAINT) {
|
||||
export function getRandomStatus(statusA: Status | null, statusB: Status | null): Status | null {
|
||||
if (!statusA || statusA.effect === StatusEffect.NONE || statusA.effect === StatusEffect.FAINT) {
|
||||
return statusB;
|
||||
}
|
||||
if (statusB === undefined || statusB.effect === StatusEffect.NONE || statusB.effect === StatusEffect.FAINT) {
|
||||
if (!statusB || statusB.effect === StatusEffect.NONE || statusB.effect === StatusEffect.FAINT) {
|
||||
return statusA;
|
||||
}
|
||||
|
||||
|
|
|
@ -3614,7 +3614,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
if (!this.isFainted()) {
|
||||
// If this Pokemon hasn't fainted, make sure the HP wasn't set over the new maximum
|
||||
this.hp = Math.min(this.hp, this.stats[Stat.HP]);
|
||||
this.status = getRandomStatus(this.status!, pokemon.status!); // Get a random valid status between the two // TODO: are the bangs correct?
|
||||
this.status = getRandomStatus(this.status, pokemon.status); // Get a random valid status between the two
|
||||
} else if (!pokemon.isFainted()) {
|
||||
// If this Pokemon fainted but the other hasn't, make sure the HP wasn't set to zero
|
||||
this.hp = Math.max(this.hp, 1);
|
||||
|
|
Loading…
Reference in New Issue