EX12_026.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Shellmon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_026 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("Shambala");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null, level: 3));
  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/WD
  28. string SharedEffectName = "Trash 2 bottom digivolution sources from 1 enemy Digimon, then 1 enemy Digimon with 1 or less digivolution sources can't attack/block until their turn ends";
  29. CardEffectFactory.ActivateClassesForSharedEffects
  30. (ref cardEffects, timing, card,
  31. SharedEffectName,
  32. SharedActivateCoroutine,
  33. SharedEffectDescription,
  34. optional: false,
  35. onPlay: true,
  36. whenDigivolving: true);
  37. string SharedEffectDescription(string tag) => $"[{tag}] Trash the bottom 2 digivolution cards of 1 of your opponent's Digimon. Then, 1 of their Digimon with 1 or fewer digivolution cards can't attack or block until their turn ends.";
  38. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  39. {
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  42. && permanent.DigivolutionCards.Count >= 1;
  43. bool CanSelectPermanentCondition2(Permanent permanent)
  44. => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  45. && permanent.DigivolutionCards.Count <= 1;
  46. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, 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: false,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: SelectPermanentCoroutine,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Custom,
  60. cardEffect: activateClass);
  61. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  62. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  63. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanent, trashCount: 2, isFromTop: false, activateClass: activateClass));
  66. }
  67. }
  68. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition2))
  69. {
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition2,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: 1,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine2,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that can't attack or block.", "The opponent is selecting 1 Digimon that can't attack or block");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine2(Permanent permanent)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  88. targetPermanent: permanent,
  89. defenderCondition: null,
  90. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  91. activateClass: activateClass,
  92. effectName: "Can't Attack"));
  93. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBlock(
  94. targetPermanent: permanent,
  95. attackerCondition: null,
  96. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  97. activateClass: activateClass,
  98. effectName: "Can't Block"));
  99. }
  100. }
  101. }
  102. #endregion
  103. #region Inherited
  104. if (timing == EffectTiming.OnAllyAttack)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("If you have 7 or fewer cards in hand, <Draw 1>.", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  109. activateClass.SetIsInheritedEffect(true);
  110. activateClass.SetHashString("EX12_026_Inherited");
  111. cardEffects.Add(activateClass);
  112. string EffectDescription()
  113. => "[When Attacking] [Once Per Turn] If your hand has 7 or fewer cards, <Draw 1>.";
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  117. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  118. }
  119. bool CanActivateCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass);
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable hashtable)
  124. {
  125. bool Used = false;
  126. if (card.Owner.HandCards.Count <= 7)
  127. {
  128. Used = true;
  129. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  130. }
  131. if (!Used)
  132. {
  133. activateClass.RemoveUse();
  134. }
  135. }
  136. }
  137. #endregion
  138. return cardEffects;
  139. }
  140. }
  141. }