EX8_024.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_024 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsTraits("DS") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region On Play
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Unsuspend 1 of your Digimon", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  26. cardEffects.Add(activateClass);
  27. string EffectDescription() => "[On Play] 1 of your Digimon unsuspends.";
  28. bool CanSelectDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  29. bool CanUseCondition(Hashtable hashtable) => CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  30. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimon);
  31. IEnumerator ActivateCoroutine(Hashtable hashtable)
  32. {
  33. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  34. selectPermanentEffect.SetUp(
  35. selectPlayer: card.Owner,
  36. canTargetCondition_ByPreSelecetedList: null,
  37. canTargetCondition: CanSelectDigimon,
  38. canEndSelectCondition: null,
  39. maxCount: 1,
  40. canNoSelect: false,
  41. canEndNotMax: false,
  42. selectPermanentCoroutine: null,
  43. afterSelectPermanentCoroutine: null,
  44. mode: SelectPermanentEffect.Mode.UnTap,
  45. cardEffect: activateClass);
  46. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend.", "The opponent is selecting 1 Digimon to unsuspend.");
  47. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  48. }
  49. }
  50. #endregion
  51. #region When Digivolving
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("Unsuspend 1 of your Digimon", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  57. cardEffects.Add(activateClass);
  58. string EffectDescription() => "[When Digivolving] 1 of your Digimon unsuspends.";
  59. bool CanSelectYourDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  60. bool CanUseCondition(Hashtable hashtable) => CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) && CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  61. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectYourDigimon);
  62. IEnumerator ActivateCoroutine(Hashtable hashtable)
  63. {
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canTargetCondition: CanSelectYourDigimon,
  69. canEndSelectCondition: null,
  70. maxCount: 1,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: null,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.UnTap,
  76. cardEffect: activateClass);
  77. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend.", "The opponent is selecting 1 Digimon to unsuspend.");
  78. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  79. }
  80. }
  81. #endregion
  82. #region When Attacking
  83. if (timing == EffectTiming.OnAllyAttack)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("1 opponents digimon can't suspend", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  88. activateClass.SetHashString("WhenAttacking_EX8_024");
  89. cardEffects.Add(activateClass);
  90. string EffectDiscription()
  91. {
  92. return "[When Attacking] [Once Per Turn] If you have 1 or more memory, 1 of your opponent's Digimon can't suspend until the end of their turn.";
  93. }
  94. bool OpponentsDigimon(Permanent permanent)
  95. {
  96. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  105. CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon) &&
  106. card.Owner.MemoryForPlayer >= 1;
  107. }
  108. IEnumerator ActivateCoroutine(Hashtable hashtable)
  109. {
  110. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  111. selectPermanentEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canTargetCondition: OpponentsDigimon,
  115. canEndSelectCondition: null,
  116. maxCount: 1,
  117. canNoSelect: false,
  118. canEndNotMax: false,
  119. selectPermanentCoroutine: SelectPermanentCoroutine,
  120. afterSelectPermanentCoroutine: null,
  121. mode: SelectPermanentEffect.Mode.Custom,
  122. cardEffect: activateClass);
  123. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that can't suspend.", "The opponent is selecting 1 Digimon that can't suspend.");
  124. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  125. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  126. {
  127. Permanent selectedPermanent = permanent;
  128. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  129. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  130. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  131. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  132. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  135. }
  136. bool CanUseCondition1(Hashtable hashtable)
  137. {
  138. if (selectedPermanent.TopCard != null)
  139. {
  140. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  141. {
  142. return true;
  143. }
  144. }
  145. return false;
  146. }
  147. bool PermanentCondition(Permanent permanent)
  148. {
  149. if (permanent == selectedPermanent)
  150. {
  151. return true;
  152. }
  153. return false;
  154. }
  155. }
  156. }
  157. }
  158. #endregion
  159. #region When Attacking - ESS
  160. if (timing == EffectTiming.OnAllyAttack)
  161. {
  162. ActivateClass activateClass = new ActivateClass();
  163. activateClass.SetUpICardEffect("Place 1 of your other Digimon as this Digimon's bottom digivolution card to unsuspend this Digimon.", CanUseCondition, card);
  164. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  165. activateClass.SetIsInheritedEffect(true);
  166. activateClass.SetHashString("Attacking_EX8_024");
  167. cardEffects.Add(activateClass);
  168. string EffectDescription()
  169. {
  170. return "[When Attacking] [Once Per Turn] By placing 1 of your other Digimon as this Digimon's bottom digivolution card, it unsuspends.";
  171. }
  172. bool CanSelectPermanentCondition(Permanent permanent)
  173. {
  174. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  175. {
  176. if (permanent != card.PermanentOfThisCard())
  177. {
  178. if (!permanent.TopCard.Equals(card))
  179. return true;
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanUseCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  187. }
  188. bool CanActivateCondition(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.IsExistOnBattleArea(card))
  191. {
  192. if (!card.PermanentOfThisCard().IsToken)
  193. {
  194. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  195. {
  196. return true;
  197. }
  198. }
  199. }
  200. return false;
  201. }
  202. IEnumerator ActivateCoroutine(Hashtable hashtable)
  203. {
  204. List<CardSource> selectedCards = new List<CardSource>();
  205. SelectPermanentEffect selectPermanentEffect =
  206. GManager.instance.GetComponent<SelectPermanentEffect>();
  207. selectPermanentEffect.SetUp(
  208. selectPlayer: card.Owner,
  209. canTargetCondition: CanSelectPermanentCondition,
  210. canTargetCondition_ByPreSelecetedList: null,
  211. canEndSelectCondition: null,
  212. maxCount: 1,
  213. canNoSelect: true,
  214. canEndNotMax: false,
  215. selectPermanentCoroutine: SelectPermanentCoroutine,
  216. afterSelectPermanentCoroutine: null,
  217. mode: SelectPermanentEffect.Mode.Custom,
  218. cardEffect: activateClass);
  219. selectPermanentEffect.SetUpCustomMessage(
  220. "Select 1 card to place on bottom of digivolution cards.",
  221. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  222. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  223. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  224. {
  225. selectedCards.Add(permanent.TopCard);
  226. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(
  227. new List<Permanent[]>() { new Permanent[] { permanent, card.PermanentOfThisCard() } },
  228. false,
  229. activateClass).PlacePermanentToDigivolutionCards());
  230. }
  231. if (selectedCards.Count >= 1)
  232. {
  233. yield return ContinuousController.instance.StartCoroutine(
  234. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() },
  235. activateClass).Unsuspend());
  236. }
  237. }
  238. }
  239. #endregion
  240. return cardEffects;
  241. }
  242. }
  243. }