BT9_014.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT9_014 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("WarGrowlmon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Opponent Digimon get effect and delete Digimon whose total DP adds up to 6000 or less", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] Until the end of your opponent's turn, 2 of their Digimon gain \"[On Deletion] Lose 1 memory.\" Then, if [WarGrowlmon] or [X Antibody] is in this Digimon's digivolution cards, you may choose any number of your opponent's Digimon whose total DP adds up to 6000 or less and delete them.";
  30. }
  31. bool CanSelectPermanentCondition(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  34. {
  35. if (permanent.CanSelectBySkill(activateClass))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanSelectPermanentCondition1(Permanent permanent)
  43. {
  44. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  45. {
  46. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  56. }
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleArea(card))
  60. {
  61. return true;
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. if (isExistOnField(card))
  68. {
  69. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  70. {
  71. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  72. {
  73. int maxCount = Math.Min(2, 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: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select Digimon to get effects.", "The opponent is selecting Digimon to get effects.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. Permanent selectedPermanent = permanent;
  92. if (selectedPermanent != null)
  93. {
  94. CardSource _topCard = selectedPermanent.TopCard;
  95. ActivateClass activateClass1 = new ActivateClass();
  96. activateClass1.SetUpICardEffect("Memory -1", CanUseCondition1, selectedPermanent.TopCard);
  97. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  98. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  99. CardEffectCommons.AddEffectToPermanent(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnDestroyedAnyone);
  100. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  103. }
  104. string EffectDiscription1()
  105. {
  106. return "[On Deletion] Lose 1 memory.";
  107. }
  108. bool CanUseCondition1(Hashtable hashtable1)
  109. {
  110. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  111. {
  112. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable1, (permanent) => permanent == selectedPermanent, activateClass))
  113. {
  114. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  115. {
  116. return true;
  117. }
  118. }
  119. }
  120. return false;
  121. }
  122. bool CanActivateCondition1(Hashtable hashtable1)
  123. {
  124. if (CardEffectCommons.IsTopCardInTrashOnDeletion(hashtable1))
  125. {
  126. return true;
  127. }
  128. return false;
  129. }
  130. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  131. {
  132. yield return ContinuousController.instance.StartCoroutine(_topCard.Owner.AddMemory(-1, activateClass1));
  133. }
  134. }
  135. }
  136. }
  137. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("WarGrowlmon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  138. {
  139. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  140. {
  141. int maxCount = Math.Min(card.Owner.Enemy.GetBattleAreaDigimons().Count(CanSelectPermanentCondition1), CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  142. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  143. selectPermanentEffect.SetUp(
  144. selectPlayer: card.Owner,
  145. canTargetCondition: CanSelectPermanentCondition1,
  146. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  147. canEndSelectCondition: CanEndSelectCondition,
  148. maxCount: maxCount,
  149. canNoSelect: true,
  150. canEndNotMax: true,
  151. selectPermanentCoroutine: null,
  152. afterSelectPermanentCoroutine: null,
  153. mode: SelectPermanentEffect.Mode.Destroy,
  154. cardEffect: activateClass);
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. bool CanEndSelectCondition(List<Permanent> permanents)
  157. {
  158. if (maxCount >= 1)
  159. {
  160. if (permanents.Count <= 0)
  161. {
  162. return false;
  163. }
  164. }
  165. int sumDP = 0;
  166. foreach (Permanent permanent1 in permanents)
  167. {
  168. sumDP += permanent1.DP;
  169. }
  170. if (sumDP > card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  171. {
  172. return false;
  173. }
  174. return true;
  175. }
  176. bool CanTargetCondition_ByPreSelecetedList(List<Permanent> permanents, Permanent permanent)
  177. {
  178. int sumDP = 0;
  179. foreach (Permanent permanent1 in permanents)
  180. {
  181. sumDP += permanent1.DP;
  182. }
  183. sumDP += permanent.DP;
  184. if (sumDP > card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  185. {
  186. return false;
  187. }
  188. return true;
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. return cardEffects;
  197. }
  198. }