Exemplo n.º 1
0
        public override StatsCollection GetFinalStats(IActor forActor)
        {
            if (new StackTrace().FrameCount > 1000)
            {
                throw new Exception("Looks like your about to have a stack overflow.  Are you calling GetFinalStats on an item whose requirements include a Stat check? Maybe switch to BaseStats");
            }

            if (!RequirementsMet(forActor))
            {
                return(new StatsCollection());
            }

            var clone = BaseStats.Clone();

            foreach (var adjective in Adjectives)
            {
                clone.Increase(adjective.GetFinalStats(forActor));
            }

            foreach (var adjective in Adjectives)
            {
                clone = adjective.Modify(clone);
            }

            return(clone);
        }
Exemplo n.º 2
0
        public virtual StatsCollection GetFinalStats(IActor forActor)
        {
            var clone = BaseStats.Clone();

            foreach (var adjective in Adjectives)
            {
                clone.Increase(adjective.GetFinalStats(forActor));
            }

            return(clone);
        }
Exemplo n.º 3
0
        public override void Spawn(Area Area)
        {
            base.Spawn(Area);

            Stats = BaseStats.Clone() as Attributes;
        }
Exemplo n.º 4
0
    public void RecalculateEffectiveStats()
    {
        Debug.Log("Recalculate Effective Stats");

        stats = BaseStats.Clone(actualStats);



        //TODO: positive items should be added in the first round, and then negative items should be added (Should negative items use EffectiveStats for calculations instead of ActualStats like positive items do?)

        //TODO: for some reason, percentage modifiers aren't being added to effective stats---------------------------

        /*foreach(Effect e in staticEffects.effectList){
         * Add(e.GetStatsOfModifier(EffectModifierEnum.positive));
         * Subtract(e.GetStatsOfModifier(EffectModifierEnum.negative));
         * AddPostivePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.positivePercent));
         * AddNegativePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.negativePercent));
         * }
         *
         *
         * foreach(Effect e in toggleEffects.effectList){
         * Add(e.GetStatsOfModifier(EffectModifierEnum.positive));
         * Subtract(e.GetStatsOfModifier(EffectModifierEnum.negative));
         * AddPostivePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.positivePercent));
         * AddNegativePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.negativePercent));
         * }
         *
         * foreach(Effect e in activeEffects.effectList){
         * Add(e.GetStatsOfModifier(EffectModifierEnum.positive));
         * Subtract(e.GetStatsOfModifier(EffectModifierEnum.negative));
         * AddPostivePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.positivePercent));
         * AddNegativePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.negativePercent));
         * }
         *
         * foreach(Effect e in instantEffects.effectList){
         * Add(e.GetStatsOfModifier(EffectModifierEnum.positive));
         * Subtract(e.GetStatsOfModifier(EffectModifierEnum.negative));
         * AddPostivePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.positivePercent));
         * AddNegativePercentage(actualStats, e.GetStatsOfModifier(EffectModifierEnum.negativePercent));
         * }	*/


        //SOFAR: each type and modifier is gone through
        List <Effect> resolvedEffects = new List <Effect>();//maybe a seperate list for each effect type, that way stats first, then damage?

//            Debug.Log("inner most loop");
        resolvedEffects.AddRange(Effect.StackResolveEffects(staticEffects.effectList));
        //Debug.Log("current count is: " + resolvedEffects.Count);
        //TODO: how to view resolved effects easily in unity?
        displayResolvedEffects = resolvedEffects;
        ApplyEffectiveStats(resolvedEffects);



        return;// //////////////////////////////////////////////////////////////////////////////////////


        resolvedEffects = new List <Effect>();
        resolvedEffects.AddRange(Effect.StackResolveEffects(toggleEffects.effectList));
        //TODO: need to actually apply the effects after each group, how?


        resolvedEffects = new List <Effect>();
        resolvedEffects.AddRange(Effect.StackResolveEffects(activeEffects.effectList));
        //TODO: need to actually apply the effects after each group, how?


        resolvedEffects = new List <Effect>();
        resolvedEffects.AddRange(Effect.StackResolveEffects(instantEffects.effectList));
        //TODO: need to actually apply the effects after each group, how?
    }