EX10_038.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Copipemon
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_038 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Static Effects
  14. #region Alternate Digivolution Requirement
  15. if (timing == EffectTiming.None)
  16. {
  17. static bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasAppmonTraits;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Link
  25. if (timing == EffectTiming.OnDeclaration)
  26. {
  27. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  28. }
  29. #endregion
  30. #region Link Condition
  31. if (timing == EffectTiming.None)
  32. {
  33. static bool PermanentCondition(Permanent targetPermanent)
  34. {
  35. return targetPermanent.TopCard.HasAppmonTraits;
  36. }
  37. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 1, card: card));
  38. }
  39. #endregion
  40. #endregion
  41. #region On Play
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  47. cardEffects.Add(activateClass);
  48. string EffectDiscription()
  49. {
  50. return "Reveal the top 3 cards of your deck. Add 1 card with the [Appmon] trait and 1 card with the [Leviathan] trait among them to the hand. Return the rest to the bottom of the deck.";
  51. }
  52. bool CanSelectCardCondition(CardSource cardSource)
  53. {
  54. return cardSource.HasAppmonTraits;
  55. }
  56. bool CanSelectCardCondition1(CardSource cardSource)
  57. {
  58. return cardSource.HasLeviathanTraits;
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.IsExistOnBattleArea(card)
  63. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.IsExistOnBattleArea(card)
  68. && card.Owner.LibraryCards.Count >= 1;
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  73. revealCount: 3,
  74. simplifiedSelectCardConditions:
  75. new SimplifiedSelectCardConditionClass[]
  76. {
  77. new SimplifiedSelectCardConditionClass(
  78. canTargetCondition:CanSelectCardCondition,
  79. message: "Select 1 card with [Appmon] trait",
  80. mode: SelectCardEffect.Mode.AddHand,
  81. maxCount: 1,
  82. selectCardCoroutine: null),
  83. new SimplifiedSelectCardConditionClass(
  84. canTargetCondition:CanSelectCardCondition1,
  85. message: "Select 1 card with [Leviathan] trait.",
  86. mode: SelectCardEffect.Mode.AddHand,
  87. maxCount: 1,
  88. selectCardCoroutine: null),
  89. },
  90. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  91. activateClass: activateClass
  92. ));
  93. }
  94. }
  95. #endregion
  96. #region Link Effect
  97. if (timing == EffectTiming.OnAllyAttack)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect("By trashing 1 linked card, return 1 [appmon] digimon from trash to hand", CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  102. activateClass.SetIsLinkedEffect(true);
  103. cardEffects.Add(activateClass);
  104. string EffectDiscription()
  105. {
  106. return "[When Attacking] By trashing 1 of this Digimon's link cards, you may return 1 [Appmon] trait Digimon card from your trash to the hand.";
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.IsExistOnBattleArea(card)
  111. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsExistOnBattleArea(card)
  116. && HasLinkedCards(card.PermanentOfThisCard().TopCard.PermanentOfThisCard())
  117. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CardCondition);
  118. }
  119. bool CardCondition(CardSource cardSource)
  120. {
  121. return cardSource.IsDigimon
  122. && cardSource.HasAppmonTraits;
  123. }
  124. bool HasLinkedCards(Permanent permanent)
  125. {
  126. return !permanent.HasNoLinkCards;
  127. }
  128. IEnumerator ActivateCoroutine(Hashtable hashtable)
  129. {
  130. Permanent thisCardPermament = card.PermanentOfThisCard().TopCard.PermanentOfThisCard();
  131. if (HasLinkedCards(thisCardPermament))
  132. {
  133. CardSource selectedCard = null;
  134. #region Select Link Card
  135. int maxCount = Math.Min(1, thisCardPermament.LinkedCards.Count);
  136. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  137. selectCardEffect.SetUp(
  138. canTargetCondition: _ => true,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. canNoSelect: () => true,
  142. selectCardCoroutine: SelectCardCoroutine,
  143. afterSelectCardCoroutine: null,
  144. message: "Select 1 linked card to trash.",
  145. maxCount: maxCount,
  146. canEndNotMax: false,
  147. isShowOpponent: true,
  148. mode: SelectCardEffect.Mode.Custom,
  149. root: SelectCardEffect.Root.Custom,
  150. customRootCardList: thisCardPermament.LinkedCards,
  151. canLookReverseCard: true,
  152. selectPlayer: card.Owner,
  153. cardEffect: activateClass);
  154. IEnumerator SelectCardCoroutine(CardSource cardSource)
  155. {
  156. selectedCard = cardSource;
  157. yield return null;
  158. }
  159. selectCardEffect.SetUpCustomMessage("Select 1 linked card to trash.", "The opponent is selecting 1 linked card to trash.");
  160. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  161. #endregion
  162. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashLinkCardsAndProcessAccordingToResult(
  163. targetPermanent: thisCardPermament,
  164. targetLinkCards: new List<CardSource>() { selectedCard },
  165. activateClass: activateClass,
  166. successProcess: SuccessProcess,
  167. failureProcess: null));
  168. IEnumerator SuccessProcess(List<CardSource> trashedLinkCards)
  169. {
  170. if (trashedLinkCards.Any() && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CardCondition))
  171. {
  172. #region Select Trash Digimon
  173. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, CardCondition));
  174. SelectCardEffect selectCardEffect1 = GManager.instance.GetComponent<SelectCardEffect>();
  175. selectCardEffect1.SetUp(
  176. canTargetCondition: CardCondition,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. canNoSelect: () => true,
  180. selectCardCoroutine: null,
  181. afterSelectCardCoroutine: null,
  182. message: "Select 1 [Appmon] trait digimon to return to hand",
  183. maxCount: maxCount1,
  184. canEndNotMax: false,
  185. isShowOpponent: true,
  186. mode: SelectCardEffect.Mode.AddHand,
  187. root: SelectCardEffect.Root.Trash,
  188. customRootCardList: null,
  189. canLookReverseCard: true,
  190. selectPlayer: card.Owner,
  191. cardEffect: activateClass);
  192. selectCardEffect1.SetUpCustomMessage("Select 1 [Appmon] trait digimon to return to hand", "The opponent is selecting 1 [Appmon] trait digimon to return to hand");
  193. yield return ContinuousController.instance.StartCoroutine(selectCardEffect1.Activate());
  194. #endregion
  195. }
  196. }
  197. }
  198. }
  199. }
  200. #endregion
  201. return cardEffects;
  202. }
  203. }
  204. }