protected override void PageAwake() { skills = new EntitySkills(); playerNameText.text = ""; levelsText.text = ""; }
public void UpdatePlayerSkills(EntitySkills skills) { /* Save these skills */ this.skills.ApplyChanges(skills); /* Update text and progress bars for skills */ UpdateSkillTexts(); UpdateSkillProgress(); }
private IEntity GetDummyEntity() { IEntityInfo info = new EntityInfo(EntityRace.Human, EntityOccupation.Barbarian, 365 * 25, "Grok"); IEntityStats stats = new EntityStats(statValues); IEntitySkills skills = new EntitySkills(skillValues); IInventory inventory = new Inventory(60); IEntityAbility abilities = new EntityAbility(GeneralAbilities.All, ItemAbilities.None, EntityAbilities.ModifyInterationAbilities, EffectAbilities.ModifyMagicAbilities, AIAbilities.None); Guid id = Guid.NewGuid(); IEntity entity = new Entity(id, info, skills, stats, inventory, abilities); return(entity); }
public void SerializeSkills() { IEntitySkills skills = new EntitySkills(skillValues); IEntitySkills skillsClone = Serializer.DeepClone(skills); Assert.AreEqual(skillsClone.Get(SkillType.LightArmor), skills.Get(SkillType.LightArmor)); Assert.AreEqual(skillsClone.Get(SkillType.HeavyArmor), skills.Get(SkillType.HeavyArmor)); Assert.AreEqual(skillsClone.Get(SkillType.LightBlade), skills.Get(SkillType.LightBlade)); Assert.AreEqual(skillsClone.Get(SkillType.HeavyBlade), skills.Get(SkillType.HeavyBlade)); Assert.AreEqual(skillsClone.Get(SkillType.BluntWeapon), skills.Get(SkillType.BluntWeapon)); Assert.AreEqual(skillsClone.Get(SkillType.Sneak), skills.Get(SkillType.Sneak)); Assert.AreEqual(skillsClone.Get(SkillType.Pickpocket), skills.Get(SkillType.Pickpocket)); Assert.AreEqual(skillsClone.Get(SkillType.LockPicking), skills.Get(SkillType.LockPicking)); }
public void SerializeEntity() { IEntityInfo info = new EntityInfo(EntityRace.Human, EntityOccupation.Barbarian, 25 * 365, "Grok"); IEntityStats stats = new EntityStats(statValues); IEntitySkills skills = new EntitySkills(skillValues); IInventory inventory = new Inventory(60); IEntityAbility abilities = new EntityAbility(GeneralAbilities.All, ItemAbilities.None, EntityAbilities.ModifyInterationAbilities, EffectAbilities.ModifyMagicAbilities, AIAbilities.None); Guid id = Guid.NewGuid(); IEntity entity = new Entity(id, info, skills, stats, inventory, abilities); IEntity entityClone = Serializer.DeepClone(entity); // to do add equality tests here //Assert.Fail(); }
public IEntity Create(EntityProfile profile) { IEntityInfo info = GenerateEntityInfo(profile.Race, profile.Occupation); IEntityStats stats = GetStatsPoints(profile.Occupation, profile.Level * 10); IEntitySkills skills = new EntitySkills(); IInventory inventory = new Inventory(20); // smaller inventory for entity IEntityAbility abilities = new EntityAbility(GeneralAbilities.All, ItemAbilities.None, EntityAbilities.ModifyInterationAbilities, EffectAbilities.ModifyMagicAbilities, AIAbilities.None); Guid id = Guid.NewGuid(); IEntity entity = new Entity(id, info, skills, stats, inventory, abilities); this.AddOccupation(entity, info.Occupation); return(entity); }
protected override void OnLevelGained(EntitySkills.Skill skill, EntitySkills skills) { if (currentJournal == null) { return; } /* Make the book have a highlight */ if (currentJournal.GetAttachedHand() == null) { /* Turn on highlighting */ currentJournal.EnableHighlight(); } }
public void SetupPageManager(string player_name, PlayerQuestManager quests, EntitySkills skills, EntityCombatManager combat) { if (pages != null) { return; } /* Setup the page manager */ pages = new PageManager(this, quests.GetCurrentQuests(), quests.GetCompletedQuests()); /* Update player name */ pages.UpdateStats(player_name, skills, combat); if (debug) { Debug.Log("JournalManager: Journal has been setup."); } }
public void SkillsCreateWithValues() { try { IEntitySkills skills = new EntitySkills(skillValues); Assert.AreEqual(skills.Get(SkillType.LightArmor), skillValues[(int)SkillType.LightArmor]); Assert.AreEqual(skills.Get(SkillType.HeavyArmor), skillValues[(int)SkillType.HeavyArmor]); Assert.AreEqual(skills.Get(SkillType.LightBlade), skillValues[(int)SkillType.LightBlade]); Assert.AreEqual(skills.Get(SkillType.HeavyBlade), skillValues[(int)SkillType.HeavyBlade]); Assert.AreEqual(skills.Get(SkillType.BluntWeapon), skillValues[(int)SkillType.BluntWeapon]); Assert.AreEqual(skills.Get(SkillType.Sneak), skillValues[(int)SkillType.Sneak]); Assert.AreEqual(skills.Get(SkillType.Pickpocket), skillValues[(int)SkillType.Pickpocket]); Assert.AreEqual(skills.Get(SkillType.LockPicking), skillValues[(int)SkillType.LockPicking]); } catch { Assert.Fail(); } }
/** * Update the player's stats in the journal. This does not flip the journal * open to the stats page and only updates the page's information. */ public void UpdateStats(string player_name, EntitySkills skills, EntityCombatManager combat) { /* Load the left page */ PlayerStatsLeftPage leftPage = (PlayerStatsLeftPage)playerStats.pageLeft; /* Update all of the page progresses */ leftPage.UpdatePlayerName(player_name); if (skills != null) { leftPage.UpdatePlayerSkills(skills); } /* Load the right page */ PlayerStatsRightPage rightPage = (PlayerStatsRightPage)playerStats.pageRight; /* Update the status effects that are affecting the player */ if (combat != null) { rightPage.UpdateStatusEffects(combat); } }
public void SkillsLeveling() { try { IEntitySkills skills = new EntitySkills(skillValues); Assert.AreEqual(skills.Get(SkillType.Pickpocket), skillValues[(int)SkillType.Pickpocket]); // the player uses the pickpocket skill and a small amount of experience is deposited skills.AddSkillPoints(SkillType.Pickpocket, 0.05f); Assert.AreEqual(skills.Get(SkillType.Pickpocket), skillValues[(int)SkillType.Pickpocket]); Assert.AreEqual(skills.GetSkillProgress(SkillType.Pickpocket), 0.05f); // this happens continuously and here we add the sum of all the skill uses skills.AddSkillPoints(SkillType.Pickpocket, 0.95f); Assert.AreEqual(skills.Get(SkillType.Pickpocket), skillValues[(int)SkillType.Pickpocket] + 1, "The Skill did not reach level 8"); Assert.AreEqual(skills.GetSkillProgress(SkillType.Pickpocket), 0.0f, "The Skill progress did not reach 0% of level 8"); Assert.IsTrue(skills.GetSkillPointProgress() > 0, "Skill Point Progress was not added into stats after leveling"); } catch { Assert.Fail(); } }
public void EntityCreate() { try { IEntityInfo info = new EntityInfo(EntityRace.Human, EntityOccupation.Barbarian, 365 * 25, "Grok"); IEntityStats stats = new EntityStats(statValues); IEntitySkills skills = new EntitySkills(skillValues); IInventory inventory = new Inventory(60); IEntityAbility abilities = new EntityAbility(GeneralAbilities.All, ItemAbilities.None, EntityAbilities.ModifyInterationAbilities, EffectAbilities.ModifyMagicAbilities, AIAbilities.None); Guid id = Guid.NewGuid(); // based on occupation generate some inventory items IEntity entity = new Entity(id, info, skills, stats, inventory, abilities); // check that we have an inventory of size 60 Assert.AreEqual(inventory, entity.Inventory); Assert.AreEqual(abilities, entity.Abilities); Assert.AreEqual(stats, entity.Stats); Assert.AreEqual(info, entity.Info); Assert.AreEqual(id, entity.ID); } catch { Assert.Fail(); } }
public void UpdateStats(string player_name, EntitySkills skills, EntityCombatManager combat) { /* Update the stats of our player skills page */ pages.UpdateStats(player_name, skills, combat); }
/* When the player gains a level, play the level-up fanfare. */ protected override void OnLevelGained(EntitySkills.Skill skill, EntitySkills skills) { PlayClip(levelup); }
public void SkillsCreate() { IEntitySkills skills = new EntitySkills(); }