Slime
Active Member
- Joined
- Jan 25, 2014
- Messages
- 115
- Reaction score
- 33
I wanted to make shielding improve armor defense.
if(checkArmor)
{
int32_t armorValue = getArmor(), minArmorReduction = 0,
maxArmorReduction = 0;
if(armorValue > 1)
{
int32_t DefSkill = player->getSkill(SKILL_SHIELD, SKILL_LEVEL); //!!!added line
minArmorReduction = (int32_t)std::ceil(armorValue * 0.475);
maxArmorReduction = (int32_t)std::ceil(
((armorValue * 0.475) - 1) + minArmorReduction);
}
else if(armorValue == 1)
{
minArmorReduction = 1;
maxArmorReduction = 1;
}
damage -= random_range(minArmorReduction, maxArmorReduction);
if(damage <= 0)
{
damage = 0;
blockType = BLOCK_ARMOR;
}
}
I thought it would be easy, like just pasting DefSkill into the formula. When trying to compile i get 'player' was not declared in this scope error. Is it because armor reffers not only to players but creatures in general?
if(checkArmor)
{
int32_t armorValue = getArmor(), minArmorReduction = 0,
maxArmorReduction = 0;
if(armorValue > 1)
{
int32_t DefSkill = player->getSkill(SKILL_SHIELD, SKILL_LEVEL); //!!!added line
minArmorReduction = (int32_t)std::ceil(armorValue * 0.475);
maxArmorReduction = (int32_t)std::ceil(
((armorValue * 0.475) - 1) + minArmorReduction);
}
else if(armorValue == 1)
{
minArmorReduction = 1;
maxArmorReduction = 1;
}
damage -= random_range(minArmorReduction, maxArmorReduction);
if(damage <= 0)
{
damage = 0;
blockType = BLOCK_ARMOR;
}
}
I thought it would be easy, like just pasting DefSkill into the formula. When trying to compile i get 'player' was not declared in this scope error. Is it because armor reffers not only to players but creatures in general?