本文整理汇总了C++中AiAgent::isIncapacitated方法的典型用法代码示例。如果您正苦于以下问题:C++ AiAgent::isIncapacitated方法的具体用法?C++ AiAgent::isIncapacitated怎么用?C++ AiAgent::isIncapacitated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AiAgent
的用法示例。
在下文中一共展示了AiAgent::isIncapacitated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillObjectMenuResponse
void PetMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) {
if (!sceneObject->isPet())
return;
AiAgent* pet = cast<AiAgent*>(sceneObject);
if (pet->getGroup() != NULL) {
ManagedReference<GroupObject*> group = player->getGroup();
if (group == pet->getGroup()) {
if (group->getLeader() == player) {
menuResponse->addRadialMenuItem(40, 3, "@ui_radial:group_kick"); // Kick from Group
menuResponse->addRadialMenuItemToRadialID(40, 41, 3, "@ui_radial:group_disband" ); // Disband Group
} else {
menuResponse->addRadialMenuItem(39, 3, "@ui_radial:group_leave"); // Leave Group
}
}
}
if (pet->isIncapacitated() && pet->isAttackableBy(player))
menuResponse->addRadialMenuItem(6, 3, "@ui_radial:combat_death_blow"); // Death Blow
if (!player->getPlayerObject()->isPrivileged() && pet->getLinkedCreature() != player) {
return;
}
menuResponse->addRadialMenuItem(59, 3, "@pet/pet_menu:menu_store"); // Store
if (pet->getLinkedCreature().get() != player)
return;
ManagedReference<PetControlDevice*> controlDevice = pet->getControlDevice().get().castTo<PetControlDevice*>();
if( controlDevice == NULL )
return;
PetManager* petManager = pet->getZoneServer()->getPetManager();
if (petManager == NULL)
return;
// DROIDS
if( controlDevice->getPetType() == PetManager::DROIDPET ){
ManagedReference<DroidObject*> droidObject = dynamic_cast<DroidObject*>(controlDevice->getControlledObject());
bool conversingDroid = (pet->getOptionsBitmask() & OptionBitmask::CONVERSE);
if(conversingDroid) {
menuResponse->addRadialMenuItem(132, 3, "@pet/pet_menu:droid_options"); // SERVER_ITEM_OPTIONS
menuResponse->addRadialMenuItemToRadialID(132, 234, 3, "@pet/pet_menu:menu_recharge" ); // PET_FEED
// convsering droids have less re-programmable commands
} else {
menuResponse->addRadialMenuItem(132, 3, "@pet/pet_menu:droid_options"); // SERVER_ITEM_OPTIONS
menuResponse->addRadialMenuItemToRadialID(132, 234, 3, "@pet/pet_menu:menu_recharge" ); // PET_FEED
menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command_droid"); // PET_COMMAND
menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW
menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY
if (droidObject != NULL && droidObject->isCombatDroid())
menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD
menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND
if (droidObject != NULL && droidObject->isCombatDroid())
menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK
menuResponse->addRadialMenuItemToRadialID(141, 147, 3, "@pet/pet_menu:menu_patrol" ); // PET_PATROL
menuResponse->addRadialMenuItemToRadialID(141, 148, 3, "@pet/pet_menu:menu_get_patrol_point" ); // PET_GET_PATROL_POINT
menuResponse->addRadialMenuItemToRadialID(141, 149, 3, "@pet/pet_menu:menu_clear_patrol_points" ); // PET_CLEAR_PATROL_POINTS
menuResponse->addRadialMenuItemToRadialID(141, 150, 3, "@pet/pet_menu:menu_assume_formation_1" ); // PET_ASSUME_FORMATION_1
menuResponse->addRadialMenuItemToRadialID(141, 151, 3, "@pet/pet_menu:menu_assume_formation_2" ); // PET_ASSUME_FORMATION_2
menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP
if (droidObject != NULL && droidObject->isCombatDroid() && droidObject->hasRangedWeapon())
menuResponse->addRadialMenuItemToRadialID(141, 163, 3, "@pet/pet_menu:menu_ranged_attack" );
menuResponse->addRadialMenuItemToRadialID(141, 164, 3, "@pet/pet_menu:menu_store" );
menuResponse->addRadialMenuItemToRadialID(141, 165, 3, "@pet/pet_menu:menu_follow_other" );
if( droidObject != NULL && droidObject->isPowerDroid() ){
menuResponse->addRadialMenuItemToRadialID(141, 235, 3, "@pet/pet_menu:menu_recharge_other" );
}
}
if( pet->isIncapacitated() ){
menuResponse->addRadialMenuItem(166, 3, "@pet/pet_menu:awaken" );
}
}
// FACTION
else if( controlDevice->getPetType() == PetManager::FACTIONPET ){
// future, if conversion do as droid objects above and not add this menu at all.
//bool conversingPet = (pet->getOptionsBitmask() & OptionBitmask::CONVERSE);
menuResponse->addRadialMenuItem(141, 3, "@pet/pet_menu:menu_command"); // PET_COMMAND
menuResponse->addRadialMenuItemToRadialID(141, 142, 3, "@pet/pet_menu:menu_follow" ); // PET_FOLLOW
menuResponse->addRadialMenuItemToRadialID(141, 143, 3, "@pet/pet_menu:menu_stay" ); // PET_STAY
menuResponse->addRadialMenuItemToRadialID(141, 144, 3, "@pet/pet_menu:menu_guard" ); // PET_GUARD
menuResponse->addRadialMenuItemToRadialID(141, 145, 3, "@pet/pet_menu:menu_friend" ); // PET_FRIEND
menuResponse->addRadialMenuItemToRadialID(141, 146, 3, "@pet/pet_menu:menu_attack" ); // PET_ATTACK
menuResponse->addRadialMenuItemToRadialID(141, 147, 3, "@pet/pet_menu:menu_patrol" ); // PET_PATROL
menuResponse->addRadialMenuItemToRadialID(141, 148, 3, "@pet/pet_menu:menu_get_patrol_point" ); // PET_GET_PATROL_POINT
menuResponse->addRadialMenuItemToRadialID(141, 149, 3, "@pet/pet_menu:menu_clear_patrol_points" ); // PET_CLEAR_PATROL_POINTS
menuResponse->addRadialMenuItemToRadialID(141, 150, 3, "@pet/pet_menu:menu_assume_formation_1" ); // PET_ASSUME_FORMATION_1
menuResponse->addRadialMenuItemToRadialID(141, 151, 3, "@pet/pet_menu:menu_assume_formation_2" ); // PET_ASSUME_FORMATION_2
menuResponse->addRadialMenuItemToRadialID(141, 158, 3, "@pet/pet_menu:menu_group" ); // PET_GROUP
menuResponse->addRadialMenuItemToRadialID(141, 163, 3, "@pet/pet_menu:menu_ranged_attack" );
menuResponse->addRadialMenuItemToRadialID(141, 164, 3, "@pet/pet_menu:menu_store" );
menuResponse->addRadialMenuItemToRadialID(141, 165, 3, "@pet/pet_menu:menu_follow_other" );
//.........这里部分代码省略.........
示例2: broadcastMessage
//.........这里部分代码省略.........
firstName = playerCreature->getFirstName().toLowerCase();
myGhost = playerCreature->getPlayerObject();
}
if (myGhost)
language = myGhost->getLanguageID();
}
if (myGhost)
{
if (myGhost->hasGodMode())
godMode = true;
}
StringIdChatParameter* param = NULL;
if (message[0] == '@' && message.indexOf(":") != -1) {
param = new StringIdChatParameter(message.toString());
}
CloseObjectsVector* closeObjects = (CloseObjectsVector*) player->getCloseObjects();
SortedVector<QuadTreeEntry*> closeEntryObjects(200, 50);
if (closeObjects != NULL) {
closeObjects->safeCopyTo(closeEntryObjects);
} else {
player->info("Null closeobjects vector in ChatManager::broadcastMessage", true);
zone->getInRangeObjects(player->getWorldPositionX(), player->getWorldPositionY(), 128, &closeEntryObjects, true);
}
float range = defaultSpatialChatDistance;
float specialRange = spatialChatDistances.get(mood2);
if (specialRange != -1) {
range = specialRange;
}
try {
for (int i = 0; i < closeEntryObjects.size(); ++i) {
SceneObject* object = cast<SceneObject*>(closeEntryObjects.get(i));
if (player->isInRange(object, range)) {
//Notify observers that are expecting spatial chat.
if (object->getObserverCount(ObserverEventType::SPATIALCHATRECEIVED)) {
ManagedReference<ChatMessage*> chatMessage = new ChatMessage();
chatMessage->setString(message.toString());
EXECUTE_TASK_3(object, chatMessage, player, {
if (player_p == NULL || object_p == NULL)
return;
Locker locker(object_p);
SortedVector<ManagedReference<Observer*> > observers = object_p->getObservers(ObserverEventType::SPATIALCHATRECEIVED);
for (int oc = 0; oc < observers.size(); oc++) {
Observer* observer = observers.get(oc);
Locker clocker(observer, object_p);
if (observer->notifyObserverEvent(ObserverEventType::SPATIALCHATRECEIVED, object_p, chatMessage_p, player_p->getObjectID()) == 1)
object_p->dropObserver(ObserverEventType::SPATIALCHATRECEIVED, observer);
}
});
}
if (object->isPlayerCreature()) {
CreatureObject* creature = cast<CreatureObject*>(object);
PlayerObject* ghost = creature->getPlayerObject();
if (ghost == NULL)
continue;
if (!ghost->isIgnoring(firstName) || godMode) {
SpatialChat* cmsg = NULL;
if (param == NULL) {
cmsg = new SpatialChat(player->getObjectID(), creature->getObjectID(), message, target, moodid, mood2, language);
} else {
cmsg = new SpatialChat(player->getObjectID(), creature->getObjectID(), *param, target, moodid, mood2);
}
creature->sendMessage(cmsg);
}
}
else if( object->isPet() ){
AiAgent* pet = cast<AiAgent*>(object);
if (pet == NULL )
continue;
if( pet->isDead() || pet->isIncapacitated() )
continue;
PetManager* petManager = server->getPetManager();
Locker clocker(pet, player);
petManager->handleChat( player, pet, message.toString() );
}
}
}