Turning luck into a different attribute?

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
526
Reaction score
131
First Language
English
Primarily Uses
RMMZ
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. :wink:).
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.
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
526
Reaction score
131
First Language
English
Primarily Uses
RMMZ
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. :wink:).
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!
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
526
Reaction score
131
First Language
English
Primarily Uses
RMMZ
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;
 
Last edited:

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
526
Reaction score
131
First Language
English
Primarily Uses
RMMZ
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!
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
526
Reaction score
131
First Language
English
Primarily Uses
RMMZ
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;
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
526
Reaction score
131
First Language
English
Primarily Uses
RMMZ
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;
 

Dark_Ansem

Veteran
Veteran
Joined
Jun 16, 2020
Messages
526
Reaction score
131
First Language
English
Primarily Uses
RMMZ
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;
 
Last edited:

Latest Threads

Latest Profile Posts

dV9O5Z.png


Continuing our countdown with Capsule Monster #14 Plug-Go! Plug-Go was originally meant to be the design of a gameboy game I wanted to make that was inspired by Megaman Battle Network! While that hasn’t worked out I’m happy I was able to recycle his design!
uApM6Gk.png

X6lGcLM.png

Took some time to pretty up the maps too.
Size Comparison.gif
12 hour little challenge for myself to do a big'ish enemy. Released for MV/MZ, working on my streamline one for later as I love the four frames over three. Spins a whole lot better I think.
Okay last one for now, it's time to go treat myself to some Zelda!

UPDATED- I've completely ripped off Sword of Mana right here lol
It seems like the imgur images are working again! ;3

Forum statistics

Threads
131,505
Messages
1,220,346
Members
173,224
Latest member
ZecaVn
Top