⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skillutil.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	{		Vampire* pTargetVampire = dynamic_cast<Vampire*>(pTargetCreature);		Assert(pTargetVampire != NULL);		Protection_t Protection = pTargetVampire->getProtection();		Protection = (Protection_t)getPercentValue(Protection, VampireTimebandFactor[timeband]);		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isOusters()) 	{		Ousters* pTargetOusters = dynamic_cast<Ousters*>(pTargetCreature);		Assert(pTargetOusters != NULL);		Protection_t Protection = pTargetOusters->getProtection();		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isMonster()) 	{		Monster* pTargetMonster = dynamic_cast<Monster*>(pTargetCreature);		Assert(pTargetMonster != NULL);		Protection_t Protection = pTargetMonster->getProtection();		Protection = (Protection_t)getPercentValue(Protection, MonsterTimebandFactor[timeband]);#ifdef __UNDERWORLD__		if ( pTargetMonster->isUnderworld() || pTargetMonster->getMonsterType() == 599)		{			Protection = pTargetMonster->getProtection();		}#endif		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	}	else	{		// NPC扼绰 富牢啊...		return 0;	}	// AbilityBalance.cpp俊辑 茄促.	//FinalDamage += g_pVariableManager->getCombatSlayerDamageBonus();	return (Damage_t)FinalDamage;}//////////////////////////////////////////////////////////////////////////////// 轨颇捞绢 傍拜磊客 乔傍拜磊 荤捞狼 单固瘤甫 拌魂茄促.//////////////////////////////////////////////////////////////////////////////Damage_t computeVampireDamage(Vampire* pVampire, Creature* pTargetCreature, bool bCritical){	Assert(pVampire != NULL);	Assert(pTargetCreature != NULL);	double 	 FinalDamage = 0;	Damage_t MinDamage   = pVampire->getDamage(ATTR_CURRENT);	Damage_t MaxDamage   = pVampire->getDamage(ATTR_MAX);	uint     timeband    = getZoneTimeband( pVampire->getZone() );	// vampire 公扁俊 狼茄 单固瘤	Item*    pItem       = pVampire->getWearItem(Vampire::WEAR_RIGHTHAND);	// 公扁甫 甸绊 乐促搁, min, max俊 公扁狼 min, max甫 拌魂秦 霖促.	if (pItem != NULL && pVampire->isRealWearingEx(Vampire::WEAR_RIGHTHAND))	{		MinDamage += pItem->getMinDamage();		MaxDamage += pItem->getMaxDamage();	}	// 角力 罚待 单固瘤甫 拌魂茄促.	Damage_t RealDamage = max(1, Random(MinDamage, MaxDamage));	RealDamage = (Damage_t)getPercentValue(RealDamage, VampireTimebandFactor[timeband]);	if (pTargetCreature->isSlayer()) 	{		Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pTargetCreature);		Assert(pTargetSlayer != NULL);		Protection_t Protection = pTargetSlayer->getProtection();		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isVampire()) 	{		Vampire* pTargetVampire = dynamic_cast<Vampire*>(pTargetCreature);		Assert(pTargetVampire != NULL);		Protection_t Protection = pTargetVampire->getProtection();		Protection = (Protection_t)getPercentValue(Protection, VampireTimebandFactor[timeband]);		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isOusters()) 	{		Ousters* pTargetOusters = dynamic_cast<Ousters*>(pTargetCreature);		Assert(pTargetOusters != NULL);		Protection_t Protection = pTargetOusters->getProtection();		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isMonster())	{		Monster* pTargetMonster = dynamic_cast<Monster*>(pTargetCreature);		Assert(pTargetMonster != NULL);		Protection_t Protection = pTargetMonster->getProtection();		Protection = (Protection_t)getPercentValue(Protection, MonsterTimebandFactor[timeband]);#ifdef __UNDERWORLD__		if ( pTargetMonster->isUnderworld() || pTargetMonster->getMonsterType() == 599)		{			Protection = pTargetMonster->getProtection();		}#endif		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	}	else	{		// NPC扼绰 富牢啊...		return 0;	}	// AbilityBalance.cpp俊辑 茄促.	//FinalDamage += g_pVariableManager->getCombatVampireDamageBonus();	return (Damage_t)FinalDamage;}//////////////////////////////////////////////////////////////////////////////// 酒快胶磐胶 傍拜磊客 乔傍拜磊 荤捞狼 单固瘤甫 拌魂茄促.//////////////////////////////////////////////////////////////////////////////Damage_t computeOustersDamage(Ousters* pOusters, Creature* pTargetCreature, bool bCritical){	Assert(pOusters != NULL);	Assert(pTargetCreature != NULL);	double 	 FinalDamage = 0;	Damage_t MinDamage   = pOusters->getDamage(ATTR_CURRENT);	Damage_t MaxDamage   = pOusters->getDamage(ATTR_MAX);	uint     timeband    = getZoneTimeband( pOusters->getZone() );	// Ousters 公扁俊 狼茄 单固瘤	Item*    pItem       = pOusters->getWearItem(Ousters::WEAR_RIGHTHAND);	// 公扁甫 甸绊 乐促搁, min, max俊 公扁狼 min, max甫 拌魂秦 霖促.	if (pItem != NULL && pOusters->isRealWearingEx(Ousters::WEAR_RIGHTHAND))	{		MinDamage += pItem->getMinDamage();		MaxDamage += pItem->getMaxDamage();	}	// 角力 罚待 单固瘤甫 拌魂茄促.	Damage_t RealDamage = max(1, Random(MinDamage, MaxDamage));	if (pTargetCreature->isSlayer()) 	{		Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pTargetCreature);		Assert(pTargetSlayer != NULL);		Protection_t Protection = pTargetSlayer->getProtection();		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isVampire()) 	{		Vampire* pTargetVampire = dynamic_cast<Vampire*>(pTargetCreature);		Assert(pTargetVampire != NULL);		Protection_t Protection = pTargetVampire->getProtection();		Protection = (Protection_t)getPercentValue(Protection, VampireTimebandFactor[timeband]);		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isOusters()) 	{		Ousters* pTargetOusters = dynamic_cast<Ousters*>(pTargetCreature);		Assert(pTargetOusters != NULL);		Protection_t Protection = pTargetOusters->getProtection();		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isMonster())	{		Monster* pTargetMonster = dynamic_cast<Monster*>(pTargetCreature);		Assert(pTargetMonster != NULL);		Protection_t Protection = pTargetMonster->getProtection();		Protection = (Protection_t)getPercentValue(Protection, MonsterTimebandFactor[timeband]);#ifdef __UNDERWORLD__		if ( pTargetMonster->isUnderworld() || pTargetMonster->getMonsterType() == 599)		{			Protection = pTargetMonster->getProtection();		}#endif		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	}	else	{		// NPC扼绰 富牢啊...		return 0;	}	// AbilityBalance.cpp俊辑 茄促.	//FinalDamage += g_pVariableManager->getCombatOustersDamageBonus();	return (Damage_t)FinalDamage;}//////////////////////////////////////////////////////////////////////////////// 阁胶磐 傍拜磊客 乔傍拜磊 荤捞狼 单固瘤甫 拌魂茄促.//////////////////////////////////////////////////////////////////////////////Damage_t computeMonsterDamage(Monster* pMonster, Creature* pTargetCreature, bool bCritical){	Assert(pMonster != NULL);	Assert(pTargetCreature != NULL);	double   FinalDamage = 0;	Damage_t MinDamage   = pMonster->getDamage(ATTR_CURRENT);	Damage_t MaxDamage   = pMonster->getDamage(ATTR_MAX);	Damage_t RealDamage  = max(1, Random(MinDamage, MaxDamage));	uint     timeband    = getZoneTimeband( pMonster->getZone() );	RealDamage = (Damage_t)getPercentValue(RealDamage, MonsterTimebandFactor[timeband]);	if (pTargetCreature->isSlayer()) 	{		Slayer* pTargetSlayer = dynamic_cast<Slayer*>(pTargetCreature);		Assert(pTargetSlayer != NULL);		Protection_t Protection = pTargetSlayer->getProtection();		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isVampire()) 	{		Vampire* pTargetVampire = dynamic_cast<Vampire*>(pTargetCreature);		Assert(pTargetVampire != NULL);		Protection_t Protection = pTargetVampire->getProtection();		Protection = (Protection_t)getPercentValue(Protection, VampireTimebandFactor[timeband]);		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isOusters()) 	{		Ousters* pTargetOusters = dynamic_cast<Ousters*>(pTargetCreature);		Assert(pTargetOusters != NULL);		Protection_t Protection = pTargetOusters->getProtection();		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	} 	else if (pTargetCreature->isMonster())	{		Monster* pTargetMonster = dynamic_cast<Monster*>(pTargetCreature);		Assert(pTargetMonster != NULL);		Protection_t Protection = pTargetMonster->getProtection();		Protection = (Protection_t)getPercentValue(Protection, MonsterTimebandFactor[timeband]);#ifdef __UNDERWORLD__		if ( pTargetMonster->isUnderworld() || pTargetMonster->getMonsterType() == 599)		{			Protection = pTargetMonster->getProtection();		}#endif		FinalDamage = computeFinalDamage(MinDamage, MaxDamage, RealDamage, Protection, bCritical);	}	else	{		// NPC扼绰 富牢啊?		return 0;	}	return (Damage_t)FinalDamage;}//////////////////////////////////////////////////////////////////////////////// resistance甫 绊妨茄 付过 单固瘤甫 拌魂茄促.//////////////////////////////////////////////////////////////////////////////Damage_t computeMagicDamage(Creature* pTargetCreature, int Damage, SkillType_t SkillType, bool bVampire){	Assert(pTargetCreature != NULL);	SkillInfo* pSkillInfo = g_pSkillInfoManager->getSkillInfo(SkillType);	Assert(pSkillInfo != NULL);	int MagicDomain = pSkillInfo->getMagicDomain();	int MagicLevel  = pSkillInfo->getLevel();	int Resist = pTargetCreature->getResist(MagicDomain);#ifdef __CHINA_SERVER__	if ( bVampire )		Resist = (int)(Resist / 1.2);	// 历亲仿俊 蝶扼 单固瘤甫 啊皑茄促.	int penalty = (int)(MagicLevel/5.0 - Resist);	penalty = min(penalty, 100);	penalty = max(penalty, -100);	Damage = getPercentValue(Damage, 100 + penalty);	return (Damage_t)max(0, (int)Damage);#else	float penalty = 1.5 * ( Resist - (MagicLevel/5.0) ) / ( Resist - (MagicLevel/5.0 ) + 100.0 );	penalty = max(penalty, -0.2f);	Damage = (int)(Damage * ( 1.0 - penalty ));	return (Damage_t)max(0, (int)Damage);#endif}//////////////////////////////////////////////////////////////////////////////// 府胶撇复阑 绊妨茄 酒快胶磐令 付过 单固瘤甫 拌魂茄促.//////////////////////////////////////////////////////////////////////////////Damage_t computeOustersMagicDamage(Ousters* pOusters, Creature* pTargetCreature, int Damage, SkillType_t SkillType){	Assert( pOusters != NULL );	Item* pWeapon = pOusters->getWearItem( Ousters::WEAR_RIGHTHAND );	if ( pWeapon == NULL		|| pWeapon->getItemClass() != Item::ITEM_CLASS_OUSTERS_WRISTLET ) return 0;	Damage_t MinDamage = pWeapon->getMinDamage();	Damage_t MaxDamage = pWeapon->getMaxDamage();	Damage_t RealDamage = max(1, Random(MinDamage, MaxDamage));	return RealDamage + Damage;}//////////////////////////////////////////////////////////////////////////////// 鸥百俊霸 固摹绰 篮 单固瘤甫 拌魂茄促.//////////////////////////////////////////////////////////////////////////////Damage_t computeSlayerSilverDamage(Creature* pCreature, int Damage, ModifyInfo* pMI){	Assert(pCreature != NULL);	// 浇饭捞绢啊 酒聪扼搁 篮 单固瘤啊 唱棵 捞蜡啊 绝促.	if (pCreature->isSlayer() == false) return 0;	Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);	Assert(pSlayer != NULL);	// 公扁啊 乐绰瘤 八荤窍绊, 绝促搁 0阑 府畔茄促.	Item* pWeapon = pSlayer->getWearItem(Slayer::WEAR_RIGHTHAND);	if (pWeapon == NULL) return 0;	Damage_t silverDamage = 0;	if (isMeleeWeapon(pWeapon))	{		// 己流磊 公扁老 版快俊绰, 扁夯利栏肺 10%狼 篮 单固瘤甫 霖促.		if (isClericWeapon(pWeapon))		{			silverDamage = max(1, (int)(Damage*0.1));			silverDamage = min((int)silverDamage, (int)pWeapon->getSilver());			if (silverDamage > 0)			{				pWeapon->setSilver(pWeapon->getSilver() - silverDamage);				//pWeapon->save(pSlayer->getName(), STORAGE_GEAR, 0, Slayer::WEAR_RIGHTHAND, 0);				if (pMI != NULL) pMI->addShortData(MODIFY_SILVER_DURABILITY, pWeapon->getSilver());			}			// 扁夯栏肺 甸绢啊绰 10%狼 篮 单固瘤			silverDamage += max(1, (int)(Damage*0.1));		}		// 己流磊 公扁啊 酒匆 版快俊绰, 篮 档陛阑 沁阑 锭父 篮 单固瘤甫 霖促.		else		{			silverDamage = max(1, (int)(Damage*0.1));			silverDamage = min((int)silverDamage, (int)pWeapon->getSilver());			if (silverDamage > 0)			{				pWeapon->setSilver(pWeapon->getSilver() - silverDamage);				//pWeapon->save(pSlayer->getName(), STORAGE_GEAR, 0, Slayer::WEAR_RIGHTHAND, 0);				if (pMI != NULL) pMI->addShortData(MODIFY_SILVER_DURABILITY, pWeapon->getSilver());			}		}	}	else if (isArmsWeapon(pWeapon) && pWeapon->getSilver() > 0)	{		// 醚 拌凯狼 公扁扼搁, 篮 藕舅捞 唱啊绰 巴捞骨肺,		// 公扁 磊眉狼 篮阑 临捞搁 救 等促. 捞巴篮 寇何俊辑,		// 溜 醚舅阑 临捞绰 何盒俊辑 贸府窍扁肺 茄促.		silverDamage = max(1, (int)(Damage*0.1));	}	return silverDamage;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -