BT16_067.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_067 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Lopmon") || targetPermanent.TopCard.CardNames.Contains("Kokomon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Trash a card to give +3000 DP.", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[On Play] By trashing 1 card in your hand, 1 of your Digimon gets +3000 DP for the turn.";
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  35. }
  36. bool PermanentCondition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  39. {
  40. return true;
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (card.Owner.HandCards.Count >= 1)
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable hashtable)
  56. {
  57. if (card.Owner.HandCards.Count >= 1)
  58. {
  59. bool discarded = false;
  60. int discardCount = 1;
  61. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  62. selectHandEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: (cardSource) => true,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: discardCount,
  68. canNoSelect: true,
  69. canEndNotMax: false,
  70. isShowOpponent: true,
  71. selectCardCoroutine: null,
  72. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  73. mode: SelectHandEffect.Mode.Discard,
  74. cardEffect: activateClass);
  75. yield return StartCoroutine(selectHandEffect.Activate());
  76. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  77. {
  78. if (cardSources.Count >= 1)
  79. {
  80. discarded = true;
  81. yield return null;
  82. }
  83. }
  84. if (discarded)
  85. {
  86. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  87. {
  88. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: PermanentCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: maxCount,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. selectPermanentEffect.SetUpCustomMessage(
  103. "Select 1 Digimon that will get DP +3000.",
  104. "The opponent is selecting 1 Digimon that will get DP +3000.");
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  109. targetPermanent: permanent,
  110. changeValue: 3000,
  111. effectDuration: EffectDuration.UntilEachTurnEnd,
  112. activateClass: activateClass));
  113. }
  114. }
  115. }
  116. }
  117. }
  118. }
  119. #endregion
  120. #region When Digivolving
  121. if (timing == EffectTiming.OnEnterFieldAnyone)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Trash a card to give +3000 DP.", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  126. cardEffects.Add(activateClass);
  127. string EffectDiscription()
  128. {
  129. return "[When Digivolving] By trashing 1 card in your hand, 1 of your Digimon gets +3000 DP for the turn.";
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  134. }
  135. bool PermanentCondition(Permanent permanent)
  136. {
  137. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  138. {
  139. return true;
  140. }
  141. return false;
  142. }
  143. bool CanActivateCondition(Hashtable hashtable)
  144. {
  145. if (CardEffectCommons.IsExistOnBattleArea(card))
  146. {
  147. if (card.Owner.HandCards.Count >= 1)
  148. {
  149. return true;
  150. }
  151. }
  152. return false;
  153. }
  154. IEnumerator ActivateCoroutine(Hashtable hashtable)
  155. {
  156. if (card.Owner.HandCards.Count >= 1)
  157. {
  158. bool discarded = false;
  159. int discardCount = 1;
  160. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  161. selectHandEffect.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition: (cardSource) => true,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. maxCount: discardCount,
  167. canNoSelect: true,
  168. canEndNotMax: false,
  169. isShowOpponent: true,
  170. selectCardCoroutine: null,
  171. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  172. mode: SelectHandEffect.Mode.Discard,
  173. cardEffect: activateClass);
  174. yield return StartCoroutine(selectHandEffect.Activate());
  175. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  176. {
  177. if (cardSources.Count >= 1)
  178. {
  179. discarded = true;
  180. yield return null;
  181. }
  182. }
  183. if (discarded)
  184. {
  185. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  186. {
  187. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  188. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  189. selectPermanentEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: PermanentCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: maxCount,
  195. canNoSelect: false,
  196. canEndNotMax: false,
  197. selectPermanentCoroutine: SelectPermanentCoroutine,
  198. afterSelectPermanentCoroutine: null,
  199. mode: SelectPermanentEffect.Mode.Custom,
  200. cardEffect: activateClass);
  201. selectPermanentEffect.SetUpCustomMessage(
  202. "Select 1 Digimon that will get DP +3000.",
  203. "The opponent is selecting 1 Digimon that will get DP +3000.");
  204. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  205. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  206. {
  207. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  208. targetPermanent: permanent,
  209. changeValue: 3000,
  210. effectDuration: EffectDuration.UntilEachTurnEnd,
  211. activateClass: activateClass));
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. #endregion
  219. #region Inherit
  220. if (timing == EffectTiming.OnEnterFieldAnyone)
  221. {
  222. ActivateClass activateClass = new ActivateClass();
  223. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  224. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  225. activateClass.SetIsInheritedEffect(true);
  226. activateClass.SetHashString("Draw1_BT16_067");
  227. cardEffects.Add(activateClass);
  228. string EffectDiscription()
  229. {
  230. return "[Your Turn] When an effect plays one of your Digimon, Draw 1.";
  231. }
  232. bool PermanentCondition(Permanent permanent)
  233. {
  234. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  235. {
  236. if (permanent.IsDigimon)
  237. {
  238. return true;
  239. }
  240. }
  241. return false;
  242. }
  243. bool CanUseCondition(Hashtable hashtable)
  244. {
  245. if (CardEffectCommons.IsExistOnBattleArea(card))
  246. {
  247. if (CardEffectCommons.IsOwnerTurn(card))
  248. {
  249. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  250. {
  251. if (CardEffectCommons.IsByEffect(hashtable, null))
  252. {
  253. return true;
  254. }
  255. }
  256. }
  257. }
  258. return false;
  259. }
  260. bool CanActivateCondition(Hashtable hashtable)
  261. {
  262. if (CardEffectCommons.IsExistOnBattleArea(card))
  263. {
  264. return true;
  265. }
  266. return false;
  267. }
  268. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  269. {
  270. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  271. }
  272. }
  273. #endregion
  274. return cardEffects;
  275. }
  276. }
  277. }