ST20_05.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //ST20-05 Gatomon
  5. namespace DCGO.CardEffects.ST20
  6. {
  7. public class ST20_05 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("ADVENTURE") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Playing from security
  23. if (timing == EffectTiming.SecuritySkill)
  24. {
  25. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  26. }
  27. #endregion
  28. #region Shared on-play/when-digivolving
  29. bool CanSelectPermanentConditionShared(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  32. }
  33. bool CanActivateConditionShared(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  36. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared);
  37. }
  38. #endregion
  39. #region On Play
  40. if (timing == EffectTiming.OnEnterFieldAnyone)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Give 2 of your opponent's Digimon <Security A. -1> until their turn ends.", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDiscription());
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[On Play] Give 2 of your opponent's Digimon <Security A. -1> until their turn ends.";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  57. {
  58. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
  59. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectPermanentConditionShared,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: maxCount,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: SelectPermanentCoroutine,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon that will get Security Attack -1.", "The opponent is selecting 2 Digimon that will get Security Attack -1.");
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  74. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  77. yield return null;
  78. }
  79. }
  80. }
  81. }
  82. #endregion
  83. #region When Digivolving
  84. if (timing == EffectTiming.OnEnterFieldAnyone)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("Give 2 of your opponent's Digimon <Security A. -1> until their turn ends.", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDiscription());
  89. cardEffects.Add(activateClass);
  90. string EffectDiscription()
  91. {
  92. return "[When Digivolving] Give 2 of your opponent's Digimon <Security A. -1> until their turn ends.";
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  101. {
  102. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentConditionShared,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: SelectPermanentCoroutine,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon that will get Security Attack -1.", "The opponent is selecting 2 Digimon that will get Security Attack -1.");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  121. yield return null;
  122. }
  123. }
  124. }
  125. }
  126. #endregion
  127. #region When Attacking - ESS
  128. if (timing == EffectTiming.OnAllyAttack)
  129. {
  130. ActivateClass activateClass = new ActivateClass();
  131. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  132. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  133. EffectDescription());
  134. activateClass.SetIsInheritedEffect(true);
  135. activateClass.SetHashString("DP-2000_ST20-005");
  136. cardEffects.Add(activateClass);
  137. string EffectDescription()
  138. {
  139. return "[When Attacking][Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  140. }
  141. bool CanSelectPermanentCondition(Permanent permanent)
  142. {
  143. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  144. }
  145. bool CanUseCondition(Hashtable hashtable)
  146. {
  147. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  148. }
  149. bool CanActivateCondition(Hashtable hashtable)
  150. {
  151. if (CardEffectCommons.IsExistOnBattleArea(card))
  152. {
  153. return true;
  154. }
  155. return false;
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  160. {
  161. int maxCount = Math.Min(1,
  162. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  163. SelectPermanentEffect selectPermanentEffect =
  164. GManager.instance.GetComponent<SelectPermanentEffect>();
  165. selectPermanentEffect.SetUp(
  166. selectPlayer: card.Owner,
  167. canTargetCondition: CanSelectPermanentCondition,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: maxCount,
  171. canNoSelect: false,
  172. canEndNotMax: false,
  173. selectPermanentCoroutine: SelectPermanentCoroutine,
  174. afterSelectPermanentCoroutine: null,
  175. mode: SelectPermanentEffect.Mode.Custom,
  176. cardEffect: activateClass);
  177. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.",
  178. "The opponent is selecting 1 Digimon that will get DP -2000.");
  179. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  180. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  181. {
  182. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  183. targetPermanent: permanent,
  184. changeValue: -2000,
  185. effectDuration: EffectDuration.UntilEachTurnEnd,
  186. activateClass: activateClass));
  187. }
  188. }
  189. }
  190. }
  191. #endregion
  192. return cardEffects;
  193. }
  194. }
  195. }