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); }
//监测阵营关系导致的是否可以攻击 public virtual bool CanAttack(RoleActor target) { if (!CanAttack()) { return(false); } if (HostMap.CanAttack(this, target) == eMapAttackRule.AtkNO) { return(false); } return(target.CanBeAttacked()); }