コード例 #1
0
int CShieldClass::GetDamageAdj (CItemEnhancement Mods, const DamageDesc &Damage) const

//	GetDamageAdj
//
//	Damage adjustment

	{
	//	The adjustment varies by shield class

	int iAdj = m_DamageAdj.GetAdj(Damage.GetDamageType());

	//	Adjust based on difference in level (negative numbers means the shield
	//	is lower than the damage level):
	//
	//	...
	//	-3	=	4.5x damage
	//	-2	=	4x damage
	//	-1	=	3.5x damage
	//	0	=	3x damage
	//	1	=	2.5x damage
	//	2	=	2x damage
	//	3	=	1.5x damage
	//	>3	=	1x damage

	if (Damage.GetShieldDamageLevel())
		iAdj = iAdj * Max(100, 300 + (50 * (Damage.GetShieldDamageLevel() - GetLevel()))) / 100;

	//	Adjust based on enhancements

	if (Mods.IsNotEmpty())
		iAdj = iAdj * Mods.GetDamageAdj(Damage) / 100;

	return iAdj;
	}
コード例 #2
0
ファイル: CShieldClass.cpp プロジェクト: Ttech/Transcendence
int CShieldClass::GetDamageAdj (CItemEnhancement Mods, const DamageDesc &Damage) const

//	GetDamageAdj
//
//	Damage adjustment

	{
	//	The adjustment varies by shield class

	int iAdj = (Damage.GetDamageType() == damageGeneric ? 100 : m_iDamageAdj[Damage.GetDamageType()]);

	//	Adjust based on the type of damage

	if (Damage.GetShieldDamage())
		iAdj = iAdj * Max(100, 300 + (50 * (Damage.GetShieldDamageLevel() - GetLevel()))) / 100;

	//	Adjust based on enhancements

	if (Mods.IsNotEmpty())
		iAdj = iAdj * Mods.GetDamageAdj(Damage) / 100;

	return iAdj;
	}