diff --git a/dlparse/export/entry/normal_attack.py b/dlparse/export/entry/normal_attack.py index 0b4ccf71..10577faf 100644 --- a/dlparse/export/entry/normal_attack.py +++ b/dlparse/export/entry/normal_attack.py @@ -57,8 +57,13 @@ class NormalAttackBranchedChainEntry(JsonExportableEntryBase): combos: list[NormalAttackComboEntry] = field(init=False) + has_utp: bool = field(init=False) + has_crisis_mods: bool = field(init=False) + def __post_init__(self, branched_combos: list[NormalAttackComboBranch]): self.combos = [NormalAttackComboEntry(combo) for combo in branched_combos] + self.has_utp = any(combo.utp_gain > 0 for combo in branched_combos) + self.has_crisis_mods = any(any(combo.crisis_mod) for combo in branched_combos) @classmethod @property @@ -66,12 +71,16 @@ def json_schema(cls) -> JsonSchema: return { "conditions": [int], "combos": [NormalAttackComboEntry.json_schema], + "hasUtp": bool, + "hasCrisis": bool, } def to_json_entry(self) -> dict[str, Any]: return { "conditions": [condition.value for condition in self.conditions.conditions_sorted], "combos": self.combos, + "hasUtp": self.has_utp, + "hasCrisis": self.has_crisis_mods, } diff --git a/tests/test_export/test_normal_attack.py b/tests/test_export/test_normal_attack.py index 4a6b1c82..fa0619dc 100644 --- a/tests/test_export/test_normal_attack.py +++ b/tests/test_export/test_normal_attack.py @@ -13,3 +13,36 @@ def test_exported_json(asset_manager: AssetManager): for entries in entry_dict.values(): for entry in entries: is_json_schema_match(NormalAttackChainEntry.json_schema, entry.to_json_entry()) + + +def test_branched_chain_has_utp_has_crisis(asset_manager: AssetManager): + # Bellina (10350503) + # - Mode 12: Unique Transform + # - Unique Combo 12 + # - Action ID 300300 + chain_data = asset_manager.transformer_atk.transform_normal_attack(300300) + chain_data = NormalAttackChainEntry(asset_manager, 12, chain_data).chain_branches[0] + assert chain_data.has_utp + assert chain_data.has_crisis_mods + + +def test_branched_chain_has_utp_no_crisis(asset_manager: AssetManager): + # Nino (10150305) + # - Mode 95: Unique Transform + # - Unique Combo 67 + # - Action ID 101100 + chain_data = asset_manager.transformer_atk.transform_normal_attack(101100) + chain_data = NormalAttackChainEntry(asset_manager, 95, chain_data).chain_branches[0] + assert chain_data.has_utp + assert not chain_data.has_crisis_mods + + +def test_branched_chain_no_utp_no_crisis(asset_manager: AssetManager): + # Gala Mascula (10250203) + # - Mode 93: Normal + # - Unique Combo 65 + # - Action ID 202700 + chain_data = asset_manager.transformer_atk.transform_normal_attack(202700) + chain_data = NormalAttackChainEntry(asset_manager, 93, chain_data).chain_branches[0] + assert not chain_data.has_utp + assert not chain_data.has_crisis_mods