BT14_097.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_097 : 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.None)
  12. {
  13. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  14. changeCardNamesClass.SetUpICardEffect("Also treated as having [Sukamon] in its name", CanUseCondition, card);
  15. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  16. cardEffects.Add(changeCardNamesClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. return true;
  20. }
  21. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  22. {
  23. if (cardSource == card)
  24. {
  25. CardNames.Add("Sukamon_BT14_097");
  26. }
  27. return CardNames;
  28. }
  29. }
  30. if (timing == EffectTiming.OptionSkill)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  34. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[Main] 1 of your non-white Digimon may digivolve into a Digimon card with [Sukamon] in its name in your hand without paying the cost, ignoring its digivolution requirements.";
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  43. {
  44. if (!permanent.TopCard.CardColors.Contains(CardColor.White))
  45. {
  46. foreach (CardSource cardSource in card.Owner.HandCards)
  47. {
  48. if (CanSelectCardCondition(cardSource))
  49. {
  50. if (!cardSource.CanNotEvolve(permanent))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanSelectCardCondition(CardSource cardSource)
  61. {
  62. return cardSource.IsDigimon && cardSource.ContainsCardName("Sukamon");
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. Permanent selectedPermanent = null;
  73. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: true,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "The opponent is selecting 1 Digimon to digivolve.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. selectedPermanent = permanent;
  92. yield return null;
  93. }
  94. if (selectedPermanent != null)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  97. targetPermanent: selectedPermanent,
  98. cardCondition: CanSelectCardCondition,
  99. payCost: false,
  100. reduceCostTuple: null,
  101. fixedCostTuple: null,
  102. ignoreDigivolutionRequirementFixedCost: 0,
  103. isHand: true,
  104. activateClass: activateClass,
  105. successProcess: null));
  106. }
  107. }
  108. }
  109. }
  110. if (timing == EffectTiming.SecuritySkill)
  111. {
  112. ActivateClass activateClass = new ActivateClass();
  113. activateClass.SetUpICardEffect($"Opponent's 1 Digimon becomes [Sukamon]", CanUseCondition, card);
  114. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  115. activateClass.SetIsSecurityEffect(true);
  116. cardEffects.Add(activateClass);
  117. string EffectDiscription()
  118. {
  119. return "[Security] Until the end of your turn, change 1 of your opponent's Digimon into being white and having 3000 DP and an original name of [Sukamon].";
  120. }
  121. bool CanSelectPermanentCondition(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  132. {
  133. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  134. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  135. selectPermanentEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: CanSelectPermanentCondition,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: maxCount,
  141. canNoSelect: false,
  142. canEndNotMax: false,
  143. selectPermanentCoroutine: SelectPermanentCoroutine,
  144. afterSelectPermanentCoroutine: null,
  145. mode: SelectPermanentEffect.Mode.Custom,
  146. cardEffect: activateClass);
  147. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. Permanent selectedPermanent = permanent;
  152. if (selectedPermanent != null)
  153. {
  154. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeBaseDigimonDP(
  155. targetPermanent: permanent,
  156. changeValue: 3000,
  157. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  158. activateClass: activateClass));
  159. }
  160. if (selectedPermanent != null)
  161. {
  162. ChangeBaseCardNameClass changeBaseCardNameClass = new ChangeBaseCardNameClass();
  163. changeBaseCardNameClass.SetUpICardEffect("Original card name is [Sukamon]", CanUseCondition1, card);
  164. changeBaseCardNameClass.SetUpChangeBaseCardNamesClass(changeBaseCardNames: changeBaseCardNames);
  165. CardEffectCommons.AddEffectToPermanent(
  166. targetPermanent: selectedPermanent,
  167. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  168. card: card,
  169. cardEffect: changeBaseCardNameClass,
  170. timing: EffectTiming.None
  171. );
  172. bool CanUseCondition1(Hashtable hashtable)
  173. {
  174. if (selectedPermanent.TopCard != null)
  175. {
  176. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  177. {
  178. return true;
  179. }
  180. }
  181. return false;
  182. }
  183. List<string> changeBaseCardNames(CardSource cardSource, List<string> CardNames)
  184. {
  185. if (cardSource == selectedPermanent.TopCard)
  186. {
  187. CardNames = new List<string>() { "Sukamon" };
  188. }
  189. return CardNames;
  190. }
  191. }
  192. if (selectedPermanent != null)
  193. {
  194. ChangeBaseCardColorClass changeBaseCardColorClass = new ChangeBaseCardColorClass();
  195. changeBaseCardColorClass.SetUpICardEffect("Original card color is white", CanUseCondition1, card);
  196. changeBaseCardColorClass.SetUpChangeBaseCardColorClass(ChangeBaseCardColors: ChangeBaseCardColors);
  197. CardEffectCommons.AddEffectToPermanent(
  198. targetPermanent: selectedPermanent,
  199. effectDuration: EffectDuration.UntilOwnerTurnEnd,
  200. card: card,
  201. cardEffect: changeBaseCardColorClass,
  202. timing: EffectTiming.None
  203. );
  204. bool CanUseCondition1(Hashtable hashtable)
  205. {
  206. if (selectedPermanent.TopCard != null)
  207. {
  208. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  209. {
  210. return true;
  211. }
  212. }
  213. return false;
  214. }
  215. List<CardColor> ChangeBaseCardColors(CardSource cardSource, List<CardColor> CardColors)
  216. {
  217. if (cardSource == selectedPermanent.TopCard)
  218. {
  219. CardColors = new List<CardColor>() { CardColor.White };
  220. }
  221. return CardColors;
  222. }
  223. }
  224. }
  225. }
  226. }
  227. }
  228. return cardEffects;
  229. }
  230. }
  231. }