BT19_032.cs 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_032 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Deletion
  12. if (timing == EffectTiming.OnDestroyedAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Security Attack -1 to an opponents' Digimon and if you have less than 2 security, Recovery +1", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Deletion] 1 of your opponent's Digimon gains <Security Attack -1> until the end of their turn. Then, if you have 2 or fewer security cards, <Recovery +1>.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  29. }
  30. bool CanActivateCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  33. {
  34. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  44. {
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: CanSelectPermanentCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: SelectPermanentCoroutine,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Custom,
  58. cardEffect: activateClass);
  59. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.", "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  64. }
  65. if (card.Owner.SecurityCards.Count <= 2)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  68. }
  69. }
  70. }
  71. }
  72. #endregion
  73. #region Inherit
  74. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  75. {
  76. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: null));
  77. }
  78. #endregion
  79. return cardEffects;
  80. }
  81. }
  82. }