EX6_064.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_064 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On PLay
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Beast]/[Beastkin]/[Holy Beast]/[Cherub] trait among them to the hand. Return the rest to the bottom of the deck.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.IsDigimon)
  25. {
  26. if (cardSource.CardTraits.Contains("Beast") || cardSource.ContainsTraits("Beastkin") || cardSource.ContainsTraits("Holy Beast") || cardSource.ContainsTraits("Cherub"))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (card.Owner.LibraryCards.Count >= 1)
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  51. revealCount: 3,
  52. simplifiedSelectCardConditions:
  53. new SimplifiedSelectCardConditionClass[]
  54. {
  55. new SimplifiedSelectCardConditionClass(
  56. canTargetCondition:CanSelectCardCondition,
  57. message: "Select 1 Digimon card with the [Beast]/[Beastkin]/[Holy Beast]/[Cherub] trait.",
  58. mode: SelectCardEffect.Mode.AddHand,
  59. maxCount: 1,
  60. selectCardCoroutine: null),
  61. },
  62. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  63. activateClass: activateClass
  64. ));
  65. }
  66. }
  67. #endregion
  68. #region Your Turn
  69. if (timing == EffectTiming.OnTappedAnyone)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("When an effect suspends your Digimon, one of your Digimon may digivolve from your hand with reduced cost.", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  74. cardEffects.Add(activateClass);
  75. string EffectDiscription()
  76. {
  77. return "[Your Turn] When an effect suspends one of your Digimon, by suspending this Tamer, 1 of your Digimon may digivolve into a Digimon card with the [Beastkin]/[Holy Beast]/[Cherub] trait in your hand with the digivolution cost reduced by 2.";
  78. }
  79. bool CanSelectPermanentCondition(Permanent permanent)
  80. {
  81. if (CardEffectCommons.IsOwnerTurn(card))
  82. {
  83. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  84. {
  85. if (permanent != card.PermanentOfThisCard())
  86. {
  87. foreach (CardSource cardSource in card.Owner.HandCards)
  88. {
  89. if (CanSelectCardCondition(cardSource))
  90. {
  91. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  92. {
  93. return true;
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. return false;
  101. }
  102. bool PermanentCondition(Permanent permanent)
  103. {
  104. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  105. }
  106. bool CanSelectCardCondition(CardSource cardSource)
  107. {
  108. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.ContainsTraits("Beastkin") || cardSource.ContainsTraits("Holy Beast") || cardSource.ContainsTraits("Cherub");
  109. }
  110. bool CanUseCondition(Hashtable hashtable)
  111. {
  112. if (CardEffectCommons.IsExistOnBattleArea(card))
  113. {
  114. if (CardEffectCommons.IsOwnerTurn(card))
  115. {
  116. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  117. {
  118. if (CardEffectCommons.IsByEffect(hashtable, null))
  119. {
  120. return true;
  121. }
  122. }
  123. }
  124. }
  125. return false;
  126. }
  127. bool CanActivateCondition(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.IsExistOnBattleArea(card))
  130. {
  131. if(CardEffectCommons.CanActivateSuspendCostEffect(card))
  132. {
  133. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  134. {
  135. if (card.Owner.HandCards.Count >= 1)
  136. {
  137. return true;
  138. }
  139. }
  140. }
  141. }
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  145. {
  146. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  147. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  148. {
  149. Permanent selectedPermanent = null;
  150. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  151. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  152. selectPermanentEffect.SetUp(
  153. selectPlayer: card.Owner,
  154. canTargetCondition: CanSelectPermanentCondition,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. maxCount: maxCount,
  158. canNoSelect: true,
  159. canEndNotMax: false,
  160. selectPermanentCoroutine: SelectPermanentCoroutine,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Custom,
  163. cardEffect: activateClass);
  164. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  167. {
  168. selectedPermanent = permanent;
  169. yield return null;
  170. }
  171. if (selectedPermanent != null)
  172. {
  173. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  174. targetPermanent: selectedPermanent,
  175. cardCondition: CanSelectCardCondition,
  176. payCost: true,
  177. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  178. fixedCostTuple: null,
  179. ignoreDigivolutionRequirementFixedCost: -1,
  180. isHand: true,
  181. activateClass: activateClass,
  182. successProcess: null));
  183. }
  184. }
  185. }
  186. }
  187. #endregion
  188. #region Security
  189. if (timing == EffectTiming.SecuritySkill)
  190. {
  191. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  192. }
  193. #endregion
  194. return cardEffects;
  195. }
  196. }
  197. }