BT25_019.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // UltimateBrachiomon
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_019 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Alt Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. => targetPermanent.TopCard.HasTSTraits || targetPermanent.TopCard.EqualsTraits("Dinosaur");
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 5, permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Reboot
  22. if (timing == EffectTiming.None)
  23. {
  24. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region Blocker
  28. if (timing == EffectTiming.None)
  29. {
  30. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  31. }
  32. #endregion
  33. #endregion
  34. #region OP/WD Shared
  35. string SharedEffectName = "Delete 1 Digimon with highest DP.";
  36. string SharedEffectDescription(string tag) => $"[{tag}] Delete 1 of your opponent's highest DP Digimon.";
  37. bool CanSelectPermamentCondition(Permanent permanent)
  38. => CardEffectCommons.IsMaxDP(permanent, card.Owner.Enemy, null);
  39. IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  40. {
  41. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermamentCondition))
  42. {
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermamentCondition));
  45. selectPermanentEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: CanSelectPermamentCondition,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: maxCount,
  51. canNoSelect: false,
  52. canEndNotMax: false,
  53. selectPermanentCoroutine: null,
  54. afterSelectPermanentCoroutine: null,
  55. mode: SelectPermanentEffect.Mode.Destroy,
  56. cardEffect: activateClass);
  57. selectPermanentEffect.SetUpCustomMessage("Select 1 highest DP Digimon to delete.", "Opponent is select 1 highest DP digimon to delete.");
  58. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  59. }
  60. }
  61. CardEffectFactory.ActivateClassesForSharedEffects
  62. (ref cardEffects, timing, card,
  63. SharedEffectName,
  64. SharedActivateCoroutine,
  65. SharedEffectDescription,
  66. optional: false,
  67. maxCountPerTurn: -1,
  68. onPlay: true,
  69. whenDigivolving: true);
  70. #endregion
  71. #region End of Your Turn
  72. if (timing == EffectTiming.OnEndTurn)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("If opponent is at 5 or more memory, this gains immune to digimon effects, If opponent is at 5 or less memory, this gains immune to option effects.", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  77. activateClass.SetHashString("BT25_019_EndOfYourTurn");
  78. cardEffects.Add(activateClass);
  79. string EffectDescription() => "[End of Your Turn] [Once Per Turn] If your opponent has 5 or more memory, their Digimon effects don't affect this Digimon until their turn ends. Then, if they have 5 or less, their Option effects don't affect this Digimon until their turn ends.";
  80. bool CanUseCondition(Hashtable hashtable)
  81. => CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  82. && CardEffectCommons.IsOwnerTurn(card);
  83. bool CanActivateCondition(Hashtable hashtable)
  84. => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  85. IEnumerator ActivateCoroutine(Hashtable hashtable)
  86. {
  87. Permanent thisPermanent = card.PermanentOfThisCard();
  88. var opponentMemory = card.Owner.Enemy.MemoryForPlayer;
  89. if (opponentMemory >= 5)
  90. {
  91. #region Give Digimon Effect Immunity
  92. thisPermanent.UntilOpponentTurnEndEffects.Add((_timing) => PermanentEffectFactory.DigimonEffectImmunity(thisPermanent));
  93. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(thisPermanent));
  94. #endregion
  95. }
  96. if (opponentMemory <= 5)
  97. {
  98. #region Give Option Effect Immunity
  99. thisPermanent.UntilOpponentTurnEndEffects.Add((_timing) => PermanentEffectFactory.OptionEffectImmunity(thisPermanent));
  100. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(thisPermanent));
  101. #endregion
  102. }
  103. }
  104. }
  105. #endregion
  106. return cardEffects;
  107. }
  108. }
  109. }