EX3_063.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX3
  5. {
  6. public class EX3_063 : 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.None)
  12. {
  13. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  14. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  15. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  16. addJogressConditionClass.SetNotShowUI(true);
  17. cardEffects.Add(addJogressConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. JogressCondition GetJogress(CardSource cardSource)
  23. {
  24. if (cardSource == card)
  25. {
  26. bool PermanentCondition1(Permanent permanent)
  27. {
  28. if (permanent != null)
  29. {
  30. if (permanent.TopCard != null)
  31. {
  32. if (permanent.TopCard.Owner == card.Owner)
  33. {
  34. if (permanent.IsDigimon)
  35. {
  36. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  37. {
  38. if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
  39. {
  40. if (permanent.Levels_ForJogress(card).Contains(5))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool PermanentCondition2(Permanent permanent)
  53. {
  54. if (permanent != null)
  55. {
  56. if (permanent.TopCard != null)
  57. {
  58. if (permanent.TopCard.Owner == card.Owner)
  59. {
  60. if (permanent.IsDigimon)
  61. {
  62. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  63. {
  64. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  65. {
  66. if (permanent.Levels_ForJogress(card).Contains(5))
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. JogressConditionElement[] elements = new JogressConditionElement[]
  79. {
  80. new JogressConditionElement(PermanentCondition1, "a level 5 purple Digimon"),
  81. new JogressConditionElement(PermanentCondition2, "a level 5 red Digimon"),
  82. };
  83. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  84. return jogressCondition;
  85. }
  86. return null;
  87. }
  88. }
  89. if (timing == EffectTiming.OnEnterFieldAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Delete Digimon and Blitz", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[When Digivolving] If DNA digivolving, your opponent chooses 1 of their Digimon. Delete all of their other Digimon. Then, <Blitz>.";
  98. }
  99. bool CanSelectPermanentCondition(Permanent permanent)
  100. {
  101. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  106. {
  107. return true;
  108. }
  109. return false;
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleArea(card))
  114. {
  115. if (CardEffectCommons.IsJogress(hashtable))
  116. {
  117. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  118. {
  119. return true;
  120. }
  121. }
  122. if (CardEffectCommons.CanActivateBlitz(card, activateClass))
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. if (CardEffectCommons.IsJogress(_hashtable))
  132. {
  133. Permanent selectedPermanent = null;
  134. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  135. {
  136. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  137. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  138. selectPermanentEffect.SetUp(
  139. selectPlayer: card.Owner.Enemy,
  140. canTargetCondition: CanSelectPermanentCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: maxCount,
  144. canNoSelect: false,
  145. canEndNotMax: false,
  146. selectPermanentCoroutine: SelectPermanentCoroutine,
  147. afterSelectPermanentCoroutine: null,
  148. mode: SelectPermanentEffect.Mode.Custom,
  149. cardEffect: activateClass);
  150. selectPermanentEffect.SetUpCustomMessage("Select your 1 Digimon.", "The opponent is selecting 1 Digimon.");
  151. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  152. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  153. {
  154. selectedPermanent = permanent;
  155. yield return null;
  156. }
  157. }
  158. bool PermanentCondition(Permanent permanent)
  159. {
  160. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  161. {
  162. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  163. {
  164. if (permanent.CanBeDestroyedBySkill(activateClass))
  165. {
  166. if (permanent != selectedPermanent)
  167. {
  168. return true;
  169. }
  170. }
  171. }
  172. }
  173. return false;
  174. }
  175. List<Permanent> destroyedPermanetns = card.Owner.Enemy.GetBattleAreaDigimons().Filter(PermanentCondition);
  176. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyedPermanetns, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  177. }
  178. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BlitzProcess(card, activateClass));
  179. }
  180. }
  181. if (timing == EffectTiming.OnAllyAttack)
  182. {
  183. ActivateClass activateClass = new ActivateClass();
  184. activateClass.SetUpICardEffect("DP +2000 and this Digimon digivolves", CanUseCondition, card);
  185. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  186. activateClass.SetHashString("DP+2000_EX3_063");
  187. cardEffects.Add(activateClass);
  188. string EffectDiscription()
  189. {
  190. return "[When Attacking][Once Per Turn] This Digimon gets +2000 DP for the turn. Then, this Digimon may digivolve into [Imperialdramon: Fighter Mode] in your hand for the digivolution cost.";
  191. }
  192. bool CanSelectCardCondition(CardSource cardSource)
  193. {
  194. return cardSource.CardNames.Contains("Imperialdramon: Fighter Mode") || cardSource.CardNames.Contains("Imperialdramon:FighterMode");
  195. }
  196. bool CanUseCondition(Hashtable hashtable)
  197. {
  198. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  199. }
  200. bool CanActivateCondition(Hashtable hashtable)
  201. {
  202. if (CardEffectCommons.IsExistOnBattleArea(card))
  203. {
  204. return true;
  205. }
  206. return false;
  207. }
  208. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  209. {
  210. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  211. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  212. targetPermanent: card.PermanentOfThisCard(),
  213. cardCondition: CanSelectCardCondition,
  214. payCost: true,
  215. reduceCostTuple: null,
  216. fixedCostTuple: null,
  217. ignoreDigivolutionRequirementFixedCost: -1,
  218. isHand: true,
  219. activateClass: activateClass,
  220. successProcess: null));
  221. }
  222. }
  223. return cardEffects;
  224. }
  225. }
  226. }