Exemple #1
0
        private void HandleBuffTriggered(BaseEvent baseEvent)
        {
            SyncEvent e    = ( SyncEvent )baseEvent;
            VBuff     buff = this.GetBuff(e.buffId);

            buff.HandleTriggered(e.triggerIndex);
        }
        protected override void DamageInternal(VBuff buff, VBio target, float damage)
        {
            if (buff.skillData.isCommon)
            {
                return;
            }

            int charge;

            if (!this._chargesPreSkill.TryGetValue(buff.skillData.id, out charge))
            {
                this._chargesPreSkill[buff.skillData.id] = 0;
                charge = 0;
            }
            int maxChargePreSkill = ( int )this.extra[0];

            if (charge < maxChargePreSkill)
            {
                ++this._totalCharges;
                ++charge;
                this._chargesPreSkill[buff.skillData.id] = charge > maxChargePreSkill ? maxChargePreSkill : charge;
            }

            if (this._totalCharges > ( int )this.extra[1])
            {
                this._totalCharges = 0;
                this._chargesPreSkill.Clear();
            }

            this.level = this._totalCharges / ( int )this.extra[3];
        }
Exemple #3
0
        private void HandleTriggerTarget(BaseEvent baseEvent)
        {
            SyncEvent e      = ( SyncEvent )baseEvent;
            VBuff     buff   = this.GetBuff(e.buffId);
            VBio      target = this.GetBio(e.targetId);

            target.HandleTrigger(buff, e.triggerIndex);
        }
Exemple #4
0
        private void HandleExitBuff(BaseEvent baseEvent)
        {
            SyncEvent e      = ( SyncEvent )baseEvent;
            VBuff     buff   = this.GetBuff(e.buffId);
            VBio      target = this.GetBio(e.targetId);

            target.HandleExitBuff(buff);
        }
Exemple #5
0
        private void HandleBuffStateAdded(BaseEvent baseEvent)
        {
            SyncEvent e = ( SyncEvent )baseEvent;

            VBio  bio  = this.GetBio(e.targetId);
            VBuff buff = this.GetBuff(e.buffId);

            bio.HandleBuffStateAdded(e.buffStateId, buff);
        }
Exemple #6
0
        public static void Hurt(VBuff buff, VBio caster, VBio target, float damage)
        {
            UIEvent e = Get();

            e.type   = UIEventType.HURT;
            e.buff   = buff;
            e.entity = caster;
            e.target = target;
            e.f0     = damage;
            e.Invoke();
        }
Exemple #7
0
        private void HandleDamage(BaseEvent baseEvent)
        {
            SyncEvent e = ( SyncEvent )baseEvent;

            VBio  caster = this.GetBio(e.casterId);
            VBio  target = this.GetBio(e.targetId);
            VBuff buff   = this.GetBuff(e.buffId);

            caster.HandleDamage(buff, target, e.f0);
            target.HandleHurt(buff, caster, e.f0);
        }
Exemple #8
0
        private void UpdateState(UpdateContext context)
        {
            int count = this._buffs.Count;

            for (int i = 0; i < count; i++)
            {
                VBuff buff = this._buffs[i];
                if (buff.isInBattle)
                {
                    buff.UpdateState(context);
                }
            }
        }
Exemple #9
0
        public VBuff GetBuff(string rid)
        {
            if (string.IsNullOrEmpty(rid))
            {
                return(null);
            }
            VBuff buff = this._buffManager.Get(rid);

            if (buff == null)
            {
                Logger.Error($"Buff:{rid} not exist");
            }
            return(buff);
        }
Exemple #10
0
        public void DestroyBuffs()
        {
            int count = this._buffs.Count;

            for (int i = 0; i < count; i++)
            {
                VBuff buff = this._buffs[i];
                if (!buff.markToDestroy)
                {
                    continue;
                }
                buff.OnRemoveFromBattle();
                this._buffs.Remove(buff);
                this._idToBuff.Remove(buff.rid);
                this._gPool.Push(buff);
                --i;
                --count;
            }
        }
Exemple #11
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();
        }
Exemple #12
0
 protected virtual void HurtInternal(VBuff vBuff, VBio caster, float damage)
 {
 }
Exemple #13
0
 protected virtual void DamageInternal(VBuff vBuff, VBio target, float damage)
 {
 }
Exemple #14
0
 public void OnHurt(VBuff buff, VBio caster, float damage)
 {
     this.HurtInternal(buff, caster, damage);
 }
Exemple #15
0
 public void OnDamage(VBuff buff, VBio target, float damage)
 {
     this.DamageInternal(buff, target, damage);
 }