BT17_090.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT17
  6. {
  7. public class BT17_090 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Your Turn
  13. if (timing == EffectTiming.OnAddDigivolutionCards)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "[Your Turn] When an effect places a Tamer card in one of your Digimon's digivolution cards, by suspending this Tamer, gain 1 memory.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleArea(card) &&
  27. CardEffectCommons.IsOwnerTurn(card) &&
  28. CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  29. hashtable: hashtable,
  30. permanentCondition: permanent =>
  31. CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card),
  32. cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null,
  33. cardCondition: cardSource => cardSource.IsTamer);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanActivateSuspendCostEffect(card);
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable hashtable)
  40. {
  41. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  42. new List<Permanent>() { card.PermanentOfThisCard() },
  43. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  44. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  45. }
  46. }
  47. #endregion
  48. #region End of Opponent's Turn
  49. if (timing == EffectTiming.OnEndTurn)
  50. {
  51. ActivateClass activateClass = new ActivateClass();
  52. activateClass.SetUpICardEffect("Digivolve one of your Digimon into a [Dex] or [DeathX] Digimon from trash", CanUseCondition,
  53. card);
  54. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  55. cardEffects.Add(activateClass);
  56. string EffectDescription()
  57. {
  58. return
  59. "[End of Opponent's Turn] (Once per Turn) If this Tamer is suspended, 1 of your Digimon with a Tamer card in its digivolution cards may digivolve into a Digimon card with [Dex] or [DeathX] in its name in the trash without paying the cost.";
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.IsExistOnBattleArea(card) &&
  64. CardEffectCommons.IsOpponentTurn(card);
  65. }
  66. bool DexCardCondition(CardSource cardSource)
  67. {
  68. return cardSource.IsDigimon &&
  69. (cardSource.ContainsCardName("Dex") ||
  70. cardSource.ContainsCardName("DeathX"));
  71. }
  72. bool CanSelectPermanentCondition(Permanent permanent)
  73. {
  74. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  75. permanent.DigivolutionCards.Some(cardSource => cardSource.IsTamer) &&
  76. card.Owner.TrashCards.Where(DexCardCondition).Any(cardSource =>
  77. cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass));
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleArea(card) &&
  82. card.PermanentOfThisCard().IsSuspended &&
  83. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable hashtable)
  86. {
  87. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  88. {
  89. int maxCount = Math.Min(1,
  90. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  91. SelectPermanentEffect selectPermanentEffect =
  92. GManager.instance.GetComponent<SelectPermanentEffect>();
  93. selectPermanentEffect.SetUp(
  94. selectPlayer: card.Owner,
  95. canTargetCondition: CanSelectPermanentCondition,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. maxCount: maxCount,
  99. canNoSelect: true,
  100. canEndNotMax: false,
  101. selectPermanentCoroutine: SelectPermanentCoroutine,
  102. afterSelectPermanentCoroutine: null,
  103. mode: SelectPermanentEffect.Mode.Custom,
  104. cardEffect: activateClass);
  105. selectPermanentEffect.SetUpCustomMessage(
  106. "Select 1 Digimon to digivolve.",
  107. "The opponent is selecting 1 Digimon to digivolve.");
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  112. targetPermanent: permanent,
  113. cardCondition: DexCardCondition,
  114. payCost: false,
  115. reduceCostTuple: null,
  116. fixedCostTuple: null,
  117. ignoreDigivolutionRequirementFixedCost: -1,
  118. isHand: false,
  119. activateClass: activateClass,
  120. successProcess: null));
  121. }
  122. }
  123. }
  124. }
  125. #endregion
  126. #region Security Skill
  127. if (timing == EffectTiming.SecuritySkill)
  128. {
  129. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  130. }
  131. #endregion
  132. return cardEffects;
  133. }
  134. }
  135. }