Skip to content

Commit

Permalink
Simplify effect.exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarel authored Oct 29, 2024
1 parent 97d0282 commit 5a23223
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sim/dex-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ export abstract class BasicEffect implements EffectData {
this.id = data.realMove ? toID(data.realMove) : toID(this.name); // Hidden Power hack
this.fullname = Utils.getString(data.fullname) || this.name;
this.effectType = Utils.getString(data.effectType) as EffectType || 'Condition';
const exists = Object.prototype.propertyIsEnumerable.call(data, 'exists') ? data.exists : true;
this.exists = !!(exists && this.id);
this.exists = data.exists ?? !!this.id;
this.num = data.num || 0;
this.gen = data.gen || 0;
this.shortDesc = data.shortDesc || '';
Expand Down Expand Up @@ -270,8 +269,7 @@ export class TypeInfo implements Readonly<TypeData> {
this.name = data.name;
this.id = data.id;
this.effectType = Utils.getString(data.effectType) as TypeInfoEffectType || 'Type';
const exists = Object.prototype.propertyIsEnumerable.call(data, 'exists') ? data.exists : true;
this.exists = !!(exists && this.id);
this.exists = data.exists ?? !!this.id;
this.gen = data.gen || 0;
this.isNonstandard = data.isNonstandard || null;
this.damageTaken = data.damageTaken || {};
Expand Down

0 comments on commit 5a23223

Please sign in to comment.