Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!exodus!arthur.Eng.Sun.COM!djenner From: djenner@arthur.Eng.Sun.COM (Doug Jenner) Newsgroups: comp.sources.games.bugs Subject: Re: File players/default missing from MDG... Summary: here are the diffs I mentioned Message-ID: <8757@exodus.Eng.Sun.COM> Date: 27 Feb 91 20:14:51 GMT References: <1991Feb20.174300.23010@coplex.uucp> <1991Feb21.143610.11358@max.physics.sunysb.edu> <1991Feb22.201422.15177@fxgrp.fx.com> <1991Feb23.193839.10399@sugar.hackercorp.com> <1991Feb24.234225.1459@nicedel.north.de> <8639@exodus.Eng.Sun.COM> Sender: news@exodus.Eng.Sun.COM Reply-To: djenner@sun.UUCP (Doug Jenner) Organization: Sun Microsystems, Mountain View Lines: 146 Below are *UNOFFICAL* patches that tweak mdg to handle items in a little more interesting fashion. There are two patches, one of which changes msghandler.c to allow the trader to buy and sell stuff from "phantom non-player characters" and another to insure high danger monster give out high value prizes (when available). To go into a bit more detail: ) The trader gradually loses stock to decay in the standard game. This is nice to keep some of the big ticket items from just collecting in the traders and never being awarded, but makes for a tough opening game. There is nothing in the trader to begin with and a low number of active players means very little shows up to buy. The patch causes 5 items to be picked at random every noon. If these items are not currently in play and are not stuff such as cash, crystals, notes, or overly valuable, then they are put up for sale. Think of them as items sold by "non player characters" to the trader, and the items that disappear through decay as having been purchased by those selfsame characters. ) The other patch causes prizes to be awarded in a manner such that dangerous critters cough up big ticket items (value of treasure >= 10*danger^2 - 10) An unusual side effect is that if there is no approriate item, you get nothing. (I still don't think a dragon should give a torch as a prize!) I can't seem to get a a message to jcg@tree.uucp, so these things don't have the blessing of the author. Use at your own risk. 8<--- cut here 8<--- *** msghandler.c.orig Wed Feb 27 11:44:55 1991 --- msghandler.c Wed Feb 27 11:48:04 1991 *************** *** 319,325 **** break; case G_MORNING : dmsg_all("It's noon."); ! break; case G_AFTERNOON : dmsg_all("It's evening."); break; --- 319,326 ---- break; case G_MORNING : dmsg_all("It's noon."); ! blue_light_specials(); /*every day at noon, new stuff goes */ ! break; /* on sale at the traders */ case G_AFTERNOON : dmsg_all("It's evening."); break; *************** *** 331,337 **** --- 332,366 ---- decay_items(); } + blue_light_specials() + /* Check to see how much value the trader has in stock. The trader can + ** "afford" 150% of the value of stock on hand (plus $50) to aquire items + ** from "non-player" characters. Next, five items are chosen at random + ** from the list. If these items are in NONESUCH land and are note notes, + ** cash, or crystals (and are "affordable") the trader gets to put it up + ** for sale. If any of the above conditions are not met, the trader misses + ** out on the item. + */ + { + int i, chance, total_stock_value = 0; + + for(i = pseg->item_count - 1; i >= 0; i--) + if (pseg->itm[i].loc.sector == LOC_TRADER) + total_stock_value += pseg->itm[i].value; + for(i = 0; i<5; i++) { + chance = rnd(pseg->item_count - 1); + if (pseg->itm[chance].type != CRYSTAL + && pseg->itm[chance].type != NOTE + && pseg->itm[chance].type != CASH + && pseg->itm[chance].value < ((1.5*total_stock_value)+50) + && pseg->itm[chance].loc.sector == LOC_NONESUCH) { + pseg->itm[chance].loc.sector = LOC_TRADER; + pseg->itm[chance].decay_cnt = 0; + } + } + } + decay_items() { int i, sector, x; *** combat.c.orig Wed Feb 27 11:44:56 1991 --- combat.c Wed Feb 27 11:47:46 1991 *************** *** 696,702 **** switch(rnd(2)) { case 1 : ! put_item_tr(sector, x, y); break; case 2 : put_treasure(tval * 20, sector, x, y); --- 696,702 ---- switch(rnd(2)) { case 1 : ! put_item_tr(sector, x, y, danger); break; case 2 : put_treasure(tval * 20, sector, x, y); *************** *** 741,748 **** } ! put_item_tr(sector, x, y) ! int sector, x, y; { int i, choice; --- 741,748 ---- } ! put_item_tr(sector, x, y, danger) ! int sector, x, y, danger; { int i, choice; *************** *** 751,757 **** for(i = 0; i < pseg->item_count; i++) { if(pseg->itm[i].loc.sector == LOC_NONESUCH && pseg->itm[i].type != CRYSTAL ! && pseg->itm[i].type != CASH) { if(choice == -1 || rnd(2) == 1) choice = i; } --- 751,758 ---- for(i = 0; i < pseg->item_count; i++) { if(pseg->itm[i].loc.sector == LOC_NONESUCH && pseg->itm[i].type != CRYSTAL ! && pseg->itm[i].type != CASH ! && pseg->itm[i].value >= (10*(danger*danger)-10)) { if(choice == -1 || rnd(2) == 1) choice = i; } -- _Doug Jenner_ Model: Homo Sapiens, version 0.24, Alpha release djenner@sun.com The above views are those of the author, and not necessarily those of Sun Microsystems, Inc. 'Though I haven't really asked them about it.