mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-11 10:52:17 +02:00
stackcount instead of loop and both info about name and qty in the override
This commit is contained in:
parent
4538eebd79
commit
39001823e2
@ -2180,30 +2180,28 @@ export class EnemyFusionChanceModifier extends EnemyPersistentModifier {
|
||||
}
|
||||
|
||||
export function modifiersOverride(scene: Phaser.Scene, player: boolean = true): void {
|
||||
// if no override, do nothing
|
||||
const modifierOverride = player ? STARTING_MODIFIER_OVERRIDE : OPP_MODIFIER_OVERRIDE;
|
||||
const modifierQtyOverride = player ? STARTING_MODIFIER_QTY_OVERRIDE : OPP_MODIFIER_QTY_OVERRIDE;
|
||||
// if no override, do nothing
|
||||
if (!modifierOverride || modifierOverride.length === 0 || !scene) return;
|
||||
// if it's the opponent, we clear all his current modifiers to avoid stacking
|
||||
if (!player) {
|
||||
scene.enemyModifiers = [];
|
||||
}
|
||||
// we loop through all the modifier name given in the override file
|
||||
for (const [index, modifierName] of modifierOverride.entries()) {
|
||||
modifierOverride.forEach(item => {
|
||||
const modifierName = item[0];
|
||||
const qty = item[1] || 1;
|
||||
// if the modifier does not exist, we skip it
|
||||
if (!modifierTypes.hasOwnProperty(modifierName)) continue;
|
||||
if (!modifierTypes.hasOwnProperty(modifierName)) return;
|
||||
const modifierType = modifierTypes[modifierName]();
|
||||
// We get how many modifiers, if none given, default to 1
|
||||
const qty = modifierQtyOverride[index] || 1
|
||||
for (const i of [...Array(qty).keys()]) {
|
||||
// for example, if qty is 2, we create an array of size 2 with the modifier on each slot
|
||||
const modifier = modifierType.withIdFromFunc(modifierTypes[modifierName]).newModifier();
|
||||
if (player) {
|
||||
scene.addModifier(modifier as PersistentModifier, true, false, false, true);
|
||||
} else {
|
||||
scene.addEnemyModifier(modifier as PersistentModifier, true, true);
|
||||
}
|
||||
const modifier = modifierType.withIdFromFunc(modifierTypes[modifierName]).newModifier() as PersistentModifier;
|
||||
modifier.stackCount = qty;
|
||||
if (player) {
|
||||
scene.addModifier(modifier as PersistentModifier, true, false, false, true);
|
||||
} else {
|
||||
scene.addEnemyModifier(modifier as PersistentModifier, true, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function itemHeldsOverride(scene: Phaser.Scene, pokemon: Pokemon, player: boolean = true): void {
|
||||
@ -2211,9 +2209,11 @@ export function itemHeldsOverride(scene: Phaser.Scene, pokemon: Pokemon, player:
|
||||
// if no override, do nothing
|
||||
if (!heldItemsOverride || heldItemsOverride.length === 0 || !scene) return;
|
||||
// we loop through all the itemName given in the override file
|
||||
for (const itemName of heldItemsOverride) {
|
||||
heldItemsOverride.forEach(item => {
|
||||
const itemName = item[0];
|
||||
const qty = item[1] || 1;
|
||||
// if the item does not exist, we skip it
|
||||
if (!modifierTypes.hasOwnProperty(itemName)) continue;
|
||||
if (!modifierTypes.hasOwnProperty(itemName)) return;
|
||||
// we retrieve the item in the list
|
||||
const modifierType = modifierTypes[itemName]();
|
||||
// we create the item
|
||||
@ -2221,11 +2221,11 @@ export function itemHeldsOverride(scene: Phaser.Scene, pokemon: Pokemon, player:
|
||||
// we assign the created item to the pokemon
|
||||
itemModifier.pokemonId = pokemon.id;
|
||||
// we say how many items we want
|
||||
itemModifier.stackCount = 1;
|
||||
itemModifier.stackCount = qty;
|
||||
if (player) {
|
||||
scene.addModifier(itemModifier as PokemonHeldItemModifier, true, false, false, true);
|
||||
} else {
|
||||
scene.addEnemyModifier(itemModifier as PokemonHeldItemModifier, true, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
@ -11,11 +11,10 @@ export const STARTING_LEVEL_OVERRIDE = 0;
|
||||
export const STARTING_WAVE_OVERRIDE = 0;
|
||||
export const STARTING_BIOME_OVERRIDE = Biome.TOWN;
|
||||
export const STARTING_MONEY_OVERRIDE = 0;
|
||||
export const STARTING_MODIFIER_OVERRIDE = []; // ['EXP_SHARE', 'GOLDEN_EXP_CHARM']
|
||||
export const STARTING_MODIFIER_QTY_OVERRIDE = []; // [5, 10];
|
||||
export const STARTING_MODIFIER_OVERRIDE = []; // [['EXP_SHARE'], ['GOLDEN_EXP_CHARM', 10]]
|
||||
export const WEATHER_OVERRIDE = WeatherType.NONE;
|
||||
export const DOUBLE_BATTLE_OVERRIDE = false;
|
||||
export const STARTING_HELD_ITEMS_OVERRIDE = []; // ['REVIVER_SEED'];
|
||||
export const STARTING_HELD_ITEMS_OVERRIDE = []; // [['REVIVER_SEED'], ['LUCKY_EGG', 3]]
|
||||
|
||||
export const ABILITY_OVERRIDE = Abilities.NONE;
|
||||
export const PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
|
||||
@ -26,9 +25,8 @@ export const OPP_ABILITY_OVERRIDE = Abilities.NONE;
|
||||
export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
|
||||
export const OPP_MOVE_OVERRIDE = Moves.NONE;
|
||||
export const OPP_MOVE_OVERRIDE_2 = Moves.NONE;
|
||||
export const OPP_HELD_ITEMS_OVERRIDE = []; // ['LUCKY_EGG']
|
||||
export const OPP_MODIFIER_OVERRIDE = []; // ['ENEMY_DAMAGE_REDUCTION', 'ENEMY_ATTACK_POISON_CHANCE']
|
||||
export const OPP_MODIFIER_QTY_OVERRIDE = []; // [1, 1];
|
||||
export const OPP_HELD_ITEMS_OVERRIDE = []; // [['LUCKY_EGG', 2]]
|
||||
export const OPP_MODIFIER_OVERRIDE = []; // [['ENEMY_DAMAGE_REDUCTION'], ['ENEMY_ATTACK_POISON_CHANCE', 2]]
|
||||
|
||||
export const OPP_SHINY_OVERRIDE = false;
|
||||
export const OPP_VARIANT_OVERRIDE = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user