Beispiel #1
0
        public void HandleBuffStateAdded(string id, VBuff buff)
        {
            BuffStateData buffStateData = ModelFactory.GetBuffStateData(id);
            VBSBase       buffState     = VBSBase.Create(buffStateData.type);

            buffState.Init(id, buff, this);
            this._buffStates[id] = buffState;
        }
Beispiel #2
0
 internal void OnDestroy()
 {
     this.EliminateAttrs();
     this.DestroyInternal();
     this.Reset();
     this.skillData = null;
     this.buff.RedRef();
     this.buff = null;
     this.owner.RedRef();
     this.owner = null;
     this._data = null;
 }
Beispiel #3
0
 internal void OnDestroy()
 {
     this.DestroyInternal();
     this.Reset();
     if (this._fxs != null)
     {
         int count = this._fxs.Count;
         for (int i = 0; i < count; i++)
         {
             this._fxs[i].markToDestroy = true;
         }
         this._fxs.Clear();
         this._fxs = null;
     }
     this.owner = null;
     this.buff  = null;
     this._data = null;
 }
Beispiel #4
0
        internal void CreateBuffState(string id, Buff buff)
        {
            BuffStateData buffStateData = ModelFactory.GetBuffStateData(id);

            //有免疫限制技能的属性,并且将要产生的state是限制类型,则不会生效
            if (this.property.immuneDisables > 0 &&
                buffStateData.beneficialType == BeneficialType.Debuff)
            {
                return;
            }

            bool create = true;

            if (buffStateData.overlapType == BuffStateOverlapType.Replace ||
                buffStateData.overlapType == BuffStateOverlapType.Unique)
            {
                BSBase bs = this.GetBuffState(id);
                if (bs != null)
                {
                    switch (buffStateData.overlapType)
                    {
                    case BuffStateOverlapType.Replace:
                        this.DestroyBuffStateImmediately(bs);
                        break;

                    case BuffStateOverlapType.Unique:
                        bs.Unite();
                        create = false;
                        break;
                    }
                }
            }
            if (create)
            {
                SyncEventHelper.BuffStateAdded(this.rid, id, buff.rid);
                BSBase buffState = BSBase.Create(buffStateData.type);
                buffState.Init(id, this, buff);
                this._buffStates.Add(buffState);
            }
        }
Beispiel #5
0
        internal void Init(string id, VBuff buff, VBio owner)
        {
            this.owner = owner;
            this.buff  = buff;
            this._data = ModelFactory.GetBuffStateData(id);
            int index = Mathf.Min(this.buff.property.lvl, this._data.levels.Length - 1);

            this.duration = this._data.levels[index].duration;
            this.trigger  = this._data.levels[index].trigger;
            this.fxs      = this._data.levels[index].fxs;
            this.attrs    = this._data.levels[index].attrs;
            this.values   = this._data.levels[index].values;
            this.extra    = this._data.levels[index].extra;
            this.extra_s  = this._data.levels[index].extra_s;

            if (this.fxs != null)
            {
                int count = this.fxs.Length;
                for (int i = 0; i < count; i++)
                {
                    Effect mfx = this.owner.battle.CreateEffect(this.fxs[i]);
                    mfx.SetupTerritory(this.buff.caster, this.owner, this.buff.targetPoint);
                    if (mfx.lifeTime <= 0)
                    {
                        if (this._fxs == null)
                        {
                            this._fxs = new List <Effect>();
                        }
                        this._fxs.Add(mfx);
                    }
                }
            }

            this._elapsed = 0f;

            this.CreateInternal();
        }
Beispiel #6
0
        internal void Init(string id, Bio owner, Buff buff)
        {
            this.owner = owner;
            this.owner.AddRef();
            this.buff = buff;
            this.buff.AddRef();
            this.skillData = this.buff.skillData;

            this._data = ModelFactory.GetBuffStateData(id);
            int index = MathUtils.Min(this.buff.property.lvl, this._data.levels.Length - 1);

            this.duration = this._data.levels[index].duration;
            this.trigger  = this._data.levels[index].trigger;
            this.attrs    = this._data.levels[index].attrs;
            this.values   = this._data.levels[index].values;
            this.extra    = this._data.levels[index].extra;

            this._elapsed      = 0f;
            this._triggerIndex = 0;
            this._enable       = true;

            this.CreateInternal();
            this.ApplyAttrs(this.attrs, this.values, false);
        }
Beispiel #7
0
        private static void PreloadBuffs(LoadBatch loader, string[] buffs)
        {
            if (buffs == null)
            {
                return;
            }

            int c2 = buffs.Length;

            for (int i = 0; i < c2; i++)
            {
                BuffData buffData = ModelFactory.GetBuffData(buffs[i]);
                //enter state
                if (buffData.enterStates != null)
                {
                    int c3 = buffData.enterStates.Length;
                    for (int j = 0; j < c3; j++)
                    {
                        string        stateId       = buffData.enterStates[j];
                        BuffStateData buffStateData = ModelFactory.GetBuffStateData(stateId);
                        int           c4            = buffStateData.levels.Length;
                        for (int k = 0; k < c4; k++)
                        {
                            BuffStateData.Level level = buffStateData.levels[k];
                            if (level.fxs == null)
                            {
                                continue;
                            }

                            int c6 = level.fxs.Length;
                            for (int l = 0; l < c6; l++)
                            {
                                EntityData effectData = ModelFactory.GetEntityData(level.fxs[l]);
                                loader.Add(new AssetsLoader("model/" + effectData.model));
                            }

                            if (level.trigger != null &&
                                level.trigger.fxs != null)
                            {
                                int c5 = level.trigger.fxs.Length;
                                for (int l = 0; l < c5; l++)
                                {
                                    string fxId = level.trigger.fxs[l];
                                    if (string.IsNullOrEmpty(fxId))
                                    {
                                        continue;
                                    }
                                    EntityData effectData = ModelFactory.GetEntityData(fxId);
                                    loader.Add(new AssetsLoader("model/" + effectData.model));
                                }
                            }
                        }
                    }
                }

                //trigger state
                if (buffData.triggerStates != null)
                {
                    int c3 = buffData.triggerStates.Length;
                    for (int j = 0; j < c3; j++)
                    {
                        string        stateId       = buffData.triggerStates[j];
                        BuffStateData buffStateData = ModelFactory.GetBuffStateData(stateId);
                        int           c4            = buffStateData.levels.Length;
                        for (int k = 0; k < c4; k++)
                        {
                            BuffStateData.Level level = buffStateData.levels[k];
                            if (level.fxs == null)
                            {
                                continue;
                            }

                            int c6 = level.fxs.Length;
                            for (int l = 0; l < c6; l++)
                            {
                                EntityData effectData = ModelFactory.GetEntityData(level.fxs[l]);
                                loader.Add(new AssetsLoader("model/" + effectData.model));
                            }

                            if (level.trigger != null &&
                                level.trigger.fxs != null)
                            {
                                int c5 = level.trigger.fxs.Length;
                                for (int l = 0; l < c5; l++)
                                {
                                    string fxId = level.trigger.fxs[l];
                                    if (string.IsNullOrEmpty(fxId))
                                    {
                                        continue;
                                    }
                                    EntityData effectData = ModelFactory.GetEntityData(fxId);
                                    loader.Add(new AssetsLoader("model/" + effectData.model));
                                }
                            }
                        }
                    }
                }

                if (buffData.levels != null)
                {
                    int c3 = buffData.levels.Length;
                    for (int k = 0; k < c3; k++)
                    {
                        BuffData.Level buffLevel = buffData.levels[k];

                        if (!string.IsNullOrEmpty(buffLevel.fx))
                        {
                            EntityData effectData = ModelFactory.GetEntityData(buffLevel.fx);
                            loader.Add(new AssetsLoader("model/" + effectData.model));
                        }

                        if (!string.IsNullOrEmpty(buffLevel.areaFx))
                        {
                            EntityData effectData = ModelFactory.GetEntityData(buffLevel.areaFx);
                            loader.Add(new AssetsLoader("model/" + effectData.model));
                        }

                        //trigger
                        BuffData.Trigger trigger = buffLevel.trigger;
                        if (trigger != null)
                        {
                            if (trigger.fxs != null)
                            {
                                int c4 = trigger.fxs.Length;
                                for (int l = 0; l < c4; l++)
                                {
                                    if (!string.IsNullOrEmpty(trigger.fxs[l]))
                                    {
                                        EntityData effectData = ModelFactory.GetEntityData(trigger.fxs[l]);
                                        loader.Add(new AssetsLoader("model/" + effectData.model));
                                    }
                                }
                            }

                            if (trigger.tfxs != null)
                            {
                                int c4 = trigger.tfxs.Length;
                                for (int l = 0; l < c4; l++)
                                {
                                    if (!string.IsNullOrEmpty(trigger.tfxs[l]))
                                    {
                                        EntityData effectData = ModelFactory.GetEntityData(trigger.tfxs[l]);
                                        loader.Add(new AssetsLoader("model/" + effectData.model));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }