BT13_064.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_064 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnDestroyedAnyone)
  16. {
  17. int maxLevel()
  18. {
  19. int maxLevel = 3;
  20. if (card.Owner.TrashCards.Count((cardSource) => cardSource.ContainsCardName("Chessmon") && cardSource.IsDigimon) >= 8)
  21. {
  22. maxLevel += 2;
  23. }
  24. return maxLevel;
  25. }
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Play 1 Digimon card with [Chessmon] in its name from hand", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[On Deletion] If it's your opponent's turn, you may play 1 level 3 or lower Digimon card with [Chessmon] in its name from your hand without paying the cost. If you have 8 or more Digimon cards with [Chessmon] in their names in your trash, add 2 to the maximum level of the card this effect can play.";
  33. }
  34. bool CanSelectCardCondition(CardSource cardSource)
  35. {
  36. if (cardSource != null)
  37. {
  38. if (cardSource.ContainsCardName("Chessmon"))
  39. {
  40. if (cardSource.IsDigimon)
  41. {
  42. if (cardSource.Level <= maxLevel())
  43. {
  44. if (cardSource.HasLevel)
  45. {
  46. if (cardSource.Owner == card.Owner)
  47. {
  48. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  49. {
  50. return true;
  51. }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnTrash(card))
  67. {
  68. if (CardEffectCommons.IsOpponentTurn(card))
  69. {
  70. if (card.Owner.HandCards.Count >= 1)
  71. {
  72. return true;
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  79. {
  80. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  81. {
  82. List<CardSource> selectedCards = new List<CardSource>();
  83. int maxCount = 1;
  84. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  85. selectHandEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCardCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: true,
  92. canEndNotMax: false,
  93. isShowOpponent: true,
  94. selectCardCoroutine: SelectCardCoroutine,
  95. afterSelectCardCoroutine: null,
  96. mode: SelectHandEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  99. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  100. yield return StartCoroutine(selectHandEffect.Activate());
  101. IEnumerator SelectCardCoroutine(CardSource cardSource)
  102. {
  103. selectedCards.Add(cardSource);
  104. yield return null;
  105. }
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  107. }
  108. }
  109. }
  110. return cardEffects;
  111. }
  112. }
  113. }