1
0

fix resistibility factor for higher tiers

This commit is contained in:
Emagi 2025-01-14 13:50:19 -05:00
parent 3e447db611
commit e1a02a3ef7

View File

@ -31,6 +31,8 @@
#include "Rules/Rules.h" #include "Rules/Rules.h"
#include "SpellProcess.h" #include "SpellProcess.h"
#include "World.h" #include "World.h"
#include <cmath>
#include <algorithm>
#include <math.h> #include <math.h>
extern Classes classes; extern Classes classes;
@ -804,8 +806,18 @@ int8 Entity::DetermineHit(Spawn* victim, int8 type, int8 damage_type, float ToHi
bonus += (skill->current_val+skillAddedByWeapon) / 25; bonus += (skill->current_val+skillAddedByWeapon) / 25;
if(is_caster_spell && lua_spell) { if(is_caster_spell && lua_spell) {
if(lua_spell->spell->GetSpellData()->resistibility > 0) if(lua_spell->spell->GetSpellData()->resistibility > 0) {
bonus -= (1.0f - lua_spell->spell->GetSpellData()->resistibility)*100.0f; float pivot = 0.7f; // Central resistibility point (we seem to have .65 - .75 for our resistability usually)
float scale_factor = 2.0f; // steepness control
// Clamps to avoid extreme values
float resistibility = std::clamp(resistibility, 0.0f, 1.0f);
// Calculate marginalized resistibility
float marginalized_resistibility = 1.0f - exp(-scale_factor * (lua_spell->spell->GetSpellData()->resistibility - pivot));
// Adjust bonus based on marginalized resistibility
bonus -= marginalized_resistibility * 100.0f;
}
LogWrite(COMBAT__DEBUG, 9, "Combat", "SpellResist: resistibility %f, bonus %f", lua_spell->spell->GetSpellData()->resistibility, bonus); LogWrite(COMBAT__DEBUG, 9, "Combat", "SpellResist: resistibility %f, bonus %f", lua_spell->spell->GetSpellData()->resistibility, bonus);
// Here we take into account Subjugation, Disruption and Ordination (debuffs) // Here we take into account Subjugation, Disruption and Ordination (debuffs)