ST20_15.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //ST21 Gennai's House
  5. namespace DCGO.CardEffects.ST20
  6. {
  7. public class ST20_15 : 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.Any(card => card.EqualsCardName("Island of Adventure") && !card.IsFlipped);
  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 CanUseCondition()
  33. {
  34. return CardEffectCommons.IsExistInSecurity(card, false);
  35. }
  36. bool PermanentCondition(Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  39. permanent.TopCard.HasLevel && permanent.Level >= 3;
  40. }
  41. string EffectDescription()
  42. {
  43. return "[Security][All Turns] All of your level 3 or higher Digimon get +2000 DP.";
  44. }
  45. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  46. permanentCondition: PermanentCondition,
  47. changeValue: 2000,
  48. isInheritedEffect: false,
  49. card: card,
  50. condition: CanUseCondition,
  51. effectName: EffectDescription));
  52. }
  53. #endregion
  54. #region Main Effect
  55. if (timing == EffectTiming.OptionSkill)
  56. {
  57. cardEffects.Add(CardEffectFactory.ReplaceTopSecurityWithFaceUpOptionMainEffect(card));
  58. }
  59. #endregion
  60. #region Security Effect
  61. if (timing == EffectTiming.SecuritySkill)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("Play 1 tamer from hand", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDescription());
  66. activateClass.SetIsSecurityEffect(true);
  67. cardEffects.Add(activateClass);
  68. string EffectDescription()
  69. {
  70. return "[Security] You may play 1 Tamer card from your hand without paying the cost.";
  71. }
  72. bool CanUseCondition(Hashtable hashtable)
  73. {
  74. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  75. }
  76. bool CanSelectCardCondition(CardSource cardSource)
  77. {
  78. return cardSource.IsTamer &&
  79. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  80. }
  81. IEnumerator ActivateCoroutine(Hashtable hashtable)
  82. {
  83. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  84. {
  85. List<CardSource> selectedCards = new List<CardSource>();
  86. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  87. selectHandEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectCardCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: 1,
  93. canNoSelect: true,
  94. canEndNotMax: false,
  95. isShowOpponent: true,
  96. selectCardCoroutine: SelectCardCoroutine,
  97. afterSelectCardCoroutine: null,
  98. mode: SelectHandEffect.Mode.Custom,
  99. cardEffect: activateClass);
  100. selectHandEffect.SetUpCustomMessage("Select 1 tamer to play.", "The opponent is selecting 1 tamer to play.");
  101. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  102. yield return StartCoroutine(selectHandEffect.Activate());
  103. IEnumerator SelectCardCoroutine(CardSource cardSource)
  104. {
  105. selectedCards.Add(cardSource);
  106. yield return null;
  107. }
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  109. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  110. root: SelectCardEffect.Root.Hand, activateETB: true));
  111. }
  112. }
  113. }
  114. #endregion
  115. return cardEffects;
  116. }
  117. }
  118. }