Fix an ability strength of 7-10 being worse than one of 6 for protect form damage/species abilities.
This commit is contained in:
@@ -2608,21 +2608,21 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_
|
||||
|
||||
if((level = univ.party[which_pc].get_prot_level(eItemAbil::DAMAGE_PROTECTION,int(damage_type))) > 0) {
|
||||
if(damage_type == eDamageType::WEAPON) how_much -= level;
|
||||
else how_much = how_much / ((level >= 7) ? 4 : 2);
|
||||
else how_much = how_much / 2;
|
||||
}
|
||||
// TODO: Do these perhaps depend on the ability strength less than they should?
|
||||
if((level = univ.party[which_pc].get_prot_level(eItemAbil::PROTECT_FROM_SPECIES,int(type_of_attacker))) > 0)
|
||||
how_much = how_much / ((level >= 7) ? 4 : 2);
|
||||
how_much = how_much / 2;
|
||||
if(isHumanoid(type_of_attacker) && !isHuman(type_of_attacker) && type_of_attacker != eRace::HUMANOID) {
|
||||
// If it's a slith, nephil, vahnatai, or goblin, Protection from Humanoids also helps
|
||||
// Humanoid is explicitly excluded here because otherwise it would help twice.
|
||||
if((level = univ.party[which_pc].get_prot_level(eItemAbil::PROTECT_FROM_SPECIES,int(eRace::HUMANOID))) > 0)
|
||||
how_much = how_much / ((level >= 7) ? 4 : 2);
|
||||
how_much = how_much / 2;
|
||||
}
|
||||
if(type_of_attacker == eRace::SKELETAL) {
|
||||
// Protection from Undead helps with both types of undead
|
||||
if((level = univ.party[which_pc].get_prot_level(eItemAbil::PROTECT_FROM_SPECIES,int(eRace::UNDEAD))) > 0)
|
||||
how_much = how_much / ((level >= 7) ? 4 : 2);
|
||||
how_much = how_much / 2;
|
||||
}
|
||||
|
||||
// invuln
|
||||
|
||||
@@ -466,10 +466,12 @@ void cItem::append(legacy::item_record_type& old){
|
||||
case 32: // Fire protection
|
||||
ability = eItemAbil::DAMAGE_PROTECTION;
|
||||
abil_data[1] = int(eDamageType::FIRE);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 33: // Cold protection
|
||||
ability = eItemAbil::DAMAGE_PROTECTION;
|
||||
abil_data[1] = int(eDamageType::COLD);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 34: // Poison protection
|
||||
ability = eItemAbil::STATUS_PROTECTION;
|
||||
@@ -478,6 +480,7 @@ void cItem::append(legacy::item_record_type& old){
|
||||
case 35: // Magic protection
|
||||
ability = eItemAbil::DAMAGE_PROTECTION;
|
||||
abil_data[1] = int(eDamageType::MAGIC);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 36: // Acid protection
|
||||
ability = eItemAbil::STATUS_PROTECTION;
|
||||
@@ -562,22 +565,27 @@ void cItem::append(legacy::item_record_type& old){
|
||||
case 57: // Protect from undead
|
||||
ability = eItemAbil::DAMAGE_PROTECTION;
|
||||
abil_data[1] = int(eDamageType::UNDEAD);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 58: // Protect from demons
|
||||
ability = eItemAbil::DAMAGE_PROTECTION;
|
||||
abil_data[1] = int(eDamageType::DEMON);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 59: // Protect from humanoids
|
||||
ability = eItemAbil::PROTECT_FROM_SPECIES;
|
||||
abil_data[1] = int(eRace::HUMANOID);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 60: // Protect from reptiles
|
||||
ability = eItemAbil::PROTECT_FROM_SPECIES;
|
||||
abil_data[1] = int(eRace::REPTILE);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 61: // Protect from giants
|
||||
ability = eItemAbil::PROTECT_FROM_SPECIES;
|
||||
abil_data[1] = int(eRace::GIANT);
|
||||
if(abil_data[0] >= 7) abil_data[0] /= 2;
|
||||
break;
|
||||
case 62: // Protect from disease
|
||||
ability = eItemAbil::STATUS_PROTECTION;
|
||||
|
||||
Reference in New Issue
Block a user