def increment_equipment_rarity(self, artifact): artifact.rarity = artifacts_relations.RARITY(artifact.rarity.value + 1) artifact.power = Power.artifact_power_randomized( distribution=artifact.record.power_type.distribution, level=self.level) artifact.max_integrity = int( artifact.rarity.max_integrity * random.uniform(1 - c.ARTIFACT_MAX_INTEGRITY_DELTA, 1 + c.ARTIFACT_MAX_INTEGRITY_DELTA)) self.reset_accessors_cache()
def purchase_artifact(self, rarity, better): distribution = self.preferences.archetype.power_distribution power = Power.better_artifact_power_randomized( distribution, self.level) if better else Power.artifact_power_randomized( distribution, self.level) artifacts_storage.sync() artifact = random.choice(artifacts_storage.artifacts).create_artifact( level=self.level, power=power, rarity=rarity) self.put_loot(artifact, force=True) self.actions.request_replane() return artifact
def generate_artifact_from_list(self, artifacts_list, level, rarity): artifact_choices = [] for artifact_record in artifacts_list: if artifact_record.state.is_ENABLED and artifact_record.accepted_for_level(level): artifact_choices.append(artifact_record) if not artifact_choices: return None artifact_record = random.choice(artifact_choices) if artifact_record.is_useless: power = Power(0, 0) else: power = Power.artifact_power_randomized(distribution=artifact_record.power_type.distribution, level=level) return artifact_record.create_artifact(level=level, power=power, rarity=rarity)
def purchase_artifact(self, rarity, better): distribution = self.preferences.archetype.power_distribution power = Power.better_artifact_power_randomized(distribution, self.level) if better else Power.artifact_power_randomized(distribution, self.level) artifacts_storage.sync() artifact = random.choice(artifacts_storage.artifacts).create_artifact(level=self.level, power=power, rarity=rarity) self.put_loot(artifact, force=True) self.actions.request_replane() return artifact
def increment_equipment_rarity(self, artifact): artifact.rarity = artifacts_relations.RARITY(artifact.rarity.value+1) artifact.power = Power.artifact_power_randomized(distribution=artifact.record.power_type.distribution, level=self.level) artifact.max_integrity = int(artifact.rarity.max_integrity * random.uniform(1-c.ARTIFACT_MAX_INTEGRITY_DELTA, 1+c.ARTIFACT_MAX_INTEGRITY_DELTA)) self.reset_accessors_cache()