EX8_017.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX8
  4. {
  5. public class EX8_017 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsTraits("DS") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 2;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region On Play
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("1 of your digimon gains <Blocker>", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[On Play] 1 of your Digimon gains <Blocker> until the end of your opponent's turn.";
  30. }
  31. bool SelectableTarget(Permanent permenant)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permenant, card);
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  42. CardEffectCommons.HasMatchConditionPermanent(SelectableTarget);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: SelectableTarget,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: 1,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: PermanentSelected,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Custom,
  58. cardEffect: activateClass);
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. IEnumerator PermanentSelected(Permanent permanent)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  63. }
  64. }
  65. }
  66. #endregion
  67. #region Jamming - ESS
  68. if (timing == EffectTiming.None)
  69. {
  70. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  71. isInheritedEffect: true,
  72. card: card,
  73. condition: null));
  74. }
  75. #endregion
  76. return cardEffects;
  77. }
  78. }
  79. }