ST14_11.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. // Ai & Mako
  9. public class ST14_11 : CEntity_Effect
  10. {
  11. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  12. {
  13. List<ICardEffect> cardEffects = new List<ICardEffect>();
  14. if (timing == EffectTiming.OnEnterFieldAnyone)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[On Play] Reveal the top 4 cards of your deck. Add 1 Digimon card with [Evil], [Wizard], or [Demon Lord] in its traits among them to your hand. Place the rest at the bottom of your deck in any order.";
  23. }
  24. bool CanSelectCardCondition(CardSource cardSource)
  25. {
  26. if (cardSource.IsDigimon)
  27. {
  28. if (cardSource.CardTraits.Contains("Evil"))
  29. {
  30. return true;
  31. }
  32. if (cardSource.CardTraits.Contains("Wizard"))
  33. {
  34. return true;
  35. }
  36. if (cardSource.CardTraits.Contains("Demon Lord"))
  37. {
  38. return true;
  39. }
  40. if (cardSource.CardTraits.Contains("DemonLord"))
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (card.Owner.LibraryCards.Count >= 1)
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  65. revealCount: 4,
  66. simplifiedSelectCardConditions:
  67. new SimplifiedSelectCardConditionClass[]
  68. {
  69. new SimplifiedSelectCardConditionClass(
  70. canTargetCondition:CanSelectCardCondition,
  71. message: "Select 1 Digimon card with [Evil], [Wizard], or [Demon Lord] in its traits.",
  72. mode: SelectCardEffect.Mode.AddHand,
  73. maxCount: 1,
  74. selectCardCoroutine: null),
  75. },
  76. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  77. activateClass: activateClass
  78. ));
  79. }
  80. }
  81. if (timing == EffectTiming.OnEnterFieldAnyone)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("Return 1 card from your hand to deck top and gain Memory +1", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  86. cardEffects.Add(activateClass);
  87. string EffectDiscription()
  88. {
  89. return "[Your Turn] When one of your Digimon digivolves into a purple Digimon, by suspending this Tamer, return 1 card from your hand to the top of your deck and gain 1 memory.";
  90. }
  91. bool CanSelectCardCondition(CardSource cardSource)
  92. {
  93. return true;
  94. }
  95. bool PermanentCondition(Permanent permanent)
  96. {
  97. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  98. {
  99. if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
  100. {
  101. return true;
  102. }
  103. }
  104. return false;
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleArea(card))
  109. {
  110. if (CardEffectCommons.IsOwnerTurn(card))
  111. {
  112. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  113. {
  114. return true;
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanActivateSuspendCostEffect(card);
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  127. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  128. {
  129. int maxCount = 1;
  130. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  131. selectHandEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectCardCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. isShowOpponent: false,
  140. selectCardCoroutine: null,
  141. afterSelectCardCoroutine: null,
  142. mode: SelectHandEffect.Mode.PutLibraryTop,
  143. cardEffect: activateClass);
  144. yield return StartCoroutine(selectHandEffect.Activate());
  145. }
  146. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  147. }
  148. }
  149. if (timing == EffectTiming.SecuritySkill)
  150. {
  151. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  152. }
  153. return cardEffects;
  154. }
  155. }