On Thu, 22 Feb 1996 BODE@juncol.juniata.edu wrote:
> I'm attempting to implement some new skills for fighter-types, and I noticed
> that each character has one attack per round (not counting kick, punch, etc.).
> Now I'm sure that someone has done this many times before, but how the ?????
> would you go about doing multiple automatic attacks per round? I figure that
> you would have to change both act.violent.c and fight.c in some way. Any
> answers?
I have done this. The first thing I did was change the name of the
hit() function to single_hit(). Then I wrote a new hit() function which
you see below. Basically, it keeps the number of attacks per round in
one variable, the number of left over "unused attack parts" from the last
round, and then adds them together, subtracting the number of "parts"
each attack until there aren't enough parts left and the character has to
wait until the next round. I hope you understood that gibberish I just
spewed out, but if not, look at the code and see. :) Also worth
mentioning is that multiple attacks are only invoked if the type of
attack is TYPE_UNDEFINED, which is important. If you care about
ambidexterity, you've got half the code needed to implement it below as
well. :)
This is of course just one way to implement multiple attacks. I
have seen many other ideas thrown around before as well about how they
should work.
void hit(struct char_data *ch, struct char_data *victim, int type)
{
void single_hit(struct char_data *ch, struct char_data *victim, int type);
if (type != TYPE_UNDEFINED)
single_hit(ch, victim, type);
else {
if (!FIGHTING(ch))
GET_APR_POINTS(ch) = 0;
for (GET_APR_POINTS(ch) += GET_APR(ch);
GET_APR_POINTS(ch) >= ATTACK_GRADE;
GET_APR_POINTS(ch) -= ATTACK_GRADE)
{
if (ch->in_room != victim->in_room) {
if (FIGHTING(ch))
stop_fighting(ch);
/* This is so we don't get double attacks next round. */
GET_APR_POINTS(ch) %= ATTACK_GRADE;
return;
}
single_hit(ch, victim, type);
}
if (LEARNABLE(ch, SKILL_AMBIDEX)
&& number(1, 100) <= GET_SKILL(ch, SKILL_AMBIDEX)
&& ch->equipment[WEAR_HOLD]
&& GET_OBJ_TYPE(ch->equipment[WEAR_HOLD]) == ITEM_WEAPON
&& !STYLE_FLAGGED(ch, STYLE_PARRY)) /* can't ambi when parrying */
single_hit(ch, victim, SKILL_AMBIDEX);
}
}
Michael Buselli
mhb@uchicago.edu
This archive was generated by hypermail 2b30 : 12/07/00 PST