Exemplo n.º 1
0
 public ShotResponseHandler(Player targetPlayer, Player causedBy, int power = 1)
     : base(RequestType.Shot, targetPlayer, causedBy)
 {
     this.power = power;
     barrelsChecked = new List<Card>();
     abilityUsed = false;
 }
Exemplo n.º 2
0
 protected ResponseHandler(RequestType type, Player requested, Player causedBy)
 {
     this.type = type;
     this.requested = requested;
     this.causedBy = causedBy;
     current = new Stack<ResponseHandler>();
     active = false;
 }
Exemplo n.º 3
0
 protected abstract ResponseHandler OnPlayFromTable(Player owner, Player targetPlayer);
Exemplo n.º 4
0
 protected ResponseHandler(Player requested, Player causedBy)
     : this(RequestType.None, requested, causedBy)
 {
 }
Exemplo n.º 5
0
 protected Character(Player player, CharacterType type)
 {
     this.player = player;
     this.type = type;
 }
Exemplo n.º 6
0
 public void PlayerPickFromSelection(Player player, Card card)
 {
     PlayerPickFromSelection(player, card, false);
 }
Exemplo n.º 7
0
        public void PlayerStealCard(Player player, Card card, bool revealCard)
        {
            Player owner = card.Owner;
            if(owner == null)
                throw new InvalidOperationException();
            if(!owner.RemoveCardFromHand(card))
                if(!owner.RemoveCardFromTable(card as TableCard))
                    throw new InvalidOperationException();

            player.AddCardToHand(card);
            game.Session.EventManager.OnPlayerStoleCard(player, owner, card, revealCard);
            owner.CheckEmptyHand();
        }
Exemplo n.º 8
0
        public void PassTableCard(TableCard card, Player targetPlayer)
        {
            Player owner = card.Owner;
            if(owner == null)
                throw new InvalidOperationException();
            if(!owner.RemoveCardFromHand(card))
                if(!owner.RemoveCardFromTable(card))
                    throw new InvalidOperationException();

            targetPlayer.AddCardToTable(card);
            game.Session.EventManager.OnPassedTableCard(owner, card, targetPlayer);
            owner.CheckEmptyHand();
        }
Exemplo n.º 9
0
 public int GetDistanceIn(Player origin)
 {
     int dist = 0;
     foreach(Card c in table)
         if(c.DistanceIn != 0 && origin.HasCardEffect(c))
             dist += c.DistanceIn;
     dist += character.DistanceIn;
     return dist;
 }
Exemplo n.º 10
0
 protected QueueResponseHandler(Player requested, Player causedBy, int capacity)
     : base(requested, causedBy)
 {
     queue = new Queue<ResponseHandler>(capacity);
 }
Exemplo n.º 11
0
 protected QueueResponseHandler(Player requested, int capacity)
     : this(requested, null, capacity)
 {
 }
Exemplo n.º 12
0
 public PrivatePlayerViewProxy(Player raw)
 {
     this.raw = raw;
 }
Exemplo n.º 13
0
 protected QueueResponseHandler(Player requested)
     : this(requested, null)
 {
 }
Exemplo n.º 14
0
 public BeerRescue(Player player, Player causedBy)
     : base(RequestType.BeerRescue, player, causedBy)
 {
 }
Exemplo n.º 15
0
        public void ModifyLifePoints(int delta, Player causedBy)
        {
            int oldLifePoints = lifePoints;
            lifePoints += delta;
            if(lifePoints > MaxLifePoints)
                lifePoints = MaxLifePoints;

            delta = lifePoints - oldLifePoints;
            if(delta != 0)
                game.Session.EventManager.OnLifePointsChanged(this, delta, causedBy);

            if(hitPoints == 0)
            {
                hitPoints = -delta;
                this.causedBy = causedBy;
            }

            if(lifePoints <= 0)
                Game.GameCycle.PushTempHandler(new BeerRescue(this, this.causedBy));
            else
            {
                int temp = hitPoints;
                hitPoints = 0;
                if(temp > 0)
                    character.OnHit(temp, this.causedBy);
            }
        }
Exemplo n.º 16
0
 public int GetDistanceOut(Player target)
 {
     int dist = 0;
     foreach(Card c in table)
         if(c.DistanceOut != 0 && target.HasCardEffect(c))
             dist += c.DistanceOut;
     dist += character.DistanceOut;
     return dist;
 }
Exemplo n.º 17
0
 public void DrawIntoSelection(int count, Player owner)
 {
     List<Card> drawn = new List<Card>(count);
     for(int i = 0; i < count; i++)
     {
         Card card = PopCardFromDeck();
         selection.Add(card);
         drawn.Add(card);
     }
     selectionOwner = owner;
     game.Session.EventManager.OnDrawnIntoSelection(drawn, owner);
 }
Exemplo n.º 18
0
 public ReadOnlyCollection<Card> PlayerDrawFromDeck(Player player, int count, bool revealCards = false)
 {
     List<Card> drawn = new List<Card>(count);
     for(int i = 0; i < count; i++)
     {
         Card card = PopCardFromDeck();
         player.AddCardToHand(card);
         drawn.Add(card);
     }
     game.Session.EventManager.OnPlayerDrewFromDeck(player, drawn, revealCards);
     return new ReadOnlyCollection<Card>(drawn);
 }
Exemplo n.º 19
0
 public ReadOnlyCollection<ICard> GetSelection(Player player)
 {
     if(player == selectionOwner || selectionOwner == null)
         return new ReadOnlyCollection<ICard>(selection.ConvertAll<ICard>(c => c));
     else
         return new ReadOnlyCollection<ICard>(selection.ConvertAll<ICard>(c => c.Empty));
 }
Exemplo n.º 20
0
 public void PlayerPass(Player player)
 {
     game.Session.EventManager.OnPlayerEndedTurn(player);
 }
Exemplo n.º 21
0
        public void PlayerCancelCard(Player player, Card card)
        {
            Player owner = card.Owner;
            if(owner == null)
                throw new InvalidOperationException();
            if(!owner.RemoveCardFromHand(card))
                if(!owner.RemoveCardFromTable(card as TableCard))
                    throw new InvalidOperationException();

            PutCardToGraveyard(card);
            game.Session.EventManager.OnPlayerCancelledCard(player, owner, card);
            owner.CheckEmptyHand();
        }
Exemplo n.º 22
0
 protected ResponseHandler(Player requested)
     : this(RequestType.None, requested, null)
 {
 }
Exemplo n.º 23
0
 public ReadOnlyCollection<Card> PlayerDrawFromGraveyard(Player player, int count)
 {
     List<Card> drawn = new List<Card>(count);
     for(int i = 0; i < count; i++)
     {
         Card card = PopCardFromGraveyard();
         player.AddCardToHand(card);
         drawn.Add(card);
     }
     game.Session.EventManager.OnPlayerDrewFromGraveyard(player, drawn);
     return new ReadOnlyCollection<Card>(drawn);
 }
Exemplo n.º 24
0
 public static Character GetCharacter(Player player, CharacterType type)
 {
     switch(type)
     {
     case CharacterType.BartCassidy:
         return new BartCassidy(player);
     case CharacterType.BlackJack:
         return new BlackJack(player);
     case CharacterType.CalamityJanet:
         return new CalamityJanet(player);
     case CharacterType.ElGringo:
         return new ElGringo(player);
     case CharacterType.JesseJones:
         return new JesseJones(player);
     case CharacterType.Jourdonnais:
         return new Jourdonnais(player);
     case CharacterType.KitCarlson:
         return new KitCarlson(player);
     case CharacterType.LuckyDuke:
         return new LuckyDuke(player);
     case CharacterType.PaulRegret:
         return new PaulRegret(player);
     case CharacterType.PedroRamirez:
         return new PedroRamirez(player);
     case CharacterType.RoseDoolan:
         return new RoseDoolan(player);
     case CharacterType.SidKetchum:
         return new SidKetchum(player);
     case CharacterType.SlabTheKiller:
         return new SlabTheKiller(player);
     case CharacterType.SuzyLafayette:
         return new SuzyLafayette(player);
     case CharacterType.VultureSam:
         return new VultureSam(player);
     case CharacterType.WillyTheKid:
         return new WillyTheKid(player);
     case CharacterType.ApacheKid:
         return new ApacheKid(player);
     case CharacterType.BelleStar:
         return new BelleStar(player);
     case CharacterType.BillNoface:
         return new BillNoface(player);
     case CharacterType.ChuckWengam:
         return new ChuckWengam(player);
     case CharacterType.DocHolyday:
         return new DocHolyday(player);
     case CharacterType.ElenaFuente:
         return new ElenaFuente(player);
     case CharacterType.GregDigger:
         return new GregDigger(player);
     case CharacterType.HerbHunter:
         return new HerbHunter(player);
     case CharacterType.JoseDelgado:
         return new JoseDelgado(player);
     case CharacterType.MollyStark:
         return new MollyStark(player);
     case CharacterType.PatBrennan:
         return new PatBrennan(player);
     case CharacterType.PixiePete:
         return new PixiePete(player);
     case CharacterType.SeanMallory:
         return new SeanMallory(player);
     case CharacterType.TequilaJoe:
         return new TequilaJoe(player);
     case CharacterType.VeraCuster:
         return new VeraCuster(player);
     default:
         throw new ArgumentOutOfRangeException("type");
         //case CharacterType.: return new (player);
     }
 }
Exemplo n.º 25
0
 public void PlayerPickFromSelection(Player player, Card card, bool revealCard)
 {
     if(selectionOwner != null && selectionOwner != player)
         throw new InvalidOperationException();
     if(!selection.Remove(card))
         throw new InvalidOperationException();
     player.AddCardToHand(card);
     game.Session.EventManager.OnPlayerPickedFromSelection(player, card, selectionOwner == null || revealCard);
 }
Exemplo n.º 26
0
 public virtual void OnHit(int hitPoints, Player causedBy)
 {
 }
Exemplo n.º 27
0
        public void PlayerPlayCard(Card card, CardType asCard, Player targetPlayer)
        {
            Player owner = card.Owner;
            if(owner == null)
                throw new InvalidOperationException();

            if(!owner.RemoveCardFromHand(card))
                if(!owner.RemoveCardFromTable(card as TableCard))
                    throw new InvalidOperationException();
            PutCardToGraveyard(card);

            game.Session.EventManager.OnPlayerPlayedCard(owner, card, asCard, targetPlayer);
            owner.OnPlayedCard(card);
            owner.CheckEmptyHand();
        }
Exemplo n.º 28
0
 public virtual void OnPlayerDied(Player player)
 {
 }
Exemplo n.º 29
0
 public void PlayerStealCard(Player player, Card card)
 {
     PlayerStealCard(player, card, false);
 }
Exemplo n.º 30
0
 protected void OnUsedAbility(Player targetPlayer)
 {
     player.Game.Session.EventManager.OnPlayerUsedAbility(player, type, targetPlayer);
 }