Ejemplo n.º 1
0
//--------------------------------------------------------------
//				CCombatDefenderPlayer::getShield
//--------------------------------------------------------------
bool CCombatDefenderPlayer::getShield(CCombatShield &shield) const 
{
	CCharacter *character = PlayerManager.getChar(_RowId);
	if ( !character) 
	{
		return false;
	}
	CGameItemPtr shieldPtr = character->getLeftHandItem();
	if (shieldPtr == NULL || shieldPtr->getStaticForm() == NULL || shieldPtr->getStaticForm()->Family != ITEMFAMILY::SHIELD )
		return false;

	shield.Quality = shieldPtr->quality();
	shield.Skill = shieldPtr->getStaticForm()->Skill;

	if ( shield.Skill < SKILLS::NUM_SKILLS )
	{
		shield.SkillValue = character->getSkills()._Skills[ shield.Skill ].Current;
	}
	else
		shield.SkillValue = 0;

	shield.MaxBluntProtection = shieldPtr->getProtection(DMGTYPE::BLUNT).Max;
	shield.MaxPiercingProtection = shieldPtr->getProtection(DMGTYPE::PIERCING).Max;
	shield.MaxSlashingProtection = shieldPtr->getProtection(DMGTYPE::SLASHING).Max;
	shield.BluntProtectionFactor = shieldPtr->getProtection(DMGTYPE::BLUNT).Factor;
	shield.PiercingProtectionFactor = shieldPtr->getProtection(DMGTYPE::PIERCING).Factor;
	shield.SlashingProtectionFactor = shieldPtr->getProtection(DMGTYPE::BLUNT).Factor;

	shield.ShieldType = shieldPtr->getStaticForm()->Shield->ShieldType;
	shield.ArmorType = shieldPtr->getStaticForm()->Shield->ArmorType;
	return true;
} // CCombatDefenderPlayer::getShield //
Ejemplo n.º 2
0
//--------------------------------------------------------------
//				CCombatDefenderPlayer::getArmor
//--------------------------------------------------------------
bool CCombatDefenderPlayer::getArmor( SLOT_EQUIPMENT::TSlotEquipment slot, CCombatArmor &armor ) const 
{ 
	CCharacter *character = PlayerManager.getChar(_RowId);
	if ( !character) 
	{
		return false;
	}

	CGameItemPtr armorPtr = character->getItem(INVENTORIES::equipment, slot);
	if (armorPtr == NULL || armorPtr->getStaticForm() == NULL || armorPtr->getStaticForm()->Family != ITEMFAMILY::ARMOR)
		return false;

	armor.Quality = armorPtr->quality();
	armor.Skill = armorPtr->getStaticForm()->Skill;

	if( armor.Skill < 0 ) { nlwarning("<CCombatDefenderPlayer::getArmor> armor.Skill negative !!!!"); armor.SkillValue = 0; }
	else
	if ( armor.Skill < SKILLS::NUM_SKILLS )
	{
		armor.SkillValue = character->getSkills()._Skills[ armor.Skill ].Current;
	}
	else
		armor.SkillValue = 0;

	armor.MaxBluntProtection = armorPtr->getProtection(DMGTYPE::BLUNT).Max;
	armor.MaxPiercingProtection = armorPtr->getProtection(DMGTYPE::PIERCING).Max;
	armor.MaxSlashingProtection = armorPtr->getProtection(DMGTYPE::SLASHING).Max;
	armor.BluntProtectionFactor = armorPtr->getProtection(DMGTYPE::BLUNT).Factor;
	armor.PiercingProtectionFactor = armorPtr->getProtection(DMGTYPE::PIERCING).Factor;
	armor.SlashingProtectionFactor = armorPtr->getProtection(DMGTYPE::BLUNT).Factor;
	armor.ArmorType = armorPtr->getStaticForm()->Armor->ArmorType;

	return true;
} // CCombatDefenderPlayer::getArmor //