EX3_064.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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_064 : 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.None)
  13. {
  14. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  15. changeCardNamesClass.SetUpICardEffect("Also treated as [ChaosGallantmon]", CanUseCondition, card);
  16. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  17. cardEffects.Add(changeCardNamesClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  23. {
  24. if (cardSource == card)
  25. {
  26. CardNames.Add("ChaosGallantmon");
  27. }
  28. return CardNames;
  29. }
  30. }
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[On Play] Delete 1 of your opponent's level 5 or lower Digimon. If this card was played by [Trial of the Four Great Dragons]'s effect, add 1 to the maximum level of the Digimon you can delete with this effect.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. int maxLevel = 5;
  50. bool CardEffectCondition(ICardEffect cardEffect)
  51. {
  52. if (cardEffect != null)
  53. {
  54. if (cardEffect.EffectSourceCard != null)
  55. {
  56. if (cardEffect.EffectSourceCard.CardNames.Contains("Trial of the Four Great Dragons")
  57. || cardEffect.EffectSourceCard.CardNames.Contains("TrialoftheFourGreatDragons"))
  58. {
  59. return true;
  60. }
  61. }
  62. }
  63. return false;
  64. }
  65. if (CardEffectCommons.IsByEffect(hashtable, CardEffectCondition))
  66. {
  67. maxLevel++;
  68. }
  69. bool CanSelectPermanentCondition(Permanent permanent)
  70. {
  71. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  72. {
  73. if (permanent.Level <= maxLevel)
  74. {
  75. if (permanent.TopCard.HasLevel)
  76. {
  77. return true;
  78. }
  79. }
  80. }
  81. return false;
  82. }
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  91. {
  92. int maxLevel = 5;
  93. bool CardEffectCondition(ICardEffect cardEffect)
  94. {
  95. if (cardEffect != null)
  96. {
  97. if (cardEffect.EffectSourceCard != null)
  98. {
  99. if (cardEffect.EffectSourceCard.CardNames.Contains("Trial of the Four Great Dragons")
  100. || cardEffect.EffectSourceCard.CardNames.Contains("TrialoftheFourGreatDragons"))
  101. {
  102. return true;
  103. }
  104. }
  105. }
  106. return false;
  107. }
  108. if (CardEffectCommons.IsByEffect(_hashtable, CardEffectCondition))
  109. {
  110. maxLevel++;
  111. }
  112. bool CanSelectPermanentCondition(Permanent permanent)
  113. {
  114. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  115. {
  116. if (permanent.Level <= maxLevel)
  117. {
  118. if (permanent.TopCard.HasLevel)
  119. {
  120. return true;
  121. }
  122. }
  123. }
  124. return false;
  125. }
  126. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  127. {
  128. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  129. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  130. selectPermanentEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: CanSelectPermanentCondition,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: maxCount,
  136. canNoSelect: false,
  137. canEndNotMax: false,
  138. selectPermanentCoroutine: null,
  139. afterSelectPermanentCoroutine: null,
  140. mode: SelectPermanentEffect.Mode.Destroy,
  141. cardEffect: activateClass);
  142. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  143. }
  144. }
  145. }
  146. if (timing == EffectTiming.OnDestroyedAnyone)
  147. {
  148. ActivateClass activateClass = new ActivateClass();
  149. activateClass.SetUpICardEffect("Place 1 [Trial of the Four Great Dragons] in battle area", CanUseCondition, card);
  150. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  151. cardEffects.Add(activateClass);
  152. string EffectDiscription()
  153. {
  154. return "[On Deletion] 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.";
  155. }
  156. bool CanSelectCardCondition(CardSource cardSource)
  157. {
  158. if (cardSource.CardNames.Contains("Trial of the Four Great Dragons") || cardSource.CardNames.Contains("TrialoftheFourGreatDragons"))
  159. {
  160. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, isPlayOption: true))
  161. {
  162. return true;
  163. }
  164. }
  165. return false;
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  170. }
  171. bool CanActivateCondition(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnTrash(card))
  174. {
  175. if (card.Owner.HandCards.Count >= 1)
  176. {
  177. if (card.Owner.GetBattleAreaPermanents().Count((permanent) =>
  178. permanent.TopCard.CardNames.Contains("Trial of the Four Great Dragons")
  179. || permanent.TopCard.CardNames.Contains("TrialoftheFourGreatDragons")) == 0)
  180. {
  181. return true;
  182. }
  183. }
  184. }
  185. return false;
  186. }
  187. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  188. {
  189. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  190. {
  191. List<CardSource> selectedCards = new List<CardSource>();
  192. int maxCount = 1;
  193. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  194. selectHandEffect.SetUp(
  195. selectPlayer: card.Owner,
  196. canTargetCondition: CanSelectCardCondition,
  197. canTargetCondition_ByPreSelecetedList: null,
  198. canEndSelectCondition: null,
  199. maxCount: maxCount,
  200. canNoSelect: true,
  201. canEndNotMax: false,
  202. isShowOpponent: true,
  203. selectCardCoroutine: SelectCardCoroutine,
  204. afterSelectCardCoroutine: null,
  205. mode: SelectHandEffect.Mode.Custom,
  206. cardEffect: activateClass);
  207. selectHandEffect.SetUpCustomMessage("Select 1 card to place in battle area.", "The opponent is selecting 1 card to place in battle area.");
  208. yield return StartCoroutine(selectHandEffect.Activate());
  209. IEnumerator SelectCardCoroutine(CardSource cardSource)
  210. {
  211. selectedCards.Add(cardSource);
  212. yield return null;
  213. }
  214. if (selectedCards.Count >= 1)
  215. {
  216. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(
  217. card: selectedCards[0],
  218. cardEffect: activateClass,
  219. root: SelectCardEffect.Root.Hand));
  220. }
  221. }
  222. }
  223. }
  224. return cardEffects;
  225. }
  226. }
  227. }