P_135.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  37. selectPermanentEffect.SetUp(
  38. selectPlayer: card.Owner,
  39. canTargetCondition: SelectDigimon,
  40. canTargetCondition_ByPreSelecetedList: null,
  41. canEndSelectCondition: null,
  42. maxCount: 1,
  43. canNoSelect: false,
  44. canEndNotMax: false,
  45. selectPermanentCoroutine: SelectedPermanent,
  46. afterSelectPermanentCoroutine: null,
  47. mode: SelectPermanentEffect.Mode.Custom,
  48. cardEffect: activateClass);
  49. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  50. IEnumerator SelectedPermanent(Permanent permanent)
  51. {
  52. bool DefenderCondition(Permanent defender)
  53. {
  54. return defender != null;
  55. }
  56. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  57. targetPermanent: permanent,
  58. defenderCondition: DefenderCondition,
  59. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  60. activateClass: activateClass,
  61. effectName: "Can't Attack Digimon"));
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(
  63. targetPermanent: permanent,
  64. changeValue: -1,
  65. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  66. activateClass: activateClass));
  67. yield return null;
  68. }
  69. }
  70. }
  71. #endregion
  72. #region Your Turn - Jamming
  73. if (timing == EffectTiming.None)
  74. {
  75. bool HasArisaKinosaki(Permanent permanent)
  76. {
  77. return permanent.TopCard.CardNames.Contains("Arisa Kinosaki");
  78. }
  79. bool JammingCondition()
  80. {
  81. if (CardEffectCommons.IsOwnerTurn(card))
  82. {
  83. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasArisaKinosaki))
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  91. isInheritedEffect: false,
  92. card: card,
  93. condition: JammingCondition));
  94. }
  95. #endregion
  96. #region When Attacking - ESS
  97. if (timing == EffectTiming.OnAllyAttack)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect("Opponent's Digimon gets -2000 DP for the turn", CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  102. activateClass.SetIsInheritedEffect(true);
  103. activateClass.SetHashString("ChangeDP_P_135");
  104. cardEffects.Add(activateClass);
  105. string EffectDiscription()
  106. {
  107. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  108. }
  109. bool SelectOpponentsDigimon(Permanent permanent)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable hashtable)
  122. {
  123. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  124. selectPermanentEffect.SetUp(
  125. selectPlayer: card.Owner,
  126. canTargetCondition: SelectOpponentsDigimon,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. maxCount: 1,
  130. canNoSelect: false,
  131. canEndNotMax: false,
  132. selectPermanentCoroutine: SelectPermanentCoroutine,
  133. afterSelectPermanentCoroutine: null,
  134. mode: SelectPermanentEffect.Mode.Custom,
  135. cardEffect: activateClass);
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  140. targetPermanent: permanent,
  141. changeValue: -2000,
  142. effectDuration: EffectDuration.UntilEachTurnEnd,
  143. activateClass: activateClass));
  144. }
  145. }
  146. }
  147. #endregion
  148. return cardEffects;
  149. }
  150. }
  151. }