BT11_018.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_018 : 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 [OmniShoutmon]/[ZeigGreymon]", 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("OmniShoutmon");
  26. CardNames.Add("ZeigGreymon");
  27. }
  28. return CardNames;
  29. }
  30. }
  31. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  32. {
  33. cardEffects.Add(CardEffectFactory.MaterialSaveEffect(card: card, materialSaveCount: 2));
  34. }
  35. if (timing == EffectTiming.OnEnterFieldAnyone)
  36. {
  37. ActivateClass activateClass = new ActivateClass();
  38. activateClass.SetUpICardEffect("Delete 1 Digimon with 8000 DP or less and opponent's 1 Digimon can't Attack", CanUseCondition, card);
  39. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  40. cardEffects.Add(activateClass);
  41. string EffectDiscription()
  42. {
  43. return "[On Play] Delete 1 of your opponent's Digimon with 8000 DP or less. 1 of your opponent's Digimon can't attack until the end of their turn.";
  44. }
  45. bool CanSelectPermanentCondition(Permanent permanent)
  46. {
  47. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  48. {
  49. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanSelectPermanentCondition1(Permanent permanent)
  57. {
  58. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  59. }
  60. bool CanUseCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. return true;
  71. }
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  73. {
  74. return true;
  75. }
  76. }
  77. return false;
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  80. {
  81. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  82. {
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  84. {
  85. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectPermanentCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: null,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Destroy,
  98. cardEffect: activateClass);
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. }
  101. }
  102. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  103. {
  104. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  105. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  106. selectPermanentEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectPermanentCondition1,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. maxCount: maxCount,
  112. canNoSelect: false,
  113. canEndNotMax: false,
  114. selectPermanentCoroutine: SelectPermanentCoroutine,
  115. afterSelectPermanentCoroutine: null,
  116. mode: SelectPermanentEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectPermanentEffect.SetUpCustomMessage(
  119. "Select 1 Digimon that will get effects.",
  120. "The opponent is selecting 1 Digimon that will get effects.");
  121. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  122. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  125. targetPermanent: permanent,
  126. defenderCondition: null,
  127. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  128. activateClass: activateClass,
  129. effectName: "Can't Attack"));
  130. }
  131. }
  132. }
  133. }
  134. if (timing == EffectTiming.OnEndAttack)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("Delete this Digimon to gain Memory +1", CanUseCondition, card);
  138. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  139. cardEffects.Add(activateClass);
  140. string EffectDiscription()
  141. {
  142. return "[End of Attack] By deleting this Digimon, gain 1 memory.";
  143. }
  144. bool CanUseCondition(Hashtable hashtable)
  145. {
  146. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  147. }
  148. bool CanActivateCondition(Hashtable hashtable)
  149. {
  150. if (CardEffectCommons.IsExistOnBattleArea(card))
  151. {
  152. if (card.PermanentOfThisCard().CanBeDestroyedBySkill(activateClass))
  153. {
  154. return true;
  155. }
  156. }
  157. return false;
  158. }
  159. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  160. {
  161. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  162. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  163. activateClass: activateClass,
  164. successProcess: permanents => SuccessProcess(),
  165. failureProcess: null));
  166. IEnumerator SuccessProcess()
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  169. }
  170. }
  171. }
  172. if (timing == EffectTiming.None)
  173. {
  174. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  175. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  176. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  177. addDigiXrosConditionClass.SetNotShowUI(true);
  178. cardEffects.Add(addDigiXrosConditionClass);
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. return true;
  182. }
  183. DigiXrosCondition GetDigiXros(CardSource cardSource)
  184. {
  185. if (cardSource == card)
  186. {
  187. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "OmniShoutmon");
  188. bool CanSelectCardCondition(CardSource cardSource)
  189. {
  190. if (cardSource != null)
  191. {
  192. if (cardSource.Owner == card.Owner)
  193. {
  194. if (cardSource.IsDigimon)
  195. {
  196. if (cardSource.CardNames_DigiXros.Contains("OmniShoutmon"))
  197. {
  198. return true;
  199. }
  200. }
  201. }
  202. }
  203. return false;
  204. }
  205. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "ZeigGreymon");
  206. bool CanSelectCardCondition1(CardSource cardSource)
  207. {
  208. if (cardSource != null)
  209. {
  210. if (cardSource.Owner == card.Owner)
  211. {
  212. if (cardSource.IsDigimon)
  213. {
  214. if (cardSource.CardNames_DigiXros.Contains("ZeigGreymon"))
  215. {
  216. return true;
  217. }
  218. }
  219. }
  220. }
  221. return false;
  222. }
  223. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1 };
  224. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 3);
  225. return digiXrosCondition;
  226. }
  227. return null;
  228. }
  229. }
  230. return cardEffects;
  231. }
  232. }
  233. }