BT16_047.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_047 : 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.HasText("Pulsemon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, 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("Suspend opponent's Digimon and give effects.", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[When Digivolving] Suspend 1 of your opponent's Digimon. Then, 1 of your opponent's Digimon can't unsuspend until the end of your opponent's turn.";
  31. }
  32. bool PermanentCondition(Permanent permanent)
  33. {
  34. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  35. {
  36. if (permanent.IsDigimon)
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. return true;
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  58. {
  59. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. selectPermanentEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: PermanentCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: maxCount,
  67. canNoSelect: false,
  68. canEndNotMax: false,
  69. selectPermanentCoroutine: null,
  70. afterSelectPermanentCoroutine: null,
  71. mode: SelectPermanentEffect.Mode.Tap,
  72. cardEffect: activateClass);
  73. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. }
  76. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  77. {
  78. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: PermanentCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: SelectPermanentCoroutine,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will not unsuspend.", "The opponent is 1 Digimon that will not unsuspend.");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  95. {
  96. Permanent selectedPermanent = permanent;
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  98. targetPermanent: selectedPermanent,
  99. activateClass: activateClass
  100. ));
  101. }
  102. }
  103. }
  104. }
  105. #endregion
  106. #region All Turns
  107. if (timing == EffectTiming.OnEndBattle)
  108. {
  109. ActivateClass activateClass = new ActivateClass();
  110. activateClass.SetUpICardEffect("Trash opponent's security or gain memory.", CanUseCondition, card);
  111. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  112. activateClass.SetHashString("TrashOrGain_BT16_047");
  113. cardEffects.Add(activateClass);
  114. string EffectDiscription()
  115. {
  116. return "[All Turns] When this Digimon deletes and opponent's Digimon by battle, if you have 3 or more security cards, trash the top card of your opponent's security stack. If you have 3 or fewer security cards, gain 2 memory.";
  117. }
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  123. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  124. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. bool CanActivateCondition(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.IsExistOnBattleArea(card))
  134. {
  135. if (card.Owner.SecurityCards.Count >= 3)
  136. {
  137. return true;
  138. }
  139. if (card.Owner.SecurityCards.Count <= 3)
  140. {
  141. return true;
  142. }
  143. }
  144. return false;
  145. }
  146. IEnumerator ActivateCoroutine(Hashtable hashtable)
  147. {
  148. if (card.Owner.SecurityCards.Count >= 3)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  151. player: card.Owner.Enemy,
  152. destroySecurityCount: 1,
  153. cardEffect: activateClass,
  154. fromTop: true).DestroySecurity());
  155. }
  156. if (card.Owner.SecurityCards.Count <= 3)
  157. {
  158. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  159. }
  160. }
  161. }
  162. #endregion
  163. return cardEffects;
  164. }
  165. }
  166. }