11using DiskCardGame ;
22using HarmonyLib ;
3+ using InscryptionAPI . Card ;
34using System . Collections ;
45using UnityEngine ;
56
@@ -16,11 +17,13 @@ private static bool FixGemsDraw(GemsDraw __instance, ref IEnumerator __result)
1617 return false ;
1718 }
1819
19- private static IEnumerator BetterGemsDraw ( GemsDraw __instance )
20+ public static IEnumerator BetterGemsDraw ( GemsDraw __instance )
2021 {
2122 yield return __instance . PreSuccessfulTriggerSequence ( ) ;
22- int numGems = Singleton < BoardManager > . Instance . PlayerSlotsCopy . FindAll (
23- x => x . Card != null && x . Card . Info . HasTrait ( Trait . Gem ) ) . Count ;
23+ Singleton < ViewManager > . Instance . SwitchToView ( SaveManager . SaveFile . IsMagnificus ? View . WizardBattleSlots : View . Default ) ;
24+ yield return new WaitForSeconds ( 0.1f ) ;
25+
26+ int numGems = Singleton < BoardManager > . Instance . PlayerSlotsCopy . Count ( x => x . Card != null && x . Card . HasTrait ( Trait . Gem ) ) ;
2427
2528 if ( numGems == 0 )
2629 {
@@ -29,18 +32,16 @@ private static IEnumerator BetterGemsDraw(GemsDraw __instance)
2932 yield return new WaitForSeconds ( 0.45f ) ;
3033 yield break ;
3134 }
32-
33- Singleton < ViewManager > . Instance . SwitchToView ( SaveManager . SaveFile . IsPart2 ? View . WizardBattleSlots : View . Hand ) ;
34- yield return new WaitForSeconds ( 0.1f ) ;
35+
3536 for ( int i = 0 ; i < numGems ; i ++ )
3637 {
37- if ( SaveManager . SaveFile . IsPart2 )
38- yield return Singleton < CardDrawPiles > . Instance . DrawCardFromDeck ( ) ;
39- else
40- {
38+ if ( Singleton < CardDrawPiles3D > . Instance != null && Singleton < CardDrawPiles3D > . Instance . Pile != null ) {
4139 Singleton < CardDrawPiles3D > . Instance . Pile . Draw ( ) ;
4240 yield return Singleton < CardDrawPiles3D > . Instance . DrawCardFromDeck ( ) ;
4341 }
42+ else
43+ yield return Singleton < CardDrawPiles > . Instance . DrawCardFromDeck ( ) ;
44+
4445 }
4546 yield return __instance . LearnAbility ( 0.5f ) ;
4647 }
0 commit comments