Ejemplo n.º 1
0
        // mount/unmount buff
        public static SkBuffInst MountBuff(SkEntity target, int buffId, List <int> idxList, List <float> valList)       // To save memory ,idxList should be increase step by step
        {
            int maxIdx = 0;
            int n      = idxList != null ? idxList.Count : 0;

            for (int i = 0; i < n; i++)
            {
                if (idxList[i] > maxIdx)
                {
                    maxIdx = idxList[i];
                }
            }
            SkAttribs buffAttribs = new SkAttribs(null, maxIdx + 1);

            for (int i = 0; i < n; i++)
            {
                int idx = idxList[i];
                buffAttribs.sums[idx] = buffAttribs.raws[idx] = valList[i];
            }

            //lz-2016.08.22 引导检测玩家进入buff
            Pathea.PeEntity entity = target.GetComponent <Pathea.PeEntity>();
            if (null != entity && entity.IsMainPlayer)
            {
                InGameAidData.CheckInBuff(buffId);
            }

            return(SkBuffInst.Mount(target._attribs.pack as SkPackage, SkBuffInst.Create(buffId, buffAttribs, target._attribs)));
        }
Ejemplo n.º 2
0
        public void  OnAtkTargetDeath(SkillSystem.SkEntity skSelf, SkillSystem.SkEntity skCaster)
        {
            PeEntity       target = skSelf.GetComponent <PeEntity>();
            AtkCooperation atk    = GetAtkCooperByTarget(target);

            if (target != null)
            {
                if (mAtkTargets.Contains(target))
                {
                    RemoveAtkTarget(target);
                }
            }
            if (atk != null)
            {
                List <PeEntity> lists = atk.GetCooperMembers();
                RemoveOut(lists);
                mCooperationLists.Remove(atk);
                atk.DissolveCooper();
            }
        }
Ejemplo n.º 3
0
        public void OnAtkTargetDestroy(SkillSystem.SkEntity entity)
        {
            for (int i = 0; i < mCooperationLists.Count; i++)
            {
                AtkCooperation atk = mCooperationLists[i] as AtkCooperation;
                if (atk != null)
                {
                    atk.OnAtkTargetDestroy(entity);
                }
            }
            PeEntity target = entity.GetComponent <PeEntity>();

            if (target != null)
            {
                if (mAtkTargets.Contains(target))
                {
                    RemoveAtkTarget(target);
                }
            }
        }
Ejemplo n.º 4
0
        public void TryGetHurt(float dmg, float exp = 0)
        {
            SkInst skInst = SkRuntimeInfo.Current as SkInst;

            if (null != skInst)
            {
                if (skInst._colInfo != null && skInst._colInfo.damageScale > PETools.PEMath.Epsilon)
                {
                    dmg *= skInst._colInfo.damageScale;
                }
            }

            SkEntity caster = SkRuntimeInfo.Current.Caster;
            SkEntity target = SkRuntimeInfo.Current.Target;

            if (CanDamage(caster, target))
            {
                if (caster is Pathea.Projectile.SkProjectile)
                {
                    Pathea.Projectile.SkProjectileDamageScale damageScale = caster.GetComponent <Pathea.Projectile.SkProjectileDamageScale>();
                    if (null != damageScale)
                    {
                        dmg *= damageScale.damageScale;
                    }
                }

                float shield = _parent.sums[(int)Pathea.AttribType.Shield];
                if (shield > 0 && caster is Pathea.Projectile.SkProjectile)
                {
                    if (shield * ShieldToHP < dmg)
                    {
                        _parent.sums[(int)Pathea.AttribType.Shield] = 0;
                        _parent.raws[(int)Pathea.AttribType.Hp]    -= dmg - shield * ShieldToHP;
                        _parent.sums[(int)Pathea.AttribType.Hp]    -= dmg - shield * ShieldToHP;
                        _parent.modflags[(int)Pathea.AttribType.Hp] = false;
                    }
                    else
                    {
                        _parent.sums[(int)Pathea.AttribType.Shield] -= dmg / ShieldToHP;
                    }
                }
                else
                {
                    _parent.raws[(int)Pathea.AttribType.Hp]    -= dmg;
                    _parent.sums[(int)Pathea.AttribType.Hp]    -= dmg;
                    _parent.modflags[(int)Pathea.AttribType.Hp] = false;
                }

                float curTime = Time.time;
                if (caster != null)
                {
                    caster._lastestTimeOfHurtingSb = curTime;
                }
                if (target != null)
                {
                    target._lastestTimeOfGettingHurt = curTime;
                }

                SkInst inst = SkRuntimeInfo.Current as SkInst;
                if (inst != null)
                {
                    inst.Caster.OnHurtSb(inst, dmg);
                    inst.Target.OnGetHurt(inst, dmg);
                }
            }

            if (exp > PETools.PEMath.Epsilon)
            {
                SkEntity parentCaster = caster;
                if (caster is Pathea.Projectile.SkProjectile)
                {
                    parentCaster = (parentCaster as Pathea.Projectile.SkProjectile).parentSkEntity;
                }
                parentCaster.SetAttribute((int)Pathea.AttribType.Exp, parentCaster.GetAttribute((int)Pathea.AttribType.Exp) + exp, false);
            }
        }