BT21_059.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. //Timemon
  7. public class BT21_059 : 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. return targetPermanent.TopCard.EqualsTraits("Stnd.");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Link Condition
  23. if (timing == EffectTiming.None)
  24. {
  25. static bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.TopCard.HasAppmonTraits;
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  30. }
  31. #endregion
  32. #region App Fusion (Globemon & Charismon)
  33. if (timing == EffectTiming.None)
  34. {
  35. cardEffects.Add(CardEffectFactory.AddAppfuseMethodByName(new List<string>() { "Watchmon", "Savemon", "Calendamon" }, card));
  36. }
  37. #endregion
  38. #region App Fusion
  39. /*if (timing == EffectTiming.None)
  40. {
  41. AddAppFusionConditionClass addAppFusionConditionClass = new AddAppFusionConditionClass();
  42. addAppFusionConditionClass.SetUpICardEffect($"App Fusion", CanUseCondition, card);
  43. addAppFusionConditionClass.SetUpAddAppFusionConditionClass(getAppFusionCondition: GetAppFusion);
  44. addAppFusionConditionClass.SetNotShowUI(true);
  45. cardEffects.Add(addAppFusionConditionClass);
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return true;
  49. }
  50. AppFusionCondition GetAppFusion(CardSource cardSource)
  51. {
  52. if (cardSource == card)
  53. {
  54. bool linkCondition(CardSource source)
  55. {
  56. return source != null;
  57. }
  58. bool digimonCondition(Permanent permanent)
  59. {
  60. return permanent != null &&
  61. permanent.TopCard != null &&
  62. permanent.TopCard.Owner == card.Owner &&
  63. permanent.TopCard.Owner.GetFieldPermanents().Contains(permanent) &&
  64. !card.CanNotEvolve(permanent) &&
  65. (permanent.TopCard.EqualsCardName("Watchmon") ||
  66. permanent.TopCard.EqualsCardName("Savemon") ||
  67. permanent.TopCard.EqualsCardName("Calendamon"));
  68. }
  69. AppFusionCondition AppFusionCondition = new AppFusionCondition(
  70. linkedCondition: linkCondition,
  71. selectLinkMessage: "1 Linked card",
  72. digimonCondition: digimonCondition,
  73. selectDigimonMessage: "1 of [Watchmon], [Savemon] and [Calendamon]",
  74. cost: 0);
  75. return AppFusionCondition;
  76. }
  77. return null;
  78. }
  79. }*/
  80. #endregion
  81. #region Blocker
  82. if (timing == EffectTiming.None)
  83. {
  84. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  85. isInheritedEffect: false,
  86. card: card,
  87. condition: null));
  88. }
  89. #endregion
  90. #region Your Turn
  91. if (timing == EffectTiming.WhenLinked)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("<De-Digivolve 1>", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[Your Turn] [Once Per Turn] When this Digimon gets linked, <De-Digivolve 1> 1 of your opponent's Digimon.";
  100. }
  101. bool PermanentCondition(Permanent permanent)
  102. {
  103. return permanent == card.PermanentOfThisCard();
  104. }
  105. bool CardCondition(CardSource source)
  106. {
  107. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  108. }
  109. bool IsOpponentsDigimon(Permanent permanent)
  110. {
  111. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  116. CardEffectCommons.IsOwnerTurn(card) &&
  117. CardEffectCommons.CanTriggerWhenLinked(hashtable, PermanentCondition, CardCondition);
  118. }
  119. bool CanActivateCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable hashtable)
  124. {
  125. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  126. {
  127. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  128. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  129. selectPermanentEffect.SetUp(
  130. selectPlayer: card.Owner,
  131. canTargetCondition: IsOpponentsDigimon,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. maxCount: maxCount,
  135. canNoSelect: false,
  136. canEndNotMax: false,
  137. selectPermanentCoroutine: SelectDeDigivolvePermanent,
  138. afterSelectPermanentCoroutine: null,
  139. mode: SelectPermanentEffect.Mode.Custom,
  140. cardEffect: activateClass);
  141. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  142. }
  143. IEnumerator SelectDeDigivolvePermanent(Permanent permanent)
  144. {
  145. if (permanent != null)
  146. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  147. }
  148. }
  149. }
  150. #endregion
  151. #region Link
  152. if (timing == EffectTiming.OnDeclaration)
  153. {
  154. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  155. }
  156. #endregion
  157. #region When Linking
  158. if (timing == EffectTiming.WhenLinked)
  159. {
  160. ActivateClass activateClass = new ActivateClass();
  161. activateClass.SetUpICardEffect("<De-Digivolve 1>", CanUseCondition, card);
  162. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  163. activateClass.SetIsLinkedEffect(true);
  164. cardEffects.Add(activateClass);
  165. string EffectDiscription()
  166. {
  167. return "[When Linking] <De-Digivolve 1> 1 of your opponent's Digimon.";
  168. }
  169. bool IsOpponentsDigimon(Permanent permanent)
  170. {
  171. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  172. }
  173. bool CanUseCondition(Hashtable hashtable)
  174. {
  175. return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  176. }
  177. bool CanActivateCondition(Hashtable hashtable)
  178. {
  179. return CardEffectCommons.IsExistOnBattleArea(card) &&
  180. CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon);
  181. }
  182. IEnumerator ActivateCoroutine(Hashtable hashtable)
  183. {
  184. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  185. {
  186. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  187. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  188. selectPermanentEffect.SetUp(
  189. selectPlayer: card.Owner,
  190. canTargetCondition: IsOpponentsDigimon,
  191. canTargetCondition_ByPreSelecetedList: null,
  192. canEndSelectCondition: null,
  193. maxCount: maxCount,
  194. canNoSelect: false,
  195. canEndNotMax: false,
  196. selectPermanentCoroutine: SelectDeDigivolvePermanent,
  197. afterSelectPermanentCoroutine: null,
  198. mode: SelectPermanentEffect.Mode.Custom,
  199. cardEffect: activateClass);
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  201. }
  202. IEnumerator SelectDeDigivolvePermanent(Permanent permanent)
  203. {
  204. if (permanent != null)
  205. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  206. }
  207. }
  208. }
  209. #endregion
  210. return cardEffects;
  211. }
  212. }
  213. }