Update token logic, nerf revive tokens, and add Fusion Token

pull/16/head
Flashfyre 2024-03-11 00:16:24 -04:00
parent 9550016ebc
commit 4c5981c126
7 changed files with 5281 additions and 5205 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

View File

@ -8,7 +8,7 @@ import * as Utils from '../utils';
import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from '../data/type';
import { getLevelTotalExp } from '../data/exp';
import { Stat } from '../data/pokemon-stat';
import { AttackTypeBoosterModifier, DamageMoneyRewardModifier, EnemyDamageBoosterModifier, EnemyDamageReducerModifier, HiddenAbilityRateBoosterModifier, PokemonBaseStatModifier, PokemonHeldItemModifier, PokemonNatureWeightModifier, ShinyRateBoosterModifier, SurviveDamageModifier, TempBattleStatBoosterModifier, TerastallizeModifier } from '../modifier/modifier';
import { AttackTypeBoosterModifier, DamageMoneyRewardModifier, EnemyDamageBoosterModifier, EnemyDamageReducerModifier, EnemyFusionChanceModifier, HiddenAbilityRateBoosterModifier, PokemonBaseStatModifier, PokemonHeldItemModifier, PokemonNatureWeightModifier, ShinyRateBoosterModifier, SurviveDamageModifier, TempBattleStatBoosterModifier, TerastallizeModifier } from '../modifier/modifier';
import { PokeballType } from '../data/pokeball';
import { Gender } from '../data/gender';
import { initMoveAnim, loadMoveAnimAssets } from '../data/battle-anims';
@ -180,7 +180,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.metBiome = scene.currentBattle ? scene.arena.biomeType : -1;
this.pokerus = false;
if (scene.gameMode === GameMode.SPLICED_ENDLESS) {
const fused = new Utils.BooleanHolder(scene.gameMode === GameMode.SPLICED_ENDLESS);
if (!fused.value && !this.isPlayer() && !this.hasTrainer())
this.scene.applyModifier(EnemyFusionChanceModifier, false, fused);
if (fused.value) {
this.calculateStats();
this.generateFusionSpecies();
}
@ -2556,6 +2560,8 @@ export class PokemonSummonData {
export class PokemonBattleData {
public hitCount: integer = 0;
public revived: boolean = false;
public maxRevived: boolean = false;
}
export class PokemonBattleSummonData {

View File

@ -883,6 +883,7 @@ export const modifierTypes = {
ENEMY_STATUS_EFFECT_HEAL_CHANCE: () => new ModifierType('Full Heal Token', 'Adds a 10% chance every turn to heal a status condition', (type, _args) => new Modifiers.EnemyStatusEffectHealChanceModifier(type, 10), 'wl_full_heal'),
ENEMY_INSTANT_REVIVE_CHANCE: () => new EnemyInstantReviveChanceModifierType('Revive Token', 5, false, 'wl_revive'),
ENEMY_INSTANT_MAX_REVIVE_CHANCE: () => new EnemyInstantReviveChanceModifierType('Max Revive Token', 2, true, 'wl_max_revive'),
ENEMY_FUSED_CHANCE: () => new ModifierType('Fusion Token', 'Adds a 1% chance that a wild Pokémon will be a fusion', (type, _args) => new Modifiers.EnemyFusionChanceModifier(type, 1), 'wl_custom_spliced'),
};
const modifierPool = {
@ -1063,17 +1064,18 @@ const trainerModifierPool = {
const enemyBuffModifierPool = {
[ModifierTier.COMMON]: [
new WeightedModifierType(modifierTypes.ENEMY_DAMAGE_BOOSTER, 5),
new WeightedModifierType(modifierTypes.ENEMY_DAMAGE_REDUCTION, 5),
new WeightedModifierType(modifierTypes.ENEMY_HEAL, 5),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_POISON_CHANCE, 1),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_PARALYZE_CHANCE, 1),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_SLEEP_CHANCE, 1),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_FREEZE_CHANCE, 1),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_BURN_CHANCE, 1),
new WeightedModifierType(modifierTypes.ENEMY_STATUS_EFFECT_HEAL_CHANCE, 5),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_REVIVE_CHANCE, 5),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_MAX_REVIVE_CHANCE, 3)
new WeightedModifierType(modifierTypes.ENEMY_DAMAGE_BOOSTER, 10),
new WeightedModifierType(modifierTypes.ENEMY_DAMAGE_REDUCTION, 10),
new WeightedModifierType(modifierTypes.ENEMY_HEAL, 10),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_POISON_CHANCE, 2),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_PARALYZE_CHANCE, 2),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_SLEEP_CHANCE, 2),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_FREEZE_CHANCE, 2),
new WeightedModifierType(modifierTypes.ENEMY_ATTACK_BURN_CHANCE, 2),
new WeightedModifierType(modifierTypes.ENEMY_STATUS_EFFECT_HEAL_CHANCE, 10),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_REVIVE_CHANCE, 10),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_MAX_REVIVE_CHANCE, 6),
new WeightedModifierType(modifierTypes.ENEMY_FUSED_CHANCE, 1)
].map(m => { m.setTier(ModifierTier.COMMON); return m; }),
[ModifierTier.GREAT]: [
new WeightedModifierType(modifierTypes.ENEMY_DAMAGE_BOOSTER, 5),
@ -1081,7 +1083,8 @@ const enemyBuffModifierPool = {
new WeightedModifierType(modifierTypes.ENEMY_HEAL, 5),
new WeightedModifierType(modifierTypes.ENEMY_STATUS_EFFECT_HEAL_CHANCE, 5),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_REVIVE_CHANCE, 5),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_MAX_REVIVE_CHANCE, 3)
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_MAX_REVIVE_CHANCE, 3),
new WeightedModifierType(modifierTypes.ENEMY_FUSED_CHANCE, 1)
].map(m => { m.setTier(ModifierTier.GREAT); return m; }),
[ModifierTier.ULTRA]: [
new WeightedModifierType(modifierTypes.ENEMY_DAMAGE_BOOSTER, 5),
@ -1089,7 +1092,8 @@ const enemyBuffModifierPool = {
new WeightedModifierType(modifierTypes.ENEMY_HEAL, 5),
new WeightedModifierType(modifierTypes.ENEMY_STATUS_EFFECT_HEAL_CHANCE, 5),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_REVIVE_CHANCE, 5),
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_MAX_REVIVE_CHANCE, 3)
new WeightedModifierType(modifierTypes.ENEMY_INSTANT_MAX_REVIVE_CHANCE, 3),
new WeightedModifierType(modifierTypes.ENEMY_FUSED_CHANCE, 300)
].map(m => { m.setTier(ModifierTier.ULTRA); return m; }),
[ModifierTier.ROGUE]: [ ].map(m => { m.setTier(ModifierTier.ROGUE); return m; }),
[ModifierTier.MASTER]: [ ].map(m => { m.setTier(ModifierTier.MASTER); return m; })
@ -1232,7 +1236,7 @@ export function getPlayerShopModifierTypeOptionsForWave(waveIndex: integer, base
}
export function getEnemyBuffModifierForWave(tier: ModifierTier, enemyModifiers: Modifiers.PersistentModifier[], scene: BattleScene): Modifiers.EnemyPersistentModifier {
const tierStackCount = tier === ModifierTier.ULTRA ? 10 : tier === ModifierTier.GREAT ? 5 : 1;
const tierStackCount = tier === ModifierTier.ULTRA ? 5 : tier === ModifierTier.GREAT ? 3 : 1;
const retryCount = 50;
let candidate = getNewModifierTypeOption(null, ModifierPoolType.ENEMY_BUFF, tier);
let r = 0;

View File

@ -2005,3 +2005,38 @@ export class EnemyInstantReviveChanceModifier extends EnemyPersistentModifier {
return 10;
}
}
export class EnemyFusionChanceModifier extends EnemyPersistentModifier {
private chance: number;
constructor(type: ModifierType, chancePercent: number, stackCount?: integer) {
super(type, stackCount);
this.chance = chancePercent / 100;
}
match(modifier: Modifier) {
return modifier instanceof EnemyFusionChanceModifier && modifier.chance === this.chance;
}
clone() {
return new EnemyFusionChanceModifier(this.type, this.chance * 100, this.stackCount);
}
getArgs(): any[] {
return [ this.chance * 100 ];
}
apply(args: any[]): boolean {
if (Phaser.Math.RND.realInRange(0, 1) >= (this.chance * this.getStackCount()))
return false;
(args[0] as Utils.BooleanHolder).value = true;
return true;
}
getMaxStackCount(scene: BattleScene): integer {
return 10;
}
}

View File

@ -2650,11 +2650,17 @@ export class FaintPhase extends PokemonPhase {
if (!pokemon.isPlayer()) {
const enemyInstantReviveModifiers = this.scene.findModifiers(m => m instanceof EnemyInstantReviveChanceModifier, false);
for (let modifier of enemyInstantReviveModifiers) {
if (modifier.shouldApply([ pokemon ]) && modifier.apply([ pokemon ]))
const maxRevive = (modifier as EnemyInstantReviveChanceModifier).fullHeal;
const prop = maxRevive ? 'maxRevived' : 'revived';
if (pokemon.battleData[prop])
continue;
if (modifier.shouldApply([ pokemon ]) && modifier.apply([ pokemon ])) {
pokemon.battleData[prop] = true;
return this.end();
}
}
}
}
if (!this.tryOverrideForBattleSpec())
this.doFaint();
@ -3852,7 +3858,11 @@ export class AddEnemyBuffModifierPhase extends Phase {
const tier = !(waveIndex % 1000) ? ModifierTier.ULTRA : !(waveIndex % 250) ? ModifierTier.GREAT : ModifierTier.COMMON;
regenerateModifierPoolThresholds(this.scene.getEnemyParty(), ModifierPoolType.ENEMY_BUFF);
this.scene.addEnemyModifier(getEnemyBuffModifierForWave(tier, this.scene.findModifiers(m => m instanceof EnemyPersistentModifier, false), this.scene)).then(() => this.end());
const count = Math.ceil(waveIndex / 250);
for (let i = 0; i < count; i++)
this.scene.addEnemyModifier(getEnemyBuffModifierForWave(tier, this.scene.findModifiers(m => m instanceof EnemyPersistentModifier, false), this.scene), true, true);
this.scene.updateModifiers(false, true).then(() => this.end());
}
}