Add Focus Band item

This commit is contained in:
Flashfyre committed 2023-04-23 21:31:06 -04:00
1 parent e7c0c1abd4
commit c1e048e9af
6 files changed
+65 -14

No files matched your search

+5
View File
@@ -533,6 +533,9 @@ const modifierTypes = {
BERRY_POUCH: () => new ModifierType('BERRY POUCH', 'Adds a 25% chance that a used berry will not be consumed',
(type, _args) => new Modifiers.PreserveBerryModifier(type)),
FOCUS_BAND: () => new PokemonHeldItemModifierType('FOCUS BAND', 'Adds a 10% chance to survive with 1 HP after being damaged enough to faint',
(type, args) => new Modifiers.SurviveDamageModifier(type, (args[0] as Pokemon).id)),
LEFTOVERS: () => new PokemonHeldItemModifierType('LEFTOVERS', 'Heals 1/16 of a POKéMON\'s maximum HP every turn',
(type, args) => new Modifiers.TurnHealModifier(type, (args[0] as Pokemon).id)),
SHELL_BELL: () => new PokemonHeldItemModifierType('SHELL BELL', 'Heals 1/8 of a POKéMON\'s dealt damage',
@@ -613,6 +616,7 @@ const modifierPool = {
new WeightedModifierType(modifierTypes.CANDY_JAR, 3),
//new WeightedModifierType(modifierTypes.OVAL_CHARM, 1),
new WeightedModifierType(modifierTypes.HEALING_CHARM, 1),
new WeightedModifierType(modifierTypes.FOCUS_BAND, 3),
new WeightedModifierType(modifierTypes.LEFTOVERS, 2),
new WeightedModifierType(modifierTypes.SHELL_BELL, 2),
new WeightedModifierType(modifierTypes.BERRY_POUCH, 3),
@@ -641,6 +645,7 @@ const enemyModifierPool = {
].map(m => { m.setTier(ModifierTier.GREAT); return m; }),
[ModifierTier.ULTRA]: [
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 5),
new WeightedModifierType(modifierTypes.FOCUS_BAND, 2),
new WeightedModifierType(modifierTypes.LUCKY_EGG, 2),
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.MASTER]: [
+41 -2
View File
@@ -349,6 +349,41 @@ export class AttackTypeBoosterModifier extends PokemonHeldItemModifier {
}
}
export class SurviveDamageModifier extends PokemonHeldItemModifier {
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
super(type, pokemonId, stackCount);
}
matchType(modifier: Modifier) {
return modifier instanceof SurviveDamageModifier;
}
clone() {
return new SurviveDamageModifier(this.type, this.pokemonId, this.stackCount);
}
shouldApply(args: any[]): boolean {
return super.shouldApply(args) && args.length === 2 && args[1] instanceof Utils.BooleanHolder;
}
apply(args: any[]): boolean {
const pokemon = args[0] as Pokemon;
const surviveDamage = args[1] as Utils.BooleanHolder;
if (!surviveDamage.value && (this.getStackCount() === this.getMaxStackCount() || Utils.randInt(10) < this.getStackCount())) {
surviveDamage.value = true;
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` hung on\nusing its ${this.type.name}!`));
}
return true;
}
getMaxStackCount(): number {
return 5;
}
}
export class TurnHealModifier extends PokemonHeldItemModifier {
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
super(type, pokemonId, stackCount);
@@ -374,7 +409,7 @@ export class TurnHealModifier extends PokemonHeldItemModifier {
}
getMaxStackCount(): number {
return 16;
return 4;
}
}
@@ -403,7 +438,7 @@ export class HitHealModifier extends PokemonHeldItemModifier {
}
getMaxStackCount(): number {
return 16;
return 4;
}
}
@@ -733,6 +768,10 @@ export class HealingBoosterModifier extends PersistentModifier {
return true;
}
getMaxStackCount(): number {
return 4;
}
}
export class ExpBoosterModifier extends PersistentModifier {