import math
import unreal


MOVEMENT_DEFAULTS = {
    "WalkSpeed": 140.0,
    "SprintSpeed": 550.0,
    "SprintStaminaCostPerSecond": 28.0,
    "MinSprintStamina": 5.0,
    "AgeYears": 25.0,
    "PhysicalConditionMultiplier": 1.0,
    "StrengthMultiplier": 1.0,
    "EnduranceMultiplier": 1.0,
    "ComfortableCarryWeight": 25.0,
    "HeavyCarryWeight": 60.0,
    "TerrainMovementMultiplier": 1.0,
}


def load(path):
    asset = unreal.EditorAssetLibrary.load_asset(path)
    if not asset:
        raise RuntimeError(f"Could not load {path}")
    return asset


def main():
    character_bp = load("/Game/Agrarian/Blueprints/Characters/BP_AgrarianPlayerCharacter")
    character_cdo = unreal.get_default_object(character_bp.generated_class())

    mismatches = []
    for property_name, expected in MOVEMENT_DEFAULTS.items():
        actual = float(character_cdo.get_editor_property(property_name))
        if not math.isclose(actual, expected, rel_tol=0.0, abs_tol=0.01):
            mismatches.append(f"{property_name}: expected {expected}, got {actual}")

    if mismatches:
        raise RuntimeError("Movement baseline verification failed: " + "; ".join(mismatches))

    unreal.log("Agrarian movement baseline verification complete.")


main()
