ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/attack.C
(Generate patch)

Comparing deliantra/server/server/attack.C (file contents):
Revision 1.143 by root, Sat Apr 23 04:56:54 2011 UTC vs.
Revision 1.148 by root, Mon Oct 29 23:55:55 2012 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25#include <assert.h> 25#include <assert.h>
26#include <global.h> 26#include <global.h>
27#include <living.h> 27#include <living.h>
28#include <material.h> 28#include <material.h>
29#include <skills.h> 29#include <skills.h>
30#include <sounds.h> 30#include <sounds.h>
31#include <sproto.h> 31#include <sproto.h>
32
33typedef struct att_msg_str
34{
35 char *msg1;
36 char *msg2;
37} att_msg;
38 32
39/*#define ATTACK_DEBUG*/ 33/*#define ATTACK_DEBUG*/
40 34
41/* did_make_save_item just checks to make sure the item actually 35/* did_make_save_item just checks to make sure the item actually
42 * made its saving throw based on the tables. It does not take 36 * made its saving throw based on the tables. It does not take
254 * returns 1 if it hits something, 0 otherwise. 248 * returns 1 if it hits something, 0 otherwise.
255 */ 249 */
256int 250int
257hit_map (object *op, int dir, uint32_t type, int full_hit) 251hit_map (object *op, int dir, uint32_t type, int full_hit)
258{ 252{
259 maptile *map;
260 sint16 x, y; 253 sint16 x, y;
261 int retflag = 0; /* added this flag.. will return 1 if it hits a monster */ 254 int retflag = 0; /* added this flag.. will return 1 if it hits a monster */
262 255
263 if (op->flag [FLAG_FREED]) 256 if (op->flag [FLAG_FREED])
264 { 257 {
364 if (op->destroyed ()) 357 if (op->destroyed ())
365 break; 358 break;
366 } 359 }
367 } 360 }
368 361
369 return 0; 362 return retflag;
370} 363}
371 364
372static void 365static void
373attack_message (int dam, int type, object *op, object *hitter) 366attack_message (int dam, int type, object *op, object *hitter)
374{ 367{
1158 * MSW 2002-07-17 1151 * MSW 2002-07-17
1159 */ 1152 */
1160int 1153int
1161kill_object (object *op, int dam, object *hitter, int type) 1154kill_object (object *op, int dam, object *hitter, int type)
1162{ 1155{
1163 char buf[MAX_BUF];
1164 shstr skill; 1156 shstr skill;
1165 int maxdam = 0; 1157 int maxdam = 0;
1166 int battleg = 0; /* true if op standing on battleground */ 1158 int battleg = 0; /* true if op standing on battleground */
1167 int pk = 0; /* true if op and what controls hitter are both players */ 1159 int pk = 0; /* true if op and what controls hitter are both players */
1168 object *owner = 0; 1160 object *owner = 0;
1434int 1426int
1435hit_player (object *op, int dam, object *hitter, uint32_t type, int full_hit) 1427hit_player (object *op, int dam, object *hitter, uint32_t type, int full_hit)
1436{ 1428{
1437 int magic = type & AT_MAGIC; 1429 int magic = type & AT_MAGIC;
1438 int body_attack = op && op->head; /* Did we hit op's head? */ 1430 int body_attack = op && op->head; /* Did we hit op's head? */
1439 int maxdam = 0, ndam = 0, attacktype = 1; 1431 int maxdam = 0, ndam = 0;
1440 int maxattacktype; 1432 int maxattacktype;
1441 int simple_attack; 1433 int simple_attack;
1442 int rtn_kill = 0; 1434 int rtn_kill = 0;
1443 int friendlyfire; 1435 int friendlyfire;
1444 1436
1813 int maxduration; 1805 int maxduration;
1814 1806
1815 tmp = present_in_ob_by_name (FORCE, shstr_confusion, op); 1807 tmp = present_in_ob_by_name (FORCE, shstr_confusion, op);
1816 if (!tmp) 1808 if (!tmp)
1817 { 1809 {
1818 tmp = get_archetype (FORCE_NAME); 1810 tmp = archetype::get (FORCE_NAME);
1819 tmp = insert_ob_in_ob (tmp, op); 1811 tmp = insert_ob_in_ob (tmp, op);
1820 } 1812 }
1821 1813
1822 /* Duration added per hit and max. duration of confusion both depend 1814 /* Duration added per hit and max. duration of confusion both depend
1823 * on the player's resistance 1815 * on the player's resistance
1845 return; 1837 return;
1846 1838
1847 object *tmp = present_in_ob (BLINDNESS, op); 1839 object *tmp = present_in_ob (BLINDNESS, op);
1848 if (!tmp) 1840 if (!tmp)
1849 { 1841 {
1850 tmp = get_archetype (shstr_blindness); 1842 tmp = archetype::get (shstr_blindness);
1851 tmp->set_flag (FLAG_BLIND); 1843 tmp->set_flag (FLAG_BLIND);
1852 tmp->set_flag (FLAG_APPLIED); 1844 tmp->set_flag (FLAG_APPLIED);
1853 // use floats so we don't lose too much precision due to rounding errors. 1845 // use floats so we don't lose too much precision due to rounding errors.
1854 tmp->set_speed (lerp<float> (op->resist [ATNR_BLIND], 0, 100, tmp->speed, MIN_ACTIVE_SPEED)); 1846 tmp->set_speed (lerp<float> (op->resist [ATNR_BLIND], 0, 100, tmp->speed, MIN_ACTIVE_SPEED));
1855 1847

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines