The Special Weapon BUG for EmberMUD
Fix Sheet by Rindar (Ron Cole)
Code from ROM 2.4 by Russ Taylor
Adaptions made by Raven and Rindar
The Bug: Have you ever set the special weapon flag on a sword to
flaming and wondered why nothing special seems to happen when you
attack with it? Well, the reason is that a large chunk of the
special weapons code was left out of EmberMUD. Because of this,
the only thing the special weapon flags do are give another line of
text to every item. Not very impressive, is it?
The Check: Set the special flag on a weapon to vampiric. Load the
weapon and then attack with it. If you don't see any life-draining
or some other unusual message, you have the bug.
The Bugfix: You need to give special weapons the power to do
damage, and that happens in fight.c. Specificly, it happens in
the functions one_hit and second_one_hit. Here's how to do it:
1) Open fight.c
2) Find the function "void one_hit"
3) Find the line: damage( ch, victim, dam, dt, dam_type );
In this case, it is at the end of the file right before
the last call of tail_chain( ); This is how it looks in
the code:
dam += GET_DAMROLL(ch) * UMIN(100,skill) /100;
if ( dam <= 0 )
dam = 1;
damage( ch, victim, dam, dt, dam_type );
4) Insert the snippet at the end of this file right
after the above line.
5) Repeat the above steps, only this time do it in the
function "void second_one_hit" in fight.c.
6) Recompile. You are done.
IMPORTANT: ROM 2.4 included the code for Flaming, Frost,
Vampiric, Shocking, and Poison weapons. EmberMUD does not
include the weapon types Shocking or Poison. If you do not
intend to use these weapon types, you should delete them from
the snippet below. If you would like to use them, you must
add the proper lines of code in merc.h, bit.c, and handler.c.
Just mimic what vampiric does in those files, and you should
be fine.
Notes: I have not yet tested poison weapons, so I am not sure
how well this bit of code works, or if it will crash the game.
As well, there is still no code for the sharp, vorpal, or two-
hands special weapons. Perhaps someone will write it and
release it, or keep it as a "unique feature" on their EmberMUD.
Whatever happens, feel free to write me and let me know how the
code works/what you've done with it. Improvements would be
most welcome, and might even be useful to the admins/coders
of pure ROM MUDs.
-= Rindar
clogar@concentric.net
** Note: This function is provided "as is" and may be used so long as
1) The author's name is kept at the top of the function (if requested) and
2) all other previous licensing aggreements are abided by. The author
assumes no responsibility for problems that occur through use or install-
ation, including lost wages, bugs, deletions, downtimes, etc... Use at
your own risk. All new code is copyrighted by its author.
Special Weapon Snippet:
/* This is what it should look like in void one_hit before you
place the function. The code you should place begins after the
star slash.
if ( dt == gsn_backstab && wield != NULL)
if ( wield->value[0] != 2 )
dam *= 2 + ch->level / 10;
else
dam *= 2 + ch->level / 8;
dam += GET_DAMROLL(ch) * UMIN(100,skill) /100;
if ( dam <= 0 )
dam = 1;
damage( ch, victim, dam, dt, dam_type );
*/
/* but do we have a funky weapon? */
if (wield != NULL && ch->fighting == victim)
{
if (IS_WEAPON_STAT(wield,WEAPON_POISON))
{
int level;
AFFECT_DATA *poison, af;
if ((poison = affect_find(wield->affected,gsn_poison)) == NULL)
level = wield->level;
else
level = poison->level;
if (!saves_spell(level / 2,victim))
{
send_to_char("You feel poison coursing through your veins.",
victim);
act("$n is poisoned by the venom on $p.",
victim,wield,NULL,TO_ROOM);
/* af.where = TO_AFFECTS; */
af.type = gsn_poison;
af.level = level * 3/4;
af.duration = level / 2;
af.location = APPLY_STR;
af.modifier = -1;
af.bitvector = AFF_POISON;
affect_join( victim, &af );
}
/* weaken the poison if it's temporary */
if (poison != NULL)
{
poison->level = UMAX(0,poison->level - 2);
poison->duration = UMAX(0,poison->duration - 1);
if (poison->level == 0 || poison->duration == 0)
act("The poison on $p has worn off.",ch,wield,NULL,TO_CHAR);
}
}
if (IS_WEAPON_STAT(wield,WEAPON_VAMPIRIC))
{
dam = number_range(1, wield->level / 5 + 1);
act("$p draws life from $n.",victim,wield,NULL,TO_ROOM);
act("You feel $p drawing your life away.",
victim,wield,NULL,TO_CHAR);
damage(ch,victim,dam,0,DAM_NEGATIVE);
ch->alignment = UMAX(-1000,ch->alignment - 1);
ch->hit += dam/2;
}
if (IS_WEAPON_STAT(wield,WEAPON_FLAMING))
{
dam = number_range(1,wield->level / 4 + 1);
act("$n is burned by $p.",victim,wield,NULL,TO_ROOM);
act("$p sears your flesh.",victim,wield,NULL,TO_CHAR);
damage(ch,victim,dam,0,DAM_FIRE);
}
if (IS_WEAPON_STAT(wield,WEAPON_FROST))
{
dam = number_range(1,wield->level / 6 + 2);
act("$p freezes $n.",victim,wield,NULL,TO_ROOM);
act("The cold touch of $p surrounds you with ice.",
victim,wield,NULL,TO_CHAR);
damage(ch,victim,dam,0,DAM_COLD);
}
if (IS_WEAPON_STAT(wield,WEAPON_SHOCKING))
{
dam = number_range(1,wield->level/5 + 2);
act("$n is struck by lightning from $p.",victim,wield,NULL,TO_ROOM);
act("You are shocked by $p.",victim,wield,NULL,TO_CHAR);
damage(ch,victim,dam,0,DAM_LIGHTNING);
}
}
/* This is what the end of the function one_hit looks like.
tail_chain( );
return;
}
*/