BT5_089.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. public class BT5_089 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +2", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Turn] If your opponent has a suspended Digimon in play, gain 2 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (CardEffectCommons.IsOwnerTurn(card))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.IsSuspended))
  39. {
  40. if (card.Owner.CanAddMemory(activateClass))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  51. }
  52. }
  53. if (timing == EffectTiming.OnAllyAttack)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  58. cardEffects.Add(activateClass);
  59. string EffectDiscription()
  60. {
  61. return "[Your Turn] When you attack with a level 5 green Digimon, you may suspend this Tamer to reveal 3 cards from the top of your deck. You may digivolve 1 green level 6 Digimon card among them onto the attacking Digimon without paying its memory cost. Place the remaining cards at the bottom of your deck in any order.";
  62. }
  63. bool CanSelectCardCondition(CardSource cardSource)
  64. {
  65. if (cardSource.IsDigimon)
  66. {
  67. if (cardSource.Level == 6)
  68. {
  69. if (cardSource.HasCardColor(CardColor.Green))
  70. {
  71. if (GManager.instance.attackProcess.AttackingPermanent != null)
  72. {
  73. if (GManager.instance.attackProcess.AttackingPermanent.TopCard != null)
  74. {
  75. if (cardSource.CanPlayCardTargetFrame(GManager.instance.attackProcess.AttackingPermanent.PermanentFrame, false, activateClass))
  76. {
  77. if (cardSource.HasLevel)
  78. {
  79. return true;
  80. }
  81. }
  82. }
  83. }
  84. }
  85. }
  86. }
  87. return false;
  88. }
  89. bool PermanentCondition(Permanent permanent)
  90. {
  91. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  92. {
  93. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  94. {
  95. if (permanent.Level == 5)
  96. {
  97. if (permanent.TopCard.HasLevel)
  98. {
  99. return true;
  100. }
  101. }
  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.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  113. {
  114. return true;
  115. }
  116. }
  117. }
  118. return false;
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. if (CardEffectCommons.IsExistOnBattleArea(card))
  123. {
  124. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  134. List<CardSource> selectedCards = new List<CardSource>();
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  136. revealCount: 3,
  137. simplifiedSelectCardConditions:
  138. new SimplifiedSelectCardConditionClass[]
  139. {
  140. new SimplifiedSelectCardConditionClass(
  141. canTargetCondition:CanSelectCardCondition,
  142. message: "Select 1 green level 6 Digimon card.",
  143. mode: SelectCardEffect.Mode.Custom,
  144. maxCount: 1,
  145. selectCardCoroutine: SelectCardCoroutine),
  146. },
  147. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  148. activateClass: activateClass,
  149. canNoSelect: true
  150. ));
  151. IEnumerator SelectCardCoroutine(CardSource cardSource)
  152. {
  153. selectedCards.Add(cardSource);
  154. yield return null;
  155. }
  156. yield return ContinuousController.instance.StartCoroutine(new PlayCardClass(
  157. cardSources: selectedCards,
  158. hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
  159. payCost: false,
  160. targetPermanent: GManager.instance.attackProcess.AttackingPermanent,
  161. isTapped: false,
  162. root: SelectCardEffect.Root.Library,
  163. activateETB: true).PlayCard());
  164. }
  165. }
  166. if (timing == EffectTiming.SecuritySkill)
  167. {
  168. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  169. }
  170. return cardEffects;
  171. }
  172. }