BT13_060.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_060 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. AddBurstDigivolutionConditionClass addBurstDigivolutionConditionClass = new AddBurstDigivolutionConditionClass();
  15. addBurstDigivolutionConditionClass.SetUpICardEffect($"Burst Digivolution", CanUseCondition, card);
  16. addBurstDigivolutionConditionClass.SetUpAddBurstDigivolutionConditionClass(getBurstDigivolutionCondition: GetBurstDigivolution);
  17. addBurstDigivolutionConditionClass.SetNotShowUI(true);
  18. cardEffects.Add(addBurstDigivolutionConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. BurstDigivolutionCondition GetBurstDigivolution(CardSource cardSource)
  24. {
  25. if (cardSource == card)
  26. {
  27. bool tamerCondition(Permanent permanent)
  28. {
  29. if (permanent != null)
  30. {
  31. if (permanent.TopCard != null)
  32. {
  33. if (permanent.TopCard.Owner == card.Owner)
  34. {
  35. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  36. {
  37. if (!permanent.CannotReturnToHand(null))
  38. {
  39. if (permanent.TopCard.CardNames.Contains("Yoshino Fujieda"))
  40. {
  41. return true;
  42. }
  43. if (permanent.TopCard.CardNames.Contains("YoshinoFujieda"))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool digimonCondition(Permanent permanent)
  55. {
  56. if (permanent != null)
  57. {
  58. if (permanent.TopCard != null)
  59. {
  60. if (permanent.TopCard.Owner == card.Owner)
  61. {
  62. if (permanent.TopCard.Owner.GetFieldPermanents().Contains(permanent))
  63. {
  64. if (!card.CanNotEvolve(permanent))
  65. {
  66. if (permanent.TopCard.CardNames.Contains("Rosemon"))
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. return false;
  76. }
  77. BurstDigivolutionCondition burstDigivolutionCondition = new BurstDigivolutionCondition(
  78. tamerCondition: tamerCondition,
  79. selectTamerMessage: "1 [Yoshino Fujieda]",
  80. digimonCondition: digimonCondition,
  81. selectDigimonMessage: "1 [Rosemon]",
  82. cost: 0);
  83. return burstDigivolutionCondition;
  84. }
  85. return null;
  86. }
  87. }
  88. if (timing == EffectTiming.OnEnterFieldAnyone)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("Suspend 1 Digimon and 1 Tamer, and opponent's Digimon and Tamer can't unsuspend", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[When Digivolving] Suspend 1 of your opponent's Digimon and 1 of their Tamers. Until the end of your opponent's turn, all of their Digimon and Tamers don't unsuspend.";
  97. }
  98. bool CanSelectPermanentCondition(Permanent permanent)
  99. {
  100. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  101. }
  102. bool CanSelectPermanentCondition1(Permanent permanent)
  103. {
  104. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  105. {
  106. if (permanent.IsTamer)
  107. {
  108. return true;
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. return true;
  122. }
  123. return false;
  124. }
  125. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  126. {
  127. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  128. {
  129. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  130. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  131. selectPermanentEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectPermanentCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. selectPermanentCoroutine: null,
  140. afterSelectPermanentCoroutine: null,
  141. mode: SelectPermanentEffect.Mode.Tap,
  142. cardEffect: activateClass);
  143. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will suspend.", "The opponent is selecting 1 Digimon that will suspend.");
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. }
  146. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1) >= 1)
  147. {
  148. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1));
  149. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  150. selectPermanentEffect.SetUp(
  151. selectPlayer: card.Owner,
  152. canTargetCondition: CanSelectPermanentCondition1,
  153. canTargetCondition_ByPreSelecetedList: null,
  154. canEndSelectCondition: null,
  155. maxCount: maxCount,
  156. canNoSelect: false,
  157. canEndNotMax: false,
  158. selectPermanentCoroutine: null,
  159. afterSelectPermanentCoroutine: null,
  160. mode: SelectPermanentEffect.Mode.Tap,
  161. cardEffect: activateClass);
  162. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer that will suspend.", "The opponent is selecting 1 Tamer that will suspend.");
  163. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  164. }
  165. bool PermanentCondition(Permanent permanent)
  166. {
  167. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  168. {
  169. if (permanent.IsDigimon || permanent.IsTamer)
  170. {
  171. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  172. {
  173. return true;
  174. }
  175. }
  176. }
  177. return false;
  178. }
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  180. permanentCondition: PermanentCondition,
  181. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  182. activateClass: activateClass,
  183. isOnlyActivePhase: false,
  184. effectName: "Opponent Digimon or Tamer can't unsuspend"));
  185. }
  186. }
  187. if (timing == EffectTiming.OnAllyAttack)
  188. {
  189. int count()
  190. {
  191. return card.Owner.Enemy.GetBattleAreaPermanents().Count((permanent) => permanent.IsSuspended && (permanent.IsDigimon || permanent.IsTamer)) / 2;
  192. }
  193. ActivateClass activateClass = new ActivateClass();
  194. activateClass.SetUpICardEffect($"Trash cards of opponent's security", CanUseCondition, card);
  195. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  196. cardEffects.Add(activateClass);
  197. string EffectDiscription()
  198. {
  199. return "[When Attacking] Trash the top card of your opponent's security stack for every 2 of your opponent's suspended Digimon and Tamers.";
  200. }
  201. bool CanUseCondition(Hashtable hashtable)
  202. {
  203. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  204. }
  205. bool CanActivateCondition(Hashtable hashtable)
  206. {
  207. if (CardEffectCommons.IsExistOnBattleArea(card))
  208. {
  209. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  210. {
  211. if (count() >= 1)
  212. {
  213. activateClass.SetEffectName($"Trash {count()} cards of opponent's security");
  214. return true;
  215. }
  216. }
  217. }
  218. return false;
  219. }
  220. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  221. {
  222. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  223. player: card.Owner.Enemy,
  224. destroySecurityCount: count(),
  225. cardEffect: activateClass,
  226. fromTop: true).DestroySecurity());
  227. }
  228. }
  229. return cardEffects;
  230. }
  231. }
  232. }