ST12_11.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 ST12_11 : 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("Play 1 Digimon from trash", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] You may play 1 [Huckmon] or 1 Digimon card with [Sistermon] in its name in your trash without paying its memory cost.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsDigimon)
  26. {
  27. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  28. {
  29. if (cardSource.CardNames.Contains("Huckmon"))
  30. {
  31. return true;
  32. }
  33. if (cardSource.ContainsCardName("Sistermon"))
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. List<CardSource> selectedCards = new List<CardSource>();
  59. int maxCount = 1;
  60. if (card.Owner.TrashCards.Count(CanSelectCardCondition) <= maxCount)
  61. {
  62. maxCount = card.Owner.TrashCards.Count(CanSelectCardCondition);
  63. }
  64. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  65. selectCardEffect.SetUp(
  66. canTargetCondition: CanSelectCardCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. canNoSelect: () => true,
  70. selectCardCoroutine: SelectCardCoroutine,
  71. afterSelectCardCoroutine: null,
  72. message: "Select 1 card to play.",
  73. maxCount: maxCount,
  74. canEndNotMax: false,
  75. isShowOpponent: true,
  76. mode: SelectCardEffect.Mode.Custom,
  77. root: SelectCardEffect.Root.Trash,
  78. customRootCardList: null,
  79. canLookReverseCard: true,
  80. selectPlayer: card.Owner,
  81. cardEffect: activateClass);
  82. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  83. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  84. yield return StartCoroutine(selectCardEffect.Activate());
  85. IEnumerator SelectCardCoroutine(CardSource cardSource)
  86. {
  87. selectedCards.Add(cardSource);
  88. yield return null;
  89. }
  90. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  91. }
  92. }
  93. if (timing == EffectTiming.OnEnterFieldAnyone)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("De-Digivolve 1 on up to 2 Digimon", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  98. activateClass.SetHashString("De-Digivolve_ST12-11");
  99. cardEffects.Add(activateClass);
  100. string EffectDiscription()
  101. {
  102. return "[Your Turn][Once Per Turn] When you play another Digimon by an effect, <De-Digivolve 1> up to 2 of your opponent's Digimon. (Trash 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.)";
  103. }
  104. bool CanSelectPermanentCondition(Permanent permanent)
  105. {
  106. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  107. }
  108. bool PermanentCondition(Permanent permanent)
  109. {
  110. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  111. {
  112. if (permanent != card.PermanentOfThisCard())
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. bool CanUseCondition(Hashtable hashtable)
  120. {
  121. if (CardEffectCommons.IsExistOnBattleArea(card))
  122. {
  123. if (CardEffectCommons.IsOwnerTurn(card))
  124. {
  125. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  126. {
  127. if (CardEffectCommons.IsByEffect(hashtable, null))
  128. {
  129. return true;
  130. }
  131. }
  132. }
  133. }
  134. return false;
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. if (CardEffectCommons.IsExistOnBattleArea(card))
  139. {
  140. return true;
  141. }
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  145. {
  146. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  147. {
  148. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  149. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  150. selectPermanentEffect.SetUp(
  151. selectPlayer: card.Owner,
  152. canTargetCondition: CanSelectPermanentCondition,
  153. canTargetCondition_ByPreSelecetedList: null,
  154. canEndSelectCondition: CanEndSelectCondition,
  155. maxCount: maxCount,
  156. canNoSelect: false,
  157. canEndNotMax: true,
  158. selectPermanentCoroutine: SelectPermanentCoroutine,
  159. afterSelectPermanentCoroutine: null,
  160. mode: SelectPermanentEffect.Mode.Custom,
  161. cardEffect: activateClass);
  162. selectPermanentEffect.SetUpCustomMessage("Select Digimon to De-Digivolve.", "The opponent is selecting Digimon to De-Digivolve.");
  163. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  164. bool CanEndSelectCondition(List<Permanent> permanents)
  165. {
  166. if (CardEffectCommons.HasNoElement(permanents))
  167. {
  168. return false;
  169. }
  170. return true;
  171. }
  172. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  173. {
  174. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  175. }
  176. }
  177. }
  178. }
  179. return cardEffects;
  180. }
  181. }