EX6_057.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.EX6
  9. {
  10. public class EX6_057 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region On Play
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Give 1 opponent Digimon [End of Your Turn] Delete this Digimon.", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Play] Until the end of your opponent's turn, 1 of your opponent's Digimon gains [End of Your Turn] Delete this Digimon.";
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOnPlay(hashtable,card);
  29. }
  30. bool CanActivateCondition(Hashtable hashtable)
  31. {
  32. if(CardEffectCommons.IsExistOnBattleArea(card))
  33. {
  34. return true;
  35. }
  36. return false;
  37. }
  38. bool CanSelectPermanentCondition(Permanent permanent)
  39. {
  40. if(CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent,card))
  41. {
  42. return true;
  43. }
  44. return false;
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  49. {
  50. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectPermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: maxCount,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: SelectPermanentCoroutine,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. selectPermanentEffect.SetUpCustomMessage(
  65. "Select 1 Digimon that will get [End of Your Turn] Delete this Digimon.",
  66. "The opponent is selecting 1 Digimon that will get [End of Your Turn] Delete this Digimon.");
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  69. {
  70. Permanent selectedPermanent = permanent;
  71. if (selectedPermanent != null)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  74. }
  75. if (selectedPermanent != null)
  76. {
  77. ActivateClass activateClass1 = new ActivateClass();
  78. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, selectedPermanent.TopCard);
  79. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  80. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  81. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  82. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetDetailEffect);
  83. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  84. {
  85. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  86. }
  87. string EffectDiscription1()
  88. {
  89. return "[End of Your Turn] Delete this Digimon.";
  90. }
  91. bool CanUseCondition1(Hashtable hashtable1)
  92. {
  93. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  94. {
  95. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  96. {
  97. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  98. {
  99. return true;
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition1(Hashtable hashtable1)
  106. {
  107. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  108. {
  109. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  117. {
  118. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  121. new List<Permanent>() { selectedPermanent },
  122. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  123. }
  124. }
  125. ICardEffect GetCardEffect(EffectTiming _timing)
  126. {
  127. if (_timing == EffectTiming.OnEndTurn)
  128. {
  129. return activateClass1;
  130. }
  131. return null;
  132. }
  133. ICardEffect GetDetailEffect(EffectTiming timing)
  134. {
  135. if (timing == EffectTiming.None)
  136. {
  137. return PermanentEffectFactory.AddDetailClass(permanent, "[End of your turn] Delete this Digimon", true, activateClass);
  138. }
  139. return null;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. #endregion
  147. #region When Digivolving
  148. if (timing == EffectTiming.OnEnterFieldAnyone)
  149. {
  150. ActivateClass activateClass = new ActivateClass();
  151. activateClass.SetUpICardEffect("Give 1 opponent Digimon [End of Your Turn] Delete this Digimon.", CanUseCondition, card);
  152. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  153. cardEffects.Add(activateClass);
  154. string EffectDiscription()
  155. {
  156. return "[When Digivolving] Until the end of your opponent's turn, 1 of your opponent's Digimon gains [End of Your Turn] Delete this Digimon.";
  157. }
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  161. }
  162. bool CanActivateCondition(Hashtable hashtable)
  163. {
  164. if (CardEffectCommons.IsExistOnBattleArea(card))
  165. {
  166. return true;
  167. }
  168. return false;
  169. }
  170. bool CanSelectPermanentCondition(Permanent permanent)
  171. {
  172. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  173. {
  174. return true;
  175. }
  176. return false;
  177. }
  178. IEnumerator ActivateCoroutine(Hashtable hashtable)
  179. {
  180. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  181. {
  182. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  183. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  184. selectPermanentEffect.SetUp(
  185. selectPlayer: card.Owner,
  186. canTargetCondition: CanSelectPermanentCondition,
  187. canTargetCondition_ByPreSelecetedList: null,
  188. canEndSelectCondition: null,
  189. maxCount: maxCount,
  190. canNoSelect: false,
  191. canEndNotMax: false,
  192. selectPermanentCoroutine: SelectPermanentCoroutine,
  193. afterSelectPermanentCoroutine: null,
  194. mode: SelectPermanentEffect.Mode.Custom,
  195. cardEffect: activateClass);
  196. selectPermanentEffect.SetUpCustomMessage(
  197. "Select 1 Digimon that will get [End of Your Turn] Delete this Digimon.",
  198. "The opponent is selecting 1 Digimon that will get [End of Your Turn] Delete this Digimon.");
  199. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  200. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  201. {
  202. Permanent selectedPermanent = permanent;
  203. if (selectedPermanent != null)
  204. {
  205. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  206. }
  207. if (selectedPermanent != null)
  208. {
  209. ActivateClass activateClass1 = new ActivateClass();
  210. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, selectedPermanent.TopCard);
  211. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  212. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  213. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  214. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  215. {
  216. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  217. }
  218. string EffectDiscription1()
  219. {
  220. return "[End of Your Turn] Delete this Digimon.";
  221. }
  222. bool CanUseCondition1(Hashtable hashtable1)
  223. {
  224. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  225. {
  226. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  227. {
  228. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  229. {
  230. return true;
  231. }
  232. }
  233. }
  234. return false;
  235. }
  236. bool CanActivateCondition1(Hashtable hashtable1)
  237. {
  238. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  239. {
  240. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  241. {
  242. return true;
  243. }
  244. }
  245. return false;
  246. }
  247. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  248. {
  249. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  250. {
  251. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  252. new List<Permanent>() { selectedPermanent },
  253. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  254. }
  255. }
  256. ICardEffect GetCardEffect(EffectTiming _timing)
  257. {
  258. if (_timing == EffectTiming.OnEndTurn)
  259. {
  260. return activateClass1;
  261. }
  262. return null;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. #endregion
  270. #region All Turns
  271. if (timing == EffectTiming.WhenRemoveField)
  272. {
  273. ActivateClass activateClass = new ActivateClass();
  274. activateClass.SetUpICardEffect("Delete 1 level 5 or lower Digimon to prevent leaving the battle area", CanUseCondition, card);
  275. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  276. activateClass.SetHashString("Protection_EX6_057");
  277. cardEffects.Add(activateClass);
  278. string EffectDiscription()
  279. {
  280. return "[All Turns] [Once Per Turn] When this Digimon would leave the battle area other than in battle, by deleting 1 level 5 or lower Digimon, prevent it from leaving.";
  281. }
  282. bool CanSelectPermanentCondition(Permanent permanent)
  283. {
  284. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  285. {
  286. if (permanent.Level <= 5)
  287. {
  288. return true;
  289. }
  290. }
  291. return false;
  292. }
  293. bool CanUseCondition(Hashtable hashtable)
  294. {
  295. if (CardEffectCommons.IsExistOnBattleArea(card))
  296. {
  297. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  298. {
  299. if (!CardEffectCommons.IsByBattle(hashtable))
  300. {
  301. return true;
  302. }
  303. }
  304. }
  305. return false;
  306. }
  307. bool CanActivateCondition(Hashtable hashtable)
  308. {
  309. if (CardEffectCommons.IsExistOnBattleArea(card))
  310. {
  311. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  312. {
  313. return true;
  314. }
  315. }
  316. return false;
  317. }
  318. IEnumerator ActivateCoroutine(Hashtable hashtable)
  319. {
  320. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  321. {
  322. int maxCount = 1;
  323. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  324. selectPermanentEffect.SetUp(
  325. selectPlayer: card.Owner,
  326. canTargetCondition: CanSelectPermanentCondition,
  327. canTargetCondition_ByPreSelecetedList: null,
  328. canEndSelectCondition: null,
  329. maxCount: maxCount,
  330. canNoSelect: true,
  331. canEndNotMax: false,
  332. selectPermanentCoroutine: SelectPermanentCoroutine,
  333. afterSelectPermanentCoroutine: null,
  334. mode: SelectPermanentEffect.Mode.Custom,
  335. cardEffect: activateClass);
  336. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  337. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  338. IEnumerator SelectPermanentCoroutine(Permanent _permanent)
  339. {
  340. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { _permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  341. IEnumerator SuccessProcess()
  342. {
  343. card.PermanentOfThisCard().willBeRemoveField = false;
  344. card.PermanentOfThisCard().HideDeleteEffect();
  345. yield return null;
  346. }
  347. }
  348. }
  349. }
  350. }
  351. #endregion
  352. #region Opponent's Turn
  353. if (timing == EffectTiming.OnDestroyedAnyone)
  354. {
  355. ActivateClass activateClass = new ActivateClass();
  356. activateClass.SetUpICardEffect("Trash the top card of your opponent's security", CanUseCondition, card);
  357. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  358. cardEffects.Add(activateClass);
  359. string EffectDiscription()
  360. {
  361. return "[Opponent's Turn] [Once Per Turn] When another Digimon is deleted, trash the top card of your opponent's security stack.";
  362. }
  363. bool PermanentCondition(Permanent permanent)
  364. {
  365. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  366. {
  367. if (permanent.IsDigimon)
  368. {
  369. if (permanent != card.PermanentOfThisCard())
  370. {
  371. return true;
  372. }
  373. }
  374. }
  375. return false;
  376. }
  377. bool CanUseCondition(Hashtable hashtable)
  378. {
  379. if (CardEffectCommons.IsOpponentTurn(card))
  380. {
  381. if (CardEffectCommons.IsExistOnBattleArea(card))
  382. {
  383. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  384. {
  385. return true;
  386. }
  387. }
  388. }
  389. return false;
  390. }
  391. bool CanActivateCondition(Hashtable hashtable)
  392. {
  393. if(CardEffectCommons.IsExistOnBattleArea(card))
  394. {
  395. return true;
  396. }
  397. return false;
  398. }
  399. IEnumerator ActivateCoroutine(Hashtable hashtable)
  400. {
  401. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  402. player: card.Owner.Enemy,
  403. destroySecurityCount: 1,
  404. cardEffect: activateClass,
  405. fromTop: true).DestroySecurity());
  406. }
  407. }
  408. #endregion
  409. return cardEffects;
  410. }
  411. }
  412. }