BT11_101.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_101 : 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.None)
  12. {
  13. ChangeCostClass changeCostClass = new ChangeCostClass();
  14. changeCostClass.SetUpICardEffect($"Use Cost -1", CanUseCondition, card);
  15. changeCostClass.SetUpChangeCostClass(
  16. changeCostFunc: ChangeCost,
  17. cardSourceCondition: CardSourceCondition,
  18. rootCondition: RootCondition,
  19. isUpDown: isUpDown,
  20. isCheckAvailability: () => false,
  21. isChangePayingCost: () => true);
  22. cardEffects.Add(changeCostClass);
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, permanent =>
  26. permanent.TopCard.CardColors.Contains(CardColor.Yellow) && permanent.IsTamer);
  27. }
  28. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  29. {
  30. if (CardSourceCondition(cardSource))
  31. {
  32. if (RootCondition(root))
  33. {
  34. if (PermanentsCondition(targetPermanents))
  35. {
  36. Cost -= 1;
  37. }
  38. }
  39. }
  40. return Cost;
  41. }
  42. bool PermanentsCondition(List<Permanent> targetPermanents)
  43. {
  44. return true;
  45. }
  46. bool CardSourceCondition(CardSource cardSource)
  47. {
  48. return cardSource == card;
  49. }
  50. bool RootCondition(SelectCardEffect.Root root)
  51. {
  52. return true;
  53. }
  54. bool isUpDown()
  55. {
  56. return true;
  57. }
  58. }
  59. if (timing == EffectTiming.OptionSkill)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  63. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[Main] Until the end of your opponent's turn, 3 of your opponent's Digimon get -5000 DP and gain <Security Attack -1>.";
  68. }
  69. bool CanSelectPermanentCondition(Permanent permanent)
  70. {
  71. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  72. {
  73. if (permanent.CanSelectBySkill(activateClass))
  74. {
  75. return true;
  76. }
  77. }
  78. return false;
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  85. {
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  87. {
  88. int maxCount = Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectPermanentCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: maxCount,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. selectPermanentEffect.SetUpCustomMessage("Select Digimon to DP -5000 and Security Attack -1.", "The opponent is selecting Digimon to DP -5000 and Security Attack -1.");
  103. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  104. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -5000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  108. yield return null;
  109. }
  110. }
  111. }
  112. }
  113. if (timing == EffectTiming.SecuritySkill)
  114. {
  115. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  116. card: card,
  117. cardEffects: ref cardEffects,
  118. effectName: $"Opponent's 3 Digimon get DP -5000 and Security Attack -1");
  119. }
  120. return cardEffects;
  121. }
  122. }
  123. }