当前位置: 首页>>代码示例>>C++>>正文


C++ Bottle::getLifeVal方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:cirosantilli,项目名称:netWork-fork,代码行数:101,代码来源:pet_attack_monster.cpp


注:本文中的Bottle::getLifeVal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。