SetShield() public méthode

public SetShield ( Operate_Type opType, int tVal ) : void
opType Operate_Type
tVal int
Résultat void
Exemple #1
0
        internal void RemoveShield(int objId, TableConfig.Skill cfg, int seq)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity)
            {
                if (cfg.type == (int)SkillOrImpactType.Skill)
                {
                    entity.SetShield(Operate_Type.OT_Absolute, 0);
                }
                else
                {
                    ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                    if (null != impactInfo)
                    {
                        entity.SetShield(Operate_Type.OT_Absolute, 0);
                    }
                }
            }
        }
Exemple #2
0
        internal void AddShield(int objId, TableConfig.Skill cfg, int seq)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity)
            {
                if (cfg.type == (int)SkillOrImpactType.Skill)
                {
                    entity.SetShield(Operate_Type.OT_Relative, cfg.addshield);
                }
                else
                {
                    ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                    if (null != impactInfo)
                    {
                        entity.SetShield(Operate_Type.OT_Relative, impactInfo.DamageData.AddShield);
                    }
                }
            }
        }
Exemple #3
0
        internal void RemoveShield(int objId, TableConfig.Skill cfg, int seq)
        {
            EntityViewModel view = GetEntityViewById(objId);

            if (null != view && null != view.Entity)
            {
                EntityInfo entity = view.Entity;
                if (cfg.type == (int)SkillOrImpactType.Skill)
                {
                    entity.SetShield(Operate_Type.OT_Absolute, 0);
                }
                else
                {
                    ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                    if (null != impactInfo)
                    {
                        entity.SetShield(Operate_Type.OT_Absolute, 0);
                    }
                }
            }
        }
Exemple #4
0
        internal void ImpactDamage(int srcObjId, int targetId, int impactId, int seq)
        {
            EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId);
            EntityInfo srcObj    = m_Scene.EntityManager.GetEntityInfo(srcObjId);

            if (null != targetObj && !targetObj.IsDead())
            {
                ImpactInfo impactInfo = targetObj.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != impactInfo && impactId == impactInfo.ImpactId)
                {
                    TableConfig.Skill cfg = impactInfo.ConfigData;
                    int   targetType      = impactInfo.TargetType;
                    float damage          = impactInfo.DamageData.Damage;
                    int   addShield       = impactInfo.DamageData.AddShield;
                    int   hpRecover       = impactInfo.DamageData.HpRecover;

                    if (hpRecover != 0)
                    {
                        targetObj.SetHp(Operate_Type.OT_Relative, (int)impactInfo.DamageData.HpRecover);
                        targetObj.SetAttackerInfo(srcObjId, false, true, false, -impactInfo.DamageData.HpRecover, 0);
                    }
                    if (addShield != 0)
                    {
                        targetObj.SetShield(Operate_Type.OT_Relative, impactInfo.DamageData.AddShield);
                    }
                    if ((targetType == (int)SkillTargetType.Enemy || targetType == (int)SkillTargetType.RandEnemy) && damage != 0)
                    {
                        if (targetObj.EntityType == (int)EntityTypeEnum.Tower)
                        {
                            if (null != srcObj && srcObj.NormalSkillId != impactInfo.SkillId)
                            {
                                //技能打塔不产生伤害
                                return;
                            }
                        }
                        bool isKiller = false;
                        if (targetObj.Shield >= damage)
                        {
                            targetObj.SetShield(Operate_Type.OT_Relative, -(int)damage);
                        }
                        else if (targetObj.Shield > 0)
                        {
                            int leftDamage = (int)damage - targetObj.Shield;
                            targetObj.SetShield(Operate_Type.OT_Absolute, 0);
                            targetObj.SetHp(Operate_Type.OT_Relative, -(int)leftDamage);
                            if (targetObj.Hp <= 0)
                            {
                                isKiller = true;
                            }
                        }
                        else
                        {
                            targetObj.SetHp(Operate_Type.OT_Relative, -(int)damage);
                            if (targetObj.Hp <= 0)
                            {
                                isKiller = true;
                            }
                        }
                        if (isKiller)
                        {
                            targetObj.GetCombatStatisticInfo().AddDeadCount(1);
                            if (null != srcObj)
                            {
                                EntityInfo killer = srcObj;
                                if (killer.SummonerId > 0)
                                {
                                    killer = m_Scene.EntityManager.GetEntityInfo(killer.SummonerId);
                                }
                                if (targetObj.EntityType == (int)EntityTypeEnum.Tower)
                                {
                                    killer.GetCombatStatisticInfo().AddKillTowerCount(1);
                                }
                                else if (targetObj.EntityType == (int)EntityTypeEnum.Hero)
                                {
                                    killer.GetCombatStatisticInfo().AddKillHeroCount(1);
                                    killer.GetCombatStatisticInfo().AddMultiKillCount(1);
                                }
                                else
                                {
                                    killer.GetCombatStatisticInfo().AddKillNpcCount(1);
                                }
                            }
                        }
                        targetObj.SetAttackerInfo(srcObjId, isKiller, true, false, (int)damage, 0);
                    }
                }
            }
        }
Exemple #5
0
        internal void ImpactDamage(int srcObjId, int targetId, int impactId, int seq, bool isFinal)
        {
            if (ClientModule.Instance.IsRoomScene)
            {
                return;
            }
            EntityViewModel view    = GetEntityViewById(targetId);
            EntityViewModel srcView = GetEntityViewById(srcObjId);

            if (null != view && null != view.Entity && null != view.Actor)
            {
                EntityInfo entity = view.Entity;
                EntityInfo srcNpc = null;
                if (null != srcView && null != srcView.Entity)
                {
                    srcNpc = srcView.Entity;
                }
                ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq);
                if (null != impactInfo && impactId == impactInfo.ImpactId)
                {
                    TableConfig.Skill cfg = impactInfo.ConfigData;
                    int   targetType      = impactInfo.TargetType;
                    float damage          = impactInfo.DamageData.Damage;
                    int   addShield       = impactInfo.DamageData.AddShield;
                    int   hpRecover       = impactInfo.DamageData.HpRecover;

                    if (hpRecover != 0)
                    {
                        entity.SetHp(Operate_Type.OT_Relative, (int)impactInfo.DamageData.HpRecover);
                        entity.SetAttackerInfo(srcObjId, false, true, false, -impactInfo.DamageData.HpRecover, 0);
                    }
                    if (addShield != 0)
                    {
                        entity.SetShield(Operate_Type.OT_Relative, impactInfo.DamageData.AddShield);
                    }
                    if ((targetType == (int)SkillTargetType.Enemy || targetType == (int)SkillTargetType.RandEnemy) && damage != 0)
                    {
                        if (entity.EntityType == (int)EntityTypeEnum.Tower)
                        {
                            if (null != srcNpc && srcNpc.NormalSkillId != impactInfo.SkillId)
                            {
                                //技能打塔不产生伤害
                                return;
                            }
                        }
                        bool isKiller = false;
                        if (entity.Shield >= damage)
                        {
                            entity.SetShield(Operate_Type.OT_Relative, -(int)damage);
                        }
                        else if (entity.Shield > 0)
                        {
                            int leftDamage = (int)damage - entity.Shield;
                            entity.SetShield(Operate_Type.OT_Absolute, 0);
                            if (entity.GetId() == ClientModule.Instance.LeaderID && entity.Hp <= leftDamage)
                            {
                                //队长不死,demo专用代码
                            }
                            else
                            {
                                entity.SetHp(Operate_Type.OT_Relative, -(int)leftDamage);
                                if (entity.Hp <= 0)
                                {
                                    isKiller = true;
                                }
                            }
                        }
                        else
                        {
                            if (entity.GetId() == ClientModule.Instance.LeaderID && entity.Hp <= damage)
                            {
                                //队长不死,demo专用代码
                            }
                            else
                            {
                                entity.SetHp(Operate_Type.OT_Relative, -(int)damage);
                                if (entity.Hp <= 0)
                                {
                                    isKiller = true;
                                }
                            }
                        }
                        if (isKiller)
                        {
                            entity.GetCombatStatisticInfo().AddDeadCount(1);
                            if (null != srcNpc)
                            {
                                EntityInfo killer = srcNpc;
                                if (killer.SummonerId > 0)
                                {
                                    EntityViewModel npcViewModel = GetEntityViewById(killer.SummonerId);
                                    if (null != npcViewModel)
                                    {
                                        killer = npcViewModel.Entity;
                                    }
                                }
                                if (entity.EntityType == (int)EntityTypeEnum.Tower)
                                {
                                    killer.GetCombatStatisticInfo().AddKillTowerCount(1);
                                }
                                else if (entity.EntityType == (int)EntityTypeEnum.Hero)
                                {
                                    killer.GetCombatStatisticInfo().AddKillHeroCount(1);
                                    killer.GetCombatStatisticInfo().AddMultiKillCount(1);
                                }
                                else
                                {
                                    killer.GetCombatStatisticInfo().AddKillNpcCount(1);
                                }
                            }
                        }
                        entity.SetAttackerInfo(srcObjId, isKiller, true, false, (int)damage, 0);
                    }
                }
            }
        }