ST19_06.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.ST19
  4. {
  5. public class ST19_06 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play/ On Deletion
  11. bool CanSelectPermanentCondition(Permanent permanent)
  12. {
  13. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  14. }
  15. #endregion
  16. #region On Play
  17. if (timing == EffectTiming.OnEnterFieldAnyone)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  22. cardEffects.Add(activateClass);
  23. string EffectDescription()
  24. {
  25. return
  26. "[On Play] 1 of your opponent's Digimon gains <Security Attack -1> until the end of their turn.";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  35. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  40. selectPermanentEffect.SetUp(
  41. selectPlayer: card.Owner,
  42. canTargetCondition: CanSelectPermanentCondition,
  43. canTargetCondition_ByPreSelecetedList: null,
  44. canEndSelectCondition: null,
  45. maxCount: 1,
  46. canNoSelect: false,
  47. canEndNotMax: false,
  48. selectPermanentCoroutine: SelectPermanentCoroutine,
  49. afterSelectPermanentCoroutine: null,
  50. mode: SelectPermanentEffect.Mode.Custom,
  51. cardEffect: activateClass);
  52. selectPermanentEffect.SetUpCustomMessage(
  53. "Select 1 Digimon that will get Security Attack -2.",
  54. "The opponent is selecting 1 Digimon that will get Security Attack -2.");
  55. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  56. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  59. targetPermanent: permanent,
  60. changeValue: -1,
  61. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  62. activateClass: activateClass));
  63. }
  64. }
  65. }
  66. #endregion
  67. #region On Deletion
  68. if (timing == EffectTiming.OnDestroyedAnyone)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  73. cardEffects.Add(activateClass);
  74. string EffectDescription()
  75. {
  76. return
  77. "[On Deletion] 1 of your opponent's Digimon gains <Security Attack -1> until the end of their turn.";
  78. }
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  82. }
  83. bool CanActivateCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  86. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  87. }
  88. IEnumerator ActivateCoroutine(Hashtable hashtable)
  89. {
  90. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  91. selectPermanentEffect.SetUp(
  92. selectPlayer: card.Owner,
  93. canTargetCondition: CanSelectPermanentCondition,
  94. canTargetCondition_ByPreSelecetedList: null,
  95. canEndSelectCondition: null,
  96. maxCount: 1,
  97. canNoSelect: false,
  98. canEndNotMax: false,
  99. selectPermanentCoroutine: SelectPermanentCoroutine,
  100. afterSelectPermanentCoroutine: null,
  101. mode: SelectPermanentEffect.Mode.Custom,
  102. cardEffect: activateClass);
  103. selectPermanentEffect.SetUpCustomMessage(
  104. "Select 1 Digimon that will get Security Attack -2.",
  105. "The opponent is selecting 1 Digimon that will get Security Attack -2.");
  106. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  107. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  110. targetPermanent: permanent,
  111. changeValue: -1,
  112. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  113. activateClass: activateClass));
  114. }
  115. }
  116. }
  117. #endregion
  118. return cardEffects;
  119. }
  120. }
  121. }