Elin:Code Analysis/Basics: Difference between revisions

no edit summary
No edit summary
Line 92: Line 92:
* If the character is golden knight, then this is further modified by 500%.
* If the character is golden knight, then this is further modified by 500%.
* A 45s base carry weight is added to the final result.
* A 45s base carry weight is added to the final result.
==Sanity==
There are many factors influencing the sanity of players. We pick the main ones in the code for analysis:
<syntaxhighlight lang="c#" line="1">
public void Cure(CureType type, int p = 100, BlessedState state = BlessedState.Normal)
{
bool flag = state == BlessedState.Blessed;
switch (type)
{
case CureType.Heal:
case CureType.Prayer:
CureCondition<ConFear>();
CureCondition<ConBlind>(2 * p / 100 + 5);
CureCondition<ConPoison>(5 * p / 100 + 5);
CureCondition<ConConfuse>(10 * p / 100 + 10);
CureCondition<ConDim>(p / 100 + 5);
CureCondition<ConBleed>(2 * p / 100 + 10);
if (flag)
{
SAN.Mod(-5);
}
break;
</syntaxhighlight>
* This is utilized when a player pray to god, and if the state of item used is "blessed", the character will have -5 Sanity value.
** This is pretty strange, considering that the action of praying to god is never an item and can never be assigned the "blessed" state, thus the code is unused.
<syntaxhighlight lang="c#" line="1">
case EffectId.RemedyJure:
TC.HealHP(1000000, HealSource.Magic);
TC.CureHost(CureType.Jure, power, state);
TC.Say("heal_jure", TC);
break;
    if (type == CureType.Jure)
{
SAN.Mod(-999);
</syntaxhighlight>
* This effect happens when you use the Healing feather (Lay hand would be EffectId.JureHeal), and modify you Sanity by -999.
<syntaxhighlight lang="c#" line="1">
case Type.Dojin:
c.PlaySound("wow");
c.Say("book_decode", c, owner);
if (!c.IsPC)
{
c.Talk("wow");
}
switch (BookType)
{
case Type.Ero:
if (c.IsPC)
{
EClass.pc.SAN.Mod(-(EClass.rnd(5) + 1));
}
</syntaxhighlight>
* This effect happens when a PC reads strange book that is in the "Ero" type. The Sanity is modded with a random value from -1 to -5.
<syntaxhighlight lang="c#" line="1">
case 914:
flag2 = false;
if (EClass.rnd(3) != 0)
{
if (Chance(30 + eleP / 5, 100))
{
Chara.AddCondition<ConConfuse>(eleP);
}
}
else if (Chance(30 + eleP / 5, 100))
{
Chara.AddCondition<ConSleep>(eleP);
}
if (Chance(50, 100))
{
Chara.SAN.Mod(EClass.rnd(2));
}
break;
            ...
case 920:
flag2 = false;
if (Chance(5 + eleP / 25, 40))
{
Chara.AddCondition<ConBlind>(eleP / 2);
}
if (Chance(5 + eleP / 25, 40))
{
Chara.AddCondition<ConParalyze>(eleP / 2);
}
if (Chance(5 + eleP / 25, 40))
{
Chara.AddCondition<ConConfuse>(eleP / 2);
}
if (Chance(5 + eleP / 25, 40))
{
Chara.AddCondition<ConPoison>(eleP / 2);
}
if (Chance(5 + eleP / 25, 40))
{
Chara.AddCondition<ConSleep>(eleP / 2);
}
if (Chance(5 + eleP / 25, 40))
{
Chara.AddCondition<ConDim>(eleP / 2);
}
if (Chance(30 + eleP / 10, 100))
{
Chara.SAN.Mod(EClass.rnd(2));
}
break;
            ...
        bool Chance(int a, int max)
{
if (dmg > 0 || (origin != null && origin.HasElement(1345)))
{
return Mathf.Min(a, max) > EClass.rnd(100);
}
return false;
}
</syntaxhighlight>
* There are two types of attacks that specifically increase the Sanity value, this is observed to be the main way people get Sanity value in daily life.
* Element ID 914 or Mind Attack will have a 50% chance of increase your Sanity value by 0 - 1 for every attack received.
* Element ID 920 or Chaos Attack will have a chance of increase your Sanity value by 0 - 1 for every attack received. The chance depend on the Element power of the attack, and will range from 30% to 100%.
* A few other effects exist as a fixed increase in Sanity value. Doing the f thing will give Sanity value +10. Eating Human flesh (canniblism) gives a fixed Sanity value +15.


[[Category:EN]]
[[Category:EN]]
[[Category:Elin Spoiler]]
[[Category:Elin Spoiler]]
361

edits