コード例 #1
0
 private int DoEffect(SkillInfo info, ActorController caster, ActorController target)
 {
     long num = 0L;
     for (int i = 0; i < info.EffectType.Count; i++)
     {
         if (info.EffectType[i] != 0)
         {
             if (info.Rate[i] >= 10000 || UtilFunc.RangeRandom(0, 10000) <= info.Rate[i])
             {
                 switch (info.EffectType[i])
                 {
                 case 2:
                     target.AddBuff(info.Value3[i], caster);
                     goto IL_143;
                 case 4:
                     num += (long)caster.CalculateDamage(info.Value1[i], info.Value2[i], target);
                     goto IL_143;
                 case 5:
                     num += (long)caster.CalculateDamage(info.Value1[i], info.Value2[i], target);
                     goto IL_143;
                 }
                 global::Debug.LogError(new object[]
                 {
                     string.Concat(new object[]
                     {
                         "SkillID = [",
                         info.ID,
                         "] invalid EffectType = [",
                         info.EffectType[i],
                         "]"
                     })
                 });
             }
         }
         IL_143:;
     }
     Singleton<ActionMgr>.Instance.PlayHitAction(caster, info, target);
     int num2 = 0;
     float num3 = info.ThreatBase;
     if (num > 0L)
     {
         bool flag = caster.CanCrit(target);
         if (flag)
         {
             num = num * 150L / 100L;
         }
         num = num * (long)(10000 + caster.DamageMod) / 10000L;
         num2 = target.DoDamage(num, caster, ActorController.CanHitBack(info));
         if (target.UIText != null && num2 > 0)
         {
             if (target.FactionType == ActorController.EFactionType.ERed)
             {
                 if (flag)
                 {
                     GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_CriticalDamage, num2, null, 0);
                 }
                 else
                 {
                     GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Damage, num2, null, 0);
                 }
             }
             else
             {
                 GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Damage, -num2, null, 2);
             }
         }
         num3 += (float)num2 * info.ThreatCoef;
     }
     if (num3 > 0f && caster.IsHostileTo(target))
     {
         target.AiCtrler.ThreatMgr.AddThreat(caster, num3);
     }
     return num2;
 }
コード例 #2
0
ファイル: ActorController.cs プロジェクト: floatyears/Decrypt
    public void DoEffectOnTarget(SkillInfo info, ActorController target, int index)
    {
        if (target == null || target.IsDead || info == null)
        {
            return;
        }
        if (this.IsHostileTo(target) && target.IsImmunity)
        {
            if (target.uiText != null)
            {
                if (target.factionType == ActorController.EFactionType.EBlue)
                {
                    GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Text, 0, ConstString.ImmunityTxt, 2);
                }
                else
                {
                    GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Text, 0, ConstString.ImmunityTxt, 0);
                }
            }
            return;
        }
        if (!info.AlwaysHit && !this.CanHit(target))
        {
            if (target.uiText != null)
            {
                if (target.factionType == ActorController.EFactionType.EBlue)
                {
                    GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Text, 0, ConstString.MissTxt, 2);
                }
                else
                {
                    GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Text, 0, ConstString.MissTxt, 0);
                }
            }
            return;
        }
        long num = 0L;
        int num2 = 0;
        int num3 = 0;
        long num4 = 0L;
        int num5 = 10000;
        for (int i = 0; i < info.EffectType.Count; i++)
        {
            if (info.EffectType[i] != 0)
            {
                if (info.Rate[i] >= 10000 || UtilFunc.RangeRandom(0, 10000) <= info.Rate[i])
                {
                    switch (info.EffectType[i])
                    {
                    case 1:
                        this.HandleTriggerSkill(info, i, target);
                        continue;
                    case 2:
                        this.HandleTriggerBuff(info, i, target);
                        continue;
                    case 4:
                        num += (long)this.CalculateDamage(info.Value1[i], info.Value2[i], target);
                        continue;
                    case 5:
                        num += (long)this.CalculateDamage(info.Value1[i], info.Value2[i], target);
                        continue;
                    case 6:
                        num4 += (long)this.CalculateHeal(info.Value1[i], info.Value2[i], target);
                        continue;
                    case 7:
                        this.HandleSummon(info, i, target.transform.position);
                        continue;
                    case 8:
                        this.HandleSummonMaelstrom(info, i, target.transform.position);
                        continue;
                    case 9:
                        this.HandleSummonMonster(info, i, target.transform.position);
                        continue;
                    case 10:
                    {
                        int value = 0;
                        int value2 = info.Value4[i];
                        switch (index)
                        {
                        case 0:
                            value = info.Value1[i];
                            break;
                        case 1:
                            value = info.Value2[i];
                            break;
                        case 2:
                            value = info.Value3[i];
                            break;
                        case 3:
                            value = info.Value3[i];
                            break;
                        }
                        num += (long)this.CalculateDamage(value, value2, target);
                        continue;

                    }
                    case 11:
                    {
                        num += (long)this.CalculateDamage(info.Value1[i], info.Value4[i], target);
                        int num6 = info.Value2[i] + info.Value3[i] * index;
                        if (num6 > 0)
                        {
                            num5 = num6;
                        }
                        continue;
                    }
                    case 12:
                    {
                        long num7 = 0L;
                        if (this.factionType == ActorController.EFactionType.EBlue)
                        {
                            if (Globals.Instance.ActorMgr.LopetActor != null)
                            {
                                num7 = (long)Globals.Instance.ActorMgr.LopetActor.GetAtt(EAttID.EAID_Attack);
                            }
                        }
                        else if (Globals.Instance.ActorMgr.RemoteLopetActor != null)
                        {
                            num7 = (long)Globals.Instance.ActorMgr.RemoteLopetActor.GetAtt(EAttID.EAID_Attack);
                        }
                        num += num7 * (long)info.Value1[i] + (long)info.Value2[i];
                        continue;
                    }
                    }
                    global::Debug.LogErrorFormat("SkillID = {0}, invalid EffectType = {1}", new object[]
                    {
                        info.ID,
                        info.EffectType[i]
                    });
                }
            }
            continue;
        }
        if (target.hitEffect == 0)
        {
            Singleton<ActionMgr>.Instance.PlayHitAction(this, info, target);
        }
        else
        {
            Singleton<ActionMgr>.Instance.PlayAction(target, "Skill/hit_26", this);
        }
        float num8 = info.ThreatBase;
        if (num > 0L)
        {
            bool flag = this.CanCrit(target);
            if (flag)
            {
                num = num * 150L / 100L;
            }
            num = num * (long)(10000 + this.damageMod) / 10000L;
            num = num * (long)num5 / 10000L;
            if (this.talentEnhanceDamage != null)
            {
                int num9 = (int)(target.CurHP * 10000L / target.MaxHP);
                if (num9 <= this.talentEnhanceDamage.Value2)
                {
                    num = num * (long)(10000 + this.talentEnhanceDamage.Value1) / 10000L;
                }
            }
            if (!flag && info.TriggerDoubleDamage && this.doubleDamage != null && Time.time >= this.doubleDamage.Cooldown && UtilFunc.RangeRandom(0, 10000) < this.doubleDamage.Value1)
            {
                num = num * (long)this.doubleDamage.Value2 / 10000L;
                this.doubleDamage.Cooldown = Time.time + (float)this.doubleDamage.Value3;
            }
            if (target.shareDamage > 0)
            {
                num = Globals.Instance.ActorMgr.DoShareDamage(target, num, target.shareDamage);
            }
            num2 = target.DoDamage(num, this, ActorController.CanHitBack(info));
            if (num2 > 0 && target.damageReflect > 0)
            {
                long damage = (long)num2 * (long)target.damageReflect / 10000L;
                this.DoReflectDamage(damage, target);
            }
            if (num2 > 0 && target.reflexDamage != null && Time.time >= target.reflexDamage.Cooldown && UtilFunc.RangeRandom(0, 10000) < target.reflexDamage.Value1)
            {
                long num10 = (long)num2 * (long)target.reflexDamage.Value2 / 10000L;
                if (num10 > 0L)
                {
                    target.reflexDamage.Cooldown = Time.time + (float)target.reflexDamage.Value3;
                    this.DoReflectDamage(num10, target);
                }
            }
            if (target.uiText != null && num2 > 0)
            {
                if (target.factionType == ActorController.EFactionType.ERed)
                {
                    if (flag)
                    {
                        GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_CriticalDamage, num2, null, 0);
                    }
                    else if (this.actorType == ActorController.EActorType.EPlayer && this.Skills[0] != null && this.Skills[0].Info != info)
                    {
                        GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_SkillDamage, num2, null, 0);
                    }
                    else
                    {
                        GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Damage, num2, null, 0);
                    }
                }
                else
                {
                    GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Damage, -num2, null, 2);
                }
            }
            num8 += (float)num2 * info.ThreatCoef;
            if (this.suckPct > 0)
            {
                long value3 = (long)num2 * (long)this.suckPct / 10000L;
                this.DoSuckHeal(value3, this, true);
            }
            if (num2 > 0 && this.damageToHeal != null && Time.time >= this.damageToHeal.Cooldown && UtilFunc.RangeRandom(0, 10000) < this.damageToHeal.Value1)
            {
                this.damageToHeal.Cooldown = Time.time + (float)this.damageToHeal.Value3;
                long value4 = (long)num2 * (long)this.damageToHeal.Value2 / 10000L;
                this.DoSuckHeal(value4, this, false);
            }
            if (this.attackToHeal != null && Time.time >= this.attackToHeal.Cooldown && UtilFunc.RangeRandom(0, 10000) < this.attackToHeal.Value1)
            {
                this.attackToHeal.Cooldown = Time.time + (float)this.attackToHeal.Value3;
                long value5 = (long)this.GetAtt(EAttID.EAID_Attack) * (long)this.attackToHeal.Value2 / 10000L;
                this.DoSuckHeal(value5, this, false);
            }
        }
        if (num4 > 0L)
        {
            num4 = num4 * (long)(10000 + this.healMod) / 10000L;
            num3 = target.DoHeal(num4, this);
            if (num3 > 0 && target.uiText != null && this.factionType == ActorController.EFactionType.EBlue)
            {
                GameUIManager.mInstance.HUDTextMgr.RequestShow(target, EShowType.EST_Heal, num3, null, 0);
            }
        }
        if (num8 > 0f && this.IsHostileTo(target))
        {
            target.AiCtrler.ThreatMgr.AddThreat(this, num8);
        }
        if ((this.actorType == ActorController.EActorType.EPlayer || this.actorType == ActorController.EActorType.EPet) && target.AiCtrler.ThreatMgr.TargetActor != null && target.AiCtrler.ThreatMgr.TargetActor.IsBuilding)
        {
            target.AiCtrler.ThreatMgr.Clear();
            target.AiCtrler.SetInitTarget(this);
        }
        if (info.CastType == 0 || info.CastType == 1)
        {
            this.CastTriggerSkill(target);
        }
        this.CountSkillDamageHeal(info, (long)num2, (long)num3);
    }