BT6_083.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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 BT6_083 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Play 1 Tamer from hand each other", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may play 1 white Tamer card with a play cost of 4 or less from your hand without paying its memory cost. Then, your opponent may play 1 Tamer card from their hand without paying its memory cost.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsTamer)
  26. {
  27. if (cardSource.HasCardColor(CardColor.White))
  28. {
  29. if (cardSource.GetCostItself <= 4)
  30. {
  31. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanSelectCardCondition1(CardSource cardSource)
  41. {
  42. if (cardSource.IsTamer)
  43. {
  44. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (card.Owner.HandCards.Count >= 1)
  60. {
  61. return true;
  62. }
  63. if (card.Owner.Enemy.HandCards.Count >= 1)
  64. {
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  73. {
  74. List<CardSource> selectedCards = new List<CardSource>();
  75. int maxCount = 1;
  76. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  77. selectHandEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectCardCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. isShowOpponent: true,
  86. selectCardCoroutine: SelectCardCoroutine,
  87. afterSelectCardCoroutine: null,
  88. mode: SelectHandEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  91. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  92. yield return StartCoroutine(selectHandEffect.Activate());
  93. IEnumerator SelectCardCoroutine(CardSource cardSource)
  94. {
  95. selectedCards.Add(cardSource);
  96. yield return null;
  97. }
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  99. cardSources: selectedCards,
  100. activateClass: activateClass,
  101. payCost: false,
  102. isTapped: false,
  103. root: SelectCardEffect.Root.Hand,
  104. activateETB: true));
  105. }
  106. if (card.Owner.Enemy.HandCards.Count(CanSelectCardCondition1) >= 1)
  107. {
  108. List<CardSource> selectedCards = new List<CardSource>();
  109. int maxCount = 1;
  110. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  111. selectHandEffect.SetUp(
  112. selectPlayer: card.Owner.Enemy,
  113. canTargetCondition: CanSelectCardCondition1,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: maxCount,
  117. canNoSelect: true,
  118. canEndNotMax: false,
  119. isShowOpponent: true,
  120. selectCardCoroutine: SelectCardCoroutine,
  121. afterSelectCardCoroutine: null,
  122. mode: SelectHandEffect.Mode.Custom,
  123. cardEffect: activateClass);
  124. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  125. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. IEnumerator SelectCardCoroutine(CardSource cardSource)
  128. {
  129. selectedCards.Add(cardSource);
  130. yield return null;
  131. }
  132. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  133. cardSources: selectedCards,
  134. activateClass: activateClass,
  135. payCost: false,
  136. isTapped: false,
  137. root: SelectCardEffect.Root.Hand,
  138. activateETB: true));
  139. }
  140. }
  141. }
  142. if (timing == EffectTiming.OnAllyAttack)
  143. {
  144. ActivateClass activateClass = new ActivateClass();
  145. activateClass.SetUpICardEffect("Play 1 Tamer from hand", CanUseCondition, card);
  146. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  147. activateClass.SetIsInheritedEffect(true);
  148. cardEffects.Add(activateClass);
  149. string EffectDiscription()
  150. {
  151. return "[When Attacking] You may play 1 white Tamer card with a play cost of 4 or less from your hand without paying its memory cost.";
  152. }
  153. bool CanSelectCardCondition(CardSource cardSource)
  154. {
  155. if (cardSource.IsTamer)
  156. {
  157. if (cardSource.HasCardColor(CardColor.White))
  158. {
  159. if (cardSource.GetCostItself <= 4)
  160. {
  161. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  162. {
  163. return true;
  164. }
  165. }
  166. }
  167. }
  168. return false;
  169. }
  170. bool CanUseCondition(Hashtable hashtable)
  171. {
  172. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  173. }
  174. bool CanActivateCondition(Hashtable hashtable)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleArea(card))
  177. {
  178. if (card.Owner.HandCards.Count >= 1)
  179. {
  180. return true;
  181. }
  182. }
  183. return false;
  184. }
  185. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  186. {
  187. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  188. {
  189. List<CardSource> selectedCards = new List<CardSource>();
  190. int maxCount = 1;
  191. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  192. selectHandEffect.SetUp(
  193. selectPlayer: card.Owner,
  194. canTargetCondition: CanSelectCardCondition,
  195. canTargetCondition_ByPreSelecetedList: null,
  196. canEndSelectCondition: null,
  197. maxCount: maxCount,
  198. canNoSelect: true,
  199. canEndNotMax: false,
  200. isShowOpponent: true,
  201. selectCardCoroutine: SelectCardCoroutine,
  202. afterSelectCardCoroutine: null,
  203. mode: SelectHandEffect.Mode.Custom,
  204. cardEffect: activateClass);
  205. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  206. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  207. yield return StartCoroutine(selectHandEffect.Activate());
  208. IEnumerator SelectCardCoroutine(CardSource cardSource)
  209. {
  210. selectedCards.Add(cardSource);
  211. yield return null;
  212. }
  213. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  214. cardSources: selectedCards,
  215. activateClass: activateClass,
  216. payCost: false,
  217. isTapped: false,
  218. root: SelectCardEffect.Root.Hand,
  219. activateETB: true));
  220. }
  221. }
  222. }
  223. return cardEffects;
  224. }
  225. }