P_144.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_144 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.CardNames.Contains("Gotsumon"))
  18. {
  19. return true;
  20. }
  21. return false;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  24. permanentCondition: PermanentCondition,
  25. digivolutionCost: 0,
  26. ignoreDigivolutionRequirement: false,
  27. card: card,
  28. condition: null));
  29. }
  30. #endregion
  31. #region Blocker/Can't Attack
  32. if(timing == EffectTiming.None)
  33. {
  34. bool HasGotsumonOrXAntibody(CardSource source)
  35. {
  36. return source.ContainsCardName("Gotsumon") || source.ContainsCardName("X Antibody") || source.ContainsCardName("X-Antibody");
  37. }
  38. bool Condition()
  39. {
  40. if (CardEffectCommons.IsOwnerTurn(card))
  41. {
  42. return card.PermanentOfThisCard().DigivolutionCards.Count(HasGotsumonOrXAntibody) == 0;
  43. }
  44. return false;
  45. }
  46. cardEffects.Add(CardEffectFactory.CanNotAttackSelfStaticEffect(
  47. defenderCondition: null,
  48. isInheritedEffect: false,
  49. card: card,
  50. condition: Condition,
  51. effectName: "Can't Attack"));
  52. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  53. isInheritedEffect: false,
  54. card: card,
  55. condition: null));
  56. }
  57. #endregion
  58. #region When Target Changed - Unsuspended Blocker
  59. if (timing == EffectTiming.OnAttackTargetChanged)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect("Unsuspend 1 of your Digimon with <Blocker>", CanUseCondition, card);
  63. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  64. activateClass.SetHashString("Unsuspend_P_144");
  65. cardEffects.Add(activateClass);
  66. string EffectDiscription()
  67. {
  68. return "[Opponent's Turn] (Once Per Turn) When an attack target is switched, you may unsuspend 1 of your Digimon with <Blocker>.";
  69. }
  70. bool PermanentHasBlocker(Permanent permanent)
  71. {
  72. if(CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  73. return permanent.HasBlocker;
  74. return false;
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. return !CardEffectCommons.IsOwnerTurn(card);
  79. }
  80. bool CanActivateCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable hashtable)
  85. {
  86. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentHasBlocker));
  87. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  88. selectPermanentEffect.SetUp(
  89. selectPlayer: card.Owner,
  90. canTargetCondition: PermanentHasBlocker,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. maxCount: maxCount,
  94. canNoSelect: false,
  95. canEndNotMax: false,
  96. selectPermanentCoroutine: null,
  97. afterSelectPermanentCoroutine: null,
  98. mode: SelectPermanentEffect.Mode.UnTap,
  99. cardEffect: activateClass);
  100. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will unsuspend.", "The opponent is selecting 1 Digimon that will unsuspend.");
  101. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  102. }
  103. }
  104. #endregion
  105. #region All Turns - DP Boost - ESS
  106. if (timing == EffectTiming.None)
  107. {
  108. string EffectDiscription()
  109. {
  110. return "[All Turns] All of your Digimon with <Blocker> get +1000 DP.";
  111. }
  112. bool Condition()
  113. {
  114. if (CardEffectCommons.IsExistOnBattleArea(card))
  115. {
  116. return true;
  117. }
  118. return false;
  119. }
  120. bool PermanentCondition(Permanent permanent)
  121. {
  122. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  123. {
  124. if (permanent.HasBlocker)
  125. {
  126. return true;
  127. }
  128. }
  129. return false;
  130. }
  131. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  132. permanentCondition: PermanentCondition,
  133. changeValue: 1000,
  134. isInheritedEffect: true,
  135. card: card,
  136. condition: Condition,
  137. effectName: EffectDiscription));
  138. }
  139. #endregion
  140. return cardEffects;
  141. }
  142. }
  143. }