BT14_094.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_094 : 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.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] Activate 1 of the effects below: - 1 of your opponent's Digimon gets -6000 DP for the turn. - By deleting 1 of your [Angemon], place 1 of your opponent's Digimon at the bottom of their security stack.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  24. }
  25. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  26. {
  27. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
  28. {
  29. new SelectionElement<int>(message: $"DP-6000", value : 0, spriteIndex: 0),
  30. new SelectionElement<int>(message: $"Delete 1 [Angemon]", value : 1, spriteIndex: 0),
  31. };
  32. string selectPlayerMessage = "Which effect will you activate?";
  33. string notSelectPlayerMessage = "The opponent is choosing which effect to activate.";
  34. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  35. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  36. int actionID = GManager.instance.userSelectionManager.SelectedIntValue;
  37. switch (actionID)
  38. {
  39. case 0:
  40. {
  41. bool CanSelectPermanentCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  44. }
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectPermanentCondition,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: maxCount,
  55. canNoSelect: false,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: SelectPermanentCoroutine,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Custom,
  60. cardEffect: activateClass);
  61. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeDP(changeValue: -6000, maxCount: maxCount));
  62. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  63. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  66. targetPermanent: permanent,
  67. changeValue: -6000,
  68. effectDuration: EffectDuration.UntilEachTurnEnd,
  69. activateClass: activateClass));
  70. }
  71. }
  72. }
  73. break;
  74. case 1:
  75. {
  76. bool CanSelectPermanentCondition(Permanent permanent)
  77. {
  78. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  79. {
  80. if (permanent.TopCard.CardNames.Contains("Angemon"))
  81. {
  82. return true;
  83. }
  84. }
  85. return false;
  86. }
  87. bool CanSelectPermanentCondition1(Permanent permanent)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  90. }
  91. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  92. {
  93. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  94. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: CanSelectPermanentCondition,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: maxCount,
  101. canNoSelect: true,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: SelectPermanentCoroutine,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Custom,
  106. cardEffect: activateClass);
  107. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  112. targetPermanents: new List<Permanent>() { permanent },
  113. activateClass: activateClass,
  114. successProcess: permanents => SuccessProcess(),
  115. failureProcess: null));
  116. IEnumerator SuccessProcess()
  117. {
  118. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  119. {
  120. maxCount = 1;
  121. selectPermanentEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectPermanentCondition1,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: maxCount,
  127. canNoSelect: false,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: SelectPermanentCoroutine,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.Custom,
  132. cardEffect: activateClass);
  133. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to place to security.", "The opponent is selecting 1 Digimon to place to security.");
  134. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  135. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  136. {
  137. Permanent selectedPermanent = permanent;
  138. if (selectedPermanent != null)
  139. {
  140. yield return ContinuousController.instance.StartCoroutine(new IPutSecurityPermanent(selectedPermanent, CardEffectCommons.CardEffectHashtable(activateClass), toTop: false).PutSecurity());
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. }
  148. break;
  149. }
  150. }
  151. }
  152. if (timing == EffectTiming.SecuritySkill)
  153. {
  154. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Select effects");
  155. }
  156. return cardEffects;
  157. }
  158. }
  159. }