P_180.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. activateClass.SetIsOptionEffect(true);
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. => "When effects trash this card from digivolution cards, delete 1 of your opponent's 7000 DP or lower Digimon.";
  45. bool CanUseCondition(Hashtable hashtable)
  46. => CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card);
  47. bool CanActivateCondition(Hashtable hashtable)
  48. => CardEffectCommons.IsExistOnTrash(card) &&
  49. CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimon);
  50. bool CanSelectOpponentsDigimon(Permanent permanent)
  51. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  52. && permanent.DP <= 7000;
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectOpponentsDigimon,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: null,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Destroy,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to delete", "The opponent is selecting 1 digimon to delete");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. }
  71. }
  72. #endregion
  73. #region Main
  74. if (timing == EffectTiming.OptionSkill)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Trash opponent top sec & place this under a 3M digimon", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. => "[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.";
  82. bool CanUseCondition(Hashtable hashtable)
  83. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  84. bool CanSelectDigimon(Permanent permanent)
  85. => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  86. && permanent.TopCard.HasThreeMusketeersTraits;
  87. IEnumerator ActivateCoroutine(Hashtable hashtable)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  90. player: card.Owner.Enemy,
  91. destroySecurityCount: 1,
  92. cardEffect: activateClass,
  93. fromTop: true).DestroySecurity());
  94. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectDigimon))
  95. {
  96. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimon));
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectDigimon,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: SelectPermanentCoroutine,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to place card underneath", "The opponent is selecting 1 digimon to place card underneath");
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  113. {
  114. if (permanent != null)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  117. yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  118. }
  119. }
  120. }
  121. }
  122. }
  123. #endregion
  124. #region Security
  125. if (timing == EffectTiming.SecuritySkill)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect($"Delete 1 Digimon with the highest DP", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  130. activateClass.SetIsSecurityEffect(true);
  131. cardEffects.Add(activateClass);
  132. string EffectDiscription()
  133. => "[Security] Delete 1 of your opponent's Digimon with the highest DP.";
  134. bool CanSelectPermanentCondition(Permanent permanent)
  135. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  136. && CardEffectCommons.IsMaxDP(permanent, card.Owner.Enemy, permanent => true);
  137. bool CanUseCondition(Hashtable hashtable)
  138. => CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  139. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  140. {
  141. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  142. {
  143. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  144. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectPermanentCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: maxCount,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: null,
  154. afterSelectPermanentCoroutine: null,
  155. mode: SelectPermanentEffect.Mode.Destroy,
  156. cardEffect: activateClass);
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. }
  159. }
  160. }
  161. #endregion
  162. return cardEffects;
  163. }
  164. }
  165. }