BT25_104.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Shinegreymon: Burst Mode // Final Shining Burst
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_104 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digimon Effects
  13. #region Alt Digivolution
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent permanent)
  17. {
  18. return permanent.TopCard.EqualsTraits("DATA SQUAD");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 5, true, card, null, level: 6));
  21. }
  22. #endregion
  23. #region Burst Digivolution
  24. if (timing == EffectTiming.None)
  25. {
  26. AddBurstDigivolutionConditionClass addBurstDigivolutionConditionClass = new AddBurstDigivolutionConditionClass();
  27. addBurstDigivolutionConditionClass.SetUpICardEffect($"Burst Digivolution", CanUseCondition, card);
  28. addBurstDigivolutionConditionClass.SetUpAddBurstDigivolutionConditionClass(getBurstDigivolutionCondition: GetBurstDigivolution);
  29. addBurstDigivolutionConditionClass.SetNotShowUI(true);
  30. cardEffects.Add(addBurstDigivolutionConditionClass);
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return true;
  34. }
  35. BurstDigivolutionCondition GetBurstDigivolution(CardSource cardSource)
  36. {
  37. if (cardSource == card)
  38. {
  39. bool tamerCondition(Permanent permanent)
  40. {
  41. return permanent != null
  42. && permanent.TopCard != null
  43. && permanent.TopCard.Owner == card.Owner
  44. && permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent)
  45. && !permanent.CannotReturnToHand(null)
  46. && permanent.TopCard.EqualsCardName("Marcus Damon");
  47. }
  48. bool digimonCondition(Permanent permanent)
  49. {
  50. return permanent != null
  51. && permanent.TopCard != null
  52. && permanent.TopCard.Owner == card.Owner
  53. && permanent.TopCard.Owner.GetFieldPermanents().Contains(permanent)
  54. && !card.CanNotEvolve(permanent)
  55. && permanent.TopCard.EqualsCardName("ShineGreymon");
  56. }
  57. BurstDigivolutionCondition burstDigivolutionCondition = new BurstDigivolutionCondition(
  58. tamerCondition: tamerCondition,
  59. selectTamerMessage: "1 [Marcus Damon]",
  60. digimonCondition: digimonCondition,
  61. selectDigimonMessage: "1 [ShineGreymon]",
  62. cost: 0);
  63. return burstDigivolutionCondition;
  64. }
  65. return null;
  66. }
  67. }
  68. #endregion
  69. #region Raid
  70. if (timing == EffectTiming.OnAllyAttack)
  71. {
  72. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  73. }
  74. #endregion
  75. #region Piercing
  76. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  77. {
  78. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  79. }
  80. #endregion
  81. #region Security Attack +1
  82. if (timing == EffectTiming.None)
  83. {
  84. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  85. }
  86. #endregion
  87. #region Blocker
  88. if (timing == EffectTiming.None)
  89. {
  90. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  91. }
  92. #endregion
  93. #region Barrier
  94. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  95. {
  96. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(false, card, null));
  97. }
  98. #endregion
  99. #region Shared WD / WA
  100. string SharedHashString = "BT25_104_WD_WA";
  101. string SharedEffectName = "As an option effect, 1 Enemy Digimon gets -15k DP, play 1 tamer.";
  102. string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] Activate 1 [Main] effect on this card's Option side.";
  103. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ActivateMainOfOptionSide(card, activateClass));
  106. }
  107. CardEffectFactory.ActivateClassesForSharedEffects
  108. (ref cardEffects, timing, card,
  109. SharedEffectName,
  110. SharedActivateCoroutine,
  111. SharedEffectDescription,
  112. optional: false,
  113. maxCountPerTurn: 1,
  114. hashValue: SharedHashString,
  115. whenDigivolving: true,
  116. whenAttacking: true);
  117. #endregion
  118. #region Your Turn
  119. //All your Marcus Damon
  120. bool IsMarcusDamon(Permanent permanent)
  121. {
  122. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  123. && permanent.TopCard.EqualsCardName("Marcus Damon");
  124. }
  125. bool MakeDigimonCondition()
  126. {
  127. return CardEffectCommons.IsExistOnBattleArea(card)
  128. && CardEffectCommons.IsOwnerTurn(card);
  129. }
  130. IEnumerator MarcusActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  131. {
  132. #region are also treated as Digimon
  133. TreatAsDigimonClass treatAsDigimonClass = CardEffectFactory.TreatAsDigimonStaticEffect(
  134. permanentCondition: IsMarcusDamon,
  135. isInheritedEffect: false,
  136. card: card,
  137. condition: MakeDigimonCondition);//Granted effect continues checking that Burst mode is on field and is idempotent, so does not have to be remove when it leaves play
  138. ICardEffect GetEffect(EffectTiming timing)
  139. {
  140. if (timing == EffectTiming.None)
  141. {
  142. return treatAsDigimonClass;
  143. }
  144. return null;
  145. }
  146. card.Owner.UntilEachTurnEndEffects.Add(GetEffect);
  147. #endregion
  148. yield return null;
  149. }
  150. if (timing == EffectTiming.OnMove) // For the gigachad that evoes into it in raising
  151. {
  152. ActivateClass activateClass = CardEffectFactory.WhenMovingClass(
  153. card,
  154. "[Marcus Damon] are treated as Digimon",
  155. MarcusActivateCoroutine,
  156. "[Marcus Damon] are treated as Digimon",
  157. false
  158. );
  159. activateClass.SetIsBackgroundProcess(true);//Run in background at start of your turn to add effect to player
  160. cardEffects.Add(activateClass);
  161. }
  162. if (timing == EffectTiming.OnStartTurn)
  163. {
  164. ActivateClass activateClass = CardEffectFactory.StartOfYourTurnClass(
  165. card,
  166. "[Marcus Damon] are treated as Digimon",
  167. MarcusActivateCoroutine,
  168. "[Marcus Damon] are treated as Digimon",
  169. false
  170. );
  171. activateClass.SetIsBackgroundProcess(true);//Run in background at start of your turn to add effect to player
  172. cardEffects.Add(activateClass);
  173. }
  174. //To anyone copying this effect: If this were not a dual card it would also need a matching On Play effect
  175. if(timing == EffectTiming.OnEnterFieldAnyone)
  176. {
  177. ActivateClass activateClass = CardEffectFactory.WhenDigivolvingClass(
  178. card,
  179. "[Marcus Damon] are treated as Digimon",
  180. MarcusActivateCoroutine,
  181. "[Marcus Damon] are treated as Digimon",
  182. false
  183. );
  184. activateClass.SetIsBackgroundProcess(true);//Run in background when digivolve into this to add effect to player
  185. cardEffects.Add(activateClass);
  186. }
  187. if (timing == EffectTiming.None)
  188. {
  189. #region with 12000 DP
  190. ChangeBaseDPClass changeBaseDPClass = CardEffectFactory.ChangeBaseDPGlobalEffect(
  191. permanentCondition: IsMarcusDamon,
  192. changeValue: 12000,
  193. isInheritedEffect: false,
  194. card: card,
  195. condition: MakeDigimonCondition);
  196. changeBaseDPClass.SetActivatedTime(card.Owner.TurnStartTime, card.ChangedLocationTime);
  197. cardEffects.Add(changeBaseDPClass);
  198. #endregion
  199. #region and gain Rush
  200. RushClass rushClass = CardEffectFactory.RushStaticEffect(
  201. permanentCondition: IsMarcusDamon,
  202. isInheritedEffect: false,
  203. card: card,
  204. condition: MakeDigimonCondition);
  205. cardEffects.Add(rushClass);
  206. #endregion
  207. }
  208. #endregion
  209. #endregion
  210. #region Option Effects
  211. #region Ignore Colour Requirement
  212. if (timing == EffectTiming.None)
  213. {
  214. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  215. bool CardCondition(CardSource cardSource)
  216. {
  217. return cardSource.EqualsTraits("DATA SQUAD");
  218. }
  219. }
  220. #endregion
  221. #region Main
  222. if (timing == EffectTiming.OptionSkill)
  223. {
  224. ActivateClass activateClass = new ActivateClass();
  225. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  226. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  227. cardEffects.Add(activateClass);
  228. string EffectDiscription()
  229. => "[Main] 1 of your opponent's Digimon gets -15000 DP for the turn. Then, you may play 1 Tamer card from your hand without paying the cost.";
  230. bool CanUseCondition(Hashtable hashtable)
  231. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  232. bool CanSelectDPMinusPermanentCondition(Permanent permanent)
  233. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  234. bool CanSelectTamerCondition(CardSource cardSource)
  235. {
  236. return cardSource.IsTamer
  237. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  238. }
  239. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  240. {
  241. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectDPMinusPermanentCondition))
  242. {
  243. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  244. selectPermanentEffect.SetUp(
  245. selectPlayer: card.Owner,
  246. canTargetCondition: CanSelectDPMinusPermanentCondition,
  247. canTargetCondition_ByPreSelecetedList: null,
  248. canEndSelectCondition: null,
  249. maxCount: 1,
  250. canNoSelect: false,
  251. canEndNotMax: false,
  252. selectPermanentCoroutine: SelectPermanentCoroutine,
  253. afterSelectPermanentCoroutine: null,
  254. mode: SelectPermanentEffect.Mode.Custom,
  255. cardEffect: activateClass);
  256. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -15000.", "The opponent is selecting 1 Digimon that will get DP -15000.");
  257. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  258. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  259. {
  260. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -15000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  261. }
  262. }
  263. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectTamerCondition))
  264. {
  265. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  266. canTargetCondition: CanSelectTamerCondition,
  267. SelectCardEffect.Root.Hand,
  268. activateClass,
  269. payCost: false
  270. ));
  271. }
  272. }
  273. }
  274. #endregion
  275. #region Arts Digivolution
  276. if (timing == EffectTiming.None)
  277. {
  278. cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
  279. }
  280. #endregion
  281. #endregion
  282. return cardEffects;
  283. }
  284. }
  285. }