On Thu, 27 Jun 1996, ????? wrote: > At 01:19 PM 6/27/96 +0200, you wrote: >> And my perform_violence() looks something like this (taken from head): >> >> [snip] >> As you can see, I added a new argument to the hit() function, the attack >> number. > void perform_violence(int APT) /* APT Attacks Per Turn */ > { > [snip] > for (lwp = apt; lwp <= 0; lwp--) > { > hit(ch, FIGHTING(ch), TYPE_UNDEFINED); > } No, that wouldn't work, that'd give everyone the same amount of attacks and it would crash because of a NULL FIGHTING(ch) pointer. Here's the proper code, assuming you add a variable to player_specials_saved (or whatever the structure is named) called apt, and a macro in utils..h to get the apt from a character... -at the top of perform_violence() with other casts- int atp; -in perform violence after the first hit() call- for (atp = 0; atp < GET_ATP(ch) && FIGHTING(ch); atp++) if (number(1, 100-(atp*5)) > number(1, 101)) hit(ch, FIGHTING(ch), TYPE_UNDEFINED); Note that it checks FIGHTING(ch) in the 'for' statement. This is so if FIGHTING(ch) becomes NULL it will exit the loop without calling hit() again. The reason I chose to have an 'atp' variable that is saved into the player file is because that gives you the ultimate flexibility and ease of use. That means you can have a skill (like SKILL_2ND_ATTACK) add a second attack to the character's atp, or choose a new route where you have a skill SKILL_INCREASE_ATP or something which when it hits LEARNED(ch) it is set back to 0 and atp is increased. Also take notice that the higher the attacks the greater chance of it missing. For instance, the first attack has a range of 1-95, while the second has a range of 1-90, the third would have a range of 1-85, and the fourth would have a range of 1-80. And so forth downward by five. This means that if someone has tons of attacks they don't always get them all. A good thing, too, IMHO. It becomes too easy to kill someone when you always get 3 attacks per round. -dak
This archive was generated by hypermail 2b30 : 12/18/00 PST