Here is what I came up with yesterday. I have probably missed a few things and if anyone has any suggestions or an easier way of coding feel free to post
Code:
ACMD(do_dirt_kick)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
struct affected_type af;
int percent, prob;
// dirt skill not learned automatic failure
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_DIRT_KICK)) {
send_to_char(ch, "You have no idea how.\r\n");
return;
}
one_argument(argument, arg);
if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_ROOM))) {
if (FIGHTING(ch) && IN_ROOM(ch) == IN_ROOM(FIGHTING(ch)))
vict = FIGHTING(ch);
else {
send_to_char(ch, "Dirt Kick who?\r\n");
return;
}
}
// do nothing if trying to dirt kick self
if (vict == ch) {
send_to_char(ch, "Aren't we funny today...\r\n");
return;
}
// vars to check if we land a kick or not
percent = ((10 - (compute_armor_class(vict) / 10)) * 2) + rand_number(1,101);;
prob = GET_SKILL(ch, SKILL_DIRT_KICK);
// ch misses victim, using TYPE_UNDEFINED instead of SKILL_DIRT_KICK messages in <message> file.
if (percent > prob) {
act("\r\n\tyYou try to kick dirt in $N's eyes, but slip and fall!\tn.", FALSE, ch, 0, vict, TO_CHAR);
act("\r\n\ty$n tries to kick dirt in $N's eyes, but slips and falls to the ground!\tn.", TRUE, ch, 0, vict, TO_NOTVICT);
damage(ch, vict, 0, TYPE_UNDEFINED);
}
else {
// we have a chance to hit!
// check to see if mob can be blinded or not
if (MOB_FLAGGED(vict, MOB_NOBLIND)) {
act("\tgYou try to kick dirt in $N's face, but nothing happens.\tn.", FALSE, ch, 0, vict, TO_CHAR);
}
else {
// if vict is not affected by blind then apply the debuffs
if (!AFF_FLAGGED(vict, AFF_BLIND)) {
new_affect(&af);
af.spell = SKILL_DIRT_KICK;
af.location = APPLY_HITROLL;
af.modifier = -10;
af.duration = 1;
SET_BIT_AR(af.bitvector, AFF_BLIND);
affect_to_char(vict, &af);
new_affect(&af);
af.spell = SKILL_DIRT_KICK;
af.location = APPLY_AC;
af.modifier = 40;
af.duration = 1;
SET_BIT_AR(af.bitvector, AFF_BLIND);
affect_to_char(vict, &af);
damage(ch, vict, rand_number(1, GET_LEVEL(ch)), TYPE_UNDEFINED);
act("\tgYou temporarily \tWblind\tg $N\tn.", FALSE, ch, 0, vict, TO_CHAR);
act("\tg$N is temporarily \tWblinded\tn.", TRUE, ch, 0, vict, TO_NOTVICT);
act("\tgYou kick dirt in $N's face!\tn.", FALSE, ch, 0, vict, TO_CHAR);
}
else {
damage(ch, vict, rand_number(1, GET_LEVEL(ch)), TYPE_UNDEFINED);
act("\r\n\tgYou kick dirt in $N's eyes!\tn.", FALSE, ch, 0, vict, TO_CHAR);
act("\r\n\tg$n kicks dirt in $N's eyes!\tn.", TRUE, ch, 0, vict, TO_NOTVICT);
}
}
}
// wait period
WAIT_STATE(ch, PULSE_VIOLENCE * 2);
}