BT15_082.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_082 : 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.OnStartTurn)
  12. {
  13. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  14. }
  15. if (timing == EffectTiming.OnReturnCardsToHandFromTrash)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Return this Tamer to your hand to play a Digimon from your hand.", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[All Turns] When a red Digimon card returns from your trash to the hand, by returning this Tamer to the hand, you may play 1 13000 DP or less red Digimon card with [Avian], [Bird], [Beast], [Animal] or [Sovereign], other than [Sea Animal] in one of its traits from your hand without paying the cost. For each of your opponent's security cards, remove 2000 from this effect's playable card's DP maximum.";
  24. }
  25. bool CardReturnedCondition(CardSource cardSource)
  26. {
  27. if (cardSource.Owner == card.Owner)
  28. {
  29. return cardSource.HasCardColor(CardColor.Red);
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.CanTriggerWhenCardsReturnToHandFromTrash(hashtable, CardReturnedCondition, card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. return true;
  49. }
  50. return false;
  51. }
  52. bool CanSelectCardCondition(CardSource cardSource)
  53. {
  54. int subAmount = card.Owner.Enemy.SecurityCards.Count * 2000;
  55. int cardDP = 13000 - subAmount;
  56. if (cardSource.CardDP <= cardDP && cardSource.HasCardColor(CardColor.Red) && cardSource.Owner == card.Owner)
  57. {
  58. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false,
  59. cardEffect: activateClass))
  60. {
  61. if (cardSource.HasAvianBeastAnimalTraits)
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. Permanent bounceTargetPermanent = card.PermanentOfThisCard();
  72. if (bounceTargetPermanent != null)
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  75. targetPermanents: new List<Permanent>() { bounceTargetPermanent },
  76. activateClass: activateClass,
  77. successProcess: SuccessProcess(),
  78. failureProcess: null));
  79. IEnumerator SuccessProcess()
  80. {
  81. List<CardSource> selectedCards = new List<CardSource>();
  82. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  83. selectHandEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: CanSelectCardCondition,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: 1,
  89. canNoSelect: true,
  90. canEndNotMax: false,
  91. isShowOpponent: true,
  92. selectCardCoroutine: SelectCardCoroutine,
  93. afterSelectCardCoroutine: null,
  94. mode: SelectHandEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  97. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  98. yield return StartCoroutine(selectHandEffect.Activate());
  99. IEnumerator SelectCardCoroutine(CardSource cardSource)
  100. {
  101. selectedCards.Add(cardSource);
  102. yield return null;
  103. }
  104. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  105. }
  106. }
  107. }
  108. }
  109. if (timing == EffectTiming.SecuritySkill)
  110. {
  111. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  112. }
  113. return cardEffects;
  114. }
  115. }
  116. }