BT25_033.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Aegiomon
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_033 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolve Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasTSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null, level: 3));
  20. }
  21. #endregion
  22. #region Barrier
  23. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  24. {
  25. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region Shared OP / WD
  29. string SharedEffectName = "By adding your top security card to your hand, -5000 DP to an enemy Digimon.";
  30. string SharedEffectDescription(string tag) => $"[{tag}] By adding your top security card to the hand, 1 of your opponent's Digimon gets -5000 DP for the turn.";
  31. bool CanSelectEnemyDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  32. bool AdditionCanActivate(Hashtable hashtable, ActivateClass activateClass) => card.Owner.SecurityCards.Any();
  33. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  34. {
  35. CardSource topCard = card.Owner.SecurityCards[0];
  36. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  37. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(player: card.Owner, refSkillInfos: ref ContinuousController.instance.nullSkillInfos, activateClass).ReduceSecurity());
  38. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectEnemyDigimon))
  39. {
  40. Permanent selectedPermanent = null;
  41. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  42. selectPermanentEffect.SetUp(
  43. selectPlayer: card.Owner,
  44. canTargetCondition: CanSelectEnemyDigimon,
  45. canTargetCondition_ByPreSelecetedList: null,
  46. canEndSelectCondition: null,
  47. maxCount: 1,
  48. canNoSelect: false,
  49. canEndNotMax: false,
  50. selectPermanentCoroutine: SelectPermanentCoroutine,
  51. afterSelectPermanentCoroutine: null,
  52. mode: SelectPermanentEffect.Mode.Custom,
  53. cardEffect: activateClass);
  54. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  55. {
  56. selectedPermanent = permanent;
  57. yield return null;
  58. }
  59. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -5000.", "The opponent is selecting 1 Digimon that will get DP -5000.");
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: selectedPermanent, changeValue: -5000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  62. }
  63. }
  64. CardEffectFactory.ActivateClassesForSharedEffects
  65. (ref cardEffects, timing, card,
  66. SharedEffectName,
  67. SharedActivateCoroutine,
  68. SharedEffectDescription,
  69. optional: true,
  70. maxCountPerTurn: -1,
  71. onPlay: true,
  72. whenDigivolving: true,
  73. additionalActivateCondition: AdditionCanActivate);
  74. #endregion
  75. #region Inherited
  76. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  77. {
  78. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: null));
  79. }
  80. #endregion
  81. return cardEffects;
  82. }
  83. }
  84. }