Example #1
0
 public bool UseAbility(Player owner, AbilityInfo info, Game game)
 {
     if (Used) return false;
     if (!CheckInfo(info)) throw new HotCitException(ExceptionType.IllegalInput);
     UseUnusedAbility(owner, info, game);
     Used = true;
     return true;
 }
Example #2
0
 protected abstract bool CheckInfo(AbilityInfo info);
Example #3
0
 protected override bool CheckInfo(AbilityInfo info)
 {
     return info.Target != null && info.District != null;
 }
Example #4
0
        protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
        {
            var target = game.GetPlayerByUsername(info.Target);

            if (target.IsCharacter(5)) throw new HotCitException(ExceptionType.BadAction, "Cannot destroy bishops districts");

            var district = target.City.FirstOrDefault(d => d.Title == info.District);

            if (district == null) throw new HotCitException(ExceptionType.NotFound, info.District + " not found at " + info.Target);

            owner.Gold -= district.Value - 1;

            target.City.Remove(district);
        }
Example #5
0
 protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
 {
     var target = game.GetPlayerByCharacter(info.Target);
     if (target == null) return;
     target.RobbedBy(info.Target, owner);
 }
Example #6
0
 public bool UseAbility(Player owner, AbilityInfo info, Game game)
 {
     if (info.Target != null && info.District != null)
     {
         return _destroyAbility.UseAbility(owner, info, game);
     }
     if (info.Target == null && info.District == null)
     {
         return _goldAbility.UseAbility(owner, info, game);
     }
     return false;
 }
Example #7
0
 protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
 {
 }
Example #8
0
 protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
 {
     var target = game.Characters.FirstOrDefault(c => c.Name == info.Target);
     if (target == null) throw new HotCitException(ExceptionType.IllegalInput, info.Target + " is not a character in the game");
     target.Dead = true;
 }
Example #9
0
 protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
 {
     if (info.Target != null) //swap with player
     {
         owner.SwapHand(game.GetPlayerByUsername(info.Target));
     }
     else
     {
         var option = new Option
         {
             Message = "Discard any number of cards and draw an equal number of cards.",
             Choices = owner.Hand.Select(c => c.Title)
         };
         game.OnSelect = new StandardSelectStrategy(option, game.SwapWithPile);
     }
 }
Example #10
0
 protected override bool CheckInfo(AbilityInfo info)
 {
     return true;
 }
Example #11
0
 protected override bool CheckInfo(AbilityInfo info)
 {
     return info.District == null;
 }
Example #12
0
 protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
 {
     game.OnSelect = new StandardSelectStrategy(GetOption(owner), (game1, s, cards) => OnSelect(game1, s, cards, owner));
 }
Example #13
0
 protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
 {
     owner.Gold += owner.City.Count(c => c.Color == _color);
 }
Example #14
0
 protected abstract void UseUnusedAbility(Player owner, AbilityInfo info, Game game);
Example #15
0
 protected override void UseUnusedAbility(Player owner, AbilityInfo info, Game game)
 {
     owner.Gold -= 2;
     for (var i = 0; i < 3; i++)
         owner.Hand.Add(game.TakeDistrict());
 }
Example #16
0
 public void UseAbility(Player player, AbilityInfo ability, Game game)
 {
     if (Ability == null) throw new HotCitException(ExceptionType.BadAction, Title + " do not have an ability");
     Ability.UseAbility(player, ability, game);
 }
Example #17
0
 public void UseAbility(string pid, AbilityInfo ability)
 {
     CheckOption(pid, OptionType.UseAbility);
     var source = ability.Source;
     var character = GetCharacterInTurn();
     var player = PlayerInTurn;
     if (source == character.Name)
     {
         character.UseAbility(player, ability, this);
     }
     else
     {
         var district = player.Hand.First(d => d.Title == source); //TODO throw hotcit exception?
         district.UseAbility(player, ability, this);
     }
 }