public void AdjustAttribute(Proficiencies.Attribute attribute, int adjustment) { if (AttributeAdjustments[attribute] < adjustment) { AttributeAdjustments[attribute] = adjustment; // TODO: recalculate hit points and armor class if appropriate } }
public bool SavingThrow(Proficiencies.Attribute attribute, int challenge_rating, bool advantage = false, bool disadvantage = false) { int proficiency_bonus = Me.Stats.SavingThrows.Contains(attribute) ? Me.Stats.ProficiencyBonus : 0; int attribute_bonus = Me.Stats.GetAdjustedAttributeModifier(attribute); int bonus = proficiency_bonus + attribute_bonus; int die_roll = RollDie(20, 1, advantage, disadvantage); return(die_roll + bonus > challenge_rating); }
public int AttributeCheck(bool _active, Proficiencies.Attribute _attribute, bool _advantage = false, bool _disadvatnage = false) { // Don't compare with a challenge rating here, because this may be to create the challenge rating (e.g. a grapple) int proficiency_bonus = Me.Stats.ProficiencyBonus; int attribute_bonus = Me.Stats.GetAdjustedAttributeModifier(_attribute); int roll = _active ? RollDie(20, 1, _advantage, _disadvatnage) : 10; return(roll + attribute_bonus); }
// public // TODO: specify spell_casting_attribute for other spells public void Cast(Actor _target, Proficiencies.Attribute spell_casting_attribute = Proficiencies.Attribute.Intelligence, bool dispel_effect = false) { if (_target == null) { return; } Target = _target; CheckAdvantageAndDisadvantage(); DrawRay(); if (Hit()) { ApplyDamage(); GameObject _impact = Instantiate(SpellEffects.Instance.physical_strike_prefab, Target.transform.position, SpellEffects.Instance.physical_strike_prefab.transform.rotation); _impact.name = "Impact"; Destroy(_impact, 3f); } }
public int GetAdjustedAttributeModifier(Proficiencies.Attribute attribute) { return(Mathf.Clamp((GetAdjustedAttribute(attribute) - 10) / 2, -5, 10)); }
public int GetAdjustedAttribute(Proficiencies.Attribute attribute) { return(Mathf.Clamp(Attributes[attribute] + AttributeAdjustments[attribute], 0, 30)); }