BT22_054.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Hagurumon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_054 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasCSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Your Turn
  29. if (timing == EffectTiming.OnAddDigivolutionCards)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Give 1 digimon -3k DP", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  34. activateClass.SetHashString("BT22_054_OnAddDigivolutionCards");
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[Your Turn] [Once Per Turn] When effects place Digimon cards with the [CS] trait in this Digimon's digivolution cards, 1 of your opponent's Digimon gets -3000 DP for the turn.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOnAddDigivolutionCard(hashtable, IsThisPermanent, null, IsCSDigimon);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  47. && CardEffectCommons.IsOwnerTurn(card)
  48. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition);
  49. }
  50. bool IsThisPermanent(Permanent permanent)
  51. {
  52. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) && permanent == card.PermanentOfThisCard();
  53. }
  54. bool IsCSDigimon(CardSource source)
  55. {
  56. return source.IsDigimon && source.HasCSTraits;
  57. }
  58. bool CanSelectPermanentCondition(Permanent permanent)
  59. {
  60. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  65. {
  66. Permanent selectedPermament = null;
  67. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
  68. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  69. selectPermanentEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: CanSelectPermanentCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: maxCount,
  75. canNoSelect: false,
  76. canEndNotMax: false,
  77. selectPermanentCoroutine: SelectPermanentCoroutine,
  78. afterSelectPermanentCoroutine: null,
  79. mode: SelectPermanentEffect.Mode.Custom,
  80. cardEffect: activateClass);
  81. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  82. {
  83. selectedPermament = permanent;
  84. yield return null;
  85. }
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to give -3k DP.", "The opponent is selecting 1 Digimon to give -3k DP.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(selectedPermament, -3000, EffectDuration.UntilEachTurnEnd, activateClass));
  89. }
  90. }
  91. }
  92. #endregion
  93. #region ESS
  94. if (timing == EffectTiming.OnDeclaration)
  95. {
  96. ActivateClass activateClass = new ActivateClass();
  97. activateClass.SetUpICardEffect("Place the top card of this Digimon at the bottom of digivolution cards to Draw 1", CanUseCondition, card);
  98. activateClass.SetUpActivateClass(null, ActivateCoroutine, 1, false, EffectDiscription());
  99. activateClass.SetIsInheritedEffect(true);
  100. activateClass.SetHashString("ReturnDigivolutionCards_BT22_054");
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[Main] [Once Per Turn] By placing this [CS] trait Digimon's top stacked card as its bottom digivolution card, <Draw 1> (Draw 1 card from your deck).";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  109. && card.PermanentOfThisCard().DigivolutionCards.Count >= 1
  110. && card.PermanentOfThisCard().TopCard.HasCSTraits;
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  113. {
  114. if (CardEffectCommons.IsExistOnBattleArea(card) && card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  115. {
  116. CardSource topCard = card.PermanentOfThisCard().TopCard;
  117. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { topCard }, activateClass));
  118. if (card.Owner.LibraryCards.Count >= 1) yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  119. }
  120. }
  121. }
  122. #endregion
  123. return cardEffects;
  124. }
  125. }
  126. }