BT25_069.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Raremon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_069 : 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 Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("TS");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Jamming
  22. if (timing == EffectTiming.None)
  23. {
  24. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region Shared OP / WD
  28. string SharedEffectName = "May link 1 [TS] card from trash to 1 of your Digimon for free";
  29. CardEffectFactory.ActivateClassesForSharedEffects
  30. (ref cardEffects, timing, card,
  31. SharedEffectName,
  32. SharedActivateCoroutine,
  33. SharedEffectDescription,
  34. optional: false,
  35. onPlay: true,
  36. whenDigivolving: true);
  37. string SharedEffectDescription(string tag) => $"[{tag}] You may link 1 [TS] trait card from your trash to 1 of your Digimon without paying the cost.";
  38. bool CanSelectLinkTarget(CardSource cardSource)
  39. {
  40. return cardSource.EqualsTraits("TS")
  41. && cardSource.CanLink(false);
  42. }
  43. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  44. {
  45. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectLinkTarget))
  46. {
  47. Permanent selectedPermanent = null;
  48. CardSource cardForLinking = null;
  49. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  50. selectCardEffect.SetUp(
  51. canTargetCondition: CanSelectLinkTarget,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. canNoSelect: () => true,
  55. selectCardCoroutine: SelectCardCoroutine,
  56. afterSelectCardCoroutine: null,
  57. message: "Select 1 card to link.",
  58. maxCount: 1,
  59. canEndNotMax: false,
  60. isShowOpponent: true,
  61. mode: SelectCardEffect.Mode.Custom,
  62. root: SelectCardEffect.Root.Trash,
  63. customRootCardList: null,
  64. canLookReverseCard: true,
  65. selectPlayer: card.Owner,
  66. cardEffect: activateClass);
  67. selectCardEffect.SetUpCustomMessage("Select 1 card to link.", "The opponent is selecting 1 card to link.");
  68. yield return StartCoroutine(selectCardEffect.Activate());
  69. IEnumerator SelectCardCoroutine(CardSource cardSource)
  70. {
  71. cardForLinking = cardSource;
  72. yield return null;
  73. }
  74. if (cardForLinking != null)
  75. {
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectPermanentCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: 1,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: SelectPermanentCoroutine,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to link.", "The opponent is selecting 1 Digimon to link.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. bool CanSelectPermanentCondition(Permanent permanent)
  92. {
  93. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  94. cardForLinking.CanLinkToTargetPermanent(permanent, false);
  95. }
  96. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  97. {
  98. selectedPermanent = permanent;
  99. yield return null;
  100. }
  101. if (selectedPermanent != null)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddLinkCard(cardForLinking, activateClass));
  104. }
  105. }
  106. }
  107. }
  108. #endregion
  109. #region All Turns - Inherited Effect
  110. if (timing == EffectTiming.None)
  111. {
  112. bool Condition()
  113. {
  114. return true;
  115. }
  116. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  117. changeValue: 1000,
  118. isInheritedEffect: true,
  119. card: card,
  120. condition: Condition));
  121. }
  122. #endregion
  123. return cardEffects;
  124. }
  125. }
  126. }