Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2507) incite cost patch
Home

[Freeciv-Dev] Re: (PR#2507) incite cost patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2507) incite cost patch
From: "Davide Pagnin via RT" <rt@xxxxxxxxxxxxxx>
Date: Sun, 8 Dec 2002 04:05:09 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Sat, 2002-12-07 at 00:27, Per I. Mathisen via RT wrote:
> This is Thomas' incite cost patch with my extensive modifications adapted
> to current cvs.
> 
> Only one change since last time (apart from cvs adaptation): Celebrating
> cities can now be incited, but at double price. Since we also get
> stability bonuses from happy cities and bonuses from happy citizens, a
> celebrating city should be extremely expensive, yet not impossible to
> incite.

1. I would like this main incite rewrite to introduce the concept of
"international incident". In civ1 and civ2, when you were peace with
your opponent you were given the option of 'subverting the city' (not
simply inciting it), that will cost twice the gold of inciting and will
not give any reputation penalty to you, nor will end up in Democracy
fall down cause to senate being overruled. 
NOTE: if you choose the 'subvert option' the opposite site has no 'GOOD
REASON' for declare war to you, but this don't mean that the opposite
site will not.

> 
> You should still be able to get cities at a bargain in the fringes of an
> empire, far away from its capital, especially when combined with more
> aggressive anti-ICS measures that keeps such cities in turmoil and
> unhappiness. But cities close to your capital should be mostly safe from
> incitement unless your opponent is awash in gold. Also Courthouse helps a
> lot to keep prices up.
> 
> The effect of Courthouse should be configurable by general effects patch
> eventually, and we may wish to delay this patch until after that. I don't
> see any easy way to ruleset'ify the other rules, though.

Then I suggest some way of ruleset'ify this patch...

> 
>   - Per
> 
> 
> ______________________________________________________________________
> 
> Index: server/cityturn.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
> retrieving revision 1.199
> diff -u -r1.199 cityturn.c
> --- server/cityturn.c 2002/11/25 19:18:09     1.199
> +++ server/cityturn.c 2002/12/06 23:18:03
> @@ -1181,43 +1181,84 @@
>  }
>  
>  /**************************************************************************
> -  Sets the incite_revolt_cost field in the given city.
> +  Returns the cost to incite a city. This depends on the size of the city,
> +  the number of happy, unhappy and angry citizens, whether it is
> +  celebrating, how close it is to the capital, how many units it has and
> +  upkeeps, presence of courthouse and its buildings and wonders.
>  **************************************************************************/
>  int city_incite_cost(struct player *pplayer, struct city *pcity)
>  {
>    struct government *g = get_gov_pcity(pcity);
>    struct city *capital;
> -  int dist;
> -  int incite_revolt_cost;
> +  int dist, size, cost;
>  
>    if (city_got_building(pcity, B_PALACE)) {
> -    incite_revolt_cost = INCITE_IMPOSSIBLE_COST;
> -  } else {
> -    incite_revolt_cost = city_owner(pcity)->economic.gold + 1000;
> -    capital = find_palace(city_owner(pcity));
> -    if (capital) {
> -      int tmp = map_distance(capital->x, capital->y, pcity->x, pcity->y);
> -      dist = MIN(32, tmp);
> +    return INCITE_IMPOSSIBLE_COST;
> +  }
> +
> +  /* Gold factor */
> +  cost = city_owner(pcity)->economic.gold + 1000;
> +
> +  unit_list_iterate(map_get_tile(pcity->x,pcity->y)->units, punit) {
> +    cost += unit_type(punit)->build_cost;
> +  } unit_list_iterate_end;

I suggest a general variable here like
present_unit_incite_cost
it can be boolean or numeric, and will allow/not allow to count present
in city units build cost in the incite cost.

> +
> +  /* Buildings */
> +  built_impr_iterate(pcity, i) {
> +    if (!is_wonder(i)) {
> +      cost += improvement_value(i);

same as present_unit_incite_cost
we can add a present_wonder_incite_cost variable

>      } else {
> -      /* No capital? Take max penalty! */
> -      dist = 32;
> -    }
> -    if (city_got_building(pcity, B_COURTHOUSE)) {
> -      dist /= 2; /* courthouse halves the distance penalty */
> +      cost += improvement_value(i) * 2;

Same here for normal improvement

>      }
> -    if (g->fixed_corruption_distance != 0) {
> -      dist = MIN(g->fixed_corruption_distance, dist);
> -    }
> -    incite_revolt_cost /= (dist + 3);
> -    incite_revolt_cost *= pcity->size;
> -    if (city_unhappy(pcity)) {
> -      incite_revolt_cost /= 2;
> -    }
> -    if (unit_list_size(&map_get_tile(pcity->x,pcity->y)->units)==0) {
> -      incite_revolt_cost /= 2;
> +  } built_impr_iterate_end;
> +
> +  /* Stability bonuses */
> +  if (!city_unhappy(pcity)
> +      && g->index != game.government_when_anarchy) {
> +    cost *= 2;
> +  }
> +  if (city_celebrating(pcity)) {
> +    cost *= 2;
> +  }
> +
> +  /* City is empty */
> +  if (unit_list_size(&map_get_tile(pcity->x,pcity->y)->units) == 0) {
> +    cost /= 2;
> +  }
> +
> +  /* Buy back is cheap, conquered cities are also cheap */
> +  if (pcity->owner != pcity->original) {
> +    if (pplayer->player_no == pcity->original) {
> +      cost /= 2;            /* buy back: 50% price reduction */
> +    } else {
> +      cost = cost * 2 / 3;  /* buy conquered: 33% price reduction */

I want some more time to review this stability bonuses, but I feel that
they are good as they are.
Eventually we can introduce stability bonuses ruleset variables.

>      }
>    }
> -  return incite_revolt_cost;
> +
> +  /* Distance from capital */
> +  capital = find_palace(city_owner(pcity));
> +  if (capital) {
> +    int tmp = map_distance(capital->x, capital->y, pcity->x, pcity->y);
> +    dist = MIN(32, tmp);

This definitely is a Magic number, we need instead a 
max_capital_distance_incite_cost 
ruleset variable

> +  } else {
> +    /* No capital? Take max penalty! */
> +    dist = 32;
> +  }
> +  if (city_got_building(pcity, B_COURTHOUSE)) {
> +    dist /= 4;
This changes the current behavior of Courthouse, I would like that this
is configurable as "courthouse effect", this means to let 2 for the
moment or to wait gen-impr included in CVS.

> +  }
> +  if (g->fixed_corruption_distance != 0) {
> +    dist = MIN(g->fixed_corruption_distance, dist);
> +  }
> +
> +  size = MAX(1, pcity->size
> +                + pcity->ppl_happy[4]
> +                - pcity->ppl_unhappy[4]
> +                - pcity->ppl_angry[4] * 3);

Those different weight for different class of citizen should be
configurable by a ruleset variable.

> +  cost *= size;
> +  cost = cost / (dist + 3);
> +
> +  return cost;
>  }
>  
>  /**************************************************************************




[Prev in Thread] Current Thread [Next in Thread]