I am trying (and failing) to write a plugin with my pitiful understanding of JS cobbled from the internet. The idea is to create a new hit rate formula that give the attacker a bonus based on their AGI or MAT (for physical and magical attacks respectively), while penalizing it based on the target's AGI. I've heard that if an enemy has 1000 HIT it can still be avoided by your 1 EVA stat. So I'm sidestepping all that entirely and putting it into the hit rate formula.
Here's what I have:
(edit: i am terrible with math and these formulas were awful but that's not why i was having this problem.
So, uhhhh.... it doesn't work. Attacks seem to land no matter what. If my 1 AGI character tries to punch an enemy with 9999 AGI and 1000 EVA it will always land. I am completely lost. Any help is much appreciated.
Here's what I have:
Code:
//=============================================================================
// Cxero_NewHitRate.js
//=============================================================================
/*:
* @plugindesc https://forums.rpgmakerweb.com/index.php?threads/rmmv-magic-hit-rate.123347/
* @author Cxero
*/
Game_Action.prototype.itemHit = function(target) {
if (this.isPhysical()) {
return (this.item().successrate + (this.subject().agi * 0.01) + this.subject().hit) - ((target.agi * 0.01) + target.eva);
} else if (this.isMagical()) {
return (this.item().successrate + (this.subject().mat * 0.01) + this.subject().hit) - ((target.agi * 0.01) + target.eva);
} else {
return this.item().successRate * 0.01;
}
};
Game_Action.prototype.itemEva = function(target) {
if (this.isPhysical()) {
return 0;
} else if (this.isMagical()) {
return 0;
} else {
return 0;
}
};
(edit: i am terrible with math and these formulas were awful but that's not why i was having this problem.
So, uhhhh.... it doesn't work. Attacks seem to land no matter what. If my 1 AGI character tries to punch an enemy with 9999 AGI and 1000 EVA it will always land. I am completely lost. Any help is much appreciated.