Mercurial > ~darius > hgwebdir.cgi > paradise_server
diff src/stats.c @ 8:0836fb919dfa
First entry of Paradise Server 2.9 patch 10 Beta
author | darius |
---|---|
date | Sat, 06 Dec 1997 04:37:05 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/stats.c Sat Dec 06 04:37:05 1997 +0000 @@ -0,0 +1,56 @@ +/*-------------------------------------------------------------------------- +NETREK II -- Paradise + +Permission to use, copy, modify, and distribute this software and its +documentation, or any derivative works thereof, for any NON-COMMERCIAL +purpose and without fee is hereby granted, provided that this copyright +notice appear in all copies. No representations are made about the +suitability of this software for any purpose. This software is provided +"as is" without express or implied warranty. + + Xtrek Copyright 1986 Chris Guthrie + Netrek (Xtrek II) Copyright 1989 Kevin P. Smith + Scott Silvey + Paradise II (Netrek II) Copyright 1993 Larry Denys + Kurt Olsen + Brandon Gillespie +--------------------------------------------------------------------------*/ + +#include "config.h" +#include "defs.h" +#include "struct.h" +#include "shmem.h" + +void +credit_armiesbombed(plyr, armies, plan) + struct player *plyr; + int armies; + struct planet *plan; +{ + double factor; + + if (!status->tourn) + return; /* nothing counts outside T-mode */ + + plyr->p_armsbomb += armies; /* inc armies bombed */ + + /* no honor in beating up on someone who isn't there */ + factor = (plan->pl_owner == NOBODY) ? 0.5 : 1.0; + + plyr->p_stats.st_di += 0.02 * armies * factor; /* inc players DI */ +#ifdef WB_BOMBING_CREDIT + if (plyr->p_ship.s_type == WARBASE) + plyr->p_stats.st_di += 0.02 * armies * factor; +#endif + plyr->p_kills += 0.02 * armies * factor; /* increase players kills */ + + armies = random_round(factor * armies); + + status->armsbomb += armies; + plyr->p_stats.st_tarmsbomb += armies; /* increase player stats */ +#ifdef WB_BOMBING_CREDIT + if (plyr->p_ship.s_type == WARBASE) + plyr->p_stats.st_tarmsbomb += armies; +#endif + checkmaxkills(plyr->p_no); /* check if over max kills */ +}