/*
* This file is part of Deliantra, the Roguelike Realtime MMORPG.
*
* Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
* Copyright (©) 2005 Mark Wedel & Crossfire Development Team
* Copyright (©) 1992 Frank Tore Johansen
*
* Deliantra is free software: you can redistribute it and/or modify it under
* the terms of the Affero GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the Affero GNU General Public License
* and the GNU General Public License along with this program. If not, see
* .
*
* The authors can be reached via e-mail to
*/
#include
#ifndef __CEXTRACT__
# include
#endif
/* Note this code is very specialized for swamps, in terms of the messages
* as well as handling of move types.
*/
void
walk_on_deep_swamp (object *op, object *victim)
{
if (victim->type == PLAYER && victim->stats.hp >= 0 && !(victim->move_type & MOVE_FLYING))
{
new_draw_info_format (NDI_UNIQUE, 0, victim, "You are down to your knees in the %s.", &op->name);
op->stats.food = 1;
victim->speed_left -= op->move_slow_penalty;
}
}
void
move_deep_swamp (object *op)
{
object *above = op->above;
object *nabove;
while (above)
{
nabove = above->above;
if (above->type == PLAYER && !(above->move_type & MOVE_FLYING) && above->stats.hp >= 0 && !QUERY_FLAG (above, FLAG_WIZ))
{
if (op->stats.food < 1)
{
LOG (llevDebug, "move_deep_swamp(): player is here, but state is " "%d\n", op->stats.food);
op->stats.food = 1;
}
switch (op->stats.food)
{
case 1:
if (rndm (0, 2) == 0)
{
new_draw_info_format (NDI_UNIQUE, 0, above, "You are down to your waist in the wet %s.", &op->name);
op->stats.food = 2;
above->speed_left -= op->move_slow_penalty;
}
break;
case 2:
if (rndm (0, 2) == 0)
{
new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, above, "You are down to your NECK in the dangerous %s.", &op->name);
op->stats.food = 3;
above->contr->killer = op;
above->stats.hp--;
above->speed_left -= op->move_slow_penalty;
}
break;
case 3:
if (rndm (0, 4) == 0)
{
object *woodsman = find_obj_by_type_subtype (above, SKILL, SK_WOODSMAN);
/* player is ready to drown - only woodsman skill can save him */
if (!woodsman)
{
op->stats.food = 0;
new_draw_info_format (NDI_UNIQUE | NDI_ALL, 1, NULL, "%s disappeared into a %s.", &above->name, &op->name);
above->contr->killer = op;
above->stats.hp = -1;
kill_player (above); /* player dies in the swamp */
}
else
{
op->stats.food = 2;
new_draw_info_format (NDI_UNIQUE, 0, above,
"You almost drowned in the %s! You survived due to your woodsman skill.", &op->name);
}
}
break;
}
}
else if (!QUERY_FLAG (above, FLAG_ALIVE) && !(above->move_type & MOVE_FLYING) &&
!(QUERY_FLAG (above, FLAG_IS_FLOOR)) && !(QUERY_FLAG (above, FLAG_OVERLAY_FLOOR)) && !(QUERY_FLAG (above, FLAG_NO_PICK)))
{
if (rndm (0, 2) == 0)
above->decrease ();
}
above = nabove;
}
}