Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CF 0.91.7-patch NEW_IMPROVE_WEAPON
- To: crossfire (at) ifi.uio.no
- Subject: CF 0.91.7-patch NEW_IMPROVE_WEAPON
- From: Tero Jyri Michael Pelander <>
- Date: Tue, 31 Jan 1995 04:39:27 +0200 (EET)
Two bugs in NEW_IMPROVE_WEAPON code.
'prepare weapon':
the diamonds were not destroyed when the scroll was used.
all stat scrolls:
no stat gains were done but the potions were destroyed.
*** server/apply.OLD Tue Jan 31 02:00:12 1995
--- server/apply.c Tue Jan 31 03:08:34 1995
***************
*** 207,221 ****
* Weapon improvement code follows
****************************************************************************/
int check_item(object *op,char *item)
{
-
int count=0;
op=op->below;
-
while(op!=NULL) {
if (strcmp(op->arch->name,item)==0) {
if (!QUERY_FLAG(op, FLAG_CURSED) && !QUERY_FLAG(op, FLAG_DAMNED))
count += op->nrof;
}
--- 207,221 ----
* Weapon improvement code follows
****************************************************************************/
int check_item(object *op,char *item)
{
int count=0;
+ if (item==NULL)
+ return 0;
op=op->below;
while(op!=NULL) {
if (strcmp(op->arch->name,item)==0) {
if (!QUERY_FLAG(op, FLAG_CURSED) && !QUERY_FLAG(op, FLAG_DAMNED))
count += op->nrof;
}
***************
*** 240,298 ****
prev = op;
op=op->below;
}
}
int check_sacrifice(object *op,object *improver)
{
int count;
! #ifndef NEW_IMPROVE_WEAPON
if (check_item(op,"food")<5) {
new_draw_info(NDI_UNIQUE,0,op,"The gods want more food.");
return 0;
}
if (check_item(op,"booze")<10) {
new_draw_info(NDI_UNIQUE,0,op,"The gods want more booze.");
return 0;
}
- #endif
count = 0;
if (improver->slaying!=NULL) {
count = check_item(op,improver->slaying);
if (count<1) {
! char buf[200];
! sprintf(buf,"The gods want more %ss",improver->slaying);
! new_draw_info(NDI_UNIQUE,0,op,buf);
return 0;
}
- #ifndef NEW_IMPROVE_WEAPON
eat_item(op,improver->slaying);
- #endif
}
else
count=1;
- #ifndef NEW_IMPROVE_WEAPON
eat_item(op,"food");
eat_item(op,"booze");
- #endif
return count;
}
int improve_weapon_stat(object *op,object *improver,object *weapon,
signed char *stat,int sacrifice_count,char *statname)
{
! char buf[200];
!
if (sacrifice_count<2)
return 0;
sacrifice_count = isqrt(sacrifice_count/2);
new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted.");
*stat += sacrifice_count;
weapon->last_eat++;
! sprintf(buf,"Weapon's bonus to %s improved by %d",statname,sacrifice_count);
! new_draw_info(NDI_UNIQUE,0,op,buf);
decrease_ob(improver);
/* So it updates the players stats and the window */
fix_player(op);
return 1;
}
--- 240,294 ----
prev = op;
op=op->below;
}
}
+ #ifndef NEW_IMPROVE_WEAPON
int check_sacrifice(object *op,object *improver)
{
int count;
!
if (check_item(op,"food")<5) {
new_draw_info(NDI_UNIQUE,0,op,"The gods want more food.");
return 0;
}
if (check_item(op,"booze")<10) {
new_draw_info(NDI_UNIQUE,0,op,"The gods want more booze.");
return 0;
}
count = 0;
if (improver->slaying!=NULL) {
count = check_item(op,improver->slaying);
if (count<1) {
! new_draw_info_format(NDI_UNIQUE,0,op,"The gods want more %ss",
! improver->slaying);
return 0;
}
eat_item(op,improver->slaying);
}
else
count=1;
eat_item(op,"food");
eat_item(op,"booze");
return count;
}
+ #endif
int improve_weapon_stat(object *op,object *improver,object *weapon,
signed char *stat,int sacrifice_count,char *statname)
{
! #ifndef NEW_IMPROVE_WEAPON
if (sacrifice_count<2)
return 0;
sacrifice_count = isqrt(sacrifice_count/2);
+ #endif
new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted.");
*stat += sacrifice_count;
weapon->last_eat++;
! new_draw_info_format(NDI_UNIQUE,0,op,"Weapon's bonus to %s improved by %d",
! statname,sacrifice_count);
decrease_ob(improver);
/* So it updates the players stats and the window */
fix_player(op);
return 1;
}
***************
*** 453,470 ****
*/
if (weapon->immune || weapon->protected ||
weapon->stats.hp || /* regeneration */
weapon->stats.sp || /* sp regeneration */
weapon->stats.exp || /* speed */
! weapon->stats.ac) /* AC - only taifu's I think */
{
new_draw_info(NDI_UNIQUE,0,op,"Cannot prepare magic weapons.");
return 0;
}
! sacrifice_count=check_sacrifice(op,improver);
! if (sacrifice_count<=0)
return 0;
sacrifice_count = isqrt(sacrifice_count);
weapon->level=sacrifice_count;
new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted.");
new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.",
--- 449,470 ----
*/
if (weapon->immune || weapon->protected ||
weapon->stats.hp || /* regeneration */
weapon->stats.sp || /* sp regeneration */
weapon->stats.exp || /* speed */
! weapon->stats.ac) /* AC - only taifu's I think */
{
new_draw_info(NDI_UNIQUE,0,op,"Cannot prepare magic weapons.");
return 0;
}
! sacrifice_count=check_item(op,improver->slaying);
! if (sacrifice_count<=0) {
! new_draw_info_format(NDI_UNIQUE,0,op,"The gods want more %ss",
! improver->slaying);
return 0;
+ }
+ eat_item(op,improver->slaying);
sacrifice_count = isqrt(sacrifice_count);
weapon->level=sacrifice_count;
new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted.");
new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.",
***************
*** 545,555 ****
if (sacrifice_needed<1)
sacrifice_needed =1;
sacrifice_needed *=2;
! sacrifice_count = check_sacrifice(op,improver);
if (sacrifice_count < sacrifice_needed) {
new_draw_info_format(NDI_UNIQUE, 0, op,
"You need at least %d %s", sacrifice_needed, improver->slaying);
return 0;
}
--- 545,555 ----
if (sacrifice_needed<1)
sacrifice_needed =1;
sacrifice_needed *=2;
! sacrifice_count = check_item(op,improver->slaying);
if (sacrifice_count < sacrifice_needed) {
new_draw_info_format(NDI_UNIQUE, 0, op,
"You need at least %d %s", sacrifice_needed, improver->slaying);
return 0;
}