BT5_088.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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_088 : 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 Digimon with no digivolution cards, 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.HasNoDigivolutionCards))
  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("Trash digivolution cards", 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 blue Digimon, you may suspend this Tamer to trash up to 2 digivolution cards from the bottom of 1 of your opponent's Digimon.";
  62. }
  63. bool CanSelectPermanentCondition(Permanent permanent)
  64. {
  65. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  66. {
  67. if (permanent.DigivolutionCards.Count((cardSource) => !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1)
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. bool PermanentCondition(Permanent permanent)
  75. {
  76. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  77. {
  78. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  79. {
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. if (CardEffectCommons.IsExistOnBattleArea(card))
  88. {
  89. if (CardEffectCommons.IsOwnerTurn(card))
  90. {
  91. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  92. {
  93. return true;
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  113. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: maxCount,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: SelectPermanentCoroutine,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Custom,
  126. cardEffect: activateClass);
  127. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  130. {
  131. Permanent selectedPermanent = permanent;
  132. int maxCount = Math.Min(2, permanent.DigivolutionCards.Count);
  133. SelectCountEffect selectCountEffect = GManager.instance.GetComponent<SelectCountEffect>();
  134. selectCountEffect.SetUp(
  135. SelectPlayer: card.Owner,
  136. targetPermanent: permanent,
  137. MaxCount: maxCount,
  138. CanNoSelect: false,
  139. Message: "How many digivolution cards will you trash?",
  140. Message_Enemy: "The opponent is choosing how many digivolution cards to trash.",
  141. SelectCountCoroutine: SelectCountCoroutine);
  142. yield return ContinuousController.instance.StartCoroutine(selectCountEffect.Activate());
  143. IEnumerator SelectCountCoroutine(int count)
  144. {
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: count, isFromTop: false, activateClass: activateClass));
  146. }
  147. }
  148. }
  149. }
  150. if (timing == EffectTiming.SecuritySkill)
  151. {
  152. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  153. }
  154. return cardEffects;
  155. }
  156. }