P_053.cs 7.1 KB

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