EX11_072.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. // Unique Emblem: Guardian Vortex
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. public class EX11_072 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Main
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Play 1 [Pteromon]/[Muchomon]/[Shoto Kazama] from hand or trash, then place in battle area", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] You may play 1 [Pteromon], [Muchomon] or [Shoto Kazama] from your hand or trash without paying the cost. Then, place this card in the battle area.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  26. }
  27. bool CanSelectCardCondition(CardSource cardSource)
  28. {
  29. return (cardSource.EqualsCardName("Pteromon")
  30. || cardSource.EqualsCardName("Muchomon")
  31. || cardSource.EqualsCardName("Shoto Kazama"))
  32. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  33. }
  34. IEnumerator ActivateCoroutine(Hashtable hashtable)
  35. {
  36. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  37. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  38. if (canSelectHand || canSelectTrash)
  39. {
  40. #region Setup Location Selection
  41. if (canSelectHand && canSelectTrash)
  42. {
  43. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  44. {
  45. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  46. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  47. };
  48. string selectPlayerMessage = "From which area do you select a card?";
  49. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  50. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  51. }
  52. else
  53. {
  54. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  55. }
  56. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  57. #endregion
  58. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  59. CardSource selectedCard = null;
  60. IEnumerator SelectCardCoroutine(CardSource cardSource)
  61. {
  62. selectedCard = cardSource;
  63. yield return null;
  64. }
  65. #region Hand/Trash Card Selection & Play
  66. if (fromHand)
  67. {
  68. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  69. selectHandEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: CanSelectCardCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: 1,
  75. canNoSelect: true,
  76. canEndNotMax: false,
  77. isShowOpponent: true,
  78. selectCardCoroutine: SelectCardCoroutine,
  79. afterSelectCardCoroutine: null,
  80. mode: SelectHandEffect.Mode.Custom,
  81. cardEffect: activateClass);
  82. selectHandEffect.SetUpCustomMessage("Select 1 [Pteromon]/[Muchomon]/[Shoto Kazama] to play.", "The opponent is selecting 1 [Pteromon]/[Muchomon]/[Shoto Kazama] to play.");
  83. yield return StartCoroutine(selectHandEffect.Activate());
  84. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(
  85. CardEffectCommons.PlayPermanentCards(new List<CardSource>() { selectedCard }, activateClass, false, false, SelectCardEffect.Root.Hand, true));
  86. }
  87. else
  88. {
  89. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  90. selectCardEffect.SetUp(
  91. canTargetCondition: CanSelectCardCondition,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. canNoSelect: () => true,
  95. selectCardCoroutine: SelectCardCoroutine,
  96. afterSelectCardCoroutine: null,
  97. message: "Select 1 [Pteromon]/[Muchomon]/[Shoto Kazama] to play.",
  98. maxCount: 1,
  99. canEndNotMax: false,
  100. isShowOpponent: true,
  101. mode: SelectCardEffect.Mode.Custom,
  102. root: SelectCardEffect.Root.Trash,
  103. customRootCardList: null,
  104. canLookReverseCard: true,
  105. selectPlayer: card.Owner,
  106. cardEffect: activateClass);
  107. selectCardEffect.SetUpCustomMessage("Select 1 [Pteromon]/[Muchomon]/[Shoto Kazama] to play.", "The opponent is selecting 1 [Pteromon]/[Muchomon]/[Shoto Kazama] to play.");
  108. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  109. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(
  110. CardEffectCommons.PlayPermanentCards(new List<CardSource>() { selectedCard }, activateClass, false, false, SelectCardEffect.Root.Trash, true));
  111. }
  112. #endregion
  113. }
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  115. }
  116. }
  117. #endregion
  118. #region Your turn - Delay
  119. if (timing == EffectTiming.OnTappedAnyone)
  120. {
  121. ActivateClass activateClass = new ActivateClass();
  122. activateClass.SetUpICardEffect("1 of your [Avian]/[Bird] in traits or [Vortex Warriors] trait may digivolve into [Bird Dragon]&[LIBERATOR] trait", CanUseCondition, card);
  123. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  124. cardEffects.Add(activateClass);
  125. string EffectDiscription()
  126. {
  127. return "[Your Turn] When any of your [Shoto Kazama]s suspend, <Delay>.\r\n• 1 of your Digimon with [Avian] or [Bird] in any of its traits or the [Vortex Warriors] trait may digivolve into a [Bird Dragon] and the [LIBERATOR] trait Digimon card in the hand with the digivolution cost reduced by 3.";
  128. }
  129. bool CanUseCondition(Hashtable hashtable)
  130. {
  131. return CardEffectCommons.IsExistOnBattleArea(card)
  132. && CardEffectCommons.CanDeclareOptionDelayEffect(card)
  133. && CardEffectCommons.IsOwnerTurn(card)
  134. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsTamer);
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleArea(card);
  139. }
  140. bool IsTamer(Permanent permanent)
  141. {
  142. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  143. && permanent.TopCard.EqualsCardName("Shoto Kazama");
  144. }
  145. bool PermanentCondition(Permanent permanent)
  146. {
  147. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  148. && (permanent.TopCard.HasBirdTraits
  149. || permanent.TopCard.EqualsTraits("Vortex Warriors"));
  150. }
  151. bool CardCondition(CardSource cardSource)
  152. {
  153. return cardSource.IsDigimon
  154. && cardSource.EqualsTraits("Bird Dragon")
  155. && cardSource.EqualsTraits("LIBERATOR");
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable hashtable)
  158. {
  159. bool delaySuccessful = false;
  160. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  161. IEnumerator SuccessProcess()
  162. {
  163. delaySuccessful = true;
  164. yield return null;
  165. }
  166. if (delaySuccessful)
  167. {
  168. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  169. {
  170. Permanent selectedDigimon = null;
  171. #region Select Permanent
  172. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, PermanentCondition));
  173. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  174. selectPermanentEffect.SetUp(
  175. selectPlayer: card.Owner,
  176. canTargetCondition: PermanentCondition,
  177. canTargetCondition_ByPreSelecetedList: null,
  178. canEndSelectCondition: null,
  179. maxCount: maxCount,
  180. canNoSelect: true,
  181. canEndNotMax: false,
  182. selectPermanentCoroutine: SelectPermanentCoroutine,
  183. afterSelectPermanentCoroutine: null,
  184. mode: SelectPermanentEffect.Mode.Custom,
  185. cardEffect: activateClass);
  186. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  187. {
  188. selectedDigimon = permanent;
  189. yield return null;
  190. }
  191. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve", "The opponent is selecting 1 Digimon to digivolve");
  192. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  193. #endregion
  194. if (selectedDigimon != null) yield return ContinuousController.instance.StartCoroutine(
  195. CardEffectCommons.DigivolveIntoHandOrTrashCard(
  196. targetPermanent: selectedDigimon,
  197. cardCondition: CardCondition,
  198. payCost: true,
  199. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  200. fixedCostTuple: null,
  201. ignoreDigivolutionRequirementFixedCost: -1,
  202. isHand: true,
  203. activateClass: activateClass,
  204. successProcess: null
  205. )
  206. );
  207. }
  208. }
  209. }
  210. }
  211. #endregion
  212. #region Security Effect
  213. if (timing == EffectTiming.SecuritySkill)
  214. {
  215. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  216. card: card,
  217. cardEffects: ref cardEffects,
  218. effectName: "Play 1 [Pteromon]/[Muchomon]/[Shoto Kazama] from hand or trash, then place in battle area");
  219. }
  220. #endregion
  221. return cardEffects;
  222. }
  223. }
  224. }