Skip to content

Commit

Permalink
Mechanical diff to convert dice results from ints to enum ints
Browse files Browse the repository at this point in the history
  • Loading branch information
thexhr committed Jan 9, 2025
1 parent 8b8a016 commit 642f1b1
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 121 deletions.
6 changes: 3 additions & 3 deletions character.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ cmd_learn_from_your_failures(__attribute__((unused)) char *unused)
toggle_output();
ret = progress_roll(dval);
toggle_output();
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
change_char_value("exp", INCREASE, 3);
printf("You commit to make a dramatic change. Choose one option -> "\
"Rulebook\n");
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
change_char_value("exp", INCREASE, 2);
printf("You learn from your mistakes\n");
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
change_char_value("exp", INCREASE, 1);
printf("Envision on how you set off an ill-fated path\n");
}
Expand Down
24 changes: 12 additions & 12 deletions delve.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ cmd_delve_the_depths(char *cmd)
goto info;

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You mark progress, delve deeper and find an opportunity:\n");
mark_delve_progress(INCREASE);
read_oracle_from_json(ORACLE_DELVE_OPPORTUNITY, 0);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("Rolling on the delve table with %s\n", stat);
if (usedstat == 1)
read_oracle_from_json(ORACLE_DELVE_THE_DEPTHS_WITS, 0);
else if (usedstat == 2)
read_oracle_from_json(ORACLE_DELVE_THE_DEPTHS_SHADOW, 0);
else if (usedstat == 3)
read_oracle_from_json(ORACLE_DELVE_THE_DEPTHS_EDGE, 0);
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
printf("You reveal a danger:\n");
read_oracle_from_json(ORACLE_DELVE_DANGER, 0);
}
Expand Down Expand Up @@ -142,14 +142,14 @@ cmd_check_your_gear(char *cmd)
ival[1] = get_int_from_cmd(cmd);

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You have the needed gear\n");
change_char_value("momentum", INCREASE, 1);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You have the needed gear, but suffer -1 supply\n");
change_char_value("momentum", INCREASE, 1);
change_char_value("supply", DECREASE, 1);
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
printf("You don't have the needed gear and the situation grows more "\
"perilous -> Rulebook\n");
}
Expand Down Expand Up @@ -192,19 +192,19 @@ cmd_escape_the_depths(char *cmd)
goto info;

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You make your way safely out\n");
change_char_value("momentum", INCREASE, 1);
curchar->delve_active = 0;
curchar->delve->progress = 0;
delete_delve(curchar->id);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You make your way out, but this place exacts its price.\n");
printf("Choose one from the Rulebook\n");
curchar->delve_active = 0;
curchar->delve->progress = 0;
delete_delve(curchar->id);
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
printf("A dire threat or imposing obstacle stands in your way\n");
printf("Reveal a danger and if you success, you make your way out!\n");
read_oracle_from_json(ORACLE_DELVE_DANGER, 0);
Expand All @@ -231,19 +231,19 @@ cmd_locate_your_objective(char *cmd)
dval[1] = get_int_from_cmd(cmd);

ret = progress_roll(dval);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You locate your objective and the situation favors you -> "\
"Rulebook\n");
curchar->delve_active = 0;
curchar->delve->progress = 0;
delete_delve(curchar->id);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You locate your objective but face an unforeseen complication "\
"-> Rulebook\n");
curchar->delve_active = 0;
curchar->delve->progress = 0;
delete_delve(curchar->id);
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
locate_your_objective_failed();
}

Expand Down
48 changes: 24 additions & 24 deletions fight.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ cmd_enter_the_fray(char *cmd)
curchar->fight_active = 1;

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
change_char_value("momentum", INCREASE, 2);
set_initiative(1);
printf("You have initiative\n");
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You may choose one boost -> Rulebook\n");
} else if (ret == 2 || ret == 12)
} else if (ret == MISS || ret == MISS_MATCH)
printf("Pay the price -> Rulebook\n");

update_prompt();
Expand Down Expand Up @@ -92,11 +92,11 @@ cmd_end_the_fight(__attribute__((unused)) char *unused)
dval[0] = curchar->fight->progress;

ret = progress_roll(dval);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("The foe is no longer in the fight -> Rulebook\n");
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("The foe is no longer in the fight, but you must chose one option -> Rulebook\n");
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
printf("You lost the fight. Pay the price -> Rulebook\n");
}
curchar->fight_active = 0;
Expand Down Expand Up @@ -124,27 +124,27 @@ cmd_take_decisive_action(__attribute__((unused)) char *unused)
ret = progress_roll(dval);
if (curchar->fight->initiative) {
/* If in control, results count as normal ... */
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
tda_strong:
change_char_value("momentum", INCREASE, 1);
printf("You prevail. If any objectives remain and the fight "\
"continues, you're in control\n");
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
tda_weak:
printf("You achieve your objective, but not without a cost "\
"-> Rulebook\n");
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
tda_miss:
printf("Your are defeated or your objective is lost. Pay the price\n");
}
} else {
/* ... otherwise, it gets harder */
if (ret == 18) /* Strong hit with matches is a strong hit */
if (ret == STRONG_MATCH) /* Strong hit with matches is a strong hit */
goto tda_strong;
else if (ret == 8 || ret == 18) {
else if (ret == STRONG || ret == STRONG_MATCH) {
printf("You are not in control -> weak hit\n");
goto tda_weak; /* Strong hit w/o match -> weak hit */
} else if (ret == 4 || ret == 2) {
} else if (ret == WEAK || ret == MISS) {
printf("You are not in control -> miss\n");
goto tda_miss; /* Everything else is a miss */
}
Expand Down Expand Up @@ -204,11 +204,11 @@ cmd_endure_harm(char *cmd)
}

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You shake it off or embrace the pain -> Rulebook\n");
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You press on\n");
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
change_char_value("momentum", DECREASE, 1);
if (curchar->health == 0)
printf("Mark either maimed or wounded or roll on the oracle table -> Rulebook\n");
Expand Down Expand Up @@ -246,7 +246,7 @@ cmd_strike(char *cmd)
goto info;

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You inflict +1 harm and retain initiative\n");
set_initiative(1);

Expand All @@ -257,7 +257,7 @@ cmd_strike(char *cmd)

mark_fight_progress(INCREASE);
mark_fight_progress(INCREASE);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You inflict harm and lose initiative\n");
set_initiative(0);

Expand All @@ -267,7 +267,7 @@ cmd_strike(char *cmd)
}

mark_fight_progress(INCREASE);
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
printf("Pay the price -> Rulebook\n");
set_initiative(0);
update_prompt();
Expand Down Expand Up @@ -305,7 +305,7 @@ cmd_clash(char *cmd)
goto info;

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You inflict harm, regain initiative and can choose one option -> Rulebook\n");
set_initiative(1);

Expand All @@ -315,7 +315,7 @@ cmd_clash(char *cmd)
}

mark_fight_progress(INCREASE);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You inflict harm and lose initiative. Pay the price -> Rulebook\n");
set_initiative(0);

Expand All @@ -325,7 +325,7 @@ cmd_clash(char *cmd)
}

mark_fight_progress(INCREASE);
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
printf("Pay the price -> Rulebook\n");
set_initiative(0);
update_prompt();
Expand Down Expand Up @@ -367,12 +367,12 @@ cmd_battle(char *cmd)
goto info;

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
change_char_value("momentum", INCREASE, 2);
printf("You achieve your objective unconditionally\n");
} else if (ret == 4 || ret == 14) /* weak hit */
} else if (ret == WEAK || ret == WEAK_MATCH) /* weak hit */
printf("You achieve your objective, but not without a cost -> Rulebook\n");
else if (ret == 2 || ret == 12) /* miss */
else if (ret == MISS || ret == MISS_MATCH) /* miss */
printf("Pay the price -> Rulebook\n");
}

Expand Down
12 changes: 6 additions & 6 deletions journey.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ cmd_undertake_a_journey(char *cmd)
}

ret = action_roll(ival);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You reach a waypoint and can choose one option -> Rulebook\n");
mark_journey_progress(INCREASE);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You reach a waypoint, but suffer -1 supply\n");
change_char_value("supply", DECREASE, 1);
mark_journey_progress(INCREASE);
} else if (ret == 2 || ret == 12)
} else if (ret == MISS || ret == MISS_MATCH)
printf("Pay the price -> Rulebook\n");

update_prompt();
Expand All @@ -87,19 +87,19 @@ cmd_reach_your_destination(char *cmd)
dval[1] = get_int_from_cmd(cmd);

ret = progress_roll(dval);
if (ret == 8 || ret == 18) {
if (ret == STRONG || ret == STRONG_MATCH) {
printf("You reach your destination and the situation favors you -> "\
"Rulebook\n");
curchar->journey_active = 0;
curchar->j->progress = 0;
delete_journey(curchar->id);
} else if (ret == 4 || ret == 14) {
} else if (ret == WEAK || ret == WEAK_MATCH) {
printf("You reach your destination but face an unforeseen complication "\
"-> Rulebook\n");
curchar->journey_active = 0;
curchar->j->progress = 0;
delete_journey(curchar->id);
} else if (ret == 2 || ret == 12) {
} else if (ret == MISS || ret == MISS_MATCH) {
reach_your_destination_failed();
}

Expand Down
Loading

0 comments on commit 642f1b1

Please sign in to comment.