ST24_07.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Shinegreymon // GeoGrey Sword
  5. namespace DCGO.CardEffects.ST24
  6. {
  7. public class ST24_07 : 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. || permanent.TopCard.ContainsCardName("RizeGreymon");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
  22. }
  23. #endregion
  24. #region Raid
  25. if (timing == EffectTiming.OnAllyAttack)
  26. {
  27. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region Piercing
  31. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  32. {
  33. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. #endregion
  36. #region Security Attack +1
  37. if (timing == EffectTiming.None)
  38. {
  39. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  40. }
  41. #endregion
  42. #region Shared WD / WA
  43. string SharedHashString = "ST24_07_WD_WA";
  44. string SharedEffectName = "You may play a tamer up to 5 cost from hand or trash. -9k to an enemy Digimon.";
  45. string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] You may play 1 Tamer card with a play cost of 5 or less from your hand or trash without paying the cost. Then, 1 of your opponent's Digimon gets -9000 DP for the turn.";
  46. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  47. bool PlayableTamerCard(CardSource cardSource, ActivateClass activateClass)
  48. {
  49. return cardSource.IsTamer
  50. && cardSource.HasPlayCost
  51. && cardSource.GetCostItself <= 5
  52. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  53. }
  54. bool EnemyDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  55. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  56. {
  57. #region Play Tamer
  58. bool PlayTamer = false;
  59. bool playFromHand = false;
  60. bool playFromTrash = false;
  61. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, cardSource => PlayableTamerCard(cardSource, activateClass));
  62. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, cardSource => PlayableTamerCard(cardSource, activateClass));
  63. if (canSelectHand || canSelectTrash)
  64. {
  65. #region User Selection - Play Token or Select Card Location
  66. var playOptions = new List<SelectionElement<bool>>()
  67. {
  68. new SelectionElement<bool>(message: $"Play a Tamer", value: true, spriteIndex: 0),
  69. new SelectionElement<bool>(message: $"Don't Play", value: false, spriteIndex: 1)
  70. };
  71. string selectPlayerMessage = "Will you play a tamer?";
  72. string notSelectPlayerMessage = "The opponent is choosing if they will play a tamer.";
  73. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: playOptions, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  74. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  75. PlayTamer = GManager.instance.userSelectionManager.SelectedBoolValue;
  76. }
  77. if (PlayTamer)
  78. {
  79. if (canSelectHand && canSelectTrash)
  80. {
  81. List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>()
  82. {
  83. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  84. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  85. };
  86. string selectPlayerMessage1 = "From which area do you select a card?";
  87. string notSelectPlayerMessage1 = "The opponent is choosing from which area to select a card.";
  88. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  89. }
  90. else
  91. {
  92. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  93. }
  94. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  95. var handOrTrashSelection = GManager.instance.userSelectionManager.SelectedBoolValue;
  96. if (handOrTrashSelection) playFromHand = true;
  97. else playFromTrash = true;
  98. }
  99. #endregion
  100. CardSource selectedCard = null;
  101. IEnumerator SelectCardCoroutine(CardSource cardSource)
  102. {
  103. selectedCard = cardSource;
  104. yield return null;
  105. }
  106. if (playFromHand)
  107. {
  108. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  109. selectHandEffect.SetUp(
  110. selectPlayer: card.Owner,
  111. canTargetCondition: cardSource => PlayableTamerCard(cardSource, activateClass),
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. maxCount: 1,
  115. canNoSelect: true,
  116. canEndNotMax: false,
  117. isShowOpponent: true,
  118. selectCardCoroutine: SelectCardCoroutine,
  119. afterSelectCardCoroutine: null,
  120. mode: SelectHandEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectHandEffect.SetUpCustomMessage("Select 1 tamer to play", "The opponent is selecting 1 tamer to play");
  123. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  124. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  125. new List<CardSource>() { selectedCard },
  126. activateClass: activateClass,
  127. payCost: false,
  128. isTapped: false,
  129. root: SelectCardEffect.Root.Hand,
  130. activateETB: true));
  131. }
  132. if (playFromTrash)
  133. {
  134. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  135. selectCardEffect.SetUp(
  136. canTargetCondition: cardSource => PlayableTamerCard(cardSource, activateClass),
  137. canTargetCondition_ByPreSelecetedList: null,
  138. canEndSelectCondition: null,
  139. canNoSelect: () => true,
  140. selectCardCoroutine: SelectCardCoroutine,
  141. afterSelectCardCoroutine: null,
  142. message: "Select 1 tamer to play",
  143. maxCount: 1,
  144. canEndNotMax: false,
  145. isShowOpponent: true,
  146. mode: SelectCardEffect.Mode.Custom,
  147. root: SelectCardEffect.Root.Trash,
  148. customRootCardList: null,
  149. canLookReverseCard: true,
  150. selectPlayer: card.Owner,
  151. cardEffect: activateClass);
  152. selectCardEffect.SetUpCustomMessage("Select 1 tamer to play", "The opponent is selecting 1 tamer to play");
  153. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Tamer");
  154. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  155. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  156. new List<CardSource>() { selectedCard },
  157. activateClass: activateClass,
  158. payCost: false,
  159. isTapped: false,
  160. root: SelectCardEffect.Root.Trash,
  161. activateETB: true));
  162. }
  163. #endregion
  164. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, EnemyDigimonCondition))
  165. {
  166. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  167. selectPermanentEffect.SetUp(
  168. selectPlayer: card.Owner,
  169. canTargetCondition: EnemyDigimonCondition,
  170. canTargetCondition_ByPreSelecetedList: null,
  171. canEndSelectCondition: null,
  172. maxCount: 1,
  173. canNoSelect: false,
  174. canEndNotMax: false,
  175. selectPermanentCoroutine: SelectPermanentCoroutine,
  176. afterSelectPermanentCoroutine: null,
  177. mode: SelectPermanentEffect.Mode.Custom,
  178. cardEffect: activateClass);
  179. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -9000.", "The opponent is selecting 1 Digimon that will get DP -9000.");
  180. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  181. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  182. {
  183. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -9000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  184. }
  185. }
  186. }
  187. #endregion
  188. #region When Digivolving
  189. if (timing == EffectTiming.OnEnterFieldAnyone)
  190. {
  191. ActivateClass activateClass = new ActivateClass();
  192. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  193. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Digivolving"));
  194. activateClass.SetHashString(SharedHashString);
  195. cardEffects.Add(activateClass);
  196. bool CanUseCondition(Hashtable hashtable)
  197. {
  198. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  199. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  200. }
  201. }
  202. #endregion
  203. #region When Attacking
  204. if (timing == EffectTiming.OnAllyAttack)
  205. {
  206. ActivateClass activateClass = new ActivateClass();
  207. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  208. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Digivolving"));
  209. activateClass.SetHashString(SharedHashString);
  210. cardEffects.Add(activateClass);
  211. bool CanUseCondition(Hashtable hashtable)
  212. {
  213. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) &&
  214. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  215. }
  216. }
  217. #endregion
  218. #endregion
  219. #region Option Effects
  220. #region Ignore Colour Requirement
  221. if (timing == EffectTiming.None)
  222. {
  223. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  224. bool CardCondition(CardSource cardSource)
  225. {
  226. return cardSource.EqualsTraits("DATA SQUAD");
  227. }
  228. }
  229. #endregion
  230. #region Main
  231. if (timing == EffectTiming.OptionSkill)
  232. {
  233. ActivateClass activateClass = new ActivateClass();
  234. activateClass.SetUpICardEffect("1 Enemy Digimon gets -6k DP, Delete 1 Enemy Digimon with 7k or less DP.", CanUseCondition, card);
  235. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  236. cardEffects.Add(activateClass);
  237. string EffectDiscription()
  238. => "[Main] 1 of your opponent's Digimon gets -6000 DP for the turn. Then, delete 1 of your opponent's Digimon with 7000 DP or less.";
  239. bool CanUseCondition(Hashtable hashtable)
  240. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  241. bool CanSelectDPMinusPermanentCondition(Permanent permanent)
  242. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  243. bool CanSelectDeletePermamentCondition(Permanent permanent)
  244. {
  245. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  246. && permanent.DP <= 7000;
  247. }
  248. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  249. {
  250. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectDPMinusPermanentCondition))
  251. {
  252. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  253. selectPermanentEffect.SetUp(
  254. selectPlayer: card.Owner,
  255. canTargetCondition: CanSelectDPMinusPermanentCondition,
  256. canTargetCondition_ByPreSelecetedList: null,
  257. canEndSelectCondition: null,
  258. maxCount: 1,
  259. canNoSelect: false,
  260. canEndNotMax: false,
  261. selectPermanentCoroutine: SelectPermanentCoroutine,
  262. afterSelectPermanentCoroutine: null,
  263. mode: SelectPermanentEffect.Mode.Custom,
  264. cardEffect: activateClass);
  265. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -6000.", "The opponent is selecting 1 Digimon that will get DP -6000.");
  266. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  267. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  268. {
  269. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -6000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  270. }
  271. }
  272. if(CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectDeletePermamentCondition))
  273. {
  274. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  275. selectPermanentEffect.SetUp(
  276. selectPlayer: card.Owner,
  277. canTargetCondition: CanSelectDeletePermamentCondition,
  278. canTargetCondition_ByPreSelecetedList: null,
  279. canEndSelectCondition: null,
  280. maxCount: 1,
  281. canNoSelect: true,
  282. canEndNotMax: false,
  283. selectPermanentCoroutine: null,
  284. afterSelectPermanentCoroutine: null,
  285. mode: SelectPermanentEffect.Mode.Destroy,
  286. cardEffect: activateClass);
  287. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  288. }
  289. }
  290. }
  291. #endregion
  292. #region Arts Digivolution
  293. if (timing == EffectTiming.None)
  294. {
  295. cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
  296. }
  297. #endregion
  298. #endregion
  299. return cardEffects;
  300. }
  301. }
  302. }