BT8_068.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT8_068 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] You may reveal the top 3 cards of your deck. For each of your opponent's Digimon, you may play 1 Digimon card with [Mamemon] in its name and a memory cost of 10 or less among the revealed cards without paying its memory cost. Trash the remaining cards.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  26. {
  27. if (cardSource.ContainsCardName("Mamemon"))
  28. {
  29. if (cardSource.GetCostItself <= 10)
  30. {
  31. if (cardSource.IsDigimon)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (card.Owner.LibraryCards.Count >= 1)
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. int maxCount = Math.Min(card.Owner.Enemy.GetBattleAreaDigimons().Count, card.Owner.fieldCardFrames.Count((frame) => frame.IsEmptyFrame() && frame.IsBattleAreaFrame()));
  58. List<CardSource> selectedCards = new List<CardSource>();
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  60. revealCount: 3,
  61. simplifiedSelectCardConditions:
  62. new SimplifiedSelectCardConditionClass[]
  63. {
  64. new SimplifiedSelectCardConditionClass(
  65. canTargetCondition:CanSelectCardCondition,
  66. message: "Select Digimon card with [Mamemon] in its name and a memory cost of 10 or less.",
  67. mode: SelectCardEffect.Mode.Custom,
  68. maxCount: maxCount,
  69. selectCardCoroutine: SelectCardCoroutine),
  70. },
  71. remainingCardsPlace: RemainingCardsPlace.Trash,
  72. activateClass: activateClass,
  73. canNoSelect: true
  74. ));
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCards.Add(cardSource);
  78. yield return null;
  79. }
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  81. cardSources: selectedCards,
  82. activateClass: activateClass,
  83. payCost: false,
  84. isTapped: false,
  85. root: SelectCardEffect.Root.Library,
  86. activateETB: true));
  87. }
  88. }
  89. if (timing == EffectTiming.None)
  90. {
  91. bool PermanentCondition(Permanent permanent)
  92. {
  93. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  94. {
  95. if (permanent != card.PermanentOfThisCard())
  96. {
  97. if (permanent.TopCard.ContainsCardName("Mamemon"))
  98. {
  99. return true;
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool Condition()
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(
  117. changeValue: 1,
  118. isInheritedEffect: false,
  119. card: card,
  120. condition: Condition));
  121. }
  122. return cardEffects;
  123. }
  124. }