예제 #1
0
        private Activity(string name,
                         LocationFeature[] requiredFeatures = null,
                         bool selectable   = true,
                         bool cancellable  = true,
                         Stats statChanges = null,
                         int duration      = 1,
                         Update onComplete = null
                         )
        {
            Name             = name;
            LocationFeatures = requiredFeatures ?? new LocationFeature[] {};
            Selectable       = selectable;
            Cancellable      = cancellable;
            StatChanges      = statChanges ?? new Stats();
            InitialDuration  = duration;
            TicksLeft        = duration;
            OnComplete       = onComplete ?? (hans => { });

            foreach (var stat in (Stat[])Enum.GetValues(typeof(Stat)))
            {
                if (!StatChanges.ContainsKey(stat))
                {
                    StatChanges.Add(stat, DefaultDecay[stat] * duration);
                }
            }
        }
예제 #2
0
        public void TurnEndUpdate(StatChanges changes)
        {
            UpdateMaxHealth(changes.MaxHealthModifier);
            CurrentHealth += changes.CurrentHealthModifier;
            UpdateMaxMana(changes.MaxManaModifier);
            CurrentMana += changes.CurrentManaModifier;
            Position     = changes.Position;

            /*StatModifiers[S] += changes.HealthRegen;
             * ManaRegen += changes.ManaRegen;
             *
             * StrengthModifier += changes.StrengthModifier;
             * DexterityModifier += changes.DexterityModifier;
             * IntellectModifier += changes.IntellectModifier;
             * PhysicalCritChanceModifier += changes.PhysicalCritChanceModifier;
             * MagicalCritChanceModifier += changes.MagicalCritChanceModifier;
             *
             * ConstitutionModifier += changes.ConstitutionModifier;
             * WisdomModifier += changes.WisdomModifier;
             * EvadeModifier += changes.EvadeModifier;
             * BlockModifier += changes.BlockModifier;
             * FireResistenceModifier += changes.FireResistenceModifier;
             * LightningResistenceModifier += changes.LightningResistenceModifier;
             * ColdResistenceModifier += changes.ColdResistenceModifier;
             * MoveModifier += changes.MoveModifier;
             * SpeedModifier += changes.SpeedModifier;
             * JumpModifier += changes.JumpModifier;*/
        }
예제 #3
0
        public void ApplyNerf(StatChanges thisStatChange, int statAmount)
        {
            int totalNerfsOfType = 0;

            foreach (StatChanges statChange in currentStatChanges)
            {
                if (statChange == thisStatChange)
                {
                    totalNerfsOfType++;
                }
            }

            if (totalNerfsOfType < buffMax)
            {
                currentStatChanges.Enqueue(thisStatChange);
                statChangeAmount.Enqueue(statAmount);

                if (currentTimer == 0)
                {
                    currentTimer = timerTotal;
                }

                AddStatChange(thisStatChange, statAmount, GetComponent <PlayerStats>());
            }
        }
예제 #4
0
    public BaseStatusEffects(int id, string name, string description,
                             int applyPercent, int effectDmg, int stayPercent, int minTurn, int maxTurn,
                             StatChanges statChange1, int statMulti1, StatChanges statChange2, int statMulti2)
    {
        this.StatusEffectName        = name;
        this.StatucEffectDescription = description;
        this.StatusEffectID          = id;
        if (applyPercent > 100)
        {
            this.StatusEffectApplyPercent = 1.0f;
        }
        else if (applyPercent < 0)
        {
            this.StatusEffectApplyPercent = 0.0f;
        }
        else
        {
            this.StatusEffectApplyPercent = applyPercent / 100.0f;
        }

        this.StatusEffectDmg = effectDmg;
        if (stayPercent > 100)
        {
            this.StatusEffectStayAppliedPercent = 1.0f;
        }
        else if (stayPercent < 0)
        {
            this.StatusEffectStayAppliedPercent = 0.0f;
        }
        else
        {
            this.StatusEffectStayAppliedPercent = stayPercent / 100.0f;
        }

        this.StatusEffectMinTurns = minTurn;
        this.StatusEffectMaxTurns = maxTurn;
        this.StatChange1          = statChange1;
        if (statMulti1 < 0)
        {
            this.StatChangeMultiple1 = 0.0f;
        }
        else
        {
            this.StatChangeMultiple1 = statMulti1 / 100.0f;
        }
        this.StatChange2 = statChange2;
        if (statMulti2 < 0)
        {
            this.StatChangeMultiple2 = 0.0f;
        }
        else
        {
            this.StatChangeMultiple2 = statMulti2 / 100.0f;
        }
    }
예제 #5
0
        private void AddStatChange(StatChanges stat, int statAmount, PlayerStats target)
        {
            if (stat == StatChanges.Random)
            {
                stat = (StatChanges)UnityEngine.Random.Range(0, 7);
            }

            switch (stat)
            {
            case StatChanges.ArmorBuff:
                target.armor += statAmount;
                break;

            case StatChanges.ArmorNerf:
                target.armor -= statAmount;
                break;

            case StatChanges.StrengthBuff:
                target.strength += statAmount;
                break;

            case StatChanges.StrengthNerf:
                target.strength -= statAmount;
                break;

            case StatChanges.SpeedBuff:
                target.speed += statAmount;
                break;

            case StatChanges.SpeedNerf:
                target.speed -= statAmount;
                break;

            case StatChanges.EvasionBuff:
                target.evasion += statAmount;
                break;

            case StatChanges.EvasionNerf:
                target.evasion -= statAmount;
                break;

            default:
                break;
            }
        }
예제 #6
0
        private void RemoveStatChange(StatChanges stat, int statAmount, PlayerStats target)
        {
            switch (stat)
            {
            case StatChanges.ArmorBuff:
                target.armor -= statAmount;
                break;

            case StatChanges.ArmorNerf:
                target.armor += statAmount;
                break;

            case StatChanges.StrengthBuff:
                target.strength -= statAmount;
                break;

            case StatChanges.StrengthNerf:
                target.strength += statAmount;
                break;

            case StatChanges.SpeedBuff:
                target.speed -= statAmount;
                break;

            case StatChanges.SpeedNerf:
                target.speed += statAmount;
                break;

            case StatChanges.EvasionBuff:
                target.evasion -= statAmount;
                break;

            case StatChanges.EvasionNerf:
                target.evasion += statAmount;
                break;

            default:
                break;
            }
        }
예제 #7
0
        public void OnCharacterAdded(Character character, CombatCharacterManager ccm, Team team)
        {
            switch (team)
            {
            case Team.PC:
                AddPC(character);
                break;

            case Team.NPC:
                AddNPC(character);
                break;

            case Team.Guest:
                AddGuest(character);
                break;
            }

            if (character.CharacterName == "Default")
            {
                foreach (var unit in Units)
                {
                    if (unit.ID == currentID - 1)
                    {
                        unit.BaseCharacter.CharacterName = unit.BaseCharacter.CharacterName + (currentID - 1).ToString();
                        StatChanges changes = new StatChanges();
                        var         pos     = GameManager.CMI.GetNode <Area>("CombatCursor").Translation + Vector3.Up;
                        changes.Position = pos;
                        unit.TurnEndUpdate(changes);
                        ccm.AddCharacter(unit, pos);
                        break;
                    }
                }
            }
            else
            {
            }
        }