BT24_067.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Hackmon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_067 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Link Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasAppmonTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 1, card: card));
  20. }
  21. #endregion
  22. #region Link
  23. if (timing == EffectTiming.OnDeclaration)
  24. {
  25. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  26. }
  27. #endregion
  28. #region Alternative Digivolution Condition
  29. if (timing == EffectTiming.None)
  30. {
  31. bool PermanentCondition(Permanent targetPermanent)
  32. {
  33. return targetPermanent.TopCard.IsLevel2
  34. && targetPermanent.TopCard.EqualsTraits("Appmon");
  35. }
  36. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  37. permanentCondition: PermanentCondition,
  38. digivolutionCost: 0,
  39. ignoreDigivolutionRequirement: false,
  40. card: card,
  41. condition: null)
  42. );
  43. }
  44. #endregion
  45. #region Your Turn - When Linked
  46. if (timing == EffectTiming.WhenLinked)
  47. {
  48. ActivateClass activateClass = new ActivateClass();
  49. activateClass.SetUpICardEffect("Play 1 [Rei Katsura]", CanUseCondition, card);
  50. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  51. activateClass.SetHashString("WhenLinked_BT24_067");
  52. cardEffects.Add(activateClass);
  53. string EffectDescription()
  54. => "[Your Turn] [Once Per Turn] When this Digimon gets linked, if you have 1 or fewer Tamers, you may play 1 [Rei Katsura] from your hand without paying the cost.";
  55. bool LinkPermanentCondition(Permanent permanent)
  56. {
  57. return permanent == card.PermanentOfThisCard();
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. if (isExistOnField(card))
  62. {
  63. if (CardEffectCommons.CanTriggerWhenLinked(hashtable, LinkPermanentCondition, null))
  64. {
  65. if (CardEffectCommons.IsOwnerTurn(card))
  66. {
  67. return true;
  68. }
  69. }
  70. }
  71. return false;
  72. }
  73. bool CanActivateCondition(Hashtable hashtable)
  74. {
  75. if (isExistOnField(card))
  76. {
  77. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  78. {
  79. if (card.Owner.GetBattleAreaPermanents().Count(permanent => permanent.IsTamer) <= 1)
  80. {
  81. return true;
  82. }
  83. }
  84. }
  85. return false;
  86. }
  87. bool CanSelectCardCondition(CardSource source)
  88. {
  89. if (source.IsTamer)
  90. {
  91. if (source.EqualsCardName("Rei Katsura"))
  92. {
  93. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: source, payCost: false, cardEffect: activateClass))
  94. {
  95. return true;
  96. }
  97. }
  98. }
  99. return false;
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable hashtable)
  102. {
  103. CardSource selectedCard = null;
  104. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  105. selectHandEffect.SetUp(
  106. selectPlayer: card.Owner,
  107. canTargetCondition: CanSelectCardCondition,
  108. canTargetCondition_ByPreSelecetedList: null,
  109. canEndSelectCondition: null,
  110. maxCount: 1,
  111. canNoSelect: true,
  112. canEndNotMax: false,
  113. isShowOpponent: true,
  114. selectCardCoroutine: SelectCardCoroutine,
  115. afterSelectCardCoroutine: null,
  116. mode: SelectHandEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  119. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  120. yield return StartCoroutine(selectHandEffect.Activate());
  121. IEnumerator SelectCardCoroutine(CardSource cardSource)
  122. {
  123. selectedCard = cardSource;
  124. yield return null;
  125. }
  126. if (selectedCard != null)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  129. }
  130. }
  131. }
  132. #endregion
  133. #region Link ESS
  134. #region Retaliation - Linked
  135. if (timing == EffectTiming.OnDestroyedAnyone)
  136. {
  137. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: false, card: card, condition: null, isLinkedEffect: true));
  138. }
  139. #endregion
  140. #endregion
  141. return cardEffects;
  142. }
  143. }
  144. }