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


C++ P_CHAR::getStrength方法代码示例

本文整理汇总了C++中P_CHAR::getStrength方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::getStrength方法的具体用法?C++ P_CHAR::getStrength怎么用?C++ P_CHAR::getStrength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在P_CHAR的用法示例。


在下文中一共展示了P_CHAR::getStrength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

// Name:	item_bounce3
// Purpose:	holds some statements that were COPIED some 50 times
// Remarks:	temporary functions to revamp the 30 occurences of the 'bouncing bugfix'
// History:	init Duke, 10.8.2000 / bugfix for bonus stats, Xanathar, 05-aug-2001
static void item_bounce3(const P_ITEM pi)
{
	VALIDATEPI( pi );
	pi->setContSerial( pi->getContSerial(true) );
	pi->setPosition( pi->getOldPosition() );
	pi->layer=pi->oldlayer;

	P_CHAR pc = pointers::findCharBySerial( pi->getContSerial(true) );
	if(pc==NULL)
		return ;
	VALIDATEPC( pc );
	if ( pi->layer > 0 )
	{
		// Xanathar -- add BONUS STATS given by equipped special items
		pc->setStrength( pc->getStrength() + pi->st2, true );
		//pc->st += pi->st2;
		pc->dx += pi->dx2;
		pc->in += pi->in2;
		// Xanathar -- for poisoned items
		if (pi->poisoned)
		{
			pc->poison += pi->poisoned;
			if ( pc->poison < 0)
				pc->poison = 0;
		}
	}
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:31,代码来源:dragdrop.cpp

示例2:

/*!
\brief Check when player is teleporting if overloaded
\author Morrolan
\return ??
\param pc the character
*/
int weights::CheckWeight2(P_CHAR pc)
{
	if ((pc->weight > (pc->getStrength()*WEIGHT_PER_STR)+30))
	{
		pc->mn -= 30;
		if (pc->mn<=0)
		{
			pc->mn=0;
		}
		return 1;
	}
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:19,代码来源:weight.cpp

示例3: CheckWeight

/*!
\brief Check when player is walking if overloaded
\author Unknow
\return 1 if k, 0 if overloaded
\param pc the character
*/
int weights::CheckWeight(P_CHAR pc)
{
	const static char steps[4]	= {25,50,75,100};//,
					  //steps2[5]	= {0,25,50,75}; //per cent steps

	int limit	= pc->getStrength()*WEIGHT_PER_STR+30, //weight limit
		percent	= int(((float)pc->weight/(float)limit)*100.0f), //current weight per cent
		ret=1,
		result; //for float rounding purposes

	UI08 index,x;
	float amount;

	if(pc->weight>limit) index=5; //overweight
	else if(percent==100) index=4; //100% weight
	else for(x=0;x<4;x++) if(percent<steps[x]) { index=x; break; } //less than 100%

/*	if(index<4)
	{
		float stepdiff		= float(steps[index]-steps2[index]),
			  percentdiff	= float(percent-steps2[index]),
			  stadiff		= ServerScp::g_fStaminaUsage[index+1]-ServerScp::g_fStaminaUsage[index];

		amount=ServerScp::g_fStaminaUsage[index]+(percentdiff/stepdiff)*stadiff;
	}
	else 
*/		amount=ServerScp::g_fStaminaUsage[index];

	if(pc->running) amount*=2; //if running, double the amount of stamina used
	if(pc->isMounting()) amount*=(float)server_data.staminaonhorse;

	pc->fstm+=amount; //increase the amount of stamina to be subtracted

	if(pc->fstm>=1.0f) //if stamina to be removed is less than 1, wait
	{
		result=(int)pc->fstm; //round it
		pc->fstm-=result;
		pc->stm-=result;
		if(pc->stm<=0)
		{
			pc->stm=0;
			ret=0;
		}
		pc->updateStats(2);
	}
	
	return ret;

}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:55,代码来源:weight.cpp

示例4: checkWearable

LOGICAL  checkWearable(P_CHAR pc, P_ITEM pi)
{
	NXWSOCKET s = pc->getSocket();
	if (s < 0)
		return false;
	if( (pi->getId()>>8) >= 0x40)  // LB, client crashfix if multi-objects are moved to PD
		return false;
	tile_st tile;

	data::seekTile(pi->getId(), tile);

	if( ( clientDimension[s]==3 ) &&  (tile.quality==0) )
	{
		pc->sysmsg(TRANSLATE("You can't wear that"));
		return false;
	}
	else 
	{
		P_ITEM outmost = pi->getOutMostCont();
		P_CHAR vendor = pointers::findCharBySerial( outmost->getContSerial() );
		if( ISVALIDPC( vendor ) && ( vendor->getOwnerSerial32() != pc->getSerial32() ) )
		{
			return false;
		}

	}
	if ( !pc->IsGM() && pi->st > pc->getStrength() && !pi->isNewbie() ) // now you can equip anything if it's newbie
	{
		pc->sysmsg(TRANSLATE("You are not strong enough to use that."));
		return false;
	}
	else if ( !pc->IsGM() && !checkItemUsability(pc, pi, ITEM_USE_WEAR) )
	{
		return false;
	}
	else if ( (pc->getId() == BODY_MALE) && ( pi->getId()==0x1c00 || pi->getId()==0x1c02 || pi->getId()==0x1c04 || pi->getId()==0x1c06 || pi->getId()==0x1c08 || pi->getId()==0x1c0a || pi->getId()==0x1c0c ) ) // Ripper...so males cant wear female armor
	{
		pc->sysmsg(TRANSLATE("You cant wear female armor!"));
		return false;
	}
	else if ((((pi->magic==2)||((tile.weight==255)&&(pi->magic!=1))) && !pc->canAllMove()) ||
			( (pi->magic==3|| pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
	{
		return false;
	}
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:47,代码来源:dragdrop.cpp

示例5: checkItemUsability

/*!
\brief wrap for check usability
\author Xanathar
\return bool
\param pc player trying using
\param pi pointer to item to be used
\param type type of usability
\remarks Luxor - Added REQSKILL command support, three bug fix applied 
*/
bool checkItemUsability(P_CHAR pc, P_ITEM pi, int type)
{
	g_nType = type;
	VALIDATEPIR(pi, false);
	VALIDATEPCR(pc, false);

	NXWSOCKET s = pc->getSocket();

	if( !pi->isNewbie() && ! pc->IsGM())
	{
		if ( pi->st > pc->getStrength() ) 
		{
			pc->sysmsg(TRANSLATE("You are not strong enough to use that."));
			return false;
		}
		if ( pi->dx > pc->dx )
		{
			pc->sysmsg(TRANSLATE("You are not quick enough to use that."));
			return false;
		}
		if ( pi->in > pc->in )
		{
			pc->sysmsg(TRANSLATE("You are not intelligent enough to use that."));
			return false;
		}
		//Luxor: REQSKILL command support
		if (pi->reqskill[0] > 0 && pi->reqskill[1] > 0 )
		{
			if (pi->reqskill[1] > pc->skill[pi->reqskill[0]]) {
				pc->sysmsg(TRANSLATE("You are not skilled enough to use that."));
				return false;
			}
		}
		if ( (pi->getGender() != INVALID && pi->getGender() != GENDER_NEUTRAL ) && pi->getGender() != pc->getGender() )
		{
			if ( pi->getGender() == 1 ) // it's a man item
				pc->sysmsg(TRANSLATE("Only males of your species may use that !"));
			else if ( pi->getGender() == 2 ) // it's a man item
				pc->sysmsg(TRANSLATE("Only females of your species may use that !"));
			else
				pc->sysmsg(TRANSLATE("You may not use that !")); // Damn, whats the political correct term for "Get some recreational extensions to your body"
			return false;
		}
		if ( Race::isRaceSystemActive() )
			if ( pi->getRace() != INVALID && pi->getRace() != pc->getRace() )
			{
				pc->sysmsg(TRANSLATE("Your race may not use this item!")); // Hope no one sues me because of racial discrimination in item use
				return false;
			}


	}

	if (s >-1 && s < now) //Luxor
	{
		
		if (pi->amxevents[EVENT_IONCHECKCANUSE]==NULL) return true;
		return (0!=pi->amxevents[EVENT_IONCHECKCANUSE]->Call(pi->getSerial32(), pc->getSerial32(), g_nType));
		/*
		AmxEvent* event = pi->getAmxEvent( EVENT_IONCHECKCANUSE );
		if ( !event ) return true;
		return ( 0 != event->Call(pi->getSerial32(), s, g_nType ) );
		*/
	}
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:75,代码来源:amxcback.cpp

示例6: wear_item

void wear_item(NXWCLIENT ps) // Item is dropped on paperdoll
{
	if ( ps == NULL )
		return;
	NXWSOCKET s = ps->toInt();
	if (s < 0)
		return;
	P_CHAR pc=ps->currChar();
	VALIDATEPC( pc );
	P_CHAR pck = pointers::findCharBySerPtr(buffer[s]+6);
	VALIDATEPC( pck );
	if( pck->dead )  //Exploit fix: Dead ppl can't equip anything.
		return;
	P_ITEM pi=pointers::findItemBySerPtr(buffer[s]+1);
	VALIDATEPI(pi);

	bool resetDragging = false;

	if( (pi->getId()>>8) >= 0x40)  // LB, client crashfix if multi-objects are moved to PD
		resetDragging = true;

	tile_st tile;
	int serial/*, letsbounce=0*/; // AntiChrist (5) - new ITEMHAND system

	data::seekTile(pi->getId(), tile);

	if( ( clientDimension[s]==3 ) &&  (tile.quality==0) )
	{
		ps->sysmsg(TRANSLATE("You can't wear that"));
		resetDragging = true;
	}
	else {
		P_ITEM outmost = pi->getOutMostCont();
		P_CHAR vendor = pointers::findCharBySerial( outmost->getContSerial() );
		if( ISVALIDPC( vendor ) && ( vendor->getOwnerSerial32() != pc->getSerial32() ) )
		{
			resetDragging = true;
		}

	}

	if( resetDragging ) {
		Sndbounce5(s);
		if (ps->isDragging())
		{
			ps->resetDragging();
			item_bounce4(s,pi);
			UpdateStatusWindow(s,pi);
		}
		return;
	}

	if ( pck->getSerial32() == pc->getSerial32() || pc->IsGM() )
	{

		if ( !pc->IsGM() && pi->st > pck->getStrength() && !pi->isNewbie() ) // now you can equip anything if it's newbie
		{
			ps->sysmsg(TRANSLATE("You are not strong enough to use that."));
			resetDragging = true;
		}
		else if ( !pc->IsGM() && !checkItemUsability(pc, pi, ITEM_USE_WEAR) )
		{
			resetDragging = true;
		}
		else if ( (pc->getId() == BODY_MALE) && ( pi->getId()==0x1c00 || pi->getId()==0x1c02 || pi->getId()==0x1c04 || pi->getId()==0x1c06 || pi->getId()==0x1c08 || pi->getId()==0x1c0a || pi->getId()==0x1c0c ) ) // Ripper...so males cant wear female armor
		{
			ps->sysmsg(TRANSLATE("You cant wear female armor!"));
			resetDragging = true;
		}
		else if ((((pi->magic==2)||((tile.weight==255)&&(pi->magic!=1))) && !pc->canAllMove()) ||
				( (pi->magic==3|| pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
		{
			resetDragging = true;
		}

		if( resetDragging ) {
			Sndbounce5(s);
			if (ps->isDragging())
			{
				ps->resetDragging();
				item_bounce4(s,pi);
				UpdateStatusWindow(s,pi);
			}
			return;
		}



		// - AntiChrist (4) - checks for new ITEMHAND system
		// - now you can't equip 2 hnd weapons with 1hnd weapons nor shields!!
		serial= pck->getSerial32(); //xan -> k not cc :)

		P_ITEM pj = NULL;
 		P_CHAR pc_currchar= pck;
// 		P_ITEM pack= pc_currchar->getBackpack();
                //<Luxor>

		P_ITEM pW = pc_currchar->getWeapon();
		if (tile.quality == 1 || tile.quality == 2)
		{ //weapons layers
//.........这里部分代码省略.........
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:101,代码来源:dragdrop.cpp


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