Board |
Mechanics.old [context] |
Sender |
Bobble |
Date |
Tue Apr 19 22:36:24 2016 |
To |
all |
Subject |
hide checks |
|
bool check_see_new( CHAR_DATA *ch, CHAR_DATA *victim, bool combat )
{
int see_state = can_see_new(ch, victim, combat);
int roll_ch;
int roll_victim;
if (see_state == SEE_CAN)
return TRUE;
if (see_state == SEE_CANT)
return FALSE;
if ( !IS_AFFECTED(victim, AFF_HIDE) )
return TRUE;
if ( is_same_group(ch, victim) )
return TRUE;
// heavy armor penalty grants auto-chance to be spotted
if ( per_chance(get_heavy_armor_penalty(victim)/2) )
return TRUE;
/* victim is hidden, check if char spots it, resisted roll */
roll_ch = (ch->level +
get_curr_stat(ch, STAT_INT) +
get_curr_stat(ch, STAT_WIS)) / 5;
roll_victim = (victim->level +
get_curr_stat(victim, STAT_AGI) +
get_curr_stat(victim, STAT_DEX)) / 5;
/* consider hide skill - can hide without it but poorly */
int hide_skill = 50 + get_skill_total(victim, gsn_hide, 0.5);
if ( IS_AFFECTED(victim, AFF_SNEAK) )
hide_skill += get_skill_overflow(victim, gsn_sneak) / 2;
roll_victim = roll_victim * hide_skill / 100;
/* easier to hide in dark rooms */
if (room_is_dim(victim->in_room)
!IS_AFFECTED(ch, AFF_DARK_VISION)
(!IS_AFFECTED(ch, AFF_INFRARED) || IS_SET(victim->form,
FORM_COLD_BLOOD)))
switch ( light_status(victim) )
{
case LIGHT_DARK:
roll_victim *= 2;
break;
case LIGHT_NORMAL:
roll_victim *= 2;
break;
case LIGHT_GLOW:
roll_victim *= 2;
break;
case LIGHT_BRIGHT:
break;
default:
break;
}
/* small races can hide better */
roll_victim = roll_victim * (5 + SIZE_MEDIUM - victim->size) / 5;
/* detect_hidden */
if (IS_AFFECTED(ch, AFF_DETECT_HIDDEN))
roll_ch *= 2;
/* alertness skill */
roll_ch += roll_ch * get_skill_total(ch, gsn_alertness, 0.5) / 100;
check_improve(ch, gsn_alertness, TRUE, 15);
/* now the roll */
return number_range(0, roll_ch) > number_range(0, roll_victim * 5);
}
shroud of darkness affects light status but not whether it's bright or not, so
with current code it does nothing for you.
|