EX12_037.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Omnimon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_037 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("ME")
  17. || targetPermanent.TopCard.EqualsTraits("VB");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 5,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null,
  25. level: 6)
  26. );
  27. }
  28. #endregion
  29. #region DNA Digivolution
  30. if (timing == EffectTiming.None)
  31. {
  32. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  33. addJogressConditionClass.SetUpICardEffect("DNA Digivolution", CanUseCondition, card);
  34. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  35. addJogressConditionClass.SetNotShowUI(true);
  36. cardEffects.Add(addJogressConditionClass);
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return true;
  40. }
  41. JogressCondition GetJogress(CardSource cardSource)
  42. {
  43. if (cardSource == card)
  44. {
  45. bool PermanentCondition1(Permanent permanent)
  46. {
  47. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  48. && (permanent.TopCard.CardColors.Contains(CardColor.Blue)
  49. || permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  50. && permanent.Levels_ForJogress(card).Contains(6);
  51. }
  52. bool PermanentCondition2(Permanent permanent)
  53. {
  54. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  55. && (permanent.TopCard.CardColors.Contains(CardColor.Red)
  56. || permanent.TopCard.CardColors.Contains(CardColor.Black))
  57. && permanent.Levels_ForJogress(card).Contains(6);
  58. }
  59. JogressConditionElement[] elements = new JogressConditionElement[]
  60. {
  61. new JogressConditionElement(PermanentCondition1, "a level 6 Blue or Yellow Digimon"),
  62. new JogressConditionElement(PermanentCondition2, "a level 6 Red or Black Digimon"),
  63. };
  64. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  65. return jogressCondition;
  66. }
  67. return null;
  68. }
  69. }
  70. #endregion
  71. #region Piercing
  72. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  73. {
  74. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  75. }
  76. #endregion
  77. #region Blocker
  78. if (timing == EffectTiming.None)
  79. {
  80. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  81. }
  82. #endregion
  83. #region Barrier
  84. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  85. {
  86. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: false, card: card, condition: null));
  87. }
  88. #endregion
  89. #region Shared WD/WA
  90. string SharedEffectName = "Delete 1 enemy digimon, then per 5 sources -13K DP 1 enemy Digimon or trash 1 security and <Recovery +1>";
  91. string SharedEffectHash = "EX12_037_WD_WA";
  92. CardEffectFactory.ActivateClassesForSharedEffects
  93. (ref cardEffects, timing, card,
  94. SharedEffectName,
  95. SharedActivateCoroutine,
  96. SharedEffectDescription,
  97. optional: false,
  98. maxCountPerTurn: 1,
  99. hashValue: SharedEffectHash,
  100. whenDigivolving: true,
  101. whenAttacking: true);
  102. string SharedEffectDescription(string tag)
  103. {
  104. return $"[{tag}] [Once Per Turn] Delete 1 of your opponent's Digimon. Then, for every 5 of this Digimon's digivolution cards, activate 1 of the effects below:\r\n• 1 of your opponent's Digimon gets -13000 DP until their turn ends.\r\n• Trash your opponent's top security card. Then, <Recovery +1>.";
  105. }
  106. bool CanSelectPermanentCondition(Permanent permanent)
  107. {
  108. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  109. }
  110. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  111. {
  112. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  113. {
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: 1,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: null,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Destroy,
  126. cardEffect: activateClass);
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. }
  129. int sourceLoops = card.PermanentOfThisCard().DigivolutionCards.Count / 5;
  130. while (sourceLoops > 0)
  131. {
  132. string selectPlayerMessage = "Which effect will you use?";
  133. string notSelectPlayerMessage = "The opponent is choosing which effect to use.";
  134. List<SelectionElement<bool>> command_SelectCommands = new List<SelectionElement<bool>>()
  135. {
  136. new SelectionElement<bool>(message: $"DP - 13K", value: true, spriteIndex: 0),
  137. new SelectionElement<bool>(message: $"Trash security", value: false, spriteIndex: 0),
  138. };
  139. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: command_SelectCommands, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  140. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  141. bool DPMinus = GManager.instance.userSelectionManager.SelectedBoolValue;
  142. if (DPMinus)
  143. {
  144. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  145. {
  146. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  147. selectPermanentEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: CanSelectPermanentCondition,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: 1,
  153. canNoSelect: false,
  154. canEndNotMax: false,
  155. selectPermanentCoroutine: SelectPermanentCoroutine,
  156. afterSelectPermanentCoroutine: null,
  157. mode: SelectPermanentEffect.Mode.Custom,
  158. cardEffect: activateClass);
  159. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will get DP -13000.", $"The opponent is selecting 1 Digimon that will get DP -13000.");
  160. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  161. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  162. {
  163. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -13000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  164. }
  165. }
  166. }
  167. else
  168. {
  169. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  170. player: card.Owner.Enemy,
  171. destroySecurityCount: 1,
  172. cardEffect: activateClass,
  173. fromTop: true).DestroySecurity());
  174. yield return ContinuousController.instance.StartCoroutine(new IRecovery(
  175. player: card.Owner,
  176. AddLifeCount: 1,
  177. cardEffect: activateClass).Recovery());
  178. }
  179. sourceLoops--;
  180. }
  181. }
  182. #endregion
  183. return cardEffects;
  184. }
  185. }
  186. }