本文整理汇总了C++中Bottle::getLifeVal方法的典型用法代码示例。如果您正苦于以下问题:C++ Bottle::getLifeVal方法的具体用法?C++ Bottle::getLifeVal怎么用?C++ Bottle::getLifeVal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bottle
的用法示例。
在下文中一共展示了Bottle::getLifeVal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attactMonsterArrange
/*宠物群攻判定*/
void Pet::attactMonsterArrange(MonsterBase *monster,double skiHrtRatio,double _cdTime,int index)
{
Hero *owner=heroid_to_hero(masterId);
if (owner==NULL)
{
return;
}
Map_Inform *mapNow = owner->getMap();
if (mapNow==NULL)
{
return;
}
// 群体指向性技能不闪避
float hitTimes = 1.0f;
int lifeHurt = 0;
unsigned range = 0;
bool isCrit = false;
// 群攻技能不带debuff
int atkNum = 0; //受攻击人数
char msg[4096] = {0};
char tempMsg[4096] = {0};
sprintf(msg, "26,2,1,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d",petdata->petskilldata[index-1].id, 1,
petdata->identity, 100, 100, 100,100,0, 0, isCrit);
// cout<<"It have enter here and msg is "<<msg<<endl;
Nbox *box = mapNow->getBox();
if (box == NULL)
{
return;
}
Point objPt;
Point tempPt;
objPt = monster->getLocation();
range = petdata->petskilldata[index-1].range;
if (range != 200)
{
range = 200;
}
range += 50; //比客户端放大50范围
OneScreen *neighborScrs[4] = {0}, *oneScr = NULL;
box->getNeighbour(objPt, neighborScrs);
set<string> tempSet;
for (int i = 0; i < 4; i++)
{
oneScr = neighborScrs[i];
if (oneScr == NULL)
{
continue;
}
// cout<<"hero pk state is "<<owner->gethero_PK_status()<<endl;
if (owner->gethero_PK_status() != PEACE_MODE)
{
set<string>::iterator it_id;
tempSet = oneScr->heroSet;
for (it_id = tempSet.begin(); it_id != tempSet.end(); it_id++)
{
if (!strcmp(owner->getIdentity(), (*it_id).c_str()))
{
// 是宠物的主人
continue;
}
Hero *hitedHero = heroid_to_hero(*it_id);
if (hitedHero == NULL)
{
continue;
}
// 已经死亡
if (hitedHero->getLifeVal() <= 0)
{
cout<<"The atked hero is dead when use many atk skill"<<endl;
continue;
}
// 无敌状态
if (hitedHero->skillBuffState & BUFF_INVINCIBLE_STATE)
{
cout<<"The atked hero is invinc for atk"<<endl;
continue;
}
if (relationCheck(owner, hitedHero, mapNow) != 2)
{
// 不是敌人,不能攻击
cout<<"The hero is not your enemy when use many atk skill !!"<<endl;
continue;
}
tempPt = hitedHero->getLocation();
cout<<"really distance is:"<<GET_DISTANCE(tempPt, objPt)<<endl;
cout<<"can hurt range is:"<<range<<endl;
if (IS_OUT_RANGE(tempPt, objPt, range))
{
// 不在作用范围内
cout<<"The atked hero is out of range when use many atk skill!!"<<endl;
continue;
//.........这里部分代码省略.........