Here is my Whirlwind code that works you'll have to fine tune it obviously
Code:
ACMD(do_whirlwind)
{
struct char_data *vict, *next_vict;
int percent, prob, activator = 0, w_wielded_type, dam;
struct obj_data *wielded = WIELDED_WEAPON(ch);
if ((IS_NPC(ch)) && (AFF_FLAGGED(ch, AFF_CHARM))) {
act("$n looks puzzled.", FALSE, ch, 0, 0, TO_ROOM);
return;
}
/* If player is a mob or skill isn't learned, we can't do this. */
if (!GET_TOT_SKILL(ch, SKILL_WHIRLWIND)) {
send_to_char(ch, "%s", NOPROFICIENCY);
return;
}
/* Neither can we do this in a peaceful room */
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) {
send_to_char(ch, "%s", PEACE_ROOM_WARNING);
return;
}
/* And finally, the show costs 30 moves, so the player must be able to pay */
if (GET_MANA(ch) < BASE_MANA_WHIRLWIND) {
send_to_char(ch, "You don't have the energy to do that just now!\r\n");
return;
}
/* Now we just need to calculate the chance for sucess before we begin. */
percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_TOT_SKILL(ch, SKILL_WHIRLWIND);
if (percent > prob) {
send_to_char(ch, "You fail to complete your whirlwind!\r\n");
act("$n fails to complete $s whirlwind attack!", FALSE, ch, 0, NULL, TO_NOTVICT);
return;
}
else {
if (rand_number(1, 101) < SG_MIN)
skill_gain(ch, SKILL_WHIRLWIND);
/* Find the weapon type (for display purposes only) */
if (wielded && GET_OBJ_TYPE(wielded) == ITEM_WEAPON)
w_wielded_type = GET_OBJ_VAL(wielded, 3) + TYPE_HIT;
else {
if (IS_NPC(ch) && ch->mob_specials.attack_type != 0)
w_wielded_type = ch->mob_specials.attack_type + TYPE_HIT;
else if (IS_MONK(ch))
if (rand_number(0,1))
w_wielded_type = TYPE_PUNCH;
else
w_wielded_type = TYPE_KICK;
else
w_wielded_type = TYPE_HIT;
}
/* Find first target, hit it, then move on to next one */
act("You make a whirlwind attack, wounding ALL of your opponents!", FALSE, ch, 0, NULL, TO_CHAR);
// act("$n attacks widely about, hitting everyone!", FALSE, ch, 0, NULL, TO_NOTVICT);
act("$n explodes into a whirlwind of attacking frenzy.", FALSE, ch, 0, NULL, TO_NOTVICT);
for (vict = world[ch->in_room].people; vict; vict = next_vict) {
next_vict = vict->next_in_room;
/* We'll leave out immortals, players (for !pk muds) and pets from the
hit list */
if (vict == ch)
continue;
if (!IS_NPC(vict) && GET_LEVEL(vict) >= LVL_IMMORT)
continue;
if (((IS_NPC(ch)) && (AFF_FLAGGED(ch, AFF_CHARM))) && (!IS_NPC(vict)))
continue;
if (((IS_NPC(ch)) && (!AFF_FLAGGED(ch, AFF_CHARM))) && ((IS_NPC(vict)) && (!AFF_FLAGGED(vict, AFF_CHARM))))
continue;
if (((IS_NPC(ch)) && (AFF_FLAGGED(ch, AFF_CHARM))) && ((IS_NPC(vict)) && (AFF_FLAGGED(vict, AFF_CHARM))))
continue;
if (PC_VS_PC_NOT_ALLOWED(ch, vict))
continue;
if (IS_PC(vict) && IS_PC(ch) && !ROOM_FLAGGED(IN_ROOM(ch), ROOM_ARENA))
continue;
if (!IS_NPC(ch)) {
for (int i = 0; i < NUM_PERK_SLOTS; i++) {
if (GET_PERK_SLOTS(ch, i) == 132)
activator = 1;
}
}
if (activator == 0) {
dam = get_max_damage_per_hit(ch, FALSE);
} else {
dam = (3 * get_max_damage_per_hit(ch, FALSE));
}
GET_TRAILING_DAMAGE(vict) += (int)(double)(dam / 2);
act("You are struck by $N's horrible whirlwind-like attack!", FALSE, vict, 0, ch, TO_CHAR);
damage(ch, vict, dam, w_wielded_type, DEATH_MSG_ATTACKER);
}
GET_MANA(ch)=GET_MANA(ch) - BASE_MANA_WHIRLWIND;
}
if (IS_NPC(ch)) SET_BIT(MSC_FLAGS(ch), MSC_JUST_ATTACKED);
if (activator == 0) {
GET_WAIT_STATE(ch) = 2 * PULSE_VIOLENCE;
} else {
GET_WAIT_STATE(ch) = PULSE_VIOLENCE;
}
}