// Assign random attributes public void Randomise() { Appearance.Randomise(false, false); Movement.LookDir = new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f)); charName = AssetManager.instance.GetUniqueNpcName(); age = (CharacterAge)Random.Range(0, System.Enum.GetNames(typeof(CharacterAge)).Length); occupation = (CharacterOccupation)Random.Range(0, System.Enum.GetNames(typeof(CharacterOccupation)).Length - 1); // -1 to not include politician wealth = (CharacterWealth)Random.Range(0, System.Enum.GetNames(typeof(CharacterWealth)).Length); disposition = Random.Range(40, 60); // If poor then high chance of wearing rags and fingerless gloves if (wealth == CharacterWealth.Poor && Random.value > 0.2f) { Appearance.hands = 2; Appearance.body = 3; } if (occupation == CharacterOccupation.Monk) { // Monk hairstyle Appearance.hair = 2; Appearance.hat = 0; } if (occupation == CharacterOccupation.Knight) { // Helmet and armour Appearance.hat = 5; Appearance.body = 2; Appearance.hair = 0; // Bald head so hair doesn't clip through helmet } // Randomise colours AFTER setting body parts so it picks colours from the new palettes Appearance.RandomiseColours(); Appearance.ApplyAll(); }
public void LoadsWealthFromTable() { var data = new MemoryStore(); data.SetValue("name", "foo"); var levels = new MemoryStore(); var level1 = new MemoryStore(); level1.SetValue("level", 1); level1.SetValue("amount", "0gp"); var level2 = new MemoryStore(); level2.SetValue("level", 2); level2.SetValue("amount", "220gp"); levels.AddListItem(level1); levels.AddListItem(level2); data.SetValue("levels", levels); var wealth = new CharacterWealth(data); Assert.Equal(wealth.Name, "foo"); Assert.Equal(wealth.Levels[0].Level, 1); Assert.Equal(wealth.Levels[0].Value, 0); Assert.Equal(wealth.Levels[1].Level, 2); Assert.Equal(wealth.Levels[1].Value, 22000); }
public string GetRandomFlattery(CharacterWealth wealth) { if (_flatteryWealth.ContainsKey(wealth)) { return(_flatteryWealth.GetValue(wealth).RandomText); } return(""); }
public string GetRandomThreaten(CharacterWealth wealth) { if (_threatenWealth.ContainsKey(wealth)) { return(_threatenWealth.GetValue(wealth).RandomText); } return(""); }
public StartingWealthTests() { var list = new List <CharacterWealth>(); var wealth = new CharacterWealth(); wealth.Name = "adventurer"; wealth.Levels.Add(new CharacterWealth.CharacterWealthLevel(1, 0)); wealth.Levels.Add(new CharacterWealth.CharacterWealthLevel(2, 2000)); list.Add(wealth); wealthGateway = EntityGateway <CharacterWealth> .LoadFromList(list); }