BT23_039.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Perorimon
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_039 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Static Effects
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasAppmonTraits
  18. && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel2;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 0,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Link Condition
  30. if (timing == EffectTiming.None)
  31. {
  32. static bool PermanentCondition(Permanent targetPermanent)
  33. {
  34. return targetPermanent.TopCard.HasAppmonTraits;
  35. }
  36. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 1, card: card));
  37. }
  38. #endregion
  39. #region Link
  40. if (timing == EffectTiming.OnDeclaration)
  41. {
  42. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  43. }
  44. #endregion
  45. #endregion
  46. #region On Play
  47. if (timing == EffectTiming.OnEnterFieldAnyone)
  48. {
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  51. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  52. cardEffects.Add(activateClass);
  53. string EffectDiscription()
  54. {
  55. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Appmon] trait and 1 card with the [Game] or [Invincible] trait among them to the hand. Return the rest to the bottom of the deck.";
  56. }
  57. bool CanSelectCardCondition(CardSource cardSource)
  58. {
  59. return cardSource.HasAppmonTraits;
  60. }
  61. bool CanSelectCardCondition1(CardSource cardSource)
  62. {
  63. return cardSource.EqualsTraits("Game") || cardSource.EqualsTraits("Invincible");
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.IsExistOnBattleArea(card)
  68. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  69. }
  70. bool CanActivateCondition(Hashtable hashtable)
  71. {
  72. return CardEffectCommons.IsExistOnBattleArea(card)
  73. && card.Owner.LibraryCards.Count >= 1;
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  78. revealCount: 3,
  79. simplifiedSelectCardConditions:
  80. new SimplifiedSelectCardConditionClass[]
  81. {
  82. new SimplifiedSelectCardConditionClass(
  83. canTargetCondition:CanSelectCardCondition,
  84. message: "Select 1 card with [Appmon] trait.",
  85. mode: SelectCardEffect.Mode.AddHand,
  86. maxCount: 1,
  87. selectCardCoroutine: null),
  88. new SimplifiedSelectCardConditionClass(
  89. canTargetCondition:CanSelectCardCondition1,
  90. message: "Select 1 [Game] or [Invincible (App Name)] trait.",
  91. mode: SelectCardEffect.Mode.AddHand,
  92. maxCount: 1,
  93. selectCardCoroutine: null),
  94. },
  95. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  96. activateClass: activateClass
  97. ));
  98. }
  99. }
  100. #endregion
  101. #region When Linking
  102. if (timing == EffectTiming.WhenLinked)
  103. {
  104. ActivateClass activateClass = new ActivateClass();
  105. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  106. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  107. activateClass.SetIsLinkedEffect(true);
  108. cardEffects.Add(activateClass);
  109. string EffectDiscription()
  110. {
  111. return "[When Linking] You may suspend 1 of your opponent's Digimon.";
  112. }
  113. bool IsOpponentsDigimon(Permanent permanent)
  114. {
  115. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  116. }
  117. bool CanUseCondition(Hashtable hashtable)
  118. {
  119. return CardEffectCommons.IsExistOnField(card)
  120. && CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  121. }
  122. bool CanActivateCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.IsExistOnField(card) &&
  125. CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  130. selectPermanentEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: IsOpponentsDigimon,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: 1,
  136. canNoSelect: true,
  137. canEndNotMax: false,
  138. selectPermanentCoroutine: null,
  139. afterSelectPermanentCoroutine: null,
  140. mode: SelectPermanentEffect.Mode.Tap,
  141. cardEffect: activateClass);
  142. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  143. }
  144. }
  145. #endregion
  146. return cardEffects;
  147. }
  148. }
  149. }