|
From: <cro...@li...> - 2002-12-14 07:04:35
|
Module Name: crossfire
Committed By: garbled
Date: Sat Dec 14 07:04:32 UTC 2002
Modified Files:
crossfire/lib: treasures
crossfire/server: spell_effect.c
Log Message:
Per the comment above summon_pet, I have modified summon_pet() to use the
treasurelist, rather than the built-in compiled list.
Start of context diffs
Index: crossfire/lib/treasures
diff -c crossfire/lib/treasures:1.52 crossfire/lib/treasures:1.53
*** crossfire/lib/treasures:1.52 Thu Sep 12 23:32:12 2002
--- crossfire/lib/treasures Fri Dec 13 23:04:31 2002
***************
*** 1,6 ****
# This file contains various treasures, with generation rules.
#
! # $Id: treasures,v 1.52 2002/09/13 06:32:12 mwedel Exp $
#
# As of version 0.91.1, what this file was extended to handle list
# re-linking and generation of only 1 item on that list. This does away
--- 1,6 ----
# This file contains various treasures, with generation rules.
#
! # $Id: treasures,v 1.53 2002/12/14 07:04:31 garbled Exp $
#
# As of version 0.91.1, what this file was extended to handle list
# re-linking and generation of only 1 item on that list. This does away
***************
*** 440,445 ****
--- 440,500 ----
arch spelldirect_poison_cloud
more
arch poison_clawing
+ end
+ ##############################################################
+ #
+ # Pet Monsters -
+ #
+ treasure mage_pet_monster
+ arch bat
+ nrof 2
+ more
+ arch spider
+ nrof 1
+ more
+ arch stalker
+ nrof 1
+ more
+ arch beholder
+ nrof 2
+ more
+ arch dark_elf
+ nrof 3
+ more
+ end
+ treasure altern_pet_monster
+ arch bird
+ nrof 1
+ more
+ arch pixie
+ nrof 1
+ more
+ arch skeleton
+ nrof 2
+ more
+ arch skull
+ nrof 1
+ more
+ arch vampire
+ nrof 1
+ more
+ end
+ treasure priest_pet_monster
+ arch bee
+ nrof 3
+ more
+ arch killer_bee
+ nrof 2
+ more
+ arch devil
+ nrof 2
+ more
+ arch angel
+ nrof 2
+ more
+ arch panther
+ nrof 5
+ more
end
##############################################################
#
Index: crossfire/server/spell_effect.c
diff -c crossfire/server/spell_effect.c:1.83 crossfire/server/spell_effect.c:1.84
*** crossfire/server/spell_effect.c:1.83 Wed Dec 11 13:31:00 2002
--- crossfire/server/spell_effect.c Fri Dec 13 23:04:32 2002
***************
*** 1,6 ****
/*
* static char *rcsid_spell_effect_c =
! * "$Id: spell_effect.c,v 1.83 2002/12/11 21:31:00 garbled Exp $";
*/
--- 1,6 ----
/*
* static char *rcsid_spell_effect_c =
! * "$Id: spell_effect.c,v 1.84 2002/12/14 07:04:32 garbled Exp $";
*/
***************
*** 1741,1823 ****
}
! /* this pet monster stuff is total crap!
! * We should replace it with:
! * struct summoned_mon int foo {
! * char * mon_arch;
! * int num_summoned;
! * }
! * struct summoned_mon pets_summoned = {
! * { "bird", 5 },
! * { "vampire", 6},
! * { NULL, 0 } -* terminator *-
! * }
! *
* Or even better, use treasure lists for this,
* eg, mage_pet_monster treasure list, etc. Means
* that these could be changed without recompiling the server.
*/
- #define MAX_PET_MONSTERS 5
- char mage_pet_monsters [MAX_PET_MONSTERS][16] =
- {"bat","spider","stalker","beholder","dark_elf"};
- int mage_num_called [MAX_PET_MONSTERS] = {2,1,1,2,3};
- char priest_pet_monsters [MAX_PET_MONSTERS][16] =
- {"bee","killer_bee","devil","angel","panther"};
- int priest_num_called [MAX_PET_MONSTERS] = {3,2,2,2,5};
- char altern_pet_monsters [MAX_PET_MONSTERS][16] =
- {"bird","pixie","skeleton","skull","vampire"};
- int altern_num_called [MAX_PET_MONSTERS] = {1,1,2,1,1};
-
-
-
int summon_pet(object *op, int dir, SpellTypeFrom item) {
int level, number, i;
char *monster;
! archetype *at;
level = ((op->head?op->head->level:SK_level(op)) / 4);
- if (level >= MAX_PET_MONSTERS)
- level = MAX_PET_MONSTERS - 1;
switch(rndm(0, 2)) {
case 0:
! number = priest_num_called[level];
! monster = priest_pet_monsters[level];
break;
case 1:
! number = mage_num_called[level];
! monster = mage_pet_monsters[level];
break;
-
default:
! number = altern_num_called[level];
! monster = altern_pet_monsters[level];
break;
}
! at = find_archetype(monster);
! if(at == NULL) {
! LOG(llevError,"Unknown archetype in summon pet: %s\n",monster);
return 0;
}
if (!dir)
! dir = find_free_spot(at, op->map, op->x, op->y, 1, SIZEOFFREE);
! if((dir==-1) || arch_blocked(at,op->map, op->x + freearr_x[dir], op->y+freearr_y[dir])) {
! new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way.");
return 0;
}
for (i = 1; i < number + 1; i++) {
archetype *atmp;
object *prev = NULL, *head = NULL; /* We want to summon dragons *grin* */
! for(atmp = at; atmp!=NULL; atmp = atmp->more) {
object *tmp;
tmp = arch_to_object(atmp);
/* if this is the head, set owner/friendly as needed */
! if (atmp == at) {
set_owner(tmp, op);
SET_FLAG(tmp, FLAG_MONSTER);
if (op->type == PLAYER) {
--- 1741,1807 ----
}
! /*
* Or even better, use treasure lists for this,
* eg, mage_pet_monster treasure list, etc. Means
* that these could be changed without recompiling the server.
+ *
+ * Garbled 2002-12-14
+ * Made summon_pet_monster use the treasurelist, as suggested above. Adding
+ * new lines to the treasures for these categories will automatically work.
*/
int summon_pet(object *op, int dir, SpellTypeFrom item) {
int level, number, i;
char *monster;
! treasurelist *trlist = NULL;
! treasure *tr, *prevtr;
level = ((op->head?op->head->level:SK_level(op)) / 4);
switch(rndm(0, 2)) {
case 0:
! trlist = find_treasurelist("mage_pet_monster");
break;
case 1:
! trlist = find_treasurelist("priest_pet_monster");
break;
default:
! trlist = find_treasurelist("altern_pet_monster");
break;
}
! if (trlist == NULL)
! return 0;
!
! for (i=0, tr=trlist->items; tr != NULL && i < level-1;
! prevtr = tr, tr = tr->next, i++);
!
! if(prevtr == NULL || prevtr->item == NULL) {
! LOG(llevError,"Treasurelist Found NULL in summon_pet_monster()\n");
return 0;
}
+
+ number = prevtr->nrof;
+
if (!dir)
! dir = find_free_spot(prevtr->item, op->map, op->x, op->y, 1, SIZEOFFREE);
! if ((dir==-1) || arch_blocked(prevtr->item, op->map,
! op->x + freearr_x[dir], op->y+freearr_y[dir])) {
! new_draw_info(NDI_UNIQUE, 0, op, "There is something in the way.");
return 0;
}
for (i = 1; i < number + 1; i++) {
archetype *atmp;
object *prev = NULL, *head = NULL; /* We want to summon dragons *grin* */
! for(atmp = prevtr->item; atmp!=NULL; atmp = atmp->more) {
object *tmp;
tmp = arch_to_object(atmp);
/* if this is the head, set owner/friendly as needed */
! if (atmp == prevtr->item) {
set_owner(tmp, op);
SET_FLAG(tmp, FLAG_MONSTER);
if (op->type == PLAYER) {
***************
*** 1861,1867 ****
SET_FLAG(tmp, FLAG_NO_DROP);
}
dir = absdir(dir + 1);
! if (arch_blocked(at,op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) {
if (i < number) {
new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way,");
new_draw_info(NDI_UNIQUE, 0,op, "no more pets for this casting.");
--- 1845,1851 ----
SET_FLAG(tmp, FLAG_NO_DROP);
}
dir = absdir(dir + 1);
! if (arch_blocked(prevtr->item, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) {
if (i < number) {
new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way,");
new_draw_info(NDI_UNIQUE, 0,op, "no more pets for this casting.");
|