本文整理汇总了C++中Spell::getTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ Spell::getTarget方法的具体用法?C++ Spell::getTarget怎么用?C++ Spell::getTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spell
的用法示例。
在下文中一共展示了Spell::getTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_cast_spell
//.........这里部分代码省略.........
// heroes can't have less than 1 channel
if (lSpell->getCostChannels() >= ((Puppet*)lCaster)->getChannels())
valid = valid && false;
}
if (lSpell->getCostHP() > lCaster->getHP())
valid = valid && false;
if (!valid)
{
if (lCaster->getRank() == PUPPET)
{
Puppet* tCaster = (Puppet*)lCaster;
log_->errorStream()
<< "caster" << tCaster->getUID()
<< " failed the resources requirements of the spell" << lSpell->getUID()
<< " : \t "
<< lSpell->getCostWP() << ":" << lSpell->getCostHP() << ":" << lSpell->getCostChannels()
<< " vs "
<< tCaster->getWP() << ":" << tCaster->getHP() << ":" << tCaster->getChannels();
}
Event e(inEvt);
return reject(e);
}
}
// prepare the response event
Event resp(inEvt);
resp.setProperty("Spell", lSpell->getUID());
resp.setProperty("C", lSpell->getCaster()->getUID());
if (lSpell->requiresTarget())
resp.setProperty("T", lSpell->getTarget()->getUID());
// dispatch to Lua
/*lua_getfield(lua_, LUA_GLOBALSINDEX, "process_spell");
if(!lua_isfunction(lua_, 1))
{
log_->errorStream() << "could not find Lua event processor!";
lua_pop(lua_,1);
Event e(inEvt);
return reject(e);
}
log_->debugStream() << "\t things are looking good, passing to lua: "
<< ", cost: " << lSpell->getCostWP() << ":" << lSpell->getCostHP() << ":"
<< lSpell->getCostChannels();
tolua_pushusertype(lua_,(void*)lCaster,"Pixy::Entity");
tolua_pushusertype(lua_,(void*)lTarget,"Pixy::Entity");
tolua_pushusertype(lua_,(void*)lSpell,"Pixy::Spell");
tolua_pushusertype(lua_,(void*)&inEvt,"Pixy::Event");
try {
lua_call(lua_, 4, 1);
} catch (std::exception& e) {
log_->errorStream() << "Lua Handler: " << e.what();
}
bool result = lua_toboolean(lua_, lua_gettop(lua_));
lua_remove(lua_, lua_gettop(lua_));*/
bool result = pass_to_lua(
"Spells.onCastSpell",
3,
"Pixy::Entity", lCaster,