/** * \brief 投送操作到目标对象身上 * \param pSkillStatus 操作 * \param pd 坐标点 * \return 如果是返回true表示可以继续处理攻击攻击过程否则false表示返回 */ bool zSkill::findAttackTarget(const SkillStatus *pSkillStatus,zPos &pd,DWORD &count,SWORD rangDamageBonus) { WORD wdTarget = pSkillStatus->target; Scene *pScene = _entry->scene; //检查范围有效 if (!pScene->zPosValidate(pd)) { return true; } SceneUser *pFindUser = NULL; SceneNpc *pFindNpc = NULL; if (wdTarget&TARGET_FRIEND) { pFindUser = pScene->getSceneUserByPos(pd); if (pFindUser/* && pFindUser!=_entry*/) { if (!_entry->isEnemy(pFindUser,false,true)&&_entry->checkMagicFlyRoute(pFindUser,pSkillStatus->mode)) { count=1; if (pFindUser->skillStatusM.putOperationToMe(_entry->carrier,true,rangDamageBonus)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); return true; } else { return false; } } } } if (wdTarget&TARGET_ENEMY) { if (!pFindUser) pFindUser = pScene->getSceneUserByPos(pd); if (pFindUser && pFindUser!=_entry) { if (_entry->getTopMaster()&&_entry->getTopMaster()->getType() == zSceneEntry::SceneEntry_Player) { if (!(pFindUser->isPkZone(_entry) && _entry->isPkZone(pFindUser))) // 新加&&this->isPkZone(pDef) { return true; } } if (_entry->isEnemy(pFindUser)&& _entry->checkMagicFlyRoute(pFindUser,pSkillStatus->mode)) { count=1; if (pFindUser->skillStatusM.putOperationToMe(_entry->carrier,false,rangDamageBonus)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); return true; } else { return false; } } } } if (!pFindUser) { if (wdTarget&TARGET_PET) { pFindNpc = pScene->getSceneNpcByPos(pd); if (pFindNpc/* && pFindNpc!=_entry*/) { if (!_entry->isEnemy(pFindNpc,false,true)&&_entry->checkMagicFlyRoute(pFindNpc,pSkillStatus->mode)&&pFindNpc->getPetType()==Cmd::PET_TYPE_PET) { count=1; if (pFindNpc->skillStatusM.putOperationToMe(_entry->carrier,true,rangDamageBonus)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); return true; } else { return false; } } } } if (wdTarget&TARGET_SUMMON) { pFindNpc = pScene->getSceneNpcByPos(pd); if (pFindNpc/* && pFindNpc!=_entry*/) { if (!_entry->isEnemy(pFindNpc,false,true)&&_entry->checkMagicFlyRoute(pFindNpc,pSkillStatus->mode)&&pFindNpc->getPetType()==Cmd::PET_TYPE_SUMMON) { count=1; if (pFindNpc->skillStatusM.putOperationToMe(_entry->carrier,true,rangDamageBonus)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); return true; } else { return false; } } } } if (wdTarget&TARGET_NPC) { if (!pFindNpc) pFindNpc = pScene->getSceneNpcByPos(pd); if (pFindNpc && pFindNpc!=_entry) { if (_entry->getTopMaster() && _entry->getTopMaster()->getType() == zSceneEntry::SceneEntry_Player && pFindNpc->getTopMaster() && pFindNpc->getTopMaster()->getType() == zSceneEntry::SceneEntry_Player) { if (!(pFindNpc->isPkZone(_entry) && _entry->isPkZone(pFindNpc))) // 新加&&this->isPkZone(pDef) { return true; } } if (_entry->isEnemy(pFindNpc)&& _entry->checkMagicFlyRoute(pFindNpc,pSkillStatus->mode)) { count=1; if (pFindNpc->skillStatusM.putOperationToMe(_entry->carrier,false,rangDamageBonus)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); return true; } else { return false; } } } } } return true; }
/** * \brief 执行一个技能操作(一个操作包含若干个技能状态,操作有不同的目标对象和范围等)[sky]技能操作 */ void zSkill::doOperation(const SkillStatus *pSkillStatus) { _entry->carrier.status = pSkillStatus; // 一个技能操作 //_entry->carrier.skilltype = base->usetype; // 技能使用类型 //_entry->carrier.skillID = id; // 技能ID _entry->carrier.skillbase = actionbase; // 技能字典 _entry->carrier.revCmd = *curRevCmd; // 保存本次收到的攻击消息 _entry->carrier.attacker = _entry; // 攻击者的指针 WORD wdTarget = pSkillStatus->target; if (wdTarget& TARGET_SELF) { if (_entry->skillStatusM.putOperationToMe(_entry->carrier,true)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } wdTarget&=(0xff & (~(1))); // 清除表示自己的位,如果只对自己施法那么wdTarget将为0 } _entry->pkValue.damagebonus = actionbase->damnum; Scene *pScene = NULL; pScene = _entry->scene; if (wdTarget) { if (1 == pSkillStatus->range) // 1据说表示单格,所以做为单攻的判断标志 { switch(curRevCmd->byAttackType) { case Cmd::ATTACKTYPE_N2U: /// Npc攻击用户 { //if (!_entry->isPkZone()) return; /*if (_entry->tempid == curRevCmd->dwDefenceTempID) { ScenePk::attackUserCmdToNine(curRevCmd,_entry); return; }*/ SceneUser *pDef = pScene->getUserByTempID(curRevCmd->dwDefenceTempID); if (pDef) { if (wdTarget&TARGET_FRIEND) { if (!_entry->isEnemy(pDef,false,true)&&_entry->checkMagicFlyRoute(pDef,pSkillStatus->mode)) { if (pDef->skillStatusM.putOperationToMe(_entry->carrier,true)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } } if (wdTarget&TARGET_ENEMY) { if (pDef->getTopMaster()&&pDef->getTopMaster()->getType() == zSceneEntry::SceneEntry_Player) { if (!(pDef->isPkZone(_entry) && _entry->isPkZone(pDef))) // 新加&&this->isPkZone(pDef) { ScenePk::attackFailToMe(curRevCmd,_entry); return; } } if (_entry->isEnemy(pDef,_entry->getType() == zSceneEntry::SceneEntry_Player)&& // 判断敌人友和检查PK模式是一个方法,所以只要判断一次就OK了 _entry->checkMagicFlyRoute(pDef,pSkillStatus->mode)) { if (pDef->skillStatusM.putOperationToMe(_entry->carrier)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } } } } break; case Cmd::ATTACKTYPE_U2U: /// 用户攻击用户 { //if (!_entry->isPkZone()) return; /*if (_entry->tempid == curRevCmd->dwDefenceTempID) { ScenePk::attackUserCmdToNine(curRevCmd,_entry); return; }*/ SceneUser *pDef = pScene->getUserByTempID(curRevCmd->dwDefenceTempID); if (pDef) { if (wdTarget&TARGET_FRIEND) { if (!_entry->isEnemy(pDef,false,true)&&_entry->checkMagicFlyRoute(pDef,pSkillStatus->mode)) { if (pDef->skillStatusM.putOperationToMe(_entry->carrier,true)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } } if (wdTarget&TARGET_ENEMY) { if (_entry->isEnemy(pDef,_entry->getType() == zSceneEntry::SceneEntry_Player)&& // 判断敌人友和检查PK模式是一个方法,所以只要判断一次就OK了 pDef->isPkZone(_entry)&&_entry->isPkZone(pDef)&&//新加 _entry->isPkZone(pDef) _entry->checkMagicFlyRoute(pDef,pSkillStatus->mode)) { if (pDef->skillStatusM.putOperationToMe(_entry->carrier)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } else { ScenePk::attackFailToMe(curRevCmd,_entry); } } } } break; case Cmd::ATTACKTYPE_U2N: /// 用户攻击Npc { SceneNpc *pNpc = SceneNpcManager::getMe().getNpcByTempID(curRevCmd->dwDefenceTempID); if (pNpc) { if (wdTarget&TARGET_PET) { if (!_entry->isEnemy(pNpc,false,true)&&_entry->checkMagicFlyRoute(pNpc,pSkillStatus->mode)&&pNpc->getPetType()==Cmd::PET_TYPE_PET) { if (pNpc->skillStatusM.putOperationToMe(_entry->carrier,true)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } } else if (wdTarget&TARGET_SUMMON) { if (!_entry->isEnemy(pNpc,false,true)&&_entry->checkMagicFlyRoute(pNpc,pSkillStatus->mode)&&pNpc->getPetType()==Cmd::PET_TYPE_SUMMON) { if (pNpc->skillStatusM.putOperationToMe(_entry->carrier,true)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } } else if (wdTarget&TARGET_NPC) { if (pNpc->getTopMaster()&&pNpc->getTopMaster()->getType() == zSceneEntry::SceneEntry_Player) { if (!(pNpc->isPkZone(_entry) && _entry->isPkZone(pNpc))) // 新加&&this->isPkZone(pDef) { ScenePk::attackFailToMe(curRevCmd,_entry); return; } } if (_entry->isEnemy(pNpc)&& // 判断敌人友和检查PK模式是一个方法,所以只要判断一次就OK了 _entry->checkMagicFlyRoute(pNpc,pSkillStatus->mode)) { if (pNpc->skillStatusM.putOperationToMe(_entry->carrier)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } else { ScenePk::attackFailToMe(curRevCmd,_entry); } } } } break; case Cmd::ATTACKTYPE_N2N: /// Npc攻击Npc { SceneNpc *pNpc = SceneNpcManager::getMe().getNpcByTempID(curRevCmd->dwDefenceTempID); if (pNpc) { if (wdTarget&TARGET_PET) { if (!_entry->isEnemy(pNpc,false,true)&&_entry->checkMagicFlyRoute(pNpc,pSkillStatus->mode)&&pNpc->getPetType()==Cmd::PET_TYPE_PET) { if (pNpc->skillStatusM.putOperationToMe(_entry->carrier,true)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } } else if (wdTarget&TARGET_SUMMON) { if (!_entry->isEnemy(pNpc,false,true)&&_entry->checkMagicFlyRoute(pNpc,pSkillStatus->mode)&&pNpc->getPetType()==Cmd::PET_TYPE_SUMMON) { if (pNpc->skillStatusM.putOperationToMe(_entry->carrier,true)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); return; } else { return; } } } else if (wdTarget&TARGET_NPC) { if (_entry->getTopMaster() && _entry->getTopMaster()->getType() == zSceneEntry::SceneEntry_Player && pNpc->getTopMaster() && pNpc->getTopMaster()->getType() == zSceneEntry::SceneEntry_Player) { if (!(pNpc->isPkZone(_entry) && _entry->isPkZone(pNpc))) // 新加&&this->isPkZone(pDef) { ScenePk::attackFailToMe(curRevCmd,_entry); return; } } if (_entry->isEnemy(pNpc)&& // 判断敌人友和检查PK模式是一个方法,所以只要判断一次就OK了 _entry->checkMagicFlyRoute(pNpc,pSkillStatus->mode)) { if (pNpc->skillStatusM.putOperationToMe(_entry->carrier)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } } } } break; case Cmd::ATTACKTYPE_U2P: /// 用户攻击点 { zPos pd; DWORD num =0; pd.x = (DWORD)curRevCmd->xDes; pd.y = (DWORD)curRevCmd->yDes; if (findAttackTarget(pSkillStatus,pd,num)) { //ScenePk::attackUserCmdToNine(curRevCmd,_entry); } return; } break; case Cmd::ATTACKTYPE_U2B: /// 用户攻击建筑 default: { //if (!ScenePk::attackUserCmdToNine(curRevCmd,_entry)) //{ // return; //} return; } break; } // ScenePk::attackFailToMe(curRevCmd,_entry); } else { zPos center,pd; BYTE byDir=0; if (curRevCmd->dwDefenceTempID!=0) { switch(curRevCmd->byAttackType) { case Cmd::ATTACKTYPE_N2U: /// Npc攻击用户 case Cmd::ATTACKTYPE_U2U: /// Npc攻击用户 { SceneUser *pDef = pScene->getUserByTempID(curRevCmd->dwDefenceTempID); if (pDef) { center = pDef->getPos(); } else { center.x = (DWORD)curRevCmd->xDes; center.y = (DWORD)curRevCmd->yDes; } } break; case Cmd::ATTACKTYPE_N2N: /// Npc攻击用户 case Cmd::ATTACKTYPE_U2N: /// Npc攻击用户 { SceneNpc *pNpc = SceneNpcManager::getMe().getNpcByTempID(curRevCmd->dwDefenceTempID); if (pNpc) { center = pNpc->getPos(); } else { center.x = (DWORD)curRevCmd->xDes; center.y = (DWORD)curRevCmd->yDes; } } break; default: { center.x = (DWORD)curRevCmd->xDes; center.y = (DWORD)curRevCmd->yDes; } break; } } else { center.x = (DWORD)curRevCmd->xDes; center.y = (DWORD)curRevCmd->yDes; } switch(pSkillStatus->center) { case SKILL_CENTER_TYPE_MOUSE: { // center.x = (DWORD)curRevCmd->xDes; // center.y = (DWORD)curRevCmd->yDes; byDir = curRevCmd->byDirect; _entry->setDir(byDir); #ifdef _DEBUG Channel::sendSys(_entry->tempid,Cmd::INFO_TYPE_GAME,"中心点类型:鼠标(%u,%u) 方向:%u",center.x,center.y,byDir); #endif // debug提示 } break; case SKILL_CENTER_TYPE_SELF: { center.x = _entry->getPos().x; center.y = _entry->getPos().y; byDir = curRevCmd->byDirect;//_entry->getDir(); _entry->setDir(byDir); #ifdef _DEBUG Channel::sendSys(_entry->tempid,Cmd::INFO_TYPE_GAME,"中心点类型:自身(%u,%u) 方向:%u",center.x,center.y,byDir); #endif } break; default: #ifdef _DEBUG Channel::sendSys(_entry->tempid,Cmd::INFO_TYPE_GAME,"中心点类型:填写错误请查证"); #endif break; } switch(pSkillStatus->range) { case 20: { DWORD tempLen = sizeof(struct Cmd::stAttackMagicUserCmd); DWORD itemNum = 0; #ifdef _DEBUG Zebra::logger->error("!!!---客户端发过来的攻击指令原始长度[%u] 当前长度[%u]",tempLen,curRevCmdLen); #endif if (curRevCmdLen>tempLen) { itemNum = (curRevCmdLen-tempLen)/sizeof(DWORD); #ifdef _DEBUG Zebra::logger->error("!!!---客户端发过来的攻击列表数目[%u]",itemNum); #endif if (itemNum >5) itemNum=5; for (DWORD i=0; i<itemNum; i++) { SceneNpc *pNpc=NULL; SceneUser *pUser=NULL; #ifdef _DEBUG Zebra::logger->error("!!!---客户端发过来的被攻击临时坐标[%u]",curRevCmd->dwTempIDList[i]); #endif if ((pNpc=_entry->scene->getNpcByTempID(curRevCmd->dwTempIDList[i]))!=NULL) { pd = pNpc->getPos(); } else if ((pUser=_entry->scene->getUserByTempID(curRevCmd->dwTempIDList[i]))!=NULL) { pd = pUser->getPos(); } else continue; /* pd.x= (curRevCmd->dwTempIDList[i]>>16) &0xffff; pd.y= (curRevCmd->dwTempIDList[i]&0xff); */ #ifdef _DEBUG Zebra::logger->error("!!!---客户端发过来的攻击坐标[%u][x=%u,y=%u]",curRevCmd->dwTempIDList[i],pd.x,pd.y); #endif //-技能范围测试 #ifdef _DEBUG zObjectB *base = objectbm.get(501); if (base) { zObject *o=zObject::create(base,1); _entry->scene->addObject(o,pd); } #endif DWORD num=0; if (!findAttackTarget(pSkillStatus,pd,num)) break; } } } break; case 21: { zPosVector range; pScene->findEntryPosInNine(_entry->getPos(),_entry->getPosI(),range); for(zPosVector::iterator iter = range.begin(); iter != range.end() ; iter ++) { pd = *iter; //-技能范围测试 #ifdef _DEBUG zObjectB *base = objectbm.get(585); if (base) { zObject *o=zObject::create(base,randBetween(1,10)); _entry->scene->addObject(o,pd); } #endif DWORD num=0; if (!findAttackTarget(pSkillStatus,pd,num)) break; } } break; case 22: { if (_entry->getType() == zSceneEntry::SceneEntry_Player) { SceneUser *pUser = (SceneUser *)_entry; TeamManager * team = SceneManager::getInstance().GetMapTeam(pUser->TeamThisID); if (team) { SendStatusToTeamExec exec(pUser,pSkillStatus); team->execEveryOne(exec); } } } break; case 50: { zPosVector range; int count=0; pScene->findEntryPosInOne(_entry->getPos(),_entry->getPosI(),range); for(zPosVector::iterator iter = range.begin(); iter != range.end() ; iter ++) { count++; if (count>20) break; pd = *iter; //-技能范围测试 #ifdef _DEBUG zObjectB *base = objectbm.get(585); if (base) { zObject *o=zObject::create(base,randBetween(1,10)); _entry->scene->addObject(o,pd); } #endif DWORD num=0; if (!findAttackTarget(pSkillStatus,pd,num)) break; } } break; default: { SMagicRange range; DWORD maxCount =0; DWORD count=0; MagicRangeInit::getInstance().get(pSkillStatus->range,byDir % 2,range); maxCount = range.num; if (0==maxCount) maxCount = 65535; for(std::vector<RelativePos>::iterator iter = range.lib.begin(); iter != range.lib.end() ; iter ++) { SWORD rangDamageBonus=0; pd = iter->getAbsolutePos(center,byDir); rangDamageBonus = (*iter).w; //-技能范围测试 #ifdef _DEBUG zObjectB *base = objectbm.get(585); if (base) { zObject *o=zObject::create(base,randBetween(1,10)); _entry->scene->addObject(o,pd); } #endif DWORD num=0; if (!findAttackTarget(pSkillStatus,pd,num,rangDamageBonus)) break; if (num>0) { count++; if (count>= maxCount) break; } } } } return; } } }
/** * \brief 当主人是玩家时,以主人的身份进行敌我判断 * \param entry 判断的对象 * \return 0:友方 1:敌人 -1:中立 */ int ScenePet::isUserMasterEnemy(SceneEntryPk * entry) { SceneEntryPk * temp = getTopMaster(); SceneUser * tm = 0;//top master if (temp && temp->getType()==zSceneEntry::SceneEntry_Player) tm = (SceneUser*)temp; else return -1; // TODO 判断传入角色与主人是否为朋友关系 if (tm==entry) return 0; SceneEntryPk * entryMaster = entry->getTopMaster(); using namespace Cmd; //if (PKMODE_ENTIRE==pkMode) return 1; switch (entryMaster->getType()) { case zSceneEntry::SceneEntry_Player: { SceneUser *pUser = (SceneUser *)entryMaster; if (pUser == tm) return 0; bool def_gem = false; bool my_gem = false; if (tm->issetUState(Cmd::USTATE_TOGETHER_WITH_TIGER) || tm->issetUState(Cmd::USTATE_TOGETHER_WITH_DRAGON)) { my_gem = true; } if (pUser->issetUState(Cmd::USTATE_TOGETHER_WITH_TIGER) || pUser->issetUState(Cmd::USTATE_TOGETHER_WITH_DRAGON)) { def_gem = true; } if ((pUser->charbase.level<20) && (!pUser->isWarRecord(Cmd::COUNTRY_FORMAL_DARE,tm->charbase.country)) && (!def_gem)) return 0; if ((tm->charbase.level<20) && (!tm->isWarRecord(Cmd::COUNTRY_FORMAL_DARE,pUser->charbase.country)) && (!my_gem)) return 0; if (tm->scene == pUser->scene && !(my_gem || def_gem)) { //if (tm->charbase.country == pUser->charbase.country) //{ if (tm->charbase.level <= tm->scene->getPkLevel() && pUser->charbase.level >tm->scene->getPkLevel() && (!tm->isWarRecord(Cmd::SEPT_NPC_DARE,pUser->charbase.septid))) { return 0; } if (tm->charbase.level > tm->scene->getPkLevel() && pUser->charbase.level <= tm->scene->getPkLevel() && (!tm->isWarRecord(Cmd::SEPT_NPC_DARE,pUser->charbase.septid))) { return 0; } //} //else //{ // if (tm->charbase.level <= tm->scene->getPkLevel()-10 && pUser->charbase.level >tm->scene->getPkLevel()-10 // && (!tm->isWarRecord(Cmd::SEPT_NPC_DARE,pUser->charbase.septid))) // { // return 0; // } // if (tm->charbase.level > tm->scene->getPkLevel()-10 && pUser->charbase.level <= tm->scene->getPkLevel()-10 // && (!tm->isWarRecord(Cmd::SEPT_NPC_DARE,pUser->charbase.septid))) // { // return 0; // } //} } if (tm->isDiplomatState() ==0 || pUser->isDiplomatState() == 0) { return 0; } switch (tm->pkMode) { case PKMODE_NORMAL: { return 0; } break; case PKMODE_TEAM: { //是同一组队或者是增益类魔法 if ((tm->TeamThisID != 0) && (pUser->TeamThisID == tm->TeamThisID)) return 0; else return 1; } break; case PKMODE_TONG: { if (tm->charbase.unionid != 0 && tm->charbase.unionid == pUser->charbase.unionid) return 0; else return 1; } break; case PKMODE_SEPT: { if (tm->charbase.septid != 0 && tm->charbase.septid == pUser->charbase.septid) return 0; else return 1; } break; case PKMODE_COUNTRY: { if (tm->charbase.country != 0 && ((tm->charbase.country == pUser->charbase.country) || (CountryAllyM::getMe().getFriendLevel(tm->charbase.country, pUser->charbase.country)>0 && (pUser->isSpecWar(Cmd::COUNTRY_FORMAL_DARE) || tm->isSpecWar(Cmd::COUNTRY_FORMAL_DARE))))) return 0; else return 1; } break; case PKMODE_GOODNESS: { if (pUser->isRedNamed(false)||pUser->charbase.country!=tm->charbase.country) return 1; else return 0; } break; case PKMODE_ALLY: { if ((CountryAllyM::getMe().getFriendLevel(pUser->charbase.country,tm->charbase.country)>0)|| (pUser->charbase.country==tm->charbase.country)) return 0; else return 1; } break; case PKMODE_ENTIRE: { if (pUser->isPkZone(tm)&&tm->isPkZone(pUser)) return 1; else return 0; } default: break; } return 0; } break; case zSceneEntry::SceneEntry_NPC: { SceneNpc * n = (SceneNpc *)entry; if (n->id==COUNTRY_MAIN_FLAG //这几个不在这里判断 || n->id==COUNTRY_SEC_FLAG || n->isMainGeneral() || n->id==COUNTRY_KING_MAIN_FLAG || n->id==COUNTRY_KING_SEC_FLAG || n->id==COUNTRY_SEC_GEN || n->id==COUNTRY_EMPEROR_MAIN_GEN || n->id==COUNTRY_EMPEROR_SEC_GEN) return 1; //国外npc if (!n->isBugbear()) { if (n->npc->flags==1 && tm->charbase.country!=n->scene->getCountryID()) return 1; else return -1; } SceneEntryPk * m = n->getMaster(); if (m) { //Zebra::logger->debug("isPetEnemy 183 %s->%s",tm->name,n->getMaster()->name); if (!scene->zPosShortRange(n->getPos(),m->getPos(),20) && n->getPetType()==Cmd::PET_TYPE_GUARDNPC) return 1; else return tm->isEnemy(m); } if ((n->aif&AIF_ATK_REDNAME)||(n->npc->kind==NPC_TYPE_GUARD)) { if (tm->isRedNamed()) return 1; if (tm->charbase.country!=tm->scene->getCountryID()) return 1; if (tm->charbase.goodness&Cmd::GOODNESS_ATT) return 1; } switch (n->npc->kind) { case NPC_TYPE_HUMAN: ///人型 case NPC_TYPE_NORMAL: /// 普通类型 case NPC_TYPE_BBOSS: /// 大Boss类型 case NPC_TYPE_LBOSS: /// 小Boss类型 case NPC_TYPE_PBOSS: /// 紫Boss类型 case NPC_TYPE_BACKBONE: /// 精英类型 case NPC_TYPE_GOLD: /// 黄金类型 case NPC_TYPE_SUMMONS: /// 召唤类型 case NPC_TYPE_AGGRANDIZEMENT: /// 强化类型 case NPC_TYPE_ABERRANCE: /// 变异类型 case NPC_TYPE_BACKBONEBUG: /// 精怪类型 case NPC_TYPE_PET: /// 宠物类型 case NPC_TYPE_TOTEM: /// 图腾类型 case NPC_TYPE_GHOST: ///元神类 case NPC_TYPE_TURRET: /// 炮塔 case NPC_TYPE_BARRACKS: case NPC_TYPE_CAMP: case NPC_TYPE_ANIMON: /// 动物类 //case NPC_TYPE_DUCKHIT: /// 花草 return 1; case NPC_TYPE_GUARD: /// 士兵类型 case NPC_TYPE_SOLDIER: /// 士兵类型 { if (tm->charbase.country!=scene->getCountryID()) return 1; if (tm->pkMode==PKMODE_ENTIRE) return 1; return 0; } case NPC_TYPE_UNIONGUARD: if (tm->isAtt(Cmd::UNION_CITY_DARE)) return 1; else if (tm->scene->getUnionDare() && !tm->isSpecWar(Cmd::UNION_CITY_DARE) && !n->isMainGeneral())//大将军第三方不能打 return 1;//中立方 else return 0;//城战期间打城战而且不是攻方,就是守方 break; case NPC_TYPE_UNIONATTACKER: if (tm->isAtt(Cmd::UNION_CITY_DARE)) return 0; else if (tm->scene->getUnionDare() && !tm->isSpecWar(Cmd::UNION_CITY_DARE)) return 1;//中立方 else return 1;//城战期间打城战而且不是攻方,就是守方 break; default: return -1; } return -1; } break; default: return -1; break; } }