Fix fighter abilities and do not rely on effects' removed attributes anymore
This commit is contained in:
3962
eos/effects.py
3962
eos/effects.py
File diff suppressed because it is too large
Load Diff
@@ -140,7 +140,7 @@ class Effect(EqBase):
|
||||
Whether this effect is implemented in code or not,
|
||||
unimplemented effects simply do nothing at all when run
|
||||
"""
|
||||
return self.handler is not eos.effects.EffectDef.handler
|
||||
return self.__effectDef is not None
|
||||
|
||||
def isType(self, type):
|
||||
"""
|
||||
@@ -157,7 +157,7 @@ class Effect(EqBase):
|
||||
effectDefName = "Effect{}".format(self.ID)
|
||||
pyfalog.debug("Loading {0} ({1})".format(self.name, effectDefName))
|
||||
self.__effectDef = effectDef = getattr(eos.effects, effectDefName)
|
||||
self.__handler = getattr(effectDef, "handler", eos.effects.EffectDef.handler)
|
||||
self.__handler = getattr(effectDef, "handler", eos.effects.BaseEffect.handler)
|
||||
self.__runTime = getattr(effectDef, "runTime", "normal")
|
||||
self.__activeByDefault = getattr(effectDef, "activeByDefault", True)
|
||||
effectType = getattr(effectDef, "type", None)
|
||||
@@ -165,20 +165,20 @@ class Effect(EqBase):
|
||||
self.__type = effectType
|
||||
except ImportError as e:
|
||||
# Effect probably doesn't exist, so create a dummy effect and flag it with a warning.
|
||||
self.__handler = eos.effects.EffectDef.handler
|
||||
self.__handler = eos.effects.DummyEffect.handler
|
||||
self.__runTime = "normal"
|
||||
self.__activeByDefault = True
|
||||
self.__type = None
|
||||
pyfalog.debug("ImportError generating handler: {0}", e)
|
||||
except AttributeError as e:
|
||||
# Effect probably exists but there is an issue with it. Turn it into a dummy effect so we can continue, but flag it with an error.
|
||||
self.__handler = eos.effects.EffectDef.handler
|
||||
self.__handler = eos.effects.DummyEffect.handler
|
||||
self.__runTime = "normal"
|
||||
self.__activeByDefault = True
|
||||
self.__type = None
|
||||
pyfalog.error("AttributeError generating handler: {0}", e)
|
||||
except Exception as e:
|
||||
self.__handler = eos.effects.EffectDef.handler
|
||||
self.__handler = eos.effects.DummyEffect.handler
|
||||
self.__runTime = "normal"
|
||||
self.__activeByDefault = True
|
||||
self.__type = None
|
||||
|
||||
@@ -57,7 +57,7 @@ class BoosterSideEffect(object):
|
||||
def name(self):
|
||||
return "{0}% {1}".format(
|
||||
self.booster.getModifiedItemAttr(self.attr),
|
||||
self.__effect.getattr('displayName') or self.__effect.handlerName,
|
||||
self.__effect.getattr('displayName') or self.__effect.name,
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
@@ -56,7 +56,7 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
|
||||
standardAttackActive = False
|
||||
for ability in self.abilities:
|
||||
if ability.effect.isImplemented and ability.effect.handlerName == 'fighterabilityattackm':
|
||||
if ability.effect.isImplemented and ability.effect.name == 'fighterAbilityAttackM':
|
||||
# Activate "standard attack" if available
|
||||
ability.active = True
|
||||
standardAttackActive = True
|
||||
@@ -64,8 +64,8 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
# Activate all other abilities (Neut, Web, etc) except propmods if no standard attack is active
|
||||
if ability.effect.isImplemented and \
|
||||
standardAttackActive is False and \
|
||||
ability.effect.handlerName != 'fighterabilitymicrowarpdrive' and \
|
||||
ability.effect.handlerName != 'fighterabilityevasivemaneuvers':
|
||||
ability.effect.name != 'fighterAbilityMicroWarpDrive' and \
|
||||
ability.effect.name != 'fighterAbilityEvasiveManeuvers':
|
||||
ability.active = True
|
||||
|
||||
@reconstructor
|
||||
|
||||
@@ -73,7 +73,7 @@ class FighterAbility(object):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self.__effect.getattr('displayName') or self.__effect.handlerName
|
||||
return self.__effect.getattr('displayName') or self.__effect.name
|
||||
|
||||
@property
|
||||
def attrPrefix(self):
|
||||
|
||||
@@ -21,8 +21,6 @@ class ItemEffects(wx.Panel):
|
||||
self.SetSizer(mainSizer)
|
||||
|
||||
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnClick, self.effectList)
|
||||
if config.debug:
|
||||
self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick, self.effectList)
|
||||
|
||||
self.PopulateList()
|
||||
|
||||
@@ -100,26 +98,6 @@ class ItemEffects(wx.Panel):
|
||||
|
||||
self.RefreshValues(event)
|
||||
|
||||
def OnRightClick(self, event):
|
||||
"""
|
||||
Debug use: open effect file with default application.
|
||||
If effect file does not exist, create it
|
||||
"""
|
||||
|
||||
effect = self.effects[event.GetText()]
|
||||
|
||||
file_ = os.path.join(config.pyfaPath, "eos", "effects", "%s.py" % effect.handlerName)
|
||||
|
||||
if not os.path.isfile(file_):
|
||||
open(file_, 'a').close()
|
||||
|
||||
if 'wxMSW' in wx.PlatformInfo:
|
||||
os.startfile(file_)
|
||||
elif 'wxMac' in wx.PlatformInfo:
|
||||
os.system("open " + file_)
|
||||
else:
|
||||
subprocess.call(["xdg-open", file_])
|
||||
|
||||
def RefreshValues(self, event):
|
||||
self.Freeze()
|
||||
self.effectList.ClearAll()
|
||||
|
||||
Reference in New Issue
Block a user