P_180.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Bind Red Trigger
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_180 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Ignore Color Requirements
  13. if (timing == EffectTiming.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool HasThreeMusketeersTrait(Permanent permanent)
  20. {
  21. return permanent.IsDigimon &&
  22. permanent.TopCard.ContainsTraits("Three Musketeers");
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasThreeMusketeersTrait);
  27. }
  28. bool CardCondition(CardSource cardSource)
  29. {
  30. return cardSource == card;
  31. }
  32. }
  33. #endregion
  34. #region When Trashed from digivolutions cards
  35. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  36. {
  37. ActivateClass activateClass = new ActivateClass();
  38. activateClass.SetUpICardEffect("Delete 1 digimon with 7k DP or lower", CanUseCondition, card);
  39. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  40. activateClass.SetIsInheritedEffect(true);
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. => "When effects trash this card from digivolution cards, delete 1 of your opponent's 7000 DP or lower Digimon.";
  44. bool CanUseCondition(Hashtable hashtable)
  45. => CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card);
  46. bool CanActivateCondition(Hashtable hashtable)
  47. => CardEffectCommons.IsExistOnTrash(card) &&
  48. CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimon);
  49. bool CanSelectOpponentsDigimon(Permanent permanent)
  50. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  51. && permanent.DP <= 7000;
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: CanSelectOpponentsDigimon,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: 1,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: null,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Destroy,
  66. cardEffect: activateClass);
  67. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to delete", "The opponent is selecting 1 digimon to delete");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. }
  70. }
  71. #endregion
  72. #region Main
  73. if (timing == EffectTiming.OptionSkill)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Trash opponent top sec & place this under a 3M digimon", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. => "[Main] Trash your opponent's top security card. Then, place this card as the bottom digivolution card of 1 of your [Three Musketeers] trait Digimon.";
  81. bool CanUseCondition(Hashtable hashtable)
  82. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  83. bool CanSelectDigimon(Permanent permanent)
  84. => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  85. && permanent.TopCard.HasThreeMusketeersTraits;
  86. IEnumerator ActivateCoroutine(Hashtable hashtable)
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  89. player: card.Owner.Enemy,
  90. destroySecurityCount: 1,
  91. cardEffect: activateClass,
  92. fromTop: true).DestroySecurity());
  93. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectDigimon))
  94. {
  95. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimon));
  96. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  97. selectPermanentEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectDigimon,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: false,
  104. canEndNotMax: false,
  105. selectPermanentCoroutine: SelectPermanentCoroutine,
  106. afterSelectPermanentCoroutine: null,
  107. mode: SelectPermanentEffect.Mode.Custom,
  108. cardEffect: activateClass);
  109. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to place card underneath", "The opponent is selecting 1 digimon to place card underneath");
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  112. {
  113. if (permanent != null)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  116. yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  117. }
  118. }
  119. }
  120. }
  121. }
  122. #endregion
  123. #region Security
  124. if (timing == EffectTiming.SecuritySkill)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect($"Delete 1 Digimon with the highest DP", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  129. activateClass.SetIsSecurityEffect(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. => "[Security] Delete 1 of your opponent's Digimon with the highest DP.";
  133. bool CanSelectPermanentCondition(Permanent permanent)
  134. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  135. && CardEffectCommons.IsMaxDP(permanent, card.Owner.Enemy, permanent => true);
  136. bool CanUseCondition(Hashtable hashtable)
  137. => CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  138. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  139. {
  140. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  141. {
  142. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  143. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  144. selectPermanentEffect.SetUp(
  145. selectPlayer: card.Owner,
  146. canTargetCondition: CanSelectPermanentCondition,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. maxCount: maxCount,
  150. canNoSelect: false,
  151. canEndNotMax: false,
  152. selectPermanentCoroutine: null,
  153. afterSelectPermanentCoroutine: null,
  154. mode: SelectPermanentEffect.Mode.Destroy,
  155. cardEffect: activateClass);
  156. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  157. }
  158. }
  159. }
  160. #endregion
  161. return cardEffects;
  162. }
  163. }
  164. }