EX12_015.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Gokuumon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_015 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("Shambala");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 4));
  19. }
  20. #endregion
  21. #region Raid
  22. if (timing == EffectTiming.OnAllyAttack)
  23. {
  24. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region Shared OP / WD
  28. string SharedEffectName = "1 enemy Digimon gets -4000 DP until their turn ends, then 1 of your other [Shambala] Digimon may gain <Alliance> and attack.";
  29. CardEffectFactory.ActivateClassesForSharedEffects
  30. (ref cardEffects, timing, card,
  31. SharedEffectName,
  32. SharedActivateCoroutine,
  33. SharedEffectDescription,
  34. optional: false,
  35. onPlay: true,
  36. whenDigivolving: true);
  37. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon gets -4000 DP until their turn ends. Then, 1 of your other Digimon with the [Shambala] trait may gain <Alliance> for the turn and attack.";
  38. bool CanSelectEnemyPermanentCondition(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  41. }
  42. bool CanSelectOwnerPermanentCondition(Permanent permanent)
  43. {
  44. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  45. && permanent.TopCard.EqualsTraits("Shambala")
  46. && permanent != card.PermanentOfThisCard();
  47. }
  48. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  49. {
  50. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectEnemyPermanentCondition))
  51. {
  52. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectEnemyPermanentCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: 1,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: SelectPermanentCoroutine,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Custom,
  64. cardEffect: activateClass);
  65. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeDP(changeValue: -3000, maxCount: 1));
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  70. targetPermanent: permanent,
  71. changeValue: -4000,
  72. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  73. activateClass: activateClass));
  74. }
  75. }
  76. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  77. {
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectOwnerPermanentCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: 1,
  85. canNoSelect: true,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: SelectPermanentCoroutine,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Custom,
  90. cardEffect: activateClass);
  91. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain <Alliance> and attack", "The opponent is selecting 1 Digimon to gain <Alliance> and attack");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  94. {
  95. if (permanent != null)
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  98. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  99. selectAttackEffect.SetUp(
  100. attacker: permanent,
  101. canAttackPlayerCondition: () => true,
  102. defenderCondition: _ => true,
  103. cardEffect: activateClass);
  104. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  105. }
  106. }
  107. }
  108. }
  109. #endregion
  110. #region DigiXros
  111. if (timing == EffectTiming.None)
  112. {
  113. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  114. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -2", CanUseCondition, card);
  115. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  116. addDigiXrosConditionClass.SetNotShowUI(true);
  117. cardEffects.Add(addDigiXrosConditionClass);
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return true;
  121. }
  122. DigiXrosCondition GetDigiXros(CardSource cardSource)
  123. {
  124. if (cardSource == card)
  125. {
  126. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition,
  127. "1 Lv.5 or lower Digimon card w/[Gokuumon] in text or w/[SW] trait");
  128. bool CanSelectCardCondition(CardSource xrosCardSource)
  129. {
  130. return xrosCardSource != null
  131. && xrosCardSource.Owner == card.Owner
  132. && xrosCardSource.IsDigimon
  133. && xrosCardSource.HasLevel
  134. && xrosCardSource.Level <= 5
  135. && (xrosCardSource.HasText("Gokuumon")
  136. || xrosCardSource.EqualsTraits("SW"));
  137. }
  138. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  139. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  140. return digiXrosCondition;
  141. }
  142. return null;
  143. }
  144. }
  145. #endregion
  146. #region Inherited
  147. if (timing == EffectTiming.OnAllyAttack)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("Delete 1 enemy Digimon with 6000 DP or less", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  152. activateClass.SetHashString("EX12_015_Inherited");
  153. activateClass.SetIsInheritedEffect(true);
  154. activateClass.SetIsSkippable(true);
  155. cardEffects.Add(activateClass);
  156. string EffectDescription()
  157. {
  158. return "[When Attacking][Once Per Turn] You may delete 1 of your opponent's Digimon with 6000 DP or less.";
  159. }
  160. bool CanSelectPermanentCondition(Permanent permanent)
  161. {
  162. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  163. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass);
  164. }
  165. bool CanUseCondition(Hashtable hashtable)
  166. {
  167. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  168. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  169. }
  170. bool CanActivateCondition(Hashtable hashtable)
  171. {
  172. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  173. && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  174. }
  175. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  176. {
  177. bool Used = false;
  178. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  179. selectPermanentEffect.SetUp(
  180. selectPlayer: card.Owner,
  181. canTargetCondition: CanSelectPermanentCondition,
  182. canTargetCondition_ByPreSelecetedList: null,
  183. canEndSelectCondition: null,
  184. maxCount: 1,
  185. canNoSelect: true,
  186. canEndNotMax: false,
  187. selectPermanentCoroutine: null,
  188. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  189. mode: SelectPermanentEffect.Mode.Destroy,
  190. cardEffect: activateClass);
  191. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  192. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  193. {
  194. if (permanents.Count > 0)
  195. {
  196. Used = true;
  197. yield return null;
  198. }
  199. }
  200. if (!Used)
  201. {
  202. activateClass.RemoveUse();
  203. }
  204. }
  205. }
  206. #endregion
  207. return cardEffects;
  208. }
  209. }
  210. }