本文整理汇总了C++中Monster::addToRoom方法的典型用法代码示例。如果您正苦于以下问题:C++ Monster::addToRoom方法的具体用法?C++ Monster::addToRoom怎么用?C++ Monster::addToRoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monster
的用法示例。
在下文中一共展示了Monster::addToRoom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doFlee
bool Creature::doFlee(bool magicTerror) {
Monster* mThis = getAsMonster();
Player* pThis = getAsPlayer();
BaseRoom* oldRoom = getRoomParent(), *newRoom=0;
UniqueRoom* uRoom=0;
Exit* exit=0;
unsigned int n=0;
if(isEffected("fear"))
magicTerror = true;
exit = getFleeableExit();
if(!exit) {
printColor("You couldn't find any place to run to!\n");
if(pThis)
pThis->setFleeing(false);
return(0);
}
newRoom = getFleeableRoom(exit);
if(!newRoom) {
printColor("You failed to escape!\n");
return(0);
}
switch(mrand(1,10)) {
case 1:
print("You run like a chicken.\n");
break;
case 2:
print("You flee in terror.\n");
break;
case 3:
print("You run screaming in horror.\n");
break;
case 4:
print("You flee aimlessly in any direction you can.\n");
break;
case 5:
print("You run screaming for your mommy.\n");
break;
case 6:
print("You run as your life flashes before your eyes.\n");
break;
case 7:
print("Your heart throbs as you attempt to escape death.\n");
break;
case 8:
print("Colors and sounds mingle as you frantically flee.\n");
break;
case 9:
print("Fear of death grips you as you flee in panic.\n");
break;
case 10:
print("You run like a coward.\n");
break;
default:
print("You run like a chicken.\n");
break;
}
broadcast(getSock(), oldRoom, "%M flees to the %s^x.", this, exit->getCName());
if(mThis) {
mThis->diePermCrt();
if(exit->doEffectDamage(this))
return(2);
mThis->deleteFromRoom();
mThis->addToRoom(newRoom);
} else if(pThis) {
pThis->dropWeapons();
pThis->checkDarkness();
unhide();
if(magicTerror)
printColor("^rYou flee from unnatural fear!\n");
Move::track(getUniqueRoomParent(), ¤tLocation.mapmarker, exit, pThis, false);
if(pThis->flagIsSet(P_ALIASING)) {
pThis->getAlias()->deleteFromRoom();
pThis->getAlias()->addToRoom(newRoom);
}
Move::update(pThis);
pThis->statistics.flee();
if(cClass == CreatureClass::PALADIN && deity != GRADIUS && !magicTerror && level >= 10) {
n = level * 8;
n = MIN<long>(experience, n);
print("You lose %d experience for your cowardly retreat.\n", n);
experience -= n;
}
if(exit->doEffectDamage(this))
return(2);
pThis->deleteFromRoom();
pThis->addToRoom(newRoom);
//.........这里部分代码省略.........