Updated quests a bit. Now gives 1 rewoard with quantity determined by how well you did.

This commit is contained in:
Storm Dragon
2026-01-27 21:06:29 -05:00
parent 6b2f9d4457
commit 6407f39d1a
+46 -21
View File
@@ -87,29 +87,50 @@ void apply_quest_reward(int score) {
if (favor_gain < 0) favor_gain = 0; if (favor_gain < 0) favor_gain = 0;
favor += favor_gain; favor += favor_gain;
int stones_gain = (score >= QUEST_STONE_SCORE) ? 1 : 0; // Determine quantity based on score
int logs_gain = (score >= QUEST_LOG_SCORE) ? 1 : 0; // <= 2: 0
int skins_gain = (score >= QUEST_SKIN_SCORE) ? 1 : 0; // 3-5: 1
int scrolls_gain = 0; // 6-7: 2
if (score >= QUEST_STONE_SCORE) scrolls_gain++; // 8-9: 3
if (score >= QUEST_LOG_SCORE) scrolls_gain++; // >= 10: 4
if (score >= QUEST_SKIN_SCORE) scrolls_gain++; int quantity = 0;
if (score >= QUEST_LOG_SCORE) quantity = 4;
else if (score >= QUEST_LOG_SCORE - 2) quantity = 3;
else if (score >= QUEST_STONE_SCORE) quantity = 2;
else if (score > 2) quantity = 1;
int stones_added = add_to_stack(get_personal_count(ITEM_STONES), stones_gain); // Select reward item
add_personal_count(ITEM_STONES, stones_added); int[] possible_rewards = {
int logs_added = add_to_stack(get_personal_count(ITEM_LOGS), logs_gain); ITEM_STICKS, ITEM_VINES, ITEM_REEDS, ITEM_STONES, ITEM_LOGS, ITEM_CLAY,
add_personal_count(ITEM_LOGS, logs_added); ITEM_MEAT, ITEM_SKINS, ITEM_FEATHERS, ITEM_DOWN, ITEM_FISH, ITEM_SMOKED_FISH,
int skins_added = add_to_stack(get_personal_count(ITEM_SKINS), skins_gain); ITEM_HEAL_SCROLL, ITEM_INCENSE, ITEM_BASKET_FOOD
add_personal_count(ITEM_SKINS, skins_added); };
int scrolls_added = add_to_stack(get_personal_count(ITEM_HEAL_SCROLL), scrolls_gain); int reward_item = possible_rewards[random(0, possible_rewards.length() - 1)];
add_personal_count(ITEM_HEAL_SCROLL, scrolls_added);
int added_amount = 0;
if (quantity > 0) {
added_amount = add_to_stack(get_personal_count(reward_item), quantity);
add_personal_count(reward_item, added_amount);
// Special handling for fish which needs weights
if (reward_item == ITEM_FISH) {
for (int i = 0; i < added_amount; i++) {
add_personal_fish_weight(get_default_fish_weight());
}
}
}
string message = "Quest Complete!\n\nRewards:\n"; string message = "Quest Complete!\n\nRewards:\n";
message += get_quest_favor_phrase(score) + "\n"; message += get_quest_favor_phrase(score) + "\n";
if (stones_gain > 0) message += "Stones: +" + stones_added + "\n";
if (logs_gain > 0) message += "Logs: +" + logs_added + "\n"; if (added_amount > 0) {
if (skins_gain > 0) message += "Skins: +" + skins_added + "\n"; message += get_item_display_name(reward_item) + ": +" + added_amount + "\n";
if (scrolls_gain > 0) message += "Heal Scrolls: +" + scrolls_added + "\n"; } else if (quantity > 0) {
message += "Inventory full, could not receive " + get_item_display_name(reward_item) + ".\n";
} else {
message += "No items awarded.\n";
}
message += "\nScore: " + score; message += "\nScore: " + score;
text_reader(message, "Quest Rewards", true); text_reader(message, "Quest Rewards", true);
} }
@@ -141,16 +162,20 @@ void run_quest_menu() {
break; break;
} }
string count_str = " " + (selection + 1) + " of " + options.length();
if (key_pressed(KEY_DOWN)) { if (key_pressed(KEY_DOWN)) {
selection++; selection++;
if (selection >= options.length()) selection = 0; if (selection >= options.length()) selection = 0;
speak_with_history(options[selection], true); count_str = " " + (selection + 1) + " of " + options.length();
speak_with_history(options[selection] + count_str, true);
} }
if (key_pressed(KEY_UP)) { if (key_pressed(KEY_UP)) {
selection--; selection--;
if (selection < 0) selection = options.length() - 1; if (selection < 0) selection = options.length() - 1;
speak_with_history(options[selection], true); count_str = " " + (selection + 1) + " of " + options.length();
speak_with_history(options[selection] + count_str, true);
} }
if (key_pressed(KEY_RETURN)) { if (key_pressed(KEY_RETURN)) {