Affliction-cure tables?

Post Reply
bluelikemonday
Posts: 3
Joined: Thu Jan 26, 2012 3:57 am

Affliction-cure tables?

Post by bluelikemonday »

I am working on an IRE curing system, someone suggested makign two tables, one that tracks the afflictions, and one that cures them as they come about.

Could anyone give me some basic example of how to do this? I have the open tables gigs.affs and gigs.cures, but no clue on how to list the afflictions, as I have never really dealt with tables this deeply. A link to something similar would be appreciated, as well as any assistance.

User avatar
Oneymus
Posts: 321
Joined: Thu Sep 17, 2009 5:24 am

Re: Affliction-cure tables?

Post by Oneymus »

A system in IRE games is a very complex undertaking. In short, yes, you will be utilizing multiple tables. You will have your current afflictions, a table detailing cures for those afflictions, priority tables... You'll need to track herbs, vials, pipes... All of that business.

But, to answer your question, you'd be looking at something roughly like:
Code: [show] | [select all] lua
currentAfflictions = {}

afflictionCures = {
    blindness = "eat some_herb",
    other_aff = "other_cure",
    ...
}

function addAffliction (aff)
    currentAfflictions[#currentAfflictions] = aff
end

function cureAfflictions ()
    for i,aff in ipairs(currentAfflictions) do
        send(afflictionsCures[aff])
        currentAfflictions[i] = nil
    end
end
This only describes, very roughly (and very incompletely), the interaction between the two tables. Even with this, you have quite the trek ahead of you. You need to prioritize certain afflictions. You need to track balances. Afflictions could have multiple cures you will want to take advantage of to maximize output. You'll need to verify afflictions were actually cured...

But, anyway, there is your basic example. Good luck. =D

Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Re: Affliction-cure tables?

Post by Iocun »

My own cure lookup table for Achaea looks somewhat like this:
Code: [show] | [select all] lua
paracelsus.affliction_cures =	{
		aeon = {{"smoke", "elm"}, {"tree"}},
		ablaze =	{{"apply", "mending"}, {"tree"}},
		addiction = {{"eat", "ginseng"}, {"tree"}},
		agoraphobia = {{"eat", "lobelia"}, {"focus"}, {"tree"}},
		anorexia =	{{"apply", "epidermal", "torso"}, {"focus"}, {"tree"}},
		asleep = {{"wake"}},
		asthma = 	{{"eat", "kelp"}, {"tree"}},
		blackout = {{"tree"}},
		bound = {{"writhe"}},
		...
I.e. each affliction is assigned a table, consisting of the different cures that can cure it. Each cure itself is contained as a table, of which the first index is the actual cure type, followed by optional arguments (which herb to eat, which salve to apply, where to apply a salve to, etc.).

The table that contains my current afflictions is called paracelsus.afflictions and contains my current afflictions in the form {anorexia = true, webbed = true, stupidity = true}. I.e. every affliction I currently have is set to true, the others are set to nil.

Post Reply