[Freeciv-Dev] Re: using OR in requirements
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
2005/12/5, Jason Dorje Short <jdorje@xxxxxxxxxxxx>:
> We cannot easily use Lua because the AI and helptext both require that
> the effects logic be invertible; e.g., it needs to know what it has to
> do to acquire an effect. This would mean lots of lua functions for each
> effect - one for each query type, basically.
Here's my rough preprocessor concept. It doesn't understand ruleset
files, but it can output them from Python dicts. You probably need
Python 2.4 to run this. Here's an example:
# input
rules_1 = {
'effect_martial_law_each': {
'name': 'Martial_Law_Each',
'value': 1,
'reqs': OR(dict(type='Gov', name='Anarchy', range='Player'),
dict(type='Gov', name='Despotism', range='Player'),
dict(type='Gov', name='Monarchy', range='Player'))
}
}
freeciv_formatter(expand_rules(rules_1))
# output
[effect_martial_law_each_000]
name = Martial_Law_Each
reqs = { "range", "type", "name"
"Player", "Gov", "Anarchy"
}
value = 1
[effect_martial_law_each_001]
name = Martial_Law_Each
reqs = { "range", "type", "name"
"Player", "Gov", "Despotism"
}
value = 1
[effect_martial_law_each_002]
name = Martial_Law_Each
reqs = { "range", "type", "name"
"Player", "Gov", "Monarchy"
}
value = 1
--
{ Marek Baczyński :: UIN 57114871 :: GG 161671 :: JID imbaczek@xxxxxxxxxxxxx }
{ http://www.vlo.ids.gda.pl/ | imbaczek at poczta fm | http://www.promode.org }
.. .. .. .. ... ... ...... evolve or face extinction ...... ... ... .. .. .. ..
or_processor.py
Description: Text Data
|
|