Zanmetsumon_BT16_062.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class Zanmetsumon_BT16_062 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. # region Alternate Digivolution Requirement [Digivolve] Lv.4 w/[Gammamon] in text: Cost 3
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4)
  16. {
  17. if (targetPermanent.TopCard.HasText("Gammamon"))
  18. {
  19. return true;
  20. }
  21. }
  22. return false;
  23. }
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  25. permanentCondition: PermanentCondition,
  26. digivolutionCost: 3,
  27. ignoreDigivolutionRequirement: false,
  28. card: card,
  29. condition: null));
  30. }
  31. #endregion
  32. #region On Play
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("<De-Digivolve 1>, then delete 3 cost", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[On Play] <De-Digivolve 1> 1 of your opponent's Digimon with as much or less DP as this Digimon. Then, delete 1 Digimon with a play cost of 3 or less.";
  42. }
  43. bool CanSelectDedigivolvePermanentCondition(Permanent permanent)
  44. {
  45. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  46. {
  47. if(permanent.HasDP && permanent.DP <= card.PermanentOfThisCard().DP)
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanSelectDeletePermanentCondition(Permanent permanent)
  55. {
  56. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  57. {
  58. if(permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 3)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.IsExistOnBattleArea(card);
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.IsExistOnBattleArea(card))
  76. {
  77. int maxCount = 1;
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDedigivolvePermanentCondition))
  80. {
  81. selectPermanentEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectDedigivolvePermanentCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: maxCount,
  87. canNoSelect: true,
  88. canEndNotMax: false,
  89. selectPermanentCoroutine: null,
  90. afterSelectPermanentCoroutine: AfterSelectDedigivolvePermanentCoroutine,
  91. mode: SelectPermanentEffect.Mode.Custom,
  92. cardEffect: activateClass);
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. }
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeletePermanentCondition))
  96. {
  97. selectPermanentEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectDeletePermanentCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: false,
  104. canEndNotMax: false,
  105. selectPermanentCoroutine: null,
  106. afterSelectPermanentCoroutine: null,
  107. mode: SelectPermanentEffect.Mode.Destroy,
  108. cardEffect: activateClass);
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. }
  111. }
  112. yield return null;
  113. }
  114. IEnumerator AfterSelectDedigivolvePermanentCoroutine(List<Permanent> permanents)
  115. {
  116. foreach (Permanent permanent in permanents)
  117. {
  118. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  119. }
  120. }
  121. }
  122. #endregion
  123. #region When Digivolved
  124. if (timing == EffectTiming.OnEnterFieldAnyone)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("<De-Digivolve 1>, then delete 3 cost", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  129. cardEffects.Add(activateClass);
  130. string EffectDiscription()
  131. {
  132. return "[When Digivolve] <De-Digivolve 1> 1 of your opponent's Digimon with as much or less DP as this Digimon. Then, delete 1 Digimon with a play cost of 3 or less.";
  133. }
  134. bool CanSelectDedigivolvePermanentCondition(Permanent permanent)
  135. {
  136. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  137. {
  138. if (permanent.HasDP && permanent.DP <= card.PermanentOfThisCard().DP)
  139. {
  140. return true;
  141. }
  142. }
  143. return false;
  144. }
  145. bool CanSelectDeletePermanentCondition(Permanent permanent)
  146. {
  147. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  148. {
  149. if (permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 3)
  150. {
  151. return true;
  152. }
  153. }
  154. return false;
  155. }
  156. bool CanUseCondition(Hashtable hashtable)
  157. {
  158. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  159. }
  160. bool CanActivateCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.IsExistOnBattleArea(card);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable hashtable)
  165. {
  166. if (CardEffectCommons.IsExistOnBattleArea(card))
  167. {
  168. int maxCount = 1;
  169. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDedigivolvePermanentCondition))
  171. {
  172. selectPermanentEffect.SetUp(
  173. selectPlayer: card.Owner,
  174. canTargetCondition: CanSelectDedigivolvePermanentCondition,
  175. canTargetCondition_ByPreSelecetedList: null,
  176. canEndSelectCondition: null,
  177. maxCount: maxCount,
  178. canNoSelect: true,
  179. canEndNotMax: false,
  180. selectPermanentCoroutine: null,
  181. afterSelectPermanentCoroutine: AfterSelectDedigivolvePermanentCoroutine,
  182. mode: SelectPermanentEffect.Mode.Custom,
  183. cardEffect: activateClass);
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. }
  186. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeletePermanentCondition))
  187. {
  188. selectPermanentEffect.SetUp(
  189. selectPlayer: card.Owner,
  190. canTargetCondition: CanSelectDeletePermanentCondition,
  191. canTargetCondition_ByPreSelecetedList: null,
  192. canEndSelectCondition: null,
  193. maxCount: maxCount,
  194. canNoSelect: false,
  195. canEndNotMax: false,
  196. selectPermanentCoroutine: null,
  197. afterSelectPermanentCoroutine: null,
  198. mode: SelectPermanentEffect.Mode.Destroy,
  199. cardEffect: activateClass);
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  201. }
  202. }
  203. yield return null;
  204. }
  205. IEnumerator AfterSelectDedigivolvePermanentCoroutine(List<Permanent> permanents)
  206. {
  207. foreach (Permanent permanent in permanents)
  208. {
  209. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  210. }
  211. }
  212. }
  213. #endregion
  214. #region All Turns
  215. if (timing == EffectTiming.None)
  216. {
  217. AddSkillClass addSkillClass = new AddSkillClass();
  218. addSkillClass.SetUpICardEffect("This Digimon gains all effects of [Gammamon] in digivolution cards", CanUseCondition, card);
  219. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  220. cardEffects.Add(addSkillClass);
  221. bool CanUseCondition(Hashtable hashtable)
  222. {
  223. return CardEffectCommons.IsExistOnBattleArea(card);
  224. }
  225. bool PermanentCondition(Permanent permanent)
  226. {
  227. return permanent == card.PermanentOfThisCard();
  228. }
  229. bool CardSourceCondition(CardSource cardSource)
  230. {
  231. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  232. {
  233. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  234. {
  235. return true;
  236. }
  237. }
  238. return false;
  239. }
  240. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  241. {
  242. if (CardSourceCondition(cardSource))
  243. {
  244. foreach (CardSource cardSource1 in cardSource.PermanentOfThisCard().DigivolutionCards)
  245. {
  246. if (cardSource1.ContainsCardName("Gammamon"))
  247. {
  248. foreach (ICardEffect cardEffect in cardSource1.cEntity_EffectController.GetCardEffects_ExceptAddedEffects(_timing, card))
  249. {
  250. if (!cardEffect.IsSecurityEffect && !cardEffect.IsInheritedEffect)
  251. {
  252. cardEffects.Add(cardEffect);
  253. }
  254. }
  255. }
  256. }
  257. }
  258. return cardEffects;
  259. }
  260. }
  261. #endregion
  262. #region All Turns - Inheritable
  263. if (timing == EffectTiming.None)
  264. {
  265. AddSkillClass addSkillClass = new AddSkillClass();
  266. addSkillClass.SetUpICardEffect("This Digimon gains all effects of [Gammamon] in digivolution cards", CanUseCondition, card);
  267. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  268. addSkillClass.SetIsInheritedEffect(true);
  269. cardEffects.Add(addSkillClass);
  270. bool CanUseCondition(Hashtable hashtable)
  271. {
  272. return CardEffectCommons.IsExistOnBattleArea(card);
  273. }
  274. bool PermanentCondition(Permanent permanent)
  275. {
  276. return permanent == card.PermanentOfThisCard();
  277. }
  278. bool CardSourceCondition(CardSource cardSource)
  279. {
  280. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  281. {
  282. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  283. {
  284. return true;
  285. }
  286. }
  287. return false;
  288. }
  289. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  290. {
  291. if (CardSourceCondition(cardSource))
  292. {
  293. foreach (CardSource cardSource1 in cardSource.PermanentOfThisCard().DigivolutionCards)
  294. {
  295. if (cardSource1.ContainsCardName("Gammamon"))
  296. {
  297. foreach (ICardEffect cardEffect in cardSource1.cEntity_EffectController.GetCardEffects_ExceptAddedEffects(_timing, card))
  298. {
  299. if (!cardEffect.IsSecurityEffect && !cardEffect.IsInheritedEffect)
  300. {
  301. cardEffects.Add(cardEffect);
  302. }
  303. }
  304. }
  305. }
  306. }
  307. return cardEffects;
  308. }
  309. }
  310. #endregion
  311. return cardEffects;
  312. }
  313. }
  314. }