BT13_098.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_098 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnDiscardSecurity)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Play this card", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "When an effect trashes this card from the security stack, you may play this card without paying the cost.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOnTrashSelfSecurity(hashtable, cardEffect => cardEffect != null, card);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: card, payCost: false, cardEffect: activateClass))
  28. {
  29. if (CardEffectCommons.IsExistOnTrash(card))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { card }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  39. }
  40. }
  41. if (timing == EffectTiming.OnStartMainPhase)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[Start of Your Main Phase] If there're 6 or fewer total cards in both players' security stacks, gain 1 memory.";
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (CardEffectCommons.IsOwnerTurn(card))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (card.Owner.SecurityCards.Count + card.Owner.Enemy.SecurityCards.Count <= 6)
  67. {
  68. if (card.Owner.CanAddMemory(activateClass))
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  79. }
  80. }
  81. if (timing == EffectTiming.OnDeclaration)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("Your [Kudamon] digivolves into [Kentaurosmon]", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  86. cardEffects.Add(activateClass);
  87. string EffectDiscription()
  88. {
  89. return "[Main] If there're 6 or fewer total cards in both players' security stacks, by suspending this Tamer, 1 of your [Kudamon] may digivolve into [Kentaurosmon] in the hand for the digivolution cost, ignoring its level.";
  90. }
  91. bool CanSelectPermanentCondition(Permanent permanent)
  92. {
  93. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  94. {
  95. if (permanent.TopCard.CardNames.Contains("Kudamon"))
  96. {
  97. foreach (CardSource cardSource in card.Owner.HandCards)
  98. {
  99. if (CanSelectCardCondition(cardSource))
  100. {
  101. if (!cardSource.CanNotEvolve(permanent))
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanSelectCardCondition(CardSource cardSource)
  112. {
  113. return cardSource.CardNames.Contains("Kentaurosmon");
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.IsExistOnBattleArea(card))
  118. {
  119. if (card.Owner.SecurityCards.Count + card.Owner.Enemy.SecurityCards.Count <= 6)
  120. {
  121. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  122. {
  123. return true;
  124. }
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  132. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  133. {
  134. Permanent selectedPermanent = null;
  135. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  136. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: CanSelectPermanentCondition,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: maxCount,
  143. canNoSelect: true,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: SelectPermanentCoroutine,
  146. afterSelectPermanentCoroutine: null,
  147. mode: SelectPermanentEffect.Mode.Custom,
  148. cardEffect: activateClass);
  149. selectPermanentEffect.SetUpCustomMessage("Select 1 [Kudamon] that will digivolve.", "The opponent is selecting 1 [Kudamon] that will digivolve.");
  150. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  151. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  152. {
  153. selectedPermanent = permanent;
  154. yield return null;
  155. }
  156. if (selectedPermanent != null)
  157. {
  158. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  159. targetPermanent: selectedPermanent,
  160. cardCondition: CanSelectCardCondition,
  161. payCost: true,
  162. reduceCostTuple: null,
  163. fixedCostTuple: null,
  164. ignoreDigivolutionRequirementFixedCost: -1,
  165. isHand: true,
  166. activateClass: activateClass,
  167. successProcess: null,
  168. ignoreRequirements: CardEffectCommons.IgnoreRequirement.Level));
  169. }
  170. }
  171. }
  172. }
  173. if (timing == EffectTiming.SecuritySkill)
  174. {
  175. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  176. }
  177. return cardEffects;
  178. }
  179. }
  180. }