EX8_069.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class EX8_069 : 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. bool PermanentCondition(Permanent permanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  35. permanent.TopCard.EqualsTraits("NSp");
  36. }
  37. AddSkillClass addSkillClass = new AddSkillClass();
  38. addSkillClass.SetUpICardEffect("Your Digimon gain Alliance", CanUseCondition, card);
  39. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  40. cardEffects.Add(addSkillClass);
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistInSecurity(card, false) &&
  44. CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
  45. }
  46. bool CardSourceCondition(CardSource cardSource)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
  49. {
  50. if (cardSource.Owner == card.Owner)
  51. {
  52. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  53. {
  54. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. }
  61. return false;
  62. }
  63. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  64. {
  65. if (_timing == EffectTiming.OnAllyAttack)
  66. {
  67. bool Condition()
  68. {
  69. return CardSourceCondition(cardSource);
  70. }
  71. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(false, cardSource, Condition));
  72. }
  73. return cardEffects;
  74. }
  75. }
  76. #endregion
  77. #region Main Effect
  78. if (timing == EffectTiming.OptionSkill)
  79. {
  80. cardEffects.Add(CardEffectFactory.ReplaceBottomSecurityWithFaceUpOptionMainEffect(card));
  81. }
  82. #endregion
  83. #region Security Effect
  84. if (timing == EffectTiming.SecuritySkill)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect($"Play 1 [NSp] Digimon card from hand", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  89. activateClass.SetIsSecurityEffect(true);
  90. cardEffects.Add(activateClass);
  91. string EffectDescription()
  92. {
  93. return
  94. "[Security] You may play 1 level 5 or lower Digimon with the [NSp] trait from your hand without paying the cost.";
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  99. }
  100. bool CanSelectCardCondition(CardSource cardSource)
  101. {
  102. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 5 &&
  103. cardSource.EqualsTraits("NSp") &&
  104. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  109. {
  110. List<CardSource> selectedCards = new List<CardSource>();
  111. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  112. selectHandEffect.SetUp(
  113. selectPlayer: card.Owner,
  114. canTargetCondition: CanSelectCardCondition,
  115. canTargetCondition_ByPreSelecetedList: null,
  116. canEndSelectCondition: null,
  117. maxCount: 1,
  118. canNoSelect: true,
  119. canEndNotMax: false,
  120. isShowOpponent: true,
  121. selectCardCoroutine: SelectCardCoroutine,
  122. afterSelectCardCoroutine: null,
  123. mode: SelectHandEffect.Mode.Custom,
  124. cardEffect: activateClass);
  125. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  126. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  127. yield return StartCoroutine(selectHandEffect.Activate());
  128. IEnumerator SelectCardCoroutine(CardSource cardSource)
  129. {
  130. selectedCards.Add(cardSource);
  131. yield return null;
  132. }
  133. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  134. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  135. root: SelectCardEffect.Root.Hand, activateETB: true));
  136. }
  137. }
  138. }
  139. #endregion
  140. return cardEffects;
  141. }
  142. }
  143. }