Sora_Takenouchi_BT15_082.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 Sora_Takenouchi_BT15_082 : 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.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. if(timing == EffectTiming.OnReturnCardsToHandFromTrash)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Return this Tamer to your hand to play a Digimon from your hand.", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. 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.";
  26. }
  27. bool CanSelectPermanentCondition(Permanent permanent)
  28. {
  29. return permanent.TopCard == card;
  30. }
  31. bool CardReturnedCondition(CardSource cardSource)
  32. {
  33. return cardSource.CardColors.Contains(CardColor.Red);
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. if (CardEffectCommons.CanTriggerWhenCardsReturnToHandFromTrash(hashtable, CardReturnedCondition, card))
  40. {
  41. return true;
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. return true;
  51. }
  52. return false;
  53. }
  54. bool CanSelectCardCondition(CardSource cardSource)
  55. {
  56. int subAmount = card.Owner.Enemy.SecurityCards.Count * 2000;
  57. int cardDP = 13000 - subAmount;
  58. if (cardSource.CardDP <= cardDP && cardSource.CardColors.Contains(CardColor.Red) && cardSource.Owner == card.Owner)
  59. {
  60. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false,
  61. cardEffect: activateClass))
  62. {
  63. if (cardSource.ContainsTraits("Avian"))
  64. {
  65. return true;
  66. }
  67. if (cardSource.ContainsTraits("Bird"))
  68. {
  69. return true;
  70. }
  71. if (cardSource.ContainsTraits("Beast"))
  72. {
  73. return true;
  74. }
  75. if (cardSource.ContainsTraits("Animal"))
  76. {
  77. return true;
  78. }
  79. if (cardSource.ContainsTraits("Sovereign"))
  80. {
  81. return true;
  82. }
  83. if (cardSource.ContainsTraits("Sea Animal"))
  84. {
  85. return false;
  86. }
  87. }
  88. }
  89. return false;
  90. }
  91. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  92. {
  93. Permanent bounceTargetPermanent = null;
  94. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: CanSelectPermanentCondition,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: 1,
  101. canNoSelect: true,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: SelectPermanentCoroutine,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Custom,
  106. cardEffect: activateClass);
  107. selectPermanentEffect.SetUpCustomMessage("Select 1 tamer to return to hand.", "The opponent is selecting 1 tamer to return to hand.");
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  110. {
  111. bounceTargetPermanent = permanent;
  112. yield return null;
  113. }
  114. if (bounceTargetPermanent != null)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  117. targetPermanents: new List<Permanent>() { bounceTargetPermanent },
  118. activateClass: activateClass,
  119. successProcess: SuccessProcess(),
  120. failureProcess: null));
  121. IEnumerator SuccessProcess()
  122. {
  123. Debug.Log("Successful Return: Select and Play out digimon");
  124. List<CardSource> selectedCards = new List<CardSource>();
  125. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  126. selectHandEffect.SetUp(
  127. selectPlayer: card.Owner,
  128. canTargetCondition: CanSelectCardCondition,
  129. canTargetCondition_ByPreSelecetedList: null,
  130. canEndSelectCondition: null,
  131. maxCount: 1,
  132. canNoSelect: true,
  133. canEndNotMax: false,
  134. isShowOpponent: true,
  135. selectCardCoroutine: SelectCardCoroutine,
  136. afterSelectCardCoroutine: null,
  137. mode: SelectHandEffect.Mode.Custom,
  138. cardEffect: activateClass);
  139. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  140. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  141. yield return StartCoroutine(selectHandEffect.Activate());
  142. IEnumerator SelectCardCoroutine(CardSource cardSource)
  143. {
  144. selectedCards.Add(cardSource);
  145. yield return null;
  146. }
  147. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  148. }
  149. }
  150. }
  151. }
  152. if(timing == EffectTiming.SecuritySkill)
  153. {
  154. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  155. }
  156. return cardEffects;
  157. }
  158. }