EX8_062.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class EX8_062 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsTraits("NSo");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Ace - Blast Digivolve
  29. if (timing == EffectTiming.OnCounterTiming)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  32. }
  33. #endregion
  34. #region On Play/When Digivolving Shared
  35. bool CanSelectPermanentConditionOnPlayWhenDigivolving(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  38. }
  39. bool CanActivateConditionOnPlayWhenDigivolving(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleArea(card);
  42. }
  43. #endregion
  44. #region On Play
  45. if (timing == EffectTiming.OnEnterFieldAnyone)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect("Apply -2000 DP 4 times", CanUseCondition, card);
  49. activateClass.SetUpActivateClass(CanActivateConditionOnPlayWhenDigivolving, ActivateCoroutine, -1, false, EffectDescription());
  50. cardEffects.Add(activateClass);
  51. string EffectDescription()
  52. {
  53. return "[On Play] Activate the effect below 4 times: • 1 of your opponent's Digimon gets -2000 DP for the turn.";
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. for (int i = 0; i < 4; i++)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionOnPlayWhenDigivolving))
  64. {
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionOnPlayWhenDigivolving));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentConditionOnPlayWhenDigivolving,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: SelectPermanentCoroutine,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  82. {
  83. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  84. }
  85. }
  86. }
  87. }
  88. }
  89. #endregion
  90. #region When Digivolving
  91. if (timing == EffectTiming.OnEnterFieldAnyone)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Apply -2000 DP 4 times", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateConditionOnPlayWhenDigivolving, ActivateCoroutine, -1, false, EffectDescription());
  96. cardEffects.Add(activateClass);
  97. string EffectDescription()
  98. {
  99. return "[When Digivolving] Activate the effect below 4 times: • 1 of your opponent's Digimon gets -2000 DP for the turn.";
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  104. }
  105. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  106. {
  107. for (int i = 0; i < 4; i++)
  108. {
  109. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionOnPlayWhenDigivolving))
  110. {
  111. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionOnPlayWhenDigivolving));
  112. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  113. selectPermanentEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: CanSelectPermanentConditionOnPlayWhenDigivolving,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: maxCount,
  119. canNoSelect: false,
  120. canEndNotMax: false,
  121. selectPermanentCoroutine: SelectPermanentCoroutine,
  122. afterSelectPermanentCoroutine: null,
  123. mode: SelectPermanentEffect.Mode.Custom,
  124. cardEffect: activateClass);
  125. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  126. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  127. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  128. {
  129. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  130. }
  131. }
  132. }
  133. }
  134. }
  135. #endregion
  136. #region All Turns
  137. if (timing == EffectTiming.OnDestroyedAnyone)
  138. {
  139. ActivateClass activateClass = new ActivateClass();
  140. activateClass.SetUpICardEffect("Play 1 [NSo] Digimon from the trash", CanUseCondition, card);
  141. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  142. activateClass.SetHashString("PlayDigimon_EX8_062");
  143. cardEffects.Add(activateClass);
  144. string EffectDescription()
  145. {
  146. return "[All Turns] [Once Per Turn] When other Digimon are deleted, you may play 1 level 4 or lower [NSo] trait Digimon card from your trash without paying the cost.";
  147. }
  148. bool PermanentCondition(Permanent permanent)
  149. {
  150. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  151. {
  152. if (permanent.IsDigimon)
  153. {
  154. if (permanent != card.PermanentOfThisCard())
  155. {
  156. return true;
  157. }
  158. }
  159. }
  160. return false;
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  165. {
  166. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  167. {
  168. return true;
  169. }
  170. }
  171. return false;
  172. }
  173. bool CanActivateCondition(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  176. {
  177. if (card.Owner.TrashCards.Count >= 1)
  178. {
  179. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash))
  180. {
  181. return true;
  182. }
  183. }
  184. }
  185. return false;
  186. }
  187. bool CanSelectCardInTrash(CardSource cardSource)
  188. {
  189. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  190. {
  191. if (cardSource.EqualsTraits("NSo"))
  192. {
  193. if (cardSource.IsDigimon)
  194. {
  195. if (cardSource.HasLevel)
  196. {
  197. if (cardSource.Level <= 4)
  198. {
  199. return true;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. return false;
  206. }
  207. IEnumerator ActivateCoroutine(Hashtable hashtable)
  208. {
  209. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash))
  210. {
  211. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardInTrash));
  212. List<CardSource> selectedCards = new List<CardSource>();
  213. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  214. selectCardEffect.SetUp(
  215. canTargetCondition: CanSelectCardInTrash,
  216. canTargetCondition_ByPreSelecetedList: null,
  217. canEndSelectCondition: null,
  218. canNoSelect: () => true,
  219. selectCardCoroutine: SelectCardCoroutine,
  220. afterSelectCardCoroutine: null,
  221. message: "Select 1 card to play.",
  222. maxCount: maxCount,
  223. canEndNotMax: false,
  224. isShowOpponent: true,
  225. mode: SelectCardEffect.Mode.Custom,
  226. root: SelectCardEffect.Root.Trash,
  227. customRootCardList: null,
  228. canLookReverseCard: true,
  229. selectPlayer: card.Owner,
  230. cardEffect: activateClass);
  231. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  232. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  233. yield return StartCoroutine(selectCardEffect.Activate());
  234. IEnumerator SelectCardCoroutine(CardSource cardSource)
  235. {
  236. selectedCards.Add(cardSource);
  237. yield return null;
  238. }
  239. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  240. cardSources: selectedCards,
  241. activateClass: activateClass,
  242. payCost: false,
  243. isTapped: false,
  244. root: SelectCardEffect.Root.Trash,
  245. activateETB: true));
  246. }
  247. }
  248. }
  249. #endregion
  250. return cardEffects;
  251. }
  252. }
  253. }