EX8_068.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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_068 : 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 CanUseCondition()
  33. {
  34. return CardEffectCommons.IsExistInSecurity(card, false) &&
  35. card.Owner.MemoryForPlayer >= 1;
  36. }
  37. bool PermanentCondition(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  40. permanent.TopCard.EqualsTraits("DS");
  41. }
  42. bool CanNotBeDestroyedByBattleCondition(Permanent permanent, Permanent AttackingPermanent, Permanent DefendingPermanent, CardSource DefendingCard)
  43. {
  44. if (permanent == AttackingPermanent)
  45. {
  46. return true;
  47. }
  48. if (permanent == DefendingPermanent)
  49. {
  50. return true;
  51. }
  52. return false;
  53. }
  54. cardEffects.Add(CardEffectFactory.CanNotBeDestroyedByBattleStaticEffect(
  55. canNotBeDestroyedByBattleCondition: CanNotBeDestroyedByBattleCondition,
  56. permanentCondition: PermanentCondition,
  57. isInheritedEffect: false,
  58. card: card,
  59. condition: CanUseCondition,
  60. effectName: "Can not be deleted by Battle")
  61. );
  62. }
  63. #endregion
  64. #region Main Effect
  65. if (timing == EffectTiming.OptionSkill)
  66. {
  67. cardEffects.Add(CardEffectFactory.ReplaceBottomSecurityWithFaceUpOptionMainEffect(card));
  68. }
  69. #endregion
  70. #region Security Effect
  71. if (timing == EffectTiming.SecuritySkill)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect($"Play 1 [DS] Digimon card from hand", CanUseCondition, card);
  75. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  76. activateClass.SetIsSecurityEffect(true);
  77. cardEffects.Add(activateClass);
  78. string EffectDescription()
  79. {
  80. return
  81. "[Security] You may play 1 level 5 or lower [DS] trait Digimon card from your hand without paying the cost.";
  82. }
  83. bool CanUseCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  86. }
  87. bool CanSelectCardCondition(CardSource cardSource)
  88. {
  89. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 5 &&
  90. cardSource.EqualsTraits("DS") &&
  91. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  92. }
  93. IEnumerator ActivateCoroutine(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  96. {
  97. List<CardSource> selectedCards = new List<CardSource>();
  98. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  99. selectHandEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectCardCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: 1,
  105. canNoSelect: true,
  106. canEndNotMax: false,
  107. isShowOpponent: true,
  108. selectCardCoroutine: SelectCardCoroutine,
  109. afterSelectCardCoroutine: null,
  110. mode: SelectHandEffect.Mode.Custom,
  111. cardEffect: activateClass);
  112. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  113. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  114. yield return StartCoroutine(selectHandEffect.Activate());
  115. IEnumerator SelectCardCoroutine(CardSource cardSource)
  116. {
  117. selectedCards.Add(cardSource);
  118. yield return null;
  119. }
  120. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  121. cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false,
  122. root: SelectCardEffect.Root.Hand, activateETB: true));
  123. }
  124. }
  125. }
  126. #endregion
  127. return cardEffects;
  128. }
  129. }
  130. }