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

Comparing deliantra/server/server/skill_util.C (file contents):
Revision 1.9 by root, Sun Sep 10 15:59:57 2006 UTC vs.
Revision 1.13 by root, Sat Sep 16 22:24:13 2006 UTC

1
2/*
3 * static char *rcsid_skill_util_c =
4 * "$Id: skill_util.C,v 1.9 2006/09/10 15:59:57 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copryight (C) 2002 Mark Wedel & Crossfire Development Team 4 Copryight (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 The author can be reached via e-mail to crossfire-devel@real-time.com 21 The author can be reached via e-mail to <crossfire@schmorp.de>
28*/ 22*/
29 23
30/* Created July 95 to separate skill utilities from actual skills -b.t. */ 24/* Created July 95 to separate skill utilities from actual skills -b.t. */
31 25
32/* Reconfigured skills code to allow linking of skills to experience 26/* Reconfigured skills code to allow linking of skills to experience
42 */ 36 */
43 37
44/* define the following for skills utility debuging */ 38/* define the following for skills utility debuging */
45 39
46/* #define SKILL_UTIL_DEBUG */ 40/* #define SKILL_UTIL_DEBUG */
47
48#define WANT_UNARMED_SKILLS
49 41
50#include <global.h> 42#include <global.h>
51#include <object.h> 43#include <object.h>
52#ifndef __CEXTRACT__ 44#ifndef __CEXTRACT__
53# include <sproto.h> 45# include <sproto.h>
54#endif 46#endif
55#include <living.h> /* for defs of STR,CON,DEX,etc. -b.t. */ 47#include <living.h> /* for defs of STR,CON,DEX,etc. -b.t. */
56#include <spells.h> 48#include <spells.h>
57 49
50/* Table of unarmed attack skills. Terminated by -1. This
51 * is also the list that we should try to use skills when
52 * automatically applying one for the player.
53 * Note it is hardcoded in the skill_util.c that dragons always
54 * want clawing if possible.
55 */
56static uint8 unarmed_skills[] = {
57 SK_KARATE,
58 SK_CLAWING,
59 SK_FLAME_TOUCH,
60 SK_SPARK_TOUCH,
61 SK_SHIVER,
62 SK_ACID_SPLASH,
63 SK_POISON_NAIL,
64 SK_PUNCHING,
65 (uint8)-1
66};
67
58static int attack_hth (object *pl, int dir, const char *string, object *skill); 68static int attack_hth (object *pl, int dir, const char *string, object *skill);
59static int attack_melee_weapon (object *op, int dir, const char *string, object *skill); 69static int attack_melee_weapon (object *op, int dir, const char *string, object *skill);
60
61shstr skill_names[NUM_SKILLS];
62 70
63/* init_skills basically just sets up the skill_names table 71/* init_skills basically just sets up the skill_names table
64 * above. The index into the array is set up by the 72 * above. The index into the array is set up by the
65 * subtypes. 73 * subtypes.
66 */ 74 */
69{ 77{
70 int i; 78 int i;
71 archetype *at; 79 archetype *at;
72 80
73 for (at = first_archetype; at != NULL; at = at->next) 81 for (at = first_archetype; at != NULL; at = at->next)
74 {
75 if (at->clone.type == SKILL) 82 if (at->clone.type == SKILL)
76 { 83 {
77 if (skill_names[at->clone.subtype] != NULL) 84 if (skill_names[at->clone.subtype] != NULL)
78 {
79 LOG (llevError, "init_skills: multiple skill using same subtype %d, %s, %s\n", 85 LOG (llevError, "init_skills: multiple skill using same subtype %d, %s, %s\n",
80 at->clone.subtype, &skill_names[at->clone.subtype], &at->clone.skill); 86 at->clone.subtype, &skill_names[at->clone.subtype], &at->clone.skill);
81 }
82 else 87 else
83 {
84 skill_names[at->clone.subtype] = at->clone.skill; 88 skill_names[at->clone.subtype] = at->clone.skill;
85 }
86 } 89 }
87 }
88 90
89 /* This isn't really an error if there is no skill subtype set, but 91 /* This isn't really an error if there is no skill subtype set, but
90 * checking for this may catch some user errors. 92 * checking for this may catch some user errors.
91 */ 93 */
92 for (i = 1; i < NUM_SKILLS; i++) 94 for (i = 1; i < NUM_SKILLS; i++)
1068 1070
1069int 1071int
1070skill_attack (object *tmp, object *pl, int dir, const char *string, object *skill) 1072skill_attack (object *tmp, object *pl, int dir, const char *string, object *skill)
1071{ 1073{
1072 sint16 tx, ty; 1074 sint16 tx, ty;
1073 mapstruct *m; 1075 maptile *m;
1074 int mflags; 1076 int mflags;
1075 1077
1076 if (!dir) 1078 if (!dir)
1077 dir = pl->facing; 1079 dir = pl->facing;
1078 tx = freearr_x[dir]; 1080 tx = freearr_x[dir];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines