BT24_051.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. //Merukimon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_051 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Static Effects
  14. #region Digivolution Condition
  15. if (timing == EffectTiming.None)
  16. {
  17. static bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.IsLevel5
  20. && (targetPermanent.TopCard.EqualsTraits("Beastkin")
  21. || targetPermanent.TopCard.EqualsTraits("TS"));
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  24. }
  25. #endregion
  26. #region Reduce Play Cost
  27. if (timing == EffectTiming.None)
  28. {
  29. bool Condition()
  30. {
  31. return card.Owner.GetBattleAreaDigimons().Count + card.Owner.Enemy.GetBattleAreaDigimons().Count >= 3;
  32. }
  33. cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction(5, card, Condition));
  34. }
  35. #endregion
  36. #endregion
  37. #region OP/WD Shared
  38. string SharedEffectName()
  39. => "Suspend 2, then 1 Digimon may gain 5k DP and attack.";
  40. string SharedEffectDescription(string tag)
  41. {
  42. return $"[{tag}] Suspend 2 of your opponent's Digimon or Tamers. Then, 1 of your Digimon may get +5000 DP for the turn and attack your opponent's Digimon.";
  43. }
  44. bool SharedCanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleArea(card);
  47. }
  48. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  51. && (permanent.IsDigimon
  52. || permanent.IsTamer);
  53. }
  54. bool CanSelectOwnerPermanentCondition(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  57. }
  58. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  61. {
  62. int maxCount = Math.Min(2,
  63. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: CanSelectOpponentPermanentCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: null,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.Tap,
  76. cardEffect: activateClass);
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  80. {
  81. Permanent selectedPermanent = null;
  82. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  83. selectPermanentEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: CanSelectOwnerPermanentCondition,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: true,
  90. canEndNotMax: false,
  91. selectPermanentCoroutine: SelectPermanentCoroutine,
  92. afterSelectPermanentCoroutine: null,
  93. mode: SelectPermanentEffect.Mode.Custom,
  94. cardEffect: activateClass);
  95. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that may get +5000 DP and attack.",
  96. "The opponent is selecting 1 Digimon that may get +5000 DP and attack.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. selectedPermanent = permanent;
  101. yield return null;
  102. }
  103. if (selectedPermanent != null)
  104. {
  105. // Give +5000 DP until end of turn
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  107. targetPermanent: selectedPermanent,
  108. changeValue: 5000,
  109. effectDuration: EffectDuration.UntilEachTurnEnd,
  110. activateClass: activateClass));
  111. if (selectedPermanent.CanAttack(activateClass))
  112. {
  113. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  114. selectAttackEffect.SetUp(
  115. attacker: selectedPermanent,
  116. canAttackPlayerCondition: () => false,
  117. defenderCondition: _ => true,
  118. cardEffect: activateClass);
  119. selectAttackEffect.SetCanNotSelectNotAttack();
  120. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  121. }
  122. }
  123. }
  124. }
  125. #endregion
  126. #region On Play
  127. if (timing == EffectTiming.OnEnterFieldAnyone)
  128. {
  129. ActivateClass activateClass = new ActivateClass();
  130. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  131. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("On Play"));
  132. cardEffects.Add(activateClass);
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  136. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  137. }
  138. }
  139. #endregion
  140. #region When Digivolving 1
  141. if (timing == EffectTiming.OnEnterFieldAnyone)
  142. {
  143. ActivateClass activateClass = new ActivateClass();
  144. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  145. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  146. cardEffects.Add(activateClass);
  147. bool CanUseCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  150. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  151. }
  152. }
  153. #endregion
  154. #region WD/WA Shared
  155. string SharedEffectName1()
  156. => "Unsuspend 1 Digimon";
  157. string SharedEffectDescription1(string tag)
  158. {
  159. return $"[{tag}] [Once Per Turn] 1 of your Digimon may unsuspend.";
  160. }
  161. bool CanSelectPermanentCondition1(Permanent permanent)
  162. {
  163. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  164. }
  165. bool SharedCanActivateCondition1(Hashtable hashtable)
  166. {
  167. return CardEffectCommons.IsExistOnBattleArea(card);
  168. }
  169. IEnumerator WDWASharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  170. {
  171. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  172. selectPermanentEffect.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectPermanentCondition1,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: 1,
  178. canNoSelect: false,
  179. canEndNotMax: false,
  180. selectPermanentCoroutine: null,
  181. afterSelectPermanentCoroutine: null,
  182. mode: SelectPermanentEffect.Mode.UnTap,
  183. cardEffect: activateClass);
  184. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to unsuspend.", "The opponent is selecting 1 Digimon to unsuspend.");
  185. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  186. }
  187. #endregion
  188. #region When Digivolving 2
  189. if (timing == EffectTiming.OnEnterFieldAnyone)
  190. {
  191. ActivateClass activateClass = new ActivateClass();
  192. activateClass.SetUpICardEffect(SharedEffectName1(), CanUseCondition, card);
  193. activateClass.SetUpActivateClass(SharedCanActivateCondition1, hash => WDWASharedActivateCoroutine(hash, activateClass), 1, true, SharedEffectDescription1("When Digivolving"));
  194. activateClass.SetHashString("BT24_051_WD_WA");
  195. cardEffects.Add(activateClass);
  196. bool CanUseCondition(Hashtable hashtable)
  197. {
  198. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  199. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  200. }
  201. }
  202. #endregion
  203. #region When Attacking
  204. if (timing == EffectTiming.OnAllyAttack)
  205. {
  206. ActivateClass activateClass = new ActivateClass();
  207. activateClass.SetUpICardEffect(SharedEffectName1(), CanUseCondition, card);
  208. activateClass.SetUpActivateClass(SharedCanActivateCondition1, hash => WDWASharedActivateCoroutine(hash, activateClass), 1, true, SharedEffectDescription1("When Attacking"));
  209. activateClass.SetHashString("BT24_051_WD_WA");
  210. cardEffects.Add(activateClass);
  211. bool CanUseCondition(Hashtable hashtable)
  212. {
  213. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  214. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  215. }
  216. }
  217. #endregion
  218. #region Your Turn
  219. if (timing == EffectTiming.None)
  220. {
  221. bool CanUseCondition()
  222. {
  223. return CardEffectCommons.IsExistOnBattleArea(card)
  224. && CardEffectCommons.IsOwnerTurn(card);
  225. }
  226. bool CanUseConditionSkill(Hashtable hashtable)
  227. {
  228. return CardEffectCommons.IsExistOnBattleArea(card)
  229. && CardEffectCommons.IsOwnerTurn(card);
  230. }
  231. bool PermanentCondition(Permanent permanent)
  232. {
  233. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  234. && permanent.TopCard.EqualsTraits("Iliad");
  235. }
  236. cardEffects.Add(CardEffectFactory.RushStaticEffect(
  237. permanentCondition: PermanentCondition,
  238. isInheritedEffect: false,
  239. card: card,
  240. condition: CanUseCondition));
  241. AddSkillClass addSkillClass = new AddSkillClass();
  242. addSkillClass.SetUpICardEffect("[Your Turn] All of your [Iliad] trait Digimon gain <Rush> and <Piercing>.", CanUseConditionSkill, card);
  243. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  244. cardEffects.Add(addSkillClass);
  245. bool CardSourceCondition(CardSource cardSource)
  246. {
  247. return PermanentCondition(cardSource.PermanentOfThisCard())
  248. && cardSource == cardSource.PermanentOfThisCard().TopCard;
  249. }
  250. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  251. {
  252. if (_timing == EffectTiming.OnDetermineDoSecurityCheck)
  253. {
  254. bool Condition()
  255. {
  256. return CardSourceCondition(cardSource);
  257. }
  258. cardEffects.Add(CardEffectFactory.PierceSelfEffect(
  259. isInheritedEffect: false,
  260. card: cardSource,
  261. condition: Condition));
  262. }
  263. return cardEffects;
  264. }
  265. }
  266. #endregion
  267. return cardEffects;
  268. }
  269. }
  270. }