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]"); } }
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."); } }
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); }