ST24_12.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Falcomon
  6. namespace DCGO.CardEffects.ST24
  7. {
  8. public class ST24_12 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsTraits("DATA SQUAD");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 2, permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region On Play
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Trash 1 face-down from under your Tamers to return 1 [DATA SQUAD] Digimon card", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  29. cardEffects.Add(activateClass);
  30. string EffectDescription()
  31. {
  32. return
  33. "[On Play] By trashing the bottom face-down card from under any of your Tamers, you may return 1 Digimon card with the [DATA SQUAD] trait from your trash to the hand.";
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnBattleArea(card)
  38. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleArea(card)
  43. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, TamerWithOneFaceDownSource);
  44. }
  45. bool TamerWithOneFaceDownSource(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  48. && permanent.DigivolutionCards.Any(CanSelectTrashSourceCardCondition);
  49. }
  50. bool CanSelectTrashSourceCardCondition(CardSource cardSource)
  51. {
  52. return cardSource.IsFlipped;
  53. }
  54. bool CanSelectCardCondition(CardSource cardSource)
  55. {
  56. return cardSource.IsDigimon
  57. && cardSource.EqualsTraits("DATA SQUAD");
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. bool trashed = false;
  62. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect1.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: TamerWithOneFaceDownSource,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: 1,
  69. canNoSelect: true,
  70. canEndNotMax: true,
  71. selectPermanentCoroutine: null,
  72. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  73. mode: SelectPermanentEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectPermanentEffect1.SetUpCustomMessage("Select 1 Tamer to trash 1 bottom face-down card from", "The opponent is selecting 1 Tamer to trash 1 bottom face-down card from");
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  77. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  78. {
  79. if (permanents.Count == 1)
  80. {
  81. trashed = true;
  82. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanents[0], trashCount: 1, isFromTop: false, activateClass: activateClass, CanSelectTrashSourceCardCondition));
  83. }
  84. }
  85. if (trashed)
  86. {
  87. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  88. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  89. selectCardEffect.SetUp(
  90. canTargetCondition: CanSelectCardCondition,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. canNoSelect: () => true,
  94. selectCardCoroutine: null,
  95. afterSelectCardCoroutine: null,
  96. message: "Select 1 card to add to your hand.",
  97. maxCount: maxCount,
  98. canEndNotMax: false,
  99. isShowOpponent: true,
  100. mode: SelectCardEffect.Mode.AddHand,
  101. root: SelectCardEffect.Root.Trash,
  102. customRootCardList: null,
  103. canLookReverseCard: true,
  104. selectPlayer: card.Owner,
  105. cardEffect: activateClass);
  106. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  107. }
  108. }
  109. }
  110. #endregion
  111. #region Inherited
  112. if (timing == EffectTiming.OnAllyAttack)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect("Delete opponents level 3 Digimon", CanUseCondition, card);
  116. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  117. activateClass.SetIsInheritedEffect(true);
  118. activateClass.SetHashString("ST24_12_Inherited");
  119. cardEffects.Add(activateClass);
  120. string EffectDescription()
  121. {
  122. return "[When Attacking] [Once Per Turn] Delete 1 of your opponent's level 3 Digimon.";
  123. }
  124. bool SelectOpponentsLevel3Digimon(Permanent permanent)
  125. {
  126. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  127. && permanent.TopCard.IsLevel3;
  128. }
  129. bool CanUseCondition(Hashtable hashtable)
  130. {
  131. return CardEffectCommons.CanTriggerOnAttack(hashtable, card)
  132. && CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  137. }
  138. IEnumerator ActivateCoroutine(Hashtable hashtable)
  139. {
  140. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(SelectOpponentsLevel3Digimon));
  141. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  142. selectPermanentEffect.SetUp(
  143. selectPlayer: card.Owner,
  144. canTargetCondition: SelectOpponentsLevel3Digimon,
  145. canTargetCondition_ByPreSelecetedList: null,
  146. canEndSelectCondition: null,
  147. maxCount: maxCount,
  148. canNoSelect: false,
  149. canEndNotMax: false,
  150. selectPermanentCoroutine: null,
  151. afterSelectPermanentCoroutine: null,
  152. mode: SelectPermanentEffect.Mode.Destroy,
  153. cardEffect: activateClass);
  154. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  155. }
  156. }
  157. #endregion
  158. return cardEffects;
  159. }
  160. }
  161. }