Last active
December 13, 2018 03:18
-
-
Save alexjurkiewicz/88fe1cd641361d4b7c44a5b0ede02b42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc | |
index 9ce7809490..e233410440 100644 | |
--- a/crawl-ref/source/decks.cc | |
+++ b/crawl-ref/source/decks.cc | |
@@ -283,10 +283,11 @@ int deck_cards(deck_type deck) | |
: you.props[deck_name(deck)].get_int(); | |
} | |
-bool gift_cards() | |
+void gift_cards() | |
{ | |
const int deal = random_range(MIN_GIFT_CARDS, MAX_GIFT_CARDS); | |
- bool dealt_cards = false; | |
+ bool dealt = false; | |
+ int dealt_cards[LAST_PLAYER_DECK + 1] = {0}; | |
for (int i = 0; i < deal; i++) | |
{ | |
@@ -297,11 +298,26 @@ bool gift_cards() | |
if (deck_cards(choice) < MAX_DECK_SIZE) | |
{ | |
you.props[deck_name(choice)]++; | |
- dealt_cards = true; | |
+ dealt = true; | |
+ dealt_cards[choice]++; | |
} | |
} | |
- return dealt_cards; | |
+ string msg = comma_separated_fn(0, LAST_PLAYER_DECK, | |
+ [&](int i) | |
+ { | |
+ const int num = dealt_cards[i]; | |
+ const string name = map_find(all_decks, i)->name; | |
+ return make_stringf("%d %s of %s", | |
+ num, | |
+ num > 1 ? "cards" : "card", | |
+ name.c_str()); | |
+ }, | |
+ "and", ",", | |
+ [&](int i) { return !!dealt_cards[i]; }); | |
+ simple_god_message(msg); | |
+ | |
+ return; | |
} | |
void reset_cards() | |
diff --git a/crawl-ref/source/decks.h b/crawl-ref/source/decks.h | |
index 189defddab..4d9e96bb39 100644 | |
--- a/crawl-ref/source/decks.h | |
+++ b/crawl-ref/source/decks.h | |
@@ -59,7 +59,7 @@ string which_decks(card_type card); | |
const string deck_flavour(deck_type deck); | |
deck_type ability_deck(ability_type abil); | |
-bool gift_cards(); | |
+void gift_cards(); | |
void reset_cards(); | |
bool deck_draw(deck_type deck); | |
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc | |
index e87edc26cb..5cf278d9bb 100644 | |
--- a/crawl-ref/source/religion.cc | |
+++ b/crawl-ref/source/religion.cc | |
@@ -949,10 +949,7 @@ static bool _give_nemelex_gift(bool forced = false) | |
&& x_chance_in_y(you.piety + 1, piety_breakpoint(1)) | |
|| one_chance_in(3) && x_chance_in_y(you.piety + 1, MAX_PIETY)) | |
{ | |
- if (gift_cards()) | |
- simple_god_message(" deals you some cards!"); | |
- else | |
- simple_god_message(" goes to deal, but finds you have enough cards."); | |
+ gift_cards(); | |
_inc_gift_timeout(5 + random2avg(9, 2)); | |
you.num_current_gifts[you.religion]++; | |
you.num_total_gifts[you.religion]++; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment