Ejemplo n.º 1
0
 public Merchant(Game game, Player player)
 {
     Player = player;
     MerchantItems = game.GetMerchantItems();
     this.game = game;
     name = game.GetCharacterName() + "'s shop";
 }
Ejemplo n.º 2
0
 public MonsterManager(Game game)
 {
     Game = game;
     monsters = new List<MonsterData>();
     monstersByAreaType = new Dictionary<AreaType, List<MonsterData>>();
     dropsByMonsterId = new Dictionary<string, List<string>>();
 }
Ejemplo n.º 3
0
 public IEnumerable<FightStep> Execute(Game game, Character initiator, Character target)
 {
     Player player = initiator as Player;
     if (player == null) throw new ArgumentException("Only players can eat!");
     player.EatItem(item);
     yield break;
 }
Ejemplo n.º 4
0
 public Monster(Game game, MonsterManager.MonsterData monster)
     : base(game, monster.Name, monster.BaseImageName, game.Roll(monster.HitDice), monster.Initiative, monster.AttackModifier, monster.ArmorClass)
 {
     ChallengeRating = monster.ChallengeRating;
     MonsterId = monster.Identifier;
     actions = new List<IAction>();
     actions.Add(new WeaponAttack(monster.WeaponStats, null));
 }
Ejemplo n.º 5
0
 public IEnumerable<FightStep> Execute(Game game, Character initiator, Character target)
 {
     if (game.GetRandom(100) <= 75)
     {
         UINotifier.Get().NotifyFlee(initiator);
     }
     yield break;
 }
Ejemplo n.º 6
0
 public MapViewer(Game game)
 {
     InitializeComponent();
     this.game = game;
     locations = new List<Location>();
     baseMap = GenerateMap();
     UpdateCurrentLocation(locations[0]);
     game.TravelTo(locations[0]);
 }
Ejemplo n.º 7
0
 public StartWindow()
 {
     InitializeComponent();
     playerPictureBox.Image = Image.FromFile("player.png");
     ambitionComboBox.SelectedIndex = 0;
     Game = new Game();
     foreach (ClassType clas in Enum.GetValues(typeof(ClassType)))
     {
         classDropDown.Items.Add(new Class(clas));
     }
     classDropDown.SelectedIndex = 0;
 }
Ejemplo n.º 8
0
 public Character(Game game, string name, string baseImageName, int hitPoints, int initiative, int attackModifier, int armorClass)
 {
     Name = name;
     BaseImageName = baseImageName;
     MaxHitPoints = hitPoints;
     HitPoints = MaxHitPoints;
     Game = game;
     Initiative = initiative;
     ArmorClass = armorClass;
     AttackModifier = attackModifier;
     ActiveEffects = new List<Effect>();
 }
Ejemplo n.º 9
0
        public IEnumerable<FightStep> Execute(Game game, Character initiator, Character target)
        {
            // Go through types that have actions and perform them all.
            if (Types.Contains(FeatType.NORMAL_DAMAGE))
            {
                initiator.GetMainAttack().Execute(game, initiator, target);
            }

            // Apply any effect.
            if (EffectParams != null)
            {
                target.AddEffect(game.GetEffect(EffectParams));
            }
            yield break;
        }
Ejemplo n.º 10
0
 public Fight(Game game, Player player, Monster enemy)
 {
     Player = player;
     Enemy = enemy;
     this.game = game;
 }
Ejemplo n.º 11
0
        public IEnumerable<FightStep> Execute(Game game, Character initiator, Character target)
        {
            bool crit = false;
            if (initiator.IsDead())
                throw new InvalidOperationException("Dead characters cannot attack!");

            int roll = game.Roll(DiceRoll.D20(0));
            int damage = 0;

            crit = false;
            if (roll >= stats.CritRangeStart)
            {
                roll = game.Roll(DiceRoll.D20(0));
                if (roll + initiator.AttackModifier > target.ArmorClass)
                {
                    crit = true;
                    for (int i = 0; i < stats.CritModifier; ++i)
                    {
                        damage += Math.Max(game.Roll(stats.Damage), 1);
                    }
                }
                else
                {
                    damage = Math.Max(game.Roll(stats.Damage), 1);
                }
            }
            else if (roll + initiator.AttackModifier > target.ArmorClass)
            {
                damage = Math.Max(game.Roll(stats.Damage), 1);
            } // else miss

            if (damage > 0 && initiator is Player)
            {
                (initiator as Player).GainProficiency(target as Monster, weapon);
            }

            target.UpdateHitPoints(-damage);
            yield return new AttackStep(initiator);
            yield return new DamageStep(target, -damage, crit, target.HitPoints);
        }
Ejemplo n.º 12
0
 public FeatManager(Game game)
 {
     featsById = new Dictionary<string, FeatData>();
 }
Ejemplo n.º 13
0
 public ItemManager(Game game)
 {
     Game = game;
     itemDatas = new Dictionary<string, ItemData>();
 }
Ejemplo n.º 14
0
 public EffectManager(Game game)
 {
     effectsById = new Dictionary<string, EffectData>();
 }
Ejemplo n.º 15
0
 public Treasure(Game game, Player player)
 {
     Player = player;
     Loot = new Character(game, "Chest", "chest", 1, 0, 0, 0);
     LootItems = game.GetRandomLoot();
 }
Ejemplo n.º 16
0
 public List<Item> GetStartingGeer(Game game)
 {
     List<Item> items = new List<Item>();
     switch (Type)
     {
         case ClassType.FIGHTER:
             items.Add(game.GetItemById("CLOTH_SHIRT"));
             items.Add(game.GetItemById("CLOTH_PANTS"));
             items.Add(game.GetItemById("SHORT_SWORD"));
             break;
         case ClassType.WIZARD:
             items.Add(game.GetItemById("ROBE"));
             items.Add(game.GetItemById("CLOTH_PANTS"));
             items.Add(game.GetItemById("BASIC_WAND"));
             break;
         case ClassType.ROGUE:
             items.Add(game.GetItemById("BLACK_SHIRT"));
             items.Add(game.GetItemById("BLACK_PANTS"));
             items.Add(game.GetItemById("DAGGER"));
             break;
         case ClassType.ARCHER:
             items.Add(game.GetItemById("CLOTH_SHIRT"));
             items.Add(game.GetItemById("CLOTH_PANTS"));
             items.Add(game.GetItemById("SHORT_BOW"));
             break;
         case ClassType.DRUID:
             items.Add(game.GetItemById("LINEN_SHIRT"));
             items.Add(game.GetItemById("CLOTH_PANTS"));
             items.Add(game.GetItemById("PLAIN_STAFF"));
             break;
     }
     return items;
 }