public override int PreventLifeloss(int amount, Player player, bool queryOnly)
        {
            if (_player != player)
            return 0;

              var dealt = amount - CalculateLifeloss(amount);
              return dealt > 0 ? dealt : 0;
        }
예제 #2
0
 public bool IsGoodTarget(ITarget target, Player controller)
 {
     return TargetingHelper.IsGoodTargetForSpell(
     target, OwningCard, controller, _p.TargetSelector,
     _p.Rules.Where(r => r is TargetingRule).Cast<TargetingRule>());
 }
예제 #3
0
 public Hand(Player owner)
     : base(owner)
 {
 }
예제 #4
0
 public Battlefield(Player owner)
     : base(owner)
 {
 }
예제 #5
0
        private static bool HasValidController(Player targetController, Player sourceController, ControlledBy controlledBy)
        {
            switch (controlledBy)
              {
            case (ControlledBy.Opponent):
              return targetController != sourceController;

            case (ControlledBy.SpellOwner):
              return targetController == sourceController;
              }

              return true;
        }
예제 #6
0
 public Library(Player owner)
     : base(owner)
 {
 }
예제 #7
0
 public bool CanBeTargetBySpellsOwnedBy(Player player)
 {
     return !Has().Shroud && (player == Controller || !Has().Hexproof);
 }
 public PreventLifelossBelowOneToPlayer(Player player)
 {
     _player = player;
 }
예제 #9
0
 public bool IsZoneValid(Zone zone, Player zoneOwner)
 {
     return _isValidZone(new IsValidZoneParam(zone, zoneOwner, _controller));
 }
예제 #10
0
        public void Initialize(Game game, Player controller, Card owningCard = null)
        {
            Game = game;

              _owningCard = owningCard;
              _controller = controller;
        }
예제 #11
0
 public bool IsGoodTarget(ITarget target, Player controller)
 {
     return _castRules.Any(x => x.IsGoodTarget(target, controller));
 }
예제 #12
0
 public virtual int PreventLifeloss(int amount, Player player, bool queryOnly)
 {
     return 0;
 }
예제 #13
0
        public bool IsVisibleToPlayer(Player player)
        {
            if (_isRevealed == true)
            return true;

              if (_isHidden == true)
            return false;

              if (Zone == Zone.Battlefield || Zone == Zone.Graveyard || Zone == Zone.Exile || Zone == Zone.Stack)
            return true;

              if (Zone == Zone.Library)
            return _isPeeked && player == Controller;

              return player == Controller;
        }
예제 #14
0
        public Card Initialize(Player owner, Game game)
        {
            Game = game;
              Owner = owner;
              Id = game.Recorder.CreateId(this);

              JoinedBattlefield.Initialize(ChangeTracker);
              LeftBattlefield.Initialize(ChangeTracker);

              _controller = new CardController(owner);
              _controller.Initialize(game, this);
              _strenght.Initialize(game, this);
              _level.Initialize(game, this);
              _counters.Initialize(this, game);
              _type.Initialize(game, this);
              _colors.Initialize(game, this);
              _protections.Initialize(ChangeTracker, this);
              _zone.Initialize(ChangeTracker, this);
              _modifiers.Initialize(ChangeTracker);

              _isTapped.Initialize(ChangeTracker, this);
              _attachedTo.Initialize(ChangeTracker, this);
              _attachments.Initialize(ChangeTracker, this);
              _hasRegenerationShield.Initialize(ChangeTracker, this);
              _damage.Initialize(ChangeTracker, this);
              _hasLeathalDamage.Initialize(ChangeTracker, this);
              _hasSummoningSickness.Initialize(ChangeTracker, this);
              _hash.Initialize(ChangeTracker);
              _isHidden.Initialize(ChangeTracker, this);
              _isRevealed.Initialize(ChangeTracker, this);
              _isPeeked.Initialize(ChangeTracker, this);
              _usageScore.Initialize(ChangeTracker, this);
              _castRules.Initialize(this, game);
              _simpleAbilities.Initialize(this, game);
              _triggeredAbilities.Initialize(this, game);
              _activatedAbilities.Initialize(this, game);
              _staticAbilities.Initialize(this, game);
              _combatRules.Initialize(this, game);
              _continuousEffects.Initialize(this, game);

              _isPreview = false;
              return this;
        }
 public ReplaceDamageToPlayersCreaturesWithCounters(Player player, Func<Counter> counter, Func<Card, bool> filter = null)
 {
     _player = player;
       _counter = counter;
       _filter = filter ?? delegate { return true; };
 }
예제 #16
0
        public void Start(Func<bool> shouldContinue, bool skipPreGame, Player looser = null)
        {
            Turn.Step = Step.GameStart;

              if (skipPreGame)
              {
            Turn.Step = Step.Untap;
              }

              Turn.State = 0;
              _previousLooser = looser;

              _currentStep.Value = _steps.First(x => x.Step == Turn.Step);
              _currentState.Value = _currentStep.Value.Start;

              _currentState.Value.Execute();

              Resume(shouldContinue);
        }
예제 #17
0
 public Graveyard(Player owner)
     : base(owner)
 {
 }
예제 #18
0
 public AssignedDamage(Player player)
 {
     _player = player;
 }
예제 #19
0
 public int PreventLifeloss(int amount, Player player, bool queryOnly = true)
 {
     return Prevent(amount, (prevention) => prevention.PreventLifeloss(amount, player, queryOnly));
 }