Elin:Code Analysis/Faith: Difference between revisions

From Ylvapedia
Jump to navigation Jump to search
No edit summary
Line 28: Line 28:
</syntaxhighlight>
</syntaxhighlight>
* As of EA23.61, there are two Gift ranks for each god, and each of them is hardcoded at piety level 15 and 30. You will recieve a gift after reach each of these levels then manually pray to the god.
* As of EA23.61, there are two Gift ranks for each god, and each of them is hardcoded at piety level 15 and 30. You will recieve a gift after reach each of these levels then manually pray to the god.
 
<syntaxhighlight lang="c#" line="1">
    int num = Mathf.Max(c.Evalue(306), 1);
    int num2 = 4;
if (orCreateElement.vBase >= num)
{
c.elements.SetBase(orCreateElement.id, num);
}
    else
{
num2 = Mathf.Clamp(orCreateElement.vBase * 100 / num / 25, 0, 3);
}
if (num2 == 4 || orCreateElement.Value != value)
{
Msg.Say("piety" + num2, c, c.faith.TextGodGender);
}
</syntaxhighlight>
* The above code controls the faith message when your piety levels up.
* There are 5 messages in all, determined by num2, ranging from (0~4).
* num2 will be calculated using your (Piety level / Faith level) * 4,rounded down to the nearest integer.
** So if <25%, num2 = 0; 25%~50%, num2 = 1, 50%~75%, num2 = 2, >75%, num2 = 3.
* If you are already at the maximum piety level, num2 = 4
* Then depend on num2, different message will be played.
* If you are at maximum piety (num2 = 4), then a message will always be shown.


==Ehekatl's School of Magic==
==Ehekatl's School of Magic==

Revision as of 13:38, 19 December 2024

Piety and Gift

    int num = EClass.pc.Evalue(85);
	if (giftRank == 0 && (num >= 15 || EClass.debug.enable))
		{
			Talk("pet");
			Chara chara = CharaGen.Create(source.rewards[0]);
			EClass._zone.AddCard(chara, point);
			chara.MakeAlly();
			chara.PlayEffect("aura_heaven");
			giftRank = 1;
			return true;
		}
	if (source.rewards.Length >= 2 && giftRank == 1 && (num >= 30 || EClass.debug.enable))
		{
			Talk("gift");
			string[] array = source.rewards[1].Split('|');
			string[] array2 = array;
			foreach (string text in array2)
			{
				Reforge(text, point, text == array[0]);
			}
			giftRank = 2;
			return true;
		}
  • As of EA23.61, there are two Gift ranks for each god, and each of them is hardcoded at piety level 15 and 30. You will recieve a gift after reach each of these levels then manually pray to the god.
    int num = Mathf.Max(c.Evalue(306), 1);
    int num2 = 4;
	if (orCreateElement.vBase >= num)
		{
			c.elements.SetBase(orCreateElement.id, num);
		}
    else
		{
			num2 = Mathf.Clamp(orCreateElement.vBase * 100 / num / 25, 0, 3);
		}
	if (num2 == 4 || orCreateElement.Value != value)
		{
			Msg.Say("piety" + num2, c, c.faith.TextGodGender);
		}
  • The above code controls the faith message when your piety levels up.
  • There are 5 messages in all, determined by num2, ranging from (0~4).
  • num2 will be calculated using your (Piety level / Faith level) * 4,rounded down to the nearest integer.
    • So if <25%, num2 = 0; 25%~50%, num2 = 1, 50%~75%, num2 = 2, >75%, num2 = 3.
  • If you are already at the maximum piety level, num2 = 4
  • Then depend on num2, different message will be played.
  • If you are at maximum piety (num2 = 4), then a message will always be shown.

Ehekatl's School of Magic

The relevant code relating to the randomized mana and stamina costs is as such:

    if (a < 0 && BaseStats.CC.HasElement(1330, 1))        
    {            
        a = -EClass.rnd(-a * 130 / 100 + 2);       
    }

This means that if there is a mana or stamina cost, the new cost is determined by taking a random number between 0 and 1.3 times the original cost plus 2. So in a case where a spell has a cost of 40, it would be randomised between 0 and 54.