public string GetAttackPowerName(D20AttackPower attackPowerMask)
    {
        string        singleResult   = null;
        StringBuilder combinedResult = null;

        foreach (var attackPower in AttackPowers)
        {
            if ((attackPowerMask & attackPower) == attackPower)
            {
                if (singleResult == null)
                {
                    // First matching attack power
                    singleResult = GetSingleAttackPowerName(attackPower);
                }
                else
                {
                    if (combinedResult == null)
                    {
                        // This is the second matching attack power
                        combinedResult = new StringBuilder(singleResult);
                    }

                    combinedResult.Append(';');
                    combinedResult.Append(GetSingleAttackPowerName(attackPower));
                }
            }
        }

        return(combinedResult?.ToString() ?? singleResult);
    }
Beispiel #2
0
 public static bool ReflexSaveAndDamage(this GameObject obj,
                                        GameObject attacker, int dc, D20SavingThrowReduction reduction, D20SavingThrowFlag flags,
                                        Dice damageDice,
                                        DamageType damageType, D20AttackPower attackPower,
                                        D20ActionType actionType = D20ActionType.NONE, int spellId = 0)
 {
     return(GameSystems.D20.Combat.ReflexSaveAndDamage(obj, attacker, dc, reduction, flags, damageDice,
                                                       damageType, attackPower, actionType, spellId));
 }
Beispiel #3
0
 public static void DamageWithReduction(this GameObject victim, GameObject attacker,
                                        DamageType damageType,
                                        Dice dice, D20AttackPower attackPower, int reductionPercent, D20ActionType actionType = D20ActionType.NONE,
                                        int spellId = -1)
 {
     //  NOTE: reductionPercent is in the 0-100 range
     GameSystems.D20.Combat.DoDamage(victim, attacker, dice, damageType, attackPower, reductionPercent, 105,
                                     actionType);
 }
Beispiel #4
0
 public static void DealSpellDamage(this GameObject victim, GameObject attacker, DamageType damageType,
                                    Dice dice,
                                    D20AttackPower attackPower = D20AttackPower.NORMAL,
                                    D20ActionType actionType   = D20ActionType.NONE,
                                    int spellId = 0)
 {
     GameSystems.D20.Combat.SpellDamageFull(victim, attacker, dice, damageType, attackPower, actionType, spellId,
                                            0);
 }
Beispiel #5
0
 public static void DealSpellDamage(this GameObject victim, GameObject attacker, DamageType damageType,
                                    Dice dice,
                                    D20AttackPower attackPower = D20AttackPower.NORMAL,
                                    int reduction            = 100,
                                    D20ActionType actionType = D20ActionType.NONE,
                                    int spellId       = 0,
                                    D20CAF flags      = 0,
                                    int projectileIdx = 0)
 {
     // Line 105: Saving Throw
     GameSystems.D20.Combat.DealWeaponlikeSpellDamage(victim, attacker, dice, damageType, attackPower, reduction, 105,
                                                      actionType, spellId, flags, projectileIdx);
 }
    private string GetSingleAttackPowerName(D20AttackPower attackPower)
    {
        switch (attackPower)
        {
        case D20AttackPower.NORMAL:
            return(_translations[2000]);

        case D20AttackPower.UNSPECIFIED:
            return(_translations[2001]);

        case D20AttackPower.SILVER:
            return(_translations[2002]);

        case D20AttackPower.MAGIC:
            return(_translations[2003]);

        case D20AttackPower.HOLY:
            return(_translations[2004]);

        case D20AttackPower.UNHOLY:
            return(_translations[2005]);

        case D20AttackPower.CHAOS:
            return(_translations[2006]);

        case D20AttackPower.LAW:
            return(_translations[2007]);

        case D20AttackPower.ADAMANTIUM:
            return(_translations[2008]);

        case D20AttackPower.BLUDGEONING:
            return(_translations[2009]);

        case D20AttackPower.PIERCING:
            return(_translations[2010]);

        case D20AttackPower.SLASHING:
            return(_translations[2011]);

        case D20AttackPower.MITHRIL:
            return(_translations[2012]);

        case D20AttackPower.COLD:
            return(_translations[2013]);

        default:
            throw new ArgumentOutOfRangeException(nameof(attackPower), attackPower, null);
        }
    }
Beispiel #7
0
 public static void Damage(this GameObject victim, GameObject attacker, DamageType damageType, Dice dice,
                           D20AttackPower attackPower = default, D20ActionType actionType = D20ActionType.NONE)
 {
     GameSystems.D20.Combat.DoUnclassifiedDamage(victim, attacker, dice, damageType, attackPower, actionType);
 }