本文整理汇总了C++中Monster::addAccuDelay方法的典型用法代码示例。如果您正苦于以下问题:C++ Monster::addAccuDelay方法的具体用法?C++ Monster::addAccuDelay怎么用?C++ Monster::addAccuDelay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monster
的用法示例。
在下文中一共展示了Monster::addAccuDelay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeMonster
//.........这里部分代码省略.........
}
}
// target
int targetLevel = 0;
int targetMaxHP = 0;
if (pEnemy->isSlayer())
{
Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pEnemy);
targetLevel = pTargetSlayer->getHighestSkillDomainLevel();
targetMaxHP = pTargetSlayer->getHP(ATTR_MAX);
}
else if (pEnemy->isVampire())
{
Vampire* pTargetVampire = dynamic_cast<Vampire*>(pEnemy);
targetLevel = pTargetVampire->getLevel();
targetMaxHP = pTargetVampire->getHP(ATTR_MAX);
}
else if (pEnemy->isOusters())
{
Ousters* pTargetOusters = dynamic_cast<Ousters*>(pEnemy);
targetLevel = pTargetOusters->getLevel();
targetMaxHP = pTargetOusters->getHP(ATTR_MAX);
}
else if (pEnemy->isMonster())
{
Monster* pEnemyMonster = dynamic_cast<Monster*>(pEnemy);
// 흡혈당하는 몬스터한테 딜레이 걸어준다.
Timeval DelayTurn;
DelayTurn.tv_sec = 4;
DelayTurn.tv_usec = 500000;
pEnemyMonster->addAccuDelay(DelayTurn);
if ((pMonster->isMaster()
#ifdef __UNDERWORLD__
|| pMonster->isUnderworld() || pMonster->getMonsterType() == 599
#endif
)
&& pMonster->getClanType()==pEnemyMonster->getClanType())
{
// 같은 clan의 마스터이면 피 상납이라고 볼 수 있을까 -_-;
}
else
{
pEnemyMonster->addEnemy(pMonster);
}
targetLevel = pEnemyMonster->getLevel();
targetMaxHP = pEnemyMonster->getHP(ATTR_MAX);
}
// 자신이나 상대방 중.. HP가 많은 쪽의 15~25%
HP_t maxHP = max((int)pMonster->getHP(ATTR_MAX), targetMaxHP);
HP_t drainHP = maxHP*(rand()%11+15)/100; // 15~25%
// 한번에 1000이상 안 찬다.
if (pMonster->getMonsterType() >= 717 )
drainHP = min((int)drainHP, 2000);
else
drainHP = min((int)drainHP, 1000);
// 몬스터의 HP를 올려준다.
HP_t CurrentHP = pMonster->getHP();
HP_t MaxHP = pMonster->getHP(ATTR_MAX);
示例2: execute
//.........这里部分代码省略.........
int targetLevel = 0;
int targetMaxHP = 0;
// 페임을 올려준다.
if (pTargetCreature->isSlayer())
{
//increaseFame(pVampire, Exp);
Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pTargetCreature);
targetLevel = pTargetSlayer->getHighestSkillDomainLevel();
targetMaxHP = pTargetSlayer->getHP(ATTR_MAX);
}
else if (pTargetCreature->isVampire())
{
//increaseFame(pVampire, Exp);
Vampire* pTargetVampire = dynamic_cast<Vampire*>(pTargetCreature);
targetLevel = pTargetVampire->getLevel();
targetMaxHP = pTargetVampire->getHP(ATTR_MAX);
}
else if (pTargetCreature->isOusters())
{
//increaseFame(pOusters, Exp);
Ousters* pTargetOusters = dynamic_cast<Ousters*>(pTargetCreature);
targetLevel = pTargetOusters->getLevel();
targetMaxHP = pTargetOusters->getHP(ATTR_MAX);
}
else if (pTargetCreature->isMonster())
{
Monster* pMonster = dynamic_cast<Monster*>(pTargetCreature);
Timeval NextTurn = pMonster->getNextTurn();
Timeval DelayTurn;
DelayTurn.tv_sec = 4;
DelayTurn.tv_usec = 500000;
pMonster->addAccuDelay(DelayTurn);
pMonster->addEnemy(pVampire);
targetLevel = pMonster->getLevel();
targetMaxHP = pMonster->getHP(ATTR_MAX);
}
shareVampExp(pVampire, Exp, _GCBloodDrainOK1);
// 흡혈을 하게 되면 흡혈한 사람의 체력이 올라간다.
// Mephisto이펙트가 걸려있으면 HP는 안 올라간다.
if (!pVampire->isFlag(Effect::EFFECT_CLASS_MEPHISTO))
{
HP_t HealPoint = (Exp==0? computeBloodDrainHealPoint(pTargetCreature, BLOODDRAIN_EXP) : Exp);
HP_t CurrentHP = pVampire->getHP();
HP_t MaxHP = pVampire->getHP(ATTR_MAX);
HP_t NewHP = min((int)MaxHP , (int)CurrentHP + (int)HealPoint);
// 은 데미지 관련 처리를 해 준다.
Silver_t newSilverDamage = max(0, (int)pVampire->getSilverDamage()-(int)HealPoint);
pVampire->saveSilverDamage(newSilverDamage);
_GCBloodDrainOK1.addShortData(MODIFY_SILVER_DAMAGE, newSilverDamage);
// 뱀파이어의 HP를 세팅한다.
pVampire->setHP(NewHP);
GCStatusCurrentHP gcStatusCurrentHP;
gcStatusCurrentHP.setObjectID(pVampire->getObjectID());
gcStatusCurrentHP.setCurrentHP(NewHP);
pZone->broadcastPacket(pVampire->getX(), pVampire->getY(), &gcStatusCurrentHP, pVampire);
_GCBloodDrainOK1.addShortData(MODIFY_CURRENT_HP, NewHP);
}