EX3_034.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX3
  6. {
  7. public class EX3_034 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Place 1 [Trial of the Four Great Dragons] in battle area", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] If you don't have a [Trial of the Four Great Dragons] in play, you may place 1 [Trial of the Four Great Dragons] from your hand in your battle area.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.CardNames.Contains("Trial of the Four Great Dragons") || cardSource.CardNames.Contains("TrialoftheFourGreatDragons"))
  25. {
  26. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, isPlayOption: true))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (card.Owner.HandCards.Count >= 1)
  42. {
  43. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardNames.Contains("Trial of the Four Great Dragons") || permanent.TopCard.CardNames.Contains("TrialoftheFourGreatDragons")) == 0)
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  54. {
  55. List<CardSource> selectedCards = new List<CardSource>();
  56. int maxCount = 1;
  57. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  58. selectHandEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectCardCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: true,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. selectCardCoroutine: SelectCardCoroutine,
  68. afterSelectCardCoroutine: null,
  69. mode: SelectHandEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectHandEffect.SetUpCustomMessage("Select 1 card to place in battle area.", "The opponent is selecting 1 card to place in battle area.");
  72. yield return StartCoroutine(selectHandEffect.Activate());
  73. IEnumerator SelectCardCoroutine(CardSource cardSource)
  74. {
  75. selectedCards.Add(cardSource);
  76. yield return null;
  77. }
  78. foreach (CardSource selectedCard in selectedCards)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: selectedCard, cardEffect: activateClass, root: SelectCardEffect.Root.Hand));
  81. }
  82. }
  83. }
  84. }
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  90. activateClass.SetHashString("DP-3000_EX3_034");
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[Your Turn][Once Per Turn] When you play a Digimon with [Four Great Dragons] in its traits or place [Trial of the Four Great Dragons] in your battle area, 1 of your opponent's Digimon gets -3000 DP for the turn.";
  95. }
  96. bool CanSelectPermanentCondition(Permanent permanent)
  97. {
  98. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  99. }
  100. bool PermanentCondition(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  103. {
  104. if (permanent.IsDigimon)
  105. {
  106. if (permanent.TopCard.CardTraits.Contains("Four Great Dragons") || permanent.TopCard.CardTraits.Contains("FourGreatDragons"))
  107. {
  108. return true;
  109. }
  110. }
  111. if (permanent.TopCard.CardNames.Contains("Trial of the Four Great Dragons") || permanent.TopCard.CardNames.Contains("TrialoftheFourGreatDragons"))
  112. {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. if (CardEffectCommons.IsOwnerTurn(card))
  123. {
  124. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  125. {
  126. return true;
  127. }
  128. }
  129. }
  130. return false;
  131. }
  132. bool CanActivateCondition(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.IsExistOnBattleArea(card))
  135. {
  136. return true;
  137. }
  138. return false;
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  141. {
  142. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  143. {
  144. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  145. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  146. selectPermanentEffect.SetUp(
  147. selectPlayer: card.Owner,
  148. canTargetCondition: CanSelectPermanentCondition,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. maxCount: maxCount,
  152. canNoSelect: false,
  153. canEndNotMax: false,
  154. selectPermanentCoroutine: SelectPermanentCoroutine,
  155. afterSelectPermanentCoroutine: null,
  156. mode: SelectPermanentEffect.Mode.Custom,
  157. cardEffect: activateClass);
  158. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  159. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  160. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  161. {
  162. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  163. }
  164. }
  165. }
  166. }
  167. if (timing == EffectTiming.OnEnterFieldAnyone)
  168. {
  169. ActivateClass activateClass = new ActivateClass();
  170. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  171. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  172. activateClass.SetIsInheritedEffect(true);
  173. activateClass.SetHashString("DP-3000_EX3_034_Inherited");
  174. cardEffects.Add(activateClass);
  175. string EffectDiscription()
  176. {
  177. return "[Your Turn][Once Per Turn] When you play a Digimon with [Four Great Dragons] in its traits or place a [Trial of the Four Great Dragons] in your battle area, 1 of your opponent's Digimon gets -3000 DP for the turn.";
  178. }
  179. bool CanSelectPermanentCondition(Permanent permanent)
  180. {
  181. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  182. }
  183. bool PermanentCondition(Permanent permanent)
  184. {
  185. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  186. {
  187. if (permanent.IsDigimon)
  188. {
  189. if (permanent.TopCard.CardTraits.Contains("Four Great Dragons") || permanent.TopCard.CardTraits.Contains("FourGreatDragons"))
  190. {
  191. return true;
  192. }
  193. }
  194. if (permanent.TopCard.CardNames.Contains("Trial of the Four Great Dragons") || permanent.TopCard.CardNames.Contains("TrialoftheFourGreatDragons"))
  195. {
  196. return true;
  197. }
  198. }
  199. return false;
  200. }
  201. bool CanUseCondition(Hashtable hashtable)
  202. {
  203. if (CardEffectCommons.IsExistOnBattleArea(card))
  204. {
  205. if (CardEffectCommons.IsOwnerTurn(card))
  206. {
  207. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  208. {
  209. return true;
  210. }
  211. }
  212. }
  213. return false;
  214. }
  215. bool CanActivateCondition(Hashtable hashtable)
  216. {
  217. if (CardEffectCommons.IsExistOnBattleArea(card))
  218. {
  219. return true;
  220. }
  221. return false;
  222. }
  223. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  224. {
  225. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  226. {
  227. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  228. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  229. selectPermanentEffect.SetUp(
  230. selectPlayer: card.Owner,
  231. canTargetCondition: CanSelectPermanentCondition,
  232. canTargetCondition_ByPreSelecetedList: null,
  233. canEndSelectCondition: null,
  234. maxCount: maxCount,
  235. canNoSelect: false,
  236. canEndNotMax: false,
  237. selectPermanentCoroutine: SelectPermanentCoroutine,
  238. afterSelectPermanentCoroutine: null,
  239. mode: SelectPermanentEffect.Mode.Custom,
  240. cardEffect: activateClass);
  241. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  242. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  243. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  244. {
  245. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  246. }
  247. }
  248. }
  249. }
  250. return cardEffects;
  251. }
  252. }
  253. }