示例#1
0
    /// <summary>
    /// 获得buff
    /// </summary>
    /// <param name="buffType"></param>
    /// <param name="existTime"></param>
    public void GetBuff(Buff.BuffType buffType, float existTime)
    {
        int index = CheckBuff(buffType);

        if (index == -1)
        {
            GameObject go = Instantiate(_buffPrefab, _buffPos.position, Quaternion.identity) as GameObject;
            go.GetComponent <Buff>().UpdateInformation(buffType, existTime);
            buffList.Add(buffType);
        }
        else
        {
            GameObject[] buffs = GameObject.FindGameObjectsWithTag(Tags.buffIcon);
            for (int i = 0; i < buffs.Length; i++)
            {
                if (buffs[i].GetComponent <Buff>()._buffType == buffType)
                {
                    buffs[i].GetComponent <AutoReduce>().DestroyBuffIcon(false);
                    buffList.RemoveAt(index);
                }
            }
            GameObject go = Instantiate(_buffPrefab, _buffPos.position, Quaternion.identity) as GameObject;
            go.GetComponent <Buff>().UpdateInformation(buffType, existTime);
            buffList.Add(buffType);
        }
    }
示例#2
0
    public Buff(
        int _id,
        string _name,
        Buff.BuffType _type,
        int _roundNum,
        bool _bool_Now,
        bool _bool_EveryRound,
        int _energy_ChangeVal,
        int _san_ChangeVal,
        PerformBuffName _performBuff,
        string _spineFileName,
        string _imageFileName
        )
    {
        this.id            = _id;
        this.name          = _name;
        this.type          = _type;
        this.roundNum      = _roundNum;
        this.performBuff   = _performBuff;
        this.spineFileName = _spineFileName;
        this.imageFileName = _imageFileName;

        this.staminaValue = _energy_ChangeVal;
        this.sanValue     = _san_ChangeVal;

        if (_bool_Now)
        {
            this.createdEvent += this.ChangePlayerActorValueOnce;
        }
        if (_bool_EveryRound)
        {
            this.roundEndEvent += this.ChangePlayerActorValue;
        }
        else
        {
            this.expiredEvent += this.ChangePlayerActorValue;
        }

        switch (_performBuff)
        {
        case PerformBuffName.stop_Round:
            this.roundStartEvent += this.PerformStopRound;
            break;

        case PerformBuffName.effect_Halved:
            this.sanChangeEvent     += this.PerformEffectHalved;
            this.staminaChangeEvent += this.PerformEffectHalved;
            break;

        case PerformBuffName.doubling_Effect:
            this.sanChangeEvent     += this.PerformDoublingEffect;
            this.staminaChangeEvent += this.PerformDoublingEffect;
            break;

        case PerformBuffName.none:
        default:
            break;
        }
    }
示例#3
0
 public void LoadBuffs(CharacterCalculationsBase currentCalculations, Buff.BuffType buffType, bool activeOnly)
 {
     if (Items != null && Character != null)
     {
         comparisonGraph1.RoundValues      = true;
         comparisonGraph1.CustomRendered   = false;
         comparisonGraph1.ItemCalculations = Calculations.GetBuffCalculations(Character, currentCalculations, buffType, activeOnly).ToArray();
         comparisonGraph1.EquipSlot        = Character.CharacterSlot.None;
     }
 }
示例#4
0
        public void AddBuff(string key, float value, float expire, Buff.BuffType buffType)
        {
            var buff = new Buff
            {
                Stat   = key,
                Value  = value,
                Expire = expire,
                Type   = buffType
            };

            AddBuff(buff);
        }
示例#5
0
    public int CheckBuff(Buff.BuffType buffType)
    {
        int length = buffList.Count;

        for (int i = 0; i < length; i++)
        {
            if (buffList[i] == buffType)
            {
                return(i);
            }
        }
        return(-1);
    }
    public void AddBuff(Buff.BuffType buff)
    {
        if (buff == Buff.BuffType.Speed)
        {
            SpeedBuffTimer.Value = Time.time + 10;
        }

        if (buff == Buff.BuffType.Rotate)
        {
            RotateBuffTimer.Value = Time.time + 10;
        }

        if (buff == Buff.BuffType.Triple)
        {
            TripleShotTimer.Value = Time.time + 10;
        }

        if (buff == Buff.BuffType.Double)
        {
            DoubleShotTimer.Value = Time.time + 10;
        }

        if (buff == Buff.BuffType.Health)
        {
            Health.Value += 20;
            if (Health.Value >= 100)
            {
                Health.Value = 100;
            }
        }

        if (buff == Buff.BuffType.Energy)
        {
            Energy.Value += 50;
            if (Energy.Value >= 100)
            {
                Energy.Value = 100;
            }
        }

        if (buff == Buff.BuffType.QuadDamage)
        {
            QuadDamageTimer.Value = Time.time + 10;
        }

        if (buff == Buff.BuffType.Bounce)
        {
            QuadDamageTimer.Value = Time.time + 10;
        }
    }
示例#7
0
    public void CreateBuff(Buff.BuffType type, float existTime)
    {
        foreach (AutoReduce buff in _buffs)
        {
            if (buff._buff._buffType == type)
            {
                existTime = buff._restTime > existTime ? buff._restTime : existTime;
                RemoveBuff(buff);
                break;
            }
        }

        switch (type)
        {
        case Buff.BuffType.slow:
            InstantiateBuff(new SlowBuff(existTime));
            break;
        }
    }
 public void AddBuff(Buff.BuffType type, float existTime)
 {
     _buffs.CreateBuff(type, existTime);
 }
示例#9
0
        public virtual List <ComparisonCalculationBase> GetBuffCalculations(Character character, CharacterCalculationsBase currentCalcs, Buff.BuffType buffType, bool activeOnly)
        {
            ClearCache();
            List <ComparisonCalculationBase> buffCalcs       = new List <ComparisonCalculationBase>();
            CharacterCalculationsBase        calcsEquipped   = null;
            CharacterCalculationsBase        calcsUnequipped = null;
            Character charAutoActivated = character.Clone();

            foreach (Buff autoBuff in currentCalcs.AutoActivatedBuffs)
            {
                if (!charAutoActivated.ActiveBuffs.Contains(autoBuff))
                {
                    charAutoActivated.ActiveBuffs.Add(autoBuff);
                    RemoveConflictingBuffs(charAutoActivated.ActiveBuffs, autoBuff);
                }
            }
            charAutoActivated.DisableBuffAutoActivation = true;
            foreach (Buff buff in Buff.GetBuffsByType(buffType))
            {
                if (!activeOnly || charAutoActivated.ActiveBuffs.Contains(buff))
                {
                    Character charUnequipped = charAutoActivated.Clone();
                    Character charEquipped   = charAutoActivated.Clone();
                    charUnequipped.DisableBuffAutoActivation = true;
                    charEquipped.DisableBuffAutoActivation   = true;
                    if (charUnequipped.ActiveBuffs.Contains(buff))
                    {
                        charUnequipped.ActiveBuffs.Remove(buff);
                    }
                    if (string.IsNullOrEmpty(buff.RequiredBuff))
                    {
                        //if (charUnequipped.ActiveBuffs.Contains("Improved " + buff.Name))
                        //	charUnequipped.ActiveBuffs.Remove("Improved " + buff.Name);
                        charUnequipped.ActiveBuffs.RemoveAll(x => x.Name == "Improved " + buff.Name);
                    }
                    else
                    {
                        //if (charUnequipped.ActiveBuffs.Contains(buff.RequiredBuff))
                        //	charUnequipped.ActiveBuffs.Remove(buff.RequiredBuff);
                        charUnequipped.ActiveBuffs.RemoveAll(x => x.Name == buff.RequiredBuff);
                    }

                    if (!charEquipped.ActiveBuffs.Contains(buff))
                    {
                        charEquipped.ActiveBuffs.Add(buff);
                    }
                    if (string.IsNullOrEmpty(buff.RequiredBuff))
                    {
                        //if (charEquipped.ActiveBuffs.Contains("Improved " + buff.Name))
                        //	charEquipped.ActiveBuffs.Remove("Improved " + buff.Name);
                        charEquipped.ActiveBuffs.RemoveAll(x => x.Name == "Improved " + buff.Name);
                    }
                    else
                    {
                        //if (!charEquipped.ActiveBuffs.Contains(buff.RequiredBuff))
                        //	charEquipped.ActiveBuffs.Add(buff.RequiredBuff);
                        Buff requiredBuff = Buff.GetBuffByName(buff.RequiredBuff);
                        if (!charEquipped.ActiveBuffs.Contains(requiredBuff))
                        {
                            charEquipped.ActiveBuffs.Add(requiredBuff);
                        }
                    }

                    RemoveConflictingBuffs(charEquipped.ActiveBuffs, buff);
                    RemoveConflictingBuffs(charUnequipped.ActiveBuffs, buff);

                    calcsUnequipped = GetCharacterCalculations(charUnequipped);
                    calcsEquipped   = GetCharacterCalculations(charEquipped);

                    ComparisonCalculationBase buffCalc = CreateNewComparisonCalculation();
                    buffCalc.Name = buff.Name;
                    buffCalc.Item = new Item()
                    {
                        Name = buff.Name, Stats = buff.Stats, Quality = Item.ItemQuality.Temp
                    };
                    buffCalc.Equipped      = charAutoActivated.ActiveBuffs.Contains(buff);
                    buffCalc.OverallPoints = calcsEquipped.OverallPoints - calcsUnequipped.OverallPoints;
                    float[] subPoints = new float[calcsEquipped.SubPoints.Length];
                    for (int i = 0; i < calcsEquipped.SubPoints.Length; i++)
                    {
                        subPoints[i] = calcsEquipped.SubPoints[i] - calcsUnequipped.SubPoints[i];
                    }
                    buffCalc.SubPoints = subPoints;
                    buffCalcs.Add(buffCalc);
                }
            }
            return(buffCalcs);
        }
示例#10
0
 public static List <ComparisonCalculationBase> GetBuffCalculations(Character character, CharacterCalculationsBase currentCalcs, Buff.BuffType buffType, bool activeOnly)
 {
     return(Instance.GetBuffCalculations(character, currentCalcs, buffType, activeOnly));
 }