ST17_06.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.ST17
  9. {
  10. public class ST17_06 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region Blocker and Armor Purge
  16. if (timing == EffectTiming.None)
  17. {
  18. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  21. {
  22. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  23. }
  24. #endregion
  25. #region Inherit
  26. if (timing == EffectTiming.None)
  27. {
  28. bool Condition()
  29. {
  30. if (CardEffectCommons.IsExistOnBattleArea(card))
  31. {
  32. if (card.PermanentOfThisCard().IsSuspended)
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  40. }
  41. #endregion
  42. #region Digivolution Condition
  43. if (timing == EffectTiming.None)
  44. {
  45. bool PermanentCondition(Permanent targetPermanent)
  46. {
  47. if ((targetPermanent.TopCard.ContainsCardName("Terriermon") && targetPermanent.Level == 3))
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  54. }
  55. #endregion
  56. #region All Turns
  57. if (timing == EffectTiming.OnTappedAnyone)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect("Give 1 Digimon and Security Digimon -4000 DP", CanUseCondition, card);
  61. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  62. cardEffects.Add(activateClass);
  63. string EffectDiscription()
  64. {
  65. return "[All Turns][Once Per Turn] When this Digimon becomes suspended, 1 of your opponent's Digimon and all of your opponent's Security Digimon get -4000 DP until the end of your opponent's turn.";
  66. }
  67. bool CanSelectPermanentCondition(Permanent permanent)
  68. {
  69. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  74. }
  75. bool CanActivateCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  82. {
  83. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  84. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  85. selectPermanentEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectPermanentCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: false,
  92. canEndNotMax: false,
  93. selectPermanentCoroutine: SelectPermanentCoroutine,
  94. afterSelectPermanentCoroutine: null,
  95. mode: SelectPermanentEffect.Mode.Custom,
  96. cardEffect: activateClass);
  97. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  102. targetPermanent: permanent,
  103. changeValue: -4000,
  104. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  105. activateClass: activateClass));
  106. }
  107. }
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeSecurityDigimonCardDPPlayerEffect(
  109. cardCondition: cardSource => cardSource.Owner == card.Owner.Enemy,
  110. changeValue: -4000,
  111. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  112. activateClass: activateClass));
  113. }
  114. }
  115. #endregion
  116. return cardEffects;
  117. }
  118. }
  119. }