BT25_080.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Witchmon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_080 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasTSTraits;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null, level: 3));
  19. }
  20. #endregion
  21. #region Shared OP/WA
  22. string SharedEffectName = "May trash 1 card to return 1 [Titan] card, then if played by effect, delete 1 enemy level 5 or lower Digimon";
  23. string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] By trashing 1 card in your hand, you may return 1 [Titan] trait card from your trash to the hand. After, if played by an effect, delete 1 of your opponent's level 5 or lower Digimon.";
  24. string SharedHashValue = "BT25_080_OP_WA";
  25. CardEffectFactory.ActivateClassesForSharedEffects
  26. (ref cardEffects, timing, card,
  27. SharedEffectName,
  28. SharedActivateCoroutine,
  29. SharedEffectDescription,
  30. maxCountPerTurn: 1,
  31. hashValue: SharedHashValue,
  32. optional: false,
  33. isSkippable: true,
  34. onPlay: true,
  35. whenAttacking: true);
  36. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  37. {
  38. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  39. selectHandEffect.SetUp(
  40. selectPlayer: card.Owner,
  41. canTargetCondition: (cardSource) => true,
  42. canTargetCondition_ByPreSelecetedList: null,
  43. canEndSelectCondition: null,
  44. maxCount: 1,
  45. canNoSelect: true,
  46. canEndNotMax: false,
  47. isShowOpponent: true,
  48. selectCardCoroutine: null,
  49. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  50. mode: SelectHandEffect.Mode.Discard,
  51. cardEffect: activateClass);
  52. yield return StartCoroutine(selectHandEffect.Activate());
  53. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  54. {
  55. if (cardSources.Count >= 1)
  56. {
  57. bool CanSelectCardCondition(CardSource cardSource)
  58. {
  59. return cardSource.EqualsTraits("Titan");
  60. }
  61. bool CanSelectPermanentCondition(Permanent permanent)
  62. {
  63. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  64. && permanent.TopCard.HasLevel
  65. && permanent.Level <= 5;
  66. }
  67. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  68. {
  69. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  70. selectCardEffect.SetUp(
  71. canTargetCondition: CanSelectCardCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. canNoSelect: () => true,
  75. selectCardCoroutine: null,
  76. afterSelectCardCoroutine: null,
  77. message: "Select 1 card to add to your hand.",
  78. maxCount: 1,
  79. canEndNotMax: false,
  80. isShowOpponent: true,
  81. mode: SelectCardEffect.Mode.AddHand,
  82. root: SelectCardEffect.Root.Trash,
  83. customRootCardList: null,
  84. canLookReverseCard: true,
  85. selectPlayer: card.Owner,
  86. cardEffect: activateClass);
  87. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  88. }
  89. if (CardEffectCommons.IsByEffect(hashtable, null)
  90. && CardEffectCommons.CanTriggerOnPlay(hashtable, card)
  91. && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  92. {
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectPermanentCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: 1,
  100. canNoSelect: false,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: null,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Destroy,
  105. cardEffect: activateClass);
  106. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  107. }
  108. }
  109. else activateClass.RemoveUse();
  110. }
  111. }
  112. #endregion
  113. #region ESS
  114. if (timing == EffectTiming.OnDiscardHand)
  115. {
  116. ActivateClass activateClass = new ActivateClass();
  117. activateClass.SetUpICardEffect("Delete 1 enemy level 4 or lower Digimon", CanUseCondition, card);
  118. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  119. activateClass.SetIsInheritedEffect(true);
  120. activateClass.SetHashString("BT25_029_AT_ESS");
  121. cardEffects.Add(activateClass);
  122. string EffectDescription()
  123. {
  124. return "[All Turns] [Once Per Turn] When your hand is trashed from, if this Digimon has the [Titan] trait, delete 1 of your opponent's level 4 or lower Digimon.";
  125. }
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  129. && CardEffectCommons.CanTriggerOnTrashHand(hashtable, null, cardSource => cardSource.Owner == card.Owner);
  130. }
  131. bool CanActivateCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  134. }
  135. bool CanSelectPermanentCondition(Permanent permanent)
  136. {
  137. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  138. && permanent.TopCard.HasLevel
  139. && permanent.Level <= 4;
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  142. {
  143. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition) && card.PermanentOfThisCard().TopCard.EqualsTraits("Titan"))
  144. {
  145. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  146. selectPermanentEffect.SetUp(
  147. selectPlayer: card.Owner,
  148. canTargetCondition: CanSelectPermanentCondition,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. maxCount: 1,
  152. canNoSelect: false,
  153. canEndNotMax: false,
  154. selectPermanentCoroutine: null,
  155. afterSelectPermanentCoroutine: null,
  156. mode: SelectPermanentEffect.Mode.Destroy,
  157. cardEffect: activateClass);
  158. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  159. }
  160. }
  161. }
  162. #endregion
  163. return cardEffects;
  164. }
  165. }
  166. }