Esempio n. 1
0
 public override void OnProduceResult(IResult result, IResultControl control)
 {
     base.OnProduceResult(result, control);
     if (result.ClassID == (int)ENResult.Damage)
     {
         ResultDamage damage = result as ResultDamage;
         BuffInfo     info   = GameTable.BuffTableAsset.Lookup(BuffID);
         foreach (var item in info.BuffResultList)
         {
             if (item.ID == (int)ClassID)
             {
                 if (item.ParamList[1] < UnityEngine.Random.Range(0.0f, 1.0f))
                 {//几率吸血
                     continue;
                 }
                 float   value = item.ParamList[0] * damage.DamageValue;
                 IResult r     = BattleFactory.Singleton.CreateResult(ENResult.Health, SourceID, TargetID, 0, 0, new float[5] {
                     (float)ResultHealth.HealthType.enFixed, value, 0, 0, 0
                 });
                 if (r != null)
                 {
                     r.ResultExpr(new float[5] {
                         (float)ResultHealth.HealthType.enFixed, value, 0, 0, 0
                     });
                     BattleFactory.Singleton.DispatchResult(r);
                 }
             }
         }
     }
 }
 public override void OnGetResult(IResult result, IResultControl control)
 {
     base.OnGetResult(result, control);
     if (result.ClassID == (int)ENResult.Damage)
     {
         ResultDamage r    = result as ResultDamage;
         BuffInfo     info = GameTable.BuffTableAsset.Lookup(BuffID);
         foreach (var item in info.BuffResultList)
         {
             if (item.ID == (int)ClassID)
             {
                 switch ((ENDecreaseDamageType)item.ParamList[0])
                 {
                 case ENDecreaseDamageType.enPercent:
                 {
                     if (item.ParamList[4] == 0 || (int)item.ParamList[4] == (int)r.DamageResultType)
                     {
                         r.DamageValue     *= m_decreasePercent;
                         m_decreasePercent *= item.ParamList[3];
                         if (m_decreasePercent < item.ParamList[2])
                         {        //最小值
                             m_decreasePercent = item.ParamList[2];
                         }
                     }
                 }
                 break;
                 }
             }
         }
     }
 }
Esempio n. 3
0
 public override void OnProduceResult(IResult result, IResultControl control)
 {
     base.OnProduceResult(result, control);
     if (result.ClassID == (int)ENResult.Damage)
     {
         ResultDamage r    = result as ResultDamage;
         BuffInfo     info = GameTable.BuffTableAsset.Lookup(BuffID);
         foreach (var item in info.BuffResultList)
         {
             if (item.ID == (int)ClassID)
             {
                 switch ((ENType)item.ParamList[0])
                 {
                 case ENType.enProduceDamage:
                 {
                     if ((int)item.ParamList[4] == (int)r.DamageResultType)
                     {        //改变某类型的伤害
                         float percent = item.ParamList[1];
                         if (percent != 0)
                         {
                             r.DamageValue *= percent;
                         }
                     }
                 }
                 break;
                 }
             }
         }
     }
 }
 public override void OnProduceResult(IResult result, IResultControl control)
 {
     base.OnProduceResult(result, control);
     if (result.ClassID == (int)ENResult.Damage)
     {
         ResultDamage rd   = result as ResultDamage;
         BuffInfo     info = GameTable.BuffTableAsset.Lookup(BuffID);
         foreach (var item in info.BuffResultList)
         {
             if (item.ID == (int)ClassID)
             {
                 switch ((ENType)item.ParamList[0])
                 {
                 case ENType.enRacialType:
                 {
                     Actor target = ActorManager.Singleton.Lookup(rd.TargetID);
                     if (target != null)
                     {
                         if (target.OnGetRaceType() == (int)item.ParamList[1])
                         {
                             rd.DamageValue *= (1 + item.ParamList[2]);
                         }
                     }
                 }
                 break;
                 }
             }
         }
     }
 }
    public override void OnGetResult(IResult result, IResultControl control)
    {
        base.OnGetResult(result, control);
        if (result.ClassID == (int)ENResult.Damage)
        {
            ResultDamage r    = result as ResultDamage;
            BuffInfo     info = GameTable.BuffTableAsset.Lookup(BuffID);
            foreach (var item in info.BuffResultList)
            {
                if (item.ID == (int)ClassID)
                {
                    switch ((ENOffsetDamageType)item.ParamList[0])
                    {
                    case ENOffsetDamageType.enTimes:
                    {
                        if (item.ParamList[4] == 0 || (int)item.ParamList[4] == (int)r.DamageResultType)
                        {
                            r.DamageValue = 0;
                            --m_offsetDamageTimes;
                        }
                        if (m_offsetDamageTimes <= 0)
                        {        //抵消伤害效果所在的buff里只有这一个效果
                            //移除自身
                            IResult rbResult = BattleFactory.Singleton.CreateResult(ENResult.RemoveBuff, TargetID, TargetID, 0, 0, new float[2] {
                                    (float)ResultRemoveBuff.ENRemoveBuffType.enBuffID, BuffID
                                });
                            if (rbResult != null)
                            {
                                rbResult.ResultExpr(new float[2] {
                                        (float)ResultRemoveBuff.ENRemoveBuffType.enBuffID, BuffID
                                    });
                                BattleFactory.Singleton.DispatchResult(rbResult);
                            }
                            continue;
                        }
                    }
                    break;

                    case ENOffsetDamageType.enProbability:
                    {
                        if (item.ParamList[4] == 0 || (int)item.ParamList[4] == (int)r.DamageResultType)
                        {
                            if (item.ParamList[1] < UnityEngine.Random.Range(0.0f, 1.0f))
                            {        //几率
                                continue;
                            }
                            r.DamageValue = 0;
                        }
                    }
                    break;
                    }
                }
            }
        }
    }
Esempio n. 6
0
 public override void OnGetResult(IResult result, IResultControl control)
 {
     base.OnGetResult(result, control);
     if (result.ClassID == (int)ENResult.Damage)
     {
         ResultDamage r    = result as ResultDamage;
         BuffInfo     info = GameTable.BuffTableAsset.Lookup(BuffID);
         foreach (var item in info.BuffResultList)
         {
             if (item.ID == (int)ClassID)
             {
                 if (r.DamageResultType == ResultDamage.ENDamageResultType.enReturn)
                 {//伤害类型为反弹伤害,不再反弹
                     continue;
                 }
                 switch ((ENReturnDamageType)item.ParamList[0])
                 {
                 case ENReturnDamageType.enPercent:
                 {
                     if (item.ParamList[4] == 0 || (int)item.ParamList[4] == (int)r.DamageResultType)
                     {
                         if (item.ParamList[2] < UnityEngine.Random.Range(0.0f, 1.0f))
                         {        //几率
                             continue;
                         }
                         float value = r.DamageValue * item.ParamList[1];
                         //反弹伤害给伤害来源
                         IResult returnDamage = BattleFactory.Singleton.CreateResult(ENResult.Damage, TargetID, r.SourceID, 0, 0, new float[5] {
                                 (float)ResultDamage.ENDamageType.enDamageFixed, value, 0, 0, (float)ResultDamage.ENDamageResultType.enReturn
                             });
                         if (returnDamage != null)
                         {        //伤害类型为enDamageFixed
                             Actor targetActor = ActorManager.Singleton.Lookup(r.SourceID);
                             targetActor.SetBlastPos(TargetID);
                             returnDamage.ResultExpr(new float[5] {
                                     (float)ResultDamage.ENDamageType.enDamageFixed, value, 0, 0, (float)ResultDamage.ENDamageResultType.enReturn
                                 });
                             BattleFactory.Singleton.DispatchResult(returnDamage);
                         }
                     }
                 }
                 break;
                 }
             }
         }
     }
 }
Esempio n. 7
0
    public override void Exec(IResultControl control)
    {
        base.Exec(control);
        int value = (int)DamageValue;

        if (value <= 0)
        {
            return;
        }
        Actor source = ActorManager.Singleton.Lookup(SourceID);

        if (source == null)
        {
            Debug.LogWarning("actor is not exist, id is " + SourceID);
            return;
        }
        Actor target = ActorManager.Singleton.Lookup(TargetID);

        if (target == null)
        {
            Debug.LogWarning("target is not exist, id is " + TargetID);
            return;
        }
        IResult r = BattleFactory.Singleton.CreateResult(ENResult.Damage, SourceID, TargetID, 0, 0, new float[5] {
            (float)ResultDamage.ENDamageType.enDamageFixed, value, 0, 0, m_damageResultType
        });

        if (r != null)
        {
            r.ResultExpr(new float[5] {
                (float)ResultDamage.ENDamageType.enDamageFixed, value, 0, 0, m_damageResultType
            });
            BattleFactory.Singleton.DispatchResult(r);

            ResultDamage rd = r as ResultDamage;
            value = (int)rd.DamageValue;
            if (value > 0)
            {
                float vampireValue = value * m_vampirePercent;
                if (!source.IsDead)
                {
                    source.AddHp((int)vampireValue);
                    source.OnHpChanged((int)vampireValue, false, 0, true);
                }
            }
        }
    }
Esempio n. 8
0
    public override void Exec(IResultControl control)
    {
        SkillResultInfo info = GameTable.SkillResultTableAsset.Lookup(SkillResultID);

        if (null == info)
        {
            return;
        }
        Actor target = ActorManager.Singleton.Lookup(TargetID);
        Actor source = ActorManager.Singleton.Lookup(SourceID);

        if (null != target && source != null)
        {
            float r = UnityEngine.Random.Range(0.0f, 1.0f);
            if (r >= source.Props.GetProperty_Float(ENProperty.hit) - target.Props.GetProperty_Float(ENProperty.avoid))
            {//没有命中
                return;
            }
            r = UnityEngine.Random.Range(0.0f, 1.0f);
            bool isFakeBreak = false, isBreak = false, isBack = false, isFly = false;
            if (r <= info.InterferePersent - target.Props.GetProperty_Float(ENProperty.AnitInterfere))
            {//普通受击
                isFakeBreak = true;
                r           = UnityEngine.Random.Range(0.0f, 1.0f);
                if (r < info.BreakPersent - target.Props.GetProperty_Float(ENProperty.AnitInterrupt))
                {//强受击
                    isBreak = true;
                    //Debug.LogWarning("hit 打断 target id=" + target.ID.ToString());
                    r = UnityEngine.Random.Range(0.0f, 1.0f);
                    if (r <= info.HitBackPersent - target.Props.GetProperty_Float(ENProperty.AnitRepel))
                    {//击退
                        //Debug.LogWarning("hit 击退 target id=" + target.ID.ToString());
                        isBack = true;
                        r      = UnityEngine.Random.Range(0.0f, 1.0f);
                        if (r < info.HitFlyPersent - target.Props.GetProperty_Float(ENProperty.AnitLauncher))
                        {//击飞
                            //Debug.LogWarning("hit 击飞 target id=" + target.ID.ToString());
                            isFly = true;
                        }
                    }
                }
            }
            if (info.ComboNum > 0)
            {
                m_damageModify = GetComboSkillDamageModify(SkillResultID);
                source.OnComboChanged(SkillResultID, TargetID, m_damageModify);
            }
            {//目标强韧结算
                float curStamina = target.Props.GetProperty_Float(ENProperty.stamina);
                if (curStamina <= 0.0f)
                {
                    target.OnStaminaEvent(source, out isFly);
                    isBack = isFly ? isFly : isBack;
                }
            }
            if (isBreak || isFly)
            {
                target.BeHited(source, isBack, isFly, info.AnimGauge);
            }
            else if (isFakeBreak)
            {
                target.FakeBeHited(source);
            }
        }
        else
        {
            return;
        }
        if (info.IsPlayEffect)
        {
            target.PlayEffect(info.EffectName, info.EffectDuration, info.EffectPos, info.IsAheadBone, Vector3.zero);
        }
        if (info.IsChangeShader)
        {
            AnimationShaderParamCallback callback = target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>();
            callback.ChangeShader(info.ChangeShaderAnimName);
        }
        foreach (var item in info.ParamList)
        {
            if (item.ID == (int)ENResult.Skill)
            {
                BattleFactory.Singleton.CreateSkillResult(SourceID, (int)item.Param[0], target.ID, SkillID, item.Param);
                continue;
            }
            IResult r = BattleFactory.Singleton.CreateResult((ENResult)item.ID, SourceID, TargetID, SkillResultID, SkillID, item.Param);
            if (r != null)
            {
                if (item.ID == (int)ENResult.Damage)
                {
                    ResultDamage damage = r as ResultDamage;
                    damage.DamageModify = m_damageModify / 100 + 1;
                }
                r.ResultExpr(item.Param);
                BattleFactory.Singleton.DispatchResult(r);
            }
        }
        if (source.Combo != null)
        {//combo附加效果
            int comboResultID = 0;
            foreach (var item in info.ExtraParamList)
            {
                if (item.ComboJudgeCount <= 0)
                {
                    continue;
                }
                int comboValue = source.Combo.TotalComboNumber;
                if (comboValue >= item.ComboJudgeCount)
                {
                    comboResultID = item.SkillResultID;
                }
            }
            if (comboResultID != 0)
            {
                BattleFactory.Singleton.CreateSkillResult(SourceID, comboResultID, target.ID, SkillID);
            }
        }
        //战斗意志
        source.OnAddWill(WillToFight.ENAddWillType.enSkillResult, new float[2] {
            info.SFightWillGet, info.NFightWillGet
        });
    }
    public override void OnGetResult(IResult result, IResultControl control)
    {
        base.OnGetResult(result, control);
        if (result.ClassID == (int)ENResult.Damage)
        {
            ResultDamage rd   = result as ResultDamage;
            Actor        self = ActorManager.Singleton.Lookup(TargetID);
            BuffInfo     info = GameTable.BuffTableAsset.Lookup(BuffID);
            if (self == null || info == null)
            {
                return;
            }
            foreach (var item in info.BuffResultList)
            {
                if (item.ID == (int)ClassID)
                {
                    switch ((ENType)item.ParamList[0])
                    {
                    case ENType.enDamagedBuffEffect:
                    {
                        bool flag = false;
                        foreach (var buff in self.MyBuffControl.BuffList)
                        {
                            BuffInfo buffInfo = GameTable.BuffTableAsset.Lookup(buff.BuffID);
                            if (buffInfo == null)
                            {
                                continue;
                            }
                            if (buffInfo.BuffEffectType == (int)item.ParamList[1])
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (flag)
                        {
                            if (item.ParamList[3] > UnityEngine.Random.Range(0.0f, 1.0f))
                            {
                                rd.DamageValue *= (1 + item.ParamList[2]);
                            }
                        }
                    }
                    break;

                    case ENType.enDamagedBuffID:
                    {
                        if (null != self.MyBuffControl.BuffList.Find(buff => buff.BuffID == (int)item.ParamList[1]))
                        {
                            if (item.ParamList[3] > UnityEngine.Random.Range(0.0f, 1.0f))
                            {
                                rd.DamageValue *= (1 + item.ParamList[2]);
                            }
                        }
                    }
                    break;

                    case ENType.enDamagedHpPercent:
                    {
                        if (self.HP < item.ParamList[1])
                        {
                            if (item.ParamList[3] > UnityEngine.Random.Range(0.0f, 1.0f))
                            {
                                rd.DamageValue *= (1 + item.ParamList[2]);
                            }
                        }
                    }
                    break;
                    }
                }
            }
        }
    }