EX8_034.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX8
  5. {
  6. public class EX8_034 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Conditions
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 4)
  17. return targetPermanent.TopCard.EqualsTraits("NSo");
  18. return false;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region When Digivolving
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Play 1 NSo Digimon card with a play cost 3 or less from your hand",
  34. CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  36. cardEffects.Add(activateClass);
  37. string EffectDescription()
  38. {
  39. return "[When Digivolving] You may play 1 [NSo] trait Digimon card with a play cost of 3 or less from your hand without paying the cost.";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  44. }
  45. bool CanSelectCardCondition(CardSource cardSource)
  46. {
  47. return cardSource.IsDigimon &&
  48. cardSource.EqualsTraits("NSo") &&
  49. cardSource.HasPlayCost && cardSource.GetCostItself <= 3;
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.IsExistOnBattleArea(card) &&
  54. card.Owner.HandCards.Some(CanSelectCardCondition);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable hashtable)
  57. {
  58. if (card.Owner.HandCards.Some(CanSelectCardCondition))
  59. {
  60. List<CardSource> selectedCards = new List<CardSource>();
  61. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  62. selectHandEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectCardCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: true,
  69. canEndNotMax: false,
  70. isShowOpponent: true,
  71. selectCardCoroutine: SelectCardCoroutine,
  72. afterSelectCardCoroutine: null,
  73. mode: SelectHandEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectHandEffect.SetUpCustomMessage("Select 1 Digimon card to play.",
  76. "The opponent is selecting 1 Digimon card to play.");
  77. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  78. yield return StartCoroutine(selectHandEffect.Activate());
  79. IEnumerator SelectCardCoroutine(CardSource cardSource)
  80. {
  81. selectedCards.Add(cardSource);
  82. yield return null;
  83. }
  84. yield return ContinuousController.instance.StartCoroutine(
  85. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  86. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  87. }
  88. }
  89. }
  90. #endregion
  91. #region On Deletion
  92. if (timing == EffectTiming.OnDestroyedAnyone)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect("2 Opponent's Digimon gain Security Attack -1", CanUseCondition, card);
  96. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  97. cardEffects.Add(activateClass);
  98. string EffectDescription()
  99. {
  100. return "[On Deletion] Give 2 of your opponent's Digimon <Security A. -1> until the end of their turn.";
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanActivateOnDeletion(card);
  109. }
  110. bool CanSelectPermanentCondition(Permanent permanent)
  111. {
  112. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  117. {
  118. int maxCount = Math.Min(2,
  119. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  120. SelectPermanentEffect selectPermanentEffect =
  121. GManager.instance.GetComponent<SelectPermanentEffect>();
  122. selectPermanentEffect.SetUp(
  123. selectPlayer: card.Owner,
  124. canTargetCondition: CanSelectPermanentCondition,
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. maxCount: maxCount,
  128. canNoSelect: false,
  129. canEndNotMax: false,
  130. selectPermanentCoroutine: SelectPermanentCoroutine,
  131. afterSelectPermanentCoroutine: null,
  132. mode: SelectPermanentEffect.Mode.Custom,
  133. cardEffect: activateClass);
  134. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon that will get Security Attack -1.",
  135. "The opponent is selecting 2 Digimon that will get Security Attack -1.");
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(
  140. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  141. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  142. yield return null;
  143. }
  144. }
  145. }
  146. }
  147. #endregion
  148. #region Inherited Effect
  149. if (timing == EffectTiming.OnAllyAttack)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("DP -4000", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  154. EffectDescription());
  155. activateClass.SetIsInheritedEffect(true);
  156. cardEffects.Add(activateClass);
  157. string EffectDescription()
  158. {
  159. return "[When Attacking] (Once Per Turn) 1 of your opponent's Digimon gets -4000 DP for the turn.";
  160. }
  161. bool CanUseCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  164. }
  165. bool CanSelectPermanentCondition(Permanent permanent)
  166. {
  167. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  168. }
  169. bool CanActivateCondition(Hashtable hashtable)
  170. {
  171. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  176. {
  177. SelectPermanentEffect selectPermanentEffect =
  178. GManager.instance.GetComponent<SelectPermanentEffect>();
  179. selectPermanentEffect.SetUp(
  180. selectPlayer: card.Owner,
  181. canTargetCondition: CanSelectPermanentCondition,
  182. canTargetCondition_ByPreSelecetedList: null,
  183. canEndSelectCondition: null,
  184. maxCount: 1,
  185. canNoSelect: false,
  186. canEndNotMax: false,
  187. selectPermanentCoroutine: SelectPermanentCoroutine,
  188. afterSelectPermanentCoroutine: null,
  189. mode: SelectPermanentEffect.Mode.Custom,
  190. cardEffect: activateClass);
  191. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.",
  192. "The opponent is selecting 1 Digimon that will get DP -4000.");
  193. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  194. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  195. {
  196. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  197. targetPermanent: permanent,
  198. changeValue: -4000,
  199. effectDuration: EffectDuration.UntilEachTurnEnd,
  200. activateClass: activateClass));
  201. }
  202. }
  203. }
  204. }
  205. #endregion
  206. return cardEffects;
  207. }
  208. }
  209. }