EX12_022.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Kamemon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_022 : 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.EqualsTraits("Shambala");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 2, permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Reveal 3, Add 1 [Shambala] trait and 1 [SW] trait, bot deck the rest", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  27. cardEffects.Add(activateClass);
  28. string EffectDescription()
  29. {
  30. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Shambala] trait and 1 card with [SW] trait among them to the hand. Return the rest to the bottom of the deck.";
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnPlay(hashtable, card)
  35. && CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  40. }
  41. bool CanSelectCardCondition(CardSource cardSource)
  42. {
  43. return cardSource.EqualsTraits("Shambala");
  44. }
  45. bool CanSelectCardCondition1(CardSource cardSource)
  46. {
  47. return cardSource.EqualsTraits("SW");
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. if (card.Owner.LibraryCards.Count > 0)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  54. revealCount: 3,
  55. simplifiedSelectCardConditions:
  56. new SimplifiedSelectCardConditionClass[]
  57. {
  58. new SimplifiedSelectCardConditionClass(
  59. canTargetCondition:CanSelectCardCondition,
  60. message: "Select 1 [Shambala] trait card.",
  61. mode: SelectCardEffect.Mode.AddHand,
  62. maxCount: 1,
  63. selectCardCoroutine: null),
  64. new SimplifiedSelectCardConditionClass(
  65. canTargetCondition:CanSelectCardCondition1,
  66. message: "Select 1 [SW] trait card.",
  67. mode: SelectCardEffect.Mode.AddHand,
  68. maxCount: 1,
  69. selectCardCoroutine: null),
  70. },
  71. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  72. activateClass: activateClass
  73. ));
  74. }
  75. }
  76. }
  77. #endregion
  78. #region Inherited
  79. if (timing == EffectTiming.OnAllyAttack)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("If you have 7 or fewer cards in hand, <Draw 1>.", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  84. activateClass.SetIsInheritedEffect(true);
  85. activateClass.SetHashString("EX12_022_Inherited");
  86. cardEffects.Add(activateClass);
  87. string EffectDescription()
  88. => "[When Attacking] [Once Per Turn] If your hand has 7 or fewer cards, <Draw 1>.";
  89. bool CanUseCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  92. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  93. }
  94. bool CanActivateCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.IsExistOnBattleArea(card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. bool Used = false;
  101. if (card.Owner.HandCards.Count <= 7)
  102. {
  103. Used = true;
  104. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  105. }
  106. if (!Used)
  107. {
  108. activateClass.RemoveUse();
  109. }
  110. }
  111. }
  112. #endregion
  113. return cardEffects;
  114. }
  115. }
  116. }