Make sure dromis can be resisted
This commit is contained in:
9328
eos/effects.py
9328
eos/effects.py
File diff suppressed because it is too large
Load Diff
@@ -29,14 +29,19 @@ cappingAttrKeyCache = {}
|
||||
|
||||
|
||||
def getResistanceAttrID(modifyingItem, effect):
|
||||
remoteResistID = effect.resistanceID
|
||||
# If it doesn't exist on the effect, check the modifying modules attributes. If it's there, set it on the
|
||||
# effect for this session so that we don't have to look here again (won't always work when it's None, but
|
||||
# will catch most)
|
||||
if not remoteResistID:
|
||||
effect.resistanceID = int(modifyingItem.getModifiedItemAttr("remoteResistanceID")) or None
|
||||
remoteResistID = effect.resistanceID
|
||||
return remoteResistID
|
||||
if not effect.getattr('resistanceCalculated'):
|
||||
attrPrefix = effect.getattr('prefix')
|
||||
if attrPrefix:
|
||||
effect.resistanceID = int(modifyingItem.getModifiedItemAttr('{}ResistanceID'.format(attrPrefix))) or None
|
||||
if not effect.resistanceID:
|
||||
effect.resistanceID = int(modifyingItem.getModifiedItemAttr('{}RemoteResistanceID'.format(attrPrefix))) or None
|
||||
else:
|
||||
effect.resistanceID = int(modifyingItem.getModifiedItemAttr("remoteResistanceID")) or None
|
||||
effect.resistanceCalculated = True
|
||||
return effect.resistanceID
|
||||
|
||||
|
||||
class ItemAttrShortcut:
|
||||
@@ -396,7 +401,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
# Add current affliction to list
|
||||
affs.append((modifier, operation, bonus, used))
|
||||
|
||||
def preAssign(self, attributeName, value):
|
||||
def preAssign(self, attributeName, value, **kwargs):
|
||||
"""Overwrites original value of the entity with given one, allowing further modification"""
|
||||
self.__preAssigns[attributeName] = value
|
||||
self.__placehold(attributeName)
|
||||
@@ -424,7 +429,7 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
self.__placehold(attributeName)
|
||||
self.__afflict(attributeName, "+", increase, increase != 0)
|
||||
|
||||
def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, *args, **kwargs):
|
||||
def multiply(self, attributeName, multiplier, stackingPenalties=False, penaltyGroup="default", skill=None, **kwargs):
|
||||
"""Multiply value of given attribute by given factor"""
|
||||
if multiplier is None: # See GH issue 397
|
||||
return
|
||||
@@ -465,15 +470,15 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
|
||||
self.__afflict(attributeName, "%s*" % afflictPenal, multiplier, multiplier != 1)
|
||||
|
||||
def boost(self, attributeName, boostFactor, skill=None, *args, **kwargs):
|
||||
def boost(self, attributeName, boostFactor, skill=None, **kwargs):
|
||||
"""Boost value by some percentage"""
|
||||
if skill:
|
||||
boostFactor *= self.__handleSkill(skill)
|
||||
|
||||
# We just transform percentage boost into multiplication factor
|
||||
self.multiply(attributeName, 1 + boostFactor / 100.0, *args, **kwargs)
|
||||
self.multiply(attributeName, 1 + boostFactor / 100.0, **kwargs)
|
||||
|
||||
def force(self, attributeName, value):
|
||||
def force(self, attributeName, value, **kwargs):
|
||||
"""Force value to attribute and prohibit any changes to it"""
|
||||
self.__forced[attributeName] = value
|
||||
self.__placehold(attributeName)
|
||||
@@ -481,6 +486,13 @@ class ModifiedAttributeDict(collections.MutableMapping):
|
||||
|
||||
@staticmethod
|
||||
def getResistance(fit, effect):
|
||||
# Resistances are applicable only to projected effects
|
||||
if isinstance(effect.type, (tuple, list)):
|
||||
effectType = effect.type
|
||||
else:
|
||||
effectType = (effect.type,)
|
||||
if 'projected' not in effectType:
|
||||
return 1
|
||||
remoteResistID = getResistanceAttrID(modifyingItem=fit.getModifier(), effect=effect)
|
||||
attrInfo = getAttributeInfo(remoteResistID)
|
||||
# Get the attribute of the resist
|
||||
|
||||
@@ -308,11 +308,17 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
projected is False and effect.isType("passive")):
|
||||
# See GH issue #765
|
||||
if effect.getattr('grouped'):
|
||||
effect.handler(fit, self, context)
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
else:
|
||||
i = 0
|
||||
while i != self.amountActive:
|
||||
effect.handler(fit, self, context)
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
i += 1
|
||||
|
||||
if self.charge:
|
||||
|
||||
@@ -394,11 +394,17 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
if effect.runTime == runTime and effect.activeByDefault and \
|
||||
((projected and effect.isType("projected")) or not projected):
|
||||
if ability.grouped:
|
||||
effect.handler(fit, self, context)
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
else:
|
||||
i = 0
|
||||
while i != self.amountActive:
|
||||
effect.handler(fit, self, context)
|
||||
try:
|
||||
effect.handler(fit, self, context, effect=effect)
|
||||
except:
|
||||
effect.handler(fit, self, context)
|
||||
i += 1
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
|
||||
Reference in New Issue
Block a user