ACR_BuilderPlugin.CreatureHelper.SetCreatureHitPoints C# (CSharp) Méthode

SetCreatureHitPoints() public static méthode

public static SetCreatureHitPoints ( NWN2CreatureTemplate creature, HPType hpType ) : void
creature NWN2CreatureTemplate
hpType HPType
Résultat void
        public static void SetCreatureHitPoints(NWN2CreatureTemplate creature, HPType hpType)
        {
            // Check for blacklisting.
            if (creature.Variables.GetVariable("ABP_SETHP_OVERRIDE").ValueInt > 0) hpType = (CreatureHelper.HPType)creature.Variables.GetVariable("ABP_SETHP_OVERRIDE").ValueInt;
            if (hpType == CreatureHelper.HPType.Ignore) return;

            // Find the new HP.
            short newHP = 0;
            switch (hpType)
            {
                case CreatureHelper.HPType.PenAndPaper: newHP = CreatureHelper.GetHitPointsPNP(creature); break;
                case CreatureHelper.HPType.Maximum: newHP = CreatureHelper.GetHitPointsMax(creature); break;
                default: return;
            }

            // And set it.
            creature.BaseHitPoints = newHP;
            creature.CurrentHitPoints = newHP;
            creature.CharsheetHitPoints = newHP;
        }