EX11_074.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Vortexdramon
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_074 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Static Effects
  14. #region Alternate Digivolution
  15. if (timing == EffectTiming.None)
  16. {
  17. bool Condition()
  18. {
  19. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasShotoKazama);
  20. }
  21. bool HasShotoKazama(Permanent targetPermanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card) &&
  24. targetPermanent.TopCard.EqualsCardName("Shoto Kazama");
  25. }
  26. bool PermanentCondition(Permanent targetPermanent)
  27. {
  28. return targetPermanent.TopCard.EqualsCardName("GrandGalemon");
  29. }
  30. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  31. permanentCondition: PermanentCondition,
  32. digivolutionCost: 6,
  33. ignoreDigivolutionRequirement: false,
  34. card: card,
  35. condition: Condition)
  36. );
  37. }
  38. #endregion
  39. #region Piercing
  40. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  41. {
  42. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  43. }
  44. #endregion
  45. #region Vortex
  46. if (timing == EffectTiming.OnEndTurn)
  47. {
  48. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card, condition: null));
  49. }
  50. #endregion
  51. #region Blocker
  52. if (timing == EffectTiming.None)
  53. {
  54. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  55. }
  56. #endregion
  57. #endregion
  58. #region Shared WD / WA
  59. string SharedEffectName = "Suspend 1 Digimon. If yours, this becomes immune to opponent's Digimon effects and gains +6K DP until end of their turn.";
  60. string SharedEffectDescription(string tag) => $"[{tag}] You may suspend 1 Digimon. If this effect suspended your Digimon, until your opponent's turn ends, their Digimon's effects don't affect this Digimon and gets +6000 DP.";
  61. bool SharedCanActivateCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  64. }
  65. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  66. {
  67. Permanent selectedPermanent = null;
  68. bool ownDigimon = false;
  69. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  70. selectPermanentEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: 1,
  76. canNoSelect: true,
  77. canEndNotMax: false,
  78. selectPermanentCoroutine: SelectPermanentCoroutine,
  79. afterSelectPermanentCoroutine: null,
  80. mode: SelectPermanentEffect.Mode.Custom,
  81. cardEffect: activateClass);
  82. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to suspend.", "The opponent is selecting 1 Digimon to suspend.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  85. {
  86. selectedPermanent = permanent;
  87. yield return null;
  88. }
  89. if (selectedPermanent != null &&
  90. selectedPermanent.TopCard != null &&
  91. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  92. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(
  95. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  96. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  97. ownDigimon = selectedPermanent.IsSuspended &&
  98. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  99. }
  100. if (ownDigimon)
  101. {
  102. Permanent thisPermanent = card.PermanentOfThisCard();
  103. #region Give Digimon Effect Immunity
  104. thisPermanent.UntilOpponentTurnEndEffects.Add((_timing) => PermanentEffectFactory.DigimonEffectImmunity(thisPermanent));
  105. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(thisPermanent));
  106. #endregion
  107. #region Gain +6000 DP
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP
  109. (
  110. thisPermanent,
  111. 6000,
  112. EffectDuration.UntilOpponentTurnEnd,
  113. activateClass
  114. ));
  115. #endregion
  116. }
  117. }
  118. #endregion
  119. #region When Digivolving
  120. if (timing == EffectTiming.OnEnterFieldAnyone)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  124. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  125. cardEffects.Add(activateClass);
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card) &&
  129. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  130. }
  131. }
  132. #endregion
  133. #region When Attacking
  134. if (timing == EffectTiming.OnAllyAttack)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  138. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDescription("When Attacking"));
  139. cardEffects.Add(activateClass);
  140. bool CanUseCondition(Hashtable hashtable)
  141. {
  142. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) &&
  143. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  144. }
  145. }
  146. #endregion
  147. #region All turns
  148. if (timing == EffectTiming.OnTappedAnyone)
  149. {
  150. ActivateClass activateClass = new ();
  151. activateClass.SetUpICardEffect("This Digimon may unsuspend. Then may battle 1 opponent's Digimon", CanUseCondition, card);
  152. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  153. activateClass.SetHashString("EX11_074_AT_Battle");
  154. cardEffects.Add(activateClass);
  155. string EffectDescription()
  156. => "[All Turns] [Once Per Turn] When any Digimon suspend, this Digimon may unsuspend. Then, this Digimon may battle 1 of your opponent's Digimon.";
  157. bool CanUseCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.IsExistOnBattleArea(card)
  160. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon);
  161. }
  162. bool CanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleArea(card);
  163. bool CanSelectPermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  164. IEnumerator ActivateCoroutine(Hashtable hashtable)
  165. {
  166. if (card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanUnsuspend)
  167. {
  168. List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>()
  169. {
  170. new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
  171. new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
  172. };
  173. string selectPlayerMessage1 = "Will you unsuspend this Digimon?";
  174. string notSelectPlayerMessage1 = "The opponent is choosing if they will unsuspend.";
  175. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  176. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  177. var selectedOption = GManager.instance.userSelectionManager.SelectedBoolValue;
  178. if (selectedOption)
  179. {
  180. yield return ContinuousController.instance.StartCoroutine(
  181. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend()
  182. );
  183. }
  184. }
  185. Permanent selectedPermanent = null;
  186. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  187. selectPermanentEffect.SetUp(
  188. selectPlayer: card.Owner,
  189. canTargetCondition: CanSelectPermanentCondition,
  190. canTargetCondition_ByPreSelecetedList: null,
  191. canEndSelectCondition: null,
  192. maxCount: 1,
  193. canNoSelect: true,
  194. canEndNotMax: false,
  195. selectPermanentCoroutine: SelectPermanentCoroutine,
  196. afterSelectPermanentCoroutine: null,
  197. mode: SelectPermanentEffect.Mode.Custom,
  198. cardEffect: activateClass);
  199. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to battle.", "The opponent is selecting 1 Digimon to battle.");
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  201. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  202. {
  203. selectedPermanent = permanent;
  204. yield return null;
  205. }
  206. if (selectedPermanent != null)
  207. {
  208. yield return ContinuousController.instance.StartCoroutine(new IBattle(card.PermanentOfThisCard(), selectedPermanent, null, true).Battle());
  209. }
  210. }
  211. }
  212. #endregion
  213. return cardEffects;
  214. }
  215. }
  216. }