BT25_036.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Craftmon
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_036 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasStandardAppTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null));
  21. }
  22. #endregion
  23. #region Link Condition
  24. if (timing == EffectTiming.None)
  25. {
  26. static bool PermanentCondition(Permanent targetPermanent)
  27. {
  28. return targetPermanent.TopCard.HasAppmonTraits;
  29. }
  30. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  31. }
  32. #endregion
  33. #region App Fusion (Hackmon, Protecmon, Pipomon)
  34. if (timing == EffectTiming.None)
  35. {
  36. cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List<string>() { "Kabemon", "Gomimon", "Ecomon", "Puzzlemon" }, card));
  37. }
  38. #endregion
  39. #region Security
  40. if (timing == EffectTiming.SecuritySkill)
  41. {
  42. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  43. }
  44. #endregion
  45. #region Shared OP/WD
  46. string SharedEffectName = "Add top security to hand, <Recovery +1>";
  47. CardEffectFactory.ActivateClassesForSharedEffects
  48. (ref cardEffects, timing, card,
  49. SharedEffectName,
  50. SharedActivateCoroutine,
  51. SharedEffectDescription,
  52. optional: false,
  53. onPlay: true,
  54. whenDigivolving: true);
  55. string SharedEffectDescription(string tag) => $"[{tag}] Add your top security card to the hand. Then, <Recovery +1>.";
  56. IEnumerator SharedActivateCoroutine(Hashtable _hashtable, ActivateClass activateClass)
  57. {
  58. if (card.Owner.SecurityCards.Count() > 0)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { card.Owner.SecurityCards[0] }, false, activateClass));
  61. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(player: card.Owner, refSkillInfos: ref ContinuousController.instance.nullSkillInfos, activateClass).ReduceSecurity());
  62. }
  63. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  64. }
  65. #endregion
  66. #region Link
  67. if (timing == EffectTiming.OnDeclaration)
  68. {
  69. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  70. }
  71. #endregion
  72. #region When Linking
  73. if (timing == EffectTiming.WhenLinked)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Trash 1 [Appmon] to <Draw 2>", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  78. activateClass.SetIsLinkedEffect(true);
  79. activateClass.SetIsSkippable(true);
  80. cardEffects.Add(activateClass);
  81. string EffectDescription()
  82. {
  83. return "[When Linking] By trashing 1 [Appmon] trait card from your hand, <Draw 2>.";
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  88. }
  89. bool CanActivateCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.IsExistOnBattleArea(card)
  92. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  93. }
  94. bool CanSelectCardCondition(CardSource cardSource)
  95. {
  96. return cardSource.HasAppmonTraits;
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  101. selectHandEffect.SetUp(
  102. selectPlayer: card.Owner,
  103. canTargetCondition: CanSelectCardCondition,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. maxCount: 1,
  107. canNoSelect: true,
  108. canEndNotMax: false,
  109. isShowOpponent: true,
  110. selectCardCoroutine: null,
  111. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  112. mode: SelectHandEffect.Mode.Discard,
  113. cardEffect: activateClass);
  114. selectHandEffect.SetUpCustomMessage("Select 1 Card to trash.", "The opponent is selecting 1 card to trash from their hand.");
  115. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  116. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  117. {
  118. if (cardSources.Count >= 1)
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  121. }
  122. }
  123. }
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }