From: "Christian Ejlertsen" <chr.ejlertsen@HAS.DK> > I've run into a problem with a manual spell I created. It's intended as > an area spell and it's working wonderfully until one mob dies then the > spell breaks out of it's loop and exits after that death I can't see > where this should since all it does is call the damage function and then > continues on which is exactly the same as mag_damage does in the end > therefor I can't see why it should stop Executing the spell. > <snip> > int ray_color = 0, doubleup = 0, dam = 0, rounds = 0, dead_yesno = 0; <snip> > for (vict = world[IN_ROOM(ch)].people; vict; vict = temp_ch) { > temp_ch = vict->next_in_room; ++ dead_yesno = 0; <snip> > for(rounds = 0; rounds < doubleup; rounds++) { > if (dead_yesno < 0) > continue; > switch(ray_color) { > case 1: <snip> > dead_yesno = damage(ch, vict, > dam, SPELL_PRISMATIC_SPRAY); > break; <snip> Here you set dead_yesno to -1 if the victim dies. You never restore it, so all following loops just skip the casting and damage. Add the (++) line above to have it the way you want. If you wish to have the loops cleaner, you might consider removing the switch statement fom the middle of it. Here's a short rewrite; struct prismatic_info_t { const char *to_char; const char *to_room; const char *to_vict; int affect; int div; int mult; int add; } prismatic_info[] = { { "You hit $N with a spray of gleaming red.", "$N is hit by $n's spray of gleaming red.", "You are hit by a ray of gleaming red.", SPELL_WEAKEN, 5, 4, 10 }, { "You hit $N with a spray of bright orange.", "$N is hit by $n's spray of bright orange.", "You are hit by a ray of bright orange.", SPELL_BLINDNESS, 5, 6, 20 }, { "You hit $N with a spray of sparkling yellow.", "$N is hit by $n's spray of sparkling yellow.", "You are hit by a ray of sparkling yellow.", 0, 4, 8, 30 }, { "You hit $N with a spray of dark green.", "$N is hit by $n's spray of dark green.", "You are hit by a ray of dark green.", SPELL_POISON, 5, 4, 10 }, { "You hit $N with a spray of amazing blue.", "$N is hit by $n's spray of amazing blue.", "You are hit by a ray of amazing blue.", SPELL_HOLD_MONSTER, 5, 4, 10 }, { "You hit $N with a spray of gleaming indigo.", "$N is hit by $n's spray of gleaming indigo.", "You are hit by a ray of gleaming indigo.", SPELL_SILENCE, 5, 4, 10 }, { "You hit $N with a spray of murky violet.", "$N is hit by $n's spray of murky violet.", "You are hit by a ray of murky violet.", 0, 5, 4, 10 } }; ASPELL(spell_prismatic_spray) { struct char_data *vict, *temp_ch; int ray_color = 0, doubleup = 0, dam = 0, rounds = 0, dead_yesno; act("$n hand issues a spray of prismatic colors.", FALSE, ch, 0, 0, TO_ROOM); act("Your hand issues a spray of prismatic colors.", FALSE, ch, 0, 0, TO_CHAR); for (vict = world[IN_ROOM(ch)].people; vict; vict = temp_ch) { temp_ch = vict->next_in_room; dead_yesno = 0; if (vict == ch) continue; if (!IS_NPC(vict) && AFF_FLAGGED(vict, AFF_GROUP) && (vict->master == ch->master || vict->master == ch)) continue; if (AFF_FLAGGED(vict, AFF_CHARM) && vict->master == ch->master) continue; ray_color = number(0, 7); if (ray_color == 7) { doubleup = 2; ray_color = number(0, 6); } else doubleup = 1; for(rounds = 0; rounds < doubleup; rounds++) { if (dead_yesno < 0) continue; act(prismatic_info[ray_color].to_char, FALSE, ch, 0, vict, TO_CHAR); act(prismatic_info[ray_color].to_room, FALSE, ch, 0, vict, TO_ROOM); act(prismatic_info[ray_color].to_vict, FALSE, ch, 0, vict, TO_VICT); if (prismatic_info[ray_color].affect) mag_affects(GET_LEVEL(ch), ch, vict, prismatic_info[ray_color].affect, 0); dam = ((GET_LEVEL(ch)/prismatic_info[ray_color].div) * prismatic_info[ray_color].mult) + prismatic_info[ray_color].add; dead_yesno = damage(ch, vict, dam, SPELL_PRISMATIC_SPRAY); ray_color = number(0, 6); } } } Welcor -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/26/03 PDT