Exemplo n.º 1
0
        public override bool CanAttack(RoleActor target)
        {
            if (!base.CanAttack(target))
            {
                return(false);
            }

            if (HostMap.CanAttack(this, target) == eMapAttackRule.AtkOK)
            {
                return(true);
            }

            if (NPCData.Template.type == (byte)eNpcType.Npc)
            {
                return(false);
            }

            if (target is NPCInstance)
            {
                var npc = target as NPCInstance;
                if (npc.NPCData.Template.type == (byte)eNpcType.Npc)
                {
                    return(false);
                }

                if (target.Camp == eCamp.None)
                {
                    return(false);
                }
            }
            else if (target is PlayerInstance)
            {
                if (target.Camp != this.Camp)
                {
                    return(true);
                }

                if (this.Camp == eCamp.None)
                {
                    return(true);
                }
            }

            if (target.Camp == this.Camp)
            {
                return(false);
            }


            return(true);
        }
Exemplo n.º 2
0
        //监测阵营关系导致的是否可以攻击
        public virtual bool CanAttack(RoleActor target)
        {
            if (!CanAttack())
            {
                return(false);
            }

            if (HostMap.CanAttack(this, target) == eMapAttackRule.AtkNO)
            {
                return(false);
            }

            return(target.CanBeAttacked());
        }