BT17_034.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_034 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Pulsemon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region When Digivolving
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("-3000 DP/Suspend an opponents Digimon", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[When Digivolving] If you have 3 or more security cards, 1 of your opponent's Digimon gets -3000 DP for the turn. If you have 3 or fewer security cards, suspend 1 of your opponent's Digimon.";
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  35. }
  36. bool PermanentCondition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  39. {
  40. return true;
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (card.Owner.SecurityCards.Count >= 3)
  49. {
  50. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  51. {
  52. return true;
  53. }
  54. }
  55. if (card.Owner.SecurityCards.Count <= 3)
  56. {
  57. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  58. {
  59. return true;
  60. }
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable hashtable)
  66. {
  67. if (card.Owner.SecurityCards.Count >= 3)
  68. {
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: PermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  88. }
  89. }
  90. if (card.Owner.SecurityCards.Count <= 3)
  91. {
  92. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: PermanentCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: maxCount,
  100. canNoSelect: false,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: null,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Tap,
  105. cardEffect: activateClass);
  106. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. }
  109. }
  110. }
  111. #endregion
  112. #region All Turns
  113. if (timing == EffectTiming.OnDiscardSecurity)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("If a card is trashed from security and there's a Tamer in the digivolution cards, Recovery +1.", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  118. activateClass.SetHashString("Recovery_BT17_034");
  119. cardEffects.Add(activateClass);
  120. string EffectDiscription()
  121. {
  122. return "[All Turns][Once per turn] When a card is trashed from your security stack, if [Leon Alexander] is in this Digimon's digivolution cards, Recovery +1.";
  123. }
  124. bool HasLeonAlexander(CardSource source)
  125. {
  126. return source.EqualsCardName("Leon Alexander");
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  131. {
  132. if (CardEffectCommons.CanTriggerOnTrashSecurity(hashtable, cardEffect => true, cardSource => cardSource.Owner == card.Owner))
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  142. {
  143. if (card.PermanentOfThisCard().DigivolutionCards.Some(HasLeonAlexander))
  144. return true;
  145. }
  146. return false;
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  151. }
  152. }
  153. #endregion
  154. #region Inherit
  155. if (timing == EffectTiming.None)
  156. {
  157. bool Condition()
  158. {
  159. if (CardEffectCommons.IsExistOnBattleArea(card))
  160. {
  161. if (card.PermanentOfThisCard().TopCard.HasPulsemonText)
  162. {
  163. return true;
  164. }
  165. }
  166. return false;
  167. }
  168. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  169. }
  170. #endregion
  171. return cardEffects;
  172. }
  173. }
  174. }