[Bug] Fix Dire Hit & System Data Conversion Failure (#4282)
Co-authored-by: xsn34kzx <xsn34kzx@gmail.com>
This commit is contained in:
parent
801b0a66f7
commit
7ea608fb8a
|
@ -22,15 +22,25 @@ export function applySessionDataPatches(data: SessionSaveData) {
|
||||||
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
||||||
m.className = "ResetNegativeStatStageModifier";
|
m.className = "ResetNegativeStatStageModifier";
|
||||||
} else if (m.className === "TempBattleStatBoosterModifier") {
|
} else if (m.className === "TempBattleStatBoosterModifier") {
|
||||||
m.className = "TempStatStageBoosterModifier";
|
// Dire Hit no longer a part of the TempBattleStatBoosterModifierTypeGenerator
|
||||||
m.typeId = "TEMP_STAT_STAGE_BOOSTER";
|
if (m.typeId !== "DIRE_HIT") {
|
||||||
|
m.className = "TempStatStageBoosterModifier";
|
||||||
|
m.typeId = "TEMP_STAT_STAGE_BOOSTER";
|
||||||
|
|
||||||
// Migration from TempBattleStat to Stat
|
// Migration from TempBattleStat to Stat
|
||||||
const newStat = m.typePregenArgs[0] + 1;
|
const newStat = m.typePregenArgs[0] + 1;
|
||||||
m.typePregenArgs[0] = newStat;
|
m.typePregenArgs[0] = newStat;
|
||||||
|
|
||||||
|
// From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
|
||||||
|
m.args = [ newStat, 5, m.args[1] ];
|
||||||
|
} else {
|
||||||
|
m.className = "TempCritBoosterModifier";
|
||||||
|
m.typePregenArgs = [];
|
||||||
|
|
||||||
|
// From [ stat, battlesLeft ] to [ maxBattles, battleCount ]
|
||||||
|
m.args = [ 5, m.args[1] ];
|
||||||
|
}
|
||||||
|
|
||||||
// From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
|
|
||||||
m.args = [ newStat, 5, m.args[1] ];
|
|
||||||
} else if (m.className === "DoubleBattleChanceBoosterModifier" && m.args.length === 1) {
|
} else if (m.className === "DoubleBattleChanceBoosterModifier" && m.args.length === 1) {
|
||||||
let maxBattles: number;
|
let maxBattles: number;
|
||||||
switch (m.typeId) {
|
switch (m.typeId) {
|
||||||
|
@ -73,7 +83,7 @@ export function applySystemDataPatches(data: SystemSaveData) {
|
||||||
case "1.0.3":
|
case "1.0.3":
|
||||||
case "1.0.4":
|
case "1.0.4":
|
||||||
// --- LEGACY PATCHES ---
|
// --- LEGACY PATCHES ---
|
||||||
if (data.starterData) {
|
if (data.starterData && data.dexData) {
|
||||||
// Migrate ability starter data if empty for caught species
|
// Migrate ability starter data if empty for caught species
|
||||||
Object.keys(data.starterData).forEach(sd => {
|
Object.keys(data.starterData).forEach(sd => {
|
||||||
if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) {
|
if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) {
|
||||||
|
@ -104,12 +114,14 @@ export function applySystemDataPatches(data: SystemSaveData) {
|
||||||
// --- PATCHES ---
|
// --- PATCHES ---
|
||||||
|
|
||||||
// Fix Starter Data
|
// Fix Starter Data
|
||||||
for (const starterId of defaultStarterSpecies) {
|
if (data.starterData && data.dexData) {
|
||||||
if (data.starterData[starterId]?.abilityAttr) {
|
for (const starterId of defaultStarterSpecies) {
|
||||||
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
if (data.starterData[starterId]?.abilityAttr) {
|
||||||
}
|
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
||||||
if (data.dexData[starterId]?.caughtAttr) {
|
}
|
||||||
data.dexData[starterId].caughtAttr |= DexAttr.FEMALE;
|
if (data.dexData[starterId]?.caughtAttr) {
|
||||||
|
data.dexData[starterId].caughtAttr |= DexAttr.FEMALE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue