mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-21 22:58:05 +00:00
✨ Add Transformative Damage Support
This commit is contained in:
parent
028fa3a6f6
commit
14a9b8a55c
@ -40,8 +40,7 @@ from utils.log import logger
|
|||||||
from utils.uid import mask_number
|
from utils.uid import mask_number
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from python_genshin_artifact.calculator import get_damage_analysis
|
from python_genshin_artifact.calculator import get_damage_analysis, get_transformative_damage
|
||||||
from python_genshin_artifact.enka.characters import characters_map
|
|
||||||
from python_genshin_artifact.enka.enka_parser import enka_parser
|
from python_genshin_artifact.enka.enka_parser import enka_parser
|
||||||
from python_genshin_artifact.models.calculator import CalculatorConfig
|
from python_genshin_artifact.models.calculator import CalculatorConfig
|
||||||
from python_genshin_artifact.models.skill import SkillInfo
|
from python_genshin_artifact.models.skill import SkillInfo
|
||||||
@ -49,11 +48,10 @@ try:
|
|||||||
GENSHIN_ARTIFACT_FUNCTION_AVAILABLE = True
|
GENSHIN_ARTIFACT_FUNCTION_AVAILABLE = True
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
get_damage_analysis = None
|
get_damage_analysis = None
|
||||||
characters_map = {}
|
get_transformative_damage = None
|
||||||
enka_parser = None
|
enka_parser = None
|
||||||
CalculatorConfig = None
|
CalculatorConfig = None
|
||||||
SkillInfo = None
|
SkillInfo = None
|
||||||
Assets = None
|
|
||||||
|
|
||||||
GENSHIN_ARTIFACT_FUNCTION_AVAILABLE = False
|
GENSHIN_ARTIFACT_FUNCTION_AVAILABLE = False
|
||||||
|
|
||||||
@ -622,12 +620,18 @@ class RenderTemplate:
|
|||||||
skill=skill_info,
|
skill=skill_info,
|
||||||
artifact_config=artifact_config,
|
artifact_config=artifact_config,
|
||||||
)
|
)
|
||||||
damage_analysis = get_damage_analysis(calculator_config)
|
|
||||||
damage_key = skill.get("damage_key")
|
damage_key = skill.get("damage_key")
|
||||||
damage_value = getattr(damage_analysis, damage_key)
|
transformative_damage_key = skill.get("transformative_damage_key")
|
||||||
if damage_value is not None:
|
damage_info = {"skill_info": skill, "damage": None, "transformative_damage": None}
|
||||||
damage_info = {"damage": damage_value, "skill_info": skill}
|
if damage_key is not None:
|
||||||
damage.append(damage_info)
|
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
|
return damage
|
||||||
|
|
||||||
|
@ -10,9 +10,19 @@
|
|||||||
{% for item in damage_info %}
|
{% for item in damage_info %}
|
||||||
<tr class="text-center odd:bg-white odd:bg-opacity-10">
|
<tr class="text-center odd:bg-white odd:bg-opacity-10">
|
||||||
<td class="border px-4 py-2">{{ item.skill_info.name }}</td>
|
<td class="border px-4 py-2">{{ item.skill_info.name }}</td>
|
||||||
<td class="border px-4 py-2">{{ item.damage.critical|round|int }}</td>
|
{%- if item.damage != None -%}
|
||||||
<td class="border px-4 py-2">{{ item.damage.expectation|round|int }}</td>
|
{%- if item.damage.is_heal or item.damage.is_shield -%}
|
||||||
|
<td class="border px-4 py-2 " colspan="2">{{ item.damage.expectation|round|int }}</td>
|
||||||
|
{%- else -%}
|
||||||
|
<td class="border px-4 py-2">{{ item.damage.critical|round|int }}</td>
|
||||||
|
<td class="border px-4 py-2">{{ item.damage.expectation|round|int }}</td>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- elif item.transformative_damage != None -%}
|
||||||
|
<td class="border px-4 py-2 " colspan="2">{{ item.transformative_damage|round|int }}</td>
|
||||||
|
{%- else -%}
|
||||||
|
<td class="border px-4 py-2" colspan="2"></td>
|
||||||
|
{%- endif -%}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user