EX4_047.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_047 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Your 1 Digimon gains Blocker and De-Digivolve 1 on 1 Digimon", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Until the end of your opponent's turn, 1 of your Digimon gains <Blocker>. If DigiXrosing, <De-Digivolve 1> 1 of your opponent's Digimon.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanSelectPermanentCondition1(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (isExistOnField(card))
  36. {
  37. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  38. {
  39. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  40. {
  41. return true;
  42. }
  43. if (hashtable != null)
  44. {
  45. if (hashtable.ContainsKey("DigiXrosCount"))
  46. {
  47. if (hashtable["DigiXrosCount"] is int)
  48. {
  49. int DigiXrosCount = (int)hashtable["DigiXrosCount"];
  50. if (DigiXrosCount >= 1)
  51. {
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  53. {
  54. return true;
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  65. {
  66. if (isExistOnField(card))
  67. {
  68. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  69. {
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectPermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: SelectPermanentCoroutine,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker.", "The opponent is selecting 1 Digimon that will get Blocker.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  91. }
  92. }
  93. if (_hashtable != null)
  94. {
  95. if (_hashtable.ContainsKey("DigiXrosCount"))
  96. {
  97. if (_hashtable["DigiXrosCount"] is int)
  98. {
  99. int DigiXrosCount = (int)_hashtable["DigiXrosCount"];
  100. if (DigiXrosCount >= 1)
  101. {
  102. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  103. {
  104. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectPermanentCondition1,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: CanEndSelectCondition,
  111. maxCount: maxCount,
  112. canNoSelect: false,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: SelectPermanentCoroutine,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. bool CanEndSelectCondition(List<Permanent> permanents)
  121. {
  122. if (permanents.Count <= 0)
  123. {
  124. return false;
  125. }
  126. return true;
  127. }
  128. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  129. {
  130. Permanent selectedPermanent = permanent;
  131. if (selectedPermanent != null)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  134. }
  135. yield return null;
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. if (timing == EffectTiming.OnDestroyedAnyone)
  147. {
  148. ActivateClass activateClass = new ActivateClass();
  149. activateClass.SetUpICardEffect("Reveal the top 2 cards of deck", CanUseCondition, card);
  150. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  151. cardEffects.Add(activateClass);
  152. string EffectDiscription()
  153. {
  154. return "[On Deletion] Reveal the top 2 cards of your deck. Add 1 card with the [Blue Flare] or [Twilight] trait among them to your hand. Trash the rest.";
  155. }
  156. bool CanSelectCardCondition(CardSource cardSource)
  157. {
  158. if (cardSource.CardTraits.Contains("Blue Flare") || cardSource.CardTraits.Contains("BlueFlare"))
  159. {
  160. return true;
  161. }
  162. if (cardSource.CardTraits.Contains("Twilight"))
  163. {
  164. return true;
  165. }
  166. return false;
  167. }
  168. bool CanUseCondition(Hashtable hashtable)
  169. {
  170. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  171. }
  172. bool CanActivateCondition(Hashtable hashtable)
  173. {
  174. if (CardEffectCommons.IsExistOnTrash(card))
  175. {
  176. if (card.Owner.LibraryCards.Count >= 1)
  177. {
  178. return true;
  179. }
  180. }
  181. return false;
  182. }
  183. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  184. {
  185. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  186. revealCount: 2,
  187. simplifiedSelectCardConditions:
  188. new SimplifiedSelectCardConditionClass[]
  189. {
  190. new SimplifiedSelectCardConditionClass(
  191. canTargetCondition:CanSelectCardCondition,
  192. message: "Select 1 card with the [Blue Flare] or [Twilight] trait.",
  193. mode: SelectCardEffect.Mode.AddHand,
  194. maxCount: 1,
  195. selectCardCoroutine: null),
  196. },
  197. remainingCardsPlace: RemainingCardsPlace.Trash,
  198. activateClass: activateClass
  199. ));
  200. }
  201. }
  202. if (timing == EffectTiming.None)
  203. {
  204. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  205. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  206. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  207. addDigiXrosConditionClass.SetNotShowUI(true);
  208. cardEffects.Add(addDigiXrosConditionClass);
  209. bool CanUseCondition(Hashtable hashtable)
  210. {
  211. return true;
  212. }
  213. DigiXrosCondition GetDigiXros(CardSource cardSource)
  214. {
  215. if (cardSource == card)
  216. {
  217. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "SkullKnightmon");
  218. bool CanSelectCardCondition(CardSource cardSource)
  219. {
  220. if (cardSource != null)
  221. {
  222. if (cardSource.Owner == card.Owner)
  223. {
  224. if (cardSource.IsDigimon)
  225. {
  226. if (cardSource.CardNames_DigiXros.Contains("SkullKnightmon"))
  227. {
  228. return true;
  229. }
  230. }
  231. }
  232. }
  233. return false;
  234. }
  235. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "DeadlyAxemon");
  236. bool CanSelectCardCondition1(CardSource cardSource)
  237. {
  238. if (cardSource != null)
  239. {
  240. if (cardSource.Owner == card.Owner)
  241. {
  242. if (cardSource.IsDigimon)
  243. {
  244. if (cardSource.CardNames_DigiXros.Contains("DeadlyAxemon"))
  245. {
  246. return true;
  247. }
  248. }
  249. }
  250. }
  251. return false;
  252. }
  253. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1 };
  254. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  255. return digiXrosCondition;
  256. }
  257. return null;
  258. }
  259. }
  260. if (timing == EffectTiming.OnAllyAttack)
  261. {
  262. ActivateClass activateClass = new ActivateClass();
  263. activateClass.SetUpICardEffect("Switch attack target to this Digimon", CanUseCondition, card);
  264. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  265. activateClass.SetIsInheritedEffect(true);
  266. activateClass.SetHashString("Switch_EX4_047");
  267. cardEffects.Add(activateClass);
  268. string EffectDiscription()
  269. {
  270. return "[Opponent's Turn][Once Per Turn] When an opponent's Digimon attacks, if this Digimon is [GreyKnightsmon], you may switch the target of attack to this Digimon. ";
  271. }
  272. bool PermanentCondition(Permanent permanent)
  273. {
  274. return CardEffectCommons.IsOpponentPermanent(permanent, card);
  275. }
  276. bool CanUseCondition(Hashtable hashtable)
  277. {
  278. if (CardEffectCommons.IsExistOnBattleArea(card))
  279. {
  280. if (CardEffectCommons.IsOpponentTurn(card))
  281. {
  282. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  283. {
  284. return true;
  285. }
  286. }
  287. }
  288. return false;
  289. }
  290. bool CanActivateCondition(Hashtable hashtable)
  291. {
  292. if (CardEffectCommons.IsExistOnBattleArea(card))
  293. {
  294. if (card.PermanentOfThisCard().TopCard.CardNames.Contains("GreyKnightsmon"))
  295. {
  296. return true;
  297. }
  298. }
  299. return false;
  300. }
  301. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  302. {
  303. if (CardEffectCommons.IsExistOnBattleArea(card))
  304. {
  305. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
  306. activateClass,
  307. false,
  308. card.PermanentOfThisCard()));
  309. }
  310. }
  311. }
  312. return cardEffects;
  313. }
  314. }
  315. }