clean up rogue_hit
This commit is contained in:
parent
b452c5e230
commit
4604ad4e4a
49
rogue/hit.c
49
rogue/hit.c
@ -114,42 +114,27 @@ mon_hit(object *monster)
|
||||
}
|
||||
|
||||
void
|
||||
rogue_hit(object *monster, boolean force_hit)
|
||||
{
|
||||
short damage, hit_chance;
|
||||
rogue_hit(object *monster, boolean force_hit){
|
||||
|
||||
if (monster) {
|
||||
if (check_imitator(monster)) {
|
||||
return;
|
||||
}
|
||||
hit_chance = force_hit ? 100 : get_hit_chance(rogue.weapon);
|
||||
if(check_imitator(monster))
|
||||
return;
|
||||
|
||||
if (wizard) {
|
||||
hit_chance *= 2;
|
||||
}
|
||||
if (!rand_percent(hit_chance)) {
|
||||
if (!fight_monster) {
|
||||
(void)strlcpy(hit_message, "you miss ",
|
||||
sizeof(hit_message));
|
||||
}
|
||||
goto RET;
|
||||
}
|
||||
damage = get_weapon_damage(rogue.weapon);
|
||||
if (wizard) {
|
||||
damage *= 3;
|
||||
}
|
||||
if (con_mon) {
|
||||
if(!rand_percent((force_hit ? 100 : get_hit_chance(rogue.weapon))
|
||||
* (1 + wizard) /* <- hit chance */) && !fight_monster){
|
||||
(void)strlcpy(hit_message, "you miss ", sizeof(hit_message));
|
||||
}else{
|
||||
if (con_mon)
|
||||
s_con_mon(monster);
|
||||
}
|
||||
if (mon_damage(monster, damage)) { /* still alive? */
|
||||
if (!fight_monster) {
|
||||
(void)strlcpy(hit_message, "you hit ",
|
||||
sizeof(hit_message));
|
||||
}
|
||||
}
|
||||
RET: check_gold_seeker(monster);
|
||||
wake_up(monster);
|
||||
|
||||
if(mon_damage(monster, get_weapon_damage(rogue.weapon)
|
||||
* (1 + 2 * wizard) /* <- damage */)
|
||||
&& !fight_monster) /* still alive? */
|
||||
(void)strlcpy(hit_message, "you hit ",
|
||||
sizeof(hit_message));
|
||||
}
|
||||
|
||||
check_gold_seeker(monster);
|
||||
wake_up(monster);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -98,9 +98,13 @@ one_move_rogue(short dirch, short pickup)
|
||||
}
|
||||
}
|
||||
if (dungeon[row][col] & MONSTER) {
|
||||
rogue_hit(object_at(&level_monsters, row, col), 0);
|
||||
object *monster;
|
||||
|
||||
if((monster = object_at(&level_monsters, row, col)) != NULL)
|
||||
rogue_hit(monster, 0);
|
||||
(void)reg_move();
|
||||
return(MOVE_FAILED);
|
||||
|
||||
return MOVE_FAILED;
|
||||
}
|
||||
if (dungeon[row][col] & DOOR) {
|
||||
if (cur_room == PASSAGE) {
|
||||
|
@ -178,7 +178,8 @@ zap_monster(object *monster, unsigned short kind)
|
||||
}
|
||||
break;
|
||||
case MAGIC_MISSILE:
|
||||
rogue_hit(monster, 1);
|
||||
if(monster != NULL)
|
||||
rogue_hit(monster, 1);
|
||||
break;
|
||||
case CANCELLATION:
|
||||
if (monster->m_flags & HOLDS) {
|
||||
|
Loading…
Reference in New Issue
Block a user