示例#1
0
文件: RpgValues.cs 项目: XCVG/quattro
        public static void SkillsFromStats(StatsSet baseStats, StatsSet derivedStats)
        {
            //derive skill values from base stats if you want to; you should never modify baseStats, and ADD to the skills on derivedStats

            //basically for testing; I had no plans to implement this in Ascension III
            //derivedStats.Skills[(int)SkillType.Melee] += derivedStats.Stats[(int)StatType.Resilience] * 100;
        }
示例#2
0
        private void RecalculateStats()
        {
            //copy base stats
            DerivedStats = new StatsSet(BaseStats);

            //apply conditions
            foreach (Condition c in Conditions)
            {
                c.Apply(BaseStats, DerivedStats);
            }

            //apply equipment bonuses (armor basically)
            if (Equipped.ContainsKey(EquipSlot.Body))
            {
                ArmorItemModel aim = Equipped[EquipSlot.Body].ItemModel as ArmorItemModel;
                if (aim != null)
                {
                    foreach (var key in BaseStats.DamageResistance.Keys)
                    {
                        if (aim.DamageResistance.ContainsKey((DamageType)key))
                        {
                            DerivedStats.DamageResistance[key] = BaseStats.DamageResistance[key] + aim.DamageResistance[(DamageType)key];
                        }
                        if (aim.DamageThreshold.ContainsKey((DamageType)key))
                        {
                            DerivedStats.DamageThreshold[key] = BaseStats.DamageThreshold[key] + aim.DamageThreshold[(DamageType)key];
                        }
                    }
                }
                else
                {
                    Debug.LogWarning("Player has non-armor item in armor slot!");
                }
            }

            //apply derived skills
            if (GameParams.UseDerivedSkills)
            {
                RpgValues.SkillsFromStats(BaseStats, DerivedStats);
            }

            //recalculate max health and energy
            DerivedStats.MaxHealth = RpgValues.MaxHealth(this);
            DerivedStats.MaxEnergy = RpgValues.MaxEnergy(this);

            //apply endurance from difficulty
            float endurance = ConfigState.Instance.GetGameplayConfig().Difficulty.PlayerEndurance;

            DerivedStats.MaxHealth *= endurance;
            DerivedStats.MaxEnergy *= endurance;
        }
示例#3
0
        public CharacterModel() //TODO with a model base parameter
        {
            HealthFraction = 1.0f;
            Level          = 1;

            Inventory      = new InventoryModel();
            Conditions     = new List <Condition>();
            Equipped       = new Dictionary <EquipSlot, InventoryItemInstance>();
            AmmoInMagazine = new Dictionary <EquipSlot, int>();
            ExtraData      = new Dictionary <string, object>();

            //create blank stats and derive stats
            BaseStats = new StatsSet();
            RecalculateStats();
        }
示例#4
0
 public static void SkillsFromStats(StatsSet baseStats, StatsSet derivedStats) => SkillsFromStatsImpl(baseStats, derivedStats);