P_112.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 P_112 : 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("Reveal the top 3 cards of deck and play 1 [Menoa Bellucci]", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] Reveal the top 3 cards of your deck. Add 1 [Eosmon] and 1 [Menoa Bellucci] among them to your hand. Place the rest at the bottom of your deck. Then, by placing this card under 1 of your [Eosmon], you may play 1 [Menoa Bellucci] from your hand without paying the cost.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.CardNames.Contains("Eosmon");
  26. }
  27. bool CanSelectCardCondition1(CardSource cardSource)
  28. {
  29. if (cardSource.CardNames.Contains("Menoa Bellucci"))
  30. {
  31. return true;
  32. }
  33. if (cardSource.CardNames.Contains("MenoaBellucci"))
  34. {
  35. return true;
  36. }
  37. return false;
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  42. {
  43. if (permanent != card.PermanentOfThisCard())
  44. {
  45. if (permanent.TopCard.CardNames.Contains("Eosmon"))
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool CanSelectCardCondition2(CardSource cardSource)
  54. {
  55. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  56. {
  57. if (cardSource.CardNames.Contains("Menoa Bellucci"))
  58. {
  59. return true;
  60. }
  61. if (cardSource.CardNames.Contains("MenoaBellucci"))
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. bool CanUseCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  71. }
  72. bool CanActivateCondition(Hashtable hashtable)
  73. {
  74. if (CardEffectCommons.IsExistOnBattleArea(card))
  75. {
  76. if (card.Owner.LibraryCards.Count >= 1)
  77. {
  78. return true;
  79. }
  80. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  81. {
  82. return true;
  83. }
  84. }
  85. return false;
  86. }
  87. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  90. revealCount: 3,
  91. simplifiedSelectCardConditions:
  92. new SimplifiedSelectCardConditionClass[]
  93. {
  94. new SimplifiedSelectCardConditionClass(
  95. canTargetCondition:CanSelectCardCondition,
  96. message: "Select 1 [Eosmon].",
  97. mode: SelectCardEffect.Mode.AddHand,
  98. maxCount: 1,
  99. selectCardCoroutine: null),
  100. new SimplifiedSelectCardConditionClass(
  101. canTargetCondition:CanSelectCardCondition1,
  102. message: "Select 1 [Menoa Bellucci].",
  103. mode: SelectCardEffect.Mode.AddHand,
  104. maxCount: 1,
  105. selectCardCoroutine: null),
  106. },
  107. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  108. activateClass: activateClass
  109. ));
  110. if (CardEffectCommons.IsExistOnBattleArea(card))
  111. {
  112. bool added = false;
  113. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: maxCount,
  121. canNoSelect: true,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: SelectPermanentCoroutine,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Custom,
  126. cardEffect: activateClass);
  127. selectPermanentEffect.SetUpCustomMessage("Select 1 [Eosmon] that will get a digivolution card.", "The opponent is selecting 1 [Eosmon] that will get a digivolution card.");
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  130. {
  131. Permanent selectedPermanent = permanent;
  132. if (selectedPermanent != null)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { card.PermanentOfThisCard(), selectedPermanent } }, false, activateClass).PlacePermanentToDigivolutionCards());
  135. if (card.IsToken)
  136. {
  137. added = true;
  138. }
  139. if (isExistOnField(card))
  140. {
  141. if (selectedPermanent.DigivolutionCards.Contains(card))
  142. {
  143. added = true;
  144. }
  145. }
  146. }
  147. }
  148. if (added)
  149. {
  150. if (card.Owner.HandCards.Count(CanSelectCardCondition2) >= 1)
  151. {
  152. List<CardSource> selectedCards = new List<CardSource>();
  153. maxCount = 1;
  154. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  155. selectHandEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectCardCondition2,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: true,
  162. canEndNotMax: false,
  163. isShowOpponent: true,
  164. selectCardCoroutine: SelectCardCoroutine,
  165. afterSelectCardCoroutine: null,
  166. mode: SelectHandEffect.Mode.Custom,
  167. cardEffect: activateClass);
  168. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  169. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  170. yield return StartCoroutine(selectHandEffect.Activate());
  171. IEnumerator SelectCardCoroutine(CardSource cardSource)
  172. {
  173. selectedCards.Add(cardSource);
  174. yield return null;
  175. }
  176. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  177. }
  178. }
  179. }
  180. }
  181. }
  182. if (timing == EffectTiming.OnEnterFieldAnyone)
  183. {
  184. ActivateClass activateClass = new ActivateClass();
  185. activateClass.SetUpICardEffect("This Digimon digivolves into [Eosmon]", CanUseCondition, card);
  186. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  187. activateClass.SetIsInheritedEffect(true);
  188. activateClass.SetHashString("DigivolveIntoEosmon_P_112");
  189. cardEffects.Add(activateClass);
  190. string EffectDiscription()
  191. {
  192. return "[Your Turn] [Once Per Turn] When another [Eosmon] is played, this Digimon may digivolve into an [Eosmon] from your hand, reducing the digivolution cost by 3.";
  193. }
  194. bool CanSelectCardCondition(CardSource cardSource)
  195. {
  196. return cardSource.CardNames.Contains("Eosmon");
  197. }
  198. bool CanUseCondition(Hashtable hashtable)
  199. {
  200. if (CardEffectCommons.IsExistOnBattleArea(card))
  201. {
  202. if (CardEffectCommons.IsOwnerTurn(card))
  203. {
  204. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, (permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) && permanent.TopCard.CardNames.Contains("Eosmon") && permanent != card.PermanentOfThisCard()))
  205. {
  206. return true;
  207. }
  208. }
  209. }
  210. return false;
  211. }
  212. bool CanActivateCondition(Hashtable hashtable)
  213. {
  214. if (CardEffectCommons.IsExistOnBattleArea(card))
  215. {
  216. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  217. {
  218. return true;
  219. }
  220. }
  221. return false;
  222. }
  223. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  224. {
  225. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  226. targetPermanent: card.PermanentOfThisCard(),
  227. cardCondition: CanSelectCardCondition,
  228. payCost: true,
  229. reduceCostTuple: (reduceCost: 3, reduceCostCardCondition: null),
  230. fixedCostTuple: null,
  231. ignoreDigivolutionRequirementFixedCost: -1,
  232. isHand: true,
  233. activateClass: activateClass,
  234. successProcess: null));
  235. }
  236. }
  237. return cardEffects;
  238. }
  239. }