BT23_011.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Birdramon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_011 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasCSTraits
  18. && targetPermanent.TopCard.HasLevel
  19. && targetPermanent.TopCard.IsLevel3;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition,
  23. digivolutionCost: 2,
  24. ignoreDigivolutionRequirement: false,
  25. card: card,
  26. condition: null)
  27. );
  28. }
  29. #endregion
  30. #region OP/WD Shared
  31. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  32. {
  33. bool SharedCanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  36. && permanent.HasDP
  37. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass);
  38. }
  39. if (CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectPermanentCondition))
  40. {
  41. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(SharedCanSelectPermanentCondition));
  42. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  43. selectPermanentEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: SharedCanSelectPermanentCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: maxCount,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. selectPermanentCoroutine: null,
  52. afterSelectPermanentCoroutine: null,
  53. mode: SelectPermanentEffect.Mode.Destroy,
  54. cardEffect: activateClass);
  55. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to delete", "Your opponent is selecting 1 digimon to delete");
  56. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  57. }
  58. }
  59. #endregion
  60. #region On Play
  61. if (timing == EffectTiming.OnEnterFieldAnyone)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("Delete a digimon with 4K DP or less", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. return "[On Play] Delete 1 of your opponent's digimon with 4000 DP or less.";
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  74. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  79. }
  80. }
  81. #endregion
  82. #region When Digivolving
  83. if (timing == EffectTiming.OnEnterFieldAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("Delete a digimon with 4K DP or less", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[When Digivolving] Delete 1 of your opponent's digimon with 4000 DP or less.";
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  96. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  97. }
  98. bool CanActivateCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  101. }
  102. }
  103. #endregion
  104. #region ESS - On Deletion
  105. if (timing == EffectTiming.OnDestroyedAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Play 1 Red/[CS] tamer from hand", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  110. activateClass.SetIsInheritedEffect(true);
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[On Deletion] You may play 1 red or [CS] trait tamer card from your hand without paying the cost.";
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card)
  123. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  124. }
  125. bool CanSelectCardCondition(CardSource cardSource)
  126. {
  127. return cardSource.IsTamer
  128. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass)
  129. && (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCSTraits);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. CardSource selectedCard = null;
  134. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  135. selectHandEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: CanSelectCardCondition,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: 1,
  141. canNoSelect: true,
  142. canEndNotMax: false,
  143. isShowOpponent: true,
  144. selectCardCoroutine: SelectCardCoroutine,
  145. afterSelectCardCoroutine: null,
  146. mode: SelectHandEffect.Mode.Custom,
  147. cardEffect: activateClass);
  148. IEnumerator SelectCardCoroutine(CardSource cardSource)
  149. {
  150. selectedCard = cardSource;
  151. yield return null;
  152. }
  153. selectHandEffect.SetUpCustomMessage("Select 1 Red/[CS] tamer to play", "Your opponent is select 1 tamer to play");
  154. selectHandEffect.SetUpCustomMessage_ShowCard("Selected card");
  155. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  156. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  157. cardSources: new List<CardSource>() { selectedCard },
  158. activateClass: activateClass,
  159. payCost: false,
  160. isTapped: false,
  161. root: SelectCardEffect.Root.Hand,
  162. activateETB: true));
  163. }
  164. }
  165. #endregion
  166. return cardEffects;
  167. }
  168. }
  169. }