I do not remember if it is absolutely necessary, but I think it may save you some heartache in the future if you add a "stop_fighting" then just hit the new target with zero damage. To switch targets in our MUD it takes an 'action' and will present opponents that are attacking you with an 'attack of opportunity', so you can ignore those parts
Oh and ignore the event stuff, we use events to run combat.
Because you are running the damage() function, you and the new target will automatically engage (if he/she can, if he/she is already targeting someone else, they will continue to do so), and the previous target will continue to fight you because you are not messing with their target.
Code:
} else {
/* don't forget to remove the fight event! */
if (char_has_mud_event(ch, eCOMBAT_ROUND)) {
event_cancel_specific(ch, eCOMBAT_ROUND);
}
USE_STANDARD_ACTION(ch);
stop_fighting(ch);
send_to_char(ch, "You switch opponents!\r\n");
act("$n switches opponents!", FALSE, ch, 0, vict, TO_ROOM);
hit(ch, vict, TYPE_UNDEFINED, DAM_RESERVED_DBC, 0, FALSE);
//everyone gets a free shot at you unless you make a acrobatics check
//15 is DC
if (FIGHTING(ch) && FIGHTING(vict)) {
if (!skill_check(ch, ABILITY_ACROBATICS, 15))
attacks_of_opportunity(ch, 0);
}
}