Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisXV authored Feb 24, 2024
1 parent 7575c87 commit 31cfb1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
6 changes: 0 additions & 6 deletions data/mods/gen9ssb/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,12 @@ export const Abilities: {[k: string]: ModdedAbilityData} = {
}
},
onPrepareHit(source, target, move) {
if (this.effectState.protean === 1) return;
if (move.hasBounced || move.flags['futuremove'] || move.sourceEffect === 'snatch') return;
const type = move.type;
if (type && type !== '???' && source.getTypes().join() !== type) {
if (!source.setType(type)) return;
this.add('-start', source, 'typechange', type, '[from] ability: Confirmed Town');
}
this.effectState.protean = 1;
},
onResidual() {
this.effectState.protean = 0;
// copy pasted gen 8 protean does not play nice with their custom move
},
flags: {},
},
Expand Down
15 changes: 8 additions & 7 deletions data/mods/gen9ssb/moves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,24 @@ export const Moves: {[k: string]: ModdedMoveData} = {
onTryMove() {
this.attrLastMove('[still]');
},
onPrepareHit(target, source, m) {
onPrepareHit(target, source, move) {
const nresTypes = [];
for (const i of this.dex.types.names()) {
if (i === "Stellar") continue;
if (target) {
const effect = this.dex.getEffectiveness(i, target.types);
const immune = this.dex.getImmunity(i, target.types);
if (effect >= 0 && immune && i !== "Stellar") {
if (effect >= 0 && immune) {
nresTypes.push(i);
}
}
}
if (nresTypes.length <= 0) return;
if (!nresTypes.length) return;
const netType = this.sample(nresTypes);
const moves = this.dex.moves.all().filter(move => (
(![2, 4].includes(this.gen) || !source.moves.includes(move.id)) &&
(!move.isNonstandard || move.isNonstandard === 'Unobtainable') &&
move.flags['metronome'] && move.type === netType && move.category !== "Status"
const moves = this.dex.moves.all().filter(m => (
(![2, 4].includes(this.gen) || !source.moves.includes(m.id)) &&
(!m.isNonstandard || m.isNonstandard === 'Unobtainable') &&
m.flags['metronome'] && m.type === netType && m.category !== "Status"
));
let randomMove = '';
if (moves.length) {
Expand Down

0 comments on commit 31cfb1d

Please sign in to comment.