Ticket #88: lanterns.patch

File lanterns.patch, 14.2 kB (added by takkaria, 2 years ago)

Current patch (incomplete)

  • lib/edit/artifact.txt

    old new  
    8383I:39:4:0 
    8484W:5:5:10:10000 
    8585P:0:1d1:0:0:0 
    86 F:ACTIVATE |  
     86F:ACTIVATE | NO_FUEL | 
    8787F:INSTA_ART 
    8888A:ILLUMINATION:10:10 
    8989D:A small crystal phial, with the light of Earendil's Star contained inside.   
     
    9696I:39:5:0 
    9797W:30:25:5:30000 
    9898P:0:1d1:0:0:0 
    99 F:ACTIVATE | SEE_INVIS |  
     99F:ACTIVATE | SEE_INVIS | NO_FUEL | 
    100100F:INSTA_ART 
    101101A:MAGIC_MAP:50:50 
    102102D:The shining Star of the West, a treasured heirloom of Elendil's house. 
     
    107107I:39:6:0 
    108108W:50:50:5:50000 
    109109P:0:1d1:0:0:0 
    110 F:ACTIVATE | SEE_INVIS | HOLD_LIFE | RES_LITE | RES_DARK |  
     110F:ACTIVATE | SEE_INVIS | HOLD_LIFE | RES_LITE | RES_DARK | NO_FUEL | 
    111111F:INSTA_ART 
    112112A:DETECT:30:30 
    113113D:A great globe seemingly filled with moonlight, the famed Heart of the  
     
    162162W:75:60:200:100000 
    163163P:0:10d10:0:0:0 
    164164# F:DRAIN_MANA |  
    165 F:ACTIVATE |  
     165F:ACTIVATE | NO_FUEL | 
    166166F:INT | WIS | SEARCH | INFRA | SEE_INVIS | TELEPATHY |  
    167167F:RES_CHAOS | RES_BLIND | AGGRAVATE | DRAIN_EXP |  
    168168F:INSTA_ART | HIDE_TYPE 
  • lib/edit/ego_item.txt

    old new  
    754754T:23:0:99 
    755755F:CON | KILL_DRAGON | RES_FEAR 
    756756 
    757 # 96 (unused) 
    758757 
    759 # 97 (unused) 
     758### Lanterns/torches 
    760759 
    761 # 98 (unused) 
     760N:96:of Shadows 
     761X:10:0 
     762W:5:4:0:1000 (imported from NPP) 
     763C:0:0:0:2 
     764T:39:0:1 
     765F:STEALTH | HIDE_TYPE | RES_LITE 
    762766 
    763 # 99 (unused) 
     767N:97:of Brightness 
     768X:10:0 
     769W:0:2:0:2000 (imported from S) 
     770C:0:0:0:0 
     771T:39:0:1 
     772F:LITE 
    764773 
     774N:98:(Everburning) 
     775X:10:0 
     776W:0:3:0:2500 (imported from S) 
     777C:0:0:0:0 
     778T:39:1:1 (lanterns only) 
     779F:NO_FUEL 
     780 
     781N:99:of True Sight 
     782X:10:0 
     783#W:depth:rarity:extra weight:cost 
     784W:20:8:0:6000 (imported from S) 
     785C:0:0:0:0 
     786T:39:0:1 
     787F:RES_BLIND | SEE_INVIS 
     788 
     789 
    765790### Digging Tools 
    766791 
    767792N:100:of Digging 
  • lib/edit/object.txt

    old new  
    31363136N:347:& Brass Lantern~ 
    31373137G:~:U 
    31383138I:39:1:0 
    3139 W:3:0:50:3
     3139W:3:0:50:6
    31403140A:3/1 
    31413141P:0:1d1:0:0:0 
    31423142F:EASY_KNOW | IGNORE_FIRE 
  • src/defines.h

    old new  
    298298/* 
    299299 * Refueling constants 
    300300 */ 
    301 #define FUEL_TORCH      5000  /* Maximum amount of fuel in a torch */ 
     301#define FUEL_TORCH      6000  /* Maximum amount of fuel in a torch */ 
    302302#define FUEL_LAMP       15000   /* Maximum amount of fuel in a lantern */ 
    303303 
    304304 
     
    454454        TMD_AFRAID, TMD_IMAGE, TMD_POISONED, TMD_CUT, TMD_STUN, TMD_PROTEVIL, 
    455455        TMD_INVULN, TMD_HERO, TMD_SHERO, TMD_SHIELD, TMD_BLESSED, TMD_SINVIS, 
    456456        TMD_SINFRA, TMD_OPP_ACID, TMD_OPP_ELEC, TMD_OPP_FIRE, TMD_OPP_COLD, 
    457         TMD_OPP_POIS, 
     457        TMD_OPP_POIS, TMD_LIGHT_AURA, 
    458458 
    459459        TMD_MAX 
    460460}; 
     
    18871887#define TR3_SEE_INVIS       0x00000020L /* See Invis */ 
    18881888#define TR3_FREE_ACT        0x00000040L /* Free action */ 
    18891889#define TR3_HOLD_LIFE       0x00000080L /* Hold life */ 
    1890 #define TR3_XXX1            0x00000100L 
     1890#define TR3_NO_FUEL         0x00000100L /* Light source uses no fuel */ 
    18911891#define TR3_XXX2            0x00000200L 
    18921892#define TR3_XXX3            0x00000400L 
    18931893#define TR3_XXX4            0x00000800L 
     
    30293029#define MSG_KILL_KING       147 
    30303030#define MSG_DRAIN_STAT      148 
    30313031#define MSG_MULTIPLY        149 
     3032#define MSG_LIGHT_AURA      150 
    30323033 
    3033 #define MSG_MAX             150 
     3034#define MSG_MAX             151 
    30343035 
    30353036/* 
    30363037 * Hack -- maximum known sounds 
  • src/dungeon.c

    old new  
    901901        /* Burn some fuel in the current lite */ 
    902902        if (o_ptr->tval == TV_LITE) 
    903903        { 
    904                 /* Hack -- Use some fuel (except on artifacts) */ 
    905                 if (!artifact_p(o_ptr) && (o_ptr->timeout > 0)) 
     904                u32b f1, f2, f3; 
     905                bool burn_fuel = TRUE; 
     906 
     907                /* Get the object flags */ 
     908                object_flags(o_ptr, &f1, &f2, &f3); 
     909 
     910                /* Turn off the wanton burning of light during the day in the town */ 
     911                if (!p_ptr->depth && ((turn % (10L * TOWN_DAWN)) < ((10L * TOWN_DAWN) / 2))) 
     912                        burn_fuel = FALSE; 
     913 
     914                /* If the light has the NO_FUEL flag, well... */ 
     915                if (f3 & TR3_NO_FUEL) 
     916                    burn_fuel = FALSE; 
     917 
     918                /* Use some fuel (except on artifacts, or during the day) */ 
     919                if (burn_fuel && o_ptr->timeout > 0) 
    906920                { 
    907921                        /* Decrease life-span */ 
    908922                        o_ptr->timeout--; 
  • src/init1.c

    old new  
    448448        "SEE_INVIS", 
    449449        "FREE_ACT", 
    450450        "HOLD_LIFE", 
    451         "XXX1", 
     451        "NO_FUEL", 
    452452        "XXX2", 
    453453        "XXX3", 
    454454        "XXX4", 
  • src/object1.c

    old new  
    13101310        if (mode < 2) goto object_desc_done; 
    13111311 
    13121312        /* Hack -- Process Lanterns/Torches */ 
    1313         if ((o_ptr->tval == TV_LITE) && (!artifact_p(o_ptr))) 
     1313        if ((o_ptr->tval == TV_LITE) && !(f3 & TR3_NO_FUEL)) 
    13141314        { 
    13151315                /* Hack -- Turns of light for normal lites */ 
    13161316                object_desc_str_macro(t, " (with "); 
  • src/spells2.c

    old new  
    496496        { 
    497497                info[i++] = "You are temporarily invulnerable."; 
    498498        } 
     499        if (p_ptr->timed[TMD_INVULN]) 
     500        { 
     501                info[i++] = "You are surrounded by an unearthly light."; 
     502        } 
    499503        if (p_ptr->confusing) 
    500504        { 
    501505                info[i++] = "Your hands are glowing dull red."; 
     
    525529        { 
    526530                info[i++] = "You land gently."; 
    527531        } 
    528         if (p_ptr->lite) 
    529         { 
    530                 info[i++] = "You are glowing with light."; 
    531         } 
    532532        if (p_ptr->regenerate) 
    533533        { 
    534534                info[i++] = "You regenerate quickly."; 
  • src/store.c

    old new  
    250250                        /* Analyze the type */ 
    251251                        switch (o_ptr->tval) 
    252252                        { 
    253                                 case TV_FOOD: 
    254                                 case TV_LITE: 
    255                                 case TV_FLASK: 
    256253                                case TV_SPIKE: 
    257254                                case TV_SHOT: 
    258255                                case TV_ARROW: 
    259256                                case TV_BOLT: 
    260257                                case TV_DIGGING: 
    261258                                case TV_CLOAK: 
    262                                 break; 
     259                                        break; 
     260 
     261                                case TV_LITE: 
     262                                        if (artifact_p(o_ptr) || ego_item_p(o_ptr)) 
     263                                                break; 
     264 
    263265                                default: 
    264                                 return (FALSE); 
     266                                       return (FALSE); 
    265267                        } 
    266268                        break; 
    267269                } 
     
    281283                                case TV_SOFT_ARMOR: 
    282284                                case TV_HARD_ARMOR: 
    283285                                case TV_DRAG_ARMOR: 
    284                                 break; 
     286                                        break; 
     287 
    285288                                default: 
    286                                 return (FALSE); 
     289                                       return (FALSE); 
    287290                        } 
    288291                        break; 
    289292                } 
     
    302305                                case TV_HAFTED: 
    303306                                case TV_POLEARM: 
    304307                                case TV_SWORD: 
    305                                 break; 
     308                                        break; 
     309 
    306310                                default: 
    307                                 return (FALSE); 
     311                                       return (FALSE); 
    308312                        } 
    309313                        break; 
    310314                } 
     
    319323                                case TV_SCROLL: 
    320324                                case TV_POTION: 
    321325                                case TV_HAFTED: 
    322                                 break; 
     326                                        break; 
     327 
    323328                                case TV_POLEARM: 
    324329                                case TV_SWORD: 
    325330                                { 
    326331                                        /* Known blessed blades are accepted too */ 
    327332                                        if (is_blessed(o_ptr) && object_known_p(o_ptr)) break; 
    328333                                } 
     334 
    329335                                default: 
    330                                 return (FALSE); 
     336                                       return (FALSE); 
    331337                        } 
    332338                        break; 
    333339                } 
     
    340346                        { 
    341347                                case TV_SCROLL: 
    342348                                case TV_POTION: 
    343                                 break; 
     349                                        break; 
     350 
    344351                                default: 
    345                                 return (FALSE); 
     352                                       return (FALSE); 
    346353                        } 
    347354                        break; 
    348355                } 
     
    361368                                case TV_ROD: 
    362369                                case TV_SCROLL: 
    363370                                case TV_POTION: 
    364                                 break; 
     371                                        break; 
     372                                 
    365373                                default: 
    366                                 return (FALSE); 
     374                                       return (FALSE); 
    367375                        } 
    368376                        break; 
    369377                } 
     
    10471055 * stores have, unless it is an ego-item or has various bonuses. 
    10481056 * 
    10491057 * Based on a suggestion by Lee Vogt <lvogt@cig.mcel.mot.com>. 
    1050  * 
    1051  * If the stores ever become truly externalised, i.e. if Lua becomes more 
    1052  * integrated, then there should be some way to get this out of the compiled 
    1053  * code, as it is a little hacky.  XXX 
    10541058 */ 
    10551059static bool black_market_ok(const object_type *o_ptr) 
    10561060{ 
    10571061        int i, j; 
    10581062 
    10591063        /* Ego items are always fine */ 
    1060         if (o_ptr->name2) return (TRUE); 
     1064        if (ego_item_p(o_ptr)) return (TRUE); 
    10611065 
    10621066        /* Good items are normally fine */ 
    10631067        if (o_ptr->to_a > 2) return (TRUE); 
     
    12781282        { TV_FOOD, SV_FOOD_JERKY, MAKE_NORMAL }, 
    12791283        { TV_FOOD, SV_FOOD_PINT_OF_WINE, MAKE_NORMAL }, 
    12801284        { TV_LITE, SV_LITE_TORCH, MAKE_NORMAL }, 
    1281         { TV_LITE, SV_LITE_LANTERN, MAKE_NORMAL }, 
    12821285        { TV_FLASK, 0, MAKE_NORMAL }, 
    12831286        { TV_SPIKE, 0, MAKE_NORMAL }, 
    12841287        { TV_SHOT, SV_AMMO_NORMAL, MAKE_MAX }, 
  • src/types.h

    old new  
    10201020 
    10211021        bool slow_digest;       /* Slower digestion */ 
    10221022        bool ffall;                     /* Feather falling */ 
    1023         bool lite;                      /* Permanent light */ 
    10241023        bool regenerate;        /* Regeneration */ 
    10251024        bool telepathy;         /* Telepathy */ 
    10261025        bool see_inv;           /* See invisible */ 
  • src/variable.c

    old new  
    372372        "kill_king", 
    373373        "drain_stat", 
    374374        "multiply", 
     375        "light_aura", 
    375376}; 
    376377 
    377378 
  • src/xtra1.c

    old new  
    841841 
    842842 
    843843/* 
    844  * Prints the speed of a character.                    -CJS- 
     844 * Prints the speed of a character. 
    845845 */ 
    846846static void prt_speed(int row, int col) 
    847847{ 
    848848        int i = p_ptr->pspeed; 
    849849 
    850850        byte attr = TERM_WHITE; 
     851        const char *type = NULL; 
    851852        char buf[32] = ""; 
    852853 
    853854        /* Hack -- Visually "undo" the Search Mode Slowdown */ 
     
    857858        if (i > 110) 
    858859        { 
    859860                attr = TERM_L_GREEN; 
    860                 strnfmt(buf, sizeof(buf), "Fast (+%d)", (i - 110))
     861                type = "Fast"
    861862        } 
    862863 
    863864        /* Slow */ 
    864865        else if (i < 110) 
    865866        { 
    866867                attr = TERM_L_UMBER; 
    867                 strnfmt(buf, sizeof(buf), "Slow (-%d)", (110 - i))
     868                type = "Slow"
    868869        } 
    869870 
     871        if (type) 
     872                strnfmt(buf, sizeof(buf), "%s (%+d)", type, (i - 110)); 
     873 
    870874        /* Display the speed */ 
    871875        c_put_str(attr, format("%-14s", buf), row, col); 
    872876} 
     
    16431647 
    16441648 
    16451649/* 
    1646  * Extract and set the current "lite radius" 
     1650 * Calculate and set the current light radius. 
     1651 * 
     1652 * The brightest wielded object counts as the light source; radii do not add 
     1653 * up anymore.  However, a glowing player will increase radius by one. 
     1654 * 
     1655 * Note that a cursed light source no longer emits light. 
    16471656 */ 
    16481657static void calc_torch(void) 
    16491658{ 
    16501659        int i; 
    1651         object_type *o_ptr; 
    1652         u32b f1, f2, f3; 
    16531660 
    16541661        s16b old_lite = p_ptr->cur_lite; 
     1662        s16b new_lite = 0; 
     1663        bool burn_light = TRUE; 
    16551664 
    16561665 
    1657         /* Assume no light */ 
    1658         p_ptr->cur_lite = 0; 
     1666        /* Ascertain lightness if in the town */ 
     1667        if (!p_ptr->depth && ((turn % (10L * TOWN_DAWN)) < ((10L * TOWN_DAWN) / 2))) 
     1668                burn_light = FALSE; 
    16591669 
    1660         /* Loop through all wielded items */ 
     1670 
     1671        /* Examine all wielded objects, use the brightest */ 
    16611672        for (i = INVEN_WIELD; i < INVEN_TOTAL; i++) 
    16621673        { 
    1663                 o_ptr = &inventory[i]
     1674                u32b f1, f2, f3
    16641675 
     1676                int amt = 0; 
     1677                object_type *o_ptr = &inventory[i]; 
     1678 
    16651679                /* Skip empty slots */ 
    16661680                if (!o_ptr->k_idx) continue; 
    16671681 
     1682                /* Extract the flags */ 
     1683                object_flags(o_ptr, &f1, &f2, &f3); 
     1684 
     1685                /* LITE flag on an object always increases radius */ 
     1686                if (f3 & TR3_LITE) amt++; 
     1687 
     1688                /* Cursed objects emit no light */ 
     1689                if (o_ptr->ident & IDENT_CURSED) 
     1690                { 
     1691                        amt = 0; 
     1692                } 
     1693 
    16681694                /* Examine actual lites */ 
    1669                 if (o_ptr->tval == TV_LITE) 
     1695                else if (o_ptr->tval == TV_LITE) 
    16701696                { 
    1671                         /* Artifact Lites provide permanent, bright, lite */ 
     1697                        /* Artifact Lites provide permanent bright light */ 
    16721698                        if (artifact_p(o_ptr)) 
     1699                                amt += 3; 
     1700 
     1701                        /* Non-artifact lights and those without fuel provide no light */ 
     1702                        else if (!burn_light || o_ptr->timeout == 0) 
     1703                            amt = 0; 
     1704 
     1705                        /* All lit lights provide at least radius 2 light */ 
     1706                        else 
    16731707                        { 
    1674                                 p_ptr->cur_lite += 3; 
    1675                                 continue; 
     1708                                amt += 2; 
     1709 
     1710                                /* Torches below half fuel provide less light */ 
     1711                                if (o_ptr->sval == SV_LITE_TORCH && o_ptr->timeout < (FUEL_TORCH / 4)) 
     1712                                    amt--; 
    16761713                        } 
    1677                          
    1678                         /* Lanterns (with fuel) provide more lite */ 
    1679                         if ((o_ptr->sval == SV_LITE_LANTERN) && (o_ptr->timeout > 0)) 
    1680                         { 
    1681                                 p_ptr->cur_lite += 2; 
    1682                                 continue; 
    1683                         } 
    1684                          
    1685                         /* Torches (with fuel) provide some lite */ 
    1686                         if ((o_ptr->sval == SV_LITE_TORCH) && (o_ptr->timeout > 0)) 
    1687                         { 
    1688                                 p_ptr->cur_lite += 1; 
    1689                                 continue; 
    1690                         } 
    16911714                } 
    1692                 else 
    1693                 { 
    1694                         /* Extract the flags */ 
    1695                         object_flags(o_ptr, &f1, &f2, &f3); 
    16961715 
    1697                        /* does this item glow? */ 
    1698                        if (f3 & TR3_LITE) p_ptr->cur_lite++; 
    1699                 } 
     1716                /* Alter p_ptr->cur_lite if reasonable */ 
     1717                if (new_lite < amt) 
     1718                    new_lite = amt; 
    17001719        } 
    17011720 
    17021721 
    1703         /* Player is glowing */ 
    1704         if (p_ptr->lite) p_ptr->cur_lite++; 
     1722        /* Glowing players should have extra light */ 
     1723        if (p_ptr->timed[TMD_LIGHT_AURA]) 
     1724                new_lite++; 
    17051725 
    17061726 
     1727        /* Limit light radius (paranoia) */ 
     1728        new_lite = MIN(new_lite, 4); 
     1729        new_lite = MAX(new_lite, 0); 
     1730 
    17071731        /* Notice changes in the "lite radius" */ 
    1708         if (old_lite != p_ptr->cur_lite) 
     1732        if (old_lite != new_lite) 
    17091733        { 
    17101734                /* Update the visuals */ 
     1735                p_ptr->cur_lite = new_lite; 
    17111736                p_ptr->update |= (PU_UPDATE_VIEW | PU_MONSTERS); 
    17121737        } 
    17131738} 
     
    18431868        p_ptr->ffall = FALSE; 
    18441869        p_ptr->hold_life = FALSE; 
    18451870        p_ptr->telepathy = FALSE; 
    1846         p_ptr->lite = FALSE; 
    18471871        p_ptr->sustain_str = FALSE; 
    18481872        p_ptr->sustain_int = FALSE; 
    18491873        p_ptr->sustain_wis = FALSE; 
     
    19151939        /* Good flags */ 
    19161940        if (f3 & (TR3_SLOW_DIGEST)) p_ptr->slow_digest = TRUE; 
    19171941        if (f3 & (TR3_FEATHER)) p_ptr->ffall = TRUE; 
    1918         if (f3 & (TR3_LITE)) p_ptr->lite = TRUE; 
    19191942        if (f3 & (TR3_REGEN)) p_ptr->regenerate = TRUE; 
    19201943        if (f3 & (TR3_TELEPATHY)) p_ptr->telepathy = TRUE; 
    19211944        if (f3 & (TR3_SEE_INVIS)) p_ptr->see_inv = TRUE; 
  • src/xtra2.c

    old new  
    5757        { "Your eyes feel very sensitive!", "Your eyes feel less sensitive.", 0, 0, (PU_BONUS | PU_MONSTERS), MSG_SEE_INVIS }, 
    5858        { "Your eyes begin to tingle!", "Your eyes stop tingling.", 0, 0, (PU_BONUS | PU_MONSTERS), MSG_INFRARED }, 
    5959        { "You feel resistant to poison!", "You feel less resistant to poison", PR_OPPOSE_ELEMENTS, 0, 0, MSG_RES_POIS }, 
     60        { "A soft, unearthly light surrounds you.", "The light fades.", 0, 0, PU_TORCH, MSG_LIGHT_AURA }, 
    6061}; 
    6162 
    6263/*