77using Il2Cpp ;
88using Il2CppInterop . Runtime ;
99
10- [ assembly: MelonInfo ( typeof ( DifficultyScaling . ModMain ) , "AI Limit Difficulty Scaling" , "1.2.1 " , "CyrixJD115" ) ]
10+ [ assembly: MelonInfo ( typeof ( DifficultyScaling . ModMain ) , "AI Limit Difficulty Scaling" , "1.2.2 " , "CyrixJD115" ) ]
1111[ assembly: MelonGame ( "SenseGames" , "AILIMIT" ) ]
1212
1313namespace DifficultyScaling ;
@@ -20,6 +20,7 @@ public class ModMain : MelonMod
2020 private static float _playerDefMult = 2.0f ;
2121 private static float _monsterDefMult = 0.4f ;
2222 private static float _crystalMult = 1.0f ;
23+ private static float _fallDeathHeightMult = 1.0f ;
2324 private static bool _debug = false ;
2425 private static bool _crystalScaled = false ;
2526
@@ -69,10 +70,11 @@ public override void OnInitializeMelon()
6970 _playerDefMult = TomlConfig . GetFloat ( cfg , "player_defense_multiplier" , 2.0f ) ;
7071 _monsterDefMult = TomlConfig . GetFloat ( cfg , "monster_defense_multiplier" , 0.4f ) ;
7172 _crystalMult = TomlConfig . GetFloat ( cfg , "crystal_multiplier" , 1.0f ) ;
73+ _fallDeathHeightMult = TomlConfig . GetFloat ( cfg , "fall_death_height_multiplier" , _playerHpMult ) ;
7274 _debug = TomlConfig . GetBool ( cfg , "debug" , false ) ;
7375
7476 MelonLogger . Msg ( $ "{ LOG } Loaded preset: { Path . GetFileName ( matchedDir ) } ") ;
75- MelonLogger . Msg ( $ "{ LOG } PlayerAtk x{ _playerAttackMult } | MonsterAtk x{ _monsterAttackMult } | PlayerDef x{ _playerDefMult } | MonsterDef x{ _monsterDefMult } | PlayerHP x{ _playerHpMult } | Crystal x{ _crystalMult } ") ;
77+ MelonLogger . Msg ( $ "{ LOG } PlayerAtk x{ _playerAttackMult } | MonsterAtk x{ _monsterAttackMult } | PlayerDef x{ _playerDefMult } | MonsterDef x{ _monsterDefMult } | PlayerHP x{ _playerHpMult } | Crystal x{ _crystalMult } | FallHeight x { _fallDeathHeightMult } ") ;
7678 }
7779
7880 public override void OnLateInitializeMelon ( )
@@ -90,10 +92,14 @@ public override void OnLateInitializeMelon()
9092 typeof ( ModMain ) . GetMethod ( nameof ( MonsterDecreaseHpPrefix ) , BindingFlags . Static | BindingFlags . NonPublic ) , null ) ,
9193 ( "Player.GetHpMaxAttribute" , playerType . GetMethod ( "GetHpMaxAttribute" , BindingFlags . Public | BindingFlags . Instance | BindingFlags . DeclaredOnly , null , Type . EmptyTypes , null ) ,
9294 null , typeof ( ModMain ) . GetMethod ( nameof ( GetHpMaxPostfix ) , BindingFlags . Static | BindingFlags . NonPublic ) ) ,
95+ ( "Player.GetHPMax" , playerType . GetMethod ( "GetHPMax" , BindingFlags . Public | BindingFlags . Instance | BindingFlags . DeclaredOnly , null , Type . EmptyTypes , null ) ,
96+ null , typeof ( ModMain ) . GetMethod ( nameof ( GetHpMaxPostfix ) , BindingFlags . Static | BindingFlags . NonPublic ) ) ,
9397 ( "Player.GetDefenseInfo" , playerType . GetMethod ( "GetDefenseInfo" , new Type [ ] { typeof ( bool ) } ) ,
9498 null , typeof ( ModMain ) . GetMethod ( nameof ( PlayerGetDefenseInfoPostfix ) , BindingFlags . Static | BindingFlags . NonPublic ) ) ,
9599 ( "Monster.GetDefenseInfo" , monsterType . GetMethod ( "GetDefenseInfo" , new Type [ ] { typeof ( bool ) } ) ,
96100 null , typeof ( ModMain ) . GetMethod ( nameof ( MonsterGetDefenseInfoPostfix ) , BindingFlags . Static | BindingFlags . NonPublic ) ) ,
101+ ( "PlayerDefine.GetDeadHigh" , typeof ( PlayerDefine ) . GetMethod ( "get_GetDeadHigh" , BindingFlags . Public | BindingFlags . Static , null , Type . EmptyTypes , null ) ,
102+ null , typeof ( ModMain ) . GetMethod ( nameof ( GetDeadHighPostfix ) , BindingFlags . Static | BindingFlags . NonPublic ) ) ,
97103 } ;
98104
99105 int patched = 0 ;
@@ -145,8 +151,13 @@ public override void OnUpdate()
145151 }
146152 }
147153
148- private static void PlayerDecreaseHpPrefix ( ref float value )
154+ private static void PlayerDecreaseHpPrefix ( ref float value , ActorDefine . DeadType deadType )
149155 {
156+ if ( deadType == ActorDefine . DeadType . FallDead || deadType == ActorDefine . DeadType . TouchGroundDead )
157+ {
158+ if ( _debug ) MelonLogger . Msg ( $ "{ DBG } Player DMG { value } SKIP (deadType={ deadType } )") ;
159+ return ;
160+ }
150161 if ( _debug ) MelonLogger . Msg ( $ "{ DBG } Player DMG { value } \u2192 { value * _monsterAttackMult } (x{ _monsterAttackMult } )") ;
151162 value *= _monsterAttackMult ;
152163 }
@@ -163,6 +174,12 @@ private static void GetHpMaxPostfix(ref float __result)
163174 __result *= _playerHpMult ;
164175 }
165176
177+ private static void GetDeadHighPostfix ( ref float __result )
178+ {
179+ if ( _debug ) MelonLogger . Msg ( $ "{ DBG } FallDeadHigh { __result } \u2192 { __result * _fallDeathHeightMult } (x{ _fallDeathHeightMult } )") ;
180+ __result *= _fallDeathHeightMult ;
181+ }
182+
166183 private static void PlayerGetDefenseInfoPostfix ( ref DefenseInfo __result )
167184 {
168185 __result . nPhysicsDamageReductionRate *= _playerDefMult ;
@@ -172,8 +189,6 @@ private static void PlayerGetDefenseInfoPostfix(ref DefenseInfo __result)
172189 __result . nPoisonsDamageReductionRate *= _playerDefMult ;
173190 __result . nPunctureDamageReductionRate *= _playerDefMult ;
174191 __result . nInfectDamageReductionRate *= _playerDefMult ;
175- __result . nGetHitConfidenceReductionRate *= _playerDefMult ;
176- __result . MaxHp *= _playerDefMult ;
177192 if ( _debug ) MelonLogger . Msg ( $ "{ DBG } Player Def scaled x{ _playerDefMult } ") ;
178193 }
179194
@@ -186,8 +201,6 @@ private static void MonsterGetDefenseInfoPostfix(ref DefenseInfo __result)
186201 __result . nPoisonsDamageReductionRate *= _monsterDefMult ;
187202 __result . nPunctureDamageReductionRate *= _monsterDefMult ;
188203 __result . nInfectDamageReductionRate *= _monsterDefMult ;
189- __result . nGetHitConfidenceReductionRate *= _monsterDefMult ;
190- __result . MaxHp *= _monsterDefMult ;
191204 if ( _debug ) MelonLogger . Msg ( $ "{ DBG } Monster Def scaled x{ _monsterDefMult } ") ;
192205 }
193206}
0 commit comments