That snippet is pretty old and some of the underlying functionality has changed. I was able to implement it into a relatively fresh version of tbaMUD and get it to compile, work and run with some minor alterations.
Code:
diff --git a/src/act.wizard.c b/src/act.wizard.c
index b0694ee..db0aa88 100644
--- a/src/act.wizard.c
+++ b/src/act.wizard.c
@@ -1261,6 +1261,9 @@ void return_to_char(struct char_data * ch)
if (ch->desc->original->desc) {
ch->desc->original->desc->character = NULL;
STATE(ch->desc->original->desc) = CON_DISCONNECT;
+
+ if (affected_by_spell(ch->desc->original, SPELL_CORPSE_HOST))
+ affect_from_char(ch->desc->original, SPELL_CORPSE_HOST);
}
/* Now our descriptor points to our original body. */
@@ -1270,6 +1273,9 @@ void return_to_char(struct char_data * ch)
/* And our body's pointer to descriptor now points to our descriptor. */
ch->desc->character->desc = ch->desc;
ch->desc = NULL;
+
+ if (affected_by_spell(ch, SPELL_CORPSE_HOST))
+ die(ch, NULL);
}
ACMD(do_return)
diff --git a/src/class.c b/src/class.c
index 6efd9da..68f540e 100644
--- a/src/class.c
+++ b/src/class.c
@@ -1561,6 +1561,7 @@ void init_spell_levels(void)
{
/* MAGES */
spell_level(SPELL_MAGIC_MISSILE, CLASS_MAGIC_USER, 1);
+ spell_level(SPELL_CORPSE_HOST, CLASS_MAGIC_USER, 1);
spell_level(SPELL_DETECT_INVIS, CLASS_MAGIC_USER, 2);
spell_level(SPELL_DETECT_MAGIC, CLASS_MAGIC_USER, 2);
spell_level(SPELL_CHILL_TOUCH, CLASS_MAGIC_USER, 3);
diff --git a/src/fight.c b/src/fight.c
index e4b74b5..92da825 100644
--- a/src/fight.c
+++ b/src/fight.c
@@ -720,16 +720,17 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
}
/* Help out poor linkless people who are attacked */
- if (!IS_NPC(victim) && !(victim->desc) && GET_POS(victim) > POS_STUNNED) {
+ if (!IS_NPC(victim) && !(victim->desc) && GET_POS(victim) > POS_STUNNED && !affected_by_spell(victim, SPELL_CORPSE_HOST)) {
do_flee(victim, NULL, 0, 0);
if (!FIGHTING(victim)) {
act("$n is rescued by divine forces.", FALSE, victim, 0, 0, TO_ROOM);
- GET_WAS_IN(victim) = IN_ROOM(victim);
+ GET_WAS_IN(victim) = victim->in_room;
char_from_room(victim);
char_to_room(victim, 0);
}
}
+
/* stop someone from fighting if they're stunned or worse */
if (GET_POS(victim) <= POS_STUNNED && FIGHTING(victim) != NULL)
stop_fighting(victim);
diff --git a/src/handler.c b/src/handler.c
index 87269bb..b7d718b 100644
--- a/src/handler.c
+++ b/src/handler.c
@@ -305,6 +305,12 @@ void affect_remove(struct char_data *ch, struct affected_type *af)
return;
}
+ /* return corpse host people to their proper bodies */
+ if (af->spell == SPELL_CORPSE_HOST && ch->desc && ch->desc->original) {
+ command_interpreter(ch, "return");
+ die(ch, NULL);
+ }
+
affect_modify_ar(ch, af->location, af->modifier, af->bitvector, FALSE);
REMOVE_FROM_LIST(af, ch->affected, next);
free(af);
diff --git a/src/spell_parser.c b/src/spell_parser.c
index dd2f7f7..dfd8b46 100644
--- a/src/spell_parser.c
+++ b/src/spell_parser.c
@@ -258,6 +258,10 @@ int call_magic(struct char_data *caster, struct char_data *cvict,
MANUAL_SPELL(spell_charm)
;
break;
+ case SPELL_CORPSE_HOST:
+ MANUAL_SPELL(spell_corpse_host)
+ ;
+ break;
case SPELL_CREATE_WATER:
MANUAL_SPELL(spell_create_water)
;
@@ -771,6 +775,9 @@ void mag_assign_spells(void) {
spello(SPELL_CONTROL_WEATHER, "control weather", 75, 25, 5, POS_STANDING,
TAR_IGNORE, FALSE, MAG_MANUAL, NULL);
+ spello(SPELL_CORPSE_HOST, "corpse host", 35, 10, 3, POS_STANDING,
+ TAR_OBJ_ROOM, FALSE, MAG_MANUAL, NULL);
+
spello(SPELL_CREATE_FOOD, "create food", 30, 5, 4, POS_STANDING,
TAR_IGNORE, FALSE, MAG_CREATIONS, NULL);
diff --git a/src/spells.c b/src/spells.c
index d9785b7..bc31d8f 100644
--- a/src/spells.c
+++ b/src/spells.c
@@ -447,3 +447,51 @@ ASPELL(spell_detect_poison)
}
}
}
+
+ASPELL(spell_corpse_host)
+{
+ struct affected_type af;
+ struct char_data* mob;
+
+ if ((obj == NULL) || !IS_CORPSE(obj)) {
+ send_to_char(ch, "Thats not what you need to be concentrating on.\r\n");
+ return;
+ }
+
+ mob = read_mobile(MOB_CORPSE_HOST, VIRTUAL);
+ char_to_room(mob, ch->in_room);
+
+ mob->player.name = "Ju-Ju Zombie\r\n";
+ mob->player.long_descr = "a Ju-Ju Zombie is standing here.\r\n";
+ mob->player.short_descr = "a Ju-Ju Zombie";
+
+ GET_LEVEL(mob) = GET_LEVEL(ch);
+
+ GET_MAX_MANA(mob) = GET_MAX_MANA(ch);
+ GET_MANA(mob) = GET_MANA(ch);
+
+ GET_MAX_HIT(mob) = GET_MAX_HIT(ch);
+ GET_HIT(mob) = GET_HIT(ch);
+
+ GET_INT(mob) = GET_INT(ch);
+ GET_WIS(mob) = GET_WIS(ch);
+ GET_STR(mob) = 18;
+ GET_CON(mob) = 15;
+ GET_CHA(mob) = 3;
+ GET_DEX(mob) = 8;
+
+ extract_obj(obj);
+
+ af.spell = SPELL_CORPSE_HOST;
+ af.duration = (GET_INT(ch) + GET_CON(ch) + GET_WIS(ch)) / 3;
+ af.modifier = 0;
+ af.location = 0;
+
+ affect_to_char(mob, &af);
+ affect_to_char(ch, &af);
+
+ ch->desc->character = mob;
+ mob->desc = ch->desc;
+ mob->desc->original = ch;
+ ch->desc = NULL;
+}
diff --git a/src/spells.h b/src/spells.h
index 4bcb8ec..b3f9e59 100644
--- a/src/spells.h
+++ b/src/spells.h
@@ -93,8 +93,9 @@
#define SPELL_IDENTIFY 52 /* Reserved Skill DO NOT CHANGE */
#define SPELL_FLY 53 /* Reserved Skill DO NOT CHANGE */
#define SPELL_DARKNESS 54
+#define SPELL_CORPSE_HOST 55
/** Total Number of defined spells */
-#define NUM_SPELLS 54
+#define NUM_SPELLS 55
/* Insert new spells here, up to MAX_SPELLS */
#define MAX_SPELLS 130
@@ -228,6 +229,7 @@ ASPELL(spell_information);
ASPELL(spell_identify);
ASPELL(spell_enchant_weapon);
ASPELL(spell_detect_poison);
+ASPELL(spell_corpse_host);
/* basic magic calling functions */
diff --git a/src/structs.h b/src/structs.h
index 08e47db..782730b 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -224,8 +224,9 @@
#define MOB_NOBLIND 17 /**< Mob can't be blinded */
#define MOB_NOKILL 18 /**< Mob can't be attacked */
#define MOB_NOTDEADYET 19 /**< (R) Mob being extracted */
+#define MOB_CORPSE_HOST 20
-#define NUM_MOB_FLAGS 19
+#define NUM_MOB_FLAGS 20
/* Preference flags: used by char_data.player_specials.pref */
#define PRF_BRIEF 0 /**< Room descs won't normally be shown */