EX8_071.cs 7.6 KB

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