/***************************************************************************
* This code is free for use within any non-commercial MUD. *
* *********************************************************************** *
* This is a simple snippet to make weapons a bit more diverse, in the *
* hopes that players will choose a weapon other than sword. The new *
* capabilities for each weapon are as follows: *
* *
* Swords have a VERY SLIM chance of attacking two enemies at once. *
* Daggers may recieve one additional attack. *
* Spears apply your dexterity as additional damroll. *
* Polearms can keep your opponent at bay for an extra defense. *
* Axes can deliver a critical hit. *
* Maces might knock your opponent down. *
* Flails will inflict daze on your opponent. *
* Whips apply your intelligence as additional damroll. *
* *
* You only need to edit one file to install this, fight.c. Afterwards, I *
* would recommend noting these changes in a helpfile. I'd most certainly *
* appreciate credit, but it isn't necessary, so long as you don't try to *
* claim it as your own work. As always, if you have feedback, I'd love *
* to hear from you. -- Midboss (eclipsing.souls@gmail.com) *
* *
***************************************************************************/
//---| Add these at the top of the file:
bool pole_special (CHAR_DATA * ch, CHAR_DATA * victim);
int axe_special (CHAR_DATA * ch, CHAR_DATA * victim, int dam);
//---| In multi_hit(), replace this:
if (IS_AWAKE (ch) && ch->in_room == victim->in_room)
multi_hit (ch, victim, TYPE_UNDEFINED);
//---| With this:
if (IS_AWAKE (ch) && ch->in_room == victim->in_room)
{
multi_hit (ch, victim, TYPE_UNDEFINED);
/*
* Swords will very rarely get in an extra round.
*/
if (get_weapon_sn (ch) == gsn_sword
&& ch->wait <= 0)
{
int chance;
CHAR_DATA * was_fighting;
CHAR_DATA * vch;
chance = get_skill (ch, gsn_sword) / 15;
/*
* Penalty if the opponent can see.
*/
if (can_see (victim, ch))
chance = chance * 3 / 5;
for (vch = ch->in_room->people; vch != NULL;
vch = vch->next_in_room)
{
if (vch->fighting == ch
|| is_same_group (vch->fighting, ch))
{
if (number_percent () < chance)
{
was_fighting = ch->fighting;
ch->fighting = vch;
multi_hit (ch, vch, TYPE_UNDEFINED);
check_improve (ch, gsn_sword, TRUE, 2);
ch->fighting = was_fighting;
WAIT_STATE (ch, PULSE_VIOLENCE);
break;
}
}
}
}
}
//---| Add this with the other defensive skill calls in damage():
if (pole_special (ch, victim))
return FALSE;
//---| Add this after the enhanced damage check in one_hit():
dam = axe_special (ch, victim, dam);
//---| Add these after the damroll is added in one_hit():
/*
* Boosted damage for spears, based on dexterity.
*/
if (get_weapon_sn (ch) == gsn_spear
&& number_percent () < get_skill (ch, gsn_spear))
{
dam += get_curr_stat (ch, STAT_DEX)
* get_skill (ch, gsn_spear) / 100;
check_improve (ch, gsn_spear, TRUE, 6);
}
//---| Add this above the block of code containing the weapon effects
//---| in one_hit():
/*
* Knockdown and daze effects for mace and flail.
*/
if (result && ch->fighting == victim)
{
/*
* Maces knock the opponent down and lag them for a moment.
*/
if (get_weapon_sn (ch) == gsn_mace
&& number_percent () < get_skill (ch, gsn_mace) / 10)
{
WAIT_STATE (victim, PULSE_VIOLENCE*1);
victim->position = POS_RESTING;
act ("Your blow knocks $N to the ground.",
ch, NULL, victim, TO_CHAR);
act ("$n knocks you to the ground.",
ch, NULL, victim, TO_VICT);
check_improve (ch, gsn_mace, TRUE, 4);
}
/*
* Flails daze the opponent and screw up their casting.
*/
if (get_weapon_sn (ch) == gsn_flail
&& number_percent () < get_skill (ch, gsn_flail) / 5)
{
DAZE_STATE (victim, PULSE_VIOLENCE*4);
check_improve (ch, gsn_flail, TRUE, 4);
}
}
//---| Add this RIGHT AFTER the first one_hit() call in multi_hit:
if (ch->fighting != victim)
return;
/*
* Extra hit for daggers.
*/
if (get_weapon_sn (ch) == gsn_dagger)
{
chance = get_skill (ch, gsn_dagger) / 2;
if (IS_AFFECTED (ch, AFF_SLOW))
chance /= 1.5;
if (IS_AFFECTED (ch, AFF_HASTE))
chance *= 2;
if (number_percent () < chance)
{
one_hit (ch, victim, dt);
check_improve (ch, gsn_dagger, TRUE, 4);
if (ch->fighting != victim)
return;
}
}
//---| Add this before the last return in check_parry():
/*
* Whip innate ability.
*/
if (get_weapon_sn (ch) == gsn_whip)
{
chance = get_skill (ch, gsn_whip) / 7;
if (number_percent () < chance)
{
disarm (ch, victim);
check_improve (ch, gsn_whip, TRUE, 3);
}
}
else if (get_weapon_sn (victim) == gsn_whip)
{
chance = get_skill (ch, gsn_whip) / 8;
if (number_percent () < chance)
{
disarm (victim, ch);
check_improve (victim, gsn_whip, TRUE, 3);
}
}
//---| Add these anywhere in fight.c you feel like.
/*
* Special defensive skill for polearms. Due to their extended range,
* polearms are able to keep your opponent from closing on on you.
*/
bool pole_special (CHAR_DATA * ch, CHAR_DATA * victim)
{
int chance;
if (!IS_AWAKE (victim))
return FALSE;
if (get_weapon_sn (victim) != gsn_polearm)
return FALSE;
chance = get_skill (victim, gsn_polearm) / 3;
if (!can_see (victim, ch))
chance /= 2;
/*
* It's harder to keep another polearm at bay.
*/
if (get_weapon_sn (ch) != gsn_polearm)
chance -= chance / 3;
if (number_percent () >= chance + victim->level - ch->level)
return FALSE;
act ("You manage to keep $n out of range.",
ch, NULL, victim, TO_VICT);
act ("$N's weapon keeps you out of range.",
ch, NULL, victim, TO_CHAR);
check_improve (victim, gsn_polearm, TRUE, 4);
return TRUE;
}
/*
* Critical hit damage modifier for axes.
*/
int axe_special (CHAR_DATA * ch, CHAR_DATA * victim, int dam)
{
int chance;
/*
* Make sure we have an axe.
*/
if (get_weapon_sn (ch) != gsn_axe)
return dam;
/*
* Base is 1/5th our axe skill. Bonus if victim can't see us, penalty
* if we can't see them.
*/
chance = get_skill (ch, gsn_axe) / 5;
if (!can_see (victim, ch))
chance *= 1.5;
if (!can_see (ch, victim))
chance /= 3;
if (number_percent () >= chance)
return dam;
/*
* We got a critical hit!
*/
dam += dam * (get_skill (ch, gsn_axe) / 2) / 100;
check_improve (victim, gsn_axe, TRUE, 4);
return dam;
}