Esempio n. 1
0
        public override void OnUpdate()
        {
            //只有不是永久Buff的情况下才会执行Update判断
            if (this.BuffData.SustainTime + 1 > 0)
            {
                //Log.Info($"执行持续伤害的Update,当前时间是{TimeHelper.Now()}");
                if (TimeHelper.Now() > MaxLimitTime)
                {
                    this.BuffState = BuffState.Finished;
                    //Log.Info("持续伤害结束了");
                }
                else if (TimeHelper.Now() > this.m_SelfNextimer)
                {
                    try
                    {
                        this.m_CurrentDamageValue = BuffDataCalculateHelper.CalculateCurrentData(this, this.BuffData);
                        //强制类型转换为伤害Buff数据
                        SustainDamageBuffData temp = (SustainDamageBuffData)this.BuffData;

                        //TODO 对受方的伤害结算,此时finalDamageValue为最终值

                        this.TheUnitBelongto.GetComponent <HeroDataComponent>().CurrentLifeValue -= this.m_CurrentDamageValue;
                        Game.EventSystem.Run(EventIdType.ChangeHP, this.TheUnitBelongto.Id, -this.m_CurrentDamageValue);
                        //Log.Info($"来自持续伤害Update的数据:{this.currentDamageValue},结束时间为{MaxLimitTime},当前层数为{this.CurrentOverlay}");
                        //设置下一个时间点
                        this.m_SelfNextimer = TimeHelper.Now() + temp.WorkInternal;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        throw;
                    }
                }
            }
        }
Esempio n. 2
0
        public override void OnExecute()
        {
            float tempFinalData = BuffDataCalculateHelper.CalculateCurrentData(this, this.BuffData);

            tempFinalData *= (this.BuffData as FlashDamageBuffData).DamageFix;

            Log.Info($"瞬时预计造成{tempFinalData}伤害");

            //TODO 对受方的伤害结算,此时finalDamageValue为最终值

            this.finalDamageValue = tempFinalData;

            this.TheUnitBelongto.GetComponent <HeroDataComponent>().CurrentLifeValue -= this.finalDamageValue;

            Game.EventSystem.Run(EventIdType.ChangeHP, this.TheUnitBelongto.Id, -this.finalDamageValue);

            //抛出Buff奏效事件
            //TODO 从当前战斗Entity获取BattleEventSystem来Run事件
            if (this.BuffData.EventIds != null)
            {
                foreach (var eventId in this.BuffData.EventIds)
                {
                    Game.Scene.GetComponent <BattleEventSystem>().Run($"{eventId}{this.TheUnitFrom.Id}", this);
                    //Log.Info($"抛出了{this.MSkillBuffDataBase.theEventID}{this.theUnitFrom.Id}");
                }
            }

            this.BuffState = BuffState.Finished;
            //Log.Info($"设置瞬时伤害Buff:{this.MSkillBuffDataBase.FlagId}状态为Finshed");
        }
Esempio n. 3
0
        public override void OnExecute()
        {
            try
            {
                //Log.Info("进入持续伤害的Execute");
                this.m_CurrentDamageValue = BuffDataCalculateHelper.CalculateCurrentData(this, this.BuffData);
                //强制类型转换为伤害Buff数据
                SustainDamageBuffData temp = (SustainDamageBuffData)this.BuffData;

                //TODO 对受方的伤害结算,此时finalDamageValue为最终值

                this.TheUnitBelongto.GetComponent <HeroDataComponent>().CurrentLifeValue -= this.m_CurrentDamageValue;
                Game.EventSystem.Run(EventIdType.ChangeHP, this.TheUnitBelongto.Id, -this.m_CurrentDamageValue);
                //Log.Info($"来自持续伤害ExeCute的数据:{this.currentDamageValue}");
                //设置下一个时间点
                this.m_SelfNextimer = TimeHelper.Now() + temp.WorkInternal;
                //Log.Info($"作用间隔为{selfNextimer - TimeHelper.Now()},持续时间为{temp.SustainTime},持续到{this.selfNextimer}");
                this.BuffState = BuffState.Running;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Esempio n. 4
0
        private void ExcuteDamage()
        {
            //强制类型转换为伤害Buff数据
            SustainDamageBuffData temp = (SustainDamageBuffData)this.BuffData;

            DamageData damageData = ReferencePool.Acquire <DamageData>().InitData(temp.BuffDamageTypes,
                                                                                  BuffDataCalculateHelper.CalculateCurrentData(this, this.BuffData), this.TheUnitFrom, this.TheUnitBelongto);

            damageData.DamageValue *= temp.DamageFix;

            this.TheUnitFrom.GetComponent <CastDamageComponent>().BaptismDamageData(damageData);

            float finalDamage = this.TheUnitBelongto.GetComponent <ReceiveDamageComponent>().BaptismDamageData(damageData);

            if (finalDamage >= 0)
            {
                this.TheUnitBelongto.GetComponent <HeroDataComponent>().NumericComponent.ApplyChange(NumericType.Hp, -finalDamage);
                //抛出伤害事件
                Game.Scene.GetComponent <BattleEventSystem>().Run($"{EventIdType.ExcuteDamage}{this.TheUnitFrom.Id}", damageData);
                //抛出受伤事件
                Game.Scene.GetComponent <BattleEventSystem>().Run($"{EventIdType.TakeDamage}{this.GetBuffTarget().Id}", damageData);
            }

            //设置下一个时间点
            this.m_SelfNextimer = TimeHelper.Now() + temp.WorkInternal;
        }
Esempio n. 5
0
        public override void OnExecute()
        {
            FlashDamageBuffData flashDamageBuffData = (this.BuffData as FlashDamageBuffData);
            DamageData          damageData          = ReferencePool.Acquire <DamageData>().InitData(flashDamageBuffData.BuffDamageTypes,
                                                                                                    BuffDataCalculateHelper.CalculateCurrentData(this, this.BuffData), this.TheUnitFrom, this.TheUnitBelongto,
                                                                                                    flashDamageBuffData.CustomData);

            damageData.DamageValue *= (this.BuffData as FlashDamageBuffData).DamageFix;

            this.TheUnitFrom.GetComponent <CastDamageComponent>().BaptismDamageData(damageData);

            float finalDamage = this.TheUnitBelongto.GetComponent <ReceiveDamageComponent>().BaptismDamageData(damageData);

            if (finalDamage >= 0)
            {
                this.TheUnitBelongto.GetComponent <HeroDataComponent>().NumericComponent.ApplyChange(NumericType.Hp, -finalDamage);
                //抛出伤害事件
                Game.Scene.GetComponent <BattleEventSystem>().Run($"{EventIdType.ExcuteDamage}{this.TheUnitFrom.Id}", damageData);
                //抛出受伤事件
                Game.Scene.GetComponent <BattleEventSystem>().Run($"{EventIdType.TakeDamage}{this.GetBuffTarget().Id}", damageData);
            }

            //TODO 从当前战斗Entity获取BattleEventSystem来Run事件
            if (this.BuffData.EventIds != null)
            {
                foreach (var eventId in this.BuffData.EventIds)
                {
                    Game.Scene.GetComponent <BattleEventSystem>().Run($"{eventId}{this.TheUnitFrom.Id}", this);
                    //Log.Info($"抛出了{this.MSkillBuffDataBase.theEventID}{this.theUnitFrom.Id}");
                }
            }

            this.BuffState = BuffState.Finished;
            //Log.Info($"设置瞬时伤害Buff:{this.MSkillBuffDataBase.FlagId}状态为Finshed");
        }