BT11_019.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_019 : 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.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  16. {
  17. cardEffects.Add(CardEffectFactory.MaterialSaveEffect(card: card, materialSaveCount: 4));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. int maxDP()
  22. {
  23. if (CardEffectCommons.IsExistOnBattleArea(card))
  24. {
  25. return card.PermanentOfThisCard().DP;
  26. }
  27. return 0;
  28. }
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect($"Delete 1 Digimon with {maxDP()} DP or less", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "[On Play] Delete 1 of your opponent's Digimon with DP less than or equal to this Digimon's DP.";
  36. }
  37. bool CanSelectPermanentCondition(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  40. {
  41. if (permanent.DP <= maxDP())
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  66. {
  67. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  68. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  69. selectPermanentEffect.SetUp(
  70. selectPlayer: card.Owner,
  71. canTargetCondition: CanSelectPermanentCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. maxCount: maxCount,
  75. canNoSelect: false,
  76. canEndNotMax: false,
  77. selectPermanentCoroutine: null,
  78. afterSelectPermanentCoroutine: null,
  79. mode: SelectPermanentEffect.Mode.Destroy,
  80. cardEffect: activateClass);
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. }
  83. }
  84. }
  85. if (timing == EffectTiming.None)
  86. {
  87. int count()
  88. {
  89. if (CardEffectCommons.IsExistOnBattleArea(card))
  90. {
  91. return card.PermanentOfThisCard().DigivolutionCards.Count / 2;
  92. }
  93. return 0;
  94. }
  95. bool Condition()
  96. {
  97. if (count() >= 1)
  98. {
  99. return true;
  100. }
  101. return false;
  102. }
  103. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(changeValue: () => 1000 * count(), isInheritedEffect: false, card: card, condition: Condition));
  104. }
  105. if (timing == EffectTiming.None)
  106. {
  107. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  108. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  109. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  110. addDigiXrosConditionClass.SetNotShowUI(true);
  111. cardEffects.Add(addDigiXrosConditionClass);
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. return true;
  115. }
  116. DigiXrosCondition GetDigiXros(CardSource cardSource)
  117. {
  118. if (cardSource == card)
  119. {
  120. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "OmniShoutmon");
  121. bool CanSelectCardCondition(CardSource cardSource)
  122. {
  123. if (cardSource != null)
  124. {
  125. if (cardSource.Owner == card.Owner)
  126. {
  127. if (cardSource.IsDigimon)
  128. {
  129. if (cardSource.CardNames_DigiXros.Contains("OmniShoutmon"))
  130. {
  131. return true;
  132. }
  133. }
  134. }
  135. }
  136. return false;
  137. }
  138. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "ZeigGreymon");
  139. bool CanSelectCardCondition1(CardSource cardSource)
  140. {
  141. if (cardSource != null)
  142. {
  143. if (cardSource.Owner == card.Owner)
  144. {
  145. if (cardSource.IsDigimon)
  146. {
  147. if (cardSource.CardNames_DigiXros.Contains("ZeigGreymon"))
  148. {
  149. return true;
  150. }
  151. }
  152. }
  153. }
  154. return false;
  155. }
  156. DigiXrosConditionElement element2 = new DigiXrosConditionElement(CanSelectCardCondition2, "Ballistamon");
  157. bool CanSelectCardCondition2(CardSource cardSource)
  158. {
  159. if (cardSource != null)
  160. {
  161. if (cardSource.Owner == card.Owner)
  162. {
  163. if (cardSource.IsDigimon)
  164. {
  165. if (cardSource.CardNames_DigiXros.Contains("Ballistamon"))
  166. {
  167. return true;
  168. }
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. DigiXrosConditionElement element3 = new DigiXrosConditionElement(CanSelectCardCondition3, "Dorulumon");
  175. bool CanSelectCardCondition3(CardSource cardSource)
  176. {
  177. if (cardSource != null)
  178. {
  179. if (cardSource.Owner == card.Owner)
  180. {
  181. if (cardSource.IsDigimon)
  182. {
  183. if (cardSource.CardNames_DigiXros.Contains("Dorulumon"))
  184. {
  185. return true;
  186. }
  187. }
  188. }
  189. }
  190. return false;
  191. }
  192. DigiXrosConditionElement element4 = new DigiXrosConditionElement(CanSelectCardCondition4, "Starmons");
  193. bool CanSelectCardCondition4(CardSource cardSource)
  194. {
  195. if (cardSource != null)
  196. {
  197. if (cardSource.Owner == card.Owner)
  198. {
  199. if (cardSource.IsDigimon)
  200. {
  201. if (cardSource.CardNames_DigiXros.Contains("Starmons"))
  202. {
  203. return true;
  204. }
  205. }
  206. }
  207. }
  208. return false;
  209. }
  210. DigiXrosConditionElement element5 = new DigiXrosConditionElement(CanSelectCardCondition5, "Sparrowmon");
  211. bool CanSelectCardCondition5(CardSource cardSource)
  212. {
  213. if (cardSource != null)
  214. {
  215. if (cardSource.Owner == card.Owner)
  216. {
  217. if (cardSource.IsDigimon)
  218. {
  219. if (cardSource.CardNames_DigiXros.Contains("Sparrowmon"))
  220. {
  221. return true;
  222. }
  223. }
  224. }
  225. }
  226. return false;
  227. }
  228. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1, element2, element3, element4, element5 };
  229. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  230. return digiXrosCondition;
  231. }
  232. return null;
  233. }
  234. }
  235. return cardEffects;
  236. }
  237. }
  238. }