EX10_028.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //Landramon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_028 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("By trashing 1 sources, 1 Digimon gains <Reboot>, <Blocker> and +3000 DP", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] By trashing any 1 card with the [Mineral] or [Rock] trait from your Digimon's digivolution cards, 1 of your Digimon with the [Mineral] or [Rock] trait gains <Reboot>, <Blocker> and +3000 DP until your opponent's turn ends.";
  22. }
  23. bool HasProperTrait(CardSource source)
  24. {
  25. return !source.CanNotTrashFromDigivolutionCards(activateClass) &&
  26. (source.EqualsTraits("Mineral") || source.EqualsTraits("Rock"));
  27. }
  28. bool HasProperAmountOfSources()
  29. {
  30. int totalSourceCount = 0;
  31. foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
  32. {
  33. totalSourceCount += permanent.DigivolutionCards.Count(HasProperTrait);
  34. }
  35. return totalSourceCount >= 1;
  36. }
  37. bool CanSelectPermanentCondition(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  40. return permanent.DigivolutionCards.Count(HasProperTrait) >= 1;
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  46. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. return HasProperAmountOfSources();
  52. return false;
  53. }
  54. bool CanSelectYourDigimon(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  57. (permanent.TopCard.EqualsTraits("Mineral") || permanent.TopCard.EqualsTraits("Rock"));
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. int trashedCount = 0;
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  63. permanentCondition: CanSelectPermanentCondition,
  64. cardCondition: HasProperTrait,
  65. maxCount: 1,
  66. canNoTrash: false,
  67. isFromOnly1Permanent: false,
  68. activateClass: activateClass,
  69. afterSelectionCoroutine: AfterTrashedCards
  70. ));
  71. IEnumerator AfterTrashedCards(Permanent permanent, List<CardSource> cards)
  72. {
  73. trashedCount += cards.Count;
  74. yield return null;
  75. }
  76. if (trashedCount == 1)
  77. {
  78. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectYourDigimon))
  79. {
  80. Permanent selectedPermanent = null;
  81. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  82. selectPermanentEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectYourDigimon,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: 1,
  88. canNoSelect: false,
  89. canEndNotMax: false,
  90. selectPermanentCoroutine: SelectTargetPermanent,
  91. afterSelectPermanentCoroutine: null,
  92. mode: SelectPermanentEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectPermanentEffect.SetUpCustomMessage("Select 1 of your Digimon to gain effects & 3K DP", "The opponent is selecting 1 of their Digimon to gain effects & 3K DP");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. IEnumerator SelectTargetPermanent(Permanent permanent)
  97. {
  98. selectedPermanent = permanent;
  99. yield return null;
  100. }
  101. if (selectedPermanent != null)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  104. targetPermanent: selectedPermanent,
  105. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  106. activateClass: activateClass
  107. ));
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  109. targetPermanent: selectedPermanent,
  110. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  111. activateClass: activateClass
  112. ));
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  114. targetPermanent: selectedPermanent,
  115. changeValue: 3000,
  116. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  117. activateClass: activateClass
  118. ));
  119. }
  120. }
  121. }
  122. }
  123. }
  124. #endregion
  125. #region When Digivolving
  126. if (timing == EffectTiming.OnEnterFieldAnyone)
  127. {
  128. ActivateClass activateClass = new ActivateClass();
  129. activateClass.SetUpICardEffect("By trashing 1 sources, 1 Digimon gains <Reboot>, <Blocker> and +3000 DP", CanUseCondition, card);
  130. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  131. cardEffects.Add(activateClass);
  132. string EffectDiscription()
  133. {
  134. return "[When Digivolving] By trashing any 1 card with the [Mineral] or [Rock] trait from your Digimon's digivolution cards, 1 of your Digimon with the [Mineral] or [Rock] trait gains <Reboot>, <Blocker> and +3000 DP until your opponent's turn ends.";
  135. }
  136. bool HasProperTrait(CardSource source)
  137. {
  138. return !source.CanNotTrashFromDigivolutionCards(activateClass) &&
  139. (source.EqualsTraits("Mineral") || source.EqualsTraits("Rock"));
  140. }
  141. bool HasProperAmountOfSources()
  142. {
  143. int totalSourceCount = 0;
  144. foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
  145. {
  146. totalSourceCount += permanent.DigivolutionCards.Count(HasProperTrait);
  147. }
  148. return totalSourceCount >= 1;
  149. }
  150. bool CanSelectPermanentCondition(Permanent permanent)
  151. {
  152. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  153. return permanent.DigivolutionCards.Count(HasProperTrait) >= 1;
  154. return false;
  155. }
  156. bool CanUseCondition(Hashtable hashtable)
  157. {
  158. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  159. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  160. }
  161. bool CanActivateCondition(Hashtable hashtable)
  162. {
  163. if (CardEffectCommons.IsExistOnBattleArea(card))
  164. return HasProperAmountOfSources();
  165. return false;
  166. }
  167. bool CanSelectYourDigimon(Permanent permanent)
  168. {
  169. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  170. (permanent.TopCard.EqualsTraits("Mineral") || permanent.TopCard.EqualsTraits("Rock"));
  171. }
  172. IEnumerator ActivateCoroutine(Hashtable hashtable)
  173. {
  174. int trashedCount = 0;
  175. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  176. permanentCondition: CanSelectPermanentCondition,
  177. cardCondition: HasProperTrait,
  178. maxCount: 1,
  179. canNoTrash: false,
  180. isFromOnly1Permanent: false,
  181. activateClass: activateClass,
  182. afterSelectionCoroutine: AfterTrashedCards
  183. ));
  184. IEnumerator AfterTrashedCards(Permanent permanent, List<CardSource> cards)
  185. {
  186. trashedCount += cards.Count;
  187. yield return null;
  188. }
  189. if (trashedCount == 1)
  190. {
  191. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectYourDigimon))
  192. {
  193. Permanent selectedPermanent = null;
  194. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  195. selectPermanentEffect.SetUp(
  196. selectPlayer: card.Owner,
  197. canTargetCondition: CanSelectYourDigimon,
  198. canTargetCondition_ByPreSelecetedList: null,
  199. canEndSelectCondition: null,
  200. maxCount: 1,
  201. canNoSelect: false,
  202. canEndNotMax: false,
  203. selectPermanentCoroutine: SelectTargetPermanent,
  204. afterSelectPermanentCoroutine: null,
  205. mode: SelectPermanentEffect.Mode.Custom,
  206. cardEffect: activateClass);
  207. selectPermanentEffect.SetUpCustomMessage("Select 1 of your Digimon to gain effects & 3K DP", "The opponent is selecting 1 of their Digimon to gain effects & 3K DP");
  208. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  209. IEnumerator SelectTargetPermanent(Permanent permanent)
  210. {
  211. selectedPermanent = permanent;
  212. yield return null;
  213. }
  214. if (selectedPermanent != null)
  215. {
  216. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(
  217. targetPermanent: selectedPermanent,
  218. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  219. activateClass: activateClass
  220. ));
  221. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  222. targetPermanent: selectedPermanent,
  223. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  224. activateClass: activateClass
  225. ));
  226. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  227. targetPermanent: selectedPermanent,
  228. changeValue: 3000,
  229. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  230. activateClass: activateClass
  231. ));
  232. }
  233. }
  234. }
  235. }
  236. }
  237. #endregion
  238. #region ESS
  239. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  240. {
  241. ActivateClass activateClass = new ActivateClass();
  242. activateClass.SetUpICardEffect("Delete 4 cost or less Digimon", CanUseCondition, card);
  243. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  244. activateClass.SetIsInheritedEffect(true);
  245. cardEffects.Add(activateClass);
  246. string EffectDiscription()
  247. {
  248. return "When effects trash this card from a [Mineral] or [Rock] trait Digimon's digivolution cards, delete 1 of your opponent's Digimon with a play cost of 4 or less.";
  249. }
  250. bool CanSelectOpponentsDigimon(Permanent permanent)
  251. {
  252. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  253. return permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 4;
  254. return false;
  255. }
  256. bool CanUseCondition(Hashtable hashtable)
  257. {
  258. Permanent trashedPermanent = CardEffectCommons.GetPermanentFromHashtable(hashtable);
  259. return (trashedPermanent.TopCard.EqualsTraits("Mineral") || trashedPermanent.TopCard.EqualsTraits("Rock")) &&
  260. CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card);
  261. }
  262. bool CanActivateCondition(Hashtable hashtable)
  263. {
  264. return CardEffectCommons.IsExistOnTrash(card);
  265. }
  266. IEnumerator ActivateCoroutine(Hashtable hashtable)
  267. {
  268. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentsDigimon))
  269. {
  270. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  271. selectPermanentEffect.SetUp(
  272. selectPlayer: card.Owner,
  273. canTargetCondition: CanSelectOpponentsDigimon,
  274. canTargetCondition_ByPreSelecetedList: null,
  275. canEndSelectCondition: null,
  276. maxCount: 1,
  277. canNoSelect: false,
  278. canEndNotMax: false,
  279. selectPermanentCoroutine: null,
  280. afterSelectPermanentCoroutine: null,
  281. mode: SelectPermanentEffect.Mode.Destroy,
  282. cardEffect: activateClass);
  283. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  284. }
  285. }
  286. }
  287. #endregion
  288. return cardEffects;
  289. }
  290. }
  291. }