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


C++ CNpc::isNonAttackingObject方法代码示例

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


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

示例1: GetMagicDamage

short CMagicProcess::GetMagicDamage(int tid, int total_hit, int attribute, int dexpoint, int righthand_damage)
{
	short damage = 0, temp_hit = 0 ; 
	int random = 0, total_r = 0 ;
	uint8 result;
	bool bSign = true;

	if( tid < NPC_BAND || tid > INVALID_BAND) return 0;     // Check if target id is valid.

	CNpc* pNpc = g_pMain->m_arNpc.GetData(tid);
	if (pNpc == nullptr || pNpc->isDead()
		|| pNpc->isNonAttackingObject())
		return 0;
	
	//result = m_pSrcUser->GetHitRate(m_pSrcUser->m_fHitrate / pNpc->m_sEvadeRate ); 
	result = SUCCESS;
		
	if (result != FAIL) {		// In case of SUCCESS (and SUCCESS only!) .... 
		switch (attribute) {
			case FIRE_R	:
				total_r = pNpc->m_byFireR;
				break;
			case COLD_R :
				total_r = pNpc->m_byColdR;
				break;
			case LIGHTNING_R :
				total_r = pNpc->m_byLightningR ;
				break;
			case MAGIC_R :
				total_r = pNpc->m_byMagicR ;
				break;
			case DISEASE_R :
				total_r = pNpc->m_byDiseaseR ;
				break;
			case POISON_R :			
				total_r = pNpc->m_byPoisonR ;
				break;
		}	

		total_hit = (total_hit * (dexpoint  + 20)) / 170;

		if(total_hit < 0)	{
			total_hit = abs(total_hit);
			bSign = false;
		}
		
		damage = (short)(total_hit - (0.7f * total_hit * total_r / 200)) ;
		random = myrand (0, damage) ;
		damage = (short)((0.7f * (total_hit - (0.9f * total_hit * total_r / 200))) + 0.2f * random);
//		damage = damage + (3 * righthand_damage);
		damage = damage + righthand_damage;
	}
	else damage = 0 ;

	if (!bSign && damage != 0)	{
		damage = -damage;
	}

	// Apply boost for skills matching weather type.
	// This isn't actually used officially, but I think it's neat...
	GetWeatherDamage(damage, attribute);
		
	//return 1;
	return damage;
}
开发者ID:llfudi,项目名称:snoxd-koserver,代码行数:65,代码来源:MagicProcess.cpp


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