private void UpdateExpiriencePoints(int expPoints) { int level = CharacterValuesUtility.CalculateLevel(expPoints); characterHolder.levelText.text = level.ToString(); characterHolder.expirienceProgress.value = CharacterValuesUtility.CalculateLevelProgress(expPoints); characterHolder.expirienceText.text = String.Format("{0}/{1}", expPoints.ToString(), CharacterValuesUtility.GetPointsByLevel(level + 1).ToString()); }
private void ResetHitDices() { var sheet = characterSheetController.Character; int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); int restoredDiceCount = Mathf.CeilToInt(level / 2f); int diceCount = sheet.HitDiceCount + restoredDiceCount; sheet.HitDiceCount = Mathf.Min(level, diceCount); }
private void SetHits() { var sheet = characterSheetController.Character; int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); int constitutionModificator = CharacterValuesUtility.GetCharacteristicModificator(sheet[CharacteristicType.Constitution]); int wholeMaxHits = sheet.MaxHits + level * constitutionModificator; characterHolder.hitsValueText.text = TextUtility.GetValueAndMaxString(sheet.CurrentHits, wholeMaxHits); }
private void SetPassivePerception() { var sheet = characterSheetController.Character; int result = 10 + CharacterValuesUtility.GetCharacteristicModificator(sheet[CharacteristicType.Wisdom]); if ((sheet.PersonalSkills & SkillType.Perception) == SkillType.Perception) { int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); result += CharacterValuesUtility.GetMasteryBonus(level); } characterHolder.passivePerceptionValueText.text = result.ToString(); }
private void SetHitDices() { var sheet = characterSheetController.Character; characterHolder.diceTypeText.text = TextUtility.GetDiceValueString(1, CharacterUtility.GetDiceTypeByClass(sheet.Type)); int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); if (sheet.HitDiceCount > level) { sheet.HitDiceCount = level; } characterHolder.dicesValueText.text = TextUtility.GetValueAndMaxString(sheet.HitDiceCount, level); }
private void SetSkillModificator(SkillHolder skillHolder) { var sheet = characterSheetController.Character; var skillCharacteristic = CharacterUtility.GetCharacteristicBySkill(skillHolder.type); int characteristicValue = sheet[skillCharacteristic]; bool isOwned = (sheet.PersonalSkills & skillHolder.type) == skillHolder.type; int modificator = CharacterValuesUtility.GetCharacteristicModificator(characteristicValue); if (isOwned) { int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); modificator += CharacterValuesUtility.GetMasteryBonus(level); } skillHolder.valueText.text = TextUtility.GetSignedValueString(modificator); skillHolder.toggleButton.isOn = isOwned; }
private void SetSavingThrowModificator(SavingThrowHolder savingThrow) { var sheet = characterSheetController.Character; int characteristicValue = sheet[savingThrow.characteristic]; int modificator = CharacterValuesUtility.GetCharacteristicModificator(characteristicValue); var baseSavingThrows = CharacterUtility.GetSavingThrowsByClass(sheet.Type); bool isOwned = baseSavingThrows.Contains(savingThrow.characteristic); if (isOwned) { int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); modificator += CharacterValuesUtility.GetMasteryBonus(level); } savingThrow.valueText.text = TextUtility.GetSignedValueString(modificator); savingThrow.toggle.isOn = isOwned; }
public void Show(CharacterSheet sheet, OnValidateInput onValidate) { currentHitsInputField.text = sheet.CurrentHits.ToString(); maxHitsInputField.text = sheet.MaxHits.ToString(); int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); int constitutionModificator = CharacterValuesUtility.GetCharacteristicModificator(sheet[CharacteristicType.Constitution]); bonusHitsText.text = TextUtility.GetSignedValueString(level * constitutionModificator); okButton.onClick.AddListener(() => { OnOkPressed?.Invoke(currentHitsInputField.text, maxHitsInputField.text); Destroy(this.gameObject); }); cancelButton.onClick.AddListener(() => { OnCancelPressed?.Invoke(currentHitsInputField.text, maxHitsInputField.text); Destroy(this.gameObject); }); }
public CharacterSheet(Guid id) { Id = id; CreatedDate = DateTime.Now; playerName = defaultName; characteristics = new Dictionary <CharacteristicType, int>(); foreach (CharacteristicType type in Enum.GetValues(typeof(CharacteristicType))) { characteristics.Add(type, 0); } type = CharacterType.Fighter; race = RaceType.Human; expiriencePoints = 0; personalSkills = SkillType.None; armorClass = 0; currentHits = 0; maxHits = 0; hitDiceCount = CharacterValuesUtility.CalculateLevel(expiriencePoints); deathSuccessCount = 0; deathFailureCount = 0; }
private void HandleHitsInputs(string currentHitsText, string maxHitsText) { var sheet = characterSheetController.Character; if (!Int32.TryParse(currentHitsText, out int currentHits)) { currentHits = sheet.CurrentHits; } if (!Int32.TryParse(maxHitsText, out int maxHits)) { maxHits = sheet.MaxHits; } int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); int constitutionModificator = CharacterValuesUtility.GetCharacteristicModificator(sheet[CharacteristicType.Constitution]); int wholeMaxHits = maxHits + level * constitutionModificator; currentHits = Mathf.Min(currentHits, wholeMaxHits); sheet.CurrentHits = currentHits; sheet.MaxHits = maxHits; // update new value on UI characterHolder.hitsValueText.text = TextUtility.GetValueAndMaxString(currentHits, wholeMaxHits); }
private void SetHitDicesCount(CharacterSheet sheet) { int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints); diceCountValueText.text = TextUtility.GetValueAndMaxString(sheet.HitDiceCount, level); }
private void SetMasteryBonus(int expPoints) { int level = CharacterValuesUtility.CalculateLevel(expPoints); characterHolder.masteryBonusValueText.text = TextUtility.GetSignedValueString(CharacterValuesUtility.GetMasteryBonus(level)); }