BT20_060.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_060 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region DNA Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  14. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  15. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  16. addJogressConditionClass.SetNotShowUI(true);
  17. cardEffects.Add(addJogressConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. JogressCondition GetJogress(CardSource cardSource)
  23. {
  24. if (cardSource == card)
  25. {
  26. bool PermanentConditionA(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  29. permanent.TopCard.CardColors.Contains(CardColor.Black) &&
  30. permanent.Levels_ForJogress(card).Contains(6);
  31. }
  32. bool PermanentConditionB(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  35. (permanent.TopCard.CardColors.Contains(CardColor.Yellow) ||
  36. permanent.TopCard.CardColors.Contains(CardColor.Red)) &&
  37. permanent.Levels_ForJogress(card).Contains(6);
  38. }
  39. JogressConditionElement[] elements =
  40. {
  41. new(PermanentConditionA, "a level 6 Black Digimon"),
  42. new(PermanentConditionB, "a level 6 Yellow or Red Digimon")
  43. };
  44. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  45. return jogressCondition;
  46. }
  47. return null;
  48. }
  49. }
  50. #endregion
  51. #region Ace - Blast DNA Digivolve
  52. if (timing == EffectTiming.OnCounterTiming)
  53. {
  54. List<BlastDNACondition> blastDNAConditions = new List<BlastDNACondition>
  55. {
  56. new("Alphamon"),
  57. new("Ouryumon")
  58. };
  59. cardEffects.Add(CardEffectFactory.BlastDNADigivolveEffect(card: card,
  60. blastDNAConditions: blastDNAConditions, condition: null));
  61. }
  62. #endregion
  63. #region On Play/ When Digivolving Shared
  64. bool CanSelectPermanentConditionShared(Permanent permanent)
  65. {
  66. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  67. }
  68. bool CanActivateConditionShared(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  71. }
  72. #endregion
  73. #region On Play
  74. if (timing == EffectTiming.OnEnterFieldAnyone)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("One of your opponent's Digimon gets -15000 DP", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  79. cardEffects.Add(activateClass);
  80. string EffectDescription()
  81. {
  82. return
  83. "[On Play] 1 of your opponent's Digimon gets -15000 DP until the end of their turn. Then, if DNA digivolving, trash your opponent's top security card and <Recovery +1 (Deck)>.";
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable hashtable)
  90. {
  91. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  92. {
  93. Permanent selectedPermanent = null;
  94. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: CanSelectPermanentConditionShared,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: 1,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: SelectPermanentCoroutine,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Custom,
  106. cardEffect: activateClass);
  107. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -15000.",
  108. "The opponent is selecting 1 Digimon that will get DP -15000.");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  111. {
  112. selectedPermanent = permanent;
  113. yield return null;
  114. }
  115. if (selectedPermanent != null)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  118. targetPermanent: selectedPermanent,
  119. changeValue: -15000,
  120. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  121. activateClass: activateClass));
  122. }
  123. }
  124. if (CardEffectCommons.IsJogress(hashtable))
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  127. player: card.Owner.Enemy,
  128. destroySecurityCount: 1,
  129. cardEffect: activateClass,
  130. fromTop: true).DestroySecurity());
  131. yield return ContinuousController.instance.StartCoroutine(new IRecovery(
  132. player: card.Owner,
  133. AddLifeCount: 1,
  134. cardEffect: activateClass).Recovery());
  135. }
  136. }
  137. }
  138. #endregion
  139. #region When Digivolving
  140. if (timing == EffectTiming.OnEnterFieldAnyone)
  141. {
  142. ActivateClass activateClass = new ActivateClass();
  143. activateClass.SetUpICardEffect("One of your opponent's Digimon gets -15000 DP", CanUseCondition, card);
  144. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  145. cardEffects.Add(activateClass);
  146. string EffectDescription()
  147. {
  148. return
  149. "[When Digivolving] 1 of your opponent's Digimon gets -15000 DP until the end of their turn. Then, if DNA digivolving, trash your opponent's top security card and <Recovery +1 (Deck)>.";
  150. }
  151. bool CanUseCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  154. }
  155. IEnumerator ActivateCoroutine(Hashtable hashtable)
  156. {
  157. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  158. {
  159. Permanent selectedPermanent = null;
  160. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  161. selectPermanentEffect.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition: CanSelectPermanentConditionShared,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. maxCount: 1,
  167. canNoSelect: false,
  168. canEndNotMax: false,
  169. selectPermanentCoroutine: SelectPermanentCoroutine,
  170. afterSelectPermanentCoroutine: null,
  171. mode: SelectPermanentEffect.Mode.Custom,
  172. cardEffect: activateClass);
  173. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -15000.",
  174. "The opponent is selecting 1 Digimon that will get DP -15000.");
  175. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  176. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  177. {
  178. selectedPermanent = permanent;
  179. yield return null;
  180. }
  181. if (selectedPermanent != null)
  182. {
  183. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  184. targetPermanent: selectedPermanent,
  185. changeValue: -15000,
  186. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  187. activateClass: activateClass));
  188. }
  189. }
  190. if (CardEffectCommons.IsJogress(hashtable))
  191. {
  192. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  193. player: card.Owner.Enemy,
  194. destroySecurityCount: 1,
  195. cardEffect: activateClass,
  196. fromTop: true).DestroySecurity());
  197. yield return ContinuousController.instance.StartCoroutine(new IRecovery(
  198. player: card.Owner,
  199. AddLifeCount: 1,
  200. cardEffect: activateClass).Recovery());
  201. }
  202. }
  203. }
  204. #endregion
  205. #region All Turns
  206. if (timing == EffectTiming.OnLoseSecurity)
  207. {
  208. ActivateClass activateClass = new ActivateClass();
  209. activateClass.SetUpICardEffect("Gain 3 memory", CanUseCondition, card);
  210. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  211. activateClass.SetHashString("RemovedSec_BT20_060");
  212. cardEffects.Add(activateClass);
  213. string EffectDescription()
  214. {
  215. return
  216. "[All Turns] (Once Per Turn) When security stacks are removed from, When security stacks are removed from, gain 3 memory.";
  217. }
  218. bool CanUseCondition(Hashtable hashtable)
  219. {
  220. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  221. CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, _ => true);
  222. }
  223. bool CanActivateCondition(Hashtable hashtable)
  224. {
  225. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  226. }
  227. IEnumerator ActivateCoroutine(Hashtable hashtable)
  228. {
  229. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(3, activateClass));
  230. }
  231. }
  232. #endregion
  233. return cardEffects;
  234. }
  235. }
  236. }