BT10_099.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_099 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OptionSkill)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  19. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[Main] Until the end of your opponent's turn, 1 of your opponent's Digimon gains <Security Attack -1>. (This Digimon checks 1 fewer security cards.) If you have a [Venusmon] in play, 3 of your opponent's Digimon gain it instead.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.CanSelectBySkill(activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. int maxCount = 1;
  45. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardNames.Contains("Venusmon")))
  46. {
  47. maxCount = 3;
  48. }
  49. if (card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition) < maxCount)
  50. {
  51. maxCount = card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition);
  52. }
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: SelectPermanentCoroutine,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.Custom,
  65. cardEffect: activateClass);
  66. selectPermanentEffect.SetUpCustomMessage("Select Digimon that will get Security Attack -1.", "The opponent is selecting Digimon that will get Security Attack -1.");
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  71. }
  72. }
  73. }
  74. }
  75. if (timing == EffectTiming.SecuritySkill)
  76. {
  77. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  78. card: card,
  79. cardEffects: ref cardEffects,
  80. effectName: $"Security Attack -1");
  81. }
  82. return cardEffects;
  83. }
  84. }
  85. }