I've played a bit of Skyrim today, a cool project came to me when doing some alchemy: To implement an ingredients and potions mechanism.
Don't ask for code, when the light bulb struck my xbox was off and this message being typed.
The idea I have in my head is both the ingredients and potions are classes ( I'm leaning toward structs for ingredients ) but I'm not sure how to code the actual "effect".
Each ingredient has 4 effects, I'm not sure whether an effect could be a struct:
1 2 3 4 5 6
struct Effect
{
int ID; // Each effect is just an ID number?
std::string name; // Effect has a name
int value; // The strength of the ingredient
};
I feel like I am missing something here, now how does a potion get made?
Effect Effects[4]; // Potion have up to 4 effects for simplicities sake
Mathematically, the most effects any potion can have is 6, not 4:
3 ingredients
* 4 effects per ingredient
/ 2 like ingredients to produce an effect
= 6 effects maximum per potion
Though if you are sticking to only 2 ingredients (as you appear to be in your code), then 4 would be the max.
I oughta stop coding in the code tabs and copy and paste from a text editor.
Yes. I pretty much always have Notepad++ open when posting code (or making really long posts that I fear might get deleted due to connection problems)
Anyway your pseudo code looks fine to me. One thing to change might be to take the "stronger" effect rather than simply ingredient1's effect. IE: Giant's Toes make stronger potions regardless of which "slot" you put them in when mixing.
I am aware of 6 being the max ( Though I've only got 5 at most I think, care to share your recipes? ;) though I wasn't sure how to make a variadic function to cope with 2 or 3 ingredients ( I didn't think I should be focusing on that, anyway )
Again I cannot fault taking the "stronger" ingredient, I'm not exactly sure how to calculate which ingredient is stronger.
Could you also touch up a little how the effect would actually work in practice? How would an effect ID actually turn into that extra 120 carry weight for 300 seconds.