BT16_062.cs 16 KB

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