P_135.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DCGO.CardEffects.P
  5. {
  6. public class P_135 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("1 Opponent's Digimon can't attack Digimon, and gain <Security A. -1>", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] Until the end of your opponent's turn, 1 of their Digimon can't attack Digimon and gain <Security A. -1>.";
  21. }
  22. bool SelectDigimon(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  29. }
  30. bool CanActivateCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnBattleArea(card);
  33. }
  34. IEnumerator ActivateCoroutine(Hashtable hashtable)
  35. {
  36. Permanent selectedPermanent = null;
  37. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  38. selectPermanentEffect.SetUp(
  39. selectPlayer: card.Owner,
  40. canTargetCondition: SelectDigimon,
  41. canTargetCondition_ByPreSelecetedList: null,
  42. canEndSelectCondition: null,
  43. maxCount: 1,
  44. canNoSelect: false,
  45. canEndNotMax: false,
  46. selectPermanentCoroutine: SelectedPermanent,
  47. afterSelectPermanentCoroutine: null,
  48. mode: SelectPermanentEffect.Mode.Custom,
  49. cardEffect: activateClass);
  50. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  51. IEnumerator SelectedPermanent(Permanent permanent)
  52. {
  53. bool DefenderCondition(Permanent defender)
  54. {
  55. return defender != null;
  56. }
  57. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  58. targetPermanent: permanent,
  59. defenderCondition: DefenderCondition,
  60. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  61. activateClass: activateClass,
  62. effectName: "Can't Attack Digimon"));
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  64. targetPermanent: permanent,
  65. changeValue: -1,
  66. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  67. activateClass: activateClass));
  68. yield return null;
  69. }
  70. }
  71. }
  72. #endregion
  73. #region Your Turn - Jamming
  74. if (timing == EffectTiming.None)
  75. {
  76. bool HasArisaKinosaki(Permanent permanent)
  77. {
  78. return permanent.TopCard.CardNames.Contains("Arisa Kinosaki");
  79. }
  80. bool JammingCondition()
  81. {
  82. if (CardEffectCommons.IsOwnerTurn(card))
  83. {
  84. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasArisaKinosaki))
  85. {
  86. return true;
  87. }
  88. }
  89. return false;
  90. }
  91. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  92. isInheritedEffect: false,
  93. card: card,
  94. condition: JammingCondition));
  95. }
  96. #endregion
  97. #region When Attacking - ESS
  98. if (timing == EffectTiming.OnAllyAttack)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect("Opponent's Digimon gets -2000 DP for the turn", CanUseCondition, card);
  102. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  103. activateClass.SetIsInheritedEffect(true);
  104. activateClass.SetHashString("ChangeDP_P_135");
  105. cardEffects.Add(activateClass);
  106. string EffectDiscription()
  107. {
  108. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  109. }
  110. bool SelectOpponentsDigimon(Permanent permanent)
  111. {
  112. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable hashtable)
  123. {
  124. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  125. selectPermanentEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: SelectOpponentsDigimon,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: 1,
  131. canNoSelect: false,
  132. canEndNotMax: false,
  133. selectPermanentCoroutine: SelectPermanentCoroutine,
  134. afterSelectPermanentCoroutine: null,
  135. mode: SelectPermanentEffect.Mode.Custom,
  136. cardEffect: activateClass);
  137. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  138. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  139. {
  140. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  141. targetPermanent: permanent,
  142. changeValue: -2000,
  143. effectDuration: EffectDuration.UntilEachTurnEnd,
  144. activateClass: activateClass));
  145. }
  146. }
  147. }
  148. #endregion
  149. return cardEffects;
  150. }
  151. }
  152. }