Pretty sure I based my combat system off of this post on reddit
I have done a lot of work modifying this and am still looking for ways to enhance it further. Currently I am looking at ways to give enemies different actions and unique special moves, miss/dodge chances, critical hits, and possibly party mechanics. I realize this is a lot of work and atm I only have an idea for enemy actions. I was going to alter the setter links in the "You" passage to set $turn to a random number from 1-6 and then have those correspond with different actions. I will take whatever suggestions you can offer so take a look at what I have built and let me know what you think. I want to make this a comprehensive battle system and it looks like I am getting closer and closer to it working out.
STORY INIT
/*Player Character*/
<<set $player to {
name: "Hiro",
MVIT: 0,
VIT: 0,
STR: 8,
DEX: 8,
CON: 8,
INT: 8,
WIS: 8,
CHA: 8,
} >>
/*Health*/
<<set $player.MVIT to Character.mod($player.CON) + 100>>
<<set $player.VIT to $player.MVIT>>
/*Weapons*/
<<set $weapon to {
name: "",
DMGmod: 0,
ATK: "",
} >>
<<set $Fists to {
name: "Fists",
DMGmod: 0,
ATK: "You punch the $monster.name,",
} >>
<<set $IronBroadsword to {
name: "Iron Broadsword",
DMGmod: 3,
ATK: "You strike the $monster.name with your blade,",
}>>
/*Spells*/
<<set $spell to {
name: "",
DMGmod: 0,
ATK: ""
}>>
<<set $Firebolt to {
name: "Firebolt",
DMGmod: 5,
ATK: "You blast the $monster.name away with a bolt of flame,",
}>>
/*Combat*/
<<set $turn = 0>>
<<set $log = "you">>
/*Monsters*/
<<set $monster to {
name: "",
MVIT: 0,
VIT: 0,
STR: 0,
DEX: 0,
WIS: 0,
FRT: 0,
CHA: 0,} >>
<<set $goblin to {
name: "Goblin",
MVIT: 30,
VIT: 30,
STR: 13,
DEX: 13,
WIS: 13,
FRT: 13,
CHA: 13,} >>
<<goto "Ready">>
READY
<<set $test to random(1, 6)>>
<<print $test>>
[[Fight Goblin|Combat][$monster to $goblin, $weapon to $Fists, $spell to $Firebolt]]
[[Stats|Point Buy]]
COMBAT
<<include "Enemy">> <<include "Log">> <<include "You">>
ENEMY
-----
<<print $monster.name>>
VIT: <<print $monster.VIT>> / <<print $monster.MVIT>>
-----
YOU
<<if $turn == 0>>
[[Punch|Combat][$monster.VIT -= $Fists.DMGmod + Character.mod($player.STR), $atkdmg to $Fists.DMGmod + Character.mod($player.STR), $turn to random(1, 6), $log to "weaponAtk"]]
[[Sword|Combat][$weapon to $IronBroadsword, $monster.VIT -= $IronBroadsword.DMGmod + Character.mod($player.STR), $atkdmg to $IronBroadsword.DMGmod + Character.mod($player.STR), $turn to $turn to random(1, 6), $log to "weaponAtk"]]
[[Firebolt|Combat][$spell to $Firebolt, $monster.VIT -= $Firebolt.DMGmod + Character.mod($player.WIS), $atkdmg to $Firebolt.DMGmod + Character.mod($player.WIS), $turn to $turn to random(1, 6), $log to "spellAtk"]]
<<elseif $turn == 1>>
[[Continue|Combat][$log to "enemyAtk", $turn to 0, $player.VIT -= $monster.STR]]
<</if>>
<<if $player.VIT lt 1>>
<<goto "Lose">>
<</if>>
<<if $monster.VIT lt 1>>
<<goto "Win">>
<</if>>
LOG
<<if $log == "you">>
It is your turn!
<<elseif $log == "weaponAtk">>
<<print $weapon.ATK>> dealing <<print $atkdmg>> points of damage!
<<elseif $log == "spellAtk">>
<<print $spell.ATK>> dealing <<print $atkdmg>> points of damage!
<<elseif $log == "enemyAtk">>
The <<print $monster.name>> attacks!
<</if>>