EX10_071.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. //Paradise Lost
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_071 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Ignore Color Requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  17. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  18. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  19. cardEffects.Add(ignoreColorConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return CardEffectCommons.HasMatchConditionPermanent((permanent) =>
  23. CardEffectCommons.IsOwnerPermanent(permanent, card) &&
  24. permanent.TopCard.ContainsCardName("Lucemon"), true);
  25. }
  26. bool CardCondition(CardSource cardSource)
  27. {
  28. return cardSource == card;
  29. }
  30. }
  31. #endregion
  32. #region Main Effect
  33. if (timing == EffectTiming.OptionSkill)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("1 Digimon gains <Raid>, <Piercing>, <Blocker>, +3000 DP", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  38. cardEffects.Add(activateClass);
  39. string EffectDescription()
  40. {
  41. return "[Main] Until your opponent's turn ends, 1 of your Digimon with [Lucemon] in its name in its name gains <Raid>, <Piercing>, <Blocker> and +3000 DP.";
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  46. }
  47. bool IsLucemon(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  50. permanent.TopCard.ContainsCardName("Lucemon");
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(IsLucemon))
  55. {
  56. Permanent selectedPermanent = null;
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: IsLucemon,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: 1,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectPermanentCoroutine,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain effects.",
  71. "The opponent is selecting 1 Digimon that will gain effects.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. selectedPermanent = permanent;
  76. yield return null;
  77. }
  78. if (selectedPermanent != null)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRaid(
  81. targetPermanent: selectedPermanent,
  82. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  83. activateClass: activateClass));
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  85. targetPermanent: selectedPermanent,
  86. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  87. activateClass: activateClass));
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  89. targetPermanent: selectedPermanent,
  90. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  91. activateClass: activateClass));
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  93. targetPermanent: selectedPermanent,
  94. changeValue: 3000,
  95. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  96. activateClass: activateClass));
  97. }
  98. }
  99. }
  100. }
  101. #endregion
  102. #region End Of Your Turn
  103. if (timing == EffectTiming.OnEndTurn)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect("Trash top security, Then one of your Digimon may attack", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  108. cardEffects.Add(activateClass);
  109. string EffectDiscription()
  110. {
  111. return "[Trash] [End of Your Turn] If you have a Digimon with [Lucemon] in its name, by returning this card to the bottom of the deck, trash your top security card and 1 of your Digimon attacks without suspending.";
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsOwnerTurn(card) &&
  116. CardEffectCommons.IsExistOnTrash(card);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.IsExistOnTrash(card) &&
  121. CardEffectCommons.HasMatchConditionPermanent(IsLucemon);
  122. }
  123. bool IsLucemon(Permanent permanent)
  124. {
  125. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  126. permanent.TopCard.ContainsCardName("Lucemon");
  127. }
  128. bool AttackWithDigimn(Permanent permanent)
  129. {
  130. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  131. permanent.CanAttack(activateClass, true);
  132. }
  133. IEnumerator ActivateCoroutine(Hashtable hashtable)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(new List<CardSource>() { card }));
  136. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { card }, "Deck Bottom Cards", true, true));
  137. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  138. player: card.Owner,
  139. destroySecurityCount: 1,
  140. cardEffect: activateClass,
  141. fromTop: true).DestroySecurity());
  142. if (CardEffectCommons.HasMatchConditionPermanent(AttackWithDigimn))
  143. {
  144. Permanent selectedPermanent = null;
  145. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  146. selectPermanentEffect.SetUp(
  147. selectPlayer: card.Owner,
  148. canTargetCondition: AttackWithDigimn,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. maxCount: 1,
  152. canNoSelect: false,
  153. canEndNotMax: false,
  154. selectPermanentCoroutine: SelectPermanentCoroutine,
  155. afterSelectPermanentCoroutine: null,
  156. mode: SelectPermanentEffect.Mode.Custom,
  157. cardEffect: activateClass);
  158. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
  159. "The opponent is selecting 1 Digimon that will attack.");
  160. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  161. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  162. {
  163. selectedPermanent = permanent;
  164. yield return null;
  165. }
  166. if (selectedPermanent != null)
  167. {
  168. if (selectedPermanent.CanAttack(activateClass, withoutTap: true))
  169. {
  170. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  171. selectAttackEffect.SetUp(
  172. attacker: selectedPermanent,
  173. canAttackPlayerCondition: () => true,
  174. defenderCondition: (permanent) => true,
  175. cardEffect: activateClass);
  176. selectAttackEffect.SetCanNotSelectNotAttack();
  177. selectAttackEffect.SetWithoutTap();
  178. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  179. }
  180. }
  181. }
  182. }
  183. }
  184. #endregion
  185. #region Security
  186. if (timing == EffectTiming.SecuritySkill)
  187. {
  188. ActivateClass activateClass = new ActivateClass();
  189. activateClass.SetUpICardEffect("Play 1 [Lucemon] from trash", CanUseCondition, card);
  190. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDiscription());
  191. activateClass.SetIsSecurityEffect(true);
  192. cardEffects.Add(activateClass);
  193. string EffectDiscription()
  194. {
  195. return "[Security] You may play 1 [Lucemon] from your trash without paying the cost.";
  196. }
  197. bool CanSelectCardCondition(CardSource cardSource)
  198. {
  199. if (cardSource != null)
  200. {
  201. if (cardSource.Owner == card.Owner)
  202. {
  203. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  204. {
  205. if (cardSource.EqualsCardName("Lucemon"))
  206. {
  207. return true;
  208. }
  209. }
  210. }
  211. }
  212. return false;
  213. }
  214. bool CanUseCondition(Hashtable hashtable)
  215. {
  216. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  217. }
  218. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  219. {
  220. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource)))
  221. {
  222. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  223. List<CardSource> selectedCards = new List<CardSource>();
  224. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  225. selectCardEffect.SetUp(
  226. canTargetCondition: CanSelectCardCondition,
  227. canTargetCondition_ByPreSelecetedList: null,
  228. canEndSelectCondition: null,
  229. canNoSelect: () => true,
  230. selectCardCoroutine: SelectCardCoroutine,
  231. afterSelectCardCoroutine: null,
  232. message: "Select 1 [Lucemon] to play.",
  233. maxCount: maxCount,
  234. canEndNotMax: false,
  235. isShowOpponent: true,
  236. mode: SelectCardEffect.Mode.Custom,
  237. root: SelectCardEffect.Root.Trash,
  238. customRootCardList: null,
  239. canLookReverseCard: true,
  240. selectPlayer: card.Owner,
  241. cardEffect: activateClass);
  242. selectCardEffect.SetUpCustomMessage("Select 1 digimon to play.", "The opponent is selecting 1 digimon to play.");
  243. selectCardEffect.SetUpCustomMessage_ShowCard("Played Digimon");
  244. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  245. IEnumerator SelectCardCoroutine(CardSource cardSource)
  246. {
  247. selectedCards.Add(cardSource);
  248. yield return null;
  249. }
  250. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  251. }
  252. }
  253. }
  254. #endregion
  255. return cardEffects;
  256. }
  257. }
  258. }