BT21_016.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Shoutmon (King Version)
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_016 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.IsLevel3)
  18. {
  19. return targetPermanent.TopCard.HasHeroTraits || targetPermanent.TopCard.EqualsTraits("Xros Heart");
  20. }
  21. return false;
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  24. permanentCondition: PermanentCondition,
  25. digivolutionCost: 2,
  26. ignoreDigivolutionRequirement: false,
  27. card: card,
  28. condition: null)
  29. );
  30. }
  31. #endregion
  32. #region Also treated as [Shoutmon]
  33. if (timing == EffectTiming.None)
  34. {
  35. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  36. changeCardNamesClass.SetUpICardEffect("Also treated as [Shoutmon]", CanUseCondition, card);
  37. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  38. cardEffects.Add(changeCardNamesClass);
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return true;
  42. }
  43. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  44. {
  45. if (cardSource == card)
  46. {
  47. CardNames.Add("Shoutmon");
  48. }
  49. return CardNames;
  50. }
  51. }
  52. #endregion
  53. #region Raid
  54. if (timing == EffectTiming.OnAllyAttack)
  55. {
  56. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  57. }
  58. #endregion
  59. #region Piercing
  60. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  61. {
  62. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  63. }
  64. #endregion
  65. #region DigiXros
  66. if (timing == EffectTiming.None)
  67. {
  68. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  69. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  70. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  71. addDigiXrosConditionClass.SetNotShowUI(true);
  72. cardEffects.Add(addDigiXrosConditionClass);
  73. bool CanUseCondition(Hashtable hashtable)
  74. {
  75. return true;
  76. }
  77. DigiXrosCondition GetDigiXros(CardSource cardSource)
  78. {
  79. if (cardSource == card)
  80. {
  81. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "[Xros Heart] Digimon");
  82. bool CanSelectCardCondition(CardSource cardSource)
  83. {
  84. if (cardSource != null)
  85. {
  86. if (cardSource.Owner == card.Owner)
  87. {
  88. if (cardSource.IsDigimon)
  89. {
  90. if (cardSource.CardTraits.Contains("Xros Heart"))
  91. {
  92. return true;
  93. }
  94. if (cardSource.CardTraits.Contains("XrosHeart"))
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  104. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 1);
  105. return digiXrosCondition;
  106. }
  107. return null;
  108. }
  109. }
  110. #endregion
  111. #region On Deletion
  112. if (timing == EffectTiming.OnDestroyedAnyone)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect("Place 1 [Xros]/[Blue Flare]/[Hero] digimon under tamer, then <Save>", CanUseCondition, card);
  116. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  117. cardEffects.Add(activateClass);
  118. string EffectDiscription()
  119. => "[On Deletion] You may place 1 Digimon card with the [Xros Heart]/[Blue Flare]/[Hero] trait from your hand or trash under any of your Tamers. Then,<Save>";
  120. bool CanUseCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  123. }
  124. bool CanActivateCondition(Hashtable hashtable)
  125. {
  126. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  127. }
  128. bool CanSelectTamerCondition(Permanent permanent)
  129. {
  130. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  131. && permanent.IsTamer;
  132. }
  133. bool CanSelectCardCondition(CardSource cardSource)
  134. {
  135. if (cardSource.IsDigimon)
  136. {
  137. if (cardSource.EqualsTraits("Xros Heart") || cardSource.EqualsTraits("Blue Flare") || cardSource.EqualsTraits("Hero"))
  138. {
  139. return true;
  140. }
  141. }
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable hashtable)
  145. {
  146. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectTamerCondition))
  147. {
  148. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition) || CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  149. {
  150. SelectCardEffect.Root? rootmode = null!;
  151. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  152. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  153. if (canSelectHand && !canSelectTrash) rootmode = SelectCardEffect.Root.Hand;
  154. if (!canSelectHand && canSelectTrash) rootmode = SelectCardEffect.Root.Trash;
  155. if (canSelectHand && canSelectTrash)
  156. {
  157. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  158. {
  159. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  160. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  161. };
  162. string selectPlayerMessage = "From which area do you select a card?";
  163. string notSelectPlayerMessage = "The opponent is choosing from which area to select a card.";
  164. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  165. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  166. rootmode = GManager.instance.userSelectionManager.SelectedBoolValue ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash;
  167. }
  168. if (rootmode != null)
  169. {
  170. CardSource selectedCard = null;
  171. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  172. selectCardEffect.SetUp(
  173. canTargetCondition: CanSelectCardCondition,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. canNoSelect: () => true,
  177. selectCardCoroutine: SelectCardCoroutine,
  178. afterSelectCardCoroutine: null,
  179. message: "Select 1 card to add as source.",
  180. maxCount: 1,
  181. canEndNotMax: false,
  182. isShowOpponent: true,
  183. mode: SelectCardEffect.Mode.Custom,
  184. root: (SelectCardEffect.Root)rootmode!,
  185. customRootCardList: null,
  186. canLookReverseCard: true,
  187. selectPlayer: card.Owner,
  188. cardEffect: activateClass);
  189. selectCardEffect.SetUpCustomMessage("Select 1 card to add as source.", "The opponent is selecting 1 card to add as source.");
  190. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  191. IEnumerator SelectCardCoroutine(CardSource cardSource)
  192. {
  193. selectedCard = cardSource;
  194. yield return null;
  195. }
  196. if (selectedCard != null)
  197. {
  198. Permanent selectedPermanent = null;
  199. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectTamerCondition));
  200. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  201. selectPermanentEffect.SetUp(
  202. selectPlayer: card.Owner,
  203. canTargetCondition: CanSelectTamerCondition,
  204. canTargetCondition_ByPreSelecetedList: null,
  205. canEndSelectCondition: null,
  206. maxCount: maxCount,
  207. canNoSelect: false,
  208. canEndNotMax: false,
  209. selectPermanentCoroutine: SelectPermanentCoroutine,
  210. afterSelectPermanentCoroutine: null,
  211. mode: SelectPermanentEffect.Mode.Custom,
  212. cardEffect: activateClass);
  213. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  214. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  215. {
  216. selectedPermanent = permanent;
  217. yield return null;
  218. }
  219. if (selectedPermanent != null)
  220. {
  221. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  222. }
  223. }
  224. }
  225. if (CardEffectCommons.CanActivateSave(hashtable, CanSelectTamerCondition))
  226. {
  227. yield return ContinuousController.instance.StartCoroutine(
  228. CardEffectCommons.SaveProcess(hashtable, activateClass, card, CanSelectTamerCondition));
  229. }
  230. }
  231. }
  232. }
  233. }
  234. #endregion
  235. #region ESS
  236. if (timing == EffectTiming.None)
  237. {
  238. bool Condition()
  239. {
  240. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  241. {
  242. if (CardEffectCommons.IsOwnerTurn(card))
  243. {
  244. return true;
  245. }
  246. }
  247. return false;
  248. }
  249. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  250. }
  251. #endregion
  252. return cardEffects;
  253. }
  254. }
  255. }