Crossfire Server, Trunk  R20513
Functions
resurrection.c File Reference

Resurrection / raise dead related code. More...

#include "global.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "output_file.h"
#include "sproto.h"
#include "spells.h"
Include dependency graph for resurrection.c:

Go to the source code of this file.

Functions

int cast_raise_dead_spell (object *op, object *caster, object *spell, int dir, const char *arg)
 This handles the raise dead / resurrection spells. More...
 
void dead_player (object *op)
 Kill a player on a permanent death server with resurrection. More...
 
static int resurrect_player (object *op, char *playername, object *spell, char *accountname)
 Resurrect a player. More...
 
static int resurrection_fails (int levelcaster, int leveldead)
 Will the resurrection succeed? More...
 

Detailed Description

Resurrection / raise dead related code.

This is used on servers with permanent death on.

Todo:
document permanent death and death :)

Definition in file resurrection.c.

Function Documentation

int cast_raise_dead_spell ( object op,
object caster,
object spell,
int  dir,
const char *  arg 
)

This handles the raise dead / resurrection spells.

So try to revive a player.

Author
peterm and mehlh.nosp@m.aff@.nosp@m.soda..nosp@m.berk.nosp@m.eley..nosp@m.edu
Parameters
opwho is doing the resurrecting.
casterwhat is casting the spell (op or a scroll/rod).
spellspell object.
dirdirection the spell is cast.
argname of the player to revive.
Return values
0spell had no effect, or player couldn't revive.
1player revived, or some nasty things happened.

Definition at line 181 of file resurrection.c.

References arch_to_object(), CALLOC, caster_level(), CORPSE, draw_ext_info(), draw_ext_info_format(), find_archetype(), FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), treasurestruct::item, treasureliststruct::items, obj::last_heal, obj::level, obj::map, MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, obj::name, archt::name, NDI_UNIQUE, treasurestruct::next, treasurestruct::nrof, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), P_OUT_OF_MAP, obj::randomitems, resurrect_player(), resurrection_fails(), safe_strncpy, obj::slaying, summon_hostile_monsters(), obj::x, and obj::y.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

void dead_player ( object op)

Kill a player on a permanent death server with resurrection.

Parameters
opplayer to kill.

Definition at line 294 of file resurrection.c.

References llevError, Settings::localdir, LOG(), make_perma_dead(), MAX_BUF, obj::name, Settings::playerdir, settings, and snprintf.

Referenced by kill_player_permadeath().

Here is the call graph for this function:

Here is the caller graph for this function:

static int resurrect_player ( object op,
char *  playername,
object spell,
char *  accountname 
)
static

Resurrect a player.

This may change the player's race, or reduce experience.

Parameters
opwho is resurrecting.
playernamethe name of the player to resurrect.
spellspell that was used to resurrect.
accountnamethe account the resurrected player belongs to
Return values
0resurrection failed.
1playername is living again.

Definition at line 52 of file resurrection.c.

References treasurestruct::chance, liv::Con, draw_ext_info_format(), liv::exp, find_treasurelist(), FMT64, treasurestruct::item, treasureliststruct::items, llevError, Settings::localdir, LOG(), MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, archt::name, NDI_UNIQUE, treasurestruct::next, of_close(), of_open(), Settings::playerdir, obj::race, RANDOM, settings, snprintf, obj::stats, treasureliststruct::total_chance, unlink, and unmake_perma_dead().

Referenced by cast_raise_dead_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

static int resurrection_fails ( int  levelcaster,
int  leveldead 
)
static

Will the resurrection succeed?

Rules:

  • equal in level, 50% success.
  • +5 % for each level below, -5% for each level above.
  • minimum 20%
Parameters
levelcasterlevel at which the spell is cast.
leveldeaddead player's level.
Returns
0 if succees, 1 if failure.

Definition at line 277 of file resurrection.c.

References rndm().

Referenced by cast_raise_dead_spell().

Here is the call graph for this function:

Here is the caller graph for this function: