BT22_016.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //BT22 Mcmon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_016 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alt digivolution
  13. if(timing == EffectTiming.None)
  14. {
  15. bool Condition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.IsDigimon &&
  18. targetPermanent.TopCard.IsLevel2 &&
  19. targetPermanent.TopCard.EqualsTraits("Appmon");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(Condition, 0, false, card, null));
  22. }
  23. #endregion
  24. #region On Play
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Reveal top 3, Add Appmon & Entertainment/Awakening", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. => "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Appmon] trait and 1 card with the [Entertainment] or [Awakening] trait among them to the hand. Return the rest to the bottom of the deck.";
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  36. {
  37. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  47. {
  48. return true;
  49. }
  50. return false;
  51. }
  52. bool CanSelectCardCondition(CardSource cardSource, int searchOption)
  53. {
  54. if (searchOption == 1)
  55. {
  56. return cardSource.EqualsTraits("Appmon");
  57. }
  58. if (searchOption == 2)
  59. {
  60. return cardSource.EqualsTraits("Entertainment") || cardSource.EqualsTraits("Awakening");
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable hashtable)
  65. {
  66. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  67. revealCount: 3,
  68. simplifiedSelectCardConditions:
  69. new SimplifiedSelectCardConditionClass[]
  70. {
  71. new SimplifiedSelectCardConditionClass(
  72. canTargetCondition: cardsource => CanSelectCardCondition(cardsource, 1),
  73. message: "Select 1 card with [Appmon] in its traits.",
  74. mode: SelectCardEffect.Mode.AddHand,
  75. maxCount: 1,
  76. selectCardCoroutine: null),
  77. new SimplifiedSelectCardConditionClass(
  78. canTargetCondition: cardsource => CanSelectCardCondition(cardsource, 2),
  79. message: "Select 1 card with [Entertainment] or [Awakening] in its traits.",
  80. mode: SelectCardEffect.Mode.AddHand,
  81. maxCount: 1,
  82. selectCardCoroutine: null),
  83. },
  84. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  85. activateClass: activateClass
  86. ));
  87. }
  88. }
  89. #endregion
  90. #region Linking process details
  91. if (timing == EffectTiming.None)
  92. {
  93. static bool PermanentCondition(Permanent targetPermanent)
  94. {
  95. return targetPermanent.TopCard.HasAppmonTraits;
  96. }
  97. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 1, card: card));
  98. }
  99. if (timing == EffectTiming.OnDeclaration)
  100. {
  101. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  102. }
  103. #endregion
  104. #region Linking Effect
  105. if(timing == EffectTiming.WhenLinked)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Trash 1 digivolution source", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  110. activateClass.SetIsLinkedEffect(true);
  111. cardEffects.Add(activateClass);
  112. string EffectDescription() => "[When Linking] Trash any 1 digivolution card of 1 of your opponent's Digimon.";
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  116. }
  117. bool CanSelectCardCondition(CardSource cardSource)
  118. {
  119. return !cardSource.CanNotTrashFromDigivolutionCards(activateClass);
  120. }
  121. bool CanSelectPermanentCondition(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  124. permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1;
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  129. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  136. permanentCondition: CanSelectPermanentCondition,
  137. cardCondition: CanSelectCardCondition,
  138. maxCount: 1,
  139. canNoTrash: false,
  140. isFromOnly1Permanent: true,
  141. activateClass: activateClass
  142. ));
  143. }
  144. }
  145. }
  146. #endregion
  147. return cardEffects;
  148. }
  149. }
  150. }