Just had a wierd thing happend, from a player using stun skill, and he failed and stunned himself.
His respons of what happened after he stunned himself was, that he was suddently affected by ALOT of spells he has no access to, sanc, fireshield, etc.
Any ideas why the log shows what it does, or ideas to improve stun the code or what in the stun code is causing the problems ?
Code:
In file crash i see:
Nov 19 03:46:48 :: SYSERR: Unknown apply adjust -67 attempt (handler.c,
affect_modify).
Nov 19 03:46:48 :: SYSERR: Unknown apply adjust -67 attempt (handler.c,
affect_modify).
Nov 19 03:46:48 :: SYSERR: Unknown apply adjust -67 attempt (handler.c,
affect_modify).
Nov 19 03:47:06 :: SYSERR: Unknown apply adjust -67 attempt (handler.c,
affect_modify).
The code
Code:
ACMD(do_stun)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
struct affected_type af;
int diff_lev, percent, prob;
int chance;
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_STUN)) {
send_to_char(ch, "You have no idea how.\r\n");
return;
}
one_argument(argument, arg);
if (!GET_SKILL(ch, SKILL_STUN) ) {
send_to_char(ch, "You do not know this skill.\r\n");
} else if (!*arg) {
send_to_char(ch, "Stun who?\r\n");
} else if (!(vict = get_char_room_vis(ch, arg, NULL))) {
send_to_char(ch, "They don't seem to be here.\r\n");
} else if ( ! IS_NPC(vict) ){
send_to_char(ch, "You can not attack another PC.\r\n");
} else if (vict == ch) {
send_to_char(ch, "You Stun yourself...OUCH!.\r\n");
act("$n tries to stun $mself, and says OUCH!", FALSE, ch, 0, vict, TO_ROOM);
} else if (IS_AFFECTED(ch, AFF_CHARM) && (ch->master == vict)) {
act("$N is just such a good friend, you simply can't stun $M.", FALSE, ch, 0, vict, TO_CHAR);
} else if (ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n");
} else if ( ! (GET_MOVE(ch) >= 10) ) {
send_to_char(ch, "I am sorry, but you seem to tired to try to do that.\r\n");
} else {
percent = rand_number(1, 105); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_STUN);
if ( percent < prob ) {
GET_MOVE(ch) -= 10;
diff_lev = GET_LEVEL(vict) - GET_LEVEL(ch);
chance = 33 - (diff_lev ) ;
if (chance > 100)
chance = 100;
chance -= GET_DEX(vict);
percent = rand_number(1, 105);
if ( chance > percent ) {
new_affect(&af);
af.duration = 0;
af.spell = SKILL_STUN;
SET_BIT_AR(af.bitvector, AFF_STUN);
affect_to_char(vict, &af);
stop_fighting(vict);
GET_POS(vict) = POS_STUNNED;
act("You stun $N.", FALSE, ch, 0, vict, TO_CHAR);
act("$n stuns $N.", TRUE, ch, 0, vict, TO_NOTVICT);
act("$n stuns you.", TRUE, ch, 0, ch->master, TO_VICT);
improve_skill(ch, SKILL_STUN);
} else {
send_to_char(ch, "You failed to stun.\r\n");
if ( rand_number(1,105) <= 1) {
if (GET_LEVEL(ch) < LVL_IMMORT) {
send_to_char(ch, "Oops, You stunned yourself!\r\n");
SET_BIT_AR(af.bitvector, AFF_STUN);
af.duration = 0;
affect_to_char(ch, &af);
GET_POS(ch) = POS_STUNNED;
}
}
}
} else {
send_to_char(ch, "You failed to stun him.\r\n");
if ( rand_number(1,105) <= 1) {
if (GET_LEVEL(ch) < LVL_IMMORT) {
send_to_char(ch, "Oops, You stunned your self.\r\n");
SET_BIT_AR(af.bitvector, AFF_STUN);
af.duration = 0;
affect_to_char(ch, &af);
GET_POS(ch) = POS_STUNNED;
}
}
}
hit(ch, vict, TYPE_UNDEFINED);
WAIT_STATE(ch, PULSE_VIOLENCE * 4);
}
}
While character is stunned he is affected by: detect invis, steel skin, stone skin, barkskin, sanc,
fireshield, prot fro evil, poison
And when stun is gone, so are the spells.
Another time char stunned himself:
Code:
Nov 19 08:43:14 :: SYSERR: Unknown apply adjust 122 attempt (handler.c,
affect_modify).
Nov 19 08:43:14 :: SYSERR: Unknown apply adjust 122 attempt (handler.c,
affect_modify).
Nov 19 08:43:14 :: SYSERR: Unknown apply adjust 122 attempt (handler.c,
affect_modify).
Nov 19 08:43:56 :: SYSERR: Unknown apply adjust 122 attempt (handler.c,
affect_modify).
So every time a char stuns himself, he is for the duration affected by spells he shouldnt be, AND those affect_modify appear in log.