BT20_041.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_041 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.EqualsTraits("ACCEL");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region On Play
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon, 1 of your Digimon gets +3000DP, then attack", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[On Play] Suspend 1 of your opponent's Digimon and 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  30. }
  31. bool IsOpponentsDigimon(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  34. }
  35. bool IsYourBoostedDigimon(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  38. }
  39. bool IsYourAttackingDigimon(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  42. permanent.CanAttack(activateClass);
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  55. {
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: IsOpponentsDigimon,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: 1,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: null,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Tap,
  68. cardEffect: activateClass);
  69. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon suspend.", "The opponent is selecting 1 Digimon to suspend.");
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. }
  72. if (CardEffectCommons.HasMatchConditionPermanent(IsYourBoostedDigimon))
  73. {
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: IsYourBoostedDigimon,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: 1,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectBoostedDigimon,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to get +3000DP.", "The opponent is selecting 1 Digimon to get +3000DP.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectBoostedDigimon(Permanent target)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  92. }
  93. }
  94. if (CardEffectCommons.HasMatchConditionPermanent(IsYourAttackingDigimon))
  95. {
  96. Permanent selectedPermanent = null;
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: IsYourAttackingDigimon,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: 1,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: SelectPermanentCoroutine,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to attack.", "The opponent is selecting 1 Digimon to attack.");
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  113. {
  114. selectedPermanent = permanent;
  115. yield return null;
  116. }
  117. if (selectedPermanent != null)
  118. {
  119. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  120. selectAttackEffect.SetUp(
  121. attacker: selectedPermanent,
  122. canAttackPlayerCondition: () => true,
  123. defenderCondition: _ => true,
  124. cardEffect: activateClass);
  125. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  126. }
  127. }
  128. }
  129. }
  130. #endregion
  131. #region When Digivolving
  132. if (timing == EffectTiming.OnEnterFieldAnyone)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon, 1 of your Digimon gets +3000DP, then attack", CanUseCondition, card);
  136. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  137. cardEffects.Add(activateClass);
  138. string EffectDiscription()
  139. {
  140. return "[When Digivolving] Suspend 1 of your opponent's Digimon and 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  141. }
  142. bool IsOpponentsDigimon(Permanent permanent)
  143. {
  144. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  145. }
  146. bool IsYourBoostedDigimon(Permanent permanent)
  147. {
  148. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  149. }
  150. bool IsYourAttackingDigimon(Permanent permanent)
  151. {
  152. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  153. permanent.CanAttack(activateClass);
  154. }
  155. bool CanUseCondition(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  158. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  159. }
  160. bool CanActivateCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable hashtable)
  165. {
  166. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  167. {
  168. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  169. selectPermanentEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: IsOpponentsDigimon,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: 1,
  175. canNoSelect: false,
  176. canEndNotMax: false,
  177. selectPermanentCoroutine: null,
  178. afterSelectPermanentCoroutine: null,
  179. mode: SelectPermanentEffect.Mode.Tap,
  180. cardEffect: activateClass);
  181. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon suspend.", "The opponent is selecting 1 Digimon to suspend.");
  182. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  183. }
  184. if (CardEffectCommons.HasMatchConditionPermanent(IsYourBoostedDigimon))
  185. {
  186. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  187. selectPermanentEffect.SetUp(
  188. selectPlayer: card.Owner,
  189. canTargetCondition: IsYourBoostedDigimon,
  190. canTargetCondition_ByPreSelecetedList: null,
  191. canEndSelectCondition: null,
  192. maxCount: 1,
  193. canNoSelect: false,
  194. canEndNotMax: false,
  195. selectPermanentCoroutine: SelectBoostedDigimon,
  196. afterSelectPermanentCoroutine: null,
  197. mode: SelectPermanentEffect.Mode.Custom,
  198. cardEffect: activateClass);
  199. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to get +3000DP.", "The opponent is selecting 1 Digimon to get +3000DP.");
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  201. IEnumerator SelectBoostedDigimon(Permanent target)
  202. {
  203. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  204. }
  205. }
  206. if (CardEffectCommons.HasMatchConditionPermanent(IsYourAttackingDigimon))
  207. {
  208. Permanent selectedPermanent = null;
  209. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  210. selectPermanentEffect.SetUp(
  211. selectPlayer: card.Owner,
  212. canTargetCondition: IsYourAttackingDigimon,
  213. canTargetCondition_ByPreSelecetedList: null,
  214. canEndSelectCondition: null,
  215. maxCount: 1,
  216. canNoSelect: false,
  217. canEndNotMax: false,
  218. selectPermanentCoroutine: SelectPermanentCoroutine,
  219. afterSelectPermanentCoroutine: null,
  220. mode: SelectPermanentEffect.Mode.Custom,
  221. cardEffect: activateClass);
  222. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to attack.", "The opponent is selecting 1 Digimon to attack.");
  223. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  224. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  225. {
  226. selectedPermanent = permanent;
  227. yield return null;
  228. }
  229. if (selectedPermanent != null)
  230. {
  231. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  232. selectAttackEffect.SetUp(
  233. attacker: selectedPermanent,
  234. canAttackPlayerCondition: () => true,
  235. defenderCondition: _ => true,
  236. cardEffect: activateClass);
  237. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  238. }
  239. }
  240. }
  241. }
  242. #endregion
  243. #region When Attacking - ESS
  244. if (timing == EffectTiming.OnAllyAttack)
  245. {
  246. ActivateClass activateClass = new ActivateClass();
  247. activateClass.SetUpICardEffect("1 Opponent's Digimon gets -4000 DP", CanUseCondition, card);
  248. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  249. activateClass.SetIsInheritedEffect(true);
  250. activateClass.SetHashString("WhenAttacking_BT20-041");
  251. cardEffects.Add(activateClass);
  252. string EffectDiscription()
  253. {
  254. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -4000 DP for the turn.";
  255. }
  256. bool IsOpponentsDigimon(Permanent permanent)
  257. {
  258. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  259. }
  260. bool CanUseCondition(Hashtable hashtable)
  261. {
  262. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  263. }
  264. bool CanActivateCondition(Hashtable hashtable)
  265. {
  266. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  267. CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  268. }
  269. IEnumerator ActivateCoroutine(Hashtable hashtable)
  270. {
  271. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  272. selectPermanentEffect.SetUp(
  273. selectPlayer: card.Owner,
  274. canTargetCondition: IsOpponentsDigimon,
  275. canTargetCondition_ByPreSelecetedList: null,
  276. canEndSelectCondition: null,
  277. maxCount: 1,
  278. canNoSelect: false,
  279. canEndNotMax: false,
  280. selectPermanentCoroutine: SelectedPermanent,
  281. afterSelectPermanentCoroutine: null,
  282. mode: SelectPermanentEffect.Mode.Custom,
  283. cardEffect: activateClass);
  284. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  285. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  286. IEnumerator SelectedPermanent(Permanent target)
  287. {
  288. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: target, changeValue: -4000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  289. }
  290. }
  291. }
  292. #endregion
  293. return cardEffects;
  294. }
  295. }
  296. }