BT10_056.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_056 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Suspend 1 Digimon and it can't unsuspend", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[When Digivolving] Suspend 1 of your opponent's Digimon. That Digimon doesn't unsuspend during their next unsuspend phase.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  47. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  48. selectPermanentEffect.SetUp(
  49. selectPlayer: card.Owner,
  50. canTargetCondition: CanSelectPermanentCondition,
  51. canTargetCondition_ByPreSelecetedList: null,
  52. canEndSelectCondition: null,
  53. maxCount: maxCount,
  54. canNoSelect: false,
  55. canEndNotMax: false,
  56. selectPermanentCoroutine: null,
  57. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  58. mode: SelectPermanentEffect.Mode.Tap,
  59. cardEffect: activateClass);
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  62. {
  63. foreach (Permanent selectedPermanent in permanents)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendNextActivePhase(
  66. targetPermanent: selectedPermanent,
  67. activateClass: activateClass
  68. ));
  69. }
  70. }
  71. }
  72. }
  73. if (timing == EffectTiming.None)
  74. {
  75. AddSkillClass addSkillClass = new AddSkillClass();
  76. addSkillClass.SetUpICardEffect("Your other Digimon gain effects", CanUseCondition, card);
  77. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  78. cardEffects.Add(addSkillClass);
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. if (CardEffectCommons.IsOpponentTurn(card))
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. bool PermanentCondition(Permanent permanent)
  91. {
  92. if (permanent != card.PermanentOfThisCard())
  93. {
  94. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  95. {
  96. if (permanent.TopCard.HasPlantTraits)
  97. {
  98. return true;
  99. }
  100. if (permanent.TopCard.HasFairyTraits)
  101. {
  102. return true;
  103. }
  104. }
  105. }
  106. return false;
  107. }
  108. bool CardSourceCondition(CardSource cardSource)
  109. {
  110. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  111. {
  112. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  120. {
  121. if (_timing == EffectTiming.OnDestroyedAnyone)
  122. {
  123. ActivateClass activateClass1 = new ActivateClass();
  124. activateClass1.SetUpICardEffect("Memory +2 and return 1 card from trash to hand", CanUseCondition1, cardSource);
  125. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription());
  126. activateClass1.SetRootCardEffect(addSkillClass);
  127. activateClass1.SetHashString("Memory+2_BT10_056");
  128. cardEffects.Add(activateClass1);
  129. string EffectDiscription()
  130. {
  131. return "[On Deletion] Gain 2 memory, and return 1 Digimon card with 3000 DP or less from your trash to your hand.";
  132. }
  133. bool CanSelectCardCondition(CardSource cardSource1)
  134. {
  135. if (cardSource1.IsDigimon)
  136. {
  137. if (cardSource1.CardDP <= 3000)
  138. {
  139. return true;
  140. }
  141. }
  142. return false;
  143. }
  144. bool CanUseCondition1(Hashtable hashtable)
  145. {
  146. if (CardSourceCondition(cardSource))
  147. {
  148. if (CardEffectCommons.CanTriggerOnDeletion(hashtable, cardSource))
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. bool CanActivateCondition1(Hashtable hashtable)
  156. {
  157. if (CardEffectCommons.CanActivateOnDeletion(cardSource))
  158. {
  159. return true;
  160. }
  161. return false;
  162. }
  163. IEnumerator ActivateCoroutine1(Hashtable _hashtable)
  164. {
  165. yield return ContinuousController.instance.StartCoroutine(cardSource.Owner.AddMemory(2, activateClass1));
  166. if (cardSource.Owner.TrashCards.Count(CanSelectCardCondition) >= 1)
  167. {
  168. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  169. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  170. selectCardEffect.SetUp(
  171. canTargetCondition: CanSelectCardCondition,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. canNoSelect: () => false,
  175. selectCardCoroutine: null,
  176. afterSelectCardCoroutine: null,
  177. message: "Select 1 card to add to your hand.",
  178. maxCount: maxCount,
  179. canEndNotMax: false,
  180. isShowOpponent: true,
  181. mode: SelectCardEffect.Mode.AddHand,
  182. root: SelectCardEffect.Root.Trash,
  183. customRootCardList: null,
  184. canLookReverseCard: true,
  185. selectPlayer: card.Owner,
  186. cardEffect: activateClass1);
  187. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  188. }
  189. }
  190. }
  191. return cardEffects;
  192. }
  193. }
  194. return cardEffects;
  195. }
  196. }
  197. }