public int GetSaveValue(OSRIC_CLASS oc, OSRIC_SAVING_THROWS ost, int level) { RPGBaseTable<int> curSaveTable = SaveDict[oc]; int levelIndex=0; for(int i = 0; i<curSaveTable.IntYIndex.Length();i++) if(level<=curSaveTable.IntYIndex.ValueAtIndex(i)) { levelIndex = i; break; } switch(ost) { case OSRIC_SAVING_THROWS.saveRoSaWa: return curSaveTable.GetValue("aimed_magic_items",levelIndex); case OSRIC_SAVING_THROWS.saveBreath: return curSaveTable.GetValue("breath_weapons",levelIndex); case OSRIC_SAVING_THROWS.saveDeath: return curSaveTable.GetValue("death_paralysis_poison",levelIndex); case OSRIC_SAVING_THROWS.savePetPoly: return curSaveTable.GetValue("petrifaction_polymorph",levelIndex); case OSRIC_SAVING_THROWS.saveSpell: return curSaveTable.GetValue("spells",levelIndex); default: return 10; } }
public OSRICAttributeModel(RPGCharacterModel _cm, JSONObject _jo) { cm = _cm; CharacterModifiers = new OSRICModifierCollection(); characterName = _jo["characterName"].str; Str = (int)_jo["Str"].n; Dex = (int)_jo["Dex"].n; Con = (int)_jo["Con"].n; Int = (int)_jo["Int"].n; Wis = (int)_jo["Wis"].n; Cha = (int)_jo["Cha"].n; hitPoints = (int)_jo["hitPoints"].n; string[] levelStr = _jo["level"].str.Split('/'); level = new int[levelStr.Length]; for(int i=0; i<levelStr.Length; i++) level[i] = Int32.Parse(levelStr[i]); experiencePoints = (int)_jo["experiencePoints"].n; vision = (int)_jo["vision"].n; move = (int)_jo["move"].n; characterGender = OSRICConstants.GetEnum<OSRIC_GENDER>(_jo["characterGender"].str); characterRace = OSRICConstants.GetEnum<OSRIC_RACE>(_jo["characterRace"].str); characterClass = OSRICConstants.GetEnum<OSRIC_CLASS>(_jo["characterClass"].str); characterAlignment = OSRICConstants.GetEnum<OSRIC_ALIGNMENT>(_jo["characterAlignment"].str); characterState = OSRICConstants.GetEnum<OSRIC_CHARACTER_STATE>(_jo["characterState"].str); foreach(JSONObject obj in _jo["CharacterModifiers"].list) CharacterModifiers.Add(new OSRICCharacterModifier(obj)); }
public void UpdateCharacterOptions(CharacterOptionCollection coc) { //OSRICEngine.RemoveRaceAdjustments(this);//if we really need to call function on the engine from here we're probably in trouble and need to rethink a few things this.ClearRacialModifiers();//this works now without engine call like above characterName = coc.charName; characterRace = coc.charRace; OSRICEngine.AddRaceAdjustments(this,characterRace); characterAlignment = coc.charAlignment; characterGender = coc.charGender; characterClass = coc.charClass; string strout = "Current Modifiers: "; foreach(OSRICCharacterModifier ocm in CharacterModifiers.ModifierList) { strout += ocm.attribute.GetDesc() + " | "; } // Debug.Log(strout); BroadcastRacialAttributeDidChange(); BroadcastAttributeModelDidChange (); }
public int RollHitPoints(OSRIC_CLASS oc,int bonus,int _minHPthreshhold) { int accumulator,die,temp; accumulator = die = temp = 0; string[] classString = oc.GetDesc().Split('/'); for(int i = 0;i<classString.Length;i++) { die = OSRICConstants.ClassHitDie[classString[i]]; temp = UnityEngine.Random.Range(1,die) + bonus; accumulator += (int)(temp/classString.Length); } if(accumulator >= _minHPthreshhold) return accumulator; else return RollHitPoints(oc,bonus,_minHPthreshhold); }
public int GetClassMaxByRace(OSRIC_RACE _or, OSRIC_CLASS _oc) { int yindex = raceMinMax.GetYIndexOf(_or.GetDesc()); if(yindex<0) return 0; try { return raceMinMax.GetValue(_oc.GetDesc(),yindex); } catch { return 0; } }
public void SetSelectedValue(OSRIC_CLASS oc) { int selected = GetOptionPosition(oc.GetDesc()); if(selected>-1) drop.value = selected; }
public void SetOptionsAndSelected(HashSet<OSRIC_CLASS> inSet, OSRIC_CLASS selected) { this.SetOptions(inSet); this.SetSelectedValue(selected); }
private int GetNextLevelTarget(OSRIC_CLASS _oc, int _level) { int[] clAr = ClassLevels[_oc]; if((_level-1)<clAr.Length) return clAr[_level]; if(_level<clAr.Length && (!UpperLevelTargets.ContainsKey(_oc))) return 0; int remainder = _level - clAr.Length; return clAr[clAr.Length-1] + (remainder*UpperLevelTargets[_oc]); }
private int GetClassLevel(OSRIC_CLASS _oc, OSRIC_RACE _or, int _xp ) { if(!ClassLevels.ContainsKey(_oc)) return -1; int[] classArr = ClassLevels[_oc]; int maxLev = engine.GetClassMaxByRace(_or,_oc); for(int i=0; i < classArr.Length;i++) if(_xp<classArr[i]) { int nextLev = i+1; Debug.Log("Next Level: " + nextLev.ToString()); if(nextLev<maxLev) return nextLev; return maxLev; } if(!UpperLevelTargets.ContainsKey(_oc)) return classArr.Length; int remainder = _xp - classArr[classArr.Length-1]; int newLevel = remainder/UpperLevelTargets[_oc] + classArr.Length; if(newLevel>maxLev) return maxLev; return newLevel; }