Implemented Repels

pull/544/head
Sophie Kujo 2024-05-06 04:37:48 -04:00
parent 6011794732
commit a3b3691084
5 changed files with 174 additions and 164 deletions

View File

@ -1,2 +1,2 @@
VITE_BYPASS_LOGIN=1
VITE_BYPASS_TUTORIAL=0
VITE_BYPASS_TUTORIAL=1

38
package-lock.json generated
View File

@ -2565,33 +2565,6 @@
"integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
"dev": true
},
"node_modules/happy-dom": {
"version": "14.3.9",
"resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-14.3.9.tgz",
"integrity": "sha512-0kPQchwthekcYpYN8CvCiq+/z5bqFYDLbTxZ+yDLwT8AFRVJDFadShHRxp3VAZRy7a5isOZ1j/LzsU1dtAIZMQ==",
"dev": true,
"optional": true,
"peer": true,
"dependencies": {
"entities": "^4.5.0",
"webidl-conversions": "^7.0.0",
"whatwg-mimetype": "^3.0.0"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/happy-dom/node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"dev": true,
"optional": true,
"peer": true,
"engines": {
"node": ">=12"
}
},
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@ -5802,17 +5775,6 @@
"node": ">=0.10.0"
}
},
"node_modules/whatwg-mimetype": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz",
"integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==",
"dev": true,
"optional": true,
"peer": true,
"engines": {
"node": ">=12"
}
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",

View File

@ -4,7 +4,7 @@ import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePh
import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon';
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies, speciesStarters } from './data/pokemon-species';
import * as Utils from './utils';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier } from './modifier/modifier';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier, DoubleBattleChancePreventerModifier } from './modifier/modifier';
import { PokeballType } from './data/pokeball';
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims';
import { Phase } from './phase';
@ -251,8 +251,8 @@ export default class BattleScene extends SceneBase {
const scene = this;
const originalRealInRange = Phaser.Math.RND.realInRange;
Phaser.Math.RND.realInRange = function (min: number, max: number): number {
const ret = originalRealInRange.apply(this, [ min, max ]);
const args = [ 'RNG', ++scene.rngCounter, ret / (max - min), `min: ${min} / max: ${max}` ];
const ret = originalRealInRange.apply(this, [min, max]);
const args = ['RNG', ++scene.rngCounter, ret / (max - min), `min: ${min} / max: ${max}`];
args.push(`seed: ${scene.rngSeedOverride || scene.waveSeed || scene.seed}`);
if (scene.rngOffset)
args.push(`offset: ${scene.rngOffset}`);
@ -295,7 +295,7 @@ export default class BattleScene extends SceneBase {
this.arenaBg = this.add.sprite(0, 0, 'plains_bg');
this.arenaBgTransition = this.add.sprite(0, 0, 'plains_bg');
[ this.arenaBgTransition, this.arenaBg ].forEach(a => {
[this.arenaBgTransition, this.arenaBg].forEach(a => {
a.setPipeline(this.fieldSpritePipeline);
a.setScale(6);
a.setOrigin(0);
@ -427,7 +427,7 @@ export default class BattleScene extends SceneBase {
this.arenaPlayerTransition.setVisible(false);
this.arenaNextEnemy.setVisible(false);
[ this.arenaPlayer, this.arenaPlayerTransition, this.arenaEnemy, this.arenaNextEnemy ].forEach(a => {
[this.arenaPlayer, this.arenaPlayerTransition, this.arenaEnemy, this.arenaNextEnemy].forEach(a => {
if (a instanceof Phaser.GameObjects.Sprite)
a.setOrigin(0, 0);
field.add(a);
@ -466,12 +466,12 @@ export default class BattleScene extends SceneBase {
ui.setup();
const defaultMoves = [ Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE ];
const defaultMoves = [Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE];
Promise.all([
Promise.all(loadPokemonAssets),
initCommonAnims(this).then(() => loadCommonAnimAssets(this, true)),
Promise.all([ Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE ].map(m => initMoveAnim(this, m))).then(() => loadMoveAnimAssets(this, defaultMoves, true)),
Promise.all([Moves.TACKLE, Moves.TAIL_WHIP, Moves.FOCUS_ENERGY, Moves.STRUGGLE].map(m => initMoveAnim(this, m))).then(() => loadMoveAnimAssets(this, defaultMoves, true)),
this.initStarterColors()
]).then(() => {
this.pushPhase(new LoginPhase(this));
@ -529,14 +529,14 @@ export default class BattleScene extends SceneBase {
variantTree = variantTree[k];
expTree = expTree[k];
} else if (variantTree.hasOwnProperty(k) && expTree.hasOwnProperty(k)) {
if ([ 'back', 'female' ].includes(k))
if (['back', 'female'].includes(k))
traverseVariantData(keys.concat(k));
else
variantTree[k] = expTree[k];
}
});
};
Object.keys(expVariantData).forEach(ek => traverseVariantData([ ek ]));
Object.keys(expVariantData).forEach(ek => traverseVariantData([ek]));
}
Promise.resolve();
});
@ -796,7 +796,7 @@ export default class BattleScene extends SceneBase {
this.lockModifierTiers = false;
this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ]));
this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [t, 0]));
this.pokeballCounts[PokeballType.POKEBALL] += 5;
this.modifiers = [];
@ -821,14 +821,14 @@ export default class BattleScene extends SceneBase {
this.updateScoreText();
this.scoreText.setVisible(false);
[ this.luckLabelText, this.luckText ].map(t => t.setVisible(false));
[this.luckLabelText, this.luckText].map(t => t.setVisible(false));
this.newArena(STARTING_BIOME_OVERRIDE || Biome.TOWN);
this.arenaBgTransition.setPosition(0, 0);
this.arenaPlayer.setPosition(300, 0);
this.arenaPlayerTransition.setPosition(0, 0);
[ this.arenaEnemy, this.arenaNextEnemy ].forEach(a => a.setPosition(-280, 0));
[this.arenaEnemy, this.arenaNextEnemy].forEach(a => a.setPosition(-280, 0));
this.arenaNextEnemy.setVisible(false);
this.arena.init();
@ -854,7 +854,7 @@ export default class BattleScene extends SceneBase {
this.fadeOutBgm(250, false);
this.tweens.add({
targets: [ this.uiContainer ],
targets: [this.uiContainer],
alpha: 0,
duration: 250,
ease: 'Sine.easeInOut',
@ -870,6 +870,9 @@ export default class BattleScene extends SceneBase {
}
newBattle(waveIndex?: integer, battleType?: BattleType, trainerData?: TrainerData, double?: boolean): Battle {
if (this.getModifiers(DoubleBattleChancePreventerModifier) != null) {
double = false;
}
let newWaveIndex = waveIndex || ((this.currentBattle?.waveIndex || (startingWave - 1)) + 1);
let newDouble: boolean;
let newBattleType: BattleType;
@ -1070,7 +1073,7 @@ export default class BattleScene extends SceneBase {
case Species.OINKOLOGNE:
return gender === Gender.FEMALE ? 1 : 0;
case Species.TOXTRICITY:
const lowkeyNatures = [ Nature.LONELY, Nature.BOLD, Nature.RELAXED, Nature.TIMID, Nature.SERIOUS, Nature.MODEST, Nature.MILD, Nature.QUIET, Nature.BASHFUL, Nature.CALM, Nature.GENTLE, Nature.CAREFUL ];
const lowkeyNatures = [Nature.LONELY, Nature.BOLD, Nature.RELAXED, Nature.TIMID, Nature.SERIOUS, Nature.MODEST, Nature.MILD, Nature.QUIET, Nature.BASHFUL, Nature.CALM, Nature.GENTLE, Nature.CAREFUL];
if (nature !== undefined && lowkeyNatures.indexOf(nature) > -1)
return 1;
return 0;
@ -1160,7 +1163,7 @@ export default class BattleScene extends SceneBase {
resetSeed(waveIndex?: integer): void {
const wave = waveIndex || this.currentBattle?.waveIndex || 0;
this.waveSeed = Utils.shiftCharCodes(this.seed, wave);
Phaser.Math.RND.sow([ this.waveSeed ]);
Phaser.Math.RND.sow([this.waveSeed]);
console.log('Wave Seed:', this.waveSeed, wave);
this.rngCounter = 0;
}
@ -1172,7 +1175,7 @@ export default class BattleScene extends SceneBase {
const tempRngOffset = this.rngOffset;
const tempRngSeedOverride = this.rngSeedOverride;
const state = Phaser.Math.RND.state();
Phaser.Math.RND.sow([ Utils.shiftCharCodes(seedOverride || this.seed, offset) ]);
Phaser.Math.RND.sow([Utils.shiftCharCodes(seedOverride || this.seed, offset)]);
this.rngCounter = 0;
this.rngOffset = offset;
this.rngSeedOverride = seedOverride || '';
@ -1199,7 +1202,7 @@ export default class BattleScene extends SceneBase {
}
initPokemonSprite(sprite: Phaser.GameObjects.Sprite, pokemon?: Pokemon, hasShadow: boolean = false, ignoreOverride: boolean = false): Phaser.GameObjects.Sprite {
sprite.setPipeline(this.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: hasShadow, ignoreOverride: ignoreOverride, teraColor: pokemon ? getTypeRgb(pokemon.getTeraType()) : undefined });
sprite.setPipeline(this.spritePipeline, { tone: [0.0, 0.0, 0.0, 0.0], hasShadow: hasShadow, ignoreOverride: ignoreOverride, teraColor: pokemon ? getTypeRgb(pokemon.getTeraType()) : undefined });
this.spriteSparkleHandler.add(sprite);
return sprite;
}
@ -1247,7 +1250,7 @@ export default class BattleScene extends SceneBase {
}
updateAndShowLuckText(duration: integer): void {
const labels = [ this.luckLabelText, this.luckText ];
const labels = [this.luckLabelText, this.luckText];
labels.map(t => {
t.setAlpha(0);
t.setVisible(true);
@ -1267,7 +1270,7 @@ export default class BattleScene extends SceneBase {
}
hideLuckText(duration: integer): void {
const labels = [ this.luckLabelText, this.luckText ];
const labels = [this.luckLabelText, this.luckText];
this.tweens.add({
targets: labels,
duration: duration,
@ -1283,7 +1286,7 @@ export default class BattleScene extends SceneBase {
this.waveCountText.setY(-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0));
this.moneyText.setY(this.waveCountText.y + 10);
this.scoreText.setY(this.moneyText.y + 10);
[ this.luckLabelText, this.luckText ].map(l => l.setY((this.scoreText.visible ? this.scoreText : this.moneyText).y + 10));
[this.luckLabelText, this.luckText].map(l => l.setY((this.scoreText.visible ? this.scoreText : this.moneyText).y + 10));
const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15;
this.partyExpBar.setY(offsetY);
this.candyBar.setY(offsetY + 15);
@ -1368,7 +1371,7 @@ export default class BattleScene extends SceneBase {
} else if (this.buttonJustPressed(Button.ACTION) || this.repeatInputDurationJustPassed(Button.ACTION)) {
inputSuccess = this.ui.processInput(Button.ACTION);
this.setLastProcessedMovementTime(Button.ACTION);
} else if (this.buttonJustPressed(Button.CANCEL)|| this.repeatInputDurationJustPassed(Button.CANCEL)) {
} else if (this.buttonJustPressed(Button.CANCEL) || this.repeatInputDurationJustPassed(Button.CANCEL)) {
inputSuccess = this.ui.processInput(Button.CANCEL);
this.setLastProcessedMovementTime(Button.CANCEL);
} else if (this.buttonJustPressed(Button.MENU)) {
@ -1838,7 +1841,7 @@ export default class BattleScene extends SceneBase {
modifiersToRemove.push(...(this.findModifiers(m => m instanceof TerastallizeModifier && m.pokemonId === modifier.pokemonId)));
if ((modifier as PersistentModifier).add(this.modifiers, !!virtual, this)) {
if (modifier instanceof PokemonFormChangeItemModifier || modifier instanceof TerastallizeModifier)
success = modifier.apply([ this.getPokemonById(modifier.pokemonId), true ]);
success = modifier.apply([this.getPokemonById(modifier.pokemonId), true]);
if (playSound && !this.sound.get(soundName))
this.playSound(soundName);
} else if (!virtual) {
@ -1860,7 +1863,7 @@ export default class BattleScene extends SceneBase {
for (let p in this.party) {
const pokemon = this.party[p];
const args: any[] = [ pokemon ];
const args: any[] = [pokemon];
if (modifier instanceof PokemonHpRestoreModifier) {
if (!(modifier as PokemonHpRestoreModifier).fainted) {
const hpRestoreMultiplier = new Utils.IntegerHolder(1);
@ -1882,7 +1885,7 @@ export default class BattleScene extends SceneBase {
return Promise.allSettled([this.party.map(p => p.updateInfo(instant)), ...modifierPromises]).then(() => resolve(success));
} else {
const args = [ this ];
const args = [this];
if (modifier.shouldApply(args)) {
const result = modifier.apply(args);
if (result instanceof Promise) {
@ -1904,7 +1907,7 @@ export default class BattleScene extends SceneBase {
modifiersToRemove.push(...(this.findModifiers(m => m instanceof TerastallizeModifier && m.pokemonId === modifier.pokemonId, false)));
if ((modifier as PersistentModifier).add(this.enemyModifiers, false, this)) {
if (modifier instanceof PokemonFormChangeItemModifier || modifier instanceof TerastallizeModifier)
modifier.apply([ this.getPokemonById(modifier.pokemonId), true ]);
modifier.apply([this.getPokemonById(modifier.pokemonId), true]);
for (let rm of modifiersToRemove)
this.removeModifier(rm, true);
}
@ -2006,7 +2009,7 @@ export default class BattleScene extends SceneBase {
}
if (isBoss)
count = Math.max(count, Math.floor(chances / 2));
getEnemyModifierTypesForWave(difficultyWaveIndex, count, [ enemyPokemon ], this.currentBattle.battleType === BattleType.TRAINER ? ModifierPoolType.TRAINER : ModifierPoolType.WILD, upgradeChance)
getEnemyModifierTypesForWave(difficultyWaveIndex, count, [enemyPokemon], this.currentBattle.battleType === BattleType.TRAINER ? ModifierPoolType.TRAINER : ModifierPoolType.WILD, upgradeChance)
.map(mt => mt.newModifier(enemyPokemon).add(this.enemyModifiers, false, this));
});
@ -2022,7 +2025,7 @@ export default class BattleScene extends SceneBase {
}
setModifiersVisible(visible: boolean) {
[ this.modifierBar, this.enemyModifierBar ].map(m => m.setVisible(visible));
[this.modifierBar, this.enemyModifierBar].map(m => m.setVisible(visible));
}
updateModifiers(player?: boolean, instant?: boolean): Promise<void> {
@ -2071,7 +2074,7 @@ export default class BattleScene extends SceneBase {
if (modifierIndex > -1) {
modifiers.splice(modifierIndex, 1);
if (modifier instanceof PokemonFormChangeItemModifier || modifier instanceof TerastallizeModifier)
modifier.apply([ this.getPokemonById(modifier.pokemonId), false ]);
modifier.apply([this.getPokemonById(modifier.pokemonId), false]);
return true;
}

View File

@ -73,16 +73,16 @@ export class ModifierType {
let poolTypes: ModifierPoolType[];
switch (poolType) {
case ModifierPoolType.PLAYER:
poolTypes = [ poolType, ModifierPoolType.TRAINER, ModifierPoolType.WILD ];
poolTypes = [poolType, ModifierPoolType.TRAINER, ModifierPoolType.WILD];
break;
case ModifierPoolType.WILD:
poolTypes = [ poolType, ModifierPoolType.PLAYER, ModifierPoolType.TRAINER ];
poolTypes = [poolType, ModifierPoolType.PLAYER, ModifierPoolType.TRAINER];
break;
case ModifierPoolType.TRAINER:
poolTypes = [ poolType, ModifierPoolType.PLAYER, ModifierPoolType.WILD ];
poolTypes = [poolType, ModifierPoolType.PLAYER, ModifierPoolType.WILD];
break;
default:
poolTypes = [ poolType ];
poolTypes = [poolType];
break;
}
// Try multiple pool types in case of stolen items
@ -304,7 +304,7 @@ export class PokemonNatureChangeModifierType extends PokemonModifierType {
if (pokemon.getNature() === this.nature)
return PartyUiHandler.NoEffectMessage;
return null;
}), `mint_${Utils.getEnumKeys(Stat).find(s => getNatureStatMultiplier(nature, Stat[s]) > 1)?.toLowerCase() || 'neutral' }`, 'mint');
}), `mint_${Utils.getEnumKeys(Stat).find(s => getNatureStatMultiplier(nature, Stat[s]) > 1)?.toLowerCase() || 'neutral'}`, 'mint');
this.nature = nature;
}
@ -332,6 +332,17 @@ export class DoubleBattleChanceBoosterModifierType extends ModifierType {
}
}
export class DoubleBattleChancePreventerModifierType extends ModifierType {
public battleCount: integer;
constructor(name: string, battleCount: integer) {
super(name, `Prevents the chance of an encounter being a double battle for ${battleCount} battles`, (_type, _args) => new Modifiers.DoubleBattleChancePreventerModifier(this, this.battleCount),
null, 'repel');
this.battleCount = battleCount;
}
}
export class TempBattleStatBoosterModifierType extends ModifierType implements GeneratedPersistentModifierType {
public tempBattleStat: TempBattleStat;
@ -345,7 +356,7 @@ export class TempBattleStatBoosterModifierType extends ModifierType implements G
}
getPregenArgs(): any[] {
return [ this.tempBattleStat ];
return [this.tempBattleStat];
}
}
@ -361,7 +372,7 @@ export class BerryModifierType extends PokemonHeldItemModifierType implements Ge
}
getPregenArgs(): any[] {
return [ this.berryType ];
return [this.berryType];
}
}
@ -420,7 +431,7 @@ export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType i
}
getPregenArgs(): any[] {
return [ this.moveType ];
return [this.moveType];
}
}
@ -464,7 +475,7 @@ export class PokemonBaseStatBoosterModifierType extends PokemonHeldItemModifierT
}
getPregenArgs(): any[] {
return [ this.stat ];
return [this.stat];
}
}
@ -509,7 +520,7 @@ export class PokemonExpBoosterModifierType extends PokemonHeldItemModifierType {
export class PokemonFriendshipBoosterModifierType extends PokemonHeldItemModifierType {
constructor(name: string, iconImage?: string) {
super(name,'Increases friendship gain per victory by 50%', (_type, args) => new Modifiers.PokemonFriendshipBoosterModifier(this, (args[0] as Pokemon).id), iconImage);
super(name, 'Increases friendship gain per victory by 50%', (_type, args) => new Modifiers.PokemonFriendshipBoosterModifier(this, (args[0] as Pokemon).id), iconImage);
}
}
@ -560,7 +571,7 @@ export class EvolutionItemModifierType extends PokemonModifierType implements Ge
}
getPregenArgs(): any[] {
return [ this.evolutionItem ];
return [this.evolutionItem];
}
}
@ -581,7 +592,7 @@ export class FormChangeItemModifierType extends PokemonModifierType implements G
}
getPregenArgs(): any[] {
return [ this.formChangeItem ];
return [this.formChangeItem];
}
}
@ -711,7 +722,7 @@ export class TerastallizeModifierType extends PokemonHeldItemModifierType implem
}
getPregenArgs(): any[] {
return [ this.teraType ];
return [this.teraType];
}
}
@ -804,9 +815,9 @@ export const modifierTypes = {
PP_UP: () => new PokemonPpUpModifierType('PP Up', 1),
PP_MAX: () => new PokemonPpUpModifierType('PP Max', 3),
/*REPEL: () => new DoubleBattleChanceBoosterModifierType('Repel', 5),
SUPER_REPEL: () => new DoubleBattleChanceBoosterModifierType('Super Repel', 10),
MAX_REPEL: () => new DoubleBattleChanceBoosterModifierType('Max Repel', 25),*/
REPEL: () => new DoubleBattleChancePreventerModifierType('Repel', 5),
SUPER_REPEL: () => new DoubleBattleChancePreventerModifierType('Super Repel', 10),
MAX_REPEL: () => new DoubleBattleChancePreventerModifierType('Max Repel', 25),
LURE: () => new DoubleBattleChanceBoosterModifierType('Lure', 5),
SUPER_LURE: () => new DoubleBattleChanceBoosterModifierType('Super Lure', 10),
@ -983,7 +994,14 @@ const modifierPool: ModifierPool = {
const thresholdPartyMemberCount = Math.min(party.filter(p => p.hp && p.getMoveset().filter(m => (m.getMove().pp - m.ppUsed) <= 5).length).length, 3);
return thresholdPartyMemberCount;
}, 3),
new WeightedModifierType(modifierTypes.LURE, 2),
new WeightedModifierType(modifierTypes.REPEL, (party: Pokemon[]) => {
const existingItem = party[0].scene.findModifier(m => m.type instanceof DoubleBattleChancePreventerModifierType || m.type instanceof DoubleBattleChanceBoosterModifierType);
return existingItem ? 0 : 2;
}),
new WeightedModifierType(modifierTypes.LURE, (party: Pokemon[]) => {
const existingItem = party[0].scene.findModifier(m => m.type instanceof DoubleBattleChancePreventerModifierType || m.type instanceof DoubleBattleChanceBoosterModifierType);
return existingItem ? 0 : 2;
}),
new WeightedModifierType(modifierTypes.TEMP_STAT_BOOSTER, 4),
new WeightedModifierType(modifierTypes.BERRY, 2),
new WeightedModifierType(modifierTypes.TM_COMMON, 1),
@ -1169,8 +1187,8 @@ const enemyBuffModifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.ENEMY_ENDURE_CHANCE, 5),
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; })
[ModifierTier.ROGUE]: [].map(m => { m.setTier(ModifierTier.ROGUE); return m; }),
[ModifierTier.MASTER]: [].map(m => { m.setTier(ModifierTier.MASTER); return m; })
};
const dailyStarterModifierPool: ModifierPool = {
@ -1240,7 +1258,7 @@ export function getModifierPoolForType(poolType: ModifierPoolType): ModifierPool
return pool;
}
const tierWeights = [ 769 / 1024, 192 / 1024, 48 / 1024, 12 / 1024, 1 / 1024 ];
const tierWeights = [769 / 1024, 192 / 1024, 48 / 1024, 12 / 1024, 1 / 1024];
export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType, rerollCount: integer = 0) {
const pool = getModifierPoolForType(poolType);
@ -1256,6 +1274,7 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
pool[t].reduce((total: integer, modifierType: WeightedModifierType) => {
const weightedModifierType = modifierType as WeightedModifierType;
const existingModifiers = party[0].scene.findModifiers(m => (m.type.generatorId || m.type.id) === weightedModifierType.modifierType.id, poolType === ModifierPoolType.PLAYER);
existingModifiers.forEach(m => console.log(m.type.name))
const itemModifierType = weightedModifierType.modifierType instanceof ModifierTypeGenerator
? weightedModifierType.modifierType.generateType(party)
: weightedModifierType.modifierType;
@ -1285,7 +1304,7 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
}, 0);
for (let id of tierModifierIds)
modifierTableData[id].tierPercent = Math.floor((modifierTableData[id].weight / tierMaxWeight) * 10000) / 100;
return [ t, Object.fromEntries(thresholds) ];
return [t, Object.fromEntries(thresholds)];
})));
for (let id of Object.keys(modifierTableData)) {
modifierTableData[id].totalPercent = Math.floor(modifierTableData[id].tierPercent * tierWeights[modifierTableData[id].tier] * 100) / 100;
@ -1523,7 +1542,7 @@ export function getPartyLuckValue(party: Pokemon[]): integer {
}
export function getLuckString(luckValue: integer): string {
return [ 'D', 'C', 'C+', 'B-', 'B', 'B+', 'A-', 'A', 'A+', 'A++', 'S', 'S+', 'SS', 'SS+', 'SSS' ][luckValue];
return ['D', 'C', 'C+', 'B-', 'B', 'B+', 'A-', 'A', 'A+', 'A++', 'S', 'S+', 'SS', 'SS+', 'SSS'][luckValue];
}
export function getLuckTextTint(luckValue: integer): integer {

View File

@ -310,6 +310,32 @@ export class DoubleBattleChanceBoosterModifier extends LapsingPersistentModifier
}
}
export class DoubleBattleChancePreventerModifier extends LapsingPersistentModifier {
constructor(type: ModifierTypes.DoubleBattleChancePreventerModifierType, battlesLeft: integer, stackCount?: integer) {
super(type, battlesLeft, stackCount);
}
match(modifier: Modifier): boolean {
if (modifier instanceof DoubleBattleChancePreventerModifier)
return (modifier as DoubleBattleChancePreventerModifier).battlesLeft === this.battlesLeft;
return false;
}
clone(): DoubleBattleChancePreventerModifier {
return new DoubleBattleChancePreventerModifier(this.type as ModifierTypes.DoubleBattleChancePreventerModifierType, this.battlesLeft, this.stackCount);
}
getArgs(): any[] {
return [ this.battlesLeft ];
}
apply(args: any[]): boolean {
const doubleBattleChance = args[0] as Utils.NumberHolder;
doubleBattleChance.value = 0;
return true;
}
}
export class TempBattleStatBoosterModifier extends LapsingPersistentModifier {
private tempBattleStat: TempBattleStat;