| 4146 | } |
| 4147 | |
| 4148 | void seen_monsters_react() |
| 4149 | { |
| 4150 | if (you.duration[DUR_TIME_STEP] || crawl_state.game_is_arena()) |
| 4151 | return; |
| 4152 | |
| 4153 | const int stealth = player_stealth(); |
| 4154 | |
| 4155 | #ifdef DEBUG_STEALTH |
| 4156 | // Too annoying for regular diagnostics. |
| 4157 | mprf(MSGCH_DIAGNOSTICS, "stealth: %d", stealth); |
| 4158 | #endif |
| 4159 | |
| 4160 | for (monster_near_iterator mi(you.pos()); mi; ++mi) |
| 4161 | { |
| 4162 | if ((mi->asleep() || mi->behaviour == BEH_WANDER) |
| 4163 | && check_awaken(*mi, stealth)) |
| 4164 | { |
| 4165 | behaviour_event(*mi, ME_ALERT, &you, you.pos(), false); |
| 4166 | |
| 4167 | // That might have caused a pacified monster to leave the level. |
| 4168 | if (!(*mi)->alive()) |
| 4169 | continue; |
| 4170 | |
| 4171 | if (!vampire_mesmerism_check(**mi)) |
| 4172 | monster_consider_shouting(**mi); |
| 4173 | } |
| 4174 | |
| 4175 | if (!mi->visible_to(&you)) |
| 4176 | continue; |
| 4177 | |
| 4178 | if (!mi->has_ench(ENCH_FRENZIED) && mi->can_see(you)) |
| 4179 | { |
| 4180 | // Trigger Duvessa & Dowan upgrades |
| 4181 | if (mi->props.exists(ELVEN_ENERGIZE_KEY)) |
| 4182 | { |
| 4183 | mi->props.erase(ELVEN_ENERGIZE_KEY); |
| 4184 | elven_twin_energize(*mi); |
| 4185 | } |
| 4186 | else if (mi->type == MONS_BORIS && player_has_orb() |
| 4187 | && !mi->props.exists(BORIS_ORB_KEY)) |
| 4188 | { |
| 4189 | mi->props[BORIS_ORB_KEY] = true; |
| 4190 | boris_covet_orb(*mi); |
| 4191 | } |
| 4192 | #if TAG_MAJOR_VERSION == 34 |
| 4193 | else if (mi->props.exists(OLD_DUVESSA_ENERGIZE_KEY)) |
| 4194 | { |
| 4195 | mi->props.erase(OLD_DUVESSA_ENERGIZE_KEY); |
| 4196 | elven_twin_energize(*mi); |
| 4197 | } |
| 4198 | else if (mi->props.exists(OLD_DOWAN_ENERGIZE_KEY)) |
| 4199 | { |
| 4200 | mi->props.erase(OLD_DOWAN_ENERGIZE_KEY); |
| 4201 | elven_twin_energize(*mi); |
| 4202 | } |
| 4203 | #endif |
| 4204 | } |
| 4205 | } |
no test coverage detected