Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quest system #47

Merged
merged 19 commits into from
Jun 8, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
log quest complete
facundoolano committed Jun 8, 2021
commit adb5b0ab0c5b6d46e85aecc0a4758b255cb45dea
6 changes: 6 additions & 0 deletions src/log.rs
Original file line number Diff line number Diff line change
@@ -186,6 +186,12 @@ pub fn shop_list(game: &Game, items: Vec<Box<dyn shop::Shoppable>>) {
println!("\n funds: {}", format_gold(game.gold));
}

pub fn quest_done(reward: i32) {
if !quiet() {
println!(" {} quest completed!", format_gold_plus(reward));
}
}

// HELPERS

/// Generic log function. At the moment all output of the game is structured as
3 changes: 2 additions & 1 deletion src/quest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use core::fmt;
use crate::game;
use crate::log;
use crate::character::Character;
use serde::{Deserialize, Serialize};

@@ -75,7 +76,7 @@ fn handle(game: &mut game::Game, handler: &dyn Fn(QuestRef)) {
if quest.is_done() {
let reward = quest.reward();
game.gold += reward;
// TODO log::quest_done(reward);
log::quest_done(reward);
}
}
}