本文整理汇总了C++中Damage::getPhysicalReflected方法的典型用法代码示例。如果您正苦于以下问题:C++ Damage::getPhysicalReflected方法的具体用法?C++ Damage::getPhysicalReflected怎么用?C++ Damage::getPhysicalReflected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Damage
的用法示例。
在下文中一共展示了Damage::getPhysicalReflected方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doReflectionDamage
bool Creature::doReflectionDamage(Damage damage, Creature* target, ReflectedDamageType printZero) {
int dmg = damage.getReflected() ? damage.getReflected() : damage.getPhysicalReflected();
// don't quit if we want to print 0
if(!dmg && printZero == REFLECTED_NONE)
return(false);
if(damage.getReflected() || printZero == REFLECTED_MAGIC) {
target->printColor("Your shield of magic reflects %s%d^x damage.\n", target->customColorize("*CC:DAMAGE*").c_str(), dmg);
printColor("%M's shield of magic flares up and hits you for %s%d^x damage.\n", target, customColorize("*CC:DAMAGE*").c_str(), dmg);
broadcastGroup(false, this, "%M's shield of magic flares up and hits %N for *CC:DAMAGE*%d^x damage.\n",
target, this, dmg);
} else {
switch(damage.getPhysicalReflectedType()) {
case REFLECTED_FIRE_SHIELD:
default:
target->printColor("Your shield of fire reflects %s%d^x damage.\n", target->customColorize("*CC:DAMAGE*").c_str(), dmg);
printColor("%M's shield of fire flares up and hits you for %s%d^x damage.\n", target, customColorize("*CC:DAMAGE*").c_str(), dmg);
broadcastGroup(false, this, "%M's shield of fire flares up and hits %N for *CC:DAMAGE*%d^x damage.\n",
target, this, dmg);
break;
}
}
if(damage.getDoubleReflected()) {
Damage reflectedDamage;
reflectedDamage.setReflected(damage.getDoubleReflected());
target->doReflectionDamage(reflectedDamage, this);
}
// we may have gotten this far for printing reasons (even on zero), but really, go no further
if(!dmg)
return(false);
if(target->isPlayer() && isMonster())
getAsMonster()->adjustThreat(target, dmg);
hp.decrease(dmg);
if(hp.getCur() <= 0)
return(true);
return(false);
}