BT25_061.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Offmon
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_061 : 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 Alternate Digivolution Condition
  23. if (timing == EffectTiming.None)
  24. {
  25. bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.TopCard.HasAppmonTraits;
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null, level: 2));
  30. }
  31. #endregion
  32. #region Basic link effect keyword
  33. if (timing == EffectTiming.OnDeclaration)
  34. {
  35. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  36. }
  37. #endregion
  38. #region Start of Your Main Phase
  39. if (timing == EffectTiming.OnStartMainPhase)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Trash 1 card from hand to Draw 1 and memory +1", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  44. activateClass.SetIsSkippable(true);
  45. cardEffects.Add(activateClass);
  46. string EffectDescription()
  47. {
  48. return "[Start of Your Main Phase] By trashing 1 card with the [Appmon] trait from your hand, <Draw 1> and gain 1 memory.";
  49. }
  50. bool CanSelectCardCondition(CardSource cardSource)
  51. {
  52. return cardSource.HasAppmonTraits;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  57. && CardEffectCommons.IsOwnerTurn(card);
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  62. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  65. {
  66. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  67. selectHandEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectCardCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: 1,
  73. canNoSelect: true,
  74. canEndNotMax: false,
  75. isShowOpponent: true,
  76. selectCardCoroutine: null,
  77. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  78. mode: SelectHandEffect.Mode.Discard,
  79. cardEffect: activateClass);
  80. yield return StartCoroutine(selectHandEffect.Activate());
  81. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  82. {
  83. if (cardSources.Count >= 1)
  84. {
  85. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  86. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  87. }
  88. }
  89. }
  90. }
  91. #endregion
  92. #region When Linked
  93. if (timing == EffectTiming.WhenLinked)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("1 enemy Digimon can't unsuspend until their turn ends.", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  98. activateClass.SetIsLinkedEffect(true);
  99. cardEffects.Add(activateClass);
  100. string EffectDescription() => "[When Linking] 1 of your opponent's Digimon can't unsuspend until their turn ends.";
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  108. }
  109. bool CanSelectPermanentCondition(Permanent permanent)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable hashtable)
  114. {
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  117. selectPermanentEffect.SetUp(
  118. selectPlayer: card.Owner,
  119. canTargetCondition: CanSelectPermanentCondition,
  120. canTargetCondition_ByPreSelecetedList: null,
  121. canEndSelectCondition: null,
  122. maxCount: maxCount,
  123. canNoSelect: false,
  124. canEndNotMax: false,
  125. selectPermanentCoroutine: SelectPermanentCoroutine,
  126. afterSelectPermanentCoroutine: null,
  127. mode: SelectPermanentEffect.Mode.Custom,
  128. cardEffect: activateClass);
  129. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  130. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  131. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  132. {
  133. Permanent selectedPermanent = permanent;
  134. if (selectedPermanent != null)
  135. {
  136. CanNotUnsuspendClass canNotUnsuspendClass = new CanNotUnsuspendClass();
  137. canNotUnsuspendClass.SetUpICardEffect("Can't Unsuspend", CanUseCondition1, card);
  138. canNotUnsuspendClass.SetUpCanNotUntapClass(PermanentCondition: PermanentCondition);
  139. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotUnsuspendClass);
  140. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  143. }
  144. bool CanUseCondition1(Hashtable hashtable)
  145. {
  146. return selectedPermanent.TopCard != null
  147. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  148. }
  149. bool PermanentCondition(Permanent permanent)
  150. {
  151. return permanent == selectedPermanent;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. #endregion
  158. return cardEffects;
  159. }
  160. }
  161. }