Add Grip Claw item and fix evolution logic bug
This commit is contained in:
1 parent
f33ee493bd
commit
d53959e0a9
5 files changed
+100
-35
No files matched your search
@@ -492,9 +492,15 @@ class EvolutionItemModifierTypeGenerator extends ModifierTypeGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
class HeldItemTransferModifierType extends PokemonHeldItemModifierType {
|
||||
export class ContactHeldItemTransferChanceModifierType extends PokemonHeldItemModifierType {
|
||||
constructor(name: string, chancePercent: integer, iconImage?: string, group?: string, soundName?: string) {
|
||||
super(name, `On contact, there is a ${chancePercent}% chance the foe's held item will be stolen`, (type, args) => new Modifiers.ContactHeldItemTransferChanceModifier(type, (args[0] as Pokemon).id, chancePercent), iconImage, group, soundName);
|
||||
}
|
||||
}
|
||||
|
||||
export class TurnHeldItemTransferModifierType extends PokemonHeldItemModifierType {
|
||||
constructor(name: string, iconImage?: string, group?: string, soundName?: string) {
|
||||
super(name, 'Every turn, the holder acquires one held item from the foe POKéMON', (type, args) => new Modifiers.HeldItemTransferModifier(type, (args[0] as Pokemon).id), iconImage, group, soundName);
|
||||
super(name, 'Every turn, the holder acquires one held item from the foe', (type, args) => new Modifiers.TurnHeldItemTransferModifier(type, (args[0] as Pokemon).id), iconImage, group, soundName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,6 +604,8 @@ const modifierTypes = {
|
||||
LUCKY_EGG: () => new PokemonExpBoosterModifierType('LUCKY EGG', 50),
|
||||
GOLDEN_EGG: () => new PokemonExpBoosterModifierType('GOLDEN EGG', 200),
|
||||
|
||||
GRIP_CLAW: () => new ContactHeldItemTransferChanceModifierType('GRIP CLAW', 10),
|
||||
|
||||
HEALING_CHARM: () => new ModifierType('HEALING CHARM', 'Doubles the effectiveness of HP restoring moves and items (excludes revives)',
|
||||
(type, _args) => new Modifiers.HealingBoosterModifier(type, 2), 'healing_charm'),
|
||||
CANDY_JAR: () => new ModifierType('CANDY JAR', 'Increases the number of levels added by RARE CANDY items by 1', (type, _args) => new Modifiers.LevelIncrementBoosterModifier(type)),
|
||||
@@ -621,7 +629,7 @@ const modifierTypes = {
|
||||
|
||||
SHINY_CHARM: () => new ModifierType('SHINY CHARM', 'Dramatically increases the chance of a wild POKéMON being shiny', (type, _args) => new Modifiers.ShinyRateBoosterModifier(type)),
|
||||
|
||||
MINI_BLACK_HOLE: () => new HeldItemTransferModifierType('MINI BLACK HOLE'),
|
||||
MINI_BLACK_HOLE: () => new TurnHeldItemTransferModifierType('MINI BLACK HOLE'),
|
||||
|
||||
GOLDEN_POKEBALL: () => new ModifierType(`GOLDEN ${getPokeballName(PokeballType.POKEBALL)}`, 'Adds 1 extra item option at the end of every battle',
|
||||
(type, _args) => new Modifiers.ExtraModifierModifier(type), 'pb_gold', null, 'pb_bounce_1'),
|
||||
@@ -697,6 +705,7 @@ const modifierPool = {
|
||||
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 4),
|
||||
new WeightedModifierType(modifierTypes.TM_ULTRA, 5),
|
||||
new WeightedModifierType(modifierTypes.CANDY_JAR, 3),
|
||||
new WeightedModifierType(modifierTypes.GRIP_CLAW, 2),
|
||||
new WeightedModifierType(modifierTypes.HEALING_CHARM, 1),
|
||||
new WeightedModifierType(modifierTypes.BATON, 1),
|
||||
new WeightedModifierType(modifierTypes.FOCUS_BAND, 3),
|
||||
|
||||
+78
-18
@@ -255,7 +255,7 @@ export class MapModifier extends PersistentModifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxStackCount(): number {
|
||||
getmaxStackCount(): integer {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -426,7 +426,7 @@ export class SurviveDamageModifier extends PokemonHeldItemModifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxStackCount(): number {
|
||||
getmaxStackCount(): integer {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
@@ -457,7 +457,7 @@ export class FlinchChanceModifier extends PokemonHeldItemModifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxStackCount(): number {
|
||||
getmaxStackCount(): integer {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
@@ -486,7 +486,7 @@ export class TurnHealModifier extends PokemonHeldItemModifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxStackCount(): number {
|
||||
getmaxStackCount(): integer {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
@@ -515,7 +515,7 @@ export class HitHealModifier extends PokemonHeldItemModifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxStackCount(): number {
|
||||
getmaxStackCount(): integer {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
@@ -609,7 +609,7 @@ export class PreserveBerryModifier extends PersistentModifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxStackCount(): number {
|
||||
getmaxStackCount(): integer {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
@@ -832,7 +832,7 @@ export class HealingBoosterModifier extends PersistentModifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
getMaxStackCount(): number {
|
||||
getmaxStackCount(): integer {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
@@ -994,30 +994,26 @@ export class SwitchEffectTransferModifier extends PokemonHeldItemModifier {
|
||||
}
|
||||
}
|
||||
|
||||
export class HeldItemTransferModifier extends PokemonHeldItemModifier {
|
||||
export abstract class HeldItemTransferModifier extends PokemonHeldItemModifier {
|
||||
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
|
||||
super(type, pokemonId, stackCount);
|
||||
}
|
||||
|
||||
matchType(modifier: Modifier): boolean {
|
||||
return modifier instanceof HeldItemTransferModifier;
|
||||
}
|
||||
|
||||
clone(): HeldItemTransferModifier {
|
||||
return new HeldItemTransferModifier(this.type, this.pokemonId, this.stackCount);
|
||||
}
|
||||
|
||||
apply(args: any[]): boolean {
|
||||
const pokemon = args[0] as Pokemon;
|
||||
const targetPokemon = pokemon.getOpponent();
|
||||
if (!targetPokemon)
|
||||
return false;
|
||||
|
||||
const transferredItemCount = this.getTransferredItemCount();
|
||||
if (!transferredItemCount)
|
||||
return false;
|
||||
|
||||
const transferredModifierTypes: ModifierTypes.ModifierType[] = [];
|
||||
const itemModifiers = pokemon.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
&& (m as PokemonHeldItemModifier).pokemonId === targetPokemon.id && !m.matchType(this), targetPokemon.isPlayer()) as PokemonHeldItemModifier[];
|
||||
|
||||
for (let i = 0; i < this.getStackCount(); i++) {
|
||||
for (let i = 0; i < transferredItemCount; i++) {
|
||||
if (!itemModifiers.length)
|
||||
break;
|
||||
const randItemIndex = Utils.randInt(itemModifiers.length);
|
||||
@@ -1029,10 +1025,74 @@ export class HeldItemTransferModifier extends PokemonHeldItemModifier {
|
||||
}
|
||||
|
||||
for (let mt of transferredModifierTypes)
|
||||
pokemon.scene.queueMessage(getPokemonMessage(targetPokemon, `'s ${mt.name} was absorbed\nby ${pokemon.name}'s MINI BLACK HOLE!`));
|
||||
pokemon.scene.queueMessage(this.getTransferMessage(pokemon, targetPokemon, mt));
|
||||
|
||||
return !!transferredModifierTypes.length;
|
||||
}
|
||||
|
||||
abstract getTransferredItemCount(): integer
|
||||
|
||||
abstract getTransferMessage(pokemon: Pokemon, targetPokemon: Pokemon, item: ModifierTypes.ModifierType): string
|
||||
}
|
||||
|
||||
export class TurnHeldItemTransferModifier extends HeldItemTransferModifier {
|
||||
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
|
||||
super(type, pokemonId, stackCount);
|
||||
}
|
||||
|
||||
matchType(modifier: Modifier): boolean {
|
||||
return modifier instanceof TurnHeldItemTransferModifier;
|
||||
}
|
||||
|
||||
clone(): TurnHeldItemTransferModifier {
|
||||
return new TurnHeldItemTransferModifier(this.type, this.pokemonId, this.stackCount);
|
||||
}
|
||||
|
||||
getTransferredItemCount(): integer {
|
||||
return this.getStackCount();
|
||||
}
|
||||
|
||||
getTransferMessage(pokemon: Pokemon, targetPokemon: Pokemon, item: ModifierTypes.ModifierType): string {
|
||||
return getPokemonMessage(targetPokemon, `'s ${item.name} was absorbed\nby ${pokemon.name}'s ${this.type.name}!`);
|
||||
}
|
||||
|
||||
getMaxStackCount(): integer {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
export class ContactHeldItemTransferChanceModifier extends HeldItemTransferModifier {
|
||||
private chance: number;
|
||||
|
||||
constructor(type: ModifierType, pokemonId: integer, chancePercent: integer, stackCount?: integer) {
|
||||
super(type, pokemonId, stackCount);
|
||||
|
||||
this.chance = chancePercent / 100;
|
||||
}
|
||||
|
||||
matchType(modifier: Modifier): boolean {
|
||||
return modifier instanceof ContactHeldItemTransferChanceModifier;
|
||||
}
|
||||
|
||||
clone(): ContactHeldItemTransferChanceModifier {
|
||||
return new ContactHeldItemTransferChanceModifier(this.type, this.pokemonId, this.chance * 100, this.stackCount);
|
||||
}
|
||||
|
||||
getArgs(): any[] {
|
||||
return super.getArgs().concat(this.chance * 100);
|
||||
}
|
||||
|
||||
getTransferredItemCount(): integer {
|
||||
return Math.random() < (this.chance * this.getStackCount()) ? 1 : 0;
|
||||
}
|
||||
|
||||
getTransferMessage(pokemon: Pokemon, targetPokemon: Pokemon, item: ModifierTypes.ModifierType): string {
|
||||
return getPokemonMessage(targetPokemon, `'s ${item.name} was snatched\nby ${pokemon.name}'s ${this.type.name}!`);
|
||||
}
|
||||
|
||||
getmaxStackCount(): integer {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtraModifierModifier extends PersistentModifier {
|
||||
|
||||
Reference in new issue
Block a user