diff --git a/plugins/genshin/player_cards.py b/plugins/genshin/player_cards.py index 2e95540d..3cbd6ec3 100644 --- a/plugins/genshin/player_cards.py +++ b/plugins/genshin/player_cards.py @@ -40,8 +40,7 @@ from utils.log import logger from utils.uid import mask_number try: - from python_genshin_artifact.calculator import get_damage_analysis - from python_genshin_artifact.enka.characters import characters_map + from python_genshin_artifact.calculator import get_damage_analysis, get_transformative_damage from python_genshin_artifact.enka.enka_parser import enka_parser from python_genshin_artifact.models.calculator import CalculatorConfig from python_genshin_artifact.models.skill import SkillInfo @@ -49,11 +48,10 @@ try: GENSHIN_ARTIFACT_FUNCTION_AVAILABLE = True except ImportError as exc: get_damage_analysis = None - characters_map = {} + get_transformative_damage = None enka_parser = None CalculatorConfig = None SkillInfo = None - Assets = None GENSHIN_ARTIFACT_FUNCTION_AVAILABLE = False @@ -622,12 +620,18 @@ class RenderTemplate: skill=skill_info, artifact_config=artifact_config, ) - damage_analysis = get_damage_analysis(calculator_config) damage_key = skill.get("damage_key") - damage_value = getattr(damage_analysis, damage_key) - if damage_value is not None: - damage_info = {"damage": damage_value, "skill_info": skill} - damage.append(damage_info) + transformative_damage_key = skill.get("transformative_damage_key") + damage_info = {"skill_info": skill, "damage": None, "transformative_damage": None} + if damage_key is not None: + damage_analysis = get_damage_analysis(calculator_config) + damage_value = getattr(damage_analysis, damage_key) + damage_info["damage"] = damage_value + if transformative_damage_key is not None: + transformative_damage = get_transformative_damage(calculator_config) + transformative_damage_value = getattr(transformative_damage, transformative_damage_key) + damage_info["transformative_damage"] = transformative_damage_value + damage.append(damage_info) return damage diff --git a/resources/genshin/player_card/damage.jinja2 b/resources/genshin/player_card/damage.jinja2 index f9920767..54f1013f 100644 --- a/resources/genshin/player_card/damage.jinja2 +++ b/resources/genshin/player_card/damage.jinja2 @@ -10,9 +10,19 @@ {% for item in damage_info %} {{ item.skill_info.name }} - {{ item.damage.critical|round|int }} - {{ item.damage.expectation|round|int }} + {%- if item.damage != None -%} + {%- if item.damage.is_heal or item.damage.is_shield -%} + {{ item.damage.expectation|round|int }} + {%- else -%} + {{ item.damage.critical|round|int }} + {{ item.damage.expectation|round|int }} + {%- endif -%} + {%- elif item.transformative_damage != None -%} + {{ item.transformative_damage|round|int }} + {%- else -%} + + {%- endif -%} {% endfor %} - \ No newline at end of file +