Jump to content

Elin:Code Analysis/Unclassified: Difference between revisions

No edit summary
Line 98: Line 98:


=== How much does this food give you? ===
=== How much does this food give you? ===
'''WARNING''': This section is not based on empirical analysis.
Please beware the editor's understanding of this part of the code is rudimentary only.
* There are a few main contributing factor of a dish.
* There are a few main contributing factor of a dish.
** One of them is a overall modifier, in code this is depicted as '''num2'''
** One of them is a overall modifier, in code this is depicted as '''num2'''
Line 148: Line 152:


* With the previous value, if the food is blessed, increase 50%, if the food is cursed, cut by 50%.
* With the previous value, if the food is blessed, increase 50%, if the food is cursed, cut by 50%.
* If the consumer have canniblism and the dish is human, increase 50%, if dish is not human, cut by 50%.
* If the consumer have canniblism and the dish is human, increase 50%, if dish is not human, cut by 50%, while the nutrition of the dish is also cut by 50%.
* If the consumer doesn't have cannibilism and the dish is human, cut by 50%.
* If the consumer doesn't have cannibilism and the dish is human, cut by 50%.


Line 200: Line 204:
* If the food is not rotten:
* If the food is not rotten:
** If the food is raw, depend on the category, its value is further decreased: meat -30%, fish -10%, dough -10%.
** If the food is raw, depend on the category, its value is further decreased: meat -30%, fish -10%, dough -10%.
<syntaxhighlight lang="c#" line="1">
    int num3 = food.Evalue(10);
    float num6 = Mathf.Min(c.hunger.value, num3);
    if (c.hunger.GetPhase() >= 3)
{
num6 *= 1.1f;
}
if (flag5 && !c.HasElement(480))
{
c.ModExp(70, -300);
c.ModExp(71, -300);
c.ModExp(72, -200);
c.ModExp(73, -200);
c.ModExp(74, -200);
c.ModExp(75, 500);
c.ModExp(76, -200);
c.ModExp(77, -300);
}
</syntaxhighlight>
* The nutrition value (num3) of food is loaded, and the actual nutrition can be absorbed by a character cannot exceed its current hunger value.
* If the character is hungry, then the actual nutrition is increased by 10%.
** A reminder, what is increased is not efficiency, but nutrition amount. I.e. the food becomes more filling.
* If the food is rot and the character cannot take rotten food, each of the characters main attribute will be heavily penalized, except Will, which will have a heavy increase.
** Guess eating rotten food train your will.
<syntaxhighlight lang="c#" line="1">
    else
{
num2 = num2 * num6 / 10f;
if (c.HasCondition<ConAnorexia>())
{
num2 = 0.01f;
}
List<Element> list = food.ListValidTraits(isCraft: true, limit: false);
foreach (Element value in food.elements.dict.Values)
{
if (value.source.foodEffect.IsEmpty() || !list.Contains(value))
{
continue;
}
string[] foodEffect = value.source.foodEffect;
int id = value.id;
float num7 = num2 * (float)value.Value;
if (value.source.category == "food" && c.IsPC)
{
bool flag6 = num7 >= 0f;
string text = value.source.GetText(flag6 ? "textInc" : "textDec", returnNull: true);
if (text != null)
{
Msg.SetColor(flag6 ? "positive" : "negative");
c.Say(text);
}
}
</syntaxhighlight>
* The eventual gain of food is multiplied by its actual nutrition value, divided by 10.
* If the character is currently in Anorxeia, it can only gain 1% of the original benefit of eating.
<syntaxhighlight lang="c#" line="1">
switch (foodEffect[0])
{
case "exp":
{
id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
int a = (int)(num7 * (float)((foodEffect.Length > 2) ? foodEffect[2].ToInt() : 4)) * 2 / 3;
c.ModExp(id, a);
break;
}
case "pot":
{
id = ((foodEffect.Length > 1) ? EClass.sources.elements.alias[foodEffect[1]].id : value.id);
int vTempPotential = c.elements.GetElement(id).vTempPotential;
int num8 = EClass.rndHalf((int)(num7 / 5f) + 1);
num8 = num8 * 100 / Mathf.Max(100, vTempPotential * 2 / 3);
c.elements.ModTempPotential(id, num8, 8);
break;
}
</syntaxhighlight>
* The food effect for attribute experiences and attribute potential is different.
** For attribute experiences, the experience gained is (overall modifier (num2)) *  (actual nutrition (num6)) / 10 * dish exp level * 8 / 3.
** For potential increase, the increase is a value between 50% and 100% of (overall modifier (num2)) *  (actual nutrition (num6)) / 10 * dish exp level / 5 + 1.
*** However the value will be further penalized if the temporal potential is already over 150.
=== Is this food tasty? ===




[[Category:EN]]
[[Category:EN]]
[[Category:Elin Spoiler]]
[[Category:Elin Spoiler]]
399

edits