BT18_080.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_080 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play/ When Digivolving Shared
  11. bool CanSelectDigimonPermanentConditionShared(Permanent permanent)
  12. {
  13. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) &&
  14. permanent.IsDigimon &&
  15. permanent.TopCard.HasLevel && permanent.Level <= 4 &&
  16. (permanent.TopCard.CardColors.Contains(CardColor.Red) ||
  17. permanent.TopCard.CardColors.Contains(CardColor.Green) ||
  18. permanent.TopCard.CardColors.Contains(CardColor.Purple) ||
  19. permanent.TopCard.CardColors.Contains(CardColor.White));
  20. }
  21. bool CanSelectTamerPermanentConditionShared(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) &&
  24. permanent.IsTamer &&
  25. permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 3 &&
  26. (permanent.TopCard.CardColors.Contains(CardColor.Blue) ||
  27. permanent.TopCard.CardColors.Contains(CardColor.Yellow) ||
  28. permanent.TopCard.CardColors.Contains(CardColor.Black) ||
  29. permanent.TopCard.CardColors.Contains(CardColor.White));
  30. }
  31. bool CanActivateConditionShared(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  34. (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonPermanentConditionShared) ||
  35. CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerPermanentConditionShared));
  36. }
  37. #endregion
  38. #region On Play
  39. if (timing == EffectTiming.OnEnterFieldAnyone)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Delete Digimon and delete Tamer", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  44. cardEffects.Add(activateClass);
  45. string EffectDescription()
  46. {
  47. return
  48. "[On Play] Delete 1 level 4 or lower red, green, purple or white Digimon. Then, delete 1 blue, yellow, black or white Tamer with a play cost of 3 or less.";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonPermanentConditionShared))
  57. {
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectDigimonPermanentConditionShared,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: null,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Destroy,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  72. "The opponent is selecting 1 Digimon to delete.");
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  74. }
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerPermanentConditionShared))
  76. {
  77. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectTamerPermanentConditionShared,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: 1,
  84. canNoSelect: false,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: null,
  87. afterSelectPermanentCoroutine: null,
  88. mode: SelectPermanentEffect.Mode.Destroy,
  89. cardEffect: activateClass);
  90. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to delete.",
  91. "The opponent is selecting 1 Tamer to delete.");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. }
  94. }
  95. }
  96. #endregion
  97. #region When Digivolving
  98. if (timing == EffectTiming.OnEnterFieldAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect("Delete Digimon and delete Tamer", CanUseCondition, card);
  102. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  103. cardEffects.Add(activateClass);
  104. string EffectDescription()
  105. {
  106. return
  107. "[When Digivolving] Delete 1 level 4 or lower red, green, purple or white Digimon. Then, delete 1 blue, yellow, black or white Tamer with a play cost of 3 or less.";
  108. }
  109. bool CanUseCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonPermanentConditionShared))
  116. {
  117. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  118. selectPermanentEffect.SetUp(
  119. selectPlayer: card.Owner,
  120. canTargetCondition: CanSelectDigimonPermanentConditionShared,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. maxCount: 1,
  124. canNoSelect: false,
  125. canEndNotMax: false,
  126. selectPermanentCoroutine: null,
  127. afterSelectPermanentCoroutine: null,
  128. mode: SelectPermanentEffect.Mode.Destroy,
  129. cardEffect: activateClass);
  130. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  131. "The opponent is selecting 1 Digimon to delete.");
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. }
  134. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerPermanentConditionShared))
  135. {
  136. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: CanSelectTamerPermanentConditionShared,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: 1,
  143. canNoSelect: false,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: null,
  146. afterSelectPermanentCoroutine: null,
  147. mode: SelectPermanentEffect.Mode.Destroy,
  148. cardEffect: activateClass);
  149. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to delete.",
  150. "The opponent is selecting 1 Tamer to delete.");
  151. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  152. }
  153. }
  154. }
  155. #endregion
  156. #region Retaliation - ESS
  157. if (timing == EffectTiming.OnDestroyedAnyone)
  158. {
  159. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  160. }
  161. #endregion
  162. return cardEffects;
  163. }
  164. }
  165. }