Interesting. Well, I'm using Certain Hit for both Void and Psionics. The issue I'm having is that I have a "frozen" state. When a physical attack hits a frozen enemy, the ice shatters, and your character deals crit damage. Psionics is supposed to ignore the defense and magic defense of an enemy. Normally, I think you could do this via variables, but I'm using a modified version of the "Dragon Quest" damage style in VS BattleCore. Modified, as in... I have no idea if my modifications are even doing anything to actually do what I want. I'll show you the code I've made.
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;
const note = this.item().note;
// Create Multiplier
let multiplier = Math.max(eval(item.damage.formula), 0);
if (this.isCertainHit()) {
if (note.match(/<PSIONIC>/i)) {
let value = multiplier * Math.max(a.psiat);
return (isNaN(value) ? 0 : value) * sign;
}
else {
let value = multiplier * Math.max(a.atk, a.mat);
return (isNaN(value) ? 0 : value) * sign;
}
}
// Get Primary Stats
let armor = 1;
if (note.match(/<PSIONIC>/i)) {
armor = 1;
} else if (this.isPhysical()) {
armor = b.def;
} else if (this.isMagical()) {
armor = b.mdf;
};
armor = this.applyArmorModifiers(b, armor);
let stat = 1;
if (note.match(/<PSIONIC>/i)) {
stat = a.psiat;
} else if (this.isPhysical() && (this.isDamage() || this.isDrain())) {
stat = a.atk;
} else if (this.isMagical() && (this.isDamage() || this.isDrain())) {
stat = a.mat;
} else if (note.match(/<PSIONIC>/i)) {
stat = a.psidef;
} else if (this.isPhysical() && this.isRecover()) {
stat = a.def;
} else if (this.isMagical() && this.isRecover()) {
stat = a.mdf;
}
// Check for Recovery
if (this.isRecover()) {
let value = stat * multiplier * sign;
return isNaN(value) ? 0 : value;
}
// Calculate Damage
let value = 0;
if (stat < ((2 + armor) / 2)) {
// Plink Damage
let baseline = Math.max(stat - ((12 * (armor - stat + 1)) / stat), 5);
value = baseline / 3;
} else {
// Normal Damage
let baseline = Math.max(stat - (armor / 2), 1);
value = baseline / 2;
}
value *= multiplier;
// Return Value
return isNaN(value) ? 0 : value;
Basically, I'm trying to make it so that psionics is neither going towards b.def or b.mdf, and I do think I've found a good way to do that.
Actually, I wonder, with this code, if I set my psionics to be "magical attack" instead of "certain hit" would that still ignore the defenses due to the notetag?
EDIT: Nope... even setting it to Magical Attack, her attack on a frozen enemy is still dealing the increased critical damage... I wonder if I have the crit part wrong? This is my crit rate code.
JavaScript:
// Declare Constants
const user = this.subject();
const target = arguments[0];
// Create Base Critical Rate
let rate = this.subject().cri * (1 - target.cev);
// Guarantee Phys Crit on Frozen Target
if (target.isStateAffected(19) && this.isPhysical) {
target.removeState(19);
return 1;
}
// Apply Notetags
const note = this.item().note;
if (note.match(/<ALWAYS CRITICAL>/i)) {
return 1;
}
if (note.match(/<SET CRITICAL RATE:[ ](\d+)([%%])>/i)) {
return Number(RegExp.$1) / 100;
}
if (note.match(/<MODIFY CRITICAL RATE:[ ](\d+)([%%])>/i)) {
rate *= Number(RegExp.$1) / 100;
}
if (note.match(/<MODIFY CRITICAL RATE:[ ]([\+\-]\d+)([%%])>/i)) {
rate += Number(RegExp.$1) / 100;
}
if (note.match(/<JS CRITICAL RATE>\s*([\s\S]*)\s*<\/JS CRITICAL RATE>/i)) {
const code = String(RegExp.$1);
try {
eval(code);
} catch (e) {
if ($gameTemp.isPlaytest()) console.log(e);
}
}
// Apply LUK Buffs/Debuffs
const lukStack = this.subject().buff(7);
rate *= 2 ** lukStack;
// Return Rate
return rate;