EX10_003.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX10
  5. {
  6. public class EX10_003 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region ESS
  12. if (timing == EffectTiming.OnAllyAttack)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("by trashing 3 digivolution sources, end an attack", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  17. activateClass.SetIsInheritedEffect(true);
  18. activateClass.SetHashString("ESS_EX10-003");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Opponent's Turn] [Once Per Turn] When one of your opponent's Digimon attacks, by trashing 3 [Mineral] or [Rock] trait cards from this Digimon's digivolution cards, end that attack.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  27. CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, OpponentsDigimon);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  32. CardEffectCommons.IsOpponentTurn(card) &&
  33. card.PermanentOfThisCard().DigivolutionCards.Count(ProperSources) >= 3;
  34. }
  35. bool OpponentsDigimon(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  38. }
  39. bool ProperSources(CardSource source)
  40. {
  41. return !source.CanNotTrashFromDigivolutionCards(activateClass) &&
  42. (source.EqualsTraits("Rock") ||
  43. source.EqualsTraits("Mineral"));
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable hashtable)
  46. {
  47. Permanent permanent = card.PermanentOfThisCard();
  48. List<CardSource> selectedCards = new List<CardSource>();
  49. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  50. selectCardEffect.SetUp(
  51. canTargetCondition: ProperSources,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. canNoSelect: () => true,
  55. selectCardCoroutine: null,
  56. afterSelectCardCoroutine: SelectCardCoroutine,
  57. message: "Select digivolution cards to trash",
  58. maxCount: 3,
  59. canEndNotMax: false,
  60. isShowOpponent: true,
  61. mode: SelectCardEffect.Mode.Custom,
  62. root: SelectCardEffect.Root.Custom,
  63. customRootCardList: permanent.DigivolutionCards,
  64. canLookReverseCard: false,
  65. selectPlayer: card.Owner,
  66. cardEffect: null);
  67. selectCardEffect.SetUpCustomMessage("Select digivolution cards to trash.", "The opponent is selecting digivolution cards to return to trash.");
  68. selectCardEffect.SetNotShowCard();
  69. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  70. IEnumerator SelectCardCoroutine(List<CardSource> cardSources)
  71. {
  72. selectedCards = cardSources;
  73. yield return null;
  74. }
  75. if (selectedCards.Count >= 3)
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(new ITrashDigivolutionCards(permanent, selectedCards, activateClass).TrashDigivolutionCards());
  78. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.EndAttack());
  79. }
  80. }
  81. }
  82. #endregion
  83. return cardEffects;
  84. }
  85. }
  86. }