P_211.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Monica Simmons
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_211 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOpponentDigimonEffect(card));
  16. }
  17. #endregion
  18. #region On Play
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("1 digimon cant attack players", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[On Play] Until your opponent's turn ends, 1 of their Digimon can't attack players.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleArea(card)
  32. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleArea(card);
  37. }
  38. bool CanSelectPermanentCondition(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. Permanent selectedPermanent = null;
  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("Select 1 Digimon that cant attack players.", "The opponent is selecting 1 Digimon that cant attack players.");
  62. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  63. {
  64. selectedPermanent = permanent;
  65. yield return null;
  66. }
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  69. targetPermanent: selectedPermanent,
  70. defenderCondition: defender => defender == null,
  71. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  72. activateClass: activateClass,
  73. effectName: "Cannot Attack Players"));
  74. }
  75. }
  76. }
  77. #endregion
  78. #region Security
  79. if (timing == EffectTiming.SecuritySkill)
  80. {
  81. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  82. }
  83. #endregion
  84. return cardEffects;
  85. }
  86. }
  87. }