BT21_095.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_095 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Ignore Color Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  15. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  16. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  17. cardEffects.Add(ignoreColorConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return card.Owner.SecurityCards.Count(cardSource => !cardSource.IsFlipped) == 0;
  21. }
  22. bool CardCondition(CardSource cardSource)
  23. {
  24. return cardSource == card;
  25. }
  26. }
  27. #endregion
  28. #region All Turns - Security
  29. if (timing == EffectTiming.None)
  30. {
  31. bool PermanentCondition(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  34. permanent.TopCard.EqualsTraits("WG");
  35. }
  36. AddSkillClass addSkillClass = new AddSkillClass();
  37. addSkillClass.SetUpICardEffect("Your Digimon gain <Vortex>", CanUseCondition, card);
  38. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  39. cardEffects.Add(addSkillClass);
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistInSecurity(card, false) &&
  43. CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
  44. }
  45. bool CardSourceCondition(CardSource cardSource)
  46. {
  47. return CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource) &&
  48. cardSource.Owner == card.Owner &&
  49. cardSource == cardSource.PermanentOfThisCard().TopCard &&
  50. PermanentCondition(cardSource.PermanentOfThisCard());
  51. }
  52. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> effects, EffectTiming effectTiming)
  53. {
  54. if (effectTiming == EffectTiming.OnEndTurn)
  55. {
  56. bool Condition()
  57. {
  58. return CardSourceCondition(cardSource);
  59. }
  60. effects.Add(CardEffectFactory.VortexSelfEffect(false, cardSource, Condition));
  61. }
  62. return effects;
  63. }
  64. }
  65. #endregion
  66. #region Main Effect
  67. if (timing == EffectTiming.OptionSkill)
  68. {
  69. cardEffects.Add(CardEffectFactory.ReplaceBottomSecurityWithFaceUpOptionMainEffect(card));
  70. }
  71. #endregion
  72. #region Security Effect
  73. if (timing == EffectTiming.SecuritySkill)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect($"Play 1 [WG] Digimon card from hand", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  78. activateClass.SetIsSecurityEffect(true);
  79. cardEffects.Add(activateClass);
  80. string EffectDescription()
  81. {
  82. return
  83. "[Security] You may play 1 level 5 or lower Digimon with the [WG] trait from your hand without paying the cost.";
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  88. }
  89. bool CanSelectCardCondition(CardSource cardSource)
  90. {
  91. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 5 &&
  92. cardSource.EqualsTraits("WG") &&
  93. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  94. }
  95. IEnumerator ActivateCoroutine(Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  98. {
  99. List<CardSource> selectedCards = new List<CardSource>();
  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: SelectCardCoroutine,
  111. afterSelectCardCoroutine: null,
  112. mode: SelectHandEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  115. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  116. yield return StartCoroutine(selectHandEffect.Activate());
  117. IEnumerator SelectCardCoroutine(CardSource cardSource)
  118. {
  119. selectedCards.Add(cardSource);
  120. yield return null;
  121. }
  122. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  123. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  124. root: SelectCardEffect.Root.Hand, activateETB: true));
  125. }
  126. }
  127. }
  128. #endregion
  129. return cardEffects;
  130. }
  131. }
  132. }