[Refactor] Change attack type booster names to enum (#4725)
This commit is contained in:
parent
3241332a3c
commit
13377806ff
|
@ -502,45 +502,25 @@ export class BerryModifierType extends PokemonHeldItemModifierType implements Ge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAttackTypeBoosterItemName(type: Type) {
|
enum AttackTypeBoosterItem {
|
||||||
switch (type) {
|
SILK_SCARF,
|
||||||
case Type.NORMAL:
|
BLACK_BELT,
|
||||||
return "Silk Scarf";
|
SHARP_BEAK,
|
||||||
case Type.FIGHTING:
|
POISON_BARB,
|
||||||
return "Black Belt";
|
SOFT_SAND,
|
||||||
case Type.FLYING:
|
HARD_STONE,
|
||||||
return "Sharp Beak";
|
SILVER_POWDER,
|
||||||
case Type.POISON:
|
SPELL_TAG,
|
||||||
return "Poison Barb";
|
METAL_COAT,
|
||||||
case Type.GROUND:
|
CHARCOAL,
|
||||||
return "Soft Sand";
|
MYSTIC_WATER,
|
||||||
case Type.ROCK:
|
MIRACLE_SEED,
|
||||||
return "Hard Stone";
|
MAGNET,
|
||||||
case Type.BUG:
|
TWISTED_SPOON,
|
||||||
return "Silver Powder";
|
NEVER_MELT_ICE,
|
||||||
case Type.GHOST:
|
DRAGON_FANG,
|
||||||
return "Spell Tag";
|
BLACK_GLASSES,
|
||||||
case Type.STEEL:
|
FAIRY_FEATHER
|
||||||
return "Metal Coat";
|
|
||||||
case Type.FIRE:
|
|
||||||
return "Charcoal";
|
|
||||||
case Type.WATER:
|
|
||||||
return "Mystic Water";
|
|
||||||
case Type.GRASS:
|
|
||||||
return "Miracle Seed";
|
|
||||||
case Type.ELECTRIC:
|
|
||||||
return "Magnet";
|
|
||||||
case Type.PSYCHIC:
|
|
||||||
return "Twisted Spoon";
|
|
||||||
case Type.ICE:
|
|
||||||
return "Never-Melt Ice";
|
|
||||||
case Type.DRAGON:
|
|
||||||
return "Dragon Fang";
|
|
||||||
case Type.DARK:
|
|
||||||
return "Black Glasses";
|
|
||||||
case Type.FAIRY:
|
|
||||||
return "Fairy Feather";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
||||||
|
@ -548,7 +528,7 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
|
||||||
public boostPercent: integer;
|
public boostPercent: integer;
|
||||||
|
|
||||||
constructor(moveType: Type, boostPercent: integer) {
|
constructor(moveType: Type, boostPercent: integer) {
|
||||||
super("", `${getAttackTypeBoosterItemName(moveType)?.replace(/[ \-]/g, "_").toLowerCase()}`,
|
super("", `${AttackTypeBoosterItem[moveType]?.toLowerCase()}`,
|
||||||
(_type, args) => new AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent));
|
(_type, args) => new AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent));
|
||||||
|
|
||||||
this.moveType = moveType;
|
this.moveType = moveType;
|
||||||
|
@ -556,7 +536,7 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return i18next.t(`modifierType:AttackTypeBoosterItem.${getAttackTypeBoosterItemName(this.moveType)?.replace(/[ \-]/g, "_").toLowerCase()}`);
|
return i18next.t(`modifierType:AttackTypeBoosterItem.${AttackTypeBoosterItem[this.moveType]?.toLowerCase()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDescription(scene: BattleScene): string {
|
getDescription(scene: BattleScene): string {
|
||||||
|
|
Loading…
Reference in New Issue