Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] Re: (PR#13977) Patch: splitting "Fanatic" option
Home

[Freeciv-Dev] Re: (PR#13977) Patch: splitting "Fanatic" option

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: lo_oris@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#13977) Patch: splitting "Fanatic" option
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Thu, 15 Sep 2005 07:36:59 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13977 >

On Wed, 14 Sep 2005, Lo'oris wrote:

> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13977 >
>
> I'm writing a new rulesed. It would be very nice for me to have the
> "Fanatic" flag for the units split in two different options:
> (1) "Fanatic": only Fanatic_troops government can built this unit
> (2) "Fanatic_free": Fanatic_troops government can mantain these unit
> for free
>
> i'm not a programmer anymore, but i tried anyway to make a patch.
> Strange enough, it did work. Here it is (based on beta7).
>
> i cannot do that in the cvs because it breaks client compatibility, and
> i cannot compile cvs client since i do not have gtk 2.4. Anyway, it
> should be nice if it could be added :)
>
> to say it all, it would be even nicer if instead of "free" / "not
> free", i could choose "pay normal mantainance" / "pay reduced
> mantainance", but i think i dunno how to write such a thing...

This sort of special cased code is now deprecated. Try to do something
like this via effects. You can make a new effect which alters unit
upkeep by a certain percentage. i.e.:

[effect_free_fanatics]
name    = "Unit_Upkeep_Bonus"
value   = -100
reqs    =
    { "type", "name", "range"
      "Gov", "Fundamentalism", "Player"
      "UnitType", "Fanatics"
    }

Or making a boolean effect which removes the upkeep:

[effect_free_fanatics]
name    = "Unit_Upkeep_Free"
value   = 1
reqs    =
    { "type", "name", "range"
      "Gov", "Fundamentalism", "Player"
      "UnitType", "Fanatics"
    }

The second solution is probably better, because there already is a similar
effect for building upkeep, and consistency is good.


The advantage of adding the new effect type is that this allows you to do
wacky things just by playing with the ruleset you could never do with the
flag. For example:

[effect_lithovore]
; Ultra Genetic Engineering allows your troops to sustain themselves
; just by eating rocks and dirt.
name  = "Unit_Upkeep_Free"
value = 1
reqs  =
    { "type", "name", "range"
      "Tech", "Ultra_Genetic_Engineering"
    }

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa





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