BT7_082.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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 BT7_082 : 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("Place a card in digivolution cards to Recovery +1 (Deck)", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may place 1 [Sistermon Blanc] from your hand or trash at the bottom of this Digimon's digivolution cards to <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource != null)
  26. {
  27. if (cardSource.Owner == card.Owner)
  28. {
  29. if (cardSource.CardNames.Contains("Sistermon Blanc"))
  30. {
  31. return true;
  32. }
  33. if (cardSource.CardNames.Contains("SistermonBlanc"))
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (isExistOnField(card))
  48. {
  49. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  50. {
  51. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  52. {
  53. return true;
  54. }
  55. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  56. {
  57. return true;
  58. }
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (isExistOnField(card))
  66. {
  67. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  68. {
  69. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1 && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  70. {
  71. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  72. {
  73. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  74. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  75. };
  76. string selectPlayerMessage = "From which area do you place a card in digivolution cards?";
  77. string notSelectPlayerMessage = "The opponent is choosing from which area to place a card in digivolution cards.";
  78. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  79. }
  80. else if (card.Owner.HandCards.Count(CanSelectCardCondition) == 0 && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  81. {
  82. GManager.instance.userSelectionManager.SetBool(false);
  83. }
  84. else if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1 && card.Owner.TrashCards.Count(CanSelectCardCondition) == 0)
  85. {
  86. GManager.instance.userSelectionManager.SetBool(true);
  87. }
  88. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  89. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  90. List<CardSource> selectedCards = new List<CardSource>();
  91. IEnumerator SelectCardCoroutine(CardSource cardSource)
  92. {
  93. selectedCards.Add(cardSource);
  94. yield return null;
  95. }
  96. if (fromHand)
  97. {
  98. int maxCount = 1;
  99. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  100. selectHandEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectCardCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: maxCount,
  106. canNoSelect: true,
  107. canEndNotMax: false,
  108. isShowOpponent: true,
  109. selectCardCoroutine: SelectCardCoroutine,
  110. afterSelectCardCoroutine: null,
  111. mode: SelectHandEffect.Mode.Custom,
  112. cardEffect: activateClass);
  113. selectHandEffect.SetUpCustomMessage("Select 1 card to place in digivolution cards.", "The opponent is selecting 1 card to place in digivolution cards.");
  114. yield return StartCoroutine(selectHandEffect.Activate());
  115. }
  116. else
  117. {
  118. int maxCount = 1;
  119. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  120. selectCardEffect.SetUp(
  121. canTargetCondition: CanSelectCardCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. canNoSelect: () => true,
  125. selectCardCoroutine: SelectCardCoroutine,
  126. afterSelectCardCoroutine: null,
  127. message: "Select 1 card to play.",
  128. maxCount: maxCount,
  129. canEndNotMax: false,
  130. isShowOpponent: true,
  131. mode: SelectCardEffect.Mode.Custom,
  132. root: SelectCardEffect.Root.Trash,
  133. customRootCardList: null,
  134. canLookReverseCard: true,
  135. selectPlayer: card.Owner,
  136. cardEffect: activateClass);
  137. selectCardEffect.SetUpCustomMessage("Select 1 card to place in digivolution cards.", "The opponent is selecting 1 card to place in digivolution cards.");
  138. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  139. }
  140. if (selectedCards.Count >= 1)
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  143. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  144. }
  145. }
  146. }
  147. }
  148. }
  149. if (timing == EffectTiming.OnDestroyedAnyone)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("Return 1 card from trash to hand", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  154. cardEffects.Add(activateClass);
  155. string EffectDiscription()
  156. {
  157. return "[On Deletion] Return 1 card with [Jesmon], [Huckmon], or [Sistermon] in its name other than [Sistermon Blanc (Awakened)] from your trash to your hand.";
  158. }
  159. bool CanSelectCardCondition(CardSource cardSource)
  160. {
  161. if (cardSource != null)
  162. {
  163. if (cardSource.Owner == card.Owner)
  164. {
  165. if (!cardSource.CardNames.Contains("Sistermon Blanc (Awakened)") && !cardSource.CardNames.Contains("SistermonBlanc(Awakened)"))
  166. {
  167. if (cardSource.ContainsCardName("Jesmon"))
  168. {
  169. return true;
  170. }
  171. if (cardSource.ContainsCardName("Huckmon"))
  172. {
  173. return true;
  174. }
  175. if (cardSource.ContainsCardName("Sistermon"))
  176. {
  177. return true;
  178. }
  179. }
  180. }
  181. }
  182. return false;
  183. }
  184. bool CanUseCondition(Hashtable hashtable)
  185. {
  186. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  187. }
  188. bool CanActivateCondition(Hashtable hashtable)
  189. {
  190. if (CardEffectCommons.IsExistOnTrash(card))
  191. {
  192. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  193. {
  194. return true;
  195. }
  196. }
  197. return false;
  198. }
  199. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  200. {
  201. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  202. {
  203. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  204. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  205. selectCardEffect.SetUp(
  206. canTargetCondition: CanSelectCardCondition,
  207. canTargetCondition_ByPreSelecetedList: null,
  208. canEndSelectCondition: null,
  209. canNoSelect: () => false,
  210. selectCardCoroutine: null,
  211. afterSelectCardCoroutine: null,
  212. message: "Select 1 card to add to your hand.",
  213. maxCount: maxCount,
  214. canEndNotMax: false,
  215. isShowOpponent: true,
  216. mode: SelectCardEffect.Mode.AddHand,
  217. root: SelectCardEffect.Root.Trash,
  218. customRootCardList: null,
  219. canLookReverseCard: true,
  220. selectPlayer: card.Owner,
  221. cardEffect: activateClass);
  222. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  223. }
  224. }
  225. }
  226. return cardEffects;
  227. }
  228. }