|
Multi Attack for Mobs [by Christian Duvall] |
|
|
|
Posted Wednesday, August 12th @ 11:31:53 PM, by George Greer in the Mobiles dept.
Added Jun 23, 1997. Click the link below to read it or download it.
From: Christian Duvall <chris@dp.net>
Subject: Multi Attacks for mobiles
Code developed by Chris Rehbein(lint@jhu.edu) and I for multi attacks on
mobiles. This works on a percentage based system where a mob has prob of
hitting anywhere from 0-100% on each of its, 2nd, 3rd, and 4th attacks.
Any problems, comments, questions- good/bad email me chris@dp.net
****** In structs.h ******
In: mob_special_data
add:
int attack1;
int attack2;
int attack3;
***** fight.c ******
In: perform_violence()
Add:
int perc, val, apr;
if (IS_NPC(ch)) {
perc = number(1, 101);
val = ch->mob_specials.attack1;
if (val > perc) {
apr++;
perc = number(1,101);
val = ch->mob_specials.attack2;
if (val > perc) {
apr++;
perc = number(1,101);
val = ch->mob_specials.attack3;
if (val > perc) {
apr++;
}
}
}
}
/* NOT MY CODE, just in case you didnt use the same multi attack for
players code as I did */
apr = MAX(-1, MIN(apr, 4));
if (apr >= 0) {
for (; apr >= 0 && FIGHTING(ch); apr--)
hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
}
****** db.c ****
Find: (in the E-specs)
CASE("Cha") {
RANGE(3, 25);
mob_proto[i].real_abils.cha = num_arg;
}
Add:
CASE("Att1") {
RANGE(1, 100);
mob_proto[i].mob_specials.attack1 = num_arg;
}
CASE("Att2") {
RANGE(1, 100);
mob_proto[i].mob_specials.attack2 = num_arg;
}
CASE("Att3") {
RANGE(1, 100);
mob_proto[i].mob_specials.attack3 = num_arg;
}
******* medit.c ******
Find: #define S_KEEPER(shop) ((shop)->keeper)
Add:
#define GET_ATTACK1(mob) ((mob)->mob_specials.attack1)
#define GET_ATTACK2(mob) ((mob)->mob_specials.attack2)
#define GET_ATTACK3(mob) ((mob)->mob_specials.attack3)
Find: if(GET_CHA(mob) != 11)
fprintf(mob_file, "Cha: %d\n", GET_CHA(mob));
Add:
f(GET_ATTACK1(mob) != 0)
fprintf(mob_file, "Att1: %d\n", GET_ATTACK1(mob));
if(GET_ATTACK2(mob) != 0)
fprintf(mob_file, "Att2: %d\n", GET_ATTACK2(mob));
if(GET_ATTACK3(mob) != 0)
fprintf(mob_file, "Att3: %d\n", GET_ATTACK3(mob));
Find:
"%sI%s) Position : %s%s\r\n"
"%sJ%s) Default : %s%s\r\n"
"%sK%s) Attack : %s%s\r\n"
< etc >
"%sQ%s) Quit\r\n"
"Enter choice : ",
Change to:
"%sI%s) Position : %s%s\r\n"
"%sJ%s) Default : %s%s\r\n"
"%sK%s) Attack : %s%s\r\n"
"%sL%s) Attack-2 : %s%d\r\n"
"%sM%s) Attack-3 : %s%d\r\n"
"%sN%s) Attack-4 : %s%d\r\n"
"%sO%s) NPC Flags : %s%s\r\n"
"%sP%s) AFF Flags : %s%s\r\n"
"%sQ%s) Quit\r\n"
"Enter choice : ",
Find:
grn, nrm, yel, attack_hit_text[GET_ATTACK(mob)].singular,
Add right below:
grn, nrm, yel, GET_ATTACK1(mob),
grn, nrm, yel, GET_ATTACK2(mob),
grn, nrm, yel, GET_ATTACK3(mob),
Find:
case 'k':
case 'K':
OLC_MODE(d) = MEDIT_ATTACK;
medit_disp_attack_types(d);
return;
erase up to default, and change to:
case 'l':
case 'L':
OLC_MODE(d) = MEDIT_ATTACK1;
i++;
break;
case 'm':
case 'M':
OLC_MODE(d) = MEDIT_ATTACK2;
i++;
break;
case 'n':
case 'N':
OLC_MODE(d) = MEDIT_ATTACK3;
i++;
break;
case 'o':
case 'O':
OLC_MODE(d) = MEDIT_NPC_FLAGS;
medit_disp_mob_flags(d);
return;
case 'p':
case 'P':
OLC_MODE(d) = MEDIT_AFF_FLAGS;
medit_disp_aff_flags(d);
return;
Find:
case MEDIT_ATTACK:
GET_ATTACK(OLC_MOB(d)) = MAX(0, MIN(NUM_ATTACK_TYPES-1, atoi(arg)));
break;
Add:
case MEDIT_ATTACK1:
GET_ATTACK1(OLC_MOB(d)) = MAX(0, MIN(200, atoi(arg)));
break;
case MEDIT_ATTACK2:
GET_ATTACK2(OLC_MOB(d)) = MAX(0, MIN(200, atoi(arg)));
break;
case MEDIT_ATTACK3:
GET_ATTACK3(OLC_MOB(d)) = MAX(0, MIN(200, atoi(arg)));
break;
Christian Duvall
chris@dp.net
<< Monkeys. Exploding Monkeys! [by Jason Buckler] | Reply | View as text | Flattened | Multi Attack Pointers [by ?] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|