EX8_031.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class EX8_031 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Conditions
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Renamon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region On Play
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Return 1 option card to hand", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
  34. EffectDescription());
  35. cardEffects.Add(activateClass);
  36. string EffectDescription()
  37. {
  38. return
  39. "[On Play] Return 1 Option card with [Plug-In] in its name from your trash to your hand.";
  40. }
  41. bool CanSelectCardCondition(CardSource cardSource)
  42. {
  43. if (cardSource.IsOption)
  44. {
  45. if (cardSource.ContainsCardName("Plug-In"))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  55. {
  56. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  75. {
  76. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  77. {
  78. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  79. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  80. selectCardEffect.SetUp(
  81. canTargetCondition: CanSelectCardCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. canNoSelect: () => false,
  85. selectCardCoroutine: null,
  86. afterSelectCardCoroutine: null,
  87. message: "Select 1 card to add to your hand.",
  88. maxCount: maxCount,
  89. canEndNotMax: false,
  90. isShowOpponent: true,
  91. mode: SelectCardEffect.Mode.AddHand,
  92. root: SelectCardEffect.Root.Trash,
  93. customRootCardList: null,
  94. canLookReverseCard: true,
  95. selectPlayer: card.Owner,
  96. cardEffect: activateClass);
  97. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  98. }
  99. }
  100. }
  101. #endregion
  102. #region When Digivolving
  103. if (timing == EffectTiming.OnEnterFieldAnyone)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect("Return 1 option card to hand", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true,
  108. EffectDescription());
  109. cardEffects.Add(activateClass);
  110. string EffectDescription()
  111. {
  112. return
  113. "[When Digivolving] Return 1 Option card with [Plug-In] in its name from your trash to your hand.";
  114. }
  115. bool CanSelectCardCondition(CardSource cardSource)
  116. {
  117. if (cardSource.IsOption)
  118. {
  119. if (cardSource.ContainsCardName("Plug-In"))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  129. {
  130. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. bool CanActivateCondition(Hashtable hashtable)
  138. {
  139. if (CardEffectCommons.IsExistOnBattleArea(card))
  140. {
  141. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  142. {
  143. return true;
  144. }
  145. }
  146. return false;
  147. }
  148. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  149. {
  150. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  151. {
  152. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  153. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  154. selectCardEffect.SetUp(
  155. canTargetCondition: CanSelectCardCondition,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. canNoSelect: () => false,
  159. selectCardCoroutine: null,
  160. afterSelectCardCoroutine: null,
  161. message: "Select 1 card to add to your hand.",
  162. maxCount: maxCount,
  163. canEndNotMax: false,
  164. isShowOpponent: true,
  165. mode: SelectCardEffect.Mode.AddHand,
  166. root: SelectCardEffect.Root.Trash,
  167. customRootCardList: null,
  168. canLookReverseCard: true,
  169. selectPlayer: card.Owner,
  170. cardEffect: activateClass);
  171. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  172. }
  173. }
  174. }
  175. #endregion
  176. #region Inherited Effect
  177. if (timing == EffectTiming.OnUseOption)
  178. {
  179. ActivateClass activateClass = new ActivateClass();
  180. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  181. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  182. activateClass.SetIsInheritedEffect(true);
  183. activateClass.SetHashString("DP-2000_EX8_031");
  184. cardEffects.Add(activateClass);
  185. string EffectDiscription()
  186. {
  187. 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.";
  188. }
  189. bool CanSelectPermanentCondition(Permanent permanent)
  190. {
  191. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  192. }
  193. bool CanUseCondition(Hashtable hashtable)
  194. {
  195. if (CardEffectCommons.IsExistOnBattleArea(card))
  196. {
  197. if (CardEffectCommons.IsOwnerTurn(card))
  198. {
  199. if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, (cost) => cost >= 2, card))
  200. {
  201. return true;
  202. }
  203. }
  204. }
  205. return false;
  206. }
  207. bool CanActivateCondition(Hashtable hashtable)
  208. {
  209. if (CardEffectCommons.IsExistOnBattleArea(card))
  210. {
  211. return true;
  212. }
  213. return false;
  214. }
  215. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  216. {
  217. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  218. {
  219. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  220. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  221. selectPermanentEffect.SetUp(
  222. selectPlayer: card.Owner,
  223. canTargetCondition: CanSelectPermanentCondition,
  224. canTargetCondition_ByPreSelecetedList: null,
  225. canEndSelectCondition: null,
  226. maxCount: maxCount,
  227. canNoSelect: false,
  228. canEndNotMax: false,
  229. selectPermanentCoroutine: SelectPermanentCoroutine,
  230. afterSelectPermanentCoroutine: null,
  231. mode: SelectPermanentEffect.Mode.Custom,
  232. cardEffect: activateClass);
  233. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  234. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  235. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  236. {
  237. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  238. }
  239. }
  240. }
  241. }
  242. #endregion
  243. return cardEffects;
  244. }
  245. }
  246. }