BT9_109.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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 BT9_109 : 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.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return card.Owner.GetBattleAreaDigimons().Count >= 1;
  22. }
  23. bool CardCondition(CardSource cardSource)
  24. {
  25. return cardSource == card;
  26. }
  27. }
  28. if (timing == EffectTiming.SecuritySkill)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect($"Memory +1 and add this card to hand", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  33. activateClass.SetIsSecurityEffect(true);
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[Security] Gain 1 memory, and add this card to its owner's hand. ";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  47. }
  48. }
  49. if (timing == EffectTiming.OptionSkill)
  50. {
  51. ActivateClass activateClass = new ActivateClass();
  52. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  53. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  54. cardEffects.Add(activateClass);
  55. string EffectDiscription()
  56. {
  57. return "[Main] Place this card under 1 of your Digimon without [X Antibody] in its digivolution cards as its bottom digivolution card.";
  58. }
  59. bool CanSelectPermanentCondition(Permanent permanent)
  60. {
  61. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  62. {
  63. if (permanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) == 0)
  64. {
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. bool CanUseCondition(Hashtable hashtable)
  71. {
  72. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  73. }
  74. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  75. {
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  77. {
  78. Permanent selectedPermanent = null;
  79. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  80. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  81. selectPermanentEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectPermanentCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: maxCount,
  87. canNoSelect: false,
  88. canEndNotMax: false,
  89. selectPermanentCoroutine: SelectPermanentCoroutine,
  90. afterSelectPermanentCoroutine: null,
  91. mode: SelectPermanentEffect.Mode.Custom,
  92. cardEffect: activateClass);
  93. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  94. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  95. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  96. {
  97. selectedPermanent = permanent;
  98. yield return null;
  99. }
  100. if (selectedPermanent != null && !selectedPermanent.IsToken)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  103. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  104. }
  105. }
  106. }
  107. }
  108. if (timing == EffectTiming.None)
  109. {
  110. CanNotTrashFromDigivolutionCardsClass canNotTrashFromDigivolutionCardsClass = new CanNotTrashFromDigivolutionCardsClass();
  111. canNotTrashFromDigivolutionCardsClass.SetUpICardEffect("[X Antibody] under this Digimon can't be trashed", CanUseCondition, card);
  112. canNotTrashFromDigivolutionCardsClass.SetUpCanNotTrashFromDigivolutionCardsClass(CardCondition: CardCondition, CardEffectCondition: CardEffectCondition);
  113. canNotTrashFromDigivolutionCardsClass.SetIsInheritedEffect(true);
  114. cardEffects.Add(canNotTrashFromDigivolutionCardsClass);
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.IsExistOnBattleArea(card))
  118. {
  119. return true;
  120. }
  121. return false;
  122. }
  123. bool CardCondition(CardSource cardSource)
  124. {
  125. if (CardEffectCommons.IsExistOnBattleArea(card))
  126. {
  127. if (cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody"))
  128. {
  129. return true;
  130. }
  131. }
  132. return false;
  133. }
  134. bool CardEffectCondition(ICardEffect cardEffect)
  135. {
  136. return cardEffect != null;
  137. }
  138. }
  139. if (timing == EffectTiming.OnAllyAttack)
  140. {
  141. ActivateClass activateClass = new ActivateClass();
  142. activateClass.SetUpICardEffect("Digivolve this Digimon into [X Antibody] Digimon", CanUseCondition, card);
  143. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  144. activateClass.SetIsInheritedEffect(true);
  145. cardEffects.Add(activateClass);
  146. string EffectDiscription()
  147. {
  148. return "[When Attacking] This Digimon can digivolve into a Digimon card with [X Antibody] in its traits in your hand for its digivolution cost.";
  149. }
  150. bool CanSelectCardCondition(CardSource cardSource)
  151. {
  152. if (cardSource.HasXAntibodyTraits)
  153. {
  154. if (cardSource.IsDigimon)
  155. {
  156. if (CardEffectCommons.IsExistOnBattleArea(card))
  157. {
  158. if (cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, true, activateClass, root: SelectCardEffect.Root.Hand))
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. }
  165. return false;
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  170. }
  171. bool CanActivateCondition(Hashtable hashtable)
  172. {
  173. if (CardEffectCommons.IsExistOnBattleArea(card))
  174. {
  175. if (card.Owner.HandCards.Count >= 1)
  176. {
  177. return true;
  178. }
  179. }
  180. return false;
  181. }
  182. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  183. {
  184. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  185. {
  186. List<CardSource> selectedCards = new List<CardSource>();
  187. int maxCount = 1;
  188. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  189. selectHandEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectCardCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: maxCount,
  195. canNoSelect: true,
  196. canEndNotMax: false,
  197. isShowOpponent: true,
  198. selectCardCoroutine: SelectCardCoroutine,
  199. afterSelectCardCoroutine: null,
  200. mode: SelectHandEffect.Mode.Custom,
  201. cardEffect: activateClass);
  202. selectHandEffect.SetUpCustomMessage("Select 1 card to digivolve.", "The opponent is selecting 1 card to digivolve.");
  203. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  204. yield return StartCoroutine(selectHandEffect.Activate());
  205. IEnumerator SelectCardCoroutine(CardSource cardSource)
  206. {
  207. selectedCards.Add(cardSource);
  208. yield return null;
  209. }
  210. if (selectedCards.Count >= 1)
  211. {
  212. CardSource selectedCard = selectedCards[0];
  213. if (CardEffectCommons.IsExistOnBattleArea(card))
  214. {
  215. yield return ContinuousController.instance.StartCoroutine(new PlayCardClass(
  216. cardSources: new List<CardSource>() { selectedCard },
  217. hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
  218. payCost: true,
  219. targetPermanent: card.PermanentOfThisCard(),
  220. isTapped: false,
  221. root: SelectCardEffect.Root.Hand,
  222. activateETB: true).PlayCard());
  223. }
  224. }
  225. }
  226. }
  227. }
  228. return cardEffects;
  229. }
  230. }