|
From: <cro...@li...> - 2003-08-27 00:00:56
|
Module Name: crossfire
Committed By: temitchell
Date: Wed Aug 27 00:00:47 UTC 2003
Modified Files:
crossfire: ChangeLog
crossfire/common: init.c
crossfire/include: config.h global.h
crossfire/lib: settings
crossfire/server: attack.c c_misc.c init.c
Added Files:
crossfire/lib/help: peaceful
Log Message:
Added friendly_fire to attack.c, called from hit_player.
Will put a cap on maxdam that is a percentage (1-100%)
of damage (min 1)based on SET_FRIENDLY_FIRE value (in settings)when
players attack other players in peaceful mode. Changed who, statistics
commands to show this setting better and added a help file for peaceful.
It would be nice to have a indicator (even a toggle button?)in the
client for this as well.
Start of context diffs
Index: crossfire/ChangeLog
diff -c crossfire/ChangeLog:1.71 crossfire/ChangeLog:1.72
*** crossfire/ChangeLog:1.71 Tue Jul 8 05:45:04 2003
--- crossfire/ChangeLog Tue Aug 26 17:00:44 2003
***************
*** 17,22 ****
--- 17,30 ----
------------------------------------------------------------------------------
Changes for CVS:
+ friendly_fire:
+ Added friendly_fire to attack.c, called from hit_player.
+ Will put a cap on maxdam that is a percentage (1-100%) of damage (min 1)
+ based on SET_FRIENDLY_FIRE value when players attack in peaceful mode.
+ Changed who, statistics to show this setting better and added help file for peaceful.
+ It would be nice to have a indicator in the client for this as well.
+ TM - 2003-08-25
+
protocol/doc/code:
Changed the way smoothing is done. Switched the smooth
command to binary mode, rebuild archetype files, added doc
***************
*** 8774,8777 ****
Have it re-draw the look window when you middle click on something (ie
apply) in that window. This fixes a bug with bags/sacks, of it
not updating when an item is used directly from a sack.
-
--- 8782,8784 ----
Index: crossfire/common/init.c
diff -c crossfire/common/init.c:1.31 crossfire/common/init.c:1.32
*** crossfire/common/init.c:1.31 Thu Jun 19 03:59:26 2003
--- crossfire/common/init.c Tue Aug 26 17:00:45 2003
***************
*** 1,6 ****
/*
* static char *rcsid_init_c =
! * "$Id: init.c,v 1.31 2003/06/19 10:59:26 tchize Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_init_c =
! * "$Id: init.c,v 1.32 2003/08/27 00:00:45 temitchell Exp $";
*/
/*
***************
*** 69,74 ****
--- 69,75 ----
RECYCLE_TMP_MAPS,
EXPLORE_MODE,
SPELLPOINT_LEVEL_DEPEND,
+ SET_FRIENDLY_FIRE,
MOTD,
"", /* DM_MAIL */
0, /* This and the next 3 values are metaserver values */
***************
*** 411,414 ****
LOG(llevDebug, "got %d messages in %d categories.\n", total, mess+1);
close_and_delete(fp, comp);
}
-
--- 412,414 ----
Index: crossfire/include/config.h
diff -c crossfire/include/config.h:1.55 crossfire/include/config.h:1.56
*** crossfire/include/config.h:1.55 Fri Jul 25 19:10:40 2003
--- crossfire/include/config.h Tue Aug 26 17:00:45 2003
***************
*** 1,6 ****
/*
* static char *rcsid_config_h =
! * "$Id: config.h,v 1.55 2003/07/26 02:10:40 temitchell Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_config_h =
! * "$Id: config.h,v 1.56 2003/08/27 00:00:45 temitchell Exp $";
*/
/*
***************
*** 132,137 ****
--- 132,138 ----
#define EXPLORE_MODE FALSE
#define STAT_LOSS_ON_DEATH FALSE
#define CASTING_TIME FALSE
+ #define SET_FRIENDLY_FIRE 5
/* you can edit the ones below */
Index: crossfire/include/global.h
diff -c crossfire/include/global.h:1.42 crossfire/include/global.h:1.43
*** crossfire/include/global.h:1.42 Sat Aug 2 09:25:22 2003
--- crossfire/include/global.h Tue Aug 26 17:00:45 2003
***************
*** 1,6 ****
/*
* static char *rcsid_global_h =
! * "$Id: global.h,v 1.42 2003/08/02 16:25:22 tchize Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_global_h =
! * "$Id: global.h,v 1.43 2003/08/27 00:00:45 temitchell Exp $";
*/
/*
***************
*** 325,330 ****
--- 325,331 ----
uint8 search_items; /* search_items command */
uint8 spell_encumbrance; /* encumbrance effects spells */
uint8 spell_failure_effects; /* nasty backlash to spell failures */
+ uint16 set_friendly_fire; /* Percent of damage done by peaceful player vs player damage */
uint8 casting_time; /* it takes awhile to cast a spell */
uint8 real_wiz; /* use mud-like wizards */
uint8 recycle_tmp_maps; /* re-use tmp maps. */
Index: crossfire/lib/settings
diff -c crossfire/lib/settings:1.10 crossfire/lib/settings:1.11
*** crossfire/lib/settings:1.10 Thu Jun 19 03:59:33 2003
--- crossfire/lib/settings Tue Aug 26 17:00:46 2003
***************
*** 173,175 ****
--- 173,181 ----
use_permanent_experience false
+ # This allows reduced damage against other players when in
+ # peaceful mode. The value is the percent of damage done
+ # compared to normal. This does not change damage done
+ # by not targeted things like walls, explosions, cone spells, disease, poison...
+
+ set_friendly_fire 5
Index: crossfire/lib/help/peaceful
diff -c /dev/null crossfire/lib/help/peaceful:1.1
*** /dev/null Tue Aug 26 17:00:48 2003
--- crossfire/lib/help/peaceful Tue Aug 26 17:00:46 2003
***************
*** 0 ****
--- 1,8 ----
+ The 'peaceful' command will switch you between peaceful and hostile attack modes.
+
+ When peaceful is on you will not automatically attack other player when bumping into them and will do reduced damage against other players if you do attack them (friendly fire).
+ Having peaceful mode on only lowers damage against other players, it has no effect on damage done to monsters or other NPCs, so it is generally advisable to remain in peaceful mode unless you are looking for trouble.
+ It is still entirely possible to kill other players when in peaceful mode so you should still be careful when interacting with other players.
+ Hostile mode (peaceful off) will enable melee combat when bumping into other players and does normal damage for other attacks as well.
+
+ Damage done by area effect attacks like cone spells, explosive detonations, fireballs, poisons, cloud or swarm attacks, runes or disease are not modified by peaceful/hostile mode.
Index: crossfire/server/attack.c
diff -c crossfire/server/attack.c:1.89 crossfire/server/attack.c:1.90
*** crossfire/server/attack.c:1.89 Thu Jun 26 04:27:43 2003
--- crossfire/server/attack.c Tue Aug 26 17:00:46 2003
***************
*** 1,6 ****
/*
* static char *rcsid_attack_c =
! * "$Id: attack.c,v 1.89 2003/06/26 11:27:43 gros Exp $";
*/
/*
CrossFire, A Multiplayer game for X-windows
--- 1,6 ----
/*
* static char *rcsid_attack_c =
! * "$Id: attack.c,v 1.90 2003/08/27 00:00:46 temitchell Exp $";
*/
/*
CrossFire, A Multiplayer game for X-windows
***************
*** 1574,1579 ****
--- 1574,1612 ----
return maxdam;
}
+ /* Find out if this is friendly fire (PVP and attacker is peaceful) or not
+ * Returns 0 this is not friendly fire
+ */
+
+ int friendly_fire(object *op, object *hitter){
+ object *owner;
+ int friendlyfire;
+
+ if (hitter->head) hitter=hitter->head;
+
+ friendlyfire = 0;
+
+ if(op->type == PLAYER){
+
+ if(hitter->type == PLAYER && hitter->contr->peaceful == 1)
+ return 1;
+
+ if(owner = get_owner(hitter)){
+ if(owner->type == PLAYER && owner->contr->peaceful == 1)
+ friendlyfire = 2;
+ }
+
+ if(hitter->type == CONE || hitter->type == FBALL || hitter->type == FIREWALL
+ || hitter->type == SWARM_SPELL || hitter->type == POISONCLOUD
+ || hitter->type == POISONING || hitter->type == DISEASE || hitter->type == RUNE)
+
+ friendlyfire = 0;
+ }
+
+ return friendlyfire;
+ }
+
+
/* This isn't used just for players, but in fact most objects.
* op is the object to be hit, dam is the amount of damage, hitter
* is what is hitting the object, and type is the attacktype.
***************
*** 1591,1596 ****
--- 1624,1630 ----
int simple_attack;
tag_t op_tag, hitter_tag;
int rtn_kill = 0;
+ int friendlyfire;
if (get_attack_mode (&op, &hitter, &simple_attack))
return 0;
***************
*** 1702,1708 ****
maxdam = ndam;
maxattacktype = 1<<attacknum;
}
! }
}
#ifdef ATTACK_DEBUG
--- 1736,1754 ----
maxdam = ndam;
maxattacktype = 1<<attacknum;
}
!
! /* if this is friendly fire then do a set % of damage only*/
! friendlyfire = friendly_fire(op, hitter);
! if (friendlyfire){
!
! maxdam = ((dam * settings.set_friendly_fire) / 100)+1;
!
! #ifdef ATTACK_DEBUG
! LOG(llevDebug,"Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n",
! friendlyfire, settings.set_friendly_fire, dam, maxdam);
! #endif
! }
! }
}
#ifdef ATTACK_DEBUG
***************
*** 2120,2124 ****
||op->type==FBULLET||op->type==FBALL))
return 1;
return 0;
! }
!
--- 2166,2169 ----
||op->type==FBULLET||op->type==FBALL))
return 1;
return 0;
! }
Index: crossfire/server/c_misc.c
diff -c crossfire/server/c_misc.c:1.33 crossfire/server/c_misc.c:1.34
*** crossfire/server/c_misc.c:1.33 Mon Jun 30 12:59:20 2003
--- crossfire/server/c_misc.c Tue Aug 26 17:00:47 2003
***************
*** 1,6 ****
/*
* static char *rcsid_c_misc_c =
! * "$Id: c_misc.c,v 1.33 2003/06/30 19:59:20 tchize Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_c_misc_c =
! * "$Id: c_misc.c,v 1.34 2003/08/27 00:00:47 temitchell Exp $";
*/
/*
***************
*** 265,278 ****
pl->socket.host,
pl->ob->map->path,
QUERY_FLAG(pl->ob,FLAG_WIZ)?" [WIZ]":"",
! pl->peaceful?"P":"W",pl->ob->count);
else
! (void) sprintf(buf,"%s the %s (@%s) [%s]%s%s",pl->ob->name,
(pl->own_title[0]=='\0'?pl->title:pl->own_title),
- pl->socket.host,
pl->ob->map->path,
QUERY_FLAG(pl->ob,FLAG_WIZ)?" [WIZ]":"",
! pl->peaceful?"P":"W");
new_draw_info(NDI_UNIQUE, 0,op,buf);
}
}
--- 265,277 ----
pl->socket.host,
pl->ob->map->path,
QUERY_FLAG(pl->ob,FLAG_WIZ)?" [WIZ]":"",
! pl->peaceful?"Peaceful":"Hostile",pl->ob->count);
else
! (void) sprintf(buf,"%s the %s [%s]%s%s",pl->ob->name,
(pl->own_title[0]=='\0'?pl->title:pl->own_title),
pl->ob->map->path,
QUERY_FLAG(pl->ob,FLAG_WIZ)?" [WIZ]":"",
! pl->peaceful?"Peaceful":"Hostile");
new_draw_info(NDI_UNIQUE, 0,op,buf);
}
}
***************
*** 633,639 ****
pl->contr->orig_stats.Pow, pl->stats.Pow, 20+pl->arch->clone.stats.Pow);
new_draw_info_format(NDI_UNIQUE, 0, pl, "Cha %2d/ %3d/%3d",
pl->contr->orig_stats.Cha, pl->stats.Cha, 20+pl->arch->clone.stats.Cha);
!
/* Can't think of anything else to print right now */
return 0;
}
--- 632,639 ----
pl->contr->orig_stats.Pow, pl->stats.Pow, 20+pl->arch->clone.stats.Pow);
new_draw_info_format(NDI_UNIQUE, 0, pl, "Cha %2d/ %3d/%3d",
pl->contr->orig_stats.Cha, pl->stats.Cha, 20+pl->arch->clone.stats.Cha);
! new_draw_info_format(NDI_UNIQUE, 0, pl, "\nAttack Mode: %s",pl->contr->peaceful? "Peaceful":"Hostile");
!
/* Can't think of anything else to print right now */
return 0;
}
Index: crossfire/server/init.c
diff -c crossfire/server/init.c:1.48 crossfire/server/init.c:1.49
*** crossfire/server/init.c:1.48 Sun Mar 23 22:58:33 2003
--- crossfire/server/init.c Tue Aug 26 17:00:47 2003
***************
*** 1,6 ****
/*
* static char *rcsid_init_c =
! * "$Id: init.c,v 1.48 2003/03/24 06:58:33 mwedel Exp $";
*/
/*
--- 1,6 ----
/*
* static char *rcsid_init_c =
! * "$Id: init.c,v 1.49 2003/08/27 00:00:47 temitchell Exp $";
*/
/*
***************
*** 584,589 ****
--- 584,597 ----
LOG(llevError,"load_settings: Unkown value for simple_exp: %s\n",
cp);
}
+ } else if (!strcasecmp(buf, "set_friendly_fire")) {
+ int val = atoi(cp);
+
+ if (val < 1 || val >100)
+ LOG(llevError, "load_settings: set_friendly_fire must be between 1 an 100"
+ ", %d is invalid\n", val);
+ else
+ settings.set_friendly_fire = val;
} else {
LOG(llevError,"Unknown value in settings file: %s\n", buf);
}
***************
*** 1051,1054 ****
return test;
}
-
--- 1059,1061 ----
|