EX10_070.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //EX10 God Grade Unleashed
  4. namespace DCGO.CardEffects.EX10
  5. {
  6. public class EX10_070 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Ignore Color Requirment
  12. if (timing == EffectTiming.None)
  13. {
  14. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  15. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  16. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  17. cardEffects.Add(ignoreColorConditionClass);
  18. bool HasAppmonTrait(Permanent permanent)
  19. {
  20. if (CardEffectCommons.IsOwnerPermanent(permanent, card))
  21. {
  22. if (permanent.TopCard.EqualsTraits("Appmon"))
  23. {
  24. if (permanent.IsDigimon || permanent.IsTamer)
  25. {
  26. return true;
  27. }
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.HasMatchConditionPermanent(HasAppmonTrait, true);
  35. }
  36. bool CardCondition(CardSource cardSource)
  37. {
  38. return cardSource == card;
  39. }
  40. }
  41. #endregion
  42. #region Main
  43. if (timing == EffectTiming.OptionSkill)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  47. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  48. cardEffects.Add(activateClass);
  49. string EffectDescription()
  50. {
  51. return "[Main] <Draw 1>. Then, place this card in the battle area.";
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  61. }
  62. }
  63. #endregion
  64. #region Delay - link when link card trashed
  65. if (timing == EffectTiming.OnLinkCardDiscarded)
  66. {
  67. Permanent trashedFrom = null;
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect($"Link 1 card from trash", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  71. cardEffects.Add(activateClass);
  72. string EffectDescription()
  73. {
  74. return "[All Turns] When effects trash any of your Digimon's link cards, <Delay>.\r\n • You may link 1 Digimon card with the [Appmon] trait from your trash to 1 of those Digimon without paying the cost.";
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.CanDeclareOptionDelayEffect(card))
  79. {
  80. if (CardEffectCommons.CanTriggerOnTrashLinkedCard(hashtable, perm => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(perm, card), cardEffect => cardEffect != null, source => source != null))
  81. {
  82. trashedFrom = CardEffectCommons.GetPermanentFromHashtable(hashtable);
  83. return true;
  84. }
  85. }
  86. return false;
  87. }
  88. bool CanActivateCondition(Hashtable hashtable)
  89. {
  90. if (CardEffectCommons.IsExistOnBattleArea(card))
  91. {
  92. if (card.PermanentOfThisCard().CanBeDestroyedBySkill(activateClass))
  93. {
  94. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, cardSource => CanLinkToTrashedFromDigimon(cardSource, hashtable)))
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. return false;
  101. }
  102. bool CanLinkToTrashedFromDigimon(CardSource cardSource, Hashtable hashtable)
  103. {
  104. return cardSource.CanLinkToTargetPermanent(CardEffectCommons.GetPermanentFromHashtable(hashtable), false);
  105. }
  106. bool CanSelectLinkTarget(CardSource cardSource)
  107. {
  108. return cardSource.HasAppmonTraits && cardSource.CanLinkToTargetPermanent(trashedFrom, false);
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable hashtable)
  111. {
  112. bool delaySuccussful = false;
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  114. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  115. activateClass: activateClass,
  116. successProcess: permanents => SuccessProcess(),
  117. failureProcess: null));
  118. IEnumerator SuccessProcess()
  119. {
  120. delaySuccussful = true;
  121. yield return null;
  122. }
  123. if (delaySuccussful)
  124. {
  125. Permanent selectedPermanent = null;
  126. CardSource cardForLinking = null;
  127. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectLinkTarget))
  128. {
  129. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  130. selectCardEffect.SetUp(
  131. canTargetCondition: CanSelectLinkTarget,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. canNoSelect: () => true,
  135. selectCardCoroutine: SelectCardCoroutine,
  136. afterSelectCardCoroutine: null,
  137. message: "Select 1 card to link.",
  138. maxCount: 1,
  139. canEndNotMax: false,
  140. isShowOpponent: true,
  141. mode: SelectCardEffect.Mode.Custom,
  142. root: SelectCardEffect.Root.Trash,
  143. customRootCardList: null,
  144. canLookReverseCard: true,
  145. selectPlayer: card.Owner,
  146. cardEffect: activateClass);
  147. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to link.", "The opponent is selecting 1 digivolution card to link.");
  148. selectCardEffect.SetUpCustomMessage_ShowCard("Linked Card");
  149. yield return StartCoroutine(selectCardEffect.Activate());
  150. }
  151. IEnumerator SelectCardCoroutine(CardSource cardSource)
  152. {
  153. cardForLinking = cardSource;
  154. yield return null;
  155. }
  156. if (cardForLinking != null)
  157. {
  158. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  159. selectPermanentEffect.SetUp(
  160. selectPlayer: card.Owner,
  161. canTargetCondition: CanSelectPermanentCondition,
  162. canTargetCondition_ByPreSelecetedList: null,
  163. canEndSelectCondition: null,
  164. maxCount: 1,
  165. canNoSelect: false,
  166. canEndNotMax: false,
  167. selectPermanentCoroutine: SelectPermanentCoroutine,
  168. afterSelectPermanentCoroutine: null,
  169. mode: SelectPermanentEffect.Mode.Custom,
  170. cardEffect: activateClass);
  171. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  172. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  173. bool CanSelectPermanentCondition(Permanent permanent)
  174. {
  175. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  176. permanent == trashedFrom &&
  177. cardForLinking.CanLinkToTargetPermanent(permanent, false);
  178. }
  179. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  180. {
  181. selectedPermanent = permanent;
  182. yield return null;
  183. }
  184. if (selectedPermanent != null)
  185. {
  186. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(cardForLinking, activateClass));
  187. }
  188. }
  189. }
  190. }
  191. }
  192. #endregion
  193. #region Security
  194. if (timing == EffectTiming.SecuritySkill)
  195. {
  196. ActivateClass activateClass = new ActivateClass();
  197. activateClass.SetUpICardEffect("place in battle area", CanUseCondition, card);
  198. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  199. activateClass.SetIsSecurityEffect(true);
  200. cardEffects.Add(activateClass);
  201. string EffectDescription()
  202. {
  203. return "[Security] place this card in the battle area.";
  204. }
  205. bool CanUseCondition(Hashtable hashtable)
  206. {
  207. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  208. }
  209. IEnumerator ActivateCoroutine(Hashtable hashtable)
  210. {
  211. yield return ContinuousController.instance.StartCoroutine(
  212. CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  213. }
  214. }
  215. #endregion
  216. return cardEffects;
  217. }
  218. }
  219. }