示例#1
0
    private void SetCharacteristic(CharacteristicType type, int statValue)
    {
        characterHolder.GetCharacteristicInput(type).text = statValue.ToString();
        int modificator = CharacterValuesUtility.GetCharacteristicModificator(statValue);

        characterHolder.GetCharacteristicModificatorText(type).text = TextUtility.GetSignedValueString(modificator);
    }
示例#2
0
    private void SetInitiative()
    {
        var sheet = characterSheetController.Character;
        int initiativeModificator = CharacterValuesUtility.GetCharacteristicModificator(sheet[CharacteristicType.Dexterity]);

        characterHolder.initiativeValueText.text = TextUtility.GetSignedValueString(initiativeModificator);
    }
示例#3
0
    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);
    }
示例#4
0
    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 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;
    }
示例#6
0
    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;
    }
示例#7
0
    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);
        });
    }
示例#8
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);
    }