EX7_054.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX7
  5. {
  6. public class EX7_054 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Trash 1 card from hand to give 1 Digimon Blocker and Retaliation", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] By trashing 1 card in your hand, 1 of your Digimon gains <Blocker> and <Retaliation> until the end of your opponent's turn.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  25. {
  26. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  27. }
  28. return false;
  29. }
  30. bool CanActivateCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  33. {
  34. if (card.Owner.HandCards.Count >= 1)
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanSelectPermanentCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. if (card.Owner.HandCards.Count >= 1)
  48. {
  49. bool discarded = false;
  50. int discardCount = 1;
  51. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  52. selectHandEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: (cardSource) => true,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: discardCount,
  58. canNoSelect: true,
  59. canEndNotMax: false,
  60. isShowOpponent: true,
  61. selectCardCoroutine: null,
  62. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  63. mode: SelectHandEffect.Mode.Discard,
  64. cardEffect: activateClass);
  65. yield return StartCoroutine(selectHandEffect.Activate());
  66. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  67. {
  68. if (cardSources.Count >= 1)
  69. {
  70. discarded = true;
  71. yield return null;
  72. }
  73. }
  74. if (discarded)
  75. {
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  77. {
  78. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectPermanentCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: SelectPermanentCoroutine,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker and Retaliation.", "The opponent is selecting 1 Digimon that will get Blocker and Retaliation.");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRetaliation(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. #endregion
  105. #region On Deletion
  106. if (timing == EffectTiming.OnDestroyedAnyone)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Trash 1 card from hand to give 1 Digimon Blocker and Retaliation", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[On Deletion] By trashing 1 card in your hand, 1 of your Digimon gains <Blocker> and <Retaliation> until the end of your opponent's turn.";
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  123. {
  124. if (card.Owner.HandCards.Count >= 1)
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. bool CanSelectPermanentCondition(Permanent permanent)
  132. {
  133. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  134. }
  135. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  136. {
  137. if (card.Owner.HandCards.Count >= 1)
  138. {
  139. bool discarded = false;
  140. int discardCount = 1;
  141. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  142. selectHandEffect.SetUp(
  143. selectPlayer: card.Owner,
  144. canTargetCondition: (cardSource) => true,
  145. canTargetCondition_ByPreSelecetedList: null,
  146. canEndSelectCondition: null,
  147. maxCount: discardCount,
  148. canNoSelect: true,
  149. canEndNotMax: false,
  150. isShowOpponent: true,
  151. selectCardCoroutine: null,
  152. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  153. mode: SelectHandEffect.Mode.Discard,
  154. cardEffect: activateClass);
  155. yield return StartCoroutine(selectHandEffect.Activate());
  156. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  157. {
  158. if (cardSources.Count >= 1)
  159. {
  160. discarded = true;
  161. yield return null;
  162. }
  163. }
  164. if (discarded)
  165. {
  166. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  167. {
  168. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition: CanSelectPermanentCondition,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canEndSelectCondition: null,
  175. maxCount: maxCount,
  176. canNoSelect: false,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: SelectPermanentCoroutine,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.Custom,
  181. cardEffect: activateClass);
  182. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker and Retaliation.", "The opponent is selecting 1 Digimon that will get Blocker and Retaliation.");
  183. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  184. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  185. {
  186. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  187. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRetaliation(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. #endregion
  195. #region Inherit
  196. if (timing == EffectTiming.OnAllyAttack)
  197. {
  198. ActivateClass activateClass = new ActivateClass();
  199. activateClass.SetUpICardEffect("End the attack by deleting 1 of your Digimon", CanUseCondition, card);
  200. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  201. activateClass.SetHashString("StopAttack_EX7-054");
  202. activateClass.SetIsInheritedEffect(true);
  203. cardEffects.Add(activateClass);
  204. string EffectDiscription()
  205. {
  206. return "[Opponent's Turn][Once Per Turn] When an opponent's Digimon attacks, by deleting 1 of your other Digimon, end the attack.";
  207. }
  208. bool CanUseCondition(Hashtable hashtable)
  209. {
  210. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  211. {
  212. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, permanent => true))
  213. {
  214. if (CardEffectCommons.IsOpponentTurn(card))
  215. {
  216. return true;
  217. }
  218. }
  219. }
  220. return false;
  221. }
  222. bool CanActivateCondition(Hashtable hashtable)
  223. {
  224. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  225. {
  226. if (CardEffectCommons.IsOpponentTurn(card))
  227. {
  228. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  229. {
  230. return true;
  231. }
  232. }
  233. }
  234. return false;
  235. }
  236. bool CanSelectPermanentCondition(Permanent permanent)
  237. {
  238. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  239. {
  240. if (permanent != card.PermanentOfThisCard())
  241. {
  242. return true;
  243. }
  244. }
  245. return false;
  246. }
  247. IEnumerator ActivateCoroutine(Hashtable hashtable)
  248. {
  249. if (CardEffectCommons.IsExistOnBattleArea(card))
  250. {
  251. int maxCount = 1;
  252. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  253. selectPermanentEffect.SetUp(
  254. selectPlayer: card.Owner,
  255. canTargetCondition: CanSelectPermanentCondition,
  256. canTargetCondition_ByPreSelecetedList: null,
  257. canEndSelectCondition: null,
  258. maxCount: maxCount,
  259. canNoSelect: false,
  260. canEndNotMax: false,
  261. selectPermanentCoroutine: SelectPermanentCoroutine,
  262. afterSelectPermanentCoroutine: null,
  263. mode: SelectPermanentEffect.Mode.Custom,
  264. cardEffect: activateClass);
  265. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  266. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  267. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  268. {
  269. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  270. IEnumerator SuccessProcess()
  271. {
  272. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.EndAttack());
  273. }
  274. }
  275. }
  276. }
  277. }
  278. #endregion
  279. return cardEffects;
  280. }
  281. }
  282. }