Jump to content

Elin:Code Analysis/Unclassified: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 33: Line 33:
** The talisman level created by swordmage is fixed at 120, while fixed at 100 by normal PC.
** The talisman level created by swordmage is fixed at 120, while fixed at 100 by normal PC.


==Ether Diseases (EA23.61)==
===Depiction of Ether Disease in code: an Index===
<syntaxhighlight lang="c#" line="1">
public const int etherManaBattery = 1564;
public const int etherPoisonHand = 1565;
public const int etherProvoke = 1563;
public const int etherStupid = 1561;
public const int etherWeak = 1560;
public const int etherAddict = 1559;
public const int etherRain = 1558;
public const int etherHead = 1557;
public const int etherViolence = 1556;
public const int etherNeck = 1555;
public const int etherWing = 1554;
public const int etherEye = 1553;
public const int etherFeet = 1552;
public const int etherArmor = 1562;
public const int etherUgly = 1551;
public const int etherGravity = 1550;
</syntaxhighlight>
* All ether disease is depicted with integer (i.e. level). There are 16 kinds of diseases, and we will review each of them.
* If you want to see for the effect yourself, just search for that number in code.
=== Mana Battery ===
<syntaxhighlight lang="c#" line="1">
    case 1564:
ModBase(961, a * 5, hide: false);
break;
</syntaxhighlight>
* This disease increase your magic resistance (961) by 5 per level (there is only one level currently).
<syntaxhighlight lang="c#" line="1">
public void TryAbsorbRod(Thing t)
{
if (!IsPC || !(t.trait is TraitRod) || t.c_charges <= 0 || !HasElement(1564))
{
return;
}
Say("absorbRod", this, t);
TraitRod rod = t.trait as TraitRod;
bool flag = false;
if (rod.source != null)
{
using IEnumerator<SourceElement.Row> enumerator = EClass.sources.elements.rows.Where((SourceElement.Row a) => a.id == rod.source.id).GetEnumerator();
if (enumerator.MoveNext())
{
SourceElement.Row current = enumerator.Current;
if (IsPC)
{
GainAbility(current.id, t.c_charges * 100);
flag = true;
}
}
}
if (!flag)
{
mana.Mod(-50 * t.c_charges);
}
t.c_charges = 0;
LayerInventory.SetDirty(t);
}
    ...
    public void GainAbility(int ele, int mtp = 100)
{
Element orCreateElement = elements.GetOrCreateElement(ele);
if (orCreateElement.ValueWithoutLink == 0)
{
elements.ModBase(orCreateElement.id, 1);
}
if (orCreateElement is Spell)
{
int num = mtp * orCreateElement.source.charge * (100 + Evalue(307) + (HasElement(307) ? 20 : 0)) / 100 / 100;
if (orCreateElement.source.charge == 1)
{
num = 1;
}
orCreateElement.vPotential += Mathf.Max(1, num / 2 + EClass.rnd(num / 2 + 1));
}
Say("spell_gain", this, orCreateElement.Name);
LayerAbility.SetDirty(orCreateElement);
}
</syntaxhighlight>
* Once detect PC have mana battery, it will take the charges in a rod, then call Gainability(this spell, 100 * charge number) to give PC this spell.
* This does not mean you get 100 wish spells for 1 charge of wish rod! Each spell have a unique charge parameter (see SourceGame/Element for more), and depend on the charge number it will give you number of spell casting.
** This value is modified by your memorization skill. If you have the skill, a flat 20% is added, then for each skill level, 1% added.
** For example, for a wish rod, and you have lvl 80 memorization, the num will equal to = 100 * 1 (Wish has a charge number of 1) * (80+100+20) / 100 / 100 = 2
** Which is pretty good, yes, you get 2 wishes out of 1 rod, but can you cast it, hum?
[[Category:EN]]
[[Category:EN]]
[[Category:Elin Spoiler]]
[[Category:Elin Spoiler]]
399

edits