P_180.cs 9.4 KB

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