Exemple #1
0
    internal override AEffect Compute(AttackInfos a_attackInfos)
    {
        EffectDamage dmg = new EffectDamage();

        dmg.attackInfos = a_attackInfos;

        IntModifier damageFromStats = a_attackInfos.source.attack.GetBonusDamage(type);
        IntModifier arpenFromStats  = a_attackInfos.source.attack.GetPenetration(type);

        if (canCrit && a_attackInfos.critType == ECriticalType.Crititcal)
        {
            damageFromStats.Add(a_attackInfos.source.attack.CriticalDamages);
            arpenFromStats.Add(a_attackInfos.source.attack.CriticalArpen);
        }
        else if (canCrit && a_attackInfos.critType == ECriticalType.Penetration)
        {
            damageFromStats.Add(a_attackInfos.source.attack.PenetrationDamages);
            arpenFromStats.Add(a_attackInfos.source.attack.PenetrationArpen);
        }

        dmg.amount = baseAmount.Value;
        dmg.amount = damageFromStats.Compute(dmg.amount, FFEngine.Game.Constants.DAMAGE_BONUS_IS_FLAT_FIRST);
        dmg.arpen  = arpenFromStats;

        dmg.type = type;

        return(dmg);
    }
Exemple #2
0
    internal override AEffectReport Apply(Unit a_target)
    {
        DamageReport report = new DamageReport();

        IntModifier reduction = a_target.defense.GetResistance(type).Compute(arpen);

        report.attackInfos = attackInfos;
        report.effectInfos = effectInfos;

        int baseDmg = ComputeStackModifications();

        report.target    = a_target;
        report.type      = type;
        report.unreduced = baseDmg;
        report.final     = reduction.Compute(report.unreduced,
                                             FFEngine.Game.Constants.DAMAGE_REDUCTION_FROM_ARMOR_IS_FLAT_FIRST);

        //Scratching
        if (attackInfos.critType == ECriticalType.Normal && a_target.defense.ShouldScratch(this))
        {
            report.didScratch = true;
            report.final      = Mathf.FloorToInt(report.final * FFEngine.Game.Constants.SCRATCH_DAMAGE_MULTIPLIER);
        }
        else
        {
            report.didScratch = false;
        }

        report.reducedByArmor = report.final - report.unreduced;

        return(report);
    }
Exemple #3
0
    internal static float ArmorPercentReduction(int a_armor, IntModifier a_arpen)
    {
        int effectiveArmor = a_armor;

        if (a_arpen != null)
        {
            effectiveArmor = a_arpen.Compute(effectiveArmor, FFEngine.Game.Constants.ARMOR_REDUCTION_FROM_ARPEN_IS_FLAT_FIRST);
        }

        float reduction = 1f + (-1f / Mathf.Exp(effectiveArmor / 50f));

        return(reduction);
    }
Exemple #4
0
    internal void ComputeValue()
    {
        value = _baseValue;

        SumUpBonuses();
        value = _bonus.Compute(value, bonusIsFlatFirst);

        SumUpReductions();
        value = _malus.Compute(value, malusIsFlatFirst);

        if (reducStackMethod == EReducPerStack.ReduceWhatsLeft)
        {
            value = Mathf.Max(value, 0);
        }

        _needsToBeCompute = false;
    }