BT15_095.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_095 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Use Option
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] Suspend 1 of your opponent's Digimon. Then, if you have a Tamer with [Izzy Izumi] in its name, until end of your opponent's turn, 1 of their Digimon gains \"[On Deletion] Trash the top card of your security stack.\"";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  29. }
  30. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  31. {
  32. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  33. {
  34. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: CanSelectPermanentCondition,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: maxCount,
  42. canNoSelect: false,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: null,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Tap,
  47. cardEffect: activateClass);
  48. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  49. }
  50. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer &&
  51. permanent.TopCard.ContainsCardName("Izzy Izumi")))
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. int maxCount = 1;
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: SelectPermanentCoroutine,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Custom,
  68. cardEffect: activateClass);
  69. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  72. {
  73. Permanent selectedPermanent = permanent;
  74. if (selectedPermanent != null)
  75. {
  76. CardSource _topCard = selectedPermanent.TopCard;
  77. ActivateClass activateClass1 = new ActivateClass();
  78. activateClass1.SetUpICardEffect("Trash the top card of your security", CanUseCondition1, selectedPermanent.TopCard);
  79. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  80. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  81. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  82. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  85. }
  86. string EffectDiscription1()
  87. {
  88. return "[On Deletion] Trash the top card of your security stack.";
  89. }
  90. bool CanUseCondition1(Hashtable hashtable1)
  91. {
  92. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  93. {
  94. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent, activateClass))
  95. {
  96. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  97. {
  98. return true;
  99. }
  100. }
  101. }
  102. return false;
  103. }
  104. bool CanActivateCondition1(Hashtable hashtable1)
  105. {
  106. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  107. {
  108. if (_topCard.Owner.SecurityCards.Count >= 1)
  109. {
  110. return true;
  111. }
  112. }
  113. return false;
  114. }
  115. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  118. player: _topCard.Owner,
  119. destroySecurityCount: 1,
  120. cardEffect: activateClass1,
  121. fromTop: true).DestroySecurity());
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129. #endregion
  130. if (timing == EffectTiming.SecuritySkill)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect($"Suspend 1 Digimon and add this card to hand", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  135. activateClass.SetIsSecurityEffect(true);
  136. cardEffects.Add(activateClass);
  137. string EffectDiscription()
  138. {
  139. return "[Security] Suspend 1 of your opponent's Digimon. Then, add this card to your hand.";
  140. }
  141. bool CanSelectPermanentCondition(Permanent permanent)
  142. {
  143. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  144. }
  145. bool CanUseCondition(Hashtable hashtable)
  146. {
  147. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  148. }
  149. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  150. {
  151. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  152. {
  153. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  154. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  155. selectPermanentEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectPermanentCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: null,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.Tap,
  166. cardEffect: activateClass);
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. }
  169. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  170. }
  171. }
  172. return cardEffects;
  173. }
  174. }
  175. }