//get Stat values after modifiers have been applied public int getModifiedStatValue(string StatName) { if (StatName == "HP") { return(HP.getModifiedStatValue()); } else if (StatName == "Attack") { return(Attack.getModifiedStatValue()); } else if (StatName == "Defence") { return(Defence.getModifiedStatValue()); } else if (StatName == "Agility") { return(Agility.getModifiedStatValue()); } return(0); }
//Adding StatBonuses public void addBonusModifier(List <StatModifierClass> modifiersList) { string Modifiertype; //for each modifier get the type of Stat then add individually to that stat, if player HP is full then increase currentHP when HP is increased foreach (var modifier in modifiersList) { Modifiertype = modifier.getModifierType(); if (Modifiertype == "HP") { if (currentHP == HP.getModifiedStatValue()) { HP.addModifier(modifier); currentHP = HP.getModifiedStatValue(); } else { HP.addModifier(modifier); } } else if (Modifiertype == "Attack") { Attack.addModifier(modifier); } else if (Modifiertype == "Defence") { Defence.addModifier(modifier); } else if (Modifiertype == "Agility") { Agility.addModifier(modifier); } } }
// Use this for initialization void Start() { //setting players Level CharacterLevel = Inspector_Character_Level; //Setting up stat Classes for the Player HP = new StatClass("HP", "This is the total amount of health points that the user has and damage taken will reduce the amount of HP, " + "but can be restored through potions. When the health points hit 0, the user will faint and it will be Game Over.", Convert.ToInt32(((CharacterLevel * 60) / 1.7))); Attack = new StatClass("Attack", "This is the attack power that the user has, this affect amount of damage the user can inflict on the enemy. The higher the stat, the more damage can be inflicted on the enemy.", Convert.ToInt32(((CharacterLevel * 60) / 5.7))); Defence = new StatClass("Defence", "This is the amount of Defensive power the user has, this will reduce the amount of damage inflicted on the user when attacked. A higher Defence means more damage reduction.", Convert.ToInt32(((CharacterLevel * 60) / 6.5))); Agility = new StatClass("Agility", "This is how quick the user is, it affects skill cooldown time as well as frequency of the users attacks. The higher the stat, the more attacks the user can do and a further reduction in cooldown time", Convert.ToInt32(((CharacterLevel * 60) / 4.8))); //Setting Players Base Exp Requirement Level_Experience_Required = Inspector_Required_Experience_Points; //setting the players current HP to Max currentHP = HP.getModifiedStatValue(); //updating UI HP Gauge updateUIHPGauge(); }