Removed Hardcoded Values
Realized there was an enum for the -1 value which should help clear up confusion if someone has to mess with this code laterpull/350/merge
parent
fabd2b1550
commit
5d6181926a
|
@ -2737,8 +2737,8 @@ export class EnemyPokemon extends Pokemon {
|
||||||
let targetScores: integer[] = [];
|
let targetScores: integer[] = [];
|
||||||
|
|
||||||
for (let mt of moveTargets[move.id]) {
|
for (let mt of moveTargets[move.id]) {
|
||||||
// Prevent a target score from being calculated when there isn't a target
|
// Prevent a target score from being calculated when the target is whoever attacks the user
|
||||||
if (mt === -1)
|
if (mt === BattlerIndex.ATTACKER)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const target = this.scene.getField()[mt];
|
const target = this.scene.getField()[mt];
|
||||||
|
@ -2812,10 +2812,10 @@ export class EnemyPokemon extends Pokemon {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!sortedBenefitScores.length) {
|
if (!sortedBenefitScores.length) {
|
||||||
// Set target to -1 when using a counter move
|
// Set target to BattlerIndex.ATTACKER when using a counter move
|
||||||
// This is the same as when the player does so
|
// This is the same as when the player does so
|
||||||
if (!!move.findAttr(attr => attr instanceof CounterDamageAttr))
|
if (!!move.findAttr(attr => attr instanceof CounterDamageAttr))
|
||||||
return [-1];
|
return [BattlerIndex.ATTACKER];
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue