本文整理汇总了C++中Monsters::getMonsterType方法的典型用法代码示例。如果您正苦于以下问题:C++ Monsters::getMonsterType方法的具体用法?C++ Monsters::getMonsterType怎么用?C++ Monsters::getMonsterType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monsters
的用法示例。
在下文中一共展示了Monsters::getMonsterType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addMonster
bool Spawn::addMonster(const std::string& _name, const Position& _pos, Direction _dir, uint32_t _interval)
{
if(!g_game.getTile(_pos))
{
std::cout << "[Spawn::addMonster] NULL tile at spawn position (" << _pos << ")" << std::endl;
return false;
}
MonsterType* mType = g_monsters.getMonsterType(_name);
if(!mType)
{
std::cout << "[Spawn::addMonster] Cannot find \"" << _name << "\"" << std::endl;
return false;
}
if(_interval < interval)
interval = _interval;
spawnBlock_t sb;
sb.mType = mType;
sb.pos = _pos;
sb.direction = _dir;
sb.interval = _interval;
sb.lastSpawn = 0;
uint32_t spawnId = (int32_t)spawnMap.size() + 1;
spawnMap[spawnId] = sb;
return true;
}
示例2: createMonster
Monster* Monster::createMonster(const std::string& name)
{
MonsterType* mType = g_monsters.getMonsterType(name);
if(!mType)
return NULL;
return createMonster(mType);
}
示例3: createMonster
Monster* Monster::createMonster(const std::string& name)
{
MonsterType* mType = g_monsters.getMonsterType(name);
if (!mType) {
return nullptr;
}
return new Monster(mType);
}
示例4: createMonster
Monster* Monster::createMonster(const std::string& name, std::string customName /* = ""*/)
{
MonsterType* mType = g_monsters.getMonsterType(name);
if(!mType)
return NULL;
return createMonster(mType, customName);
}
示例5: createMonsterNick
Monster* Monster::createMonsterNick(const std::string& name, const std::string& nick)
{
MonsterType* mType = g_monsters.getMonsterType(name);
if(!mType)
return NULL;
mType->name = nick;
mType->realName = name;
return createMonster(mType);
}
示例6: createMonster
Monster* Monster::createMonster(const std::string& name)
{
unsigned long id = g_monsters.getIdByName(name);
if(!id){
return NULL;
}
MonsterType* mtype = g_monsters.getMonsterType(id);
if(!mtype)
return NULL;
Monster* new_monster = new Monster(mtype);
return new_monster;
}
示例7: createMonster
Monster* Monster::createMonster(const std::string& name)
{
MonsterType* mType = g_monsters.getMonsterType(name);
if(!mType)
return NULL;
mType->name = name;
mType->realName = name;
//-- sistema de shiny respawn
mType->codenome = "";
mType->exists = false;
std::string findText[] = {"Shiny", "Elite", "Elder", "shiny", "elite", "elder"};
for(int i = 0; i < 6; i++){
if(mType->name.find(findText[i]) != std::string::npos){
mType->codenome = findText[i];
mType->exists = true;
break;
}
}
if (mType->exists) {
mType->realName = mType->name;
std::string newName = mType->name;
std::string from = mType->codenome + " ";
std::string to = "";
size_t start_pos = 0;
while((start_pos = newName.find(from, start_pos)) != std::string::npos) {
newName.replace(start_pos, from.length(), to);
start_pos += to.length(); // Handles case where 'to' is a substring of 'from'
}
mType->name = newName;
}
return createMonster(mType);
}
示例8: addMonster
bool Spawn::addMonster(const std::string& name, const Position& pos, Direction dir, uint32_t interval)
{
MonsterType* mType = g_monsters.getMonsterType(name);
if (!mType) {
std::cout << "[Spawn::addMonster] Can not find " << name << std::endl;
return false;
}
this->interval = std::min(this->interval, interval);
spawnBlock_t sb;
sb.mType = mType;
sb.pos = pos;
sb.direction = dir;
sb.interval = interval;
sb.lastSpawn = 0;
uint32_t spawnId = spawnMap.size() + 1;
spawnMap[spawnId] = sb;
return true;
}
示例9: deserializeSpell
//.........这里部分代码省略.........
continue;
if(readXMLInteger(tmpNode, "type", intValue))
{
Outfit_t outfit;
outfit.lookType = intValue;
if(readXMLInteger(tmpNode, "head", intValue))
outfit.lookHead = intValue;
if(readXMLInteger(tmpNode, "body", intValue))
outfit.lookBody = intValue;
if(readXMLInteger(tmpNode, "legs", intValue))
outfit.lookLegs = intValue;
if(readXMLInteger(tmpNode, "feet", intValue))
outfit.lookFeet = intValue;
if(readXMLInteger(tmpNode, "addons", intValue))
outfit.lookAddons = intValue;
outfits.push_back(outfit);
}
if(readXMLInteger(tmpNode, "typeex", intValue) || readXMLInteger(tmpNode, "item", intValue))
{
Outfit_t outfit;
outfit.lookTypeEx = intValue;
outfits.push_back(outfit);
}
if(readXMLString(tmpNode, "monster", strValue))
{
if(MonsterType* mType = g_monsters.getMonsterType(strValue))
outfits.push_back(mType->outfit);
}
}
ConditionType_t conditionType = CONDITION_PARALYZE;
if(speedChange > 0)
{
conditionType = CONDITION_HASTE;
if(aggressive == AUTO)
aggressive = NO;
}
else if(aggressive == AUTO)
aggressive = YES;
if(ConditionSpeed* condition = dynamic_cast<ConditionSpeed*>(Condition::createCondition(
CONDITIONID_COMBAT, conditionType, duration)))
{
condition->setFormulaVars((speedChange / 1000.), 0, (speedChange / 1000.), 0);
if(!outfits.empty())
condition->setOutfits(outfits);
combat->setCondition(condition);
combat->setParam(COMBATPARAM_AGGRESSIVE, aggressive);
}
}
else if(tmpName == "outfit")
{
std::vector<Outfit_t> outfits;
for(xmlNodePtr tmpNode = node->children; tmpNode; tmpNode = tmpNode->next)
{
if(xmlStrcmp(tmpNode->name,(const xmlChar*)"outfit"))
continue;
示例10: deserializeSpell
//.........这里部分代码省略.........
int32_t duration = 10000;
if ((attr = node.attribute("duration"))) {
duration = pugi::cast<int32_t>(attr.value());
}
if ((attr = node.attribute("speedchange"))) {
speedChange = pugi::cast<int32_t>(attr.value());
if (speedChange < -1000) {
//cant be slower than 100%
speedChange = -1000;
}
}
ConditionType_t conditionType;
if (speedChange > 0) {
conditionType = CONDITION_HASTE;
combat->setParam(COMBAT_PARAM_AGGRESSIVE, 0);
} else {
conditionType = CONDITION_PARALYZE;
}
ConditionSpeed* condition = static_cast<ConditionSpeed*>(Condition::createCondition(CONDITIONID_COMBAT, conditionType, duration, 0));
condition->setFormulaVars(speedChange / 1000.0, 0, speedChange / 1000.0, 0);
combat->setCondition(condition);
} else if (tmpName == "outfit") {
int32_t duration = 10000;
if ((attr = node.attribute("duration"))) {
duration = pugi::cast<int32_t>(attr.value());
}
if ((attr = node.attribute("monster"))) {
MonsterType* mType = g_monsters.getMonsterType(attr.as_string());
if (mType) {
ConditionOutfit* condition = static_cast<ConditionOutfit*>(Condition::createCondition(CONDITIONID_COMBAT, CONDITION_OUTFIT, duration, 0));
condition->setOutfit(mType->outfit);
combat->setParam(COMBAT_PARAM_AGGRESSIVE, 0);
combat->setCondition(condition);
}
} else if ((attr = node.attribute("item"))) {
Outfit_t outfit;
outfit.lookTypeEx = pugi::cast<uint16_t>(attr.value());
ConditionOutfit* condition = static_cast<ConditionOutfit*>(Condition::createCondition(CONDITIONID_COMBAT, CONDITION_OUTFIT, duration, 0));
condition->setOutfit(outfit);
combat->setParam(COMBAT_PARAM_AGGRESSIVE, 0);
combat->setCondition(condition);
}
} else if (tmpName == "invisible") {
int32_t duration = 10000;
if ((attr = node.attribute("duration"))) {
duration = pugi::cast<int32_t>(attr.value());
}
Condition* condition = Condition::createCondition(CONDITIONID_COMBAT, CONDITION_INVISIBLE, duration, 0);
combat->setParam(COMBAT_PARAM_AGGRESSIVE, 0);
combat->setCondition(condition);
} else if (tmpName == "drunk") {
int32_t duration = 10000;
if ((attr = node.attribute("duration"))) {
duration = pugi::cast<int32_t>(attr.value());
}