BT13_094.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_094 : 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.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Start of Your Main Phase] If you have a Digimon with [Avian] or [Bird] in one of its traits, gain 1 memory.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. if (CardEffectCommons.IsExistOnBattleArea(card))
  24. {
  25. if (CardEffectCommons.IsOwnerTurn(card))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. if (isExistOnField(card))
  35. {
  36. if (card.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()))
  37. {
  38. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.HasBirdTraits))
  39. {
  40. if (card.Owner.CanAddMemory(activateClass))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. if (isExistOnField(card))
  52. {
  53. if (card.Owner.CanAddMemory(activateClass))
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  56. }
  57. }
  58. }
  59. }
  60. if (timing == EffectTiming.OnEnterFieldAnyone)
  61. {
  62. ActivateClass activateClass = new ActivateClass();
  63. activateClass.SetUpICardEffect("Your 1 Digimon gets effects", CanUseCondition, card);
  64. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  65. cardEffects.Add(activateClass);
  66. string EffectDiscription()
  67. {
  68. return "[On Play] 1 of your Digimon gains \"[On Deletion] You may play 1[Biyomon] from your hand or trash without paying the cost\" until the end of your opponent's turn.";
  69. }
  70. bool CanSelectPermanentCondition(Permanent permanent)
  71. {
  72. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  77. }
  78. bool CanActivateCondition(Hashtable hashtable)
  79. {
  80. if (isExistOnField(card))
  81. {
  82. if (card.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()))
  83. {
  84. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  85. {
  86. return true;
  87. }
  88. }
  89. }
  90. return false;
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  93. {
  94. if (isExistOnField(card))
  95. {
  96. if (card.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()))
  97. {
  98. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  99. {
  100. int maxCount = 1;
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: SelectPermanentCoroutine,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  117. {
  118. Permanent selectedPermanent = permanent;
  119. if (selectedPermanent != null)
  120. {
  121. CardSource _topCard = selectedPermanent.TopCard;
  122. ActivateClass activateClass1 = new ActivateClass();
  123. activateClass1.SetUpICardEffect("Play 1 [Biyomon] from trash", CanUseCondition1, selectedPermanent.TopCard);
  124. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, true, EffectDiscription1());
  125. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  126. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  127. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  128. string EffectDiscription1()
  129. {
  130. return "[On Deletion] You may play 1[Biyomon] from your hand or trash without paying the cost";
  131. }
  132. bool CanSelectCardCondition(CardSource cardSource)
  133. {
  134. if (cardSource != null)
  135. {
  136. if (cardSource.Owner == card.Owner)
  137. {
  138. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass1))
  139. {
  140. if (cardSource.CardNames.Contains("Biyomon"))
  141. {
  142. return true;
  143. }
  144. }
  145. }
  146. }
  147. return false;
  148. }
  149. bool CanUseCondition1(Hashtable hashtable1)
  150. {
  151. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  152. {
  153. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent))
  154. {
  155. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  156. {
  157. return true;
  158. }
  159. }
  160. }
  161. return false;
  162. }
  163. bool CanActivateCondition1(Hashtable hashtable1)
  164. {
  165. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  166. {
  167. if (_topCard.Owner.HandCards.Count((cardSource) => CanSelectCardCondition(cardSource)) >= 1)
  168. {
  169. return true;
  170. }
  171. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(_topCard, CanSelectCardCondition))
  172. {
  173. return true;
  174. }
  175. }
  176. return false;
  177. }
  178. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  179. {
  180. bool canSelectHand = _topCard.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  181. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(_topCard, CanSelectCardCondition);
  182. if (canSelectHand || canSelectTrash)
  183. {
  184. if (canSelectHand && canSelectTrash)
  185. {
  186. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  187. {
  188. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  189. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  190. };
  191. string selectPlayerMessage = "From which area do you play a card?";
  192. string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
  193. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  194. }
  195. else
  196. {
  197. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  198. }
  199. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  200. List<CardSource> selectedCards = new List<CardSource>();
  201. IEnumerator SelectCardCoroutine(CardSource cardSource)
  202. {
  203. selectedCards.Add(cardSource);
  204. yield return null;
  205. }
  206. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  207. if (fromHand)
  208. {
  209. int maxCount = 1;
  210. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  211. selectHandEffect.SetUp(
  212. selectPlayer: card.Owner,
  213. canTargetCondition: CanSelectCardCondition,
  214. canTargetCondition_ByPreSelecetedList: null,
  215. canEndSelectCondition: null,
  216. maxCount: maxCount,
  217. canNoSelect: true,
  218. canEndNotMax: false,
  219. isShowOpponent: true,
  220. selectCardCoroutine: SelectCardCoroutine,
  221. afterSelectCardCoroutine: null,
  222. mode: SelectHandEffect.Mode.Custom,
  223. cardEffect: activateClass);
  224. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  225. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  226. yield return StartCoroutine(selectHandEffect.Activate());
  227. }
  228. else
  229. {
  230. int maxCount = 1;
  231. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  232. selectCardEffect.SetUp(
  233. canTargetCondition: CanSelectCardCondition,
  234. canTargetCondition_ByPreSelecetedList: null,
  235. canEndSelectCondition: null,
  236. canNoSelect: () => true,
  237. selectCardCoroutine: SelectCardCoroutine,
  238. afterSelectCardCoroutine: null,
  239. message: "Select 1 card to play.",
  240. maxCount: maxCount,
  241. canEndNotMax: false,
  242. isShowOpponent: true,
  243. mode: SelectCardEffect.Mode.Custom,
  244. root: SelectCardEffect.Root.Trash,
  245. customRootCardList: null,
  246. canLookReverseCard: true,
  247. selectPlayer: card.Owner,
  248. cardEffect: activateClass);
  249. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  250. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  251. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  252. }
  253. SelectCardEffect.Root root = SelectCardEffect.Root.Hand;
  254. if (!fromHand)
  255. {
  256. root = SelectCardEffect.Root.Trash;
  257. }
  258. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: root, activateETB: true));
  259. }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. }
  266. }
  267. }
  268. if (timing == EffectTiming.SecuritySkill)
  269. {
  270. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  271. }
  272. return cardEffects;
  273. }
  274. }
  275. }