Ejemplo n.º 1
0
        private static PlayerActionShortcut FromWeapon(string weaponName, PlayerActionShortcutDto shortcutDto, Character player, string damageStr = null, string suffix = "", WeaponProperties weaponProperties = WeaponProperties.None, AttackType attackType = AttackType.None)
        {
            PlayerActionShortcut result = FromAction(shortcutDto, damageStr, suffix);

            result.WeaponProperties = weaponProperties;

            if (attackType == AttackType.None && weaponProperties != WeaponProperties.None)
            {
                if ((weaponProperties & WeaponProperties.Melee) == WeaponProperties.Melee)
                {
                    attackType = AttackType.Melee;
                }
                else if ((weaponProperties & WeaponProperties.Ranged) == WeaponProperties.Ranged)
                {
                    attackType = AttackType.Range;
                }
            }
            result.AttackingType = attackType;

            if ((attackType & AttackType.Range) == AttackType.Range ||
                (attackType & AttackType.MartialRange) == AttackType.MartialRange ||
                (attackType & AttackType.Melee) == AttackType.Melee ||
                (attackType & AttackType.MartialMelee) == AttackType.MartialMelee)
            {
                if (player.IsProficientWith(weaponName))
                {
                    result.ProficiencyBonus = (int)Math.Round(player.proficiencyBonus);
                }
            }
            result.UpdatePlayerAttackingAbility(player);

            result.ProcessDieStr(shortcutDto, damageStr);

            result.AddEffect(shortcutDto, WeaponWindupPrefix, player);

            return(result);
        }