public override void GiveDmg(Npc name) { if (IsSuccessful()) { short dmg = GameFunctions.RndNext(10, 17); name.Health -= dmg; if (name.Health < 0) { name.Health = 0; } else { if (GameFunctions.RndNextDouble() > HealChance) { GameFunctions.AddToCombatLog($"{_name} damages {name.NpcRace} for {dmg} health, stealing 1hp"); Health += 1; } else { GameFunctions.AddToCombatLog($"{_name} damages {name.NpcRace} for {dmg} health"); } } if (Health > 100) { Health = 100; } } else { GameFunctions.AddToCombatLog($"{_name} missed!"); } }
public void DropItem(Player player) { if (GameFunctions.RndNextDouble() > _dropChance) { switch (GameFunctions.RndNext(1, 3)) { case 1: GameFunctions.AddToEnemyLog($"The {NpcRace} dropped a {player.HealItemsType}!"); player.HealItems++; break; case 2: GameFunctions.AddToEnemyLog($"The {NpcRace} dropped a potion labeled 'Special Attack!'"); player.SpecialMoves++; break; } } }
public bool HitOrHeal() { //Npc intelligence => heal chance thresholds if (Health > 95) { _turnChoice = 1.00; } else if (Health > 50) { _turnChoice = 0.85; } else { _turnChoice = 0.70; } return(GameFunctions.RndNextDouble() < _turnChoice); }
public bool IsAccuracySuccessful() => GameFunctions.RndNextDouble() < _accuracyN;