BT23_054.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Magnamon
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_054 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Veemon") ||
  17. (targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.HasCSTraits);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. #endregion
  24. #region Blocker/Armor Purge
  25. if (timing == EffectTiming.None)
  26. {
  27. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  28. }
  29. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  30. {
  31. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  32. }
  33. #endregion
  34. #region OP/WD Shared
  35. bool SharedOwnerDigimon(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  38. (permanent.TopCard.HasRoyalKnightTraits || permanent.TopCard.HasCSTraits);
  39. }
  40. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  41. {
  42. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  43. Permanent selectedPermanent = null;
  44. #region Select Permanent
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: SharedOwnerDigimon,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: 1,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: SelectPermanentCoroutine,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Custom,
  57. cardEffect: activateClass);
  58. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  59. {
  60. selectedPermanent = permanent;
  61. yield return null;
  62. }
  63. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to gain effects", "The opponent is selecting 1 Digimon to gain effects");
  64. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  65. #endregion
  66. if (selectedPermanent != null)
  67. {
  68. bool CardEffectCondition(ICardEffect cardEffect)
  69. {
  70. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  71. }
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHand(
  73. targetPermanent: selectedPermanent,
  74. cardEffectCondition: CardEffectCondition,
  75. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  76. activateClass: activateClass,
  77. effectName: "Can't return to hand by opponent's effects"));
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeck(
  79. targetPermanent: selectedPermanent,
  80. cardEffectCondition: CardEffectCondition,
  81. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  82. activateClass: activateClass,
  83. effectName: "Can't return to deck by opponent's effects"));
  84. }
  85. }
  86. #endregion
  87. #region On Play
  88. if (timing == EffectTiming.OnEnterFieldAnyone)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("Draw 1, then give can't be returned to hand/deck", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[On Play] <Draw 1> Then, 1 of your Digimon with the [Royal Knight] or [CS] trait can't be returned to hands or decks by your opponent's effects until their turn ends.";
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable hashtable)
  107. {
  108. yield return SharedActivateCoroutine(hashtable, activateClass);
  109. }
  110. }
  111. #endregion
  112. #region When Digivolving
  113. if (timing == EffectTiming.OnEnterFieldAnyone)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("Draw 1, then give can't be returned to hand/deck", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  118. cardEffects.Add(activateClass);
  119. string EffectDiscription()
  120. {
  121. return "[When Digivolving] <Draw 1> Then, 1 of your Digimon with the [Royal Knight] or [CS] trait can't be returned to hands or decks by your opponent's effects until their turn ends.";
  122. }
  123. bool CanUseCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  126. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable hashtable)
  133. {
  134. yield return SharedActivateCoroutine(hashtable, activateClass);
  135. }
  136. }
  137. #endregion
  138. return cardEffects;
  139. }
  140. }
  141. }