BT19_069.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_069 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Digivolution Condition
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("Gazimon") ||
  16. targetPermanent.TopCard.EqualsCardName("Gizamon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  19. digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play/ When Digivolving/ On Deletion Shared
  23. bool CanSelectOpponentPermanentConditionShared(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  26. permanent.IsDigimon &&
  27. permanent.TopCard.HasLevel &&
  28. permanent.Level <= 4;
  29. }
  30. bool CanActivateConditionShared(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  33. card.Owner.HandCards.Count >= 1;
  34. }
  35. #endregion
  36. #region On Play
  37. if (timing == EffectTiming.OnEnterFieldAnyone)
  38. {
  39. ActivateClass activateClass = new ActivateClass();
  40. activateClass.SetUpICardEffect("Trash 1 card from hand to delete 1 of your opponent's level 4 or lower Digimon",
  41. CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, true, EffectDescription());
  43. cardEffects.Add(activateClass);
  44. string EffectDescription()
  45. {
  46. return
  47. "[On Play] By trashing 1 card in your hand, delete 1 of your opponent's level 4 or lower Digimon.";
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable hashtable)
  54. {
  55. bool discarded = false;
  56. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  57. selectHandEffect.SetUp(
  58. canTargetCondition: _ => true,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. canNoSelect: true,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  64. maxCount: 1,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. mode: SelectHandEffect.Mode.Discard,
  68. selectPlayer: card.Owner,
  69. cardEffect: activateClass);
  70. selectHandEffect.SetUpCustomMessage("Select 1 card to discard.",
  71. "The opponent is selecting 1 card to discard.");
  72. yield return StartCoroutine(selectHandEffect.Activate());
  73. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  74. {
  75. discarded = cardSources.Count > 0;
  76. yield return null;
  77. }
  78. if (discarded && CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentConditionShared))
  79. {
  80. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  81. selectPermanentEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectOpponentPermanentConditionShared,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: 1,
  87. canNoSelect: false,
  88. canEndNotMax: false,
  89. selectPermanentCoroutine: null,
  90. afterSelectPermanentCoroutine: null,
  91. mode: SelectPermanentEffect.Mode.Destroy,
  92. cardEffect: activateClass);
  93. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  94. "The opponent is selecting 1 Digimon to delete.");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. }
  97. }
  98. }
  99. #endregion
  100. #region When Digivolving
  101. if (timing == EffectTiming.OnEnterFieldAnyone)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("Trash 1 card from hand to delete 1 of your opponent's level 4 or lower Digimon",
  105. CanUseCondition, card);
  106. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, true, EffectDescription());
  107. cardEffects.Add(activateClass);
  108. string EffectDescription()
  109. {
  110. return
  111. "[When Digivolving] By trashing 1 card in your hand, delete 1 of your opponent's level 4 or lower Digimon.";
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable hashtable)
  118. {
  119. bool discarded = false;
  120. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  121. selectHandEffect.SetUp(
  122. canTargetCondition: _ => true,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. canNoSelect: true,
  126. selectCardCoroutine: null,
  127. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  128. maxCount: 1,
  129. canEndNotMax: false,
  130. isShowOpponent: true,
  131. mode: SelectHandEffect.Mode.Discard,
  132. selectPlayer: card.Owner,
  133. cardEffect: activateClass);
  134. selectHandEffect.SetUpCustomMessage("Select 1 card to discard.",
  135. "The opponent is selecting 1 card to discard.");
  136. yield return StartCoroutine(selectHandEffect.Activate());
  137. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  138. {
  139. discarded = cardSources.Count > 0;
  140. yield return null;
  141. }
  142. if (discarded && CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentConditionShared))
  143. {
  144. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectOpponentPermanentConditionShared,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: 1,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: null,
  154. afterSelectPermanentCoroutine: null,
  155. mode: SelectPermanentEffect.Mode.Destroy,
  156. cardEffect: activateClass);
  157. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  158. "The opponent is selecting 1 Digimon to delete.");
  159. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  160. }
  161. }
  162. }
  163. #endregion
  164. #region On Deletion
  165. if (timing == EffectTiming.OnDestroyedAnyone)
  166. {
  167. ActivateClass activateClass = new ActivateClass();
  168. activateClass.SetUpICardEffect("Trash 1 card from hand to delete 1 of your opponent's level 4 or lower Digimon",
  169. CanUseCondition, card);
  170. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  171. cardEffects.Add(activateClass);
  172. string EffectDescription()
  173. {
  174. return
  175. "[On Deletion] By trashing 1 card in your hand, delete 1 of your opponent's level 4 or lower Digimon.";
  176. }
  177. bool CanUseCondition(Hashtable hashtable)
  178. {
  179. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  180. }
  181. bool CanActivateCondition(Hashtable hashtable)
  182. {
  183. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  184. card.Owner.HandCards.Count >= 1;
  185. }
  186. IEnumerator ActivateCoroutine(Hashtable hashtable)
  187. {
  188. bool discarded = false;
  189. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  190. selectHandEffect.SetUp(
  191. canTargetCondition: _ => true,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. canNoSelect: true,
  195. selectCardCoroutine: null,
  196. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  197. maxCount: 1,
  198. canEndNotMax: false,
  199. isShowOpponent: true,
  200. mode: SelectHandEffect.Mode.Discard,
  201. selectPlayer: card.Owner,
  202. cardEffect: activateClass);
  203. selectHandEffect.SetUpCustomMessage("Select 1 card to discard.",
  204. "The opponent is selecting 1 card to discard.");
  205. yield return StartCoroutine(selectHandEffect.Activate());
  206. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  207. {
  208. discarded = cardSources.Count > 0;
  209. yield return null;
  210. }
  211. if (discarded && CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentConditionShared))
  212. {
  213. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  214. selectPermanentEffect.SetUp(
  215. selectPlayer: card.Owner,
  216. canTargetCondition: CanSelectOpponentPermanentConditionShared,
  217. canTargetCondition_ByPreSelecetedList: null,
  218. canEndSelectCondition: null,
  219. maxCount: 1,
  220. canNoSelect: false,
  221. canEndNotMax: false,
  222. selectPermanentCoroutine: null,
  223. afterSelectPermanentCoroutine: null,
  224. mode: SelectPermanentEffect.Mode.Destroy,
  225. cardEffect: activateClass);
  226. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  227. "The opponent is selecting 1 Digimon to delete.");
  228. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  229. }
  230. }
  231. }
  232. #endregion
  233. #region Blocker - ESS
  234. if (timing == EffectTiming.None)
  235. {
  236. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  237. }
  238. #endregion
  239. return cardEffects;
  240. }
  241. }
  242. }