BT22_081.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Eater Eve
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_081 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Yuuko Kamishiro");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  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 On Play
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("1 digimon can not suspend, then if no sources, place [Yuuko Kamishiro] from hand or trash", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[On Play] Until your opponent's turn ends, 1 of their Digimon can't suspend. Then, if this Digimon has no digivolution cards, you may place 1 [Yuuko Kamishiro] from your hand or trash as this Digimon's bottom digivolution card.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  48. }
  49. bool CanSelectOpponentsDigimonCondition(Permanent permanent)
  50. {
  51. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  52. }
  53. bool IsYuukoKamishiro(CardSource cardSource)
  54. {
  55. return cardSource.EqualsCardName("Yuuko Kamishiro");
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimonCondition))
  60. {
  61. Permanent selectedPermanent = null;
  62. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentsDigimonCondition));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectOpponentsDigimonCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage(
  77. "Select 1 Digimon that will get unable to suspend.",
  78. "The opponent is selecting 1 Digimon that will get unable to unsuspend.");
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  81. {
  82. selectedPermanent = permanent;
  83. yield return null;
  84. }
  85. if (selectedPermanent != null)
  86. {
  87. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  88. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
  89. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
  90. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  91. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  92. {
  93. yield return ContinuousController.instance.StartCoroutine(GManager.instance
  94. .GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  95. }
  96. bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
  97. {
  98. if (selectedPermanent.TopCard != null)
  99. {
  100. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  101. {
  102. return true;
  103. }
  104. }
  105. return false;
  106. }
  107. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  108. {
  109. if (permanentCanNotSuspend == selectedPermanent)
  110. {
  111. return true;
  112. }
  113. return false;
  114. }
  115. }
  116. }
  117. if (card.PermanentOfThisCard().DigivolutionCards.Count == 0)
  118. {
  119. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, IsYuukoKamishiro);
  120. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsYuukoKamishiro);
  121. if (canSelectHand || canSelectTrash)
  122. {
  123. if (canSelectHand && canSelectTrash)
  124. {
  125. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  126. {
  127. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  128. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  129. };
  130. string selectPlayerMessage = "From which area do you select a card?";
  131. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  132. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  133. }
  134. else
  135. {
  136. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  137. }
  138. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  139. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  140. List<CardSource> selectedCards = new List<CardSource>();
  141. IEnumerator SelectCardCoroutine(CardSource cardSource)
  142. {
  143. selectedCards.Add(cardSource);
  144. yield return null;
  145. }
  146. if (fromHand)
  147. {
  148. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  149. selectHandEffect.SetUp(
  150. selectPlayer: card.Owner,
  151. canTargetCondition: IsYuukoKamishiro,
  152. canTargetCondition_ByPreSelecetedList: null,
  153. canEndSelectCondition: null,
  154. maxCount: 1,
  155. canNoSelect: true,
  156. canEndNotMax: false,
  157. isShowOpponent: true,
  158. selectCardCoroutine: SelectCardCoroutine,
  159. afterSelectCardCoroutine: null,
  160. mode: SelectHandEffect.Mode.Custom,
  161. cardEffect: activateClass);
  162. selectHandEffect.SetUpCustomMessage("Select 1 Yuuko Kamishiro to add as source.", "The opponent is selecting 1 card to add as source.");
  163. yield return StartCoroutine(selectHandEffect.Activate());
  164. }
  165. else
  166. {
  167. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  168. selectCardEffect.SetUp(
  169. canTargetCondition: IsYuukoKamishiro,
  170. canTargetCondition_ByPreSelecetedList: null,
  171. canEndSelectCondition: null,
  172. canNoSelect: () => true,
  173. selectCardCoroutine: SelectCardCoroutine,
  174. afterSelectCardCoroutine: null,
  175. message: "Select 1 Yuuko Kamishiro to add as source.",
  176. maxCount: 1,
  177. canEndNotMax: false,
  178. isShowOpponent: true,
  179. mode: SelectCardEffect.Mode.Custom,
  180. root: SelectCardEffect.Root.Trash,
  181. customRootCardList: null,
  182. canLookReverseCard: true,
  183. selectPlayer: card.Owner,
  184. cardEffect: activateClass);
  185. selectCardEffect.SetUpCustomMessage("Select 1 Yuuko Kamishiro to add as source.", "The opponent is selecting 1 card to add as source.");
  186. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  187. }
  188. if (selectedCards.Count > 0) yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  189. }
  190. }
  191. }
  192. }
  193. #endregion
  194. #region When Digivolving
  195. if (timing == EffectTiming.OnEnterFieldAnyone)
  196. {
  197. ActivateClass activateClass = new ActivateClass();
  198. activateClass.SetUpICardEffect("1 digimon can not suspend, then if no sources, place [Yuuko Kamishiro] from hand or trash", CanUseCondition, card);
  199. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  200. cardEffects.Add(activateClass);
  201. string EffectDiscription()
  202. {
  203. return "[When Digivolving] Until your opponent's turn ends, 1 of their Digimon can't suspend. Then, if this Digimon has no digivolution cards, you may place 1 [Yuuko Kamishiro] from your hand or trash as this Digimon's bottom digivolution card.";
  204. }
  205. bool CanUseCondition(Hashtable hashtable)
  206. {
  207. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  208. }
  209. bool CanActivateCondition(Hashtable hashtable)
  210. {
  211. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  212. }
  213. bool CanSelectOpponentsDigimonCondition(Permanent permanent)
  214. {
  215. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  216. }
  217. bool IsYuukoKamishiro(CardSource cardSource)
  218. {
  219. return cardSource.EqualsCardName("Yuuko Kamishiro");
  220. }
  221. IEnumerator ActivateCoroutine(Hashtable hashtable)
  222. {
  223. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimonCondition))
  224. {
  225. Permanent selectedPermanent = null;
  226. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentsDigimonCondition));
  227. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  228. selectPermanentEffect.SetUp(
  229. selectPlayer: card.Owner,
  230. canTargetCondition: CanSelectOpponentsDigimonCondition,
  231. canTargetCondition_ByPreSelecetedList: null,
  232. canEndSelectCondition: null,
  233. maxCount: maxCount,
  234. canNoSelect: false,
  235. canEndNotMax: false,
  236. selectPermanentCoroutine: SelectPermanentCoroutine,
  237. afterSelectPermanentCoroutine: null,
  238. mode: SelectPermanentEffect.Mode.Custom,
  239. cardEffect: activateClass);
  240. selectPermanentEffect.SetUpCustomMessage(
  241. "Select 1 Digimon that will get unable to unsuspend.",
  242. "The opponent is selecting 1 Digimon that will get unable to unsuspend.");
  243. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  244. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  245. {
  246. selectedPermanent = permanent;
  247. yield return null;
  248. }
  249. if (selectedPermanent != null)
  250. {
  251. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  252. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
  253. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
  254. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  255. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  256. {
  257. yield return ContinuousController.instance.StartCoroutine(GManager.instance
  258. .GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  259. }
  260. bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
  261. {
  262. if (selectedPermanent.TopCard != null)
  263. {
  264. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  265. {
  266. return true;
  267. }
  268. }
  269. return false;
  270. }
  271. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  272. {
  273. if (permanentCanNotSuspend == selectedPermanent)
  274. {
  275. return true;
  276. }
  277. return false;
  278. }
  279. }
  280. }
  281. if (card.PermanentOfThisCard().DigivolutionCards.Count == 0)
  282. {
  283. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, IsYuukoKamishiro);
  284. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsYuukoKamishiro);
  285. if (canSelectHand || canSelectTrash)
  286. {
  287. if (canSelectHand && canSelectTrash)
  288. {
  289. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  290. {
  291. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  292. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  293. };
  294. string selectPlayerMessage = "From which area do you select a card?";
  295. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  296. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  297. }
  298. else
  299. {
  300. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  301. }
  302. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  303. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  304. List<CardSource> selectedCards = new List<CardSource>();
  305. IEnumerator SelectCardCoroutine(CardSource cardSource)
  306. {
  307. selectedCards.Add(cardSource);
  308. yield return null;
  309. }
  310. if (fromHand)
  311. {
  312. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  313. selectHandEffect.SetUp(
  314. selectPlayer: card.Owner,
  315. canTargetCondition: IsYuukoKamishiro,
  316. canTargetCondition_ByPreSelecetedList: null,
  317. canEndSelectCondition: null,
  318. maxCount: 1,
  319. canNoSelect: true,
  320. canEndNotMax: false,
  321. isShowOpponent: true,
  322. selectCardCoroutine: SelectCardCoroutine,
  323. afterSelectCardCoroutine: null,
  324. mode: SelectHandEffect.Mode.Custom,
  325. cardEffect: activateClass);
  326. selectHandEffect.SetUpCustomMessage("Select 1 Yuuko Kamishiro to add as source.", "The opponent is selecting 1 card to add as source.");
  327. yield return StartCoroutine(selectHandEffect.Activate());
  328. }
  329. else
  330. {
  331. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  332. selectCardEffect.SetUp(
  333. canTargetCondition: IsYuukoKamishiro,
  334. canTargetCondition_ByPreSelecetedList: null,
  335. canEndSelectCondition: null,
  336. canNoSelect: () => true,
  337. selectCardCoroutine: SelectCardCoroutine,
  338. afterSelectCardCoroutine: null,
  339. message: "Select 1 Yuuko Kamishiro to add as source.",
  340. maxCount: 1,
  341. canEndNotMax: false,
  342. isShowOpponent: true,
  343. mode: SelectCardEffect.Mode.Custom,
  344. root: SelectCardEffect.Root.Trash,
  345. customRootCardList: null,
  346. canLookReverseCard: true,
  347. selectPlayer: card.Owner,
  348. cardEffect: activateClass);
  349. selectCardEffect.SetUpCustomMessage("Select 1 Yuuko Kamishiro to add as source.", "The opponent is selecting 1 card to add as source.");
  350. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  351. }
  352. if (selectedCards.Count > 0) yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  353. }
  354. }
  355. }
  356. }
  357. #endregion
  358. #region All turns
  359. if (timing == EffectTiming.WhenRemoveField)
  360. {
  361. ActivateClass activateClass = new ActivateClass();
  362. activateClass.SetUpICardEffect("Play [Yuuko Kamishiro]", CanUseCondition, card);
  363. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  364. cardEffects.Add(activateClass);
  365. string EffectDiscription()
  366. {
  367. return "[All Turns] When this Digimon would leave the battle area, you may play 1 [Yuuko Kamishiro] from its digivolution cards without paying the cost.";
  368. }
  369. bool CanUseCondition(Hashtable hashtable)
  370. {
  371. return CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, IsEaterEve)
  372. && card.PermanentOfThisCard().DigivolutionCards.Filter(x => IsYuukoKamishiro(x)).Count >= 1;
  373. }
  374. bool IsEaterEve(Permanent permanent)
  375. {
  376. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent)
  377. && permanent == card.PermanentOfThisCard();
  378. }
  379. bool IsYuukoKamishiro(CardSource cardSource)
  380. {
  381. return cardSource.EqualsCardName("Yuuko Kamishiro");
  382. }
  383. bool CanActivateCondition(Hashtable hashtable)
  384. {
  385. return CardEffectCommons.IsExistOnField(card);
  386. }
  387. IEnumerator ActivateCoroutine(Hashtable hashtable)
  388. {
  389. List<CardSource> selectedCards = new List<CardSource>();
  390. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  391. selectCardEffect.SetUp(
  392. canTargetCondition: IsYuukoKamishiro,
  393. canTargetCondition_ByPreSelecetedList: null,
  394. canEndSelectCondition: null,
  395. canNoSelect: () => true,
  396. selectCardCoroutine: SelectCardCoroutine,
  397. afterSelectCardCoroutine: null,
  398. message: "Select 1 Yuuko Kamishiro to play",
  399. maxCount: 1,
  400. canEndNotMax: false,
  401. isShowOpponent: true,
  402. mode: SelectCardEffect.Mode.Custom,
  403. root: SelectCardEffect.Root.Custom,
  404. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  405. canLookReverseCard: true,
  406. selectPlayer: card.Owner,
  407. cardEffect: activateClass);
  408. IEnumerator SelectCardCoroutine(CardSource cardSource)
  409. {
  410. selectedCards.Add(cardSource);
  411. yield return null;
  412. }
  413. selectCardEffect.SetUpCustomMessage("Select 1 Yuuko Kamishiro to add as source.", "The opponent is selecting 1 card to add as source.");
  414. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  415. if (selectedCards.Count > 0) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  416. }
  417. }
  418. #endregion
  419. return cardEffects;
  420. }
  421. }
  422. }