EX9_040.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX9
  5. {
  6. public class EX9_040 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Requirements
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsTraits("WG") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Blocker
  22. if (timing == EffectTiming.None)
  23. {
  24. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  25. }
  26. #endregion
  27. #region All Turns
  28. if (timing == EffectTiming.OnTappedAnyone)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Suspend an opponent's Digimon", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  33. activateClass.SetHashString("Play_EX9_040");
  34. cardEffects.Add(activateClass);
  35. string EffectDescription()
  36. {
  37. return "[All Turns][Once Per Turn] When this Digimon suspends, suspend 1 of your opponent's Digimon.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, permanent => permanent == card.PermanentOfThisCard());
  42. }
  43. bool CanSelectPermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: CanSelectPermanentCondition,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: maxCount,
  61. canNoSelect: false,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: null,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Tap,
  66. cardEffect: activateClass);
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. }
  69. }
  70. #endregion
  71. #region Inherit
  72. if (timing == EffectTiming.None)
  73. {
  74. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(
  75. changeValue: () => 1000,
  76. isInheritedEffect: true,
  77. card: card,
  78. condition: null));
  79. }
  80. #endregion
  81. return cardEffects;
  82. }
  83. }
  84. }