git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2524 c06c8d41-db1a-0410-9941-cceddc491573
HW7XKO7HRAUQVDVVKG5GA7PYAEL5J5GKVDPT2CKAD3FLERAY5HLAC UL6TJFCVOYWGHMOYG7PCODNN2TRWXLZ46YP6AMFJF5YIKYQVLUTQC S3RNWZ2RPHNTLEPNYRJPQ3PIAP5PW5S3YAQAYQQ5INWLKDKS7XNAC K2GMFKXUWN5R3KCW6OYVXHN47MIQZKEEIOSAU6LFFKBNKF6JBVWAC JM7UAK777RAVDAVLQLEOBRTGNW2B47S5G55XITJXO243IUNZHVYQC E42EFZ3RINKLTGOJJZAH2N5QF3P4S5NCO5T52HLXJRMBPP463HTAC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC APMT6XTVAD4ZCXCMUPTW5KCNR7TXW6W37SNYUP5A6NLFLXT3BCYQC 3KAINFIXO7WNWGUGZB43EUNFRS2ZPBLQZDTY456QACMRHYIJ7WDAC 45CWQUPQHKUFUJ4MVL5K3KCVCCKLY2Z7RZWZ53UT723RV5STPSRAC UKN6HTZXDUUOWKNWNKWPHKGUGL474JIAQN5JU3DM3DU26WGMNP4AC KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC EGV2HM7SD7UQSWJGLR65NQJTUBAJ7WHLM67FMH4UFP7JRSFKREPAC 74LQ7JXVLAFSHLI7LCBKFX47CNTYSKGUQSXNX5FCIUIGCC2JTR3QC JPYDWBRN75GC6UZ26MXJTCXGORTJOWGRDEU4JFPU52LYHGK6UI2QC #endifstatic void give_nemelex_gift(){if (random2(MAX_PIETY) <= you.piety&& one_chance_in(3)&& !you.attribute[ATTR_CARD_COUNTDOWN]&& !grid_destroys_items(grd[you.x_pos][you.y_pos])){misc_item_type gift_type;if ( random2(MAX_PIETY) <= you.piety ){// make a pure deckconst misc_item_type pure_decks[] = {MISC_DECK_OF_ESCAPE,MISC_DECK_OF_DESTRUCTION,MISC_DECK_OF_DUNGEONS,MISC_DECK_OF_SUMMONING,MISC_DECK_OF_WONDERS};int weights[5];get_pure_deck_weights(weights);gift_type = pure_decks[choose_random_weighted(weights, weights+5)];#if DEBUG_GIFTS || DEBUG_CARDSshow_pure_deck_chances();
}else{// make a mixed deckconst misc_item_type mixed_decks[] = {MISC_DECK_OF_WAR,MISC_DECK_OF_CHANGES,MISC_DECK_OF_DEFENSE};gift_type = RANDOM_ELEMENT(mixed_decks);}int thing_created = items( 1, OBJ_MISCELLANY, gift_type,true, 1, MAKE_ITEM_RANDOM_RACE );if (thing_created != NON_ITEM){// Piety|Common | Rare |Legendary// --------------------------------// 0: 95.00%, 5.00%, 0.00%// 20: 86.00%, 10.50%, 3.50%// 40: 77.00%, 16.00%, 7.00%// 60: 68.00%, 21.50%, 10.50%// 80: 59.00%, 27.00%, 14.00%// 100: 50.00%, 32.50%, 17.50%// 120: 41.00%, 38.00%, 21.00%// 140: 32.00%, 43.50%, 24.50%// 160: 23.00%, 49.00%, 28.00%// 180: 14.00%, 54.50%, 31.50%// 200: 5.00%, 60.00%, 35.00%int common_weight = 95 - (90 * you.piety / MAX_PIETY);int rare_weight = 5 + (55 * you.piety / MAX_PIETY);int legend_weight = 0 + (35 * you.piety / MAX_PIETY);deck_rarity_type rarity = static_cast<deck_rarity_type>(random_choose_weighted(common_weight,DECK_RARITY_COMMON,rare_weight,DECK_RARITY_RARE,legend_weight,DECK_RARITY_LEGENDARY,0));item_def &deck(mitm[thing_created]);deck.special = rarity;deck.colour = deck_rarity_to_color(rarity);move_item_to_grid( &thing_created, you.x_pos, you.y_pos );origin_acquired(deck, you.religion);simple_god_message(" grants you a gift!");more();canned_msg(MSG_SOMETHING_APPEARS);you.attribute[ATTR_CARD_COUNTDOWN] = 10;inc_gift_timeout(5 + random2avg(9, 2));you.num_gifts[you.religion]++;take_note(Note(NOTE_GOD_GIFT, you.religion));}}}
if (random2(MAX_PIETY) <= you.piety&& one_chance_in(3)&& !you.attribute[ATTR_CARD_COUNTDOWN]&& !grid_destroys_items(grd[you.x_pos][you.y_pos])){misc_item_type gift_type;if ( random2(MAX_PIETY) <= you.piety ){// make a pure deckconst misc_item_type pure_decks[] = {MISC_DECK_OF_ESCAPE,MISC_DECK_OF_DESTRUCTION,MISC_DECK_OF_DUNGEONS,MISC_DECK_OF_SUMMONING,MISC_DECK_OF_WONDERS};int weights[5];get_pure_deck_weights(weights);gift_type = pure_decks[choose_random_weighted(weights,weights+5)];#if DEBUG_GIFTS || DEBUG_CARDSshow_pure_deck_chances();#endif}else{// make a mixed deckconst misc_item_type mixed_decks[] = {MISC_DECK_OF_WAR,MISC_DECK_OF_CHANGES,MISC_DECK_OF_DEFENSE};gift_type = RANDOM_ELEMENT(mixed_decks);}int thing_created = items( 1, OBJ_MISCELLANY, gift_type,true, 1, MAKE_ITEM_RANDOM_RACE );if (thing_created != NON_ITEM){// Piety|Common | Rare |Legendary// --------------------------------// 0: 95.00%, 5.00%, 0.00%// 20: 86.00%, 10.50%, 3.50%// 40: 77.00%, 16.00%, 7.00%// 60: 68.00%, 21.50%, 10.50%// 80: 59.00%, 27.00%, 14.00%// 100: 50.00%, 32.50%, 17.50%// 120: 41.00%, 38.00%, 21.00%// 140: 32.00%, 43.50%, 24.50%// 160: 23.00%, 49.00%, 28.00%// 180: 14.00%, 54.50%, 31.50%// 200: 5.00%, 60.00%, 35.00%int common_weight = 95 - (90 * you.piety / MAX_PIETY);int rare_weight = 5 + (55 * you.piety / MAX_PIETY);int legend_weight = 0 + (35 * you.piety / MAX_PIETY);deck_rarity_type rarity = (deck_rarity_type)random_choose_weighted(common_weight,DECK_RARITY_COMMON,rare_weight,DECK_RARITY_RARE,legend_weight,DECK_RARITY_LEGENDARY,0);item_def &deck(mitm[thing_created]);deck.special = rarity;deck.colour = deck_rarity_to_color(rarity);move_item_to_grid( &thing_created, you.x_pos, you.y_pos );origin_acquired(deck, you.religion);simple_god_message(" grants you a gift!");more();canned_msg(MSG_SOMETHING_APPEARS);you.attribute[ATTR_CARD_COUNTDOWN] = 10;inc_gift_timeout(5 + random2avg(9, 2));you.num_gifts[you.religion]++;take_note(Note(NOTE_GOD_GIFT, you.religion));}}
give_nemelex_gift();
mpr("Oops, all of the cards seem to be gone.");mpr("A swarm of software bugs snatches the deck from you and ""whisk it away.");
strm << "Oops, all of the cards seem to be gone." << std::endl<< "A swarm of software bugs snatches the deck from you ""and whisks it away." << std::endl;
mprf("Oops, counted %d marked cards, but num_marked is %d.",(int) num_marked, (int) props["num_marked"].get_byte());
strm << "Oops, counted " << static_cast<int>(num_marked)<< " marked cards, but num_marked is "<< (static_cast<int>(props["num_marked"].get_byte()));