BT21_036.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_036 : 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
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Veemon") ||
  17. (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel3 &&
  18. targetPermanent.TopCard.EqualsTraits("Hero"));
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null));
  26. }
  27. #endregion
  28. #region Blocker
  29. if (timing == EffectTiming.None)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  32. isInheritedEffect: false,
  33. card: card,
  34. condition: null));
  35. }
  36. #endregion
  37. #region Armor Purge
  38. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  39. {
  40. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  41. }
  42. #endregion
  43. #region When Digivolving
  44. if (timing == EffectTiming.OnEnterFieldAnyone)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("Unsuspend this Digimon and give 1 enemy Digimon DP-", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  49. cardEffects.Add(activateClass);
  50. string EffectDescription()
  51. {
  52. return
  53. "[When Digivolving] This Digimon unsuspends. Then, to 1 of your opponent's Digimon give -2000 DP for the turn for each card with the [Armor Form] trait in your trash.";
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  58. }
  59. bool CanSelectPermanentCondition(Permanent permanent)
  60. {
  61. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable hashtable)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  70. new List<Permanent>() { card.PermanentOfThisCard() },
  71. activateClass).Unsuspend());
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. int minusDP = -2000 * card.Owner.TrashCards.Count(
  75. cardSource => cardSource.CardTraits.Contains("Armor Form") || cardSource.CardTraits.Contains("ArmorForm"));
  76. SelectPermanentEffect selectPermanentEffect =
  77. GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectPermanentCondition,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: 1,
  84. canNoSelect: false,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: SelectPermanentCoroutine,
  87. afterSelectPermanentCoroutine: null,
  88. mode: SelectPermanentEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will get DP {minusDP}.",
  91. $"The opponent is selecting 1 Digimon that will get DP {minusDP}.");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  96. targetPermanent: permanent,
  97. changeValue: minusDP,
  98. effectDuration: EffectDuration.UntilEachTurnEnd,
  99. activateClass: activateClass));
  100. }
  101. }
  102. }
  103. }
  104. #endregion
  105. return cardEffects;
  106. }
  107. }
  108. }