Combat Scripts (What am I doing wrong)?

Okay so I have an interesting module where full magic classes have access to tomes of power which slightly unbalance the game. Rather than bemoan this too much, I actually incorporated the power imbalance into the lore of the world. But I did want to modify the warrior classes a bit so that they are still interesting to play. So, in addition to a Rage mechanic (Magic Classes have a Mana mechanic now, so that balances a bit), I wanted to modify some feats so that warrior classes gain a slight advantage when they have them. I’m sure its easier to just edit the feats in some kind of ex-toolset system, but I’ve decided not to at the moment.

Here is one script I need help with:

void ApplyPowerAttackBonus(object oPC)
{
// Check if the Power Attack mode is active
if (GetActionMode(oPC, COMBAT_MODE_POWER_ATTACK))
{
int nClassLevel;

    // Calculate the effective class level for warrior classes
    nClassLevel += GetLevelByClass(CLASS_TYPE_FIGHTER, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_RANGER, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_PALADIN, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_BARBARIAN, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_ROGUE, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_MONK, oPC);

    int nExtraDamage = (nClassLevel + 3) / 4; // 1/4 level rounded up

    // Apply extra damage to nearby enemies
    effect eDamage = EffectDamage(nExtraDamage);

    // Loop through nearby enemies and apply damage
    object oEnemy = GetFirstObjectInShape(SHAPE_SPHERE, 5.0, GetLocation(oPC), TRUE);
    while (GetIsObjectValid(oEnemy))
    {
        // Ensure the PC doesn't damage themselves
        if (oEnemy != oPC && GetIsEnemy(oPC, oEnemy))
        {
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oEnemy);
        }
        oEnemy = GetNextObjectInShape(SHAPE_SPHERE, 5.0, GetLocation(oPC), TRUE);
    }
}

}

What I want it to do: When a warrior class uses power attack mode and hits their target, they also do a small amount of damage to other nearby enemies (1/4 of their current level, rounded up).

What it’s currently doing: Nothing as far as I can tell.

The other script modifies the Toughness feat for warrior classes.

void ApplyToughnessBonus(object oPC)
{
// Check if the PC has the Toughness feat
if (GetHasFeat(FEAT_TOUGHNESS, oPC))
{
int nClassLevel;

    // Calculate the effective class level for warrior classes
    nClassLevel += GetLevelByClass(CLASS_TYPE_FIGHTER, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_RANGER, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_PALADIN, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_BARBARIAN, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_ROGUE, oPC);
    nClassLevel += GetLevelByClass(CLASS_TYPE_MONK, oPC);

    int nRegenAmount = (nClassLevel + 4) / 5; // 1/5 level rounded up

    effect eRegen = EffectRegenerate(nRegenAmount, 6.0); // Regenerate every 6 seconds (1 round)
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eRegen, oPC);
}

}

What I want it to do: Apply a regeneration effect that restores hitpoints equal to 1/5 of the character’s warrior class levels (rounded up) every 6 seconds.

What it’s currently doing: Regenerating the damage dealt to the character in combat very rapidly (1 point, 1 point, 1 point, etc) exactly equal to the damage dealt. So for example, in one recent test my fighter was hit for 8 points of damage, on the next round it showed eight lines of regeneration 1 hit point.