EX9_025.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Airdramon
  5. namespace DCGO.CardEffects.EX9
  6. {
  7. public class EX9_025 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Alternative Digivolution Cost
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. if (targetPermanent.TopCard.IsLevel3)
  19. {
  20. if (targetPermanent.TopCard.EqualsTraits("DM"))
  21. {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  28. permanentCondition: PermanentCondition,
  29. digivolutionCost: 2,
  30. ignoreDigivolutionRequirement: false,
  31. card: card,
  32. condition: null)
  33. );
  34. }
  35. #endregion
  36. #region Training
  37. if (timing == EffectTiming.OnDeclaration)
  38. {
  39. cardEffects.Add(CardEffectFactory.TrainingEffect(card: card));
  40. }
  41. #endregion
  42. #endregion
  43. #region When Attacking
  44. if (timing == EffectTiming.OnAllyAttack)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect($"By Placing top card FD as bottom source card, give -2000 DP to 1 digimon for each FD source", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  49. activateClass.SetHashString("EX9_025_WA");
  50. cardEffects.Add(activateClass);
  51. string EffectDiscription()
  52. {
  53. return "[When Attacking] [Once Per Turn] By placing your deck's top card face down as this Digimon's bottom digivolution card, to 1 of your opponent's Digimon, give -2000 DP for the turn for each of this Digimon's face-down digivolution cards.";
  54. }
  55. bool CanSelectOpponentsDigimon(Permanent permanent)
  56. {
  57. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  62. }
  63. bool CanActivateCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  66. {
  67. if (card.Owner.LibraryCards.Count >= 1)
  68. {
  69. return true;
  70. }
  71. }
  72. return false;
  73. }
  74. IEnumerator ActivateCoroutine(Hashtable hashtable)
  75. {
  76. Permanent thisPermanent = card.PermanentOfThisCard();
  77. CardSource selectedCard = card.Owner.LibraryCards[0];
  78. yield return ContinuousController.instance.StartCoroutine(thisPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  79. if (thisPermanent.DigivolutionCards.Contains(selectedCard))
  80. {
  81. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimon))
  82. {
  83. Permanent selectedPermanent = null;
  84. int DPMinus() => thisPermanent.DigivolutionCards.Filter(x => x.IsFlipped).Count * 2000;
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: CanSelectOpponentsDigimon,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: 1,
  92. canNoSelect: false,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: SelectPermanentCoroutine,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon to give -{DPMinus()}.", $"The opponent is selecting 1 Digimon to give -{DPMinus()}.");
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  101. {
  102. selectedPermanent = permanent;
  103. yield return null;
  104. }
  105. if (selectedPermanent != null)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  108. targetPermanent: selectedPermanent,
  109. changeValue: -DPMinus(),
  110. effectDuration: EffectDuration.UntilEachTurnEnd,
  111. activateClass: activateClass));
  112. }
  113. }
  114. }
  115. }
  116. }
  117. #endregion
  118. #region ESS
  119. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  120. {
  121. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: null));
  122. }
  123. #endregion
  124. return cardEffects;
  125. }
  126. }
  127. }