BT14_099.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_099 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] Trash the top 3 cards of your deck. Then, 1 of your Digimon with [Devimon] in its name gains <Security A. +1> for the turn.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.TopCard.ContainsCardName("Devimon"))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(3, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  39. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  40. {
  41. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  42. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  43. selectPermanentEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: CanSelectPermanentCondition,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: maxCount,
  49. canNoSelect: false,
  50. canEndNotMax: false,
  51. selectPermanentCoroutine: SelectPermanentCoroutine,
  52. afterSelectPermanentCoroutine: null,
  53. mode: SelectPermanentEffect.Mode.Custom,
  54. cardEffect: activateClass);
  55. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain Security Attack +1.", "The opponent is selecting 1 Digimon to gain Security Attack +1.");
  56. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  57. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  60. targetPermanent: permanent,
  61. changeValue: 1,
  62. effectDuration: EffectDuration.UntilEachTurnEnd,
  63. activateClass: activateClass));
  64. }
  65. }
  66. }
  67. }
  68. if (timing == EffectTiming.SecuritySkill)
  69. {
  70. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Trash 3 cards from deck top and your 1 Digimon gains Security Attack +1");
  71. }
  72. return cardEffects;
  73. }
  74. }
  75. }