D&D Style Damage Calculations Help

So I'm looking at creating a Dungeons and Dragons (5th Edition) inspired game, extending to randomly generated numbers based on dice rolls. Now when I say I know VERY basic Javascript, I say that in the context of knowing a few terms that I've looked up specifically for this project. After looking at some Yanfly plugins I feel like what I want should be possible, but do need a little help doing so as I'm more of a story writer/ideas man than any kind of coding developer.


What I want to create is a damage system based on comparing a chance to hit rolled on a D20 (plus modifiers in the form of math around a stat) to an enemies AC (defense stat in the rpg maker engine). Then, if that does not miss, I want damage calculated based on a weapon's allocated dice roll (using battle/skill core, whichever one allows you to change a weapon's attack skill) plus proficiencies (added via the weapon's own stats).


So basically:

  1. Chance to hit based on a dice roll + proficiency ((Strength-10)/2) compared to an AC (defense stat)
  2. Damage calculated via a weapon specific dice roll + proficiencies added through weapon stats.

(In terms of damage, all numbers should be integers, but I believe I read that JavaScript treats integers and floats identically anyway?)


I have some ideas as to how it could possibly work:

  • Using Yanfly's hit formula plugin to calculate the chance to hit, but I am completely uncertain if that allows for non-percentage calculations, given that the chance to hit is an integer higher or lower than another integer. Then using the damage core plugin to calculate damage independently of chance to hit, which is a simple dice roll in the attack skill's damage formula.
  • Setting all chance to hit percentages to 100%, and all Evasion percentages to 0%, and calculating chance to hit within the damage formula using an if else type statement. If the attack roll is lower than AC, deal 0 damage, else deal a rolled amount of damage.



My biggest problem is creating these formulae from scratch. I can confidently edit and manipulate existing formulae and understand how most things work, but I have a lot of difficulty starting out. Some help, or information on whether what I want is even possible would be great. I'm also kinda bad at articulating my ideas properly so I'll answer anything to help you help me XD Even just a short list of the different script/math/formula commands I need to use would help me a lot in figuring it out myself.


EDIT:


So I've been reading up on javascript a bit more and have found a hit formula plugin, as well as damage core. Using those, will the following formula function?
Damage formula:  1 + rand(x) + floor.((a.atk-10/2)


x = 3, 5, 7, or 11 for each die possible, +1 to make 1 the minimum roll


(a.atk-10)/2 = D&D's formula for proficiency bonus, rounded down.


Hit formula: floor.((a.agi-10)/2) + (1 + rand(19)) > b.def


This takes an actors bonus to hit rounded down, adds a d20 roll, and if that is higher than the AC (or defense) or the target, it hits. 


Basically I just need to know if this stuff even works or makes sense XD


EDIT 2:

I've considered that perhaps the HIT formula should use EVA as the AC stat, and defense can just change aesthetically to represent that to the player? If that would make the formula work better.
At the moment this looks more like an implementation question than a design topic.  However, before I move it to MV Support, I want to check if it would be better in JS Plugin Support.  Do all these calculations flow from the scripts, or are they data base formulas?
At the moment this looks more like an implementation question than a design topic.  However, before I move it to MV Support, I want to check if it would be better in JS Plugin Support.  Do all these calculations flow from the scripts, or are they data base formulas?



Sorry I totally suck at getting the right topics... it's kind of a bit of both? I'm kinda asking whether I need the plugins, if it can all be done in the database, I'm a bit all over the place with it, but it's not specifically a question related to a particular plugin.
Moving this to RPGMaker MV


We will see if there is a non plugin solution, as I sense that is your preference.  If it does, in fact, need a plugin, then we may have to move it again to Plugin Requests.  But let's see what people come up with first.
There's a couple ways to do this. You could use YEP Hit Accuracy or VS Hit Formula for the d20 roll, and Hime have a plugin for damage rolls. You may want to check the thread on my signature - it is outdated, but can provide you a way to follow.
Changes to the HIT mechanics will require plugins. The damage formula can be implemented without plugins, but changing the HIT check will require plugins.

Original thread: https://forums.rpgmakerweb.com/threads/d-d-style-damage-calculations-help.67280/