BT15_060.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_060 : 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. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.None)
  16. {
  17. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  18. changeCardNamesClass.SetUpICardEffect("Also treated as [Omnimon] when revealed from the top of the deck.", CanUseCondition, card);
  19. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: ChangeCardNames);
  20. cardEffects.Add(changeCardNamesClass);
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. if (card.IsBeingRevealed)
  24. {
  25. return true;
  26. }
  27. return false;
  28. }
  29. List<string> ChangeCardNames(CardSource cardSource, List<string> CardNames)
  30. {
  31. if (cardSource == card)
  32. {
  33. CardNames.Add("Omnimon");
  34. }
  35. return CardNames;
  36. }
  37. }
  38. if (timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("One of your other Digimon may digivolve into a black Digimon with [Greymon] or [Garurumon] in it's name from your hand.", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  43. cardEffects.Add(activateClass);
  44. string EffectDiscription()
  45. {
  46. return "[On Play] If it's your turn, 1 of your other Digimon may digivolve into a black Digimon with [Greymon] or [Garurumon] in it's name in your hand with the digivolution cost reduced by 2.";
  47. }
  48. bool CanSelectPermanentCondition(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsOwnerTurn(card))
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent != card.PermanentOfThisCard())
  55. {
  56. foreach (CardSource cardSource in card.Owner.HandCards)
  57. {
  58. if (CanSelectCardCondition(cardSource))
  59. {
  60. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  61. {
  62. return true;
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. return false;
  70. }
  71. bool CanSelectCardCondition(CardSource cardSource)
  72. {
  73. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.HasCardColor(CardColor.Black) && (cardSource.HasGreymonName || cardSource.HasGarurumonName);
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  84. {
  85. if (card.Owner.HandCards.Count >= 1)
  86. {
  87. return true;
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  94. {
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. Permanent selectedPermanent = null;
  98. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  99. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  100. selectPermanentEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectPermanentCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: maxCount,
  106. canNoSelect: true,
  107. canEndNotMax: false,
  108. selectPermanentCoroutine: SelectPermanentCoroutine,
  109. afterSelectPermanentCoroutine: null,
  110. mode: SelectPermanentEffect.Mode.Custom,
  111. cardEffect: activateClass);
  112. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  113. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  114. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  115. {
  116. selectedPermanent = permanent;
  117. yield return null;
  118. }
  119. if (selectedPermanent != null)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  122. targetPermanent: selectedPermanent,
  123. cardCondition: CanSelectCardCondition,
  124. payCost: true,
  125. reduceCostTuple: (reduceCost: 2, reduceCostCardCondition: null),
  126. fixedCostTuple: null,
  127. ignoreDigivolutionRequirementFixedCost: -1,
  128. isHand: true,
  129. activateClass: activateClass,
  130. successProcess: null));
  131. }
  132. }
  133. }
  134. }
  135. if (timing == EffectTiming.OnAllyAttack)
  136. {
  137. ActivateClass activateClass = new ActivateClass();
  138. activateClass.SetUpICardEffect("De-Digivolve 1 on 1 Digimon", CanUseCondition, card);
  139. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  140. activateClass.SetIsInheritedEffect(true);
  141. activateClass.SetHashString("DeDigi_BT15_060");
  142. cardEffects.Add(activateClass);
  143. string EffectDiscription()
  144. {
  145. return "[When Attacking][Once Per Turn][De-Digivolve] 1 of your opponent's Digimon (Trash up to 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards).";
  146. }
  147. bool CanSelectPermanentCondition(Permanent permanent)
  148. {
  149. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  150. }
  151. bool CanUseCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  154. }
  155. bool CanActivateCondition(Hashtable hashtable)
  156. {
  157. if (CardEffectCommons.IsExistOnBattleArea(card))
  158. {
  159. return true;
  160. }
  161. return false;
  162. }
  163. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  164. {
  165. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  166. {
  167. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  168. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  169. selectPermanentEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: CanSelectPermanentCondition,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: maxCount,
  175. canNoSelect: false,
  176. canEndNotMax: false,
  177. selectPermanentCoroutine: SelectPermanentCoroutine,
  178. afterSelectPermanentCoroutine: null,
  179. mode: SelectPermanentEffect.Mode.Custom,
  180. cardEffect: activateClass);
  181. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  182. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  183. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  184. {
  185. Permanent selectedPermanent = permanent;
  186. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  187. }
  188. }
  189. }
  190. }
  191. if (timing == EffectTiming.None)
  192. {
  193. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  194. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  195. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  196. addDigiXrosConditionClass.SetNotShowUI(true);
  197. cardEffects.Add(addDigiXrosConditionClass);
  198. bool CanUseCondition(Hashtable hashtable)
  199. {
  200. return true;
  201. }
  202. DigiXrosCondition GetDigiXros(CardSource cardSource)
  203. {
  204. if (cardSource == card)
  205. {
  206. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Agumon or Greymon");
  207. bool CanSelectCardCondition(CardSource cardSource)
  208. {
  209. if (cardSource != null)
  210. {
  211. if (cardSource.Owner == card.Owner)
  212. {
  213. if (cardSource.IsDigimon)
  214. {
  215. if (cardSource.CardNames_DigiXros.Contains("Agumon") || cardSource.CardNames.Contains("Greymon"))
  216. {
  217. return true;
  218. }
  219. }
  220. }
  221. }
  222. return false;
  223. }
  224. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "Gabumon or Garurumon");
  225. bool CanSelectCardCondition1(CardSource cardSource)
  226. {
  227. if (cardSource != null)
  228. {
  229. if (cardSource.Owner == card.Owner)
  230. {
  231. if (cardSource.IsDigimon)
  232. {
  233. if (cardSource.CardNames_DigiXros.Contains("Gabumon") || cardSource.CardNames_DigiXros.Contains("Garurumon"))
  234. {
  235. return true;
  236. }
  237. }
  238. }
  239. }
  240. return false;
  241. }
  242. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1 };
  243. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 1);
  244. return digiXrosCondition;
  245. }
  246. return null;
  247. }
  248. }
  249. return cardEffects;
  250. }
  251. }
  252. }