BT10_038.cs 7.3 KB

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