It either has 22 errors or 108, once it was down to about 3 then back to 108.
It all started after I had made my BaseCharacter class yesterday, I’m beggin for help, it’s flustering the hell out of me.
public class BaseStat {
private int _baseValue;
private int _buffValue;
private int _expToLevel;
private float _levelMod;
public BaseStat(){
_baseValue = 0;
_buffValue = 0;
_levelMod = 1.1f;
_expToLevel = 100;
}
#region Basic Setters and Getters
public int BaseValue {
get{ return _baseValue; }
set{ _baseValue = value; }
}
public int BuffValue {
get{ return _buffValue; }
set{ _buffValue = value; }
}
public int ExpToLevel {
get{ return _expToLevel; }
set{ _expToLevel = value; }
}
public float LevelMod {
get{ return _levelMod; }
set{ _levelMod = value; }
}
#endregion
private int CalculateExpToLevel(){
return (int)(_expToLevel * _levelMod);
}
public void LevelUp(){
_expToLevel = CalculateExpToLevel();
_baseValue++;
}
public int AdjustedBaseValue{
get{ return _baseValue + _buffValue; }
}
}
using System.Collections.Generic;
public class ModifiedStat : BaseStat {
private List<ModifyingAttribute> _mods; //List to hold modifiers
private int _modValue; //Value of modifier
public ModifiedStat(){
_mods = new List<ModifyingAttribute>(); //Initialize list of modifiers
_modValue = 0; //Set modifier value to 0
}
//Function to add modifiers to the list
public void AddModifier(ModifyingAttribute mod){
_mods.Add(mod);
}
private void CalculateModValue(){
_modValue = 0;
//If there are any mods in the list, then
//for each mod it will add (adjusted value * set ratio of the attribute
if(_mods.Count > 0)
foreach(ModifyingAttribute att in _mods)
_modValue += (int)(att.attribute.AdjustedBaseValue * att.ratio);
}
//Adds the normal value of your attributes with the value of buffs and modifiers
public new int AdjustedBaseValue {
get{ return BaseValue + BuffValue + _modValue; }
}
public void Update() {
CalculateModValue();
}
}
public struct ModifyingAttribute{
public Attribute attribute;
public float ratio;
public ModifyingAttribute(Attribute att, float rat){
attribute = att;
ratio = rat;
}
}
using System;
public class Attribute : BaseStat{
public Attribute(){
ExpToLevel = 50;
LevelMod = 1.05f;
}
public enum AttributeName {
Constitution,
Strength,
Dexterity,
Intellect,
Vitality,
Haste
}
}
public class Vital : ModifiedStat {
private int _currValue;
public Vital(){
_currValue = 0;
ExpToLevel = 50;
LevelMod = 1.1f;
}
public int CurrValue {
get{
if (_currValue > AdjustedBaseValue)
_currValue = AdjustedBaseValue;
return _currValue;
}
set{_currValue = value; }
}
}
public enum VitalName {
Health,
Energy,
Mana
}
public class Skill : ModifiedStat {
private bool _known;
public Skill() {
_known = false;
ExpToLevel = 25;
LevelMod = 1.1f;
}
public bool Known {
get{ return _known; }
set{ _known = value; }
}
}
public enum SkillName {
Melee_Offense,
Melee_Defense,
Ranged_Offense,
Ranged_Defense,
Caster_Offense,
Caster_Defense,
}
using System.Collections;
using System;
public class BaseCharacter : MonoBehaviour {
#region Private Variables
private string _name; //Holds name of character
private int _level; //Holds level
private uint _freeExp; //Holds extra exp (uint stores only positive numbers)
private Attribute[] _primaryAttribute; //Array of attributes for the character
private Vital[] _vital; //Array of vital assets to the character
private Skill[] _skill; //Array of skills for the character
#endregion
public void Awake () {
_name = string.Empty;
_level = 0;
_freeExp = 0;
_primaryAttribute = new Attribute[Enum.GetValues(typeof(AttributeName)).Length];
_vital = new Vital[Enum.GetValues(typeof(VitalName)).Length];
_skill = new Skill[Enum.GetValues(typeof(SkillName)).Length];
SetupPrimaryAttributes();
SetupVitals();
SetupSkills();
}
#region Basic Setters and Getters
public string Name {
get{ return _name; }
set{ _name = value; }
}
public int Level {
get{ return _level; }
set{ _level = value; }
}
public uint FreeExp {
get{ return _freeExp; }
set{ _freeExp = value; }
}
#endregion
public void AddExp (uint exp) {
_freeExp += exp;
}
public void CalculateLevel () {
}
#region Average of Attributes, Vitals, and Skills
private void SetupPrimaryAttributes () {
for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++) {
_primaryAttribute[cnt] = new Attribute();
}
}
private void SetupVitals () {
for(int cnt = 0; cnt < _vital.Length; cnt++) {
_vital[cnt] = new Vital();
}
}
private void SetupSkills () {
for(int cnt = 0; cnt < _skill.Length; cnt++) {
_skill[cnt] = new Skill();
}
}
#endregion
#region Returns Attributes, Vitals, and Skills to int Index
public Attribute GetPrimaryAttribute(int index) {
return _primaryAttribute[index];
}
public Vital GetVital(int index) {
return _vital[index];
}
public Skill GetSkill(int index) {
return _skill[index];
}
#endregion
#region Vital Modifiers
private void SetupVitalModifiers(){
//health
GetVital((int)VitalName.Health).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), .5f));
//energy
GetVital((int)VitalName.Energy).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Dexterity), 1));
//mana
GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Intellect), 1));
}
/*private void SetupVitalModifiers(){
//health
ModifyingAttribute healthModifier = new ModifyingAttribute();
healthModifier.attribute = GetPrimaryAttribute((int)AttributeName.Constitution);
healthMod.ratio = 1;
GetVital((int)VitalName.Health).AddModifier(energyModifier);
//energy
ModifyingAttribute energyModifier = new ModifyingAttribute();
energyModifier.attribute = GetPrimaryAttribute((int)AttributeName.Dexterity);
energyMod.ratio = 1;
GetVital((int)VitalName.Energy).AddModifier(energyModifier);
//mana
ModifyingAttribute manaModifier = new ModifyingAttribute();
manaModifier.attribute = GetPrimaryAttribute((int)AttributeName.Intellect);
manaMod.ratio = 1;
GetVital((int)VitalName.mana).AddModifier(manaModifier);
}*/
#endregion
#region Skill Modifiers
private void SetupSkillModifiers(){
//Melee offense
GetSkill((int)SkillName.Melee_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Might), .33f));
GetSkill((int)SkillName.Melee_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Dexterity), .33f));
//Melee defense
GetSkill((int)SkillName.Melee_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Dexterity), .33f));
GetSkill((int)SkillName.Melee_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), .33f));
//Ranged offense
GetSkill((int)SkillName.Ranged_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Dexterity), .33f));
GetSkill((int)SkillName.Ranged_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Haste), .33f));
//Ranged defense
GetSkill((int)SkillName.Ranged_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Dexterity), .33f));
GetSkill((int)SkillName.Ranged_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), .33f));
//Caster offense
GetSkill((int)SkillName.Caster_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Intellect), .33f));
GetSkill((int)SkillName.Caster_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Haste), .33f));
//Caster defense
GetSkill((int)SkillName.Caster_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Intellect), .33f));
GetSkill((int)SkillName.Caster_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Vitality), .33f));
}
/*private void SetupSkillModifiers(){
ModifyingAttribute MeleeOffenseModifier1 = new ModifyingAttribute();
ModifyingAttribute MeleeOffenseModifier2 = new ModifyingAttribute();
MeleeOffenseModifier1.attribute = GetPrimaryAttribute((int)AttributeName.strength);
MeleeOffenseModifier1.ratio = .33f;
MeleeOffenseModifier2.attribute = GetPrimaryAttribute((int)AttributeName.strength);
MeleeOffenseModifier2.ratio = .33f;
GetSkill((int)SkillName.Melee_Offense).AddModifier(MeleeOffenseModifier1);
GetSkill((int)SkillName.Melee_Offense).AddModifier(MeleeOffenseModifier2);
}
*/
public void StatUpdate(){
for(int cnt = 0; cnt < _vital.Length; cnt++)
_vital[cnt].Update();
for(int cnt = 0; cnt < _skill.Length; cnt++)
_skill[cnt].Update();
}
#endregion
}