EX6_035.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_035 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Counter Timing
  13. if (timing == EffectTiming.OnCounterTiming)
  14. {
  15. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  16. }
  17. #endregion
  18. #region Digivolution Condition
  19. if (timing == EffectTiming.None)
  20. {
  21. bool PermanentConditionOne(Permanent targetPermanent)
  22. {
  23. if ((targetPermanent.TopCard.ContainsCardName("Antylamon")))
  24. {
  25. return true;
  26. }
  27. return false;
  28. }
  29. bool PermanentConditionTwo(Permanent targetPermanent)
  30. {
  31. if ((targetPermanent.TopCard.EqualsCardName("Cherubimon")) && (targetPermanent.TopCard.CardColors.Contains(CardColor.Purple)))
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentConditionOne, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  38. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentConditionTwo, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  39. }
  40. #endregion
  41. #region Alliance
  42. if (timing == EffectTiming.OnAllyAttack)
  43. {
  44. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  45. }
  46. #endregion
  47. #region On Play
  48. if (timing == EffectTiming.OnEnterFieldAnyone)
  49. {
  50. int minusDP()
  51. {
  52. int minusDP = 0;
  53. minusDP += 4000 * card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard());
  54. return minusDP;
  55. }
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("Play 1 Digimon from hand, Then -4k DP for each digimon", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  59. activateClass.SetHashString("Play1Digimon_EX6_035");
  60. cardEffects.Add(activateClass);
  61. string EffectDiscription()
  62. {
  63. return "[On Play] You may play 1 level 4 or lower green or yellow Digimon card from your hand without paying the cost. Then, 1 of your opponent's Digimon gets -4000 DP for each of your other Digimon until the end of their turn.";
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  72. }
  73. bool CanSelectPermanentCondition(Permanent permanent)
  74. {
  75. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  76. }
  77. bool CanSelectCardCondition(CardSource cardSource)
  78. {
  79. if (CardEffectCommons.IsExistOnHand(cardSource))
  80. {
  81. if (cardSource.IsDigimon)
  82. {
  83. if (cardSource.HasLevel && cardSource.Level <= 4)
  84. {
  85. if (cardSource.HasCardColor(CardColor.Green) || cardSource.HasCardColor(CardColor.Yellow))
  86. {
  87. return true;
  88. }
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. IEnumerator ActivateCoroutine(Hashtable hashtable)
  95. {
  96. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  97. {
  98. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  99. List<CardSource> selectedCards = new List<CardSource>();
  100. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  101. selectHandEffect.SetUp(
  102. selectPlayer: card.Owner,
  103. canTargetCondition: CanSelectCardCondition,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. maxCount: 1,
  107. canNoSelect: true,
  108. canEndNotMax: false,
  109. isShowOpponent: true,
  110. selectCardCoroutine: SelectCardCoroutine,
  111. afterSelectCardCoroutine: null,
  112. mode: SelectHandEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  115. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  116. yield return StartCoroutine(selectHandEffect.Activate());
  117. IEnumerator SelectCardCoroutine(CardSource cardSource)
  118. {
  119. selectedCards.Add(cardSource);
  120. yield return null;
  121. }
  122. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  123. }
  124. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  125. {
  126. if (CardEffectCommons.IsExistOnBattleArea(card))
  127. {
  128. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  129. {
  130. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  131. int _minusDP = minusDP();
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: maxCount,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: SelectPermanentCoroutine,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Custom,
  144. cardEffect: activateClass);
  145. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will get DP -{_minusDP}.", $"The opponent is selecting 1 Digimon that will get DP -{_minusDP}.");
  146. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  147. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  148. {
  149. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -_minusDP, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  150. }
  151. }
  152. }
  153. }
  154. }
  155. }
  156. #endregion
  157. #region When Digivolving
  158. if (timing == EffectTiming.OnEnterFieldAnyone)
  159. {
  160. int minusDP()
  161. {
  162. int minusDP = 0;
  163. minusDP += 4000 * card.Owner.GetBattleAreaDigimons().Count((permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard());
  164. return minusDP;
  165. }
  166. ActivateClass activateClass = new ActivateClass();
  167. activateClass.SetUpICardEffect("Play 1 Digimon from hand, Then -4k DP for each digimon", CanUseCondition, card);
  168. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  169. activateClass.SetHashString("Play1Digimon_EX6_035");
  170. cardEffects.Add(activateClass);
  171. string EffectDiscription()
  172. {
  173. return "[When Digivolving] You may play 1 level 4 or lower green or yellow Digimon card from your hand without paying the cost. Then, 1 of your opponent's Digimon gets -4000 DP for each of your other Digimon until the end of their turn.";
  174. }
  175. bool CanUseCondition(Hashtable hashtable)
  176. {
  177. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  178. }
  179. bool CanActivateCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  182. }
  183. bool CanSelectPermanentCondition(Permanent permanent)
  184. {
  185. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  186. }
  187. bool CanSelectCardCondition(CardSource cardSource)
  188. {
  189. if (CardEffectCommons.IsExistOnHand(cardSource))
  190. {
  191. if (cardSource.IsDigimon)
  192. {
  193. if(cardSource.HasLevel && cardSource.Level <= 4)
  194. {
  195. if (cardSource.HasCardColor(CardColor.Green) || cardSource.HasCardColor(CardColor.Yellow))
  196. {
  197. return true;
  198. }
  199. }
  200. }
  201. }
  202. return false;
  203. }
  204. IEnumerator ActivateCoroutine(Hashtable hashtable)
  205. {
  206. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  207. {
  208. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  209. List<CardSource> selectedCards = new List<CardSource>();
  210. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  211. selectHandEffect.SetUp(
  212. selectPlayer: card.Owner,
  213. canTargetCondition: CanSelectCardCondition,
  214. canTargetCondition_ByPreSelecetedList: null,
  215. canEndSelectCondition: null,
  216. maxCount: 1,
  217. canNoSelect: true,
  218. canEndNotMax: false,
  219. isShowOpponent: true,
  220. selectCardCoroutine: SelectCardCoroutine,
  221. afterSelectCardCoroutine: null,
  222. mode: SelectHandEffect.Mode.Custom,
  223. cardEffect: activateClass);
  224. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  225. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  226. yield return StartCoroutine(selectHandEffect.Activate());
  227. IEnumerator SelectCardCoroutine(CardSource cardSource)
  228. {
  229. selectedCards.Add(cardSource);
  230. yield return null;
  231. }
  232. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  233. }
  234. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  235. {
  236. if (CardEffectCommons.IsExistOnBattleArea(card))
  237. {
  238. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  239. {
  240. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  241. int _minusDP = minusDP();
  242. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  243. selectPermanentEffect.SetUp(
  244. selectPlayer: card.Owner,
  245. canTargetCondition: CanSelectPermanentCondition,
  246. canTargetCondition_ByPreSelecetedList: null,
  247. canEndSelectCondition: null,
  248. maxCount: maxCount,
  249. canNoSelect: false,
  250. canEndNotMax: false,
  251. selectPermanentCoroutine: SelectPermanentCoroutine,
  252. afterSelectPermanentCoroutine: null,
  253. mode: SelectPermanentEffect.Mode.Custom,
  254. cardEffect: activateClass);
  255. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will get DP -{_minusDP}.", $"The opponent is selecting 1 Digimon that will get DP -{_minusDP}.");
  256. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  257. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  258. {
  259. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -_minusDP, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  260. }
  261. }
  262. }
  263. }
  264. }
  265. }
  266. #endregion
  267. return cardEffects;
  268. }
  269. }
  270. }