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

View File

@@ -87,29 +87,50 @@ void apply_quest_reward(int score) {
if (favor_gain < 0) favor_gain = 0;
favor += favor_gain;
int stones_gain = (score >= QUEST_STONE_SCORE) ? 1 : 0;
int logs_gain = (score >= QUEST_LOG_SCORE) ? 1 : 0;
int skins_gain = (score >= QUEST_SKIN_SCORE) ? 1 : 0;
int scrolls_gain = 0;
if (score >= QUEST_STONE_SCORE) scrolls_gain++;
if (score >= QUEST_LOG_SCORE) scrolls_gain++;
if (score >= QUEST_SKIN_SCORE) scrolls_gain++;
// Determine quantity based on score
// <= 2: 0
// 3-5: 1
// 6-7: 2
// 8-9: 3
// >= 10: 4
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);
add_personal_count(ITEM_STONES, stones_added);
int logs_added = add_to_stack(get_personal_count(ITEM_LOGS), logs_gain);
add_personal_count(ITEM_LOGS, logs_added);
int skins_added = add_to_stack(get_personal_count(ITEM_SKINS), skins_gain);
add_personal_count(ITEM_SKINS, skins_added);
int scrolls_added = add_to_stack(get_personal_count(ITEM_HEAL_SCROLL), scrolls_gain);
add_personal_count(ITEM_HEAL_SCROLL, scrolls_added);
// Select reward item
int[] possible_rewards = {
ITEM_STICKS, ITEM_VINES, ITEM_REEDS, ITEM_STONES, ITEM_LOGS, ITEM_CLAY,
ITEM_MEAT, ITEM_SKINS, ITEM_FEATHERS, ITEM_DOWN, ITEM_FISH, ITEM_SMOKED_FISH,
ITEM_HEAL_SCROLL, ITEM_INCENSE, ITEM_BASKET_FOOD
};
int reward_item = possible_rewards[random(0, possible_rewards.length() - 1)];
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";
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 (skins_gain > 0) message += "Skins: +" + skins_added + "\n";
if (scrolls_gain > 0) message += "Heal Scrolls: +" + scrolls_added + "\n";
if (added_amount > 0) {
message += get_item_display_name(reward_item) + ": +" + added_amount + "\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;
text_reader(message, "Quest Rewards", true);
}
@@ -140,17 +161,21 @@ void run_quest_menu() {
speak_with_history("Closed.", true);
break;
}
string count_str = " " + (selection + 1) + " of " + options.length();
if (key_pressed(KEY_DOWN)) {
selection++;
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)) {
selection--;
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)) {