EX10_034.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //Blastmon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_034 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digixros
  13. if (timing == EffectTiming.None)
  14. {
  15. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  16. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  17. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  18. addDigiXrosConditionClass.SetNotShowUI(true);
  19. cardEffects.Add(addDigiXrosConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return true;
  23. }
  24. DigiXrosCondition GetDigiXros(CardSource cardSource)
  25. {
  26. if (cardSource == card)
  27. {
  28. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Bagra Army trait");
  29. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition, "Bagra Army trait");
  30. DigiXrosConditionElement element2 = new DigiXrosConditionElement(CanSelectCardCondition, "Bagra Army trait");
  31. bool CanSelectCardCondition(CardSource cardSource)
  32. {
  33. if (cardSource != null)
  34. {
  35. if (cardSource.Owner == card.Owner)
  36. {
  37. if (cardSource.IsDigimon)
  38. {
  39. if (cardSource.EqualsTraits("Bagra Army"))
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1, element2 };
  49. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  50. return digiXrosCondition;
  51. }
  52. return null;
  53. }
  54. }
  55. #endregion
  56. #region Static Effects
  57. #region Collision
  58. if (timing == EffectTiming.OnCounterTiming)
  59. {
  60. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(false, card, null));
  61. }
  62. #endregion
  63. #region Fragment
  64. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  65. {
  66. string EffectDiscription()
  67. {
  68. return "<Fragment <3>> (When this Digimon would be deleted, by trashing any 3 of its digivolution cards, it isn’t deleted.)";
  69. }
  70. cardEffects.Add(CardEffectFactory.FragmentSelfEffect(isInheritedEffect: false, card: card, condition: null, trashValue: 3, effectName: "Fragment <3>", effectDiscription: EffectDiscription()));
  71. }
  72. #endregion
  73. #region Blocker
  74. if (timing == EffectTiming.None)
  75. {
  76. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  77. isInheritedEffect: false,
  78. card: card,
  79. condition: null));
  80. }
  81. #endregion
  82. #endregion
  83. #region On Play - gain must attack
  84. if (timing == EffectTiming.OnEnterFieldAnyone)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("1 digimon gains attack on Start of your main phase", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  89. cardEffects.Add(activateClass);
  90. string EffectDiscription()
  91. {
  92. return "[On Play] Until your opponent's turn ends, give 1 of their Digimon \"[Start of Your Main Phase] This Digimon attacks.\"";
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  97. {
  98. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  99. {
  100. return true;
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  108. }
  109. bool CanSelectPermanentCondition(Permanent permanent)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  116. {
  117. Permanent selectedPermanent = null;
  118. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  119. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  120. selectPermanentEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectPermanentCondition,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: maxCount,
  126. canNoSelect: false,
  127. canEndNotMax: false,
  128. selectPermanentCoroutine: SelectPermanentCoroutine,
  129. afterSelectPermanentCoroutine: null,
  130. mode: SelectPermanentEffect.Mode.Custom,
  131. cardEffect: activateClass);
  132. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  133. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  134. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  135. {
  136. selectedPermanent = permanent;
  137. yield return null;
  138. }
  139. if (selectedPermanent != null)
  140. {
  141. ActivateClass activateClass1 = new ActivateClass();
  142. activateClass1.SetUpICardEffect("[Start of Your Main Phase] This Digimon attacks.", CanUseCondition1, selectedPermanent.TopCard);
  143. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  144. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  145. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  146. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  147. {
  148. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  149. }
  150. string EffectDiscription1()
  151. {
  152. return "[Start of Your Main Phase] This Digimon attacks.";
  153. }
  154. bool CanUseCondition1(Hashtable hashtable1)
  155. {
  156. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  157. {
  158. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  159. {
  160. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  161. {
  162. return true;
  163. }
  164. }
  165. }
  166. return false;
  167. }
  168. bool CanActivateCondition1(Hashtable hashtable1)
  169. {
  170. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  171. {
  172. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  173. {
  174. if (selectedPermanent.CanAttack(activateClass1))
  175. {
  176. return true;
  177. }
  178. }
  179. }
  180. return false;
  181. }
  182. ICardEffect GetCardEffect(EffectTiming _timing)
  183. {
  184. if (_timing == EffectTiming.OnStartMainPhase)
  185. {
  186. return activateClass1;
  187. }
  188. return null;
  189. }
  190. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  191. {
  192. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  193. {
  194. if (selectedPermanent.CanAttack(activateClass1))
  195. {
  196. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  197. selectAttackEffect.SetUp(
  198. attacker: selectedPermanent,
  199. canAttackPlayerCondition: () => true,
  200. defenderCondition: (permanent) => true,
  201. cardEffect: activateClass1);
  202. selectAttackEffect.SetCanNotSelectNotAttack();
  203. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  204. }
  205. }
  206. }
  207. }
  208. }
  209. }
  210. }
  211. #endregion
  212. #region When Digivolving - gain must attack
  213. if (timing == EffectTiming.OnEnterFieldAnyone)
  214. {
  215. ActivateClass activateClass = new ActivateClass();
  216. activateClass.SetUpICardEffect("1 digimon gains attack on Start of your main phase", CanUseCondition, card);
  217. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  218. cardEffects.Add(activateClass);
  219. string EffectDiscription()
  220. {
  221. return "[On Play] [When Digivolving] Until your opponent's turn ends, give 1 of their Digimon \"[Start of Your Main Phase] This Digimon attacks.\"";
  222. }
  223. bool CanUseCondition(Hashtable hashtable)
  224. {
  225. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  226. {
  227. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  228. {
  229. return true;
  230. }
  231. }
  232. return false;
  233. }
  234. bool CanActivateCondition(Hashtable hashtable)
  235. {
  236. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  237. }
  238. bool CanSelectPermanentCondition(Permanent permanent)
  239. {
  240. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  241. }
  242. IEnumerator ActivateCoroutine(Hashtable hashtable)
  243. {
  244. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  245. {
  246. Permanent selectedPermanent = null;
  247. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  248. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  249. selectPermanentEffect.SetUp(
  250. selectPlayer: card.Owner,
  251. canTargetCondition: CanSelectPermanentCondition,
  252. canTargetCondition_ByPreSelecetedList: null,
  253. canEndSelectCondition: null,
  254. maxCount: maxCount,
  255. canNoSelect: false,
  256. canEndNotMax: false,
  257. selectPermanentCoroutine: SelectPermanentCoroutine,
  258. afterSelectPermanentCoroutine: null,
  259. mode: SelectPermanentEffect.Mode.Custom,
  260. cardEffect: activateClass);
  261. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  262. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  263. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  264. {
  265. selectedPermanent = permanent;
  266. yield return null;
  267. }
  268. if (selectedPermanent != null)
  269. {
  270. ActivateClass activateClass1 = new ActivateClass();
  271. activateClass1.SetUpICardEffect("[Start of Your Main Phase] This Digimon attacks.", CanUseCondition1, selectedPermanent.TopCard);
  272. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  273. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  274. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  275. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  276. {
  277. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  278. }
  279. string EffectDiscription1()
  280. {
  281. return "[Start of Your Main Phase] This Digimon attacks.";
  282. }
  283. bool CanUseCondition1(Hashtable hashtable1)
  284. {
  285. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  286. {
  287. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  288. {
  289. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  290. {
  291. return true;
  292. }
  293. }
  294. }
  295. return false;
  296. }
  297. bool CanActivateCondition1(Hashtable hashtable1)
  298. {
  299. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  300. {
  301. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  302. {
  303. if (selectedPermanent.CanAttack(activateClass1))
  304. {
  305. return true;
  306. }
  307. }
  308. }
  309. return false;
  310. }
  311. ICardEffect GetCardEffect(EffectTiming _timing)
  312. {
  313. if (_timing == EffectTiming.OnStartMainPhase)
  314. {
  315. return activateClass1;
  316. }
  317. return null;
  318. }
  319. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  320. {
  321. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  322. {
  323. if (selectedPermanent.CanAttack(activateClass1))
  324. {
  325. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  326. selectAttackEffect.SetUp(
  327. attacker: selectedPermanent,
  328. canAttackPlayerCondition: () => true,
  329. defenderCondition: (permanent) => true,
  330. cardEffect: activateClass1);
  331. selectAttackEffect.SetCanNotSelectNotAttack();
  332. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  333. }
  334. }
  335. }
  336. }
  337. }
  338. }
  339. }
  340. #endregion
  341. #region All Turns - OPT
  342. if (timing == EffectTiming.OnAllyAttack)
  343. {
  344. List<Permanent> removedPermanents = new List<Permanent>();
  345. ActivateClass activateClass = new ActivateClass();
  346. activateClass.SetUpICardEffect("Trash 2 source cards, gain <Security A. +1> and +3000 DP", CanUseCondition, card);
  347. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  348. activateClass.SetHashString("AT_EX10_034");
  349. cardEffects.Add(activateClass);
  350. string EffectDiscription()
  351. {
  352. return "[All Turns] [Once Per Turn] When Digimon attack, by trashing any 2 of this Digimon's digivolution cards, this Digimon gains <Security A. +1> and +3000 DP until your turn ends.";
  353. }
  354. bool CanUseCondition(Hashtable hashtable)
  355. {
  356. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  357. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, IsAttackingDigimon);
  358. }
  359. bool CanActivateCondition(Hashtable hashtable)
  360. {
  361. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  362. && card.PermanentOfThisCard().DigivolutionCards.Count >= 2;
  363. }
  364. bool IsAttackingDigimon(Permanent permanent)
  365. {
  366. return permanent.IsDigimon;
  367. }
  368. IEnumerator ActivateCoroutine(Hashtable hashtable)
  369. {
  370. Permanent thisPermanent = card.PermanentOfThisCard();
  371. List<CardSource> selectedCards = new List<CardSource>();
  372. #region Trash Digivolution Cards
  373. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  374. selectCardEffect.SetUp(
  375. canTargetCondition: _ => true,
  376. canTargetCondition_ByPreSelecetedList: null,
  377. canEndSelectCondition: null,
  378. canNoSelect: () => false,
  379. selectCardCoroutine: SelectCardCoroutine,
  380. afterSelectCardCoroutine: null,
  381. message: "Select 2 digivolution cards to trash.",
  382. maxCount: 2,
  383. canEndNotMax: false,
  384. isShowOpponent: true,
  385. mode: SelectCardEffect.Mode.Custom,
  386. root: SelectCardEffect.Root.Custom,
  387. customRootCardList: thisPermanent.DigivolutionCards,
  388. canLookReverseCard: true,
  389. selectPlayer: card.Owner,
  390. cardEffect: activateClass);
  391. IEnumerator SelectCardCoroutine(CardSource cardSource)
  392. {
  393. selectedCards.Add(cardSource);
  394. yield return null;
  395. }
  396. selectCardEffect.SetUseFaceDown();
  397. selectCardEffect.SetUpCustomMessage("Select 2 digivolution cards to trash.", "The opponent is selecting 2 digivolution cards to trash.");
  398. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  399. #endregion
  400. if (selectedCards.Count == 2)
  401. {
  402. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsAndProcessAccordingToResult(
  403. targetPermanent: thisPermanent,
  404. targetDigivolutionCards: selectedCards,
  405. activateClass: activateClass,
  406. successProcess: SuccessProcess,
  407. failureProcess: null));
  408. IEnumerator SuccessProcess(List<CardSource> trashedSources)
  409. {
  410. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  411. targetPermanent: card.PermanentOfThisCard(),
  412. changeValue: 1,
  413. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  414. activateClass: activateClass
  415. ));
  416. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  417. targetPermanent: card.PermanentOfThisCard(),
  418. changeValue: 3000,
  419. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  420. activateClass: activateClass
  421. ));
  422. }
  423. }
  424. }
  425. }
  426. #endregion
  427. return cardEffects;
  428. }
  429. }
  430. }