Exemple #1
0
 public void CureAllAbnormalState()
 {
     for (int i = 1; i <= 48; i++)
     {
         if (IsAbnormalState((eAbnormalState)i))
         {
             EnableAbnormalState((eAbnormalState)i, false);
         }
     }
     for (int i = LifeStealQueueList.Count - 1; i >= 0; i--)
     {
         LifeStealQueueList[i].Dequeue();
         if (LifeStealQueueList[i].Count == 0)
         {
             LifeStealQueueList.RemoveAt(i);
             OnChangeState?.Invoke(this, eStateIconType.BUFF_ADD_LIFE_STEAL, false);
         }
     }
     //处理反击字典
     //处理knightGuardDatas
     DamageSealDataDictionary.Clear();
     DamageOnceOwnerSealDateDictionary.Clear();
     DamageOwnerSealDataDictionary.Clear();
 }
Exemple #2
0
        internal int SetDamage(DamageData damageData, bool byAttack, int actionId, ActionParameter.OnDamageHitDelegate onDamageHit, bool hasEffect, Skill skill, bool energyAdd, Action onDefeat, bool noMotion, float weight, float actionWeightSum, Func <int, float, int> p)
        {
            int  randomInt = staticBattleManager.Random();
            bool critical  = false;

            if (randomInt <= damageData.CriticalRate && damageData.CriticalRate != 0)
            {
                critical = true;
            }
            if (damageData.ActionType == eActionType.ATTACK)
            {
                eDamageType damageType = damageData.DamageType;
                if ((damageType == eDamageType.ATK && IsAbnormalState(eAbnormalState.LOG_ATK_BARRIR)) ||
                    (damageType == eDamageType.MGC && IsAbnormalState(eAbnormalState.LOG_MGC_BARRIR)) ||
                    IsAbnormalState(eAbnormalState.LOG_ALL_BARRIR))
                {
                    critical = damageData.IsLogBarrierCritical;
                }
            }
            int damage = SetDamageImpl(damageData, byAttack, onDamageHit, hasEffect, skill, energyAdd, critical, onDefeat, noMotion, p);

            //boss相关代码鸽了
            if (damageData.Source != null)
            {
                if (damageData.ActionType != eActionType.DESTROY)
                {
                    if (damageData.ActionType != eActionType.ATTACK_FIELD && (skill == null || skill.IsLifeStealEnabled))
                    {
                        int lifesteal = damageData.LifeSteal;
                        if (skill != null)
                        {
                            lifesteal += skill.LifeSteal;
                        }
                        if (lifesteal >= 1)
                        {
                            float recovery_value = lifesteal * damage / (lifesteal + UnitData.level + 100);
                            if (recovery_value > 0)
                            {
                                eInhibitHealType eh = damageData.DamageType == eDamageType.MGC ? eInhibitHealType.MAGIC : eInhibitHealType.PHYSICS;
                                SetRecovery((int)recovery_value, eh, damageData.Source, false, false,
                                            false,//鸽了
                                            false, true, null);
                            }
                        }
                    }
                }
                if (IsOther ^ damageData.Source.IsOther)
                {
                    UnitCtrl source = damageData.Source;
                    if (damageData.Source.SummonType != eSummonType.NONE)
                    {
                        source = source.SummonSource;
                    }
                    //伤害统计
                    if (source != null)
                    {
                        //source.UnitDamageinfo.Setdamage(damage + 原伤害)
                    }
                }
            }
            accumulateDamage += damage;
            //log
            if (skill != null)
            {
                if (damageData.Source != null)
                {
                    if (skill.SkillId == damageData.Source.UBSkillId)
                    {
                        if (byAttack)
                        {
                            damageData.Target.PassiveUbIsMagic = damageData.DamageType == eDamageType.MGC;
                        }
                        damageData.Target.TotalDamage += damage;
                    }
                }
                if (damage >= 1)
                {
                    if (!skill.DamageedPartsList.Contains(damageData.Target))
                    {
                        skill.DamageedPartsList.Add(damageData.Target);
                    }
                }
            }
            if (damageData.Source != null)
            {
                if (damage >= 1 && DamageSealDataDictionary.ContainsKey(damageData.Source))
                {
                    Dictionary <int, AttackSealData> dic = DamageSealDataDictionary[damageData.Source];
                    foreach (AttackSealData sealData in dic.Values)
                    {
                        if (!sealData.OnlyCritical || critical)
                        {
                            sealData.AddSeal(this);
                        }
                    }
                }
                if (damage >= 1 && damageData.Source.DamageOnceOwnerSealDateDictionary.ContainsKey(damageData.Source) && skill != null)
                {
                    if (!skill.AlreadyAddAttackSelfSeal)
                    {
                        Dictionary <int, AttackSealData> dic2 = DamageOnceOwnerSealDateDictionary[damageData.Source];
                        foreach (AttackSealData sealData in dic2.Values)
                        {
                            sealData.AddSeal(damageData.Source);
                        }
                        skill.AlreadyAddAttackSelfSeal = true;
                    }
                }
            }
            if (damageData.Source == null || damage < 1 || !damageData.Source.DamageOwnerSealDataDictionary.ContainsKey(damageData.Source))
            {
                if (skill == null)
                {
                    return(damage);
                }
                skill.TotalDamage += damage;
                return(damage);
            }
            foreach (AttackSealData sealData1 in damageData.Source.DamageOwnerSealDataDictionary[damageData.Source].Values)
            {
                if (sealData1.OnlyCritical)
                {
                    if (critical)
                    {
                        sealData1.AddSeal(damageData.Source);
                    }
                }
                else
                {
                    sealData1.AddSeal(damageData.Source);
                }
            }
            if (skill != null)
            {
                skill.TotalDamage += damage;
            }
            return(damage);
        }