EX7_028.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_028 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel4 && targetPermanent.TopCard.ContainsTraits("NSp");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 3,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region On Deletion
  27. if (timing == EffectTiming.OnDestroyedAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Play Digimon from hand.", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return
  36. "[On Deletion] You may play 1 yellow or [NSp] trait Digimon card with a play cost of 4 or less from your hand without paying the cost.";
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  41. }
  42. bool CanSelectCardCondition(CardSource cardSource)
  43. {
  44. return cardSource.IsDigimon &&
  45. cardSource.HasPlayCost &&
  46. cardSource.GetCostItself <= 4 &&
  47. (cardSource.CardColors.Contains(CardColor.Yellow) ||
  48. cardSource.ContainsTraits("NSp"));
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanActivateOnDeletion(card) &&
  53. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  58. {
  59. List<CardSource> selectedCards = new List<CardSource>();
  60. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  61. selectHandEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: CanSelectCardCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: 1,
  67. canNoSelect: true,
  68. canEndNotMax: false,
  69. isShowOpponent: true,
  70. selectCardCoroutine: SelectCardCoroutine,
  71. afterSelectCardCoroutine: null,
  72. mode: SelectHandEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectHandEffect.SetUpCustomMessage("Select 1 Digimon card to play.",
  75. "The opponent is selecting 1 Digimon card to play.");
  76. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  77. yield return StartCoroutine(selectHandEffect.Activate());
  78. IEnumerator SelectCardCoroutine(CardSource cardSource)
  79. {
  80. selectedCards.Add(cardSource);
  81. yield return null;
  82. }
  83. yield return ContinuousController.instance.StartCoroutine(
  84. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  85. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  86. }
  87. }
  88. }
  89. #endregion
  90. #region When Attacking - ESS
  91. if (timing == EffectTiming.OnAllyAttack)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("DP -4000", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  96. EffectDescription());
  97. activateClass.SetIsInheritedEffect(true);
  98. cardEffects.Add(activateClass);
  99. string EffectDescription()
  100. {
  101. return "[When Attacking] (Once Per Turn) 1 of your opponent's Digimon gets -4000 DP for the turn.";
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  106. }
  107. bool CanSelectPermanentCondition(Permanent permanent)
  108. {
  109. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  114. }
  115. IEnumerator ActivateCoroutine(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  118. {
  119. SelectPermanentEffect selectPermanentEffect =
  120. GManager.instance.GetComponent<SelectPermanentEffect>();
  121. selectPermanentEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectPermanentCondition,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: 1,
  127. canNoSelect: false,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: SelectPermanentCoroutine,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.Custom,
  132. cardEffect: activateClass);
  133. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.",
  134. "The opponent is selecting 1 Digimon that will get DP -4000.");
  135. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  136. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  137. {
  138. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  139. targetPermanent: permanent,
  140. changeValue: -4000,
  141. effectDuration: EffectDuration.UntilEachTurnEnd,
  142. activateClass: activateClass));
  143. }
  144. }
  145. }
  146. }
  147. #endregion
  148. return cardEffects;
  149. }
  150. }
  151. }