BT25_007.cs 7.5 KB

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