78 if (spell->type ==
SPELL 79 && (*params ==
'\0' || !strncmp(params, spell->name, strlen(params)))) {
81 snprintf(spell_sort[num_found++],
sizeof(spell_sort[0]),
82 "%s:%-30s %3s %3s", spell->skill ? spell->skill :
"generic",
83 spell->name,
"den",
"den");
85 snprintf(spell_sort[num_found++],
sizeof(spell_sort[0]),
86 "%s:%-30s %3d %3d", spell->skill ? spell->skill :
"generic",
87 spell->name, spell->level,
95 "You know no spells like '%s'.", params);
98 "You know no spells.");
105 "You know the following '%s' spells:", params);
108 "You know the following spells:");
115 qsort(spell_sort, num_found,
MAX_BUF, (
int (*)(
const void *,
const void *))strcmp);
116 strcpy(tmp,
"asdfg");
117 for (i = 0; i < num_found; i++) {
119 if (strncmp(tmp, spell_sort[i], strlen(tmp))) {
120 strcpy(tmp, spell_sort[i]);
121 cp = strchr(tmp,
':');
125 "\n[b][fixed]%s spells %.*s <lvl> <sp>",
126 tmp, (
int)(20-strlen(tmp)),
" ");
130 strchr(spell_sort[i],
':')+1);
153 tag_t spellnumber = 0;
154 if ((spellnumber = atoi(cpy)) != 0)
165 cp = strchr(cpy,
' ');
168 if (!strncmp(cp,
"of ", 3))
171 }
else if (strlen(cpy) > strlen(spob->
name)) {
172 cp = cpy+strlen(spob->
name);
175 if (!strncmp(cp,
"of ", 3))
182 "You need the skill %s to cast %s!",
215 "You ready the spell %s%s%s",
216 spob->
name, required ?
" which consumes for each invocation " :
"", required ? required :
"");
294 "No ranged attack chosen.");
299 "You regain control of your golem.");
305 "Switched to %s and %s.",
312 "Switched to spells (%s).",
326 "Switched to skill: %s",
344 int dir = ((*params ==
'\0') || (params[0] ==
'+')) ? 1 : -1;
395 if (*params ==
'\0') {
396 for (ix = 0; lookup[ix].shoottype !=
range_size; ix++) {
399 "shoottype is set to %s", lookup[ix].range);
408 for (ix = 0; lookup[ix].shoottype !=
range_size; ix++) {
409 if (!strcmp(params, lookup[ix].range)) {
416 "shoottype not readied: %s", lookup[ix].range);
425 "shoottype: Unknown shoottype option %s", params);
object * lookup_spell_by_name(object *op, const char *spname)
Look at object 'op' and see if they know the spell spname.
object * ranges[range_size]
Object for each range.
Spell-related defines: spellpath, subtypes, ...
#define MSG_TYPE_COMMAND_CONFIG
bowmode, petmode, applymode
void command_shoottype(object *op, const char *params)
'shoottype' command, set range attack.
Defines various flags that both the new client and new server use.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
int16_t SP_level_spellpoint_cost(object *caster, object *spell, int flags)
Scales the spellpoint cost of a spell by it's increased effectiveness.
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
#define MSG_TYPE_SKILL_MISSING
Don't have the skill.
void command_invoke(object *op, const char *params)
'invoke' command, fires a spell immediately.
object * chosen_skill
The skill chosen to use.
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
Minimum, exclusive, value.
#define NROFREALSPELLS
Number of spells.
rangetype shoottype
Which range-attack is being used by player.
object * spell
Spell that was being cast.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
object * object_find_by_tag(const object *who, tag_t tag)
Find object in inventory.
#define MSG_TYPE_COMMAND_SUCCESS
Successful result from command.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
void command_cast_spell(object *op, const char *params, int cast_now)
Sets up to cast a spell.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
uint32_t golem_count
To track the golem.
sstring race
Human, goblin, dragon, etc.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
char spellparam[MAX_BUF]
What param to add to spells.
Defines and structures related to commands the player can send.
uint32_t tag_t
Object tag, unique during the whole game.
uint32_t path_denied
Paths the object is denied access to.
#define MAX_BUF
Used for all kinds of things.
Skill-related defines, including subtypes.
int8_t facing
Object is oriented/facing that way.
void query_base_name(const object *op, int plural, char *buf, size_t size)
Query a short name for the item.
Maximum, exclusive, value.
int legal_range(object *op, int r)
Check for the validity of a player range.
sstring name
The name of the object, obviously...
uint8_t type
PLAYER, BULLET, etc.
rangetype
What range is currently selected by the player.
sstring skill
Name of the skill this object uses/grants.
static void send_updated_shoottype(object *op)
Sends the updated range attack to the client.
#define MSG_TYPE_SKILL
Messages related to skill use.
static void show_matching_spells(object *op, const char *params)
Shows all spells that op knows.
#define NDI_UNIQUE
Print immediately, don't buffer.
void command_rotateshoottype(object *op, const char *params)
'rotateshoottype' command, switch range attack.
void command_cast(object *op, const char *params)
'cast' command, prepares a spell for laster casting.
tag_t count
Unique object number for this object.
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level...
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.