11using System . Collections . ObjectModel ;
22using System . Diagnostics . CodeAnalysis ;
3+ using System . Runtime . CompilerServices ;
34using DiskCardGame ;
45using HarmonyLib ;
56using UnityEngine ;
@@ -21,8 +22,8 @@ public class FullAbility
2122 public readonly static ReadOnlyCollection < FullAbility > BaseGameAbilities = new ( GenBaseGameAbilityList ( ) ) ;
2223 private readonly static ObservableCollection < FullAbility > NewAbilities = new ( ) ;
2324
24- public static List < FullAbility > AllAbilities { get ; private set ; }
25- public static List < AbilityInfo > AllAbilityInfos { get ; private set ; }
25+ public static List < FullAbility > AllAbilities { get ; private set ; } = BaseGameAbilities . ToList ( ) ;
26+ public static List < AbilityInfo > AllAbilityInfos { get ; private set ; } = BaseGameAbilities . Select ( x => x . Info ) . ToList ( ) ;
2627
2728 private static int _abilityCounter = ( int ) Ability . NUM_ABILITIES ;
2829
@@ -47,7 +48,7 @@ private static List<FullAbility> GenBaseGameAbilityList()
4748 Id = ability . ability ,
4849 Info = ability ,
4950 AbilityBehavior = gameAsm . GetType ( $ "DiskCardGame.{ name } ") ,
50- Texture = AbilitiesUtil . LoadAbilityIcon ( name )
51+ Texture = OriginalLoadAbilityIcon ( name )
5152 } ) ;
5253 }
5354 return baseGame ;
@@ -69,7 +70,7 @@ public static FullAbility Add(AbilityInfo info, Type behavior, Texture tex)
6970
7071 public static void Remove ( Ability id ) => NewAbilities . Remove ( NewAbilities . FirstOrDefault ( x => x . Id == id ) ) ;
7172 public static void Remove ( FullAbility ability ) => NewAbilities . Remove ( ability ) ;
72-
73+
7374 [ HarmonyPrefix ]
7475 [ HarmonyPatch ( typeof ( ScriptableObjectLoader < UnityObject > ) , nameof ( ScriptableObjectLoader < UnityObject > . LoadData ) ) ]
7576 [ SuppressMessage ( "Member Access" , "Publicizer001" , Justification = "Need to set internal list of abilities" ) ]
@@ -78,6 +79,11 @@ private static void AbilityLoadPrefix()
7879 ScriptableObjectLoader < AbilityInfo > . allData = AllAbilityInfos ;
7980 }
8081
82+ [ HarmonyReversePatch ( HarmonyReversePatchType . Original ) ]
83+ [ HarmonyPatch ( typeof ( AbilitiesUtil ) , nameof ( AbilitiesUtil . LoadAbilityIcon ) ) ]
84+ [ MethodImpl ( MethodImplOptions . NoInlining ) ]
85+ private static Texture OriginalLoadAbilityIcon ( string abilityName , bool fillerAbility = false , bool something = false ) { throw new NotImplementedException ( ) ; }
86+
8187 [ HarmonyPrefix ]
8288 [ HarmonyPatch ( typeof ( AbilitiesUtil ) , nameof ( AbilitiesUtil . LoadAbilityIcon ) ) ]
8389 private static bool LoadAbilityIconReplacement ( string abilityName , ref Texture __result )
0 commit comments