EX7_011.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_011 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasText("Three Musketeers") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("Place an Option under this Digimon's digivolution cards to delete a Digimon", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] By placing 1 Option card with the [Three Musketeers] trait from your hand or trash as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with 6000 DP or less.";
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. if (cardSource.IsOption && cardSource.ContainsTraits("Three Musketeers") || cardSource.IsOption && cardSource.ContainsTraits("ThreeMusketeers"))
  36. {
  37. return true;
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. }
  45. bool CanSelectPermanentCondition(Permanent permanent)
  46. {
  47. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  48. {
  49. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  61. {
  62. return true;
  63. }
  64. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  65. {
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  74. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  75. if (canSelectHand || canSelectTrash)
  76. {
  77. if (canSelectHand && canSelectTrash)
  78. {
  79. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  80. {
  81. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  82. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  83. };
  84. string selectPlayerMessage = "From which area do you select a card?";
  85. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  86. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  87. }
  88. else
  89. {
  90. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  91. }
  92. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  93. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  94. List<CardSource> selectedCards = new List<CardSource>();
  95. IEnumerator SelectCardCoroutine(CardSource cardSource)
  96. {
  97. selectedCards.Add(cardSource);
  98. yield return null;
  99. }
  100. if (fromHand)
  101. {
  102. int maxCount = 1;
  103. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  104. selectHandEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectCardCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: true,
  111. canEndNotMax: false,
  112. isShowOpponent: true,
  113. selectCardCoroutine: SelectCardCoroutine,
  114. afterSelectCardCoroutine: null,
  115. mode: SelectHandEffect.Mode.Custom,
  116. cardEffect: activateClass);
  117. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  118. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  119. yield return StartCoroutine(selectHandEffect.Activate());
  120. }
  121. else
  122. {
  123. int maxCount = 1;
  124. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  125. selectCardEffect.SetUp(
  126. canTargetCondition: CanSelectCardCondition,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. canNoSelect: () => true,
  130. selectCardCoroutine: SelectCardCoroutine,
  131. afterSelectCardCoroutine: null,
  132. message: "Select 1 card to place on bottom of digivolution cards.",
  133. maxCount: maxCount,
  134. canEndNotMax: false,
  135. isShowOpponent: true,
  136. mode: SelectCardEffect.Mode.Custom,
  137. root: SelectCardEffect.Root.Trash,
  138. customRootCardList: null,
  139. canLookReverseCard: true,
  140. selectPlayer: card.Owner,
  141. cardEffect: activateClass);
  142. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  143. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  144. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  145. }
  146. if (selectedCards.Count >= 1)
  147. {
  148. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  149. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  150. {
  151. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  152. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  153. selectPermanentEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: CanSelectPermanentCondition,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: maxCount,
  159. canNoSelect: false,
  160. canEndNotMax: false,
  161. selectPermanentCoroutine: null,
  162. afterSelectPermanentCoroutine: null,
  163. mode: SelectPermanentEffect.Mode.Destroy,
  164. cardEffect: activateClass);
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. }
  167. }
  168. }
  169. }
  170. }
  171. #endregion
  172. #region When Digivolving
  173. if (timing == EffectTiming.OnEnterFieldAnyone)
  174. {
  175. ActivateClass activateClass = new ActivateClass();
  176. activateClass.SetUpICardEffect("Place an Option under this Digimon's digivolution cards to delete a Digimon", CanUseCondition, card);
  177. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  178. cardEffects.Add(activateClass);
  179. string EffectDiscription()
  180. {
  181. return "[When Digivolving] By placing 1 Option card with the [Three Musketeers] trait from your hand or trash as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with 6000 DP or less.";
  182. }
  183. bool CanSelectCardCondition(CardSource cardSource)
  184. {
  185. if (cardSource.IsOption && cardSource.ContainsTraits("Three Musketeers") || cardSource.IsOption && cardSource.ContainsTraits("ThreeMusketeers"))
  186. {
  187. return true;
  188. }
  189. return false;
  190. }
  191. bool CanUseCondition(Hashtable hashtable)
  192. {
  193. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  194. }
  195. bool CanSelectPermanentCondition(Permanent permanent)
  196. {
  197. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  198. {
  199. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  200. {
  201. return true;
  202. }
  203. }
  204. return false;
  205. }
  206. bool CanActivateCondition(Hashtable hashtable)
  207. {
  208. if (CardEffectCommons.IsExistOnBattleArea(card))
  209. {
  210. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  211. {
  212. return true;
  213. }
  214. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  215. {
  216. return true;
  217. }
  218. }
  219. return false;
  220. }
  221. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  222. {
  223. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  224. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  225. if (canSelectHand || canSelectTrash)
  226. {
  227. if (canSelectHand && canSelectTrash)
  228. {
  229. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  230. {
  231. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  232. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  233. };
  234. string selectPlayerMessage = "From which area do you select a card?";
  235. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  236. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  237. }
  238. else
  239. {
  240. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  241. }
  242. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  243. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  244. List<CardSource> selectedCards = new List<CardSource>();
  245. IEnumerator SelectCardCoroutine(CardSource cardSource)
  246. {
  247. selectedCards.Add(cardSource);
  248. yield return null;
  249. }
  250. if (fromHand)
  251. {
  252. int maxCount = 1;
  253. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  254. selectHandEffect.SetUp(
  255. selectPlayer: card.Owner,
  256. canTargetCondition: CanSelectCardCondition,
  257. canTargetCondition_ByPreSelecetedList: null,
  258. canEndSelectCondition: null,
  259. maxCount: maxCount,
  260. canNoSelect: true,
  261. canEndNotMax: false,
  262. isShowOpponent: true,
  263. selectCardCoroutine: SelectCardCoroutine,
  264. afterSelectCardCoroutine: null,
  265. mode: SelectHandEffect.Mode.Custom,
  266. cardEffect: activateClass);
  267. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  268. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  269. yield return StartCoroutine(selectHandEffect.Activate());
  270. }
  271. else
  272. {
  273. int maxCount = 1;
  274. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  275. selectCardEffect.SetUp(
  276. canTargetCondition: CanSelectCardCondition,
  277. canTargetCondition_ByPreSelecetedList: null,
  278. canEndSelectCondition: null,
  279. canNoSelect: () => true,
  280. selectCardCoroutine: SelectCardCoroutine,
  281. afterSelectCardCoroutine: null,
  282. message: "Select 1 card to place on bottom of digivolution cards.",
  283. maxCount: maxCount,
  284. canEndNotMax: false,
  285. isShowOpponent: true,
  286. mode: SelectCardEffect.Mode.Custom,
  287. root: SelectCardEffect.Root.Trash,
  288. customRootCardList: null,
  289. canLookReverseCard: true,
  290. selectPlayer: card.Owner,
  291. cardEffect: activateClass);
  292. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  293. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  294. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  295. }
  296. if (selectedCards.Count >= 1)
  297. {
  298. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  299. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  300. {
  301. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  302. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  303. selectPermanentEffect.SetUp(
  304. selectPlayer: card.Owner,
  305. canTargetCondition: CanSelectPermanentCondition,
  306. canTargetCondition_ByPreSelecetedList: null,
  307. canEndSelectCondition: null,
  308. maxCount: maxCount,
  309. canNoSelect: false,
  310. canEndNotMax: false,
  311. selectPermanentCoroutine: null,
  312. afterSelectPermanentCoroutine: null,
  313. mode: SelectPermanentEffect.Mode.Destroy,
  314. cardEffect: activateClass);
  315. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  316. }
  317. }
  318. }
  319. }
  320. }
  321. #endregion
  322. #region Inherit
  323. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  324. {
  325. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: true, card: card, condition: null));
  326. }
  327. #endregion
  328. return cardEffects;
  329. }
  330. }
  331. }