BT23_028.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Coordemon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_028 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasStandardAppTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Security
  24. if (timing == EffectTiming.SecuritySkill)
  25. {
  26. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  27. }
  28. #endregion
  29. #region Link Condition
  30. if (timing == EffectTiming.None)
  31. {
  32. static bool PermanentCondition(Permanent targetPermanent)
  33. {
  34. return targetPermanent.TopCard.HasAppmonTraits;
  35. }
  36. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  37. }
  38. #endregion
  39. #region Link
  40. if (timing == EffectTiming.OnDeclaration)
  41. {
  42. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  43. }
  44. #endregion
  45. #endregion
  46. #region OP/WD Shared
  47. bool IsOpponentsDigimon(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  50. }
  51. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  54. {
  55. Permanent selectedPermanent = null;
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: IsOpponentsDigimon,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectedPermanent,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. IEnumerator SelectedPermanent(Permanent target)
  71. {
  72. selectedPermanent = target;
  73. yield return null;
  74. }
  75. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain -3K DP.", "The opponent is selecting 1 Digimon that will gain -3K DP.");
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  77. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  78. targetPermanent: selectedPermanent,
  79. changeValue: -3000,
  80. effectDuration: EffectDuration.UntilEachTurnEnd,
  81. activateClass: activateClass));
  82. }
  83. }
  84. #endregion
  85. #region On Play
  86. if (timing == EffectTiming.OnEnterFieldAnyone)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("-3K DP", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription());
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[On Play] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  99. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  100. }
  101. bool CanActivateCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  104. }
  105. }
  106. #endregion
  107. #region When Digivolving
  108. if (timing == EffectTiming.OnEnterFieldAnyone)
  109. {
  110. ActivateClass activateClass = new ActivateClass();
  111. activateClass.SetUpICardEffect("-3K DP", CanUseCondition, card);
  112. activateClass.SetUpActivateClass(CanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, EffectDiscription());
  113. cardEffects.Add(activateClass);
  114. string EffectDiscription()
  115. {
  116. return "[When Digivolving] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  117. }
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  121. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  122. }
  123. bool CanActivateCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  126. }
  127. }
  128. #endregion
  129. #region Link Effect
  130. if (timing == EffectTiming.WhenLinked)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect("1 digimon gains can't activate [When Digivolving] effects.", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  135. activateClass.SetIsLinkedEffect(true);
  136. cardEffects.Add(activateClass);
  137. string EffectDiscription()
  138. {
  139. return "[When Linking] Until your opponent's turn ends, 1 of their Digimon can't activate [When Digivolving] effects.";
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  144. && CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  149. }
  150. IEnumerator ActivateCoroutine(Hashtable hashtable)
  151. {
  152. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  153. {
  154. Permanent selectedPermanent = null;
  155. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  156. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  157. selectPermanentEffect.SetUp(
  158. selectPlayer: card.Owner,
  159. canTargetCondition: IsOpponentsDigimon,
  160. canTargetCondition_ByPreSelecetedList: null,
  161. canEndSelectCondition: null,
  162. maxCount: maxCount,
  163. canNoSelect: false,
  164. canEndNotMax: false,
  165. selectPermanentCoroutine: SelectedPermanent,
  166. afterSelectPermanentCoroutine: null,
  167. mode: SelectPermanentEffect.Mode.Custom,
  168. cardEffect: activateClass);
  169. IEnumerator SelectedPermanent(Permanent target)
  170. {
  171. selectedPermanent = target;
  172. yield return null;
  173. }
  174. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain cant activate [When Digivolving] effects.", "The opponent is selecting 1 Digimon that will gain cant activate [When Digivolving] effects.");
  175. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  176. if (selectedPermanent != null)
  177. {
  178. DisableEffectClass invalidationClass = new DisableEffectClass();
  179. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseConditionDebuff, card);
  180. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  181. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  182. bool CanUseConditionDebuff(Hashtable hashtableDebuff)
  183. {
  184. return true;
  185. }
  186. bool InvalidateCondition(ICardEffect cardEffect)
  187. {
  188. if (selectedPermanent.TopCard != null)
  189. {
  190. if (cardEffect != null)
  191. {
  192. if (cardEffect.EffectSourceCard != null)
  193. {
  194. if (isExistOnField(cardEffect.EffectSourceCard))
  195. {
  196. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent)
  197. {
  198. if (cardEffect.IsWhenDigivolving)
  199. {
  200. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  201. {
  202. return true;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. }
  209. }
  210. return false;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. #endregion
  217. return cardEffects;
  218. }
  219. }
  220. }