EX4_028.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_028 : 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. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Kyubimon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.None)
  20. {
  21. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  22. changeCardNamesClass.SetUpICardEffect("Also treated as [Taomon]", CanUseCondition, card);
  23. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  24. cardEffects.Add(changeCardNamesClass);
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return true;
  28. }
  29. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  30. {
  31. if (cardSource == card)
  32. {
  33. CardNames.Add("Taomon");
  34. }
  35. return CardNames;
  36. }
  37. }
  38. if (timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Return 1 Digimon with 6000 DP or less to hand", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  43. cardEffects.Add(activateClass);
  44. string EffectDiscription()
  45. {
  46. return "[On Play] Return 1 of your opponent's Digimon with 6000 DP or less to its owner's hand.";
  47. }
  48. bool CanSelectPermanentCondition(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  51. {
  52. if (permanent.DP <= 6000)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  75. {
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  77. {
  78. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: CanSelectPermanentCondition,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: null,
  85. maxCount: maxCount,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: null,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.Bounce,
  91. cardEffect: activateClass);
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. }
  94. }
  95. }
  96. if (timing == EffectTiming.OnEnterFieldAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Return 1 Digimon with 6000 DP or less to hand", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[When Digivolving] Return 1 of your opponent's Digimon with 6000 DP or less to its owner's hand.";
  105. }
  106. bool CanSelectPermanentCondition(Permanent permanent)
  107. {
  108. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  109. {
  110. if (permanent.DP <= 6000)
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. bool CanUseCondition(Hashtable hashtable)
  118. {
  119. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  120. }
  121. bool CanActivateCondition(Hashtable hashtable)
  122. {
  123. if (CardEffectCommons.IsExistOnBattleArea(card))
  124. {
  125. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  126. {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  133. {
  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,
  140. canTargetCondition: CanSelectPermanentCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: maxCount,
  144. canNoSelect: false,
  145. canEndNotMax: false,
  146. selectPermanentCoroutine: null,
  147. afterSelectPermanentCoroutine: null,
  148. mode: SelectPermanentEffect.Mode.Bounce,
  149. cardEffect: activateClass);
  150. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  151. }
  152. }
  153. }
  154. if (timing == EffectTiming.OnUseOption)
  155. {
  156. ActivateClass activateClass = new ActivateClass();
  157. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  158. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  159. activateClass.SetIsInheritedEffect(true);
  160. activateClass.SetHashString("DP-2000_EX4_028");
  161. cardEffects.Add(activateClass);
  162. string EffectDiscription()
  163. {
  164. return "[Your Turn][Once Per Turn] When you use an Option card with a cost of 2 or more, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  165. }
  166. bool CanSelectPermanentCondition(Permanent permanent)
  167. {
  168. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  169. }
  170. bool CanUseCondition(Hashtable hashtable)
  171. {
  172. if (CardEffectCommons.IsExistOnBattleArea(card))
  173. {
  174. if (CardEffectCommons.IsOwnerTurn(card))
  175. {
  176. if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, (cost) => cost >= 2, card))
  177. {
  178. return true;
  179. }
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanActivateCondition(Hashtable hashtable)
  185. {
  186. if (CardEffectCommons.IsExistOnBattleArea(card))
  187. {
  188. return true;
  189. }
  190. return false;
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  193. {
  194. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  195. {
  196. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  197. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  198. selectPermanentEffect.SetUp(
  199. selectPlayer: card.Owner,
  200. canTargetCondition: CanSelectPermanentCondition,
  201. canTargetCondition_ByPreSelecetedList: null,
  202. canEndSelectCondition: null,
  203. maxCount: maxCount,
  204. canNoSelect: false,
  205. canEndNotMax: false,
  206. selectPermanentCoroutine: SelectPermanentCoroutine,
  207. afterSelectPermanentCoroutine: null,
  208. mode: SelectPermanentEffect.Mode.Custom,
  209. cardEffect: activateClass);
  210. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  211. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  212. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  213. {
  214. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  215. }
  216. }
  217. }
  218. }
  219. return cardEffects;
  220. }
  221. }
  222. }