BT3_101.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. public class BT3_101 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] 1 of your opponent's Digimon gets -3000 DP and <Security Attack -1> (This Digimon checks 1 fewer security card) until the end of your opponent's next turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  32. {
  33. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  34. {
  35. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  36. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  37. selectPermanentEffect.SetUp(
  38. selectPlayer: card.Owner,
  39. canTargetCondition: CanSelectPermanentCondition,
  40. canTargetCondition_ByPreSelecetedList: null,
  41. canEndSelectCondition: null,
  42. maxCount: maxCount,
  43. canNoSelect: false,
  44. canEndNotMax: false,
  45. selectPermanentCoroutine: SelectPermanentCoroutine,
  46. afterSelectPermanentCoroutine: null,
  47. mode: SelectPermanentEffect.Mode.Custom,
  48. cardEffect: activateClass);
  49. selectPermanentEffect.SetUpCustomMessage(
  50. "Select 1 Digimon that will get DP -3000 and Security Attack -1.",
  51. "The opponent is selecting 1 Digimon that will get DP -3000 and Security Attack -1.");
  52. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  53. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  56. targetPermanent: permanent,
  57. changeValue: -3000,
  58. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  59. activateClass: activateClass));
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  61. targetPermanent: permanent,
  62. changeValue: -1,
  63. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  64. activateClass: activateClass));
  65. }
  66. }
  67. }
  68. }
  69. if (timing == EffectTiming.SecuritySkill)
  70. {
  71. ActivateClass activateClass = new ActivateClass();
  72. activateClass.SetUpICardEffect($"DP -3000 and Security Attack -1", CanUseCondition, card);
  73. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  74. activateClass.SetIsSecurityEffect(true);
  75. cardEffects.Add(activateClass);
  76. string EffectDiscription()
  77. {
  78. return "[Security] 1 of your opponent's Digimon gets -3000 DP and <Security Attack -1> (This Digimon checks 1 fewer security card) until the end of the turn.";
  79. }
  80. bool CanSelectPermanentCondition(Permanent permanent)
  81. {
  82. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  83. }
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  87. }
  88. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  89. {
  90. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  91. {
  92. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectPermanentCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: maxCount,
  100. canNoSelect: false,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: SelectPermanentCoroutine,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. selectPermanentEffect.SetUpCustomMessage(
  107. "Select 1 Digimon that will get DP -3000 and Security Attack -1.",
  108. "The opponent is selecting 1 Digimon that will get DP -3000 and Security Attack -1.");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  113. targetPermanent: permanent,
  114. changeValue: -3000,
  115. effectDuration: EffectDuration.UntilEachTurnEnd,
  116. activateClass: activateClass));
  117. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  118. targetPermanent: permanent,
  119. changeValue: -1,
  120. effectDuration: EffectDuration.UntilEachTurnEnd,
  121. activateClass: activateClass));
  122. }
  123. }
  124. }
  125. }
  126. return cardEffects;
  127. }
  128. }