Jump to content

Elin:Code Analysis/Feats: Difference between revisions

No edit summary
Line 10: Line 10:
== Depiction of Feats in code: an Index ==
== Depiction of Feats in code: an Index ==
<syntaxhighlight lang="c#" line="1">
<syntaxhighlight lang="c#" line="1">
public const int featStamina = 1612;
public const int featStamina = 1612; x
public const int featCHA = 1627;
public const int featCHA = 1627; x
public const int featWIL = 1626;
public const int featWIL = 1626; x
public const int featMAG = 1625;
public const int featMAG = 1625; x
public const int featLER = 1624;
public const int featLER = 1624; x
public const int featPER = 1623;
public const int featPER = 1623; x
public const int featEND = 1622;
public const int featEND = 1622; x
public const int featDEX = 1621;
public const int featDEX = 1621; x
public const int featSTR = 1620;
public const int featSTR = 1620; x
public const int featLuck = 1628;
public const int featLuck = 1628; x
public const int featSwordsage = 1418;
public const int featSwordsage = 1418; *
public const int featLife = 1610;
public const int featLife = 1610; x
public const int featManaMeat = 1421;
public const int featManaMeat = 1421; *
public const int featExecutioner = 1420;
public const int featExecutioner = 1420; *
public const int featMilitant = 1419;
public const int featMilitant = 1419;
public const int featWitch = 1417;
public const int featWitch = 1417;
Line 126: Line 126:


* If you want to see for the effect yourself, just search for that number in code.
* If you want to see for the effect yourself, just search for that number in code.
== Class feats ==
===featSwordsage (Talisman Mastery)===
<syntaxhighlight lang="c#" line="1">
    case MixType.Talisman:
{
int num2 = EClass.pc.Evalue(1418);
Thing thing4 = ai.ings[1];
SourceElement.Row source2 = (thing4.trait as TraitSpellbook).source;
int num3 = thing4.c_charges * source2.charge * (100 + num2 * 50) / 500 + 1;
int num4 = 100;
Thing thing5 = ThingGen.Create("talisman").SetNum(num3);
thing5.refVal = source2.id;
thing5.encLV = num4 * (100 + num2 * 10) / 100;
thing.ammoData = thing5;
thing.c_ammo = num3;
EClass.pc.Say("talisman", thing, thing5);
thing4.Destroy();
break;
}
</syntaxhighlight>
* The "talisman mastery 2" trait of swordmage positively influence the effect of created talismans. Specifically:
** The number of charges created by swordmage will be '''(magic_book_charges * num_of_charge_gained_if_read * 2 / 5) + 1'''.
** For a normal PC, the number of charges will be '''(magic_book_charges * num_of_charge_gained_if_read * 1 / 5) + 1'''.
*** For example, for a magic book with 3 reads left with each read giving PC 10 charges, the number of talisman charge by swordmage would be 13, while by normal PC would be 7.
** The talisman level created by swordmage is fixed at 120, while fixed at 100 by normal PC.
===featManameat (Mana Body)===
<syntaxhighlight lang="c#" line="1">
if (Evalue(1421) >= 2 && base.hp <= MaxHP / (9 - Evalue(1421) * 2))
{
num4 /= 2;
}
PlayEffect("cast");
mana.Mod(-num4);
</syntaxhighlight>
* If the feat Mana body is of level more than 2, then if the character's HP is lower than a threshold, all mana cost is cut by 50%.
** Specifically, if feat Level is 2, when HP <= 20% Maximum HP, if feat Level is 3, when HP <= 33% Maximum HP.
<syntaxhighlight lang="c#" line="1">
    if (Evalue(1421) > 0)
{
int num6 = 0;
int num7 = dmg;
if (hp > 0)
{
num7 = dmg - hp;
hp -= dmg;
num6 += dmg;
if (hp < 0 && Chara.mana.value >= 0)
{
num6 += hp;
hp = 0;
}
}
if (hp <= 0)
{
if (Evalue(1421) >= 2)
{
num7 /= 2;
}
dmg = num7;
if (Chara.mana.value > 0)
{
num7 -= Chara.mana.value;
Chara.mana.value -= dmg;
num6 += dmg;
}
if (Chara.mana.value <= 0)
{
hp -= num7;
num6 += num7;
}
}
dmg = num6;
}
</syntaxhighlight>
* It seems, that this mana cost reduction by 50% is also applied when HP is equal or less than 0 (only when Mana body >= level 2).
** This effectively cut the damage these character recieved when HP is 0 by 50%.
=== featExecutioner (Heart of Death) ===
<syntaxhighlight lang="c#" line="1">
    if (CC.Evalue(1420) > 0)
{
int num3 = Mathf.Min(100, 100 - CC.hp * 100 / CC.MaxHP);
if (num3 >= 50 && num3 * num3 * num3 * num3 / 3 > EClass.rnd(100000000))
{
return Crit();
}
}
return true;
</syntaxhighlight>
* This is calculated after ALL other calculation is done. Such as Natural 20 hit, Natural 1 miss, etc.
** A number (num3) is calculated through the percentage of HP left of a character. For example, if a character has 10% HP, that number is 90.
* If the number is >= 50 (Character have less than 50% Max HP), we generate a random number, and test if num3^4 /3 is bigger than that number.
** This effectively translate to a 33% Critical chance at 0 HP, a about 2% Critical chance at 50% HP.
* Remember, this calculation is done '''after all other calculations''', including all evasions. If player doesn't have this feat, this attack will hit anyway.
** In other words, in order to trigger this effect, you have to first hit the enemy.


[[Category:EN]]
[[Category:EN]]
[[Category:Elin Spoiler]]
[[Category:Elin Spoiler]]
362

edits