Exemple #1
0
 private void ResolveDeath(Actor defender)
 {
     if (defender is Player)
     {
         MessageLog.Add($"{defender.Name} was killed! Game over, man!");
     }
     else if (defender is Monster)
     {
         Container.Adventure.RemoveMonster((Monster)defender);
         MessageLog.Add($"{defender.ColoredName} died and dropped [c:r f:{Palette.GoldenFizz.ToParser()}]{defender.Gold} gold pieces.[c:u]");
     }
 }
Exemple #2
0
        public void ResolveDamage(Actor attacker, Actor defender)
        {
            int damage = Random.Next(1, attacker.Constitution);

            damage -= Random.Next(1, defender.Constitution);

            if (damage > 0)
            {
                defender.Health.Damage((ushort)damage);
                MessageLog.Add($"{attacker.ColoredName} hit {defender.ColoredName} for [c:r f:{Palette.Mandy.ToParser()}]{damage} dmg[c:u]");

                if (defender.Health.CurrentValue <= 0)
                {
                    ResolveDeath(defender);
                }
            }
            else
            {
                MessageLog.Add($"{attacker.ColoredName} hit {defender.ColoredName}, but {defender.ColoredName} parried the blow.");
            }
        }
Exemple #3
0
        public bool ResolveAttack(Actor attacker, Actor defender)
        {
            bool hits = false;

            if (Random.Next(0, 20) + attacker.Dexterity > defender.Dexterity)
            {
                if (Random.Next(0, 20) + attacker.Constitution > defender.Constitution)
                {
                    hits = true;
                }
                else
                {
                    MessageLog.Add($"{attacker.ColoredName}'s attack was deflected by {defender.ColoredName}!");
                }
            }
            else
            {
                MessageLog.Add($"{attacker.ColoredName} missed {defender.ColoredName} completely!");
            }

            return(hits);
        }