Exemplo n.º 1
0
        private void DoSuperBody(byte nSLV)
        {
            var tDurationMillis = 60000;
            int superBodySkillID;

            // set only if-statements instead of else-if statements if we enable stackable auras
            if (Parent.Buffs.Contains((int)Skills.BMAGE_AURA_BLUE) || Parent.Buffs.Contains((int)Skills.BMAGE_AURA_BLUE_ADVANCED))
            {
                tDurationMillis  = 10000;
                superBodySkillID = (int)Skills.BMAGE_SUPER_BODY_BLUE;
            }
            else if (Parent.Buffs.Contains((int)Skills.BMAGE_AURA_DARK) || Parent.Buffs.Contains((int)Skills.BMAGE_AURA_DARK_ADVANCED))
            {
                superBodySkillID = (int)Skills.BMAGE_SUPER_BODY_DARK;
            }
            else if (Parent.Buffs.Contains((int)Skills.BMAGE_AURA_YELLOW) || Parent.Buffs.Contains((int)Skills.BMAGE_AURA_YELLOW_ADVANCED))
            {
                superBodySkillID = (int)Skills.BMAGE_SUPER_BODY_YELLOW;
            }
            else
            {
                throw new InvalidOperationException("Trying to cast super body when no auras are active.");
            }

            var auraBoost = new BuffSkill(superBodySkillID, nSLV);

            auraBoost.GenerateAuraSkill(SecondaryStatFlag.SuperBody, tDurationMillis);
            Parent.Buffs.Add(auraBoost);
        }
Exemplo n.º 2
0
        public void AddAura(SecondaryStatFlag nType, int dwCharIdFrom, int nAuraSkillID, int nAuraLevel)
        {
            // TODO fuse removal logic with SecondaryStatValues class
            AbstractBuff existingBuff = null;

            foreach (var buff in this)
            {
                if (buff.StatType == nType)
                {
                    if (nAuraSkillID == buff.nSkillID)
                    {
                        if (buff.nSLV >= nAuraLevel)
                        {
                            return;
                        }
                    }
                    existingBuff = buff;
                    break;
                }
            }

            Remove(existingBuff);

            // client expects two packets, so we generate two but only save one (cuz cant save same key twice)
            var auraBuff = new BuffSkill(nAuraSkillID, (byte)nAuraLevel);

            auraBuff.GenerateAuraSkill(SecondaryStatFlag.Aura);
            Parent.Buffs.Add(auraBuff);

            auraBuff.Stat.Clear();             // recycling ftw
            auraBuff.dwCharFromId = dwCharIdFrom;

            auraBuff.GenerateAuraSkill(nType);
            Parent.Buffs.Add(auraBuff);
            auraBuff.Stat.Add(SecondaryStatFlag.Aura,
                              new SecondaryStatEntry
            {
                nValue = nAuraSkillID,
                rValue = nAuraLevel,
                tValue = -1000,
            });
        }