 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
20 #define _GNU_SOURCE // strcasestr() is a GNU extension in string.h
84 int recharge(
object *op,
object *caster,
object *spell_ob) {
90 if (wand == NULL || wand->
type !=
WAND) {
92 "You need to mark the wand you want to recharge.");
98 "The %s vibrates violently, then explodes!",
120 "Your %s is broken.",
130 "The %s glows with power.",
165 object *owner, *replacing;
179 std::vector<std::pair<archetype *, int>> candidates;
185 candidates.push_back(std::make_pair(at, pos));
189 if (candidates.empty()) {
195 choice =
rndm(0, candidates.size() - 1);
196 auto at = candidates[choice].first;
197 int pos = candidates[choice].second;
206 if (tmp->type ==
SPELL) {
259 "The %s glow red, melt and evaporate!",
263 "The %s glows red, melts and evaporates!",
282 int max_value, difficulty, tries = 0, choice, charges = op->
stats.
food;
288 max_value = op->
value*2;
289 if (max_value > 2000*(
level/10))
290 max_value = 2000*(
level/10)+(max_value-2000*(
level/10))/3;
292 std::vector<archetype *> candidates;
305 candidates.push_back(at);
308 if (candidates.empty())
311 difficulty = op->
magic*5;
316 choice =
rndm(0, candidates.size() - 1);
317 at = candidates[choice];
322 }
while (new_ob->
value > max_value && tries < 10);
324 LOG(
llevError,
"polymorph_item: fix_generated_object made %s invisible?!\n", new_ob->
name);
339 if (new_ob->
nrof > 2)
427 int range, mflags, maxrange,
level;
435 for (range = 1; range < maxrange; range++) {
494 int missile_plus = 0, bonus_plus = 0;
495 const char *missile_name;
496 object *tmp, *missile;
500 missile_name = tmp != NULL ? tmp->
race :
"arrow";
504 if (!strcmp(missile_name,
"arrows"))
505 missile_name =
"arrow";
506 else if (!strcmp(missile_name,
"crossbow bolts"))
507 missile_name =
"bolt";
510 if ( stringarg && strncmp(stringarg,
"of ",3)==0 ) stringarg +=3;
511 if ( stringarg && strncmp(stringarg,
"bolt",4)==0 ) {
512 missile_name =
"bolt";
514 while ( isalpha(*stringarg) ) ++stringarg;
515 while ( *stringarg==
' ' ) ++stringarg;
517 if ( stringarg && strncmp(stringarg,
"arrow",5)==0 ) {
518 missile_name =
"arrow";
520 while ( isalpha(*stringarg) ) ++stringarg;
521 while ( *stringarg==
' ' ) ++stringarg;
525 LOG(
llevDebug,
"Cast create_missile: could not find archetype %s\n", missile_name);
530 if ( stringarg && strncmp(stringarg,
"of ",3)==0 ) stringarg +=3;
533 if (isalpha(*stringarg)) {
535 auto ial = std::find_if(items.cbegin(), items.cend(), [&] (
const auto al) { return !strcasecmp(al->item->name, stringarg); });
536 if (ial == items.cend()) {
539 "No such object %ss of %s",
540 missile_name, stringarg);
547 "You are not allowed to create %ss of %s",
548 missile_name, stringarg);
558 }
else if (atoi(stringarg) < missile_plus)
559 missile_plus = atoi(stringarg);
561 if (missile_plus > 4)
563 else if (missile_plus < -4)
567 if (missile->
nrof <= (uint32_t)3 * (missile_plus + bonus_plus)) {
570 "This item is too powerful for you to create!");
573 missile->
nrof -= 3*(missile_plus+bonus_plus);
574 if (missile->
nrof < 1)
577 missile->
magic = missile_plus;
582 tag = missile->
count;
627 int cast_create_food(
object *op,
object *caster,
object *spell_ob,
int dir,
const char *stringarg) {
660 "You don't have enough experience to create any food.");
667 new_op->
nrof = food_value;
670 if (new_op->
nrof < 1)
699 int probe(
object *op,
object *caster,
object *spell_ob,
int dir,
int level) {
700 int r, mflags, maxrange;
708 for (r = 1; r < maxrange; r++) {
719 "Something blocks your magic.");
726 "You detect something.");
734 "You detect nothing.");
806 "You can not extend the duration of your invisibility any further");
832 "You can't see your hands!");
835 "You feel more transparent!");
856 int range, i, j, mflags;
865 for (i = -range; i < range; i++)
866 for (j = -range; j < range; j++) {
915 "You feel a force starting to build up inside you.");
922 "Oops, program error!");
923 LOG(
llevError,
"cast_word_of_recall: create_archetype(force) failed!\n");
934 dummy->
speed = 0.002;
949 "You feel a force starting to build up inside you.");
968 int cast_wonder(
object *op,
object *caster,
int dir,
object *spell_ob) {
972 return cast_cone(op, caster, dir, spell_ob);
977 LOG(
llevError,
"cast_wonder: Unable to get a spell!\n");
981 LOG(
llevError,
"cast_wonder: spell returned is not a spell (%d, %s)!\n", newspell->
type, newspell->
name);
986 LOG(
llevError,
"cast_wonder: spell returned is another wonder spell!\n");
989 return cast_spell(op, caster, dir, newspell, NULL);
1020 "You worship no god");
1026 if (*cp ==
'\0' && tmp == NULL)
1028 "You feel very mundane");
1038 "Your %s is depleted by %d",
1048 "You glow in the dark.");
1051 for (tmp = op->
inv; tmp; tmp = tmp->
below) {
1053 if (immunity == NULL) {
1060 if (tmp->
level > 100)
1062 else if (tmp->
level > 70)
1064 else if (tmp->
level > 20)
1069 if (immunity != NULL) {
1083 snprintf(
buf,
sizeof(
buf),
"Your metabolism isn't focused on anything.");
1111 object *dummy, *force;
1117 if (dummy == NULL) {
1119 "Oops, program error!");
1120 LOG(
llevError,
"object_new failed (force in cast_create_town_portal for %s!\n", op->
name);
1125 if (force == NULL) {
1138 "You fix this place in your mind and feel that you "
1139 "can come here from anywhere.");
1152 if (dummy == NULL) {
1154 "Oops, program error!");
1155 LOG(
llevError,
"object_new failed (force) in cast_create_town_portal for %s!\n", op->
name);
1160 if (perm_portal == NULL) {
1162 "Oops, program error!");
1174 int16_t exitx =
EXIT_X(old_force);
1175 int16_t exity =
EXIT_Y(old_force);
1176 LOG(
llevDebug,
"Trying to kill a portal in %s (%d,%d)\n", old_force->
race, exitx, exity);
1187 if (tmp->
name == old_force->
name) {
1199 if (tmp->
name == old_force->
name) {
1242 object *dummy, *force, *tmp;
1243 char portal_name [2 *
HUGE_BUF], portal_message [1024];
1254 "You can't cast that here.");
1262 "You need to exit the transport to cast that.");
1267 if (force == NULL) {
1307 if (exitmap == NULL) {
1309 "Something strange happens. You can't remember where to go!?");
1316 "The spell effect has expired.");
1325 snprintf(portal_message, 1024,
"The air moves around you and a huge smell of ammonia surrounds you as you pass through %s's tiny portal. Pouah!", op->
name);
1326 else if (op_level < 30)
1327 snprintf(portal_message, 1024,
"%s's portal smells of ozone. You do a lot of movements and finally pass through the small hole in the air.", op->
name);
1328 else if (op_level < 60)
1329 snprintf(portal_message, 1024,
"A shining door opens in the air in front of you, showing you the path to another place.");
1331 snprintf(portal_message, 1024,
"As you walk through %s's portal, flowers come out from the ground around you. You feel awed.", op->
name);
1338 snprintf(portal_name,
sizeof(portal_name),
"%s's portal to %s", op->
name, force->
name);
1340 if (dummy == NULL) {
1342 "Oops, program error!");
1343 LOG(
llevError,
"object_new failed (perm_magic_portal) in cast_create_town_portal for %s!\n", op->
name);
1371 "Oops, program error!");
1372 LOG(
llevError,
"object_new failed (force) in cast_create_town_portal for %s!\n", op->
name);
1387 snprintf(portal_name,
sizeof(portal_name),
"%s's portal to %s", op->
name, op->
map->
path);
1389 if (dummy == NULL) {
1391 "Oops, program error!");
1392 LOG(
llevError,
"object_new failed (perm_magic_portal) in cast_create_town_portal for %s!\n", op->
name);
1419 "Oops, program error!");
1420 LOG(
llevError,
"object_new failed (force) in cast_create_town_portal for %s!\n", op->
name);
1432 "You see air moving and showing you the way home.");
1456 int magic_wall(
object *op,
object *caster,
int dir,
object *spell_ob) {
1458 int i, posblocked, negblocked, maxrange;
1478 "Something is in the way.");
1483 }
else if (spell_ob->
race) {
1486 snprintf(buf1,
sizeof(buf1), spell_ob->
race, dir);
1489 LOG(
llevError,
"summon_wall: Unable to find archetype %s\n", buf1);
1491 "This spell is broken.");
1532 "Something destroys your %s",
1550 for (i = 1; i <= maxrange; i++) {
1553 dir2 = (dir < 4) ? (dir+2) : dir-2;
1610 uint32_t dist, maxdist;
1620 "In what direction?");
1632 "You can't dimension door that far!");
1636 for (dist = 0; dist < op->
contr->
count; dist++) {
1650 if (dist < op->contr->count) {
1652 "Something blocks the magic of the spell.");
1670 "You cast your spell, but nothing happens.");
1679 for (dist = 0; dist < maxdist; dist++) {
1696 for (; dist > 0; dist--) {
1705 "Your spell failed!");
1714 "Your spell failed!");
1751 int heal = 0, success = 0;
1761 heal =
spell->stats.dam;
1762 if (
spell->stats.hp)
1768 "You are already fully healed.");
1780 "You feel just fine!");
1781 }
else if (heal > 50) {
1783 "Your wounds close!");
1784 }
else if (heal > 25) {
1786 "Your wounds mostly close.");
1787 }
else if (heal > 10) {
1789 "Your wounds start to fade.");
1792 "Your wounds start to close.");
1808 "Your body feels cleansed");
1818 "Your mind feels clearer");
1829 "Your vision begins to return.");
1840 "Magical energies surge through your body!");
1848 "You feel redeemed with you god!");
1857 "You feel your belly fill with food");
1860 if (
spell->other_arch != NULL && target->
map != NULL) {
1874 "You grow no stronger.",
1875 "You grow no more agile.",
1876 "You don't feel any healthier.",
1878 "You are no easier to look at.",
1904 object *force = NULL;
1920 if (tmp2->name == spell_ob->
name) {
1923 }
else if (spell_ob->
race && spell_ob->
race == tmp2->name) {
1926 "You can not cast %s while %s is in effect",
1927 spell_ob->
name, tmp2->name_pl);
1932 if (force == NULL) {
1949 "You recast the spell while in effect.");
1957 "Recasting the spell had no effect.");
1970 if (spell_ob->
resist[i]) {
1972 if (force->
resist[i] > 100)
1986 for (k = 0; k < stat; k++)
2012 if (op->
speed > 0.5)
2050 int cast_bless(
object *op,
object *caster,
object *spell_ob,
int dir) {
2053 object *force = NULL, *tmp;
2065 if (tmp2->name == spell_ob->
name) {
2068 }
else if (spell_ob->
race && spell_ob->
race == tmp2->name) {
2070 "You can not cast %s while %s is in effect",
2071 spell_ob->
name, tmp2->name_pl);
2076 if (force == NULL) {
2093 "You recast the spell while in effect.");
2096 "Recasting the spell had no effect.");
2106 "Your blessing seems empty.");
2111 if (god->
resist[i] > 0) {
2133 "You are blessed by %s!",
2145 if (spell_ob->
other_arch != NULL && tmp->map != NULL) {
2175 #define SMALL_NUGGET "smallnugget"
2176 #define LARGE_NUGGET "largenugget"
2198 uint64_t small_value, large_value;
2209 if (small_nugget_arch == NULL) {
2214 if (large_nugget_arch == NULL) {
2229 assert(large_value != 0 && small_value != 0);
2230 count = value/large_value;
2231 *large_nuggets +=
count;
2232 value -= (uint64_t)
count*large_value;
2233 count = value/small_value;
2234 *small_nuggets +=
count;
2241 if (*small_nuggets*small_value >= large_value) {
2242 assert(small_value != 0);
2244 *small_nuggets -= large_value/small_value;
2245 if (*small_nuggets && large_value%small_value)
2277 if (x == op->
x && y == op->
y && op->
map ==
m)
2280 if (small_nuggets) {
2282 tmp-> nrof = small_nuggets;
2285 if (large_nuggets) {
2287 tmp-> nrof = large_nuggets;
2306 int alchemy(
object *op,
object *caster,
object *spell_ob) {
2307 int x, y,
weight = 0, weight_max, large_nuggets, small_nuggets, mflags;
2328 if (value_adj > 0.40)
2331 for (y = op->
y-1; y <= op->y+1; y++) {
2332 for (x = op->
x-1; x <= op->x+1; x++) {
2369 if (
weight > weight_max) {
2407 int success = 0, was_one = 0;
2431 "You feel like some of your items are looser now.");
2435 "You failed to remove the curse.");
2438 "You are not using any cursed items.");
2460 "You need to mark an item first!");
2467 "The spell has no effect");
2474 "Your %s emits a dark light for a few seconds.",
name);
2483 "Your %s glows blue for a few seconds.",
name);
2506 int success = 0, num_ident;
2523 "The item has a story:\n%s",
2543 "On the ground is %s.",
2547 "The item has a story:\n%s",
2561 "You can't reach anything unidentified.");
2581 object *tmp, *last, *detect;
2584 int16_t x, y, nx, ny;
2596 for (x = op->
x-range; x <= op->x+range; x++)
2597 for (y = op->
y-range; y <= op->y+range; y++) {
2658 if (spell_detect_magic
2700 int dx = nx, dy = ny;
2703 if (done_one == 2 && detect) {
2713 dx =
HEAD(detect)->x;
2714 dy =
HEAD(detect)->y;
2717 for (part = detect_ob; part != NULL; part = part->
more) {
2721 part->
type =
spell->other_arch->clone.type;
2722 for (flag = 0; flag < 4; flag++) {
2723 part->
flags[flag] =
spell->other_arch->clone.flags[flag];
2727 part->
speed =
spell->other_arch->clone.speed;
2756 if (spell_detect_magic
2791 "You feel energy course through you.");
2797 "Your head explodes!");
2807 "You feel like your head is going to explode.");
2810 "You get a splitting headache!");
2813 "Chaos fills your world.");
2817 "You start hearing voices.");
2839 object *plyr = NULL;
2869 "There is no one there.");
2874 if (
spell->stats.dam > 0) {
2879 }
else if (op != plyr) {
2887 sucked = (plyr->
stats.
sp*rate)/100;
2891 sucked = (sucked*rate)/100;
2949 }
else switch (head->
type) {
2961 if (
rndm(0, 149) == 0) {
2993 "You can't consecrate anything if you don't worship a god!");
3003 "You are not powerful enough to reconsecrate the %s",
3020 "You fail to consecrate the altar.");
3025 new_altar->
level = tmp->level;
3031 "You consecrated the altar to %s!",
3038 "You are not standing over an altar!");
3066 object *weapon, *tmp;
3073 if (!
spell->other_arch) {
3075 "Oops, program error!");
3076 LOG(
llevError,
"animate_weapon failed: spell %s missing other_arch!\n",
spell->name);
3095 "There is something in the way.");
3109 "There is something in the way.");
3118 "You must mark a weapon to use with this spell!");
3123 "The spell fails to transform your weapon.");
3128 "You need to mark a weapon to animate it.");
3133 "You need to pay for the weapon to animate it.");
3141 "You need to unequip %s before using it in this spell",
3146 if (weapon->
nrof > 1) {
3252 if (tmp->
speed > 3.33)
3256 snprintf(
buf,
sizeof(
buf),
"animated %s", weapon->
name);
3303 if (
spell->stats.dam < 0)
3305 "It can be no brighter here.");
3308 "It can be no darker here.");
3363 if (
spell->resist[i]) {
3392 "You recast the spell while in effect.");
3417 if (!msg || msg[0] == 0) {
3425 "Trying to cheat are we?");
3426 LOG(
llevInfo,
"write_rune: player %s tried to write bogus rune %s\n", op->
name, msg);
3430 if (!
spell->other_arch)
int SP_level_range_adjust(const object *caster, const object *spob)
Adjust the range of the spell based on level.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
#define MSG_TYPE_SPELL_PERCEIVE_SELF
Perceive self messages.
sstring name_pl
The plural name of the object.
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
#define FORCE_CHANGE_ABILITY
int16_t bed_y
x,y - coordinates of respawn (savebed).
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
#define UP_OBJ_FACE
Only thing that changed was the face.
int write_mark(object *op, object *spell, const char *msg)
This writes a rune that contains the appropriate message.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
Utility function to assign the correct skill when casting.
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Find object in inventory.
int cast_polymorph(object *op, object *caster, object *spell_ob, int dir)
Polymorph spell casting.
struct Settings settings
Global settings.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be friendly
static void place_alchemy_objects(object *op, mapstruct *m, int small_nuggets, int large_nuggets, int x, int y)
Place gold nuggets on the map.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
int cast_change_ability(object *op, object *caster, object *spell_ob, int dir, int silent)
Cast some stat-improving spell.
int remove_curse(object *op, object *caster, object *spell)
This function removes the cursed/damned status on equipped items.
int16_t maxhp
Max hit points.
object * object_find_by_type_applied(const object *who, int type)
Find applied object in inventory.
uint32_t weapontype
Type of weapon.
static bool CAN_PROBE(const object *ob)
Determine whether the given object can have an HP bar.
uint8_t map_layer
What level to draw this on the map.
#define GET_MAP_TOP(M, X, Y)
Gets the top object on a map.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
uint16_t difficulty
What level the player should be to play here.
uint32_t path_attuned
Paths the object is attuned to.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FLAG_UNDEAD
Monster is undead.
archetype * find_archetype_by_object_type_name(int type, const char *name)
This function retrieves an archetype by type and name that appears during the game.
#define FLAG_GENERATOR
Will generate type ob->stats.food.
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
object * inv
Pointer to the first object in the inventory.
uint16_t look_position
Start of drawing of look window.
uint32_t golem_count
To track the golem.
int perceive_self(object *op)
Living thing wants to know information.
#define FLAG_STARTEQUIP
Object was given to player at start.
mapstruct * ready_map_name(const char *name, int flags)
Makes sure the given map is loaded and swapped in.
#define QUERY_FLAG(xyz, p)
int makes_invisible_to(object *pl, object *mon)
This checks to see if 'pl' is invisible to 'mon'.
void archetypes_for_each(arch_op op)
int magic_wall(object *op, object *caster, int dir, object *spell_ob)
This creates magic walls.
int cast_change_map_lightlevel(object *op, object *spell)
This changes the light level for the entire map.
#define ARCH_DEPLETION
Archetype for depletion.
object * map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at)
Searches for any objects with a matching archetype at the given map and coordinates.
void confuse_living(object *op, object *hitter, int dam)
Confuse a living thing.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
bool pick_up(object *op, object *alt)
Try to pick up an item.
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
struct archetype * arch
Pointer to archetype.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
uint16_t attack_movement
What kind of attack movement.
#define FLAG_IS_BUILDABLE
Can build on item.
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
wonder is really just a spell that will likely cast another spell.
#define FOR_BELOW_PREPARE(op_, it_)
Constructs a loop iterating over all objects below an object.
int8_t range
Range of the spell.
float speed
Frequency of object 'moves' relative to server tick rate.
std::vector< artifact * > items
Artifacts for this type.
static int food_value_choice
int16_t invisible
How much longer the object will be invis.
object * transport
Transport the player is in.
float speed_left
How much speed is left to spend this round.
void give_artifact_abilities(object *op, const object *artifact)
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-...
struct mapstruct * map
Pointer to the map in which this object is present.
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(),...
object * arch_present_in_ob(const archetype *at, const object *op)
Searches for any objects with a matching archetype in the inventory of the given object.
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
object * generate_treasure(treasurelist *t, int difficulty)
Generate a treasure from a list generating a single item.
object * item
Special values of the artifact.
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
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 fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
fix_generated_item(): This is called after an item is generated, in order to set it up right.
int cast_consecrate(object *op, object *caster, object *spell)
A spell to make an altar your god's.
#define MSG_TYPE_VICTIM_SPELL
Someone cast a bad spell on the player.
int SP_level_duration_adjust(const object *caster, const object *spob)
Adjust the duration of the spell based on level.
int8_t direction
Means the object is moving that way.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
int dimension_door(object *op, object *caster, object *spob, int dir)
Teleport through some doors and space.
tag_t count
Unique object number for this object.
#define FLAG_WIZCAST
The wizard can cast spells in no-magic area.
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
#define MAP_PLAYER_UNIQUE
This map is player-specific.
char savebed_map[MAX_BUF]
Map where player will respawn after death.
#define tolower(C)
Simple macro to convert a letter to lowercase.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
#define FLAG_BLESSED
Item has a blessing, opposite of cursed/damned.
static void polymorph_melt(object *who, object *op)
Destroys item from polymorph failure.
#define P_NO_MAGIC
Spells (some) can't pass this object.
@ TRANSPORT
see doc/Developers/objects
uint32_t hidden
If True, player (DM) is hidden from view.
static archetype * food_choice
int rndm(int min, int max)
Returns a number between min and max.
#define FLAG_BLOCKSVIEW
Object blocks view.
@ range_golem
Control golem.
int apply_manual(object *op, object *tmp, int aflag)
Main apply handler.
#define FOR_OB_AND_ABOVE_FINISH()
Finishes FOR_OB_AND_ABOVE_PREPARE().
char path[HUGE_BUF]
Filename of the map.
static const char *const no_gain_msgs[NUM_STATS]
This is used for the spells that gain stats.
#define P_IS_ALIVE
Something alive is on this space.
#define FLAG_APPLIED
Object is ready for use by living.
int16_t level
Level of creature or object.
int probe(object *op, object *caster, object *spell_ob, int dir, int level)
Try to get information about a living thing.
AssetsManager * getManager()
materialtype_t * name_to_material(const char *name)
Convert materialname to materialtype_t.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
object * above
Pointer to the object stacked above this one.
#define HUGE_BUF
Used for messages - some can be quite long.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define FLAG_NO_PICK
Object can't be picked up.
#define MSG_TYPE_SPELL_TARGET
Target of non attack spell.
#define MSG_TYPE_SPELL_HEAL
Healing related spells.
const object * find_god(const char *name)
Returns a god's object from its name.
Plugin animator file specs[Config] name
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
#define FOR_BELOW_FINISH()
Finishes FOR_BELOW_PREPARE().
#define FLAG_ALIVE
Object can fight (or be fought)
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
static void food_each(archetype *arch)
#define MSG_TYPE_SPELL_SUCCESS
Spell succeeded messages.
#define FOR_OB_AND_ABOVE_PREPARE(op_)
Constructs a loop iterating over an object and all objects above it in the same pile.
void store_spell_expiry(object *spell)
Stores in the spell when to warn player of expiration.
void spell_effect(object *spob, int x, int y, mapstruct *map, object *originator)
Inserts into map a spell effect based on other_arch.
int16_t y
Position in the map for this object.
static event_registration m
void polymorph(object *op, object *who, int level)
Handles polymorphing an object, living or not.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
void object_update(object *op, int action)
object_update() updates the array which represents the map.
struct player * contr
Pointer to the player which control this object.
int cast_invisible(object *op, object *caster, object *spell_ob)
Makes the player or character invisible.
#define FLAG_TEAR_DOWN
at->faces[hp*animations/maxhp] at hit
static void charge_mana_effect(object *victim, int caster_level)
Checks if victim has overcharged mana, and if so does some fireball.
uint8_t subtype
Subtype of object.
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
const char * determine_god(object *op)
Determines if op worships a god.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
uint8_t anim_speed
Ticks between animation-frames.
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Searches for any objects with a matching type & name variable in the inventory of the given object.
static void alchemy_object(float value_adj, object *obj, int *small_nuggets, int *large_nuggets, int *weight)
Compute how many nuggets an object is worth, and remove it.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
int cast_word_of_recall(object *op, object *caster, object *spell_ob)
Word of recall causes the player to return 'home'.
#define FLAG_KNOWN_BLESSED
Item is known to be blessed.
#define MOVE_WALK
Object walks.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
int64_t * levels
Number of levels for which we have experience.
object * ranges[range_size]
Object for each range.
#define EXPLODING_FIREBALL
This is used for fumbles - this arch is all set up to do the right just by inserting it.
object clone
An object from which to do object_copy()
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler si Thief st Viking ba Warrior or Wizard C Wraith C Class Prof Str Dex Con Wis Cha Int Pow Net Skills Enclosed are codes used for the skills above The ones in and fighting should all be pretty self explanatory For the other a brief description is for a more detailed look at the skills doc file Skill remove use magic items phys no fire cold Fireborns are supposed to be fire spirits They re closely in tune with magic and are powerful and learn magic easily Being fire they are immune to fire and poison
void examine_monster(object *op, object *tmp, int level)
Player examine a monster.
uint64_t price_base(const object *obj)
Price an item based on its value or archetype value, type, identification/BUC status,...
sstring add_string(const char *str)
This will add 'str' to the hash table.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
#define HEAD(op)
Returns the head part of an object.
object * below
Pointer to the object stacked below this one.
int change_map_light(mapstruct *m, int change)
Used to change map light level (darkness) up or down.
MoveType move_type
Type of movement this object uses.
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW).
#define MSG_TYPE_ITEM
Item related information.
const Face * face
Face with colors.
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item.
int32_t value
How much money it is worth (or contains)
int is_identified(const object *op)
Return true if the item is identified, either because it is of a type that doesn't ever need identifi...
char * ob_describe(const object *op, const object *observer, int use_media_tags, char *buf, size_t size)
Returns the description of an object, as seen by the given observer.
void object_update_speed(object *op)
Updates the speed of an object.
uint8_t last_anim
Last sequence used to draw face.
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
static void polymorph_living(object *op, int level)
Takes a living object (op) and turns it into another monster of some sort.
uint32_t tmp_invis
Will invis go away when we attack?
int animate_weapon(object *op, object *caster, object *spell, int dir)
Generalization of staff_to_snake().
uint8_t type
PLAYER, BULLET, etc.
#define INS_NO_MERGE
Don't try to merge with other items.
#define FLAG_DAMNED
The object is very cursed.
int16_t dam
How much damage this object does when hitting.
int8_t magic
Any magical bonuses to this item.
sstring materialname
Specific material name.
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
with a maximum of six This is not so if you are wearing plate you receive no benefit Armour is additive with all the supplementry forms of which means that it lasts until the next semi permanent spell effect is cast upon the character spell
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
int32_t food
How much food in stomach.
int caster_level(const object *caster, const object *spell)
This function returns the effective level the spell is being cast at.
int cast_detection(object *op, object *caster, object *spell)
Detect magic or invisible items.
int cast_create_town_portal(object *op, object *caster, object *spell)
This function cast the spell of town portal for op.
uint32_t tag_t
Object tag, unique during the whole game.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
rangetype shoottype
Which range-attack is being used by player.
#define FLAG_USE_WEAPON
(Monster) can wield weapons
const char *const statname[NUM_STATS]
Name of stats.
#define FLAG_NO_DROP
Object can't be dropped.
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
void each(std::function< void(T *)> op)
Apply a function to each asset.
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
#define MSG_TYPE_SPELL
Spell related info.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
sstring race
Human, goblin, dragon, etc.
int cast_item_curse_or_bless(object *op, object *spell_ob)
This alters player's marked item's cursed or blessed status, based on the spell_ob's fields.
int8_t facing
Object is oriented/facing that way.
const Animations * animation
Animation of this item, NULL if not animated.
int8_t save[NROFATTACKS]
Save chances for the attacks.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be and may attack the nearest of your enemies Others can be in that they follow you around and help you in your quest to kill enemies and find treasure SPECIAL ITEMS There are many special items which can be found in of these the most important may be the signs all a player must do is apply the handle In the case of the player must move items over the button to hold it down Some of the larger buttons may need very large items to be moved onto before they can be activated Gates and locked but be for you could fall down into a pit full of ghosts or dragons and not be able to get back out Break away sometimes it may be worth a player s time to test the walls of a map for secret doors Fire such as missile weapons and spells you will notice them going up in smoke ! So be careful not to destroy valuable items Spellbooks sometimes a player can learn the other times they cannot There are many different types of books and scrolls out there Improve item have lower weight
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
long last_reset_time
A timestamp of the last original map loading.
#define FLAG_MONSTER
Will attack players.
#define P_OUT_OF_MAP
This space is outside the map.
Archetypes * archetypes()
Get archetypes.
#define MAX_BUF
Used for all kinds of things.
#define INS_ON_TOP
Always put object on top.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Describes an item, in all its details.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
int32_t weight
Attributes of the object.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
void monster_check_apply_all(object *monster)
Calls monster_check_apply() for all inventory objects.
void cast_magic_storm(object *op, object *tmp, int lvl)
This is really used mostly for spell fumbles and the like.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
A buffer that will be expanded as content is added to it.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
#define MOVE_FLY_LOW
Low flying object.
int16_t maxgrace
Maximum grace.
int cast_transfer(object *op, object *caster, object *spell, int dir)
This spell transfers sp from the player to another person.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
#define FLAG_REMOVED
Object is not in any map or invenory.
#define FLAG_WIZ
Object has special privilegies.
uint8_t dam_modifier
How going up in level affects damage.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring slaying
Which race to do double damage to.
int8_t glow_radius
indicates the glow radius of the object
static object * town_portal_find_force(object *op, object *spell)
#define FLAG_FRIENDLY
Will help players.
sstring name
The name of the object, obviously...
int SP_level_dam_adjust(const object *caster, const object *spob)
Returns adjusted damage based on the caster.
static void polymorph_item(object *who, object *op, int level)
Changes an item to another item of similar type.
#define MSG_TYPE_SPELL_FAILURE
Spell failure messages.
int is_dragon_pl(const object *op)
Checks if player is a dragon.
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
#define ARCH_PORTAL_FAILED
Archetype for town portal failure.
int16_t maxsp
Max spell points.
int is_magical(const object *op)
Checks whether object is magical.
void counterspell(object *op, int dir)
Nullifies spell effects.
Magical Runes Runes are magical inscriptions on the dungeon floor
int cast_heal(object *op, object *caster, object *spell, int dir)
Heals something.
sstring skill
Name of the skill this object uses/grants.
#define MSG_TYPE_SPELL_ERROR
Spell failure messages.
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
int cast_bless(object *op, object *caster, object *spell_ob, int dir)
Improve statistics of some living object.
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coo...
int cast_create_obj(object *op, object *new_op, int dir)
Creates object new_op in direction dir or if that is blocked, beneath the player (op).
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
int did_make_save(const object *op, int level, int bonus)
This function takes an object (monster/player, op), and determines if it makes a basic save throw by ...
int cast_create_missile(object *op, object *caster, object *spell, int dir, const char *stringarg)
Create a missile (nonmagic - magic +4).
int reference_count
How many times this temporary archetype is used.
#define FLAG_NO_FIX_PLAYER
fix_object() won't be called
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
Object is attacked by something.
#define CLEAR_FLAG(xyz, p)
bool map_path_unique(const char *path)
Return true if the given map path leads to a unique map.
method_ret ob_apply(object *op, object *applier, int aflags)
Apply an object by running an event hook or an object method.
static int town_portal_destroy_existing(object *op, object *spell)
Remove op's existing town portals.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
int cast_create_food(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
Create food.
int16_t duration
Number of moves (see 'speed') spell lasts.
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players.
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
Find object in inventory by type and archetype name.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
uint32_t count
Any numbers typed before a command.
ob_flags flags
Various flags.
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
#define FLAG_ANIMATE
The object looks at archetype for faces.
struct treasurelist * randomitems
Items to be generated.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
int cure_disease(object *sufferer, object *caster, sstring skill)
Do the cure disease stuff, from the spell "cure disease".
archetype * try_find_archetype(const char *name)
Magical Runes Runes are magical inscriptions on the dungeon which cast a spell or detonate when something steps on them Flying objects don t detonate runes Beware ! Runes are invisible most of the time They are only visible occasionally ! There are several runes which are there are some special runes which may only be called with the invoke and people may apply it to read it Maybe useful for mazes ! This rune will not nor is it ordinarily invisible Partial Visibility of they ll be visible only part of the time They have a(your level/2) chance of being visible in any given round
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define OB_TYPE_MOVE_BLOCK(ob1, type)
Basic macro to see if if ob1 can not move onto a space based on the 'type' move_block parameter Add c...
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
void update_all_los(const mapstruct *map, int x, int y)
This function makes sure that update_los() will be called for all players on the given map within the...
uint8_t state
How the object was last drawn (animation)
uint32_t unique
If set, this is a per player unique map.
sstring name
More definite name, like "generate_kobold".
uint32_t nrof
Number of objects.
#define FLAG_XRAYS
X-ray vision.
socket_struct * socket
Socket information for this player.
#define PETMOVE
If the upper four bits of attack_movement are set to this number, the monster follows a player until ...
living stats
Str, Con, Dex, etc.
MoveType move_allow
What movement types explicitly allowed.
This is one artifact, ie one special item.
object * more
Pointer to the rest of a large body of objects.
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
object * find_target_for_friendly_spell(object *op, int dir)
This function is commonly used to find a friendly target for spells such as heal or protection or arm...
int cast_identify(object *op, object *caster, object *spell)
Identifies objects in the players inventory/on the ground.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FLAG_IS_CAULDRON
container can make alchemical stuff
void pets_control_golem(object *op, int dir)
Makes the golem go in specified direction.
const char * invis_race
What race invisible to?
int recharge(object *op, object *caster, object *spell_ob)
Recharge wands.
uint8_t create_home_portals
If 1, can create portals in unique maps (apartments)
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_CURSED
The object is cursed.
artifactlist * find_artifactlist(int type)
Finds the artifact list for a certain item type.
int cast_earth_to_dust(object *op, object *caster, object *spell_ob)
Basically destroys earthwalls in the area.
@ NUM_STATS
Number of statistics.
#define MSG_TYPE_ITEM_INFO
Information related to items.
object * find_marked_object(object *op)
Return the object the player has marked with the 'mark' command below.
MoveType move_block
What movement types this blocks.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
static const int32_t MAX_FOOD
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
int alchemy(object *op, object *caster, object *spell_ob)
Change items to gold nuggets.
int create_aura(object *op, object *caster, object *spell)
Create an aura spell object and put it in the player's inventory.
@ llevDebug
Only for debugging purposes.
#define SP_WORD_OF_RECALL
int cast_cone(object *op, object *caster, int dir, object *spell)
Casts a cone spell.
int is_true_undead(object *op)
Is the object a true undead?
#define P_BLOCKSVIEW
This spot blocks the player's view.
#define FLAG_IDENTIFIED
Item is identifiable (e.g.
void player_update_bg_music(object *player)
object * identify(object *op)
Identifies an item.