EX11_055.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Chitose Horaiji
  4. namespace DCGO.CardEffects.EX11
  5. {
  6. public class EX11_055 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Shared OP / SOYMP
  12. string SharedEffectName = "Trash 1 [Composite] or [Wicked God] from hand to Draw 1 & gain 1 memory";
  13. string SharedEffectDescription(string tag) => $"[{tag}] By trashing 1 [Composite] or [Wicked God] trait card from your hand, <Draw 1> and gain 1 memory.";
  14. bool SharedCanActivateCondition(Hashtable hashtable)
  15. {
  16. return CardEffectCommons.IsExistOnBattleArea(card)
  17. && CardEffectCommons.HasMatchConditionOwnersHand(card, ValidDiscardCard);
  18. }
  19. bool ValidDiscardCard(CardSource cardSource)
  20. {
  21. return cardSource.EqualsTraits("Composite")
  22. || cardSource.EqualsTraits("Wicked God");
  23. }
  24. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  25. {
  26. bool discarded = false;
  27. int discardCount = 1;
  28. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  29. selectHandEffect.SetUp(
  30. selectPlayer: card.Owner,
  31. canTargetCondition: ValidDiscardCard,
  32. canTargetCondition_ByPreSelecetedList: null,
  33. canEndSelectCondition: null,
  34. maxCount: discardCount,
  35. canNoSelect: true,
  36. canEndNotMax: false,
  37. isShowOpponent: true,
  38. selectCardCoroutine: null,
  39. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  40. mode: SelectHandEffect.Mode.Discard,
  41. cardEffect: activateClass);
  42. selectHandEffect.SetUpCustomMessage("Select 1 Card to trash.", "The opponent is selecting 1 card to trash from their hand.");
  43. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  44. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  45. {
  46. if (cardSources.Count >= 1)
  47. {
  48. discarded = true;
  49. yield return null;
  50. }
  51. }
  52. if (discarded)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  55. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  56. }
  57. }
  58. #endregion
  59. #region Start of your Main Phase
  60. if (timing == EffectTiming.OnStartMainPhase)
  61. {
  62. ActivateClass activateClass = new ActivateClass();
  63. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  64. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("Start of Your Main Phase"));
  65. cardEffects.Add(activateClass);
  66. bool CanUseCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.IsExistOnBattleArea(card)
  69. && CardEffectCommons.IsOwnerTurn(card);
  70. }
  71. }
  72. #endregion
  73. #region On Play
  74. if (timing == EffectTiming.OnEnterFieldAnyone)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  78. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  79. cardEffects.Add(activateClass);
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.IsExistOnBattleArea(card)
  83. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  84. }
  85. }
  86. #endregion
  87. #region All Turns
  88. if (timing == EffectTiming.OnDestroyedAnyone)
  89. {
  90. ActivateClass activateClass = new();
  91. activateClass.SetUpICardEffect("By suspending this tamer, play 1 [Gazimon] or [Gizamon] for free.", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  93. cardEffects.Add(activateClass);
  94. string EffectDescription()
  95. => "[All Turns] When any of your [Composite] or [Wicked God] trait Digimon are deleted, by suspending this Tamer, you may play 1 [Gazimon] or [Gizamon] from your hand without paying the cost.";
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleArea(card)
  99. && CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass);
  100. }
  101. bool PermanentCondition(Permanent permanent)
  102. {
  103. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  104. && (permanent.TopCard.EqualsTraits("Composite") || permanent.TopCard.EqualsTraits("Wicked God"));
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleArea(card)
  109. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  110. }
  111. bool CanSelectCardCondition(CardSource cardSource)
  112. {
  113. return (cardSource.EqualsCardName("Gazimon")
  114. || cardSource.EqualsCardName("Gizamon"))
  115. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable hashtable)
  118. {
  119. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  120. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  121. {
  122. CardSource selectedCard = null;
  123. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  124. selectHandEffect.SetUp(
  125. selectPlayer: card.Owner,
  126. canTargetCondition: CanSelectCardCondition,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. maxCount: 1,
  130. canNoSelect: true,
  131. canEndNotMax: false,
  132. isShowOpponent: true,
  133. selectCardCoroutine: SelectCardCoroutine,
  134. afterSelectCardCoroutine: null,
  135. mode: SelectHandEffect.Mode.Custom,
  136. cardEffect: activateClass);
  137. selectHandEffect.SetUpCustomMessage("Select 1 digimon to play", "The opponent is selecting 1 digimon to play");
  138. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  139. IEnumerator SelectCardCoroutine(CardSource cardSource)
  140. {
  141. selectedCard = cardSource;
  142. yield return null;
  143. }
  144. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  145. new List<CardSource>() { selectedCard },
  146. activateClass: activateClass,
  147. payCost: false,
  148. isTapped: false,
  149. root: SelectCardEffect.Root.Hand,
  150. activateETB: true));
  151. }
  152. }
  153. }
  154. #endregion
  155. #region Security
  156. if (timing == EffectTiming.SecuritySkill)
  157. {
  158. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  159. }
  160. #endregion
  161. return cardEffects;
  162. }
  163. }
  164. }