本文整理汇总了C++中Armor::isDestroyed方法的典型用法代码示例。如果您正苦于以下问题:C++ Armor::isDestroyed方法的具体用法?C++ Armor::isDestroyed怎么用?C++ Armor::isDestroyed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armor
的用法示例。
在下文中一共展示了Armor::isDestroyed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hit
bool Actor::hit(int dmg, const DamageTypes_t damageType) {
tracer << "Actor::hit()..." << endl;
tracer << "Actor: Damage from parameter: " << dmg << endl;
monsterHit(dmg);
tracer << "Actor: Damage after monsterHit(): " << dmg << endl;
dmg = max(1, dmg);
//Filter damage through worn armor
if(isHumanoid()) {
Armor* armor = dynamic_cast<Armor*>(inventory_->getItemInSlot(slot_armorBody));
if(armor != NULL) {
tracer << "Actor: Has armor, running hit on armor" << endl;
dmg = armor->takeDurabilityHitAndGetReducedDamage(dmg, damageType);
if(armor->isDestroyed()) {
tracer << "Actor: Armor was destroyed" << endl;
if(this == eng->player) {
eng->log->addMessage("My " + eng->itemData->getItemRef(armor, itemRef_plain) + " is torn apart!");
}
delete armor;
armor = NULL;
inventory_->getSlot(slot_armorBody)->item = NULL;
}
}
}
// Filter damage through intrinsic armor
// TODO Stuff goes here
statusEffectsHandler_->isHit();
actorSpecific_hit(dmg);
//Damage to corpses
if(deadState != actorDeadState_alive) {
if(dmg >= getHpMax(true) / 2) {
deadState = actorDeadState_mangled;
glyph_ = ' ';
if(isHumanoid()) {
eng->gore->makeGore(pos);
}
}
tracer << "Actor::hit() [DONE]" << endl;
return false;
}
if(this != eng->player || eng->config->BOT_PLAYING == false) {
hp_ -= dmg;
}
const bool IS_ON_BOTTOMLESS = eng->map->featuresStatic[pos.x][pos.y]->isBottomless();
const bool IS_MANGLED = IS_ON_BOTTOMLESS == true ? true : (dmg > ((getHpMax(true) * 5) / 4) ? true : false);
if(getHp() <= 0) {
die(IS_MANGLED, !IS_ON_BOTTOMLESS, !IS_ON_BOTTOMLESS);
actorSpecificDie();
tracer << "Actor::hit() [DONE]" << endl;
return true;
} else {
tracer << "Actor::hit() [DONE]" << endl;
return false;
}
}