BT11_043.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_043 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Sukamon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 3,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null));
  24. }
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Opponent's 1 Digimon becomes [Sukamon]", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[On Play] If your opponent has 16 or more cards in their trash, or you have 3 or more cards with [Sukamon] in their names in your trash, change 1 of your opponent's Digimon into a white Digimon with 3000 DP and an original name of [Sukamon] until the end of your opponent's turn.";
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  48. {
  49. if (card.Owner.Enemy.TrashCards.Count >= 16)
  50. {
  51. return true;
  52. }
  53. if (card.Owner.TrashCards.Count((cardSource) => cardSource.ContainsCardName("Sukamon")) >= 3)
  54. {
  55. return true;
  56. }
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  64. {
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: SelectPermanentCoroutine,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. selectPermanentEffect.SetUpCustomMessage(
  80. "Select 1 Digimon that will get effects.",
  81. "The opponent is selecting 1 Digimon that will get effects.");
  82. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  83. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  84. {
  85. Permanent selectedPermanent = permanent;
  86. if (selectedPermanent != null)
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeBaseDigimonDP(
  89. targetPermanent: permanent,
  90. changeValue: 3000,
  91. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  92. activateClass: activateClass));
  93. }
  94. if (selectedPermanent != null)
  95. {
  96. ChangeBaseCardNameClass changeBaseCardNameClass = new ChangeBaseCardNameClass();
  97. changeBaseCardNameClass.SetUpICardEffect("Original card name is [Sukamon]", CanUseCondition1, card);
  98. changeBaseCardNameClass.SetUpChangeBaseCardNamesClass(changeBaseCardNames: ChangeBaseCardNames);
  99. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => changeBaseCardNameClass);
  100. bool CanUseCondition1(Hashtable hashtable)
  101. {
  102. if (selectedPermanent.TopCard != null)
  103. {
  104. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. List<string> ChangeBaseCardNames(CardSource cardSource, List<string> CardNames)
  112. {
  113. if (cardSource == selectedPermanent.TopCard)
  114. {
  115. CardNames = new List<string>() { "Sukamon" };
  116. }
  117. return CardNames;
  118. }
  119. }
  120. if (selectedPermanent != null)
  121. {
  122. ChangeBaseCardColorClass changeBaseCardNameClass = new ChangeBaseCardColorClass();
  123. changeBaseCardNameClass.SetUpICardEffect("Original card color is white", CanUseCondition1, card);
  124. changeBaseCardNameClass.SetUpChangeBaseCardColorClass(ChangeBaseCardColors: ChangeBaseCardColors);
  125. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => changeBaseCardNameClass);
  126. bool CanUseCondition1(Hashtable hashtable)
  127. {
  128. if (selectedPermanent.TopCard != null)
  129. {
  130. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. List<CardColor> ChangeBaseCardColors(CardSource cardSource, List<CardColor> CardColors)
  138. {
  139. if (cardSource == selectedPermanent.TopCard)
  140. {
  141. CardColors = new List<CardColor>() { CardColor.White };
  142. }
  143. return CardColors;
  144. }
  145. }
  146. }
  147. }
  148. }
  149. }
  150. if (timing == EffectTiming.OnEnterFieldAnyone)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect("Opponent's 1 Digimon becomes [Sukamon]", CanUseCondition, card);
  154. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  155. cardEffects.Add(activateClass);
  156. string EffectDiscription()
  157. {
  158. return "[When Digivolving] If your opponent has 16 or more cards in their trash, or you have 3 or more cards with [Sukamon] in their names in your trash, change 1 of your opponent's Digimon into a white Digimon with 3000 DP and an original name of [Sukamon] until the end of your opponent's turn.";
  159. }
  160. bool CanSelectPermanentCondition(Permanent permanent)
  161. {
  162. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  163. }
  164. bool CanUseCondition(Hashtable hashtable)
  165. {
  166. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  167. }
  168. bool CanActivateCondition(Hashtable hashtable)
  169. {
  170. if (CardEffectCommons.IsExistOnBattleArea(card))
  171. {
  172. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  173. {
  174. if (card.Owner.Enemy.TrashCards.Count >= 16)
  175. {
  176. return true;
  177. }
  178. if (card.Owner.TrashCards.Count((cardSource) => cardSource.ContainsCardName("Sukamon")) >= 3)
  179. {
  180. return true;
  181. }
  182. }
  183. }
  184. return false;
  185. }
  186. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  187. {
  188. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  189. {
  190. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  191. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  192. selectPermanentEffect.SetUp(
  193. selectPlayer: card.Owner,
  194. canTargetCondition: CanSelectPermanentCondition,
  195. canTargetCondition_ByPreSelecetedList: null,
  196. canEndSelectCondition: null,
  197. maxCount: maxCount,
  198. canNoSelect: false,
  199. canEndNotMax: false,
  200. selectPermanentCoroutine: SelectPermanentCoroutine,
  201. afterSelectPermanentCoroutine: null,
  202. mode: SelectPermanentEffect.Mode.Custom,
  203. cardEffect: activateClass);
  204. selectPermanentEffect.SetUpCustomMessage(
  205. "Select 1 Digimon that will get effects.",
  206. "The opponent is selecting 1 Digimon that will get effects.");
  207. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  208. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  209. {
  210. Permanent selectedPermanent = permanent;
  211. if (selectedPermanent != null)
  212. {
  213. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeBaseDigimonDP(
  214. targetPermanent: permanent,
  215. changeValue: 3000,
  216. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  217. activateClass: activateClass));
  218. }
  219. if (selectedPermanent != null)
  220. {
  221. ChangeBaseCardNameClass changeBaseCardNameClass = new ChangeBaseCardNameClass();
  222. changeBaseCardNameClass.SetUpICardEffect("Original card name is [Sukamon]", CanUseCondition1, card);
  223. changeBaseCardNameClass.SetUpChangeBaseCardNamesClass(changeBaseCardNames: changeBaseCardNames);
  224. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => changeBaseCardNameClass);
  225. bool CanUseCondition1(Hashtable hashtable)
  226. {
  227. if (selectedPermanent.TopCard != null)
  228. {
  229. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  230. {
  231. return true;
  232. }
  233. }
  234. return false;
  235. }
  236. List<string> changeBaseCardNames(CardSource cardSource, List<string> CardNames)
  237. {
  238. if (cardSource == selectedPermanent.TopCard)
  239. {
  240. CardNames = new List<string>() { "Sukamon" };
  241. }
  242. return CardNames;
  243. }
  244. }
  245. if (selectedPermanent != null)
  246. {
  247. ChangeBaseCardColorClass changeBaseCardNameClass = new ChangeBaseCardColorClass();
  248. changeBaseCardNameClass.SetUpICardEffect("Original card color is white", CanUseCondition1, card);
  249. changeBaseCardNameClass.SetUpChangeBaseCardColorClass(ChangeBaseCardColors: ChangeBaseCardColors);
  250. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => changeBaseCardNameClass);
  251. bool CanUseCondition1(Hashtable hashtable)
  252. {
  253. if (selectedPermanent.TopCard != null)
  254. {
  255. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  256. {
  257. return true;
  258. }
  259. }
  260. return false;
  261. }
  262. List<CardColor> ChangeBaseCardColors(CardSource cardSource, List<CardColor> CardColors)
  263. {
  264. if (cardSource == selectedPermanent.TopCard)
  265. {
  266. CardColors = new List<CardColor>() { CardColor.White };
  267. }
  268. return CardColors;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. if (timing == EffectTiming.OnAllyAttack)
  276. {
  277. ActivateClass activateClass = new ActivateClass();
  278. activateClass.SetUpICardEffect("This Digimon gains Security Attack+", CanUseCondition, card);
  279. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  280. cardEffects.Add(activateClass);
  281. string EffectDiscription()
  282. {
  283. return "[When Attacking] For each other Digimon with [Sukamon] in its name in play, this Digimon gains <Security Attack +1> for the turn.";
  284. }
  285. int count()
  286. {
  287. return CardEffectCommons.MatchConditionPermanentCount(PermanentCondition);
  288. }
  289. bool PermanentCondition(Permanent permanent)
  290. {
  291. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  292. {
  293. if (permanent.IsDigimon)
  294. {
  295. if (permanent != card.PermanentOfThisCard())
  296. {
  297. if (permanent.TopCard.ContainsCardName("Sukamon"))
  298. {
  299. return true;
  300. }
  301. }
  302. }
  303. }
  304. return false;
  305. }
  306. bool CanUseCondition(Hashtable hashtable)
  307. {
  308. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  309. }
  310. bool CanActivateCondition(Hashtable hashtable)
  311. {
  312. if (CardEffectCommons.IsExistOnBattleArea(card))
  313. {
  314. if (count() >= 1)
  315. {
  316. return true;
  317. }
  318. }
  319. return false;
  320. }
  321. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  322. {
  323. int changeValue = count();
  324. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  325. targetPermanent: card.PermanentOfThisCard(),
  326. changeValue: changeValue,
  327. effectDuration: EffectDuration.UntilEachTurnEnd,
  328. activateClass: activateClass));
  329. }
  330. }
  331. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  332. {
  333. ActivateClass activateClass = new ActivateClass();
  334. activateClass.SetUpICardEffect("Prevent this Digimon from being deleted", CanUseCondition, card);
  335. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  336. activateClass.SetIsInheritedEffect(true);
  337. activateClass.SetHashString("Substitute_BT11_043");
  338. cardEffects.Add(activateClass);
  339. string EffectDiscription()
  340. {
  341. return "[All Turns] When this Digimon would be deleted, by deleting 1 other Digimon with [Sukamon] in its name, prevent that deletion.";
  342. }
  343. bool CanSelectPermanentCondition(Permanent permanent)
  344. {
  345. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  346. {
  347. if (permanent != card.PermanentOfThisCard())
  348. {
  349. if (permanent.TopCard.ContainsCardName("Sukamon"))
  350. {
  351. return true;
  352. }
  353. }
  354. }
  355. return false;
  356. }
  357. bool CanUseCondition(Hashtable hashtable)
  358. {
  359. if (CardEffectCommons.IsExistOnBattleArea(card))
  360. {
  361. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  362. {
  363. return true;
  364. }
  365. }
  366. return false;
  367. }
  368. bool CanActivateCondition(Hashtable hashtable)
  369. {
  370. if (CardEffectCommons.IsExistOnBattleArea(card))
  371. {
  372. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  373. {
  374. return true;
  375. }
  376. }
  377. return false;
  378. }
  379. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  380. {
  381. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  382. {
  383. int maxCount = 1;
  384. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  385. selectPermanentEffect.SetUp(
  386. selectPlayer: card.Owner,
  387. canTargetCondition: CanSelectPermanentCondition,
  388. canTargetCondition_ByPreSelecetedList: null,
  389. canEndSelectCondition: null,
  390. maxCount: maxCount,
  391. canNoSelect: true,
  392. canEndNotMax: false,
  393. selectPermanentCoroutine: SelectPermanentCoroutine,
  394. afterSelectPermanentCoroutine: null,
  395. mode: SelectPermanentEffect.Mode.Custom,
  396. cardEffect: activateClass);
  397. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  398. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  399. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  400. {
  401. Permanent thisCardPermanent = card.PermanentOfThisCard();
  402. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  403. IEnumerator SuccessProcess()
  404. {
  405. if (thisCardPermanent.TopCard != null)
  406. {
  407. thisCardPermanent.willBeRemoveField = false;
  408. thisCardPermanent.HideDeleteEffect();
  409. }
  410. yield return null;
  411. }
  412. }
  413. }
  414. }
  415. }
  416. return cardEffects;
  417. }
  418. }
  419. }