Jump to content

Elin:Code Analysis/Combat: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 28: Line 28:
|(305)
|(305)
|Magic Device
|Magic Device
|
|-
|(411)
|Spell Enhance
|
|
|-
|-
Line 217: Line 221:
Penetration is '''Character Penetration''' + '''Weapon Penetration'''
Penetration is '''Character Penetration''' + '''Weapon Penetration'''
==Spellcasting/Damaging Spells==
==Spellcasting/Damaging Spells==
<syntaxhighlight lang="c#">
public override int GetPower(Card c)
{
    int num = base.Value * 8 + 50;
    if (!c.IsPC)
    {
        num = Mathf.Max(num, c.LV * 6 + 30);
    }
    num = EClass.curve(num, 400, 100, 75);
    if (this is Spell)
    {
        num = num * (100 + c.Evalue(411)) / 100;
    }
    return num;
}
</syntaxhighlight><syntaxhighlight lang="c#">
public static int curve(int a, int start, int step, int rate = 75)
{
    if (a <= start)
    {
        return a;
    }
    for (int i = 0; i < 10; i++)
    {
        int num = start + i * step;
        if (a <= num)
        {
            return a;
        }
        a = num + (a - num) * rate / 100;
    }
    return a;
}
</syntaxhighlight>Spellpower is curve( ('''Spell''' '''Main Attribute''' x 8 + 50), 400, 100, 75 ) x (100 + '''Spell Enhance Enchanement''') / 100 if it's Player Character
Spellpower is '''Spell''' '''Main Attribute''' x 8 + 50 or '''Char Level''' x 6 + 30, choose the bigger one of it's not Player Character
About '''curve''' '''<code>curve(a, start, step, rate)</code> Function:'''
Set <code>i = 0</code>. Calculate <code>num = start + i * step</code>. When <code>a</code> exceeds <code>num</code>, the excess portion needs to be multiplied by <code>rate / 100</code>. Then increment <code>i</code> by 1. Repeat the above steps 10 times


In simple terms, this function is used to compress numerical values. The slope of the function's curve gradually decreases to <code>(rate / 100)^10</code>
{| class="wikitable"
{| class="wikitable"
|+
|+
28

edits