EX12_025.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Gawappamon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_025 : 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: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Blocker
  22. if (timing == EffectTiming.None)
  23. {
  24. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region Shared OP / OD
  28. string SharedEffectName = "May bounce 1 enemy lvl 4 or lower Digimon.";
  29. CardEffectFactory.ActivateClassesForSharedEffects
  30. (ref cardEffects, timing, card,
  31. SharedEffectName,
  32. SharedActivateCoroutine,
  33. SharedEffectDescription,
  34. optional: false,
  35. onPlay: true,
  36. onDeletion: true);
  37. string SharedEffectDescription(string tag) => $"[{tag}] You may return 1 of your opponent's level 4 or lower Digimon to the hand.";
  38. bool CanSelectPermanentCondition(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  41. && permanent.TopCard.HasLevel
  42. && permanent.TopCard.Level <= 4;
  43. }
  44. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  45. {
  46. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  47. {
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectPermanentCondition,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: 1,
  55. canNoSelect: true,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: null,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Bounce,
  60. cardEffect: activateClass);
  61. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  62. }
  63. }
  64. #endregion
  65. #region Inherited
  66. if (timing == EffectTiming.OnAllyAttack)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("If you have 7 or fewer cards in hand, <Draw 1>.", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  71. activateClass.SetIsInheritedEffect(true);
  72. activateClass.SetHashString("EX12_025_Inherited");
  73. cardEffects.Add(activateClass);
  74. string EffectDescription()
  75. => "[When Attacking] [Once Per Turn] If your hand has 7 or fewer cards, <Draw 1>.";
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  79. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  80. }
  81. bool CanActivateCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.IsExistOnBattleArea(card);
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  86. {
  87. bool Used = false;
  88. if (card.Owner.HandCards.Count <= 7)
  89. {
  90. Used = true;
  91. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  92. }
  93. if (!Used)
  94. {
  95. activateClass.RemoveUse();
  96. }
  97. }
  98. }
  99. #endregion
  100. return cardEffects;
  101. }
  102. }
  103. }