/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Timothy C. Stoehr.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* special_hit.c
*
* This source herein may be modified and/or distributed by anybody who
* so desires, with the following restrictions:
* 1.) No portion of this notice shall be removed.
* 2.) Credit shall not be taken for the creation of this source.
* 3.) This code is not to be traded, sold, or used for personal
* gain or profit.
*
*/
if (freeze_percent > 10) {
monster->m_flags |= FREEZING_ROGUE;
messagef(1, "you are frozen");
n = get_rand(4, 8);
for (i = 0; i < n; i++) {
mv_mons();
}
if (rand_percent(freeze_percent)) {
for (i = 0; i < 50; i++) {
mv_mons();
}
killed_by(NULL, HYPOTHERMIA);
}
messagef(1, "%s", you_can_move_again);
monster->m_flags &= (~FREEZING_ROGUE);
}
}
void
steal_gold(object *monster)
{
int amount;
if ((rogue.gold <= 0) || rand_percent(10)) {
return;
}
for (n = 0; n <= 5; n++) {
for (i = -n; i <= n; i++) {
if (try_to_cough(row+n, col+i, obj)) {
return;
}
if (try_to_cough(row-n, col+i, obj)) {
return;
}
}
for (i = -n; i <= n; i++) {
if (try_to_cough(row+i, col-n, obj)) {
return;
}
if (try_to_cough(row+i, col+n, obj)) {
return;
}
}
}
free_object(obj);
}
if (rand_percent(60) || (rogue.hp_max <= 30) || (rogue.hp_current < 10)) {
return;
}
n = get_rand(1, 3); /* 1 Hp, 2 Str, 3 both */
if ((n != 2) || (!sustain_strength)) {
messagef(0, "you feel weaker");
}
if (n != 2) {
rogue.hp_max--;
rogue.hp_current--;
less_hp++;
}
if (n != 1) {
if ((rogue.str_current > 3) && (!sustain_strength)) {
rogue.str_current--;
if (coin_toss()) {
rogue.str_max--;
}
}
}
print_stats((STAT_STRENGTH | STAT_HP));
}
boolean
m_confuse(object *monster)
{
if (!rogue_can_see(monster->row, monster->col)) {
return(0);
}
if (rand_percent(45)) {
monster->m_flags &= (~CONFUSES); /* will not confuse the rogue */
return(0);
}
if (rand_percent(55)) {
monster->m_flags &= (~CONFUSES);
messagef(1, "the gaze of the %s has confused you",
mon_name(monster));
cnfs();
return(1);
}
return(0);
}
boolean
flame_broil(object *monster)
{
short row, col, dir;