BT15_026.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_026 : 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. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasGarurumonName)
  17. {
  18. if (targetPermanent.TopCard.HasLevel)
  19. {
  20. if (targetPermanent.Level == 4)
  21. {
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  29. }
  30. if (timing == EffectTiming.OnCounterTiming)
  31. {
  32. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  33. }
  34. #region On Play/When Digivolving Shared
  35. bool CanActivateSharedCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. if (card.Owner.LibraryCards.Count >= 1)
  40. {
  41. return true;
  42. }
  43. if (card.Owner.HandCards.Count >= 5)
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. #endregion
  51. #region On Play
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectSharedDiscription());
  57. cardEffects.Add(activateClass);
  58. string EffectSharedDiscription()
  59. {
  60. return "[On Play] Trigger <Draw 1>. (Draw 1 card from your deck.)";
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  69. if (card.Owner.HandCards.Count >= 5)
  70. {
  71. int discardCount = 1;
  72. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  73. selectHandEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: (cardSource) => true,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: discardCount,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. isShowOpponent: true,
  82. selectCardCoroutine: null,
  83. afterSelectCardCoroutine: null,
  84. mode: SelectHandEffect.Mode.Discard,
  85. cardEffect: activateClass);
  86. yield return StartCoroutine(selectHandEffect.Activate());
  87. }
  88. }
  89. }
  90. #endregion
  91. #region When Digivolving
  92. if (timing == EffectTiming.OnEnterFieldAnyone)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  96. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectSharedDiscription());
  97. cardEffects.Add(activateClass);
  98. string EffectSharedDiscription()
  99. {
  100. return "[When Digivolving] Trigger <Draw 1>. (Draw 1 card from your deck.)";
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  109. if (card.Owner.HandCards.Count >= 5)
  110. {
  111. int discardCount = 1;
  112. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  113. selectHandEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: (cardSource) => true,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: discardCount,
  119. canNoSelect: false,
  120. canEndNotMax: false,
  121. isShowOpponent: true,
  122. selectCardCoroutine: null,
  123. afterSelectCardCoroutine: null,
  124. mode: SelectHandEffect.Mode.Discard,
  125. cardEffect: activateClass);
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. }
  128. }
  129. }
  130. #endregion
  131. #region All Turns
  132. if (timing == EffectTiming.OnAddHand)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect("Opponent's 1 Digimon or Tamer can't suspend", CanUseCondition, card);
  136. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  137. activateClass.SetHashString("CantSuspend_BT15_026");
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. {
  141. return "[All Turns][Once Per Turn] When one of your Digimon's effects adds cards to your hand, 1 of your opponent's Digimon or Tamers can't suspend until the end of the turn.";
  142. }
  143. bool CanSelectPermanentCondition(Permanent permanent)
  144. {
  145. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  146. {
  147. if (permanent.IsDigimon || permanent.IsTamer)
  148. {
  149. return true;
  150. }
  151. }
  152. return false;
  153. }
  154. bool IsMyDigimonEffect(ICardEffect effect)
  155. {
  156. if (effect.EffectSourceCard != null)
  157. {
  158. if (effect.EffectSourceCard.Owner == card.Owner)
  159. {
  160. return effect.EffectSourceCard.IsDigimon;
  161. }
  162. }
  163. return false;
  164. }
  165. bool CanUseCondition(Hashtable hashtable)
  166. {
  167. if (CardEffectCommons.IsExistOnBattleArea(card))
  168. {
  169. if (CardEffectCommons.CanTriggerWhenAddHand(
  170. hashtable,
  171. player => player == card.Owner,
  172. IsMyDigimonEffect))
  173. {
  174. return true;
  175. }
  176. }
  177. return false;
  178. }
  179. bool CanActivateCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.IsExistOnBattleArea(card);
  182. }
  183. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  184. {
  185. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  186. {
  187. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  188. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  189. selectPermanentEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectPermanentCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: maxCount,
  195. canNoSelect: false,
  196. canEndNotMax: false,
  197. selectPermanentCoroutine: SelectPermanentCoroutine,
  198. afterSelectPermanentCoroutine: null,
  199. mode: SelectPermanentEffect.Mode.Custom,
  200. cardEffect: activateClass);
  201. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will get unable to suspend.", "The opponent is selecting 1 Digimon or Tamer that will get unable to suspend.");
  202. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  203. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  204. {
  205. Permanent selectedPermanent = permanent;
  206. if (selectedPermanent != null)
  207. {
  208. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  209. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  210. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  211. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  212. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  213. {
  214. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  215. }
  216. bool CanUseCondition1(Hashtable hashtable)
  217. {
  218. if (selectedPermanent.TopCard != null)
  219. {
  220. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  221. {
  222. return true;
  223. }
  224. }
  225. return false;
  226. }
  227. bool PermanentCondition(Permanent permanent)
  228. {
  229. if (permanent == selectedPermanent)
  230. {
  231. return true;
  232. }
  233. return false;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. #endregion
  241. return cardEffects;
  242. }
  243. }
  244. }