[Bug] Thief Interaction with Species Stat Boosters (#2747)

This commit is contained in:
Amani H 2024-07-02 10:31:28 -04:00 committed by GitHub
parent df18dd885d
commit 6da5d9d6aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 9 deletions

View File

@ -45,7 +45,6 @@ type NewModifierFunc = (type: ModifierType, args: any[]) => Modifier;
export class ModifierType {
public id: string;
public generatorId: string;
public localeKey: string;
public iconImage: string;
public group: string;
@ -102,7 +101,7 @@ export class ModifierType {
if (!pool.hasOwnProperty(tier)) {
continue;
}
if (pool[tier].find(m => (m as WeightedModifierType).modifierType.id === (this.generatorId || this.id))) {
if (pool[tier].find(m => (m as WeightedModifierType).modifierType.id === this.id)) {
return (this.tier = tier);
}
}
@ -133,7 +132,6 @@ export class ModifierTypeGenerator extends ModifierType {
generateType(party: Pokemon[], pregenArgs?: any[]) {
const ret = this.genTypeFunc(party, pregenArgs);
if (ret) {
ret.generatorId = ret.id;
ret.id = this.id;
ret.setTier(this.tier);
}
@ -554,7 +552,7 @@ export class SpeciesStatBoosterModifierType extends PokemonHeldItemModifierType
const item = SpeciesStatBoosterModifierTypeGenerator.items[key];
super(`modifierType:SpeciesBoosterItem.${key}`, key.toLowerCase(), (type, args) => new Modifiers.SpeciesStatBoosterModifier(type, (args[0] as Pokemon).id, item.stats, item.multiplier, item.species));
this.id = this.key = key;
this.key = key;
}
getPregenArgs(): any[] {
@ -1742,7 +1740,7 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
let i = 0;
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);
const existingModifiers = party[0].scene.findModifiers(m => m.type.id === weightedModifierType.modifierType.id, poolType === ModifierPoolType.PLAYER);
const itemModifierType = weightedModifierType.modifierType instanceof ModifierTypeGenerator
? weightedModifierType.modifierType.generateType(party)
: weightedModifierType.modifierType;
@ -1755,7 +1753,7 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
: weightedModifierType.weight as integer
: 0;
if (weightedModifierType.maxWeight) {
const modifierId = weightedModifierType.modifierType.generatorId || weightedModifierType.modifierType.id;
const modifierId = weightedModifierType.modifierType.id;
tierModifierIds.push(modifierId);
const outputWeight = useMaxWeightForOutput ? weightedModifierType.maxWeight : weight;
modifierTableData[modifierId] = { weight: outputWeight, tier: parseInt(t), tierPercent: 0, totalPercent: 0 };

View File

@ -5,7 +5,6 @@ import { GeneratedPersistentModifierType, ModifierTypeGenerator, getModifierType
export default class ModifierData {
private player: boolean;
private typeId: string;
private typeGeneratorId: string;
private typePregenArgs: any[];
private args: any[];
private stackCount: integer;
@ -16,7 +15,6 @@ export default class ModifierData {
const sourceModifier = source instanceof PersistentModifier ? source as PersistentModifier : null;
this.player = player;
this.typeId = sourceModifier ? sourceModifier.type.id : source.typeId;
this.typeGeneratorId = sourceModifier ? sourceModifier.type.generatorId : source.typeGeneratorId;
if (sourceModifier) {
if ("getPregenArgs" in source.type) {
this.typePregenArgs = (source.type as GeneratedPersistentModifierType).getPregenArgs();
@ -38,7 +36,6 @@ export default class ModifierData {
try {
let type = typeFunc();
type.id = this.typeId;
type.generatorId = this.typeGeneratorId;
if (type instanceof ModifierTypeGenerator) {
type = (type as ModifierTypeGenerator).generateType(this.player ? scene.getParty() : scene.getEnemyField(), this.typePregenArgs);