BT22_063.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Alphamon
  6. namespace DCGO.CardEffects.BT22
  7. {
  8. public class BT22_063 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Static Effects
  14. #region CS Alternative Digivolution Condition
  15. if (timing == EffectTiming.None)
  16. {
  17. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return targetPermanent.TopCard.IsLevel5
  20. && targetPermanent.TopCard.HasCSTraits;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 3,
  25. ignoreDigivolutionRequirement: false,
  26. card: card,
  27. condition: null)
  28. );
  29. }
  30. #endregion
  31. #region Kyoko Kuremi Alternative Digivolution Condition
  32. if (timing == EffectTiming.None)
  33. {
  34. bool PermanentCondition(Permanent targetPermanent)
  35. {
  36. return targetPermanent.TopCard.EqualsCardName("Kyoko Kuremi");
  37. }
  38. bool Condition()
  39. {
  40. return card.Owner.SecurityCards.Count <= 3;
  41. }
  42. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  43. permanentCondition: PermanentCondition,
  44. digivolutionCost: 5,
  45. ignoreDigivolutionRequirement: false,
  46. card: card,
  47. condition: Condition)
  48. );
  49. }
  50. #endregion
  51. #region Blocker
  52. if (timing == EffectTiming.None)
  53. {
  54. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  55. }
  56. #endregion
  57. #region Reboot
  58. if (timing == EffectTiming.None)
  59. {
  60. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  61. }
  62. #endregion
  63. #endregion
  64. #region OP/WD/WA Shared
  65. string SharedEffectName = "-5K DP to 1 digimon";
  66. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon gets -5000 DP for the turn.";
  67. bool SharedOpponentDigimon(Permanent permanent)
  68. {
  69. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  70. }
  71. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  72. {
  73. Permanent selectedPermanent = null;
  74. #region Select Permanent
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedOpponentDigimon));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: SharedOpponentDigimon,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: false,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: SelectPermanentCoroutine,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. selectedPermanent = permanent;
  92. yield return null;
  93. }
  94. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to get -5K DP", "The opponent is selecting 1 Digimon to get -5K DP");
  95. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  96. #endregion
  97. if (selectedPermanent != null)
  98. yield return ContinuousController.instance.StartCoroutine(
  99. CardEffectCommons.ChangeDigimonDP(selectedPermanent, -5000, EffectDuration.UntilEachTurnEnd, activateClass));
  100. }
  101. CardEffectFactory.ActivateClassesForSharedEffects
  102. (ref cardEffects, timing, card,
  103. SharedEffectName,
  104. SharedActivateCoroutine,
  105. SharedEffectDescription,
  106. optional: false,
  107. onPlay: true,
  108. whenDigivolving: true,
  109. whenAttacking: true);
  110. #endregion
  111. #region All Turns
  112. if (timing == EffectTiming.OnTappedAnyone)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect("Gain 3K DP & Unsuspend", CanUseCondition, card);
  116. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  117. activateClass.SetHashString("BT22_063_UnSuspend");
  118. cardEffects.Add(activateClass);
  119. string EffectDiscription()
  120. {
  121. return "[All Turns] [Once Per Turn] When this Digimon suspends, if [Kyoko Kuremi] is in this Digimon's digivolution cards or if this Digimon's stack has 2 or more same-level cards, it gets +3000 DP until your opponent's turn ends. Then, this Digimon unsuspends.";
  122. }
  123. bool CanUseCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  126. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsAlphamon);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  131. }
  132. bool IsAlphamon(Permanent permanent)
  133. {
  134. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  135. && permanent == card.PermanentOfThisCard();
  136. }
  137. bool HasSourceCondition()
  138. {
  139. Permanent permanent = card.PermanentOfThisCard();
  140. if (permanent.DigivolutionCards.Filter(x => x.EqualsCardName("Kyoko Kuremi")).Count >= 1) return true;
  141. if (permanent.StackCards.Filter(x => !x.IsFlipped).GroupBy(x => x.Level).Any(y => y.Count() >= 2)) return true;
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable hashtable)
  145. {
  146. if (HasSourceCondition())
  147. {
  148. yield return ContinuousController.instance.StartCoroutine(
  149. CardEffectCommons.ChangeDigimonDP(card.PermanentOfThisCard(), 3000, EffectDuration.UntilOpponentTurnEnd, activateClass));
  150. }
  151. yield return ContinuousController.instance.StartCoroutine(
  152. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  153. }
  154. }
  155. #endregion
  156. return cardEffects;
  157. }
  158. }
  159. }