BT20_076.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.BT20
  6. {
  7. public class BT20_076 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region DNA Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  16. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  17. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  18. addJogressConditionClass.SetNotShowUI(true);
  19. cardEffects.Add(addJogressConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return true;
  23. }
  24. JogressCondition GetJogress(CardSource cardSource)
  25. {
  26. if (cardSource == card)
  27. {
  28. bool PermanentCondition1(Permanent permanent)
  29. {
  30. if (permanent != null)
  31. {
  32. if (permanent.TopCard != null)
  33. {
  34. if (permanent.TopCard.Owner == card.Owner)
  35. {
  36. if (permanent.IsDigimon)
  37. {
  38. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  39. {
  40. if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
  41. {
  42. if (permanent.Levels_ForJogress(card).Contains(5))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool PermanentCondition2(Permanent permanent)
  55. {
  56. if (permanent != null)
  57. {
  58. if (permanent.TopCard != null)
  59. {
  60. if (permanent.TopCard.Owner == card.Owner)
  61. {
  62. if (permanent.IsDigimon)
  63. {
  64. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  65. {
  66. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  67. {
  68. if (permanent.Levels_ForJogress(card).Contains(5))
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. }
  78. return false;
  79. }
  80. JogressConditionElement[] elements = new JogressConditionElement[]
  81. {
  82. new JogressConditionElement(PermanentCondition1, "a level 5 purple Digimon"),
  83. new JogressConditionElement(PermanentCondition2, "a level 5 red Digimon"),
  84. };
  85. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  86. return jogressCondition;
  87. }
  88. return null;
  89. }
  90. }
  91. #endregion
  92. #region Ace - Blast DNA Digivolve
  93. if (timing == EffectTiming.OnCounterTiming)
  94. {
  95. List<BlastDNACondition> blastDNAConditions = new List<BlastDNACondition>
  96. {
  97. new("Dinobeemon"),
  98. new("Paildramon")
  99. };
  100. cardEffects.Add(CardEffectFactory.BlastDNADigivolveEffect(card: card,
  101. blastDNAConditions: blastDNAConditions, condition: null));
  102. }
  103. #endregion
  104. #region On Play
  105. if (timing == EffectTiming.OnEnterFieldAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  110. cardEffects.Add(activateClass);
  111. string EffectDiscription()
  112. {
  113. return "[On Play] Delete 1 of your opponent's Digimon with 11000 DP or less. Then, if DNA digivolving, this Digimon may digivolve into [Imperialdramon: Fighter Mode] in the hand or trash without paying the cost.";
  114. }
  115. bool CanSelectPermanentCondition(Permanent permanent)
  116. {
  117. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  118. {
  119. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(11000, activateClass))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. bool CanSelectDigivolveCondition(CardSource cardSource)
  127. {
  128. return cardSource.EqualsCardName("Imperialdramon: Fighter Mode") &&
  129. cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  134. }
  135. bool CanActivateCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  140. {
  141. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  142. {
  143. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  144. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectPermanentCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: maxCount,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: null,
  154. afterSelectPermanentCoroutine: null,
  155. mode: SelectPermanentEffect.Mode.Destroy,
  156. cardEffect: activateClass);
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. }
  159. if (CardEffectCommons.IsJogress(_hashtable))
  160. {
  161. bool canSelectHand = card.Owner.HandCards.Count(CanSelectDigivolveCondition) >= 1;
  162. bool canSelectTrash = card.Owner.TrashCards.Count(CanSelectDigivolveCondition) >= 1;
  163. if (canSelectHand || canSelectTrash)
  164. {
  165. if (canSelectHand && canSelectTrash)
  166. {
  167. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  168. {
  169. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  170. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  171. };
  172. string selectPlayerMessage = "From which area do you want to digivolve from?";
  173. string notSelectPlayerMessage = "The opponent is choosing where to digivolve from.";
  174. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  175. }
  176. else
  177. {
  178. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  179. }
  180. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  181. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  182. if (fromHand)
  183. {
  184. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  185. targetPermanent: card.PermanentOfThisCard(),
  186. cardCondition: CanSelectDigivolveCondition,
  187. payCost: false,
  188. reduceCostTuple: null,
  189. fixedCostTuple: null,
  190. ignoreDigivolutionRequirementFixedCost: -1,
  191. isHand: true,
  192. activateClass: activateClass,
  193. successProcess: null));
  194. }
  195. else
  196. {
  197. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  198. targetPermanent: card.PermanentOfThisCard(),
  199. cardCondition: CanSelectDigivolveCondition,
  200. payCost: false,
  201. reduceCostTuple: null,
  202. fixedCostTuple: null,
  203. ignoreDigivolutionRequirementFixedCost: -1,
  204. isHand: false,
  205. activateClass: activateClass,
  206. successProcess: null));
  207. }
  208. }
  209. }
  210. }
  211. }
  212. #endregion
  213. #region When Digivolving
  214. if (timing == EffectTiming.OnEnterFieldAnyone)
  215. {
  216. ActivateClass activateClass = new ActivateClass();
  217. activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card);
  218. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  219. cardEffects.Add(activateClass);
  220. string EffectDiscription()
  221. {
  222. return "[When Digivolving] Delete 1 of your opponent's Digimon with 11000 DP or less. Then, if DNA digivolving, this Digimon may digivolve into [Imperialdramon: Fighter Mode] in the hand or trash without paying the cost.";
  223. }
  224. bool CanSelectPermanentCondition(Permanent permanent)
  225. {
  226. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  227. {
  228. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(11000, activateClass))
  229. {
  230. return true;
  231. }
  232. }
  233. return false;
  234. }
  235. bool CanSelectDigivolveCondition(CardSource cardSource)
  236. {
  237. return cardSource.EqualsCardName("Imperialdramon: Fighter Mode") &&
  238. cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame,false,activateClass);
  239. }
  240. bool CanUseCondition(Hashtable hashtable)
  241. {
  242. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  243. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  244. }
  245. bool CanActivateCondition(Hashtable hashtable)
  246. {
  247. return CardEffectCommons.IsExistOnBattleAreaDigimon(card); ;
  248. }
  249. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  250. {
  251. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  252. {
  253. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  254. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  255. selectPermanentEffect.SetUp(
  256. selectPlayer: card.Owner,
  257. canTargetCondition: CanSelectPermanentCondition,
  258. canTargetCondition_ByPreSelecetedList: null,
  259. canEndSelectCondition: null,
  260. maxCount: maxCount,
  261. canNoSelect: false,
  262. canEndNotMax: false,
  263. selectPermanentCoroutine: null,
  264. afterSelectPermanentCoroutine: null,
  265. mode: SelectPermanentEffect.Mode.Destroy,
  266. cardEffect: activateClass);
  267. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  268. }
  269. if (CardEffectCommons.IsJogress(_hashtable))
  270. {
  271. bool canSelectHand = card.Owner.HandCards.Count(CanSelectDigivolveCondition) >= 1;
  272. bool canSelectTrash = card.Owner.TrashCards.Count(CanSelectDigivolveCondition) >= 1;
  273. if (canSelectHand || canSelectTrash)
  274. {
  275. if (canSelectHand && canSelectTrash)
  276. {
  277. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  278. {
  279. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  280. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  281. };
  282. string selectPlayerMessage = "From which area do you want to digivolve from?";
  283. string notSelectPlayerMessage = "The opponent is choosing where to digivolve from.";
  284. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  285. }
  286. else
  287. {
  288. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  289. }
  290. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  291. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  292. if (fromHand)
  293. {
  294. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  295. targetPermanent: card.PermanentOfThisCard(),
  296. cardCondition: CanSelectDigivolveCondition,
  297. payCost: false,
  298. reduceCostTuple: null,
  299. fixedCostTuple: null,
  300. ignoreDigivolutionRequirementFixedCost: -1,
  301. isHand: true,
  302. activateClass: activateClass,
  303. successProcess: null));
  304. }
  305. else
  306. {
  307. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  308. targetPermanent: card.PermanentOfThisCard(),
  309. cardCondition: CanSelectDigivolveCondition,
  310. payCost: false,
  311. reduceCostTuple: null,
  312. fixedCostTuple: null,
  313. ignoreDigivolutionRequirementFixedCost: -1,
  314. isHand: false,
  315. activateClass: activateClass,
  316. successProcess: null));
  317. }
  318. }
  319. }
  320. }
  321. }
  322. #endregion
  323. return cardEffects;
  324. }
  325. }
  326. }