On Thu, 12 Dec 1996, Nicholas S. Wourms wrote: > Has anyone sucessfully implemented multiple attack skills? If so, how did > you revise the code from the snippet site. If you didn't get it from the > snippet site, could you show me what you did? Thanks in advance! In perform_violence(), fight.c find the lines: hit(ch, FIGHTING(ch), TYPE_UNDEFINED); if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL) (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""); Change to: for (; apr >= 0 && FIGHTING(ch); apr--) hit(ch, FIGHTING(ch), TYPE_UNDEFINED); if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL) (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""); Now, at the beginning of perform_violence() add "int apr = 0;" and then before the above shown for() loop, do the skill checks: if (number(1, 200) <= GET_SKILL(ch, SKILL_SECOND_ATTACK)) apr++; if (number(1, 300) <= GET_SKILL(ch, SKILL_THIRD_ATTACK)) apr++; if (affected_by_spell(ch, SPELL_HASTE)) apr += number(0, 2); and continue on in that same method, incrementing 'apr' by one for each attack the person gets. You needn't change the for() loop and it does make sure that FIGHTING(ch) is not NULL before hitting. If apr is 0 it will only hit once (since apr is checked if it's >= 0, not just over, the check isn't true until we hit -1). Essentially, zero "counts" for an attack. -- Daniel Koepke dkoepke@california.com Forgive me father, for I am sin. +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST