@@ -22,15 +22,25 @@ export function applySessionDataPatches(data: SessionSaveData) {
22
22
} else if ( m . className === "PokemonResetNegativeStatStageModifier" ) {
23
23
m . className = "ResetNegativeStatStageModifier" ;
24
24
} else if ( m . className === "TempBattleStatBoosterModifier" ) {
25
- m . className = "TempStatStageBoosterModifier" ;
26
- m . typeId = "TEMP_STAT_STAGE_BOOSTER" ;
25
+ // Dire Hit no longer a part of the TempBattleStatBoosterModifierTypeGenerator
26
+ if ( m . typeId !== "DIRE_HIT" ) {
27
+ m . className = "TempStatStageBoosterModifier" ;
28
+ m . typeId = "TEMP_STAT_STAGE_BOOSTER" ;
27
29
28
- // Migration from TempBattleStat to Stat
29
- const newStat = m . typePregenArgs [ 0 ] + 1 ;
30
- m . typePregenArgs [ 0 ] = newStat ;
30
+ // Migration from TempBattleStat to Stat
31
+ const newStat = m . typePregenArgs [ 0 ] + 1 ;
32
+ m . typePregenArgs [ 0 ] = newStat ;
33
+
34
+ // From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
35
+ m . args = [ newStat , 5 , m . args [ 1 ] ] ;
36
+ } else {
37
+ m . className = "TempCritBoosterModifier" ;
38
+ m . typePregenArgs = [ ] ;
39
+
40
+ // From [ stat, battlesLeft ] to [ maxBattles, battleCount ]
41
+ m . args = [ 5 , m . args [ 1 ] ] ;
42
+ }
31
43
32
- // From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
33
- m . args = [ newStat , 5 , m . args [ 1 ] ] ;
34
44
} else if ( m . className === "DoubleBattleChanceBoosterModifier" && m . args . length === 1 ) {
35
45
let maxBattles : number ;
36
46
switch ( m . typeId ) {
@@ -73,7 +83,7 @@ export function applySystemDataPatches(data: SystemSaveData) {
73
83
case "1.0.3" :
74
84
case "1.0.4" :
75
85
// --- LEGACY PATCHES ---
76
- if ( data . starterData ) {
86
+ if ( data . starterData && data . dexData ) {
77
87
// Migrate ability starter data if empty for caught species
78
88
Object . keys ( data . starterData ) . forEach ( sd => {
79
89
if ( data . dexData [ sd ] ?. caughtAttr && ( data . starterData [ sd ] && ! data . starterData [ sd ] . abilityAttr ) ) {
@@ -104,12 +114,14 @@ export function applySystemDataPatches(data: SystemSaveData) {
104
114
// --- PATCHES ---
105
115
106
116
// Fix Starter Data
107
- for ( const starterId of defaultStarterSpecies ) {
108
- if ( data . starterData [ starterId ] ?. abilityAttr ) {
109
- data . starterData [ starterId ] . abilityAttr |= AbilityAttr . ABILITY_1 ;
110
- }
111
- if ( data . dexData [ starterId ] ?. caughtAttr ) {
112
- data . dexData [ starterId ] . caughtAttr |= DexAttr . FEMALE ;
117
+ if ( data . starterData && data . dexData ) {
118
+ for ( const starterId of defaultStarterSpecies ) {
119
+ if ( data . starterData [ starterId ] ?. abilityAttr ) {
120
+ data . starterData [ starterId ] . abilityAttr |= AbilityAttr . ABILITY_1 ;
121
+ }
122
+ if ( data . dexData [ starterId ] ?. caughtAttr ) {
123
+ data . dexData [ starterId ] . caughtAttr |= DexAttr . FEMALE ;
124
+ }
113
125
}
114
126
}
115
127
}
0 commit comments