#These are the relevant classes class Debuff: def __init__(self, Name, Multiplier, Explanation): self.name = Name self.multiplier = Multiplier self.explanation = Explanation class Lock_On: def __init__(self, LockedOnPosition = None): self.lockedOnPosition = LockedOnPosition class VulnerabilityClass: def __init__(self, Vulnerability): self.vulnerability = Vulnerability class Lock_On_Vulnerability_Debuff(Debuff, VulnerabilityClass, Lock_On): def __init__(self, Name, Multiplier, Explanation, Vulnerability): Debuff.__init__(self, Name, Multiplier, Explanation) Vulnerability.__init__(self, Vulnerability) Lock_On.__init__(self) #This is the object of that class Proof_of_Debt = Lock_On_Vulnerability_Debuff("Proof of Debt", 50.0, "Target takes 50% more damage from follow-up attacks", "FUA") #func to determine damage dealt def damage(TookTurn, Target, Attack): Vulnerability_Multiplier = 1 Crit = crit(TookTurn.stats.CRT_RATE) if Attack.scaler == "ATK": BaseDMG = TookTurn.stats.ATK * Attack.multiplier / 100 elif Attack.scaler == "DEF": BaseDMG = TookTurn.stats.DEF * Attack.multiplier / 100 DMGBOOST = 1 + TookTurn.stats.ELM_DMGBOOST / 100 + TookTurn.stats.DMGBOOST / 100 DEF = 1 - (Target.stats.DEF / (Target.stats.DEF + 200 + 10 * TookTurn.stats.level)) if Crit: CRT = 1 + TookTurn.stats.CRT_DMG / 100 print("Critical!") else: CRT = 1 if len(Target.vulnerabilityDebuffs) > 0: for Vulnerability_Debuff in Target.vulnerabilityDebuffs: for type in Attack.types: print(Vulnerability_Debuff.name)#debugging by checking if other #attributes work# if type == Vulnerability_Debuff.vulnerability: ###This is line 44### Vulnerability_Multiplier += Vulnerability_Debuff.multiplier / 100 else: Vulnerability_Multiplier += 0 Damage_Dealt = floor(BaseDMG * CRT * DMGBOOST * DEF * Vulnerability_Multiplier) return Damage_Dealt #This is the console output just before and at the time of error Training Dummy now has 9988471 HP and 0 shield left. Critical! Proof of Debt #the other attribute does work Traceback (most recent call last): File "/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py", line 333, in <module> Fastest(Active_Units) File "/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py", line 258, in Fastest Damage_Dealt = damage(TookTurn, Target, TookTurn.Skill.Trigger) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py", line 44, in damage if type == Vulnerability_Debuff.vulnerability: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Lock_On_Vulnerability_Debuff' object has no attribute 'vulnerability'
submitted by /u/BahaChicken
[link] [comments]
r/learnpython #These are the relevant classes class Debuff: def __init__(self, Name, Multiplier, Explanation): self.name = Name self.multiplier = Multiplier self.explanation = Explanation class Lock_On: def __init__(self, LockedOnPosition = None): self.lockedOnPosition = LockedOnPosition class VulnerabilityClass: def __init__(self, Vulnerability): self.vulnerability = Vulnerability class Lock_On_Vulnerability_Debuff(Debuff, VulnerabilityClass, Lock_On): def __init__(self, Name, Multiplier, Explanation, Vulnerability): Debuff.__init__(self, Name, Multiplier, Explanation) Vulnerability.__init__(self, Vulnerability) Lock_On.__init__(self) #This is the object of that class Proof_of_Debt = Lock_On_Vulnerability_Debuff(“Proof of Debt”, 50.0, “Target takes 50% more damage from follow-up attacks”, “FUA”) #func to determine damage dealt def damage(TookTurn, Target, Attack): Vulnerability_Multiplier = 1 Crit = crit(TookTurn.stats.CRT_RATE) if Attack.scaler == “ATK”: BaseDMG = TookTurn.stats.ATK * Attack.multiplier / 100 elif Attack.scaler == “DEF”: BaseDMG = TookTurn.stats.DEF * Attack.multiplier / 100 DMGBOOST = 1 + TookTurn.stats.ELM_DMGBOOST / 100 + TookTurn.stats.DMGBOOST / 100 DEF = 1 – (Target.stats.DEF / (Target.stats.DEF + 200 + 10 * TookTurn.stats.level)) if Crit: CRT = 1 + TookTurn.stats.CRT_DMG / 100 print(“Critical!”) else: CRT = 1 if len(Target.vulnerabilityDebuffs) > 0: for Vulnerability_Debuff in Target.vulnerabilityDebuffs: for type in Attack.types: print(Vulnerability_Debuff.name)#debugging by checking if other #attributes work# if type == Vulnerability_Debuff.vulnerability: ###This is line 44### Vulnerability_Multiplier += Vulnerability_Debuff.multiplier / 100 else: Vulnerability_Multiplier += 0 Damage_Dealt = floor(BaseDMG * CRT * DMGBOOST * DEF * Vulnerability_Multiplier) return Damage_Dealt #This is the console output just before and at the time of error Training Dummy now has 9988471 HP and 0 shield left. Critical! Proof of Debt #the other attribute does work Traceback (most recent call last): File “/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py”, line 333, in <module> Fastest(Active_Units) File “/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py”, line 258, in Fastest Damage_Dealt = damage(TookTurn, Target, TookTurn.Skill.Trigger) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File “/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py”, line 44, in damage if type == Vulnerability_Debuff.vulnerability: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: ‘Lock_On_Vulnerability_Debuff’ object has no attribute ‘vulnerability’ submitted by /u/BahaChicken [link] [comments]
#These are the relevant classes class Debuff: def __init__(self, Name, Multiplier, Explanation): self.name = Name self.multiplier = Multiplier self.explanation = Explanation class Lock_On: def __init__(self, LockedOnPosition = None): self.lockedOnPosition = LockedOnPosition class VulnerabilityClass: def __init__(self, Vulnerability): self.vulnerability = Vulnerability class Lock_On_Vulnerability_Debuff(Debuff, VulnerabilityClass, Lock_On): def __init__(self, Name, Multiplier, Explanation, Vulnerability): Debuff.__init__(self, Name, Multiplier, Explanation) Vulnerability.__init__(self, Vulnerability) Lock_On.__init__(self) #This is the object of that class Proof_of_Debt = Lock_On_Vulnerability_Debuff("Proof of Debt", 50.0, "Target takes 50% more damage from follow-up attacks", "FUA") #func to determine damage dealt def damage(TookTurn, Target, Attack): Vulnerability_Multiplier = 1 Crit = crit(TookTurn.stats.CRT_RATE) if Attack.scaler == "ATK": BaseDMG = TookTurn.stats.ATK * Attack.multiplier / 100 elif Attack.scaler == "DEF": BaseDMG = TookTurn.stats.DEF * Attack.multiplier / 100 DMGBOOST = 1 + TookTurn.stats.ELM_DMGBOOST / 100 + TookTurn.stats.DMGBOOST / 100 DEF = 1 - (Target.stats.DEF / (Target.stats.DEF + 200 + 10 * TookTurn.stats.level)) if Crit: CRT = 1 + TookTurn.stats.CRT_DMG / 100 print("Critical!") else: CRT = 1 if len(Target.vulnerabilityDebuffs) > 0: for Vulnerability_Debuff in Target.vulnerabilityDebuffs: for type in Attack.types: print(Vulnerability_Debuff.name)#debugging by checking if other #attributes work# if type == Vulnerability_Debuff.vulnerability: ###This is line 44### Vulnerability_Multiplier += Vulnerability_Debuff.multiplier / 100 else: Vulnerability_Multiplier += 0 Damage_Dealt = floor(BaseDMG * CRT * DMGBOOST * DEF * Vulnerability_Multiplier) return Damage_Dealt #This is the console output just before and at the time of error Training Dummy now has 9988471 HP and 0 shield left. Critical! Proof of Debt #the other attribute does work Traceback (most recent call last): File "/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py", line 333, in <module> Fastest(Active_Units) File "/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py", line 258, in Fastest Damage_Dealt = damage(TookTurn, Target, TookTurn.Skill.Trigger) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bahachicken/PycharmProjects/Honkai: Star Railing time/Gameplay.py", line 44, in damage if type == Vulnerability_Debuff.vulnerability: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Lock_On_Vulnerability_Debuff' object has no attribute 'vulnerability'
submitted by /u/BahaChicken
[link] [comments]