A fun idea inspired by Toril/Sojourn MUDs which I use to (and kinda still) play
is there is a different between infravision and ultravision. I.E. A drow can
see perfectly in pitch black, whereas an elf can only partially see. A way to
I outlined the rough idea of it below.
Code:
|============|
|UTILS.H |
|============|
|============|
On the very top ADD this, near "int room_is_dark"
bool char_has_infra(struct char_data *ch);
bool char_has_ultra(struct char_data *ch);
Find this macro:
#define CAN_SEE_IN_DARK(ch) \
(AFF_FLAGGED(ch, AFF_INFRAVISION) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
REPLACE it with these two:
#define CAN_SEE_IN_DARK(ch) \
(char_has_ultra(ch) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
#define CAN_INFRA_IN_DARK(ch) \
(char_has_infra(ch) || (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
Find this:
#define LIGHT_OK(sub) (!AFF_FLAGGED(sub, AFF_BLIND) && \
(IS_LIGHT(IN_ROOM(sub)) || CAN_SEE_IN_DARK(sub) || \
GET_LEVEL(sub) >= LVL_IMMORT))
ADD this below it:
#define INFRA_OK(sub) (!AFF_FLAGGED(sub, AFF_BLIND) && \
(IS_LIGHT(IN_ROOM(sub)) || CAN_INFRA_IN_DARK(sub) || \
GET_LEVEL(sub) >= LVL_IMMORT))
Find this:
#define MORT_CAN_SEE(sub, obj) (LIGHT_OK(sub) && INVIS_OK(sub, obj))
ADD this:
#define MORT_CAN_INFRA(sub, obj) (INFRA_OK(sub) && INVIS_OK(sub, obj))
Find this:
#define IMM_CAN_SEE(sub, obj) \
(MORT_CAN_SEE(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED(sub, PRF_HOLYLIGHT)))
ADD this:
#define IMM_CAN_INFRA(sub, obj) \
(MORT_CAN_INFRA(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED(sub, PRF_HOLYLIGHT)))
Find this:
#define CAN_SEE(sub, obj) (SELF(sub, obj) || \
((GET_REAL_LEVEL(sub) >= (IS_NPC(obj) ? 0 : GET_INVIS_LEV(obj))) && \
IMM_CAN_SEE(sub, obj)))
ADD this:
#define CAN_INFRA(sub, obj) (SELF(sub, obj) || \
((GET_REAL_LEVEL(sub) >= (IS_NPC(obj) ? 0 : GET_INVIS_LEV(obj))) && \
IMM_CAN_INFRA(sub, obj)))
(Onto objects)
Find this:
#define CAN_SEE_OBJ_CARRIER(sub, obj) \
((!obj->carried_by || CAN_SEE(sub, obj->carried_by)) && \
(!obj->worn_by || CAN_SEE(sub, obj->worn_by)))
ADD this:
#define CAN_INFRA_OBJ_CARRIER(sub, obj) \
((!obj->carried_by || CAN_INFRA(sub, obj->carried_by)) && \
(!obj->worn_by || CAN_INFRA(sub, obj->worn_by)))
Find this:
#define MORT_CAN_SEE_OBJ(sub, obj) \
(LIGHT_OK(sub) && INVIS_OK_OBJ(sub, obj) && CAN_SEE_OBJ_CARRIER(sub, obj))
ADD this:
#define MORT_CAN_INFRA_OBJ(sub, obj) \
(INFRA_OK(sub) && INVIS_OK_OBJ(sub, obj) && CAN_INFRA_OBJ_CARRIER(sub, obj))
Find this:
#define CAN_SEE_OBJ(sub, obj) \
(MORT_CAN_SEE_OBJ(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED((sub), PRF_HOLYLIGHT)))
ADD this:
#define CAN_INFRA_OBJ(sub, obj) \
(MORT_CAN_INFRA_OBJ(sub, obj) || (!IS_NPC(sub) && PRF_FLAGGED((sub), PRF_HOLYLIGHT)))
|============|
|UTILS.C |
|============|
|============|
Find this function:
int room_is_dark(room_rnum room)
ADD these two new functions above it:
bool char_has_infra(struct char_data *ch)
{
if (AFF_FLAGGED(ch, AFF_INFRAVISION))
return TRUE;
/* If you have races you can select them here
if (GET_RACE(ch) == RACE_ELF)
return TRUE;
*/
return FALSE;
}
bool char_has_ultra(struct char_data *ch)
{
if (AFF_FLAGGED(ch, AFF_ULTRAVISION))
return TRUE;
/* If you have races you can select them here
if (GET_RACE(ch) == RACE_TROLL)
return TRUE;
*/
return FALSE;
}
|============|
|STRUCTS.H |
|============|
|============|
Find this:
#define NUM_AFF_FLAGS x <--- this value should be obvious from your list
REPLACE NUM_AFF_FLAGS with one value higher, and above it ADD the new AFF_ flag:
#define AFF_ULTRAVISION (x-1) <--- this value should be obvious from your list
*************
* Now comes the fun part, you get to chose how infravision will react to
your mud, simply use your search command to find all cases of CAN_SEE
and add a clause for CAN_INFRA. You can customize the relationship
however you like, example below would mean infravision would be identical
to having no special vision, except you can know that there are other
characters in the room with you. *
*********
|====================|
|ACT.INFORMATIVE.C |
|====================|
|====================|
Find this function:
static void list_char_to_char(struct char_data *list, struct char_data *ch)
Find these lines in the function:
if (CAN_SEE(ch, i))
list_one_char(i, ch);
ADD this right below it:
else if (CAN_INFRA(ch, i))
send_to_char(ch, "\tnYou see the \trred\tn outline of someone or something.\r\n");