updated how weapons are handled

This commit is contained in:
Ben Cook
2019-01-01 17:11:39 -05:00
parent 708a39403c
commit 2d7a25724b
9 changed files with 61 additions and 53 deletions
+1 -7
View File
@@ -59,14 +59,8 @@ class Feature():
The weapon to be tested for special bonuses
kwargs
Any other key-word arguments the function may require
Returns
-------
weapon
Updated weapon (perhaps changed damage bonus, etc.)
"""
return weapon
pass
class FeatureSelector(Feature):
-1
View File
@@ -64,7 +64,6 @@ class MartialArts(Feature):
if int(self.die[1:]) > int(weapon.base_damage.split('d')[-1]):
weapon.base_damage = '1' + str(self.die)
weapon.is_finesse = True
return weapon
class Ki(Feature):
+1 -3
View File
@@ -72,7 +72,6 @@ class Archery(Feature):
"""
if isinstance(weapon, weapons.RangedWeapon):
weapon.attack_bonus += 2
return weapon
class Defense(Feature):
@@ -98,8 +97,7 @@ class Dueling(Feature):
"""
if (isinstance(weapon, weapons.MeleeWeapon)
and "two-handed" not in weapon.properties.lower()):
weapon.bonus_damage += 2
return weapon
weapon.damage_bonus += 2
class TwoWeaponFighting(Feature):
+7 -10
View File
@@ -468,14 +468,13 @@ class HexWarrior(Feature):
it is higher than STR/DEX bonus
"""
if weapon.is_finesse:
existing_mod = max(self.owner.strength.modifier,
self.owner.dexterity.modifier)
abils = {'strength': self.owner.strength.modifier,
'dexterity': self.owner.dexterity.modifier,
'charisma': self.owner.charisma.modifier}
else:
existing_mod = self.owner.strength.modifier
cha_mod = self.owner.charisma.modifier
if cha_mod > existing_mod:
weapon.attack_bonus += (cha_mod - existing_mod)
return weapon
abils = {weapon.ability: getattr(self.owner, weapon.ability).modifier,
'charisma': self.owner.charisma.modifier}
weapon.ability = max(abils, key=abils.get)
class AccursedSpecter(Feature):
@@ -958,11 +957,9 @@ class ImprovedPactWeapon(Invocation):
"""
Add +1 to attack and damage if magic is not already magic
"""
if weapon.magic_bonus <= 1:
weapon.magic_bonus = 1
if (weapon.attack_bonus == 0) or (weapon.bonus_damage == 0):
weapon.attack_bonus += 1
weapon.bonus_damage += 1
return weapon
class LanceOfLethargy(Invocation):