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:
(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:
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.
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:
- Chance to hit based on a dice roll + proficiency ((Strength-10)/2) compared to an AC (defense stat)
- 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.