BT24_097.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Soul Fear
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_097 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Ignore Color Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  17. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  18. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  19. cardEffects.Add(ignoreColorConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. => CardEffectCommons.HasMatchConditionPermanent((permanent) => permanent.TopCard.Owner == card.Owner && (permanent.IsTamer || permanent.IsDigimon) && permanent.TopCard.HasTSTraits, true);
  22. bool CardCondition(CardSource cardSource)
  23. => cardSource == card;
  24. }
  25. #endregion
  26. #region Link Condition
  27. if (timing == EffectTiming.None)
  28. {
  29. static bool PermanentCondition(Permanent targetPermanent)
  30. {
  31. return targetPermanent.IsDigimon && targetPermanent.TopCard.HasTSTraits;
  32. }
  33. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 3, card: card));
  34. }
  35. #endregion
  36. #region Link
  37. if (timing == EffectTiming.OnDeclaration)
  38. {
  39. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  40. }
  41. #endregion
  42. #endregion
  43. #region Security Effect
  44. if (timing == EffectTiming.SecuritySkill)
  45. {
  46. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  47. card: card,
  48. cardEffects: ref cardEffects,
  49. effectName: "Delete 1 opponent's level 6 or higher Digimon. Then, you may link this card.");
  50. }
  51. #endregion
  52. #region Main
  53. if (timing == EffectTiming.OptionSkill)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("Delete 1 opponent's level 6 or higher Digimon. Then, you may link this card.", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  58. cardEffects.Add(activateClass);
  59. string EffectDescription()
  60. => "[Main] Delete 1 of your opponent's level 6 or higher Digimon. Then, you may link this card to 1 of your Digimon on the field without paying the cost.";
  61. bool CanUseCondition(Hashtable hashtable)
  62. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  63. bool CanSelectPermanentCondition(Permanent permanent)
  64. {
  65. return permanent.IsDigimon
  66. && CardEffectCommons.IsOwnerPermanent(permanent, card)
  67. && card.CanLinkToTargetPermanent(permanent, false, true);
  68. }
  69. bool CanSelectTargetCondition(Permanent permanent)
  70. {
  71. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  72. {
  73. if (permanent.TopCard.HasLevel)
  74. {
  75. if (permanent.Level >= 6)
  76. {
  77. return true;
  78. }
  79. }
  80. }
  81. return false;
  82. }
  83. IEnumerator ActivateCoroutine(Hashtable hashtable)
  84. {
  85. #region Delete 1 opponent's digimon
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTargetCondition))
  87. {
  88. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTargetCondition));
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectTargetCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: maxCount,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: null,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Destroy,
  101. cardEffect: activateClass);
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. }
  104. #endregion
  105. #region Select Digimon To Link
  106. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition, true))
  107. {
  108. Permanent selectedPermanent = null;
  109. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: CanSelectPermanentCondition,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: 1,
  116. canNoSelect: true,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: SelectPermanentCoroutine,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  123. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  124. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  125. {
  126. selectedPermanent = permanent;
  127. yield return null;
  128. }
  129. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(card, activateClass));
  130. }
  131. #endregion
  132. }
  133. }
  134. #endregion
  135. #region Link ESS
  136. if (timing == EffectTiming.OnAllyAttack)
  137. {
  138. ActivateClass activateClass = new ActivateClass();
  139. activateClass.SetUpICardEffect("Delete 1 opponent's level 5 or lower Digimon.", CanUseCondition, card);
  140. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  141. activateClass.SetIsLinkedEffect(true);
  142. activateClass.SetHashString("WA_BT24-097");
  143. cardEffects.Add(activateClass);
  144. string EffectDescription()
  145. {
  146. return "[When Attacking] [Once Per Turn] Delete 1 of your opponent's level 5 or higher Digimon.";
  147. }
  148. bool CanUseCondition(Hashtable hashtable)
  149. {
  150. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  151. }
  152. bool CanSelectTargetCondition(Permanent permanent)
  153. {
  154. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  155. {
  156. if (permanent.TopCard.HasLevel)
  157. {
  158. if (permanent.Level <= 5)
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. return false;
  165. }
  166. bool CanActivateCondition(Hashtable hashtable)
  167. {
  168. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  169. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectTargetCondition);
  170. }
  171. IEnumerator ActivateCoroutine(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTargetCondition))
  174. {
  175. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTargetCondition));
  176. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  177. selectPermanentEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: CanSelectTargetCondition,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: maxCount,
  183. canNoSelect: false,
  184. canEndNotMax: false,
  185. selectPermanentCoroutine: null,
  186. afterSelectPermanentCoroutine: null,
  187. mode: SelectPermanentEffect.Mode.Destroy,
  188. cardEffect: activateClass);
  189. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  190. }
  191. }
  192. }
  193. #endregion
  194. return cardEffects;
  195. }
  196. }
  197. }