IceStatue_BT11_099.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 IceStatue_BT11_099 : 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.None)
  14. {
  15. ChangeCostClass changeCostClass = new ChangeCostClass();
  16. changeCostClass.SetUpICardEffect($"Play Cost -1", CanUseCondition, card);
  17. changeCostClass.SetUpChangeCostClass(
  18. changeCostFunc: ChangeCost,
  19. cardSourceCondition: CardSourceCondition,
  20. rootCondition: RootCondition,
  21. isUpDown: isUpDown,
  22. isCheckAvailability: () => false,
  23. isChangePayingCost: () => true);
  24. cardEffects.Add(changeCostClass);
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) =>
  28. permanent.TopCard.CardColors.Contains(CardColor.Blue) && permanent.IsTamer))
  29. {
  30. return true;
  31. }
  32. return false;
  33. }
  34. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  35. {
  36. if (CardSourceCondition(cardSource))
  37. {
  38. if (RootCondition(root))
  39. {
  40. if (PermanentsCondition(targetPermanents))
  41. {
  42. Cost -= 1;
  43. }
  44. }
  45. }
  46. return Cost;
  47. }
  48. bool PermanentsCondition(List<Permanent> targetPermanents)
  49. {
  50. return true;
  51. }
  52. bool CardSourceCondition(CardSource cardSource)
  53. {
  54. return cardSource == card;
  55. }
  56. bool RootCondition(SelectCardEffect.Root root)
  57. {
  58. return true;
  59. }
  60. bool isUpDown()
  61. {
  62. return true;
  63. }
  64. }
  65. if (timing == EffectTiming.OptionSkill)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  69. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[Main] Trash the top 3 digivolution cards of 1 of your opponent's Digimon. Then, return 1 of your opponent's Digimon with no digivolution cards to its owner's hand.";
  74. }
  75. bool CanSelectPermanentCondition(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  78. {
  79. return true;
  80. }
  81. return false;
  82. }
  83. bool CanSelectPermanentCondition1(Permanent permanent)
  84. {
  85. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  86. {
  87. if (permanent.HasNoDigivolutionCards)
  88. {
  89. return true;
  90. }
  91. }
  92. return false;
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  101. {
  102. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: SelectPermanentCoroutine,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  119. {
  120. Permanent selectedPermanent = permanent;
  121. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 3, isFromTop: true, activateClass: activateClass));
  122. }
  123. }
  124. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  125. {
  126. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  127. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  128. selectPermanentEffect.SetUp(
  129. selectPlayer: card.Owner,
  130. canTargetCondition: CanSelectPermanentCondition1,
  131. canTargetCondition_ByPreSelecetedList: null,
  132. canEndSelectCondition: null,
  133. maxCount: maxCount,
  134. canNoSelect: false,
  135. canEndNotMax: false,
  136. selectPermanentCoroutine: null,
  137. afterSelectPermanentCoroutine: null,
  138. mode: SelectPermanentEffect.Mode.Bounce,
  139. cardEffect: activateClass);
  140. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  141. }
  142. }
  143. }
  144. if (timing == EffectTiming.SecuritySkill)
  145. {
  146. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  147. card: card,
  148. cardEffects: ref cardEffects,
  149. effectName: $"Trash digivolution cards and return 1 Digimon with no digivolution cards to hand");
  150. }
  151. return cardEffects;
  152. }
  153. }