Candlemon_BT18_030.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class Candlemon_BT18_030 : CEntity_Effect
  6. {
  7. List<ICardEffect> cardEffects = new List<ICardEffect>();
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. #region On Play
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal top 3, add 1 yellow Data and 1 Witchelny", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] Reveal the top 3 cards of your deck. Add 1 yellow card with the [Data] trait and 1 card with the [Witchelny] trait among them to the hand. Return the rest to the bottom of the deck.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. return (cardSource.CardTraits.Contains("Data") && cardSource.CardColors.Contains(CardColor.Yellow));
  24. }
  25. bool CanSelectCardCondition1(CardSource cardSource)
  26. {
  27. return cardSource.CardTraits.Contains("Witchelny");
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  36. {
  37. if (card.Owner.LibraryCards.Count >= 1)
  38. return true;
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  45. revealCount: 3,
  46. simplifiedSelectCardConditions:
  47. new SimplifiedSelectCardConditionClass[]
  48. {
  49. new SimplifiedSelectCardConditionClass(
  50. canTargetCondition:CanSelectCardCondition,
  51. message: "Select 1 yellow card with [Data] in its traits.",
  52. mode: SelectCardEffect.Mode.AddHand,
  53. maxCount: 1,
  54. selectCardCoroutine: null),
  55. new SimplifiedSelectCardConditionClass(
  56. canTargetCondition:CanSelectCardCondition1,
  57. message: "Select 1 card with [Witchelny] in its traits.",
  58. mode: SelectCardEffect.Mode.AddHand,
  59. maxCount: 1,
  60. selectCardCoroutine: null),
  61. },
  62. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  63. activateClass: activateClass
  64. ));
  65. }
  66. }
  67. #endregion
  68. #region All Turns - Inherited
  69. if (timing == EffectTiming.WhenRemoveField)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect("Trash 1 security to prevent this Digimon from leaving Battle Area", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  74. activateClass.SetHashString("TrashSecurityToStay_Candlemon_BT18_030");
  75. activateClass.SetIsInheritedEffect(true);
  76. cardEffects.Add(activateClass);
  77. string EffectDiscription()
  78. {
  79. return "[All Turns] When this yellow Digimon with the [Data] or [Witchelny] trait would leave the battle area by an opponent's effect, by trashing your top security card, it doesn't leave.";
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  84. {
  85. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  86. {
  87. if (CardEffectCommons.IsByEffect(hashtable, cardEffect => CardEffectCommons.IsOpponentEffect(cardEffect, card)))
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  96. {
  97. if (card.CardColors.Contains(CardColor.Yellow) &&
  98. (card.CardTraits.Contains("Data") || card.CardTraits.Contains("Witchelny")))
  99. {
  100. if (card.Owner.SecurityCards.Count >= 1 )
  101. return true;
  102. }
  103. }
  104. return false;
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card) || card.Owner.SecurityCards.Count >= 1)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  111. player: card.Owner,
  112. destroySecurityCount: 1,
  113. cardEffect: activateClass,
  114. fromTop: true).DestroySecurity());
  115. Permanent thisCardPermanent = card.PermanentOfThisCard();
  116. thisCardPermanent.willBeRemoveField = false;
  117. thisCardPermanent.HideDeleteEffect();
  118. thisCardPermanent.HideHandBounceEffect();
  119. thisCardPermanent.HideDeckBounceEffect();
  120. thisCardPermanent.HideWillRemoveFieldEffect();
  121. yield return null;
  122. }
  123. }
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }