BT24_032.cs 7.7 KB

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