P_161.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_161 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Ignore Color Requirements
  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. return !CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("Bishop Device"));
  22. }
  23. bool CardCondition(CardSource cardSource)
  24. {
  25. return cardSource == card;
  26. }
  27. }
  28. #endregion
  29. #region Shared When Trashed/Main
  30. bool CanSelectPermanentToNoSuspendCondition(Permanent permanent)
  31. {
  32. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  33. {
  34. if (permanent.IsDigimon || permanent.IsTamer)
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. #endregion
  42. #region When Trashed from battle area
  43. if (timing == EffectTiming.OnDestroyedAnyone)
  44. {
  45. ActivateClass activateClass = new ActivateClass();
  46. activateClass.SetUpICardEffect("1 of your opponent's digimon or tamers can't suspend.", CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  48. cardEffects.Add(activateClass);
  49. string EffectDescription()
  50. {
  51. return "When this card is trashed from the battle area, until the end of your opponent's turn, 1 of their Digimon or Tamers can't suspend.";
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentToNoSuspendCondition))
  64. {
  65. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentToNoSuspendCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentToNoSuspendCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: SelectPermanentCoroutine,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will get unable to suspend.",
  80. "The opponent is selecting 1 Digimon or Tamer that will get unable to suspend.");
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  83. {
  84. Permanent selectedPermanent = permanent;
  85. if (selectedPermanent != null)
  86. {
  87. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  88. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition, card);
  89. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  90. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  91. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  92. {
  93. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
  94. .CreateDebuffEffect(selectedPermanent));
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. if (selectedPermanent.TopCard != null)
  99. {
  100. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  101. {
  102. return true;
  103. }
  104. }
  105. return false;
  106. }
  107. bool PermanentCondition(Permanent permanent)
  108. {
  109. return permanent == selectedPermanent;
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. #endregion
  117. #region Main
  118. if (timing == EffectTiming.OptionSkill)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("1 of your opponent's digimon or tamers can't suspend, then place in battle area", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  123. cardEffects.Add(activateClass);
  124. string EffectDescription()
  125. {
  126. return "[Main] Until the end of your opponent's turn, 1 of their Digimon or Tamers can't suspend. Then, place this card in the battle area.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentToNoSuspendCondition))
  135. {
  136. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentToNoSuspendCondition));
  137. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  138. selectPermanentEffect.SetUp(
  139. selectPlayer: card.Owner,
  140. canTargetCondition: CanSelectPermanentToNoSuspendCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: maxCount,
  144. canNoSelect: false,
  145. canEndNotMax: false,
  146. selectPermanentCoroutine: SelectPermanentCoroutine,
  147. afterSelectPermanentCoroutine: null,
  148. mode: SelectPermanentEffect.Mode.Custom,
  149. cardEffect: activateClass);
  150. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will get unable to suspend.",
  151. "The opponent is selecting 1 Digimon or Tamer that will get unable to suspend.");
  152. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  153. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  154. {
  155. Permanent selectedPermanent = permanent;
  156. if (selectedPermanent != null)
  157. {
  158. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  159. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition, card);
  160. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  161. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  162. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  163. {
  164. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>()
  165. .CreateDebuffEffect(selectedPermanent));
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. if (selectedPermanent.TopCard != null)
  170. {
  171. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  172. {
  173. return true;
  174. }
  175. }
  176. return false;
  177. }
  178. bool PermanentCondition(Permanent permanent)
  179. {
  180. return permanent == selectedPermanent;
  181. }
  182. }
  183. }
  184. }
  185. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  186. }
  187. }
  188. #endregion
  189. #region Security Effect
  190. if (timing == EffectTiming.SecuritySkill)
  191. {
  192. ActivateClass activateClass = new ActivateClass();
  193. activateClass.SetUpICardEffect("Return 1 opponent's level 5 or lower Digimon to the bottom of the deck, then add this to hand", CanUseCondition, card);
  194. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  195. activateClass.SetIsSecurityEffect(true);
  196. cardEffects.Add(activateClass);
  197. string EffectDescription()
  198. {
  199. return "[Security] Return 1 of your opponent's level 5 or lower Digimon to the bottom of the deck. Then, add this card to the hand.";
  200. }
  201. bool CanSelectPermanentCondition(Permanent permanent)
  202. {
  203. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  204. {
  205. if (permanent.Level <= 5)
  206. {
  207. if (permanent.TopCard.HasLevel)
  208. {
  209. return true;
  210. }
  211. }
  212. }
  213. return false;
  214. }
  215. bool CanUseCondition(Hashtable hashtable)
  216. {
  217. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  218. }
  219. IEnumerator ActivateCoroutine(Hashtable hashtable)
  220. {
  221. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  222. {
  223. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  224. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  225. selectPermanentEffect.SetUp(
  226. selectPlayer: card.Owner,
  227. canTargetCondition: CanSelectPermanentCondition,
  228. canTargetCondition_ByPreSelecetedList: null,
  229. canEndSelectCondition: null,
  230. maxCount: maxCount,
  231. canNoSelect: false,
  232. canEndNotMax: false,
  233. selectPermanentCoroutine: null,
  234. afterSelectPermanentCoroutine: null,
  235. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  236. cardEffect: activateClass);
  237. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  238. }
  239. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  240. }
  241. }
  242. #endregion
  243. return cardEffects;
  244. }
  245. }
  246. }