BT15_039.cs 19 KB

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