@@ -6,10 +6,16 @@ namespace APIPlugin
66{
77 public partial class Plugin
88 {
9+ private static bool cardsLoaded = false ;
10+
11+ public static bool CardsLoaded { get => cardsLoaded ; set => cardsLoaded = value ; }
12+
13+ private static bool abilitiesLoaded = false ;
14+
15+ public static bool AbilitiesLoaded { get => abilitiesLoaded ; set => abilitiesLoaded = value ; }
16+
917 private void SetAbilityIdentifiers ( )
1018 {
11- ImportCustomAbilities ( ) ;
12-
1319 Log . LogDebug ( $ "Number of ability IDs to set from NewCard.abilityIds: [{ NewCard . abilityIds . Count } ]") ;
1420 foreach ( var item in NewCard . abilityIds )
1521 {
@@ -49,54 +55,6 @@ private void SetAbilityIdentifiers()
4955 }
5056 }
5157 }
52-
53- ImportCustomCards ( ) ;
54- }
55-
56- private static void ImportCustomAbilities ( )
57- {
58- Plugin . Log . LogDebug ( $ "Starting pre-emptive data load for AbilityInfo before adding custom abilities...") ;
59- List < AbilityInfo > officialAbilityInfo = ScriptableObjectLoader < AbilityInfo > . AllData ;
60-
61- foreach ( NewAbility newAbility in NewAbility . abilities )
62- {
63- officialAbilityInfo . Add ( newAbility . info ) ;
64- Plugin . Log . LogDebug ( $ "Official ability list now contains [{ newAbility . info . rulebookName } ]!") ;
65- }
66-
67- ScriptableObjectLoader < AbilityInfo > . allData = officialAbilityInfo ;
68- Plugin . Log . LogInfo ( $ "Loaded { NewAbility . abilities . Count } custom abilities into data! " +
69- $ "Total of [{ ScriptableObjectLoader < AbilityInfo > . allData . Count } ]") ;
70- }
71-
72- private static void ImportCustomCards ( )
73- {
74- Plugin . Log . LogDebug ( $ "Starting pre-emptive data load for CardInfo before adding modified and new cards...") ;
75- List < CardInfo > officialCardInfo = ScriptableObjectLoader < CardInfo > . AllData ;
76- Plugin . Log . LogDebug ( $ "CustomCards count [{ CustomCard . cards . Count } ] NewCard.cards count [{ NewCard . cards . Count } ]") ;
77- foreach ( CustomCard card in CustomCard . cards )
78- {
79- int index = officialCardInfo . FindIndex ( ( CardInfo x ) => x . name == card . name ) ;
80- if ( index == - 1 )
81- {
82- Plugin . Log . LogWarning ( $ "Could not find card { card . name } to modify") ;
83- }
84- else
85- {
86- officialCardInfo [ index ] = card . AdjustCard ( officialCardInfo [ index ] ) ;
87- Plugin . Log . LogInfo ( $ "Loaded modified [{ card . name } ] into data") ;
88- }
89- }
90-
91- ScriptableObjectLoader < CardInfo > . allData = officialCardInfo . Concat (
92- NewCard . cards . Select ( cardInfo =>
93- {
94- Log . LogInfo ( $ "Loaded custom card to card pool: [{ cardInfo . name } ]") ;
95- return cardInfo ;
96- }
97- )
98- ) . ToList ( ) ;
99- Plugin . Log . LogInfo ( $ "Loaded { NewCard . cards . Count } custom cards into data") ;
10058 }
10159
10260 private void SetSpecialAbilityIdentifiers ( )
0 commit comments