//Character Creation System Model function CreateChar(name, ws, ts, prof) { this.name = name; this.ows = ws; //Overworld Spriteset (32x32) this.its = ts; //Town & Battle Spriteset (32x48) this.CharClass = prof; if (this.CharClass == "Fighter"){ this.Str = InitVal(20); this.Dex = InitVal(20); this.Con = InitVal(18); this.Int = InitVal(15); this.Wis = InitVal(15); this.Chrm = InitVal(16); }else if (this.CharClass == "Thief"){ this.Str = InitVal(16); this.Dex = InitVal(20); this.Con = InitVal(18); this.Int = InitVal(16); this.Wis = InitVal(16); this.Chrm = InitVal(20); }else if(this.CharClass == "WhiteMage"){ this.Str = InitVal(13); this.Dex = InitVal(15); this.Con = InitVal(18); this.Int = InitVal(20); this.Wis = InitVal(20); this.Chrm = InitVal(15); }else if(this.CharClass == "BlackMage"){ this.Str = InitVal(15); this.Dex = InitVal(13); this.Con = InitVal(18); this.Int = InitVal(20); this.Wis = InitVal(20); this.Chrm = InitVal(14); } this.Atk = Math.floor((this.Str + this.Dex + this.Con)/3); //Just an initial thought, most likely will redefine this this.Def = Math.floor((this.Dex + this.Con + this.Wis)/2); //Just an initial thought, most likely will redefine this this.MgcPwr = Math.floor((this.Int + this.Wis + this.Con)/3); //Just an initial thought, most likely will redefine this this.MgcDef = Math.floor((this.Str + this.Int + this.Wis)/2); //Just an initial thought, most likely will redefine this this.MaxHP = InitVal(30); this.CurHP = this.MaxHP; this.MaxSP = InitVal(20); this.CurSP = this.MaxSP; this.Level = 1; this.XP = 0; this.equipment = []; this.magic = []; this.skills = []; //this.coinage = 0; redefine this as a global variable so all Party Members can access it this.equip = function(what) { var theitem = equipment_db[what]; this.equipment.push(theitem); this.MaxHP += theitem.hpbonus; this.Atk += theitem.attackbonus; this.Def += theitem.defensebonus; this.MgcPwr += theitem.mgcpwrbonus; this.MgcDef += theitem.mgcdefbonus; } this.unequip = function(what) { var theitem = equipment_db[what]; var itemindex = this.equipment.indexof(theitem); this.equipment.splice(itemindex, 1); this.MaxHP - theitem.hpbonus; this.Atk - theitem.attackbonus; this.Def - theitem.defensebonus; this.MgcPwr - theitem.mgcpwrbonus; this.MgcDef - theitem.mgcdefbonus; } this.LearnedSpell = function(what) { var theSpell = spell_db[what]; this.magic.push(theSpell); } this.KnownSkills = function(what) { var theSkill = skill_db[what]; this.skills.push(theSkill); } } //Initial Values function InitVal(max) { var min = 10; return Math.floor(Math.random()*(max - min) + min); }