Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lots of diffs to hopefully make the game better



Here are a bunch of changes I've made.  I think this improves the
balance of the game better and prevents some stupidities like finding
mjollnier on top of an anthill in the bakery.
---------
These diffs make the following changes:
1. Fix a bug in setting difficulty of a level.  If the difficulty was 20 
or more the code thought it was difficulty 0.
2. Allow the healing spells to be cast on the player who casts them.
This happens if you cast the spell in a direction which there isn't a player
in.  This change also causes the spell to not do anything if the target
is at full strength.
3. A better way of figuring out the magic that an item should have.
This method is based on a table indexed for 14 different difficulty levels.
4. A better way of doing treasures.  This change makes it possible for
you to specify certain of the transitions between lists require a minimum
difficulty.  You can also specify if the difficulty of a map is not high
enough whether to keep looking for a treasure or leave it empty.
5. A hack to deal with a new archetype
6. Lots of changes to the treasure lists.
   Some of these changes adjust the balance a lot.  Other people should
   try this out and see what they think.
a. I made different helmets and shields have higher possible magic values.
   this makes a difference between the different types of helmets and 
     shields, the higher the weight the higher the magic can be.
b. Shops will no longer sell potions or artifacts.  It seemed unreasonable
   to be able to just buy artifacts, it made it too easy.  potions were
   eliminated because they chained to artifacts, and because they were too
   easy to buy and make yourself really powerful.  This is somewhat balanced
   by an increased chance of potions appearing.
   Shops will sell the ring of nodrain which allows people to buy something
   which will protect them from grimreapers but not give them a mondo
   weapon easily.  
c. It takes a minimum difficulty of 5 to get onto the simple artifacts list
   (dragon_mail,bracers_ac)  This actually includes most places.
d. It takes a minimum difficulty of 8 to get onto the super artifacts list
   (excalibur, bonecrusher, etc.)
e. Chances to get onto artifacts and super artifacts lists are increased
   if the difficulty is harder.
7. The ring of no drain archetype.

*** 1.1	1992/10/16 04:09:42
--- map.c	1992/10/18 00:39:03
***************
*** 886,891 ****
--- 886,892 ----
          }
        }
    exp_pr_sq=(1000*total_exp)/(m->mapx*m->mapy+1);
+   diff=20;
    for(i=1;i<20;i++)
      if(exp_pr_sq<=level_exp(i)) {
        diff=i;
*** 1.1	1992/10/16 03:39:35
--- spells.c	1992/10/16 03:41:13
***************
*** 1,6 ****
  /*
   * static char *rcsid_spells_c =
!  *   "$Id: spells.c,v 1.1 1992/10/16 03:39:35 eanders Exp eanders $";
   */
  
  /*
--- 1,6 ----
  /*
   * static char *rcsid_spells_c =
!  *   "$Id: spells.c,v 1.20 1992/09/24 04:52:34 frankj Exp $";
   */
  
  /*
***************
*** 715,721 ****
      if(tmp->type==PLAYER)
        break;
    if(tmp==NULL)		/* didn't find a player there */
!     return 0;
  
    switch(spell_type) {
    case SP_MINOR_HEAL:
--- 715,724 ----
      if(tmp->type==PLAYER)
        break;
    if(tmp==NULL)		/* didn't find a player there */
!     tmp = op;
! 
!   if (tmp->type!=PLAYER)
!     return 0; /* it might happen */
  
    switch(spell_type) {
    case SP_MINOR_HEAL:
***************
*** 731,736 ****
--- 734,741 ----
      heal=1000;
      break;
    }
+   if (tmp->stats.hp==tmp->stats.maxhp)
+     return 0;
    tmp->stats.hp+=heal;
    if(tmp->stats.hp>tmp->stats.maxhp)
      tmp->stats.hp=tmp->stats.maxhp;
*** 1.1	1992/10/16 04:09:42
--- treasure.c	1992/10/18 00:38:40
***************
*** 27,37 ****
  
  #include "treasure.h"
  
  void set_magic(mapstruct *m,object *op, int magic) {
!   int i,max_magic=4;
!   if(m!=NULL)
!     max_magic=14-m->difficulty;
!   i=get_magic(max_magic);
    if(i>magic)
      i=magic;
    if(!i) return;
--- 27,92 ----
  
  #include "treasure.h"
  
+ #define MAXMAGIC 4
+ 
+ #define DIFFLEVELS 14
+ 
+ int difftomagic_list[DIFFLEVELS][MAXMAGIC+1] =
+ {
+ /*chance of magic    difficulty*/
+ /* +0  +1 +2 +3 +4 */
+   { 100,0, 0, 0, 0 }, /*1*/
+   { 95, 5, 0, 0, 0 }, /*2*/
+   { 90,10, 0, 0, 0 }, /*3*/
+   { 85,15, 0, 0, 0 }, /*4*/
+   { 80,17, 3, 0, 0 }, /*5*/
+   { 75,18, 7, 0, 0 }, /*6*/
+   { 70,20,10, 0, 0 }, /*7*/
+   { 65,22,12, 1, 0 }, /*8*/
+   { 50,25,18, 5, 2 }, /*9*/
+   { 35,27,23,10, 5 }, /*10*/
+   { 20,27,23,20,10 }, /*11*/
+   { 10,27,23,20,20 }, /*12*/
+   {  5,10,25,20,40 }, /*13*/
+   {  1, 4, 5,10,80 }, /*14*/
+ };
+ 
+ int magic_from_difficulty(int difficulty)
+ {
+   int percent,loop,chance;
+ 
+   difficulty = difficulty-1;
+ 
+   percent = RANDOM()%100;
+ 
+   if (difficulty>=DIFFLEVELS)
+     difficulty=DIFFLEVELS-1;
+ 
+   for(loop=0;loop<(MAXMAGIC+1);++loop) {
+     chance = difftomagic_list[difficulty][loop];
+     if (percent<chance) {
+       break;
+     } else {
+       percent -= chance;
+     }
+   }
+   if (loop==(MAXMAGIC+1)) {
+     fprintf(stderr,"Warning, table for difficulty %d bad.\n",difficulty);
+     loop=0;
+   }
+ /*  printf("Chose magic %d for difficulty %d\n",loop,difficulty);*/
+   return loop;
+ }
+ 
  void set_magic(mapstruct *m,object *op, int magic) {
!   int i,difficulty;
! 
!   if (m)
!     difficulty = m->difficulty;
!   else
!     difficulty = 1;
! 
!   i = magic_from_difficulty(difficulty);
    if(i>magic)
      i=magic;
    if(!i) return;
***************
*** 221,226 ****
--- 276,289 ----
  
  object *generate_treasure(int list,mapstruct *m) {
    int max_tries=1;
+   int difficulty;
+ 
+   if (m==NULL) {
+     /* store difficulty */
+     difficulty = 5;
+   } else
+     difficulty=m->difficulty;
+ 
    if(list<0)
      return NULL;
    if(list>NROF_T) {
***************
*** 232,240 ****
      object *op;
      if(!strcmp("unused",treasure_list[list][roll].name))
        continue;
      if(!strncmp("list",treasure_list[list][roll].name,4)) {
!       sscanf(treasure_list[list][roll].name,"list %d",&list);
!       continue;
      }
      if(!strcmp("nothing",treasure_list[list][roll].name))
        return NULL;
--- 295,323 ----
      object *op;
      if(!strcmp("unused",treasure_list[list][roll].name))
        continue;
+     if (treasure_list[list][roll].nrof== -1)
+       if (m!=NULL)
+ 	continue;
+ 
      if(!strncmp("list",treasure_list[list][roll].name,4)) {
!       int newlist;
! 
!       sscanf(treasure_list[list][roll].name,"list %d",&newlist);
!       if (difficulty>=treasure_list[list][roll].magic) {
! /*	if (treasure_list[list][roll].magic)
! 	  printf("Took limited list transition %d,%d.\n",
! 		 difficulty,treasure_list[list][roll].magic);*/
! 	list = newlist;
! 	continue;
!       } else {
! 	if (treasure_list[list][roll].nrof) {
! /*	  printf("Taking unused special.\n");*/
! 	  continue;
! 	} else {
! /*	  printf("Taking nothing special.\n");*/
! 	  return NULL;
! 	}
!       }
      }
      if(!strcmp("nothing",treasure_list[list][roll].name))
        return NULL;
***************
*** 247,253 ****
        op->nrof=RANDOM()%treasure_list[list][roll].nrof+1;
      if(!op->magic) /* Only set magic bonus if it doesn't already have one */
        set_magic(m,op,treasure_list[list][roll].magic);
!     if(op->type==RING){
        set_ring_bonus(op,DICE2);
        if(!(RANDOM()%4)) {
          set_ring_bonus(op,RANDOM()%2?DICE2:-DICE2);
--- 330,336 ----
        op->nrof=RANDOM()%treasure_list[list][roll].nrof+1;
      if(!op->magic) /* Only set magic bonus if it doesn't already have one */
        set_magic(m,op,treasure_list[list][roll].magic);
!     if(op->type==RING&&treasure_list[list][roll].nrof!= -1){
        set_ring_bonus(op,DICE2);
        if(!(RANDOM()%4)) {
          set_ring_bonus(op,RANDOM()%2?DICE2:-DICE2);
*** 1.1	1992/10/16 04:06:18
--- treasure.h	1992/10/17 23:44:24
***************
*** 1,6 ****
  /*
   * static char *rcsid_treasure_h =
!  *   "$Id: treasure.h,v 1.1 1992/10/16 04:06:18 eanders Exp eanders $";
   */
  
  /*
--- 1,6 ----
  /*
   * static char *rcsid_treasure_h =
!  *   "$Id: treasure.h,v 1.12 1992/09/23 00:33:37 frankj Exp $";
   */
  
  /*
***************
*** 43,48 ****
--- 43,55 ----
  
  #define MAX_T 20
  
+ /* List transition rules:
+    first number is difficulty of the map neccesary to make the transition.
+    if the difficulty is too low, the second number determines if the
+    entry is treated as an unused or a nothing.
+    if the number is a 0 it is treated as a nothing.  If the number
+    is a 1 the entry is treated as an unused.
+ */
  treasure treasure_list[NROF_T][MAX_T]=
  { /* For use in chests */
    { /* List 0 */
***************
*** 116,127 ****
      {"plate_mail",4,0},
      {"robe",4,0},
      {"leather_armour",4,0},
!     {"full_helmet",1,0},
!     {"horned_helmet",1,0},
      {"helmet",1,0},
      {"shield",2,0},
      {"small_shield",1,0},
!     {"high_shield",2,0},
      {"unused",0,0},
      {"unused",0,0},
      {"unused",0,0},
--- 123,134 ----
      {"plate_mail",4,0},
      {"robe",4,0},
      {"leather_armour",4,0},
!     {"full_helmet",3,0},
!     {"horned_helmet",2,0},
      {"helmet",1,0},
      {"shield",2,0},
      {"small_shield",1,0},
!     {"high_shield",3,0},
      {"unused",0,0},
      {"unused",0,0},
      {"unused",0,0},
***************
*** 157,163 ****
    },
    { /* List 5 (shop) */
      {"scroll",0,3},
!     {"list 8",0,0},
      {"amulet",0,0},
      {"ring",0,0},
      {"gem",0,2},
--- 164,170 ----
    },
    { /* List 5 (shop) */
      {"scroll",0,3},
!     {"unused",0,0},
      {"amulet",0,0},
      {"ring",0,0},
      {"gem",0,2},
***************
*** 167,178 ****
      {"ring",0,0},
      {"clock",0,0},
      {"scroll",0,0},
!     {"list 8",0,0},
      {"amulet",0,0},
      {"ring",0,0},
      {"gem",0,1},
      {"book",0,0},
!     {"list 8",0,0},
      {"unused",0,0},
      {"unused",0,0},
      {"unused",0,0}
--- 174,185 ----
      {"ring",0,0},
      {"clock",0,0},
      {"scroll",0,0},
!     {"unused",0,0},
      {"amulet",0,0},
      {"ring",0,0},
      {"gem",0,1},
      {"book",0,0},
!     {"ring_nodrain",0,-1},
      {"unused",0,0},
      {"unused",0,0},
      {"unused",0,0}
***************
*** 197,203 ****
      {"unused",0,0},
      {"unused",0,0},
      {"unused",0,0},
!     {"unused",0,0}
    },
    { /* List 7 */
      {"goldcoin",0,6},
--- 204,210 ----
      {"unused",0,0},
      {"unused",0,0},
      {"unused",0,0},
!     {"list 8",0,0}
    },
    { /* List 7 */
      {"goldcoin",0,6},
***************
*** 236,247 ****
      {"nothing",0,0},
      {"nothing",0,0},
      {"nothing",0,0},
!     {"nothing",0,0},
!     {"nothing",0,0},
!     {"nothing",0,0},
!     {"nothing",0,0},
!     {"nothing",0,0},
!     {"list 9",0,0}
    },
    { /* List 9 (Artifacts) */
      {"dragon_mail",4,0},
--- 243,254 ----
      {"nothing",0,0},
      {"nothing",0,0},
      {"nothing",0,0},
!     {"list 9",10,0},
!     {"list 9",10,0},
!     {"list 9",8,0},
!     {"list 9",8,0},
!     {"list 9",5,1},
!     {"list 9",5,1}
    },
    { /* List 9 (Artifacts) */
      {"dragon_mail",4,0},
***************
*** 250,261 ****
      {"bracers_ac",4,0},
      {"dragon_mail",4,0},
      {"bracers_ac",4,0},
!     {"list 13",0,0},
!     {"list 13",0,0},
!     {"list 13",0,0},
!     {"nothing",0,0},
!     {"nothing",0,0},
!     {"nothing",0,0},
      {"nothing",0,0},
      {"nothing",0,0},
      {"nothing",0,0},
--- 257,268 ----
      {"bracers_ac",4,0},
      {"dragon_mail",4,0},
      {"bracers_ac",4,0},
!     {"list 13",8,1},
!     {"list 13",8,1},
!     {"list 13",9,0},
!     {"list 13",9,0},
!     {"list 13",10,0},
!     {"list 13",10,0},
      {"nothing",0,0},
      {"nothing",0,0},
      {"nothing",0,0},
*** 1.1 1992/10/17 23:27:51
--- archetypes  1992/10/17 23:38:43
***************
*** 4142,4147 ****
--- 4142,4156 ----
  weight 25000
  value 44
  end
+ Object ring_nodrain
+ name Immunity to Drain Ring
+ face 30
+ value 10000
+ weight 40
+ type 70
+ material 2
+ immune 128
+ end
  Object stormbringer
  name Stormbringer
  last_sp 8
          -Eric 
*********************************************************
"Overhead, without any fuss, the stars were going out."
           -The Nine Billion Names of God
"Yes, you're very smart.  Shut up."
           -In "The Princess Bride"
*********************************************************