BT9_091.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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 BT9_091 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may reveal the top 3 cards of your deck. Add 1 purple or yellow Digimon card among them to your hand. Trash the rest.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsDigimon)
  26. {
  27. if (cardSource.HasCardColor(CardColor.Purple))
  28. {
  29. return true;
  30. }
  31. if (cardSource.HasCardColor(CardColor.Yellow))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.LibraryCards.Count >= 1)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  56. revealCount: 3,
  57. simplifiedSelectCardConditions:
  58. new SimplifiedSelectCardConditionClass[]
  59. {
  60. new SimplifiedSelectCardConditionClass(
  61. canTargetCondition:CanSelectCardCondition,
  62. message: "Select 1 purple or yellow Digimon card.",
  63. mode: SelectCardEffect.Mode.AddHand,
  64. maxCount: 1,
  65. selectCardCoroutine: null),
  66. },
  67. remainingCardsPlace: RemainingCardsPlace.Trash,
  68. activateClass: activateClass
  69. ));
  70. }
  71. }
  72. if (timing == EffectTiming.OnEnterFieldAnyone)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  77. cardEffects.Add(activateClass);
  78. string EffectDiscription()
  79. {
  80. return "[All Turns] When you play a 2-color purple and yellow Digimon, you may suspend this Tamer to gain 1 memory.";
  81. }
  82. bool PermanentCondition(Permanent permanent)
  83. {
  84. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  85. {
  86. if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
  87. {
  88. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  89. {
  90. if (permanent.TopCard.CardColors.Count == 2)
  91. {
  92. return true;
  93. }
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. if (CardEffectCommons.IsExistOnBattleArea(card))
  113. {
  114. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  115. {
  116. return true;
  117. }
  118. }
  119. return false;
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  122. {
  123. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  124. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  125. }
  126. }
  127. if (timing == EffectTiming.SecuritySkill)
  128. {
  129. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  130. }
  131. return cardEffects;
  132. }
  133. }