} // represents who this entity is allied with in combat public Entity(string name, int level, char gender, int team, int[] abilityScoreValues = null, Die hitDie = null, MapPoint location = null) { Name = name; Level.SetValue(level); Gender = gender; Team = team; AbilityScores = new AbilityScores(abilityScoreValues); _experience = 0; hitDie ??= new Die(6); _hitDie = hitDie; Hp = 0; for (int j = 0; j < Level.Value; j++) { Hp += _hitDie.Roll(1, getModifier("CON")); } CurrentHp = new Stat("HP", 0, Hp, Hp); PassivePerception = AbilityScores.TotalScores["WIS"]; Location = location; Actions.Add(new TargetedAction("attack", $"[target name] - Attack a target creature within {_attackRangeFeet} feet.", "major", Attack)); Actions.Add(new NonTargetedAction("search", "- Search surroundings for items and creatures.", "major", Search)); Actions.Add(new NonTargetedAction("hide", "- Attempt to hide from enemies", "major", Hide)); Actions.Add(new TargetedAction("take", "[item name] - Pick up an item within 5 feet.", "minor", TakeItem)); Actions.Add(new TargetedAction("drop", "[item name] - Drop an item in inventory.", "minor", DropItem)); Actions.Add(new TargetedAction("use", "[item name] - Use an item in inventory.", "minor", UseItem)); Actions.Add(new TargetedAction("move", "[direction] [distance] - Move to an unoccupied space. Enter abbreviated direction and distance in feet. (e.g., NW 20)", "move", Move)); }
public SentientCreature(string name, int level, char gender, Race race, Caste caste, int team, int[] abilityScoreValues = null, MapPoint location = null) : base(name, level, gender, team, abilityScoreValues, null, location) { Race = race; Caste = caste; _hitDie = race.HitDie; AbilityScores.AddMods(AbilityScores.RacialMods, Race.AbilityMods); }
public virtual string GetAllStats() { string output = $"{Name}, lvl {Level.Value} {char.ToUpper(Gender)}\n"; output += $"HP: {CurrentHp.Value} / {Hp} AC: {ArmorClass}\n"; output += $"{AbilityScores.GetShortDescription()}\n"; output += $"Inventory: {ListItems()}"; output += $"Status Effects: {ListStatusEffects()}"; return(output); }
public override bool AddItem(Item newItem) { bool canAddItem = true; if (newItem is Armor) { var newArmor = (Armor)newItem; var equippedArmor = from i in Items where i is Armor select(Armor) i; if (equippedArmor.Any(a => a.Slot == newArmor.Slot)) { canAddItem = false; Console.WriteLine($"{Name} already has {newArmor.Slot} armor equipped."); } if (newArmor.Material != Caste.ArmorProficiency) { canAddItem = false; Console.WriteLine($"{Name} cannot wear {newArmor.Name} because it is {newArmor.Material}. A {Caste.Name} can only wear {Caste.ArmorProficiency} armor."); } } if (newItem is Weapon) { var newWeapon = (Weapon)newItem; var heldWeapons = from i in Items where i is Weapon select(Weapon) i; if (heldWeapons.Any(w => w.TwoHanded) || heldWeapons.Where(w => !w.TwoHanded).Count() >= 2) { canAddItem = false; Console.WriteLine($"{Name} cannot hold any more weapons."); } if (!Caste.WeaponProficiency.Contains(newWeapon.Type)) { canAddItem = false; Console.WriteLine($"{Name} cannot use {newWeapon.Name} because {Pronouns[0].ToLower()} is a {Caste.Name}."); } } if (_currentWeightCarried + newItem.Weight > _maxCarryWeight) { canAddItem = false; Console.WriteLine($"{newItem.Name} is too heavy for {Name} to carry."); } if (canAddItem) { Items.Add(newItem); AbilityScores.AddMods(AbilityScores.ItemMods, newItem.AbilityMods); } return(canAddItem); }
public override string GetAllStats() { string output = $"{Name}, lvl {Level.Value} {char.ToUpper(Gender)} {Race.Name} {Caste.Name}\n"; output += $"HP: {CurrentHp.Value} / {Hp} AC: {ArmorClass}\n"; output += $"{AbilityScores.GetShortDescription()}\n"; output += $"Inventory: {ListItems()}\n"; output += $"Status Effects: {ListStatusEffects()}\n"; if (HiddenDc > 0) { output += $"Currently hidden with DC of {HiddenDc}.\n"; } return(output); }