BT25_014.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Meramon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_014 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alt Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent permanent)
  15. {
  16. return permanent.TopCard.EqualsTraits("Flame");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, true, card, null, level: 3));
  19. }
  20. if (timing == EffectTiming.None)
  21. {
  22. bool PermanentCondition(Permanent permanent)
  23. {
  24. return permanent.TopCard.EqualsTraits("TS");
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, true, card, null, level: 3));
  27. }
  28. #endregion
  29. #region Main
  30. if (timing == EffectTiming.OnDeclaration)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Delete 1 enemy digimon with 4000 DP or less, if none deleted <Draw 2>", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDescription());
  35. activateClass.SetHashString("BT25_014_Main");
  36. cardEffects.Add(activateClass);
  37. string EffectDescription()
  38. {
  39. return "[Main] [Once Per Turn] By trashing 1 [Flame] or [TS] trait card from your hand, delete 1 of your opponent's Digimon with 4000 DP or less. If this effect didn't delete, <Draw 2>.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  44. && CardEffectCommons.IsOwnerTurn(card);
  45. }
  46. bool CanSelectCardCondition(CardSource cardSource)
  47. {
  48. return cardSource.EqualsTraits("Flame")
  49. || cardSource.HasTSTraits;
  50. }
  51. bool CanSelectPermanentCondition(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  54. && permanent.HasDP
  55. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  60. selectHandEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectCardCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: 1,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. selectCardCoroutine: null,
  70. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  71. mode: SelectHandEffect.Mode.Discard,
  72. cardEffect: activateClass);
  73. selectHandEffect.SetUpCustomMessage("Select 1 Card to trash.", "The opponent is selecting 1 card to trash from their hand.");
  74. yield return StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  76. {
  77. if (cardSources.Count >= 1)
  78. {
  79. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  80. bool failedToDelete = true;
  81. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  82. {
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: 1,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: null,
  93. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  97. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  98. {
  99. deleteTargetPermanents = permanents.Clone();
  100. yield return null;
  101. }
  102. }
  103. if (deleteTargetPermanents.Count > 0)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: SuccessDeleteProcess, failureProcess: null));
  106. IEnumerator SuccessDeleteProcess(List<Permanent> permanents)
  107. {
  108. if (permanents.Count > 0)
  109. failedToDelete = false;
  110. yield return null;
  111. }
  112. }
  113. if (failedToDelete)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  116. }
  117. }
  118. }
  119. }
  120. }
  121. #endregion
  122. #region ESS - When Attacking
  123. if (timing == EffectTiming.OnAllyAttack)
  124. {
  125. ActivateClass activateClass = new ActivateClass();
  126. activateClass.SetUpICardEffect("Delete 1 enemy Digimon with 4000 DP or less", CanUseCondition, card);
  127. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  128. activateClass.SetIsInheritedEffect(true);
  129. activateClass.SetHashString("BT25_014_Inherited");
  130. cardEffects.Add(activateClass);
  131. string EffectDescription()
  132. {
  133. return "[When Attacking] [Once Per Turn] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  134. }
  135. bool CanSelectPermanentCondition(Permanent permanent)
  136. {
  137. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  138. && permanent.HasDP
  139. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass);
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.CanTriggerOnAttack(hashtable, card)
  144. && CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  149. }
  150. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  151. {
  152. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  153. {
  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: 1,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: null,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.Destroy,
  166. cardEffect: activateClass);
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. }
  169. }
  170. }
  171. #endregion
  172. return cardEffects;
  173. }
  174. }
  175. }