Turning luck into a different attribute?

If you're confused, I just don't understand why you're messing with it at all. It takes seconds to copy and paste a formula between different skills, so the whole damage styles thing saves you such minimal effort to begin with (in my opinion).
I'm doing that as well, just need to focus the math.

It doesn't seem to have anything to do with your original question with the Luck stuff.

If you've moved onto how the damage styles in this specific plugin work, that seems like that's about carefully reading the documentation or doing some really simple testing that would take, like, three minutes (make a style do 10 damage, overwrite one sklll to do 15 damage, see whether it does 10 or 15 damage in game. Done. 😉).
I mean it does and it's all related. I've just not had chance to playtest since I've just been working most of the day and when I wasnt i was asset editing/hunting, hence why I've asked in the forum.. am trying to multitask as much as possible. Thank you for your help.

Ps: I've read the documentation but it doesn't provide the reply I need, hence why I'm asking. I hope that is not too much trouble.
If you've moved onto how the damage styles in this specific plugin work, that seems like that's about carefully reading the documentation or doing some really simple testing that would take, like, three minutes (make a style do 10 damage, overwrite one sklll to do 15 damage, see whether it does 10 or 15 damage in game. Done. 😉).
So, there is an override system in place which works just for me - as it works on a single-skill basis.
Now, just need to work out the math for the default formula!
So, this is the damage formula syntax

JavaScript:
if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    value = (((a.atk ** 3) / 32) + 32) * power / 16;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * ((a.mat ** 2 / 6) + power) / 4;
} else if (this.isPhysical() && this.isRecover()) {
    value = power * ((a.def + power) / 2);
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2);
}

two things: first off, I think a parenthesis is missing in row 4, secondly, would this be the correct syntax for making it most similar to how it works in FFT?

27ff0339d0359cc1937e7753a7a988be2b3d10a7


JavaScript:
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * (((a.mat ** 2 / 6) + power) / 4) * a.luk * b.luk;

JavaScript:
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2) * a.luk * b.luk;
So, a little update. Turns out that with the Core VS plugins it IS possible to make an entirely new attribute AND make it work in formulas.

However, the idea of using luck as a "new" attribute kind of grew on me, I like the idea of influencing events inside and outside battle. Sort of making the strength of your belief work for you!
remade it so that it's a bit more tidy?

JavaScript:
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

// Create Damage Offense Value
let value = power;

if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    value = (((a.atk ** 3) / 32) + 32) * power / 16;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * ((a.mat ** 2 / 6) + power) / 4;
    value *= a.luk * b.luk; // Multiply by caster's and target's luck
} else if (this.isPhysical() && this.isRecover()) {
    value = power * ((a.def + power) / 2);
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2);
    value *= a.luk * b.luk; // Multiply by caster's and target's luck
}

// Apply Damage Defense Value
if (this.isDamage() || this.isDrain()) {
    let armor = this.isPhysical() ? b.def : b.mdf;
    armor = this.applyArmorModifiers(b, armor);
    armor = Math.max(armor, 1);
    value *= ((((armor - 280.4) ** 2) / 110) / 16) / 730;
    value *= (730 - (armor * 51 - (armor ** 2) / 11) / 10) / 730;
} else if (this.isRecover()) {
    value *= -1;
}

// Return Value
return isNaN(value) ? 0 : value;
Updated so that hopefully it's clearer
JavaScript:
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

// Create Damage Offense Value
let value = power;

if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    value = (((a.atk ** 3) / 32) + 32) * power / 16;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * ((a.mat ** 2 / 6) + power) / 4;
    value *= a.luk; // Add caster's luck as a multiplier
} else if (this.isPhysical() && this.isRecover()) {
    value = power * ((a.def + power) / 2);
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2);
    value *= a.luk; // Add caster's luck as a multiplier
}

// Apply Damage Defense Value
if (this.isDamage() || this.isDrain()) {
    let armor = this.isPhysical() ? b.def : b.mdf;
    armor = this.applyArmorModifiers(b, armor);
    armor = Math.max(armor, 1);
    value *= ((((armor - 280.4) ** 2) / 110) / 16) / 730;
    value *= (730 - (armor * 51 - (armor ** 2) / 11) / 10) / 730;
    if (this.isMagical()) {
        value *= b.luk; // Add target's luck as a multiplier
    }
} else if (this.isRecover()) {
    value *= -1;
}

// Return Value
return isNaN(value) ? 0 : value;
Yet another variation.

JavaScript:
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

// Create Damage Offense Value
let value = power;

if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    value = (((a.atk ** 3) / 32) + 32) * power / 16;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * ((a.mat ** 2 / 6) + power) / 4 * ((a.luk - 15) * (3 - 1) / (255 - 15) + 1);
} else if (this.isPhysical() && this.isRecover()) {
    value = power * ((a.def + power) / 2);
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2) * ((a.luk - 15) * (3 - 1) / (255 - 15) + 1);
}

// Apply Damage Defense Value
if (this.isDamage() || this.isDrain()) {
    let armor = this.isPhysical() ? b.def : b.mdf;
    if (this.isMagical()) {
        armor *= (1 + ((b.luk - 15) * (0.5 - 1) / (255 - 15)));
    }
    armor = this.applyArmorModifiers(b, armor);
    armor = Math.max(armor, 1);
    value *= ((((armor - 280.4) ** 2) / 110) / 16) / 730;
    value *= (730 - (armor * 51 - (armor ** 2) / 11) / 10) / 730;
} else if (this.isRecover()) {
    value *= -1;
}

// Return Value
return isNaN(value) ? 0 : value;
More changes

JavaScript:
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

// Create Damage Offense Value
let value = power;

if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    value = (((a.atk ** 3) / 32) + 32) * power / 16;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * ((a.mat ** 2 / 6) + power) / 4 * (a.luk <= 15 ? (a.luk / 15) : ((a.luk - 15) * (3 - 1) / (255 - 15) + 1));
} else if (this.isPhysical() && this.isRecover()) {
    value = power * ((a.def + power) / 2);
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2) * (a.luk <= 15 ? (a.luk / 15) : ((a.luk - 15) * (3 - 1) / (255 - 15) + 1));
}

// Apply Damage Defense Value
if (this.isDamage() || this.isDrain()) {
    let armor = this.isPhysical() ? b.def : b.mdf;
    if (this.isMagical()) {
        armor *= (1 + (b.luk <= 15 ? ((b.luk - 15) / 15) : ((b.luk - 15) * (0.5 - 1) / (255 - 15))));
    }
    armor = this.applyArmorModifiers(b, armor);
    armor = Math.max(armor, 1);
    value *= ((((armor - 280.4) ** 2) / 110) / 16) / 730;
    value *= (730 - (armor * 51 - (armor ** 2) / 11) / 10) / 730;
} else if (this.isRecover()) {
    value *= -1;
}

// Return Value
return isNaN(value) ? 0 : value;
Boy math really isn't my strength
JavaScript:
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

// Create Damage Offense Value
let value = power;

if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    value = (((a.atk ** 3) / 32) + 32) * power / 16;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * ((a.mat ** 2 / 6) + power) / 4 * (a.luk <= 15 ? (a.luk / 15) : ((a.luk - 15) * (3 - 1) / (255 - 15) + 1));
} else if (this.isPhysical() && this.isRecover()) {
    value = power * ((a.def + power) / 2);
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2) * (a.luk <= 15 ? (a.luk / 15) : ((a.luk - 15) * (3 - 1) / (255 - 15) + 1));
}

// Apply Damage Defense Value
if (this.isDamage() || this.isDrain()) {
    let armor = this.isPhysical() ? b.def : b.mdf;
    if (this.isMagical()) {
        armor *= (1 + (b.luk <= 15 ? ((15 - b.luk) / 15) : ((255 - b.luk) * (0.5 - 1) / (255 - 15))));
    }
    armor = this.applyArmorModifiers(b, armor);
    armor = Math.max(armor, 1);
    value *= ((((armor - 280.4) ** 2) / 110) / 16) / 730;
    value *= (730 - (armor * 51 - (armor ** 2) / 11) / 10) / 730;
} else if (this.isRecover()) {
    value *= -1;
}

// Return Value
return isNaN(value) ? 0 : value;
JavaScript:
// Define Constants
const user = this.subject();
const target = arguments[0];
const item = this.item();
const a = this.subject();
const b = target;
const v = $gameVariables._data;
const sign = [3, 4].includes(item.damage.type) ? -1 : 1;

// Create Damage Constant
const power = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
    return (isNaN(power) ? 0 : power) * sign;
}

// Create Damage Offense Value
let value = power;

if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
    value = (((a.atk ** 3) / 32) + 32) * power / 16;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
    value = power * ((a.mat ** 2 / 6) + power) / 4 * (a.luk <= 15 ? (a.luk / 15) : ((a.luk - 15) * (3 - 1) / (255 - 15) + 1));
} else if (this.isPhysical() && this.isRecover()) {
    value = power * ((a.def + power) / 2);
} else if (this.isMagical() && this.isRecover()) {
    value = power * ((a.mdf + power) / 2) * (a.luk <= 15 ? (a.luk / 15) : ((a.luk - 15) * (3 - 1) / (255 - 15) + 1));
}

// Apply Damage Defense Value
if (this.isDamage() || this.isDrain()) {
    let armor = this.isPhysical() ? b.def : b.mdf;
    armor = this.applyArmorModifiers(b, armor);
    armor = Math.max(armor, 1);
    value *= ((((armor - 280.4) ** 2) / 110) / 16) / 730;
    value *= (730 - (armor * 51 - (armor ** 2) / 11) / 10) / 730;
    if (this.isMagical()) {
        if (b.luk === 0) {
            value = 0; // no damage received
        } else if (b.luk < 15) {
            value *= b.luk / 15; // scales from 0 (at luck 1) to 1 (at luck 14)
        } else {
            value *= 1 + (b.luk - 15) * (2 - 1) / (255 - 15); // scales from 1 (at luck 15) to 2 (at luck 255)
        }
    }
} else if (this.isRecover()) {
    value *= -1;
}

// Return Value
return isNaN(value) ? 0 : value;
JavaScript:
// Declare Constants
const target = arguments[0];
const critical = arguments[1];
const item = this.item();
const a = this.subject(); // Added this line to get the subject (user)

// Function to calculate luck-based scaling
function luckScaling(luk, maxScale) {
    return luk <= 15 ? (luk / 15) : ((luk - 15) * (maxScale - 1) / (255 - 15) + 1);
}

// Function to calculate MP-based scaling
function mpScaling(mmp) {
    return mmp * 0.1; // 10% of max MP
}

// Get Base Damage
let baseValue = this.evalDamageFormula(target);

// Add the luck-based scaling factor for magical attacks and recoveries
if (this.isMagical() && (this.isDamage() || this.isDrain() || this.isRecover())) {
    baseValue *= luckScaling(a.luk, 3); // max scaling factor for attack is 3
    baseValue += mpScaling(a.mmp); // Add MP-based scaling
}

// Calculate Element Modifiers
let value = baseValue * this.calcElementRate(target);

// Calculate Physical and Magical Modifiers
if (this.isPhysical()) {
    value *= target.pdr;
}
if (this.isMagical()) {
    value *= target.mdr;
    value *= luckScaling(target.luk, 2); // max scaling factor for defense is 2
}

// Apply Healing Modifiers
if (baseValue < 0) {
    value *= target.rec;
}

// Apply Critical Modifiers
if (critical) {
    value = this.applyCritical(value);
}

// Apply Variance and Guard Modifiers
value = this.applyVariance(value, item.damage.variance);
value = this.applyGuard(value, target);

// Finalize Damage
value = Math.round(value);
return value;
JavaScript:
// Declare Constants
const target = arguments[0];
const critical = arguments[1];
const item = this.item();
const a = this.subject(); // The attacker

// Function to calculate faith-based scaling
function FaithScaling(luk, maxScale) {
    return luk <= 15 ? (luk / 15) : ((luk - 15) * (maxScale - 1) / (255 - 15) + 1);
}

// Function to calculate MP-based scaling
function MaxMpScaling(mmp) {
    return mmp * 0.1; // 10% of max MP
}

// Calculate Base Damage
let baseValue = this.evalDamageFormula(target);

// Apply Faith and MP Scaling for Magical Actions
if (this.isSkill() && this.isMagical() && (this.isDamage() || this.isDrain() || this.isRecover())) {
    const faithFactor = FaithScaling(a.luk, 3); // Max scaling factor for attack is 3
    const mpFactor = MaxMpScaling(a.mmp); // MP-based scaling
    baseValue = baseValue * faithFactor + mpFactor;
}

// Calculate Element Modifiers
let value = baseValue * this.calcElementRate(target);

// Apply Physical and Magical Modifiers
if (this.isPhysical()) {
    value *= target.pdr;
}
if (this.isMagical()) {
    value *= target.mdr;
    const defenseFaithFactor = FaithScaling(target.luk, 2); // Max scaling factor for defense is 2
    value *= defenseFaithFactor;
}

// Apply Healing Modifiers
if (baseValue < 0) {
    value *= target.rec;
}

// Apply Critical Modifiers
if (critical) {
    value = this.applyCritical(value);
}

// Apply Variance and Guard Modifiers
value = this.applyVariance(value, item.damage.variance);
value = this.applyGuard(value, target);

// Finalize and Return Damage
return Math.round(value);

Original thread: https://forums.rpgmakerweb.com/threads/turning-luck-into-a-different-attribute.152406/