BT21_043.cs 12 KB

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