P_048.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class P_048 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Return cards from trash to unsuspend this Digimon and your 1 Tamer", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] You may place 3 non-Digi-Egg cards from your trash at the bottom of your deck in any order to unsuspend this Digimon and 1 of your Tamers.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return !cardSource.IsDigiEgg;
  26. }
  27. bool CanSelectPermanentCondition(Permanent permanent)
  28. {
  29. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  30. {
  31. if (permanent.IsTamer)
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 3)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. bool returned = false;
  56. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 3)
  57. {
  58. int maxCount = 3;
  59. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  60. selectCardEffect.SetUp(
  61. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. canNoSelect: () => true,
  65. selectCardCoroutine: null,
  66. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  67. message: "Select cards to place at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  68. maxCount: maxCount,
  69. canEndNotMax: false,
  70. isShowOpponent: false,
  71. mode: SelectCardEffect.Mode.Custom,
  72. root: SelectCardEffect.Root.Trash,
  73. customRootCardList: null,
  74. canLookReverseCard: true,
  75. selectPlayer: card.Owner,
  76. cardEffect: activateClass);
  77. selectCardEffect.SetNotShowCard();
  78. selectCardEffect.SetNotAddLog();
  79. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  80. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  81. {
  82. if (cardSources.Count == 3)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  85. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Cards", true, true));
  86. returned = true;
  87. }
  88. }
  89. }
  90. if (returned)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleArea(card))
  93. {
  94. Permanent selectedPermanent = card.PermanentOfThisCard();
  95. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  96. }
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: null,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.UnTap,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. }
  113. }
  114. }
  115. if (timing == EffectTiming.OnReturnCardsToLibraryFromTrash)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  120. activateClass.SetHashString("Memory_P_048");
  121. cardEffects.Add(activateClass);
  122. string EffectDiscription()
  123. {
  124. return "[Your Turn][Once Per Turn] When a card is returned from your trash to your deck, gain 1 memory.";
  125. }
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  129. {
  130. if (CardEffectCommons.IsOwnerTurn(card))
  131. {
  132. if (CardEffectCommons.CanTriggerWhenOwnerCardsReturnToLibraryFromTrash(hashtable, null, card))
  133. {
  134. return true;
  135. }
  136. }
  137. }
  138. return false;
  139. }
  140. bool CanActivateCondition(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  143. {
  144. return true;
  145. }
  146. return false;
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  151. }
  152. }
  153. return cardEffects;
  154. }
  155. }