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