ST16_15.cs 9.9 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 ST16_15 : 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. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.TopCard.ContainsCardName("Matt Ishida") && permanent.IsTamer) >= 1)
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. bool CardCondition(CardSource cardSource)
  28. {
  29. if (cardSource == card)
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. }
  36. if (timing == EffectTiming.OptionSkill)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  40. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. {
  44. return "[Main] Return 1 Digimon card from your trash to the hand. Then, 1 of your Digimon with [Garurumon] in its name gains \"[On Deletion] Play this card without paying the cost\" until the end of your opponent's turn.";
  45. }
  46. bool CanSelectCardCondition(CardSource cardSource)
  47. {
  48. return cardSource.IsDigimon;
  49. }
  50. bool CanSelectPermanentCondition(Permanent permanent)
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent.TopCard.HasGarurumonName)
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  68. {
  69. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  70. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  71. selectCardEffect.SetUp(
  72. canTargetCondition: CanSelectCardCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. canNoSelect: () => false,
  76. selectCardCoroutine: null,
  77. afterSelectCardCoroutine: null,
  78. message: "Select 1 card to add to your hand.",
  79. maxCount: maxCount,
  80. canEndNotMax: false,
  81. isShowOpponent: true,
  82. mode: SelectCardEffect.Mode.AddHand,
  83. root: SelectCardEffect.Root.Trash,
  84. customRootCardList: null,
  85. canLookReverseCard: true,
  86. selectPlayer: card.Owner,
  87. cardEffect: activateClass);
  88. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  89. }
  90. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  91. {
  92. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectPermanentCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: maxCount,
  100. canNoSelect: false,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: SelectPermanentCoroutine,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  109. {
  110. Permanent selectedPermanent = permanent;
  111. if (selectedPermanent != null)
  112. {
  113. CardSource _topCard = selectedPermanent.TopCard;
  114. ActivateClass activateClass1 = new ActivateClass();
  115. activateClass1.SetUpICardEffect("Play this card from trash", CanUseCondition1, selectedPermanent.TopCard);
  116. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  117. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  118. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  119. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  120. string EffectDiscription1()
  121. {
  122. return "[On Deletion] Play this card without paying the cost";
  123. }
  124. bool CanUseCondition1(Hashtable hashtable1)
  125. {
  126. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  127. {
  128. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent, activateClass))
  129. {
  130. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  131. {
  132. return true;
  133. }
  134. }
  135. }
  136. return false;
  137. }
  138. bool CanActivateCondition1(Hashtable hashtable1)
  139. {
  140. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  141. {
  142. CardSource TopCard = CardEffectCommons.GetTopCardFromEffectHashtable(hashtable1);
  143. if (TopCard != null)
  144. {
  145. if (CardEffectCommons.IsExistOnTrash(TopCard))
  146. {
  147. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: TopCard, payCost: false, cardEffect: activateClass1))
  148. {
  149. return true;
  150. }
  151. }
  152. }
  153. }
  154. return false;
  155. }
  156. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  157. {
  158. CardSource TopCard = CardEffectCommons.GetTopCardFromEffectHashtable(_hashtable1);
  159. if (TopCard != null)
  160. {
  161. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  162. cardSources: new List<CardSource>() { TopCard },
  163. activateClass: activateClass1,
  164. payCost: false,
  165. isTapped: false,
  166. root: SelectCardEffect.Root.Trash,
  167. activateETB: true));
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. }
  175. if (timing == EffectTiming.SecuritySkill)
  176. {
  177. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Return 1 card from trash to hand and your 1 Digimon gains effect");
  178. }
  179. return cardEffects;
  180. }
  181. }