Пример #1
0
        public void Attack(ICreature creature)
        {
            int toHit = RNG.Roll(1, 20) + ToHitBonus;

            Console.WriteLine("{0} rolls a {1} to hit! ({2} + {3})", this.Name, toHit, toHit - ToHitBonus, ToHitBonus);
            if (toHit >= creature.AC)
            {
                int damage = (RNG.Roll(DamageDice, DamageSides) + DamageBonus) - creature.DR;
                creature.CurrentHP -= damage;
                Console.WriteLine(this.Name + " hits " + creature.Name + " for " + damage);
                Console.WriteLine("{0} now has {1} hitpoint remaining", creature.Name, creature.CurrentHP);
            }
        }
Пример #2
0
 public Creature(string name, int ac, int level, int tohitbonus, int damagedice, int damagesides, int damagebonus, int speed, int mr, int dr)
 {
     Name     = name;
     IsPlayer = false;
     AC       = ac;
     Level    = level;
     Speed    = speed;
     MR       = mr;
     DR       = dr;
     for (int x = 0; x < level; x++)
     {
         MaxHP += RNG.Roll(1, 8);
     }
     CurrentHP   = MaxHP;
     ToHitBonus  = tohitbonus;
     DamageDice  = damagedice;
     DamageSides = damagesides;
     DamageBonus = damagebonus;
 }
Пример #3
0
 public Player(string name)
 {
     Name     = name;
     IsPlayer = true;
     Class    = "Warrior";
     AC       = 17;
     DR       = 0;
     MR       = 0;
     Level    = 2;
     for (int x = 0; x < Level; x++)
     {
         MaxHP += RNG.Roll(1, 8);
     }
     CurrentHP   = MaxHP;
     ToHitBonus  = 5;
     DamageDice  = 1;
     DamageSides = 8;
     DamageBonus = 3;
     Speed       = 15;
     Level       = 1;
 }