-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Labels
Milestone
Description
change on https://github.com/TwistedScorpio/OTHire/blob/master/source/player.cpp
both int32_t Player::getDefense() const and float Player::getDefenseFactor() const
float Player::getDefenseFactor() const
{
switch(fightMode){
case FIGHTMODE_ATTACK:
{
return 0.6f;
break;
}
case FIGHTMODE_BALANCED:
{
return 1.0f;
break;
}
case FIGHTMODE_DEFENSE:
{
return 1.8f;
break;
}
default:
return 1.0f;
break;
}
}
int32_t Player::getDefense() const
{
int32_t defenseSkill = getSkill(SKILL_FIST, SKILL_LEVEL);
int32_t defenseValue = 5;
float defenseFactor = getDefenseFactor();
const Item* weapon = NULL;
const Item* shield = NULL;
getShieldAndWeapon(shield, weapon);
if(weapon){
defenseValue = weapon->getDefense() + 1;
defenseSkill = getWeaponSkill(weapon);
}
if(shield){
defenseValue = shield->getDefense() + 1;
defenseSkill = getSkill(SKILL_SHIELD, SKILL_LEVEL);
}
if(defenseSkill == 0)
return 0;
if(vocation && vocation->getBaseDefense() != 1.0){
defenseValue = int32_t(defenseValue * vocation->getBaseDefense());
}
// Nostalrius use this to default to full def when you are not attacking anything, we don't have access to this variables, so it's not implemented
/* if ((followCreature || !attackedCreature) && earliestAttackTime <= OTSYS_TIME()) {
defenseFactor = 1.8;
} */
int32_t randresult1 = (uint32_t)random_range(0, 99);
int32_t randresult2 = (uint32_t)random_range(0, 99);
return ((int32_t)std::floor((float)((5 * defenseSkill + 50)* defenseValue * defenseFactor * (randresult1+randresult2) / 2 / 10000.)));
}
Reactions are currently unavailable