EX8_067.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_067 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnStartTurn)
  11. {
  12. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  13. }
  14. #region Your Turn
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("place up to 2 cards with the [Mineral] or [Rock] trait from your trash as bottom digivolution sources", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[Your Turn] When any of your Digimon digivolve into a [Mineral] or [Rock] trait Digimon, by suspending this Tamer, place up to 2 cards with the [Mineral] or [Rock] trait from your trash as that Digimon’s bottom digivolution cards.";
  24. }
  25. bool HasProperTraits(CardSource source)
  26. {
  27. return source.EqualsTraits("Mineral") || source.EqualsTraits("Rock");
  28. }
  29. bool PermanentCondition(Permanent permanent)
  30. {
  31. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  32. return HasProperTraits(permanent.TopCard);
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. if (CardEffectCommons.IsOwnerTurn(card))
  40. {
  41. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.IsExistOnBattleArea(card))
  52. {
  53. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  63. {
  64. List<Permanent> digivolvedPermanent = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable(hashtable, null);
  65. List<CardSource> selectedCards = new List<CardSource>();
  66. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  67. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  68. selectCardEffect.SetUp(
  69. canTargetCondition: HasProperTraits,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: CanEndSelectCondition,
  72. canNoSelect: () => true,
  73. selectCardCoroutine: SelectCardCoroutine,
  74. afterSelectCardCoroutine: null,
  75. message: "Select [Mineral] or [Rock] to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  76. maxCount: 2,
  77. canEndNotMax: true,
  78. isShowOpponent: true,
  79. mode: SelectCardEffect.Mode.Custom,
  80. root: SelectCardEffect.Root.Trash,
  81. customRootCardList: null,
  82. canLookReverseCard: true,
  83. selectPlayer: card.Owner,
  84. cardEffect: activateClass);
  85. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  86. selectCardEffect.SetUpCustomMessage("Select [Mineral] or [Rock] to place on bottom of digivolution cards.", "The opponent is selecting [Mineral] or [Rock] to place on bottom of digivolution cards.");
  87. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  88. bool CanEndSelectCondition(List<CardSource> cardSources)
  89. {
  90. if (CardEffectCommons.HasNoElement(cardSources))
  91. {
  92. return false;
  93. }
  94. return true;
  95. }
  96. IEnumerator SelectCardCoroutine(CardSource cardSource)
  97. {
  98. selectedCards.Add(cardSource);
  99. yield return null;
  100. }
  101. if (selectedCards.Count >= 1)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(digivolvedPermanent[0].AddDigivolutionCardsBottom(selectedCards, activateClass));
  104. }
  105. }
  106. }
  107. }
  108. #endregion
  109. if (timing == EffectTiming.SecuritySkill)
  110. {
  111. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  112. }
  113. return cardEffects;
  114. }
  115. }
  116. }