BT17_056.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT17
  4. {
  5. public class BT17_056 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region All Turns - Attack Target Switched
  11. if (timing == EffectTiming.OnAttackTargetChanged)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal 3, Place 1 [Parasitemon] or 1 black level 5 or lower Digimon as bottom digivolution source", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  16. activateClass.SetHashString("Reveal_BT17_056");
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[All Turns] [Once Per Turn] When an attack target is switched, reveal the top 3 cards of your deck. Place 1 [Parasitemon] or 1 black level 5 or lower Digimon card among them as this Digimon's bottom digivolution card. Trash the rest.";
  21. }
  22. bool IsSelectableSource(CardSource source)
  23. {
  24. if(source.EqualsCardName("Parasitemon"))
  25. return true;
  26. if (source.IsDigimon)
  27. {
  28. if (source.HasCardColor(CardColor.Black))
  29. {
  30. if (source.HasLevel && source.Level <= 5)
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  47. revealCount: 3,
  48. simplifiedSelectCardConditions:
  49. new SimplifiedSelectCardConditionClass[]
  50. {
  51. new SimplifiedSelectCardConditionClass(
  52. canTargetCondition:IsSelectableSource,
  53. message: "Select 1 [Parasitemon] or Black Level 5 or lower Digimon.",
  54. mode: SelectCardEffect.Mode.Custom,
  55. maxCount: 1,
  56. selectCardCoroutine: SelectedCardToSources),
  57. },
  58. remainingCardsPlace: RemainingCardsPlace.Trash,
  59. activateClass: activateClass,
  60. canNoSelect: false
  61. ));
  62. IEnumerator SelectedCardToSources (CardSource source)
  63. {
  64. if(source != null)
  65. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource> { source }, activateClass));
  66. }
  67. }
  68. }
  69. #endregion
  70. #region All Turns - Digivolution Source Added
  71. if (timing == EffectTiming.OnAddDigivolutionCards)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect("Digivolve into [GroundLocomon]", CanUseCondition, card);
  75. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  76. cardEffects.Add(activateClass);
  77. string EffectDiscription()
  78. {
  79. return "[All Turns] When one of your Digimon's effects adds to this Digimon's digivolution cards, this Digimon may digivolve into [GroundLocomon] in the hand without paying the cost.";
  80. }
  81. bool IsGroundLocomon(CardSource source)
  82. {
  83. if (source.EqualsCardName("GroundLocomon"))
  84. {
  85. if (source.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, true, activateClass, SelectCardEffect.Root.Hand))
  86. return true;
  87. }
  88. return false;
  89. }
  90. bool IsThisDigimon(Permanent permanent)
  91. {
  92. return permanent == card.PermanentOfThisCard();
  93. }
  94. bool IsMyDigimonEffect(ICardEffect effect)
  95. {
  96. if (effect.EffectSourceCard != null)
  97. {
  98. if (effect.EffectSourceCard.Owner == card.Owner)
  99. {
  100. return effect.EffectSourceCard.IsDigimon;
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  108. {
  109. if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  110. hashtable: hashtable,
  111. permanentCondition: IsThisDigimon,
  112. cardEffectCondition: IsMyDigimonEffect,
  113. cardCondition: null))
  114. {
  115. return CardEffectCommons.HasMatchConditionOwnersHand(card, IsGroundLocomon);
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  127. targetPermanent: card.PermanentOfThisCard(),
  128. cardCondition: IsGroundLocomon,
  129. payCost: false,
  130. reduceCostTuple: null,
  131. fixedCostTuple: null,
  132. ignoreDigivolutionRequirementFixedCost: -1,
  133. isHand: true,
  134. activateClass: activateClass,
  135. successProcess: null));
  136. }
  137. }
  138. #endregion
  139. #region All Turns - ESS
  140. if (timing == EffectTiming.OnCounterTiming)
  141. {
  142. bool condition()
  143. {
  144. if(card.PermanentOfThisCard().TopCard != card)
  145. return card.PermanentOfThisCard().TopCard.ContainsTraits("Machine");
  146. return false;
  147. }
  148. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(
  149. isInheritedEffect: true,
  150. card: card,
  151. condition: condition));
  152. }
  153. #endregion
  154. return cardEffects;
  155. }
  156. }
  157. }