EX10_022.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX10
  4. {
  5. public class EX10_022 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Digivolution Requirements
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("Belphemon: Sleep Mode");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region Fortitude
  21. if (timing == EffectTiming.OnDestroyedAnyone)
  22. {
  23. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  24. }
  25. #endregion
  26. #region Start of Your Main Phase
  27. if (timing == EffectTiming.OnStartMainPhase)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Suspend all lvl 5 or lower, then gain <Piercing>, <Security Atk +2>, +3000 DP", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "[Start of Your Main Phase] Suspend all of your opponent's level 5 or lower Digimon. Then, if you have 6 or fewer cards in your hand, this Digimon gains <Piercing> (When this Digimon attacks and deletes an opponent's Digimon and survives the battle, it performs any security checks it normally would.), <Security A. +2> (This Digimon checks 2 additional security cards.) and +3000 DP for the turn.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  40. CardEffectCommons.IsOwnerTurn(card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  45. }
  46. bool CanSelectPermanentCondition(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  49. !permanent.TopCard.CanNotBeAffected(activateClass) &&
  50. permanent.TopCard.HasLevel && permanent.TopCard.Level <= 5;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. #region Suspend All Digimon
  55. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  56. {
  57. List<Permanent> tappedPermanents = new List<Permanent>();
  58. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  59. {
  60. if (CanSelectPermanentCondition(permanent))
  61. {
  62. tappedPermanents.Add(permanent);
  63. }
  64. }
  65. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(tappedPermanents, hashtable).Tap());
  66. }
  67. #endregion
  68. if(card.Owner.HandCards.Count <= 6)
  69. {
  70. Permanent permanent = card.PermanentOfThisCard();
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  72. targetPermanent: permanent,
  73. effectDuration: EffectDuration.UntilEachTurnEnd,
  74. activateClass: activateClass));
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  76. targetPermanent: permanent,
  77. changeValue: 2,
  78. effectDuration: EffectDuration.UntilEachTurnEnd,
  79. activateClass: activateClass));
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  81. targetPermanent: permanent,
  82. changeValue: 3000,
  83. effectDuration: EffectDuration.UntilEachTurnEnd,
  84. activateClass: activateClass));
  85. }
  86. }
  87. }
  88. #endregion
  89. #region SOYMP/On Play/ When Digivolving Shared
  90. string SharedEffectDiscription(string tag)
  91. {
  92. return $"[{tag}] Delete 1 of your opponent's suspended Digimon or Tamers.";
  93. }
  94. bool SharedCanActivateCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  97. }
  98. bool SharedCanSelectPermanentCondition(Permanent permanent)
  99. {
  100. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  101. (permanent.IsDigimon || permanent.IsTamer) &&
  102. permanent.IsSuspended;
  103. }
  104. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  105. {
  106. if (CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectPermanentCondition))
  107. {
  108. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  109. selectPermanentEffect.SetUp(
  110. selectPlayer: card.Owner,
  111. canTargetCondition: SharedCanSelectPermanentCondition,
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. maxCount: 1,
  115. canNoSelect: false,
  116. canEndNotMax: false,
  117. selectPermanentCoroutine: null,
  118. afterSelectPermanentCoroutine: null,
  119. mode: SelectPermanentEffect.Mode.Destroy,
  120. cardEffect: activateClass);
  121. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  122. }
  123. }
  124. #endregion
  125. #region SOYMP
  126. if (timing == EffectTiming.OnStartMainPhase)
  127. {
  128. ActivateClass activateClass = new ActivateClass();
  129. activateClass.SetUpICardEffect("Delete 1 Suspended Digimon/Tamer", CanUseCondition, card);
  130. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("Start of Your Main Phase"));
  131. cardEffects.Add(activateClass);
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  135. CardEffectCommons.IsOwnerTurn(card);
  136. }
  137. }
  138. #endregion
  139. #region On Play
  140. if (timing == EffectTiming.OnEnterFieldAnyone)
  141. {
  142. ActivateClass activateClass = new ActivateClass();
  143. activateClass.SetUpICardEffect("Delete 1 Suspended Digimon/Tamer", CanUseCondition, card);
  144. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("On Play"));
  145. cardEffects.Add(activateClass);
  146. bool CanUseCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  149. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  150. }
  151. }
  152. #endregion
  153. #region When Digivolving
  154. if (timing == EffectTiming.OnEnterFieldAnyone)
  155. {
  156. ActivateClass activateClass = new ActivateClass();
  157. activateClass.SetUpICardEffect("Delete 1 Suspended Digimon/Tamer", CanUseCondition, card);
  158. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDiscription("When Digivolving"));
  159. cardEffects.Add(activateClass);
  160. bool CanUseCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  163. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  164. }
  165. }
  166. #endregion
  167. #region End Of Opponents Turn
  168. if (timing == EffectTiming.OnEndTurn)
  169. {
  170. ActivateClass activateClass = new ActivateClass();
  171. activateClass.SetUpICardEffect("Trash the top card of this Digimon", CanUseCondition, card);
  172. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  173. activateClass.SetIsInheritedEffect(true);
  174. cardEffects.Add(activateClass);
  175. string EffectDiscription()
  176. {
  177. return "[End of Opponent's Turn] If this Digimon is [Belphemon: Sleep Mode], trash the top card of this Digimon. ";
  178. }
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. if (isExistOnField(card))
  182. {
  183. return true;
  184. }
  185. return false;
  186. }
  187. bool CanActivateCondition(Hashtable hashtable)
  188. {
  189. if (isExistOnField(card))
  190. {
  191. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  192. {
  193. if (CardEffectCommons.IsOpponentTurn(card))
  194. {
  195. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  196. {
  197. if (card.PermanentOfThisCard().TopCard.EqualsCardName("Belphemon: Sleep Mode"))
  198. {
  199. return true;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. return false;
  206. }
  207. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  208. {
  209. if (isExistOnField(card))
  210. {
  211. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  212. {
  213. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  214. {
  215. Permanent permanent = card.PermanentOfThisCard();
  216. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  217. CardSource cardSource = permanent.TopCard;
  218. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource));
  219. if (!cardSource.IsToken)
  220. {
  221. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
  222. }
  223. permanent.ShowingPermanentCard.ShowPermanentData(true);
  224. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(cardSource, permanent));
  225. }
  226. }
  227. }
  228. }
  229. }
  230. #endregion
  231. return cardEffects;
  232. }
  233. }
  234. }