AdjustDamage() public static method

public static AdjustDamage ( BaseObject attack, BaseObject def, bool isMagicAck = false ) : uint
attack BaseObject
def BaseObject
isMagicAck bool
return uint
Beispiel #1
0
        public override bool Run()
        {
            base.Run();
            if (System.Environment.TickCount - mnTick > mnTime)
            {
                this.ClearThis();
                return(false);
            }

            //会攻击的特效-- 降灵咒雨
            if (mnEffID == Define.JIANGLINGZHOUYU)
            {
                if (System.Environment.TickCount - mnAttackTick > 1000)
                {
                    mnAttackTick = System.Environment.TickCount;

                    NetMsg.MsgMonsterMagicInjuredInfo magicattack = new NetMsg.MsgMonsterMagicInjuredInfo();
                    magicattack.roleid  = (uint)mnEffID;
                    magicattack.role_x  = this.GetCurrentX();
                    magicattack.role_y  = this.GetCurrentY();
                    magicattack.tag     = 21;
                    magicattack.magicid = (ushort)Define.JIANGLINGZHOUYU_MAGICID;
                    magicattack.magiclv = 0;

                    this.BrocatBuffer(magicattack.GetBuffer());

                    NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                    magicattackex.nID      = mPlay.GetTypeId();
                    magicattackex.nX       = this.GetCurrentX();
                    magicattackex.nY       = this.GetCurrentY();
                    magicattackex.nMagicID = (ushort)Define.JIANGLINGZHOUYU_MAGICID;
                    magicattackex.nMagicLv = 0;
                    magicattackex.bDir     = this.GetDir();
                    NetMsg.MsgAttackInfo info = new NetMsg.MsgAttackInfo();
                    info.tag = 21;
                    //---攻击 暂时只攻击怪物
                    foreach (RefreshObject refobj in this.GetVisibleList().Values)
                    {
                        BaseObject obj = refobj.obj;
                        if (obj.type == OBJECTTYPE.MONSTER)
                        {
                            if (this.GetPoint().CheckVisualDistance(obj.GetCurrentX(), obj.GetCurrentY(), Define.JIANGLINGZHOUYU_DIS))
                            {
                                uint nValue = BattleSystem.AdjustDamage(mPlay, obj, true);
                                magicattackex.AddObject(obj.GetTypeId(), (int)nValue);

                                obj.Injured(mPlay, nValue, info);
                            }
                        }
                    }
                    this.BrocatBuffer(magicattackex.GetBuffer());
                }
            }
            return(true);
        }
Beispiel #2
0
        public override bool Run()
        {
            bool ret = base.Run();

            //距离超出-
            if (!this.GetPoint().CheckVisualDistance(mPlay.GetCurrentX(), mPlay.GetCurrentY(), DIS))
            {
                mPlay.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_MINGGUOSHENGNV);
                return(false);
            }
            //刷新周围对象以便寻找目标
            if (this.GetAi().GetTargetObject() == null)
            {
                if (System.Environment.TickCount - mnRefreshTick > REFRESHTIME)
                {
                    this.RefreshVisibleObject();
                    mnRefreshTick = System.Environment.TickCount;
                }
            }
            if (mMagicAttackTime.ToNextTime())
            {
                this.RefreshVisibleObject();

                NetMsg.MsgMonsterMagicInjuredInfo magicattack = new NetMsg.MsgMonsterMagicInjuredInfo();
                magicattack.roleid  = this.GetTypeId();
                magicattack.role_x  = this.GetCurrentX();
                magicattack.role_y  = this.GetCurrentY();
                magicattack.tag     = 21;
                magicattack.magicid = 6051;
                magicattack.magiclv = 0;
                this.BrocatBuffer(magicattack.GetBuffer());



                NetMsg.MsgGroupMagicAttackInfo magicattackex = new NetMsg.MsgGroupMagicAttackInfo();
                magicattackex.nID      = this.GetTypeId();
                magicattackex.nX       = this.GetCurrentX();
                magicattackex.nY       = this.GetCurrentY();
                magicattackex.nMagicID = 6051;
                magicattackex.nMagicLv = 0;
                magicattackex.bDir     = this.GetDir();
                foreach (RefreshObject refobj in this.GetVisibleList().Values)
                {
                    //只攻击怪物
                    if (refobj.obj.type == OBJECTTYPE.MONSTER)
                    {
                        BaseObject obj = refobj.obj;
                        if (this.GetPoint().CheckVisualDistance(obj.GetCurrentX(), obj.GetCurrentY(), 10))
                        {
                            uint injured = BattleSystem.AdjustDamage(mPlay, obj, true);
                            NetMsg.MsgAttackInfo info = new NetMsg.MsgAttackInfo();
                            info.tag = 21;
                            obj.Injured(this, injured, info);
                            magicattackex.AddObject(obj.GetTypeId(), (int)injured);
                        }
                    }
                }
                this.BrocatBuffer(magicattackex.GetBuffer());
            }
            return(ret);
        }