P_086.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class P_086 : CEntity_Effect
  5. {
  6. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  7. {
  8. List<ICardEffect> cardEffects = new List<ICardEffect>();
  9. if (timing == EffectTiming.OnEnterFieldAnyone)
  10. {
  11. ActivateClass activateClass = new ActivateClass();
  12. activateClass.SetUpICardEffect("Your 1 Digimon gets unable to be attacked", CanUseCondition, card);
  13. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  14. cardEffects.Add(activateClass);
  15. string EffectDiscription()
  16. {
  17. return "[On Play] If you have a blue Tamer in play, 1 of your Digimon can't be attacked until the end of your opponent's turn.";
  18. }
  19. bool PermanentCondition(Permanent permanent)
  20. {
  21. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  22. {
  23. if (permanent.IsTamer)
  24. {
  25. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  26. {
  27. return true;
  28. }
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  60. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  61. selectPermanentEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: CanSelectPermanentCondition,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: maxCount,
  67. canNoSelect: false,
  68. canEndNotMax: false,
  69. selectPermanentCoroutine: SelectPermanentCoroutine,
  70. afterSelectPermanentCoroutine: null,
  71. mode: SelectPermanentEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectPermanentEffect.SetUpCustomMessage(
  74. "Select 1 Digimon that will gain effects.",
  75. "The opponent is selecting 1 Digimon that will gain effects.");
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  77. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeAttacked(
  80. targetPermanent: permanent,
  81. attackerCondition: null,
  82. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  83. activateClass: activateClass,
  84. effectName: "Can't be Attacked"));
  85. }
  86. }
  87. }
  88. }
  89. return cardEffects;
  90. }
  91. }