I’ve done a few unpublished (outside of friends at least) IF games before and I decided to ramp things up a bit. I want to include combat in this next one but I’m running into a weird issue with the I7 compiler.
The combat system itself is heavily influenced by the D&D rulesets.
Below is the error followed by the block of code in general. Even after pasting the entire code into Notepad++ I still cannot figure out where Inform is getting the error from. The only thing I can think of at this point is I’m getting programmer’s blindness, so I’m turning to the internet for help!
The Error:
Problem. The phrase or rule definition 'To make (attacker - a person) strike a blow against (defender - a person)' is written using the 'colon and indentation' syntax for its 'if's, 'repeat's and 'while's, where blocks of phrases grouped together are indented one tab step inward from the 'if ...:' or similar phrase to which they belong. But the tabs here seem to be misaligned, and I can't determine the structure. The first phrase going awry in the definition seems to be 'if the instrument is a weapon' , in case that helps.
The code:
To make (attacker - a person) strike (defender - a person):
if the attacker is the player, say "You attack ";
otherwise, say "[The attacker] attacks ";
if the defender is the player, say "you, ";
otherwise, say "[the defender], ";
let the damage done be the hit dice of the attacker;
let the armament be nothing;
if the attacker wears a weapon:
let the damage done be the hit dice of the armament;
say "with [the weapon worn by the player]";
otherwise:
say atkType of the attacker;
change the AC to die roll 1d20;
say ", making an attack roll (1d20) of [AC] ";
let DC be the defense of the defender;
if AC = 1;
if the armament is a weapon; [attacker wields weapon on crit failure]
if the attacker is the player;
say "You completely botch your attack! You deal [run paragraph on]";
let hits be damage done;
let hits be the hits divided by 2;
say "[hits] [paragraph run on]";
if the hits is 1, say "point of damage to yourself!";
otherwise say "points of damage to yourself!";
otherwise:
say "[the attacker] botches their attack! They deal [run paragraph on]";
let hits be damage done;
let hits be the hits divided by 2;
say "[hits] [paragraph run on]";
if the hits is 1, say "point of damage to themself!";
otherwise say "points of damage to themself!";
otherwise: [attacker is unarmed on crit failure]
let hits be 1;
if the attacker is the player;
say "You deal 1 damage to yourself!";
otherwise:
say "[the attacker] deals 1 damage to themself!";
stop;
if AC <= DC; [2 to whatever DC is]
say " - Miss!";
stop;
if AC > DC;
say "- hit, doing [damage done] damage: ";
let hits be the roll of damage done;
stop;
if AC = 20;
say "- a critical hit! You deal [paragraph run on]";
let hits be damage done;
let hits be the hits multiplied by 2;
say "[hits] of damage!";
make the defender take hits points of damage.