BT13_091.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_091 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Delete opponent's all level 5 or lower Digimon and this Digimon gets effects", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] Delete all of your opponent's level 5 or lower Digimon. Then, if you have 6 or fewer cards in your hand, this Digimon gets +3000 DP and gains <Security Attack +1> for the turn.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (permanent != null)
  25. {
  26. if (permanent.TopCard != null)
  27. {
  28. if (permanent.IsDigimon)
  29. {
  30. if (permanent.TopCard.Owner == card.Owner.Enemy)
  31. {
  32. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  33. {
  34. if (permanent.Level <= 5)
  35. {
  36. if (permanent.TopCard.HasLevel)
  37. {
  38. if (permanent.CanBeDestroyedBySkill(activateClass))
  39. {
  40. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (CardEffectCommons.IsOwnerTurn(card))
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. if (isExistOnField(card))
  68. {
  69. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  70. {
  71. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  72. {
  73. return true;
  74. }
  75. if (card.Owner.HandCards.Count <= 6)
  76. {
  77. return true;
  78. }
  79. }
  80. }
  81. return false;
  82. }
  83. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  84. {
  85. if (isExistOnField(card))
  86. {
  87. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  88. {
  89. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  90. {
  91. List<Permanent> destroyedPermanetns = new List<Permanent>();
  92. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  93. {
  94. if (CanSelectPermanentCondition(permanent))
  95. {
  96. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  97. {
  98. destroyedPermanetns.Add(permanent);
  99. }
  100. }
  101. }
  102. if (destroyedPermanetns.Count >= 1)
  103. {
  104. Hashtable hashtable = new Hashtable();
  105. hashtable.Add("CardEffect", activateClass);
  106. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyedPermanetns, hashtable).Destroy());
  107. }
  108. }
  109. if (card.Owner.HandCards.Count <= 6)
  110. {
  111. if (isExistOnField(card))
  112. {
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: card.PermanentOfThisCard(), changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  115. }
  116. }
  117. }
  118. }
  119. }
  120. }
  121. if (timing == EffectTiming.OnEndAttack)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Delete your another Digimon to unsuspend this Digimon", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  126. activateClass.SetHashString("Unsuspend_BT13_091");
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[End of Attack][Once Per Turn] By deleting 1 of your other Digimon, unsuspend this Digimon.";
  131. }
  132. bool CanSelectPermanentCondition(Permanent permanent)
  133. {
  134. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  135. {
  136. if (permanent != card.PermanentOfThisCard())
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  146. {
  147. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  148. {
  149. return true;
  150. }
  151. }
  152. return false;
  153. }
  154. bool CanActivateCondition(Hashtable hashtable)
  155. {
  156. if (CardEffectCommons.IsExistOnBattleArea(card))
  157. {
  158. if (card.Owner.CanAddMemory(activateClass))
  159. {
  160. return true;
  161. }
  162. }
  163. return false;
  164. }
  165. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  166. {
  167. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  168. {
  169. int maxCount = Math.Min(1, card.Owner.GetBattleAreaDigimons().Count(CanSelectPermanentCondition));
  170. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  171. selectPermanentEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectPermanentCondition,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: maxCount,
  177. canNoSelect: true,
  178. canEndNotMax: false,
  179. selectPermanentCoroutine: SelectPermanentCoroutine,
  180. afterSelectPermanentCoroutine: null,
  181. mode: SelectPermanentEffect.Mode.Custom,
  182. cardEffect: activateClass);
  183. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  186. {
  187. Permanent thisCardPermanent = card.PermanentOfThisCard();
  188. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  189. IEnumerator SuccessProcess()
  190. {
  191. if (thisCardPermanent.TopCard != null)
  192. {
  193. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { thisCardPermanent }, activateClass).Unsuspend());
  194. }
  195. }
  196. }
  197. }
  198. }
  199. }
  200. if (timing == EffectTiming.OnEndTurn)
  201. {
  202. ActivateClass activateClass = new ActivateClass();
  203. activateClass.SetUpICardEffect("Trash the top card of this Digimon", CanUseCondition, card);
  204. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  205. activateClass.SetIsInheritedEffect(true);
  206. cardEffects.Add(activateClass);
  207. string EffectDiscription()
  208. {
  209. return "[End of Opponent's Turn] If this Digimon is [Belphemon: Sleep Mode], trash the top card of this Digimon. ";
  210. }
  211. bool CanUseCondition(Hashtable hashtable)
  212. {
  213. if (isExistOnField(card))
  214. {
  215. return true;
  216. }
  217. return false;
  218. }
  219. bool CanActivateCondition(Hashtable hashtable)
  220. {
  221. if (isExistOnField(card))
  222. {
  223. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  224. {
  225. if (CardEffectCommons.IsOpponentTurn(card))
  226. {
  227. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  228. {
  229. if (card.PermanentOfThisCard().TopCard.CardNames.Contains("Belphemon: Sleep Mode"))
  230. {
  231. return true;
  232. }
  233. if (card.PermanentOfThisCard().TopCard.CardNames.Contains("Belphemon:SleepMode"))
  234. {
  235. return true;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. return false;
  242. }
  243. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  244. {
  245. if (isExistOnField(card))
  246. {
  247. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  248. {
  249. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  250. {
  251. Permanent permanent = card.PermanentOfThisCard();
  252. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  253. CardSource cardSource = permanent.TopCard;
  254. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource));
  255. if (!cardSource.IsToken)
  256. {
  257. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
  258. }
  259. permanent.ShowingPermanentCard.ShowPermanentData(true);
  260. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(cardSource, permanent));
  261. }
  262. }
  263. }
  264. }
  265. }
  266. return cardEffects;
  267. }
  268. }
  269. }