Exemple #1
0
    public int SkillCheck(bool active, Proficiencies.Skill skill, bool advantage = false, bool disadvatnage = false)
    {
        // Don't compare with the challenge rating in here because we may be rolling to create the challenge rating (e.g. trying to hide or bluff)

        bool proficient        = Me.Stats.Skills.Contains(skill);
        bool expertise         = Me.Stats.ExpertiseInSkills.Contains(skill);
        int  proficiency_bonus = expertise ? Me.Stats.ProficiencyBonus * 2 : Me.Stats.ProficiencyBonus;
        int  attribute_bonus   = Me.Stats.GetAdjustedAttributeModifier(Proficiencies.Instance.GetAttributeForSkill(skill));
        int  bonus             = proficient ? proficiency_bonus + attribute_bonus : attribute_bonus;

        int roll = active ? RollDie(20, 1, advantage, disadvatnage) : 10;

        return(roll + bonus);
    }
Exemple #2
0
    public bool OpposedSkillCheck(Proficiencies.Skill _skill, Actor _target, bool _advantage = false, bool _disadvantage = false)
    {
        int skill_check      = 0;
        int challenge_rating = 0;

        switch (_skill)
        {
        case Proficiencies.Skill.Deception:
            skill_check      = DeceptionCheck(true, _advantage, _disadvantage);
            challenge_rating = _target.Me.Stats.WisdomCheck();
            Debug.Log("Deception Skill check: " + skill_check + " vs Challenge Rating: " + challenge_rating);
            return(skill_check > challenge_rating);

        case Proficiencies.Skill.Insight:
            skill_check      = InsightCheck(true, _advantage, _disadvantage);
            challenge_rating = Mathf.Max(15, _target.Me.Actions.SkillCheck(true, Proficiencies.Skill.Deception, _advantage, _disadvantage));
            Debug.Log("Insight Skill check: " + skill_check + " vs Challenge Rating: " + challenge_rating);
            return(skill_check > challenge_rating);

        case Proficiencies.Skill.Intimidation:
            skill_check      = IntimidationCheck(true, _advantage, _disadvantage);
            challenge_rating = _target.Me.Stats.WisdomCheck();
            Debug.Log("Intimidation Skill check: " + skill_check + " vs Challenge Rating: " + challenge_rating);
            return(skill_check > challenge_rating);

        case Proficiencies.Skill.Investigation:
            return(Me.Senses.InvestigationCheck(true, Mathf.Max(15, _target.Me.Actions.SkillCheck(true, Proficiencies.Skill.Deception, _advantage, _disadvantage)), _advantage, _disadvantage));

        case Proficiencies.Skill.Perception:
            return(Me.Senses.PerceptionCheck(true, Mathf.Max(15, _target.Me.Actions.SkillCheck(true, Proficiencies.Skill.Deception, _advantage, _disadvantage)), _advantage, _disadvantage));

        case Proficiencies.Skill.Persuasion:
            skill_check      = PersuasionCheck(true, _advantage, _disadvantage);
            challenge_rating = _target.Me.Stats.WisdomCheck();
            Debug.Log("Persuasion Skill check: " + skill_check + " vs Challenge Rating: " + challenge_rating);
            return(skill_check > challenge_rating);
        }
        Debug.Log("Opposed skill check for unhandle skill: " + _skill);
        return(false);
    }