Пример #1
0
 public override void DoAttack(Entity target)
 {
     if (Mechanics.RollDie(DieType.D20) >= 10 + Mechanics.GetModifier(target.Dexterity))
     {
         target.ApplyDamage(entity.MainHand);
     }
 }
Пример #2
0
        private void RollInitiative()
        {
            var random = new Random();

            // creatures with the same name are grouped in the same initative
            var namedict = new Dictionary <string, int>();

            foreach (var c in encounter.Creatures)
            {
                if (!c.IsPC)
                {
                    if (groupByName)
                    {
                        if (namedict.ContainsKey(c.Name))
                        {
                            c.Initiative = namedict[c.Name];
                        }
                        else
                        {
                            c.Initiative = random.Next(20) + Mechanics.GetModifier(c.Dexterity);
                            namedict.Add(c.Name, c.Initiative);
                        }
                    }
                    else
                    {
                        c.Initiative = random.Next(20) + Mechanics.GetModifier(c.Dexterity);
                    }
                }
            }

            encounter.Creatures.Sort(CreatureViewModel.CompareInitiative);

            rolled = true;
        }
Пример #3
0
 public override void Attack(Entity source)
 {
     if (Mechanics.RollDie(DieType.D20) >= 10 + Mechanics.GetModifier(entity.Dexterity))
     {
         entity.ApplyDamage(source.MainHand);
     }
 }