﻿create_artifact_mysterious_tome_effect = {
    # Get the character the artifact is being made for.
    $OWNER$ = { save_scope_as = owner }
    # Not really used, but if we don't set the scopes we get errors in the feature selection
    set_artifact_rarity_illustrious = yes
    
    # Create the artifact
    create_artifact = {
        name = artifact_mysterious_tome_name
        description = artifact_mysterious_tome_description
        type = book
        template = pog_mysterious_tome_template
        visuals = book
        wealth = scope:wealth
        quality = scope:quality
        history = {
            type = created_before_history
        }
        modifier = mysterious_tome_modifier
        save_scope_as = newly_created_artifact
        decaying = no
    }
    
    scope:newly_created_artifact = {
        set_variable = { name = historical_unique_artifact value = yes }
        set_variable = mysterious_tome
        save_scope_as = epic
        save_scope_value_as = {
            name = mysterious_tome
            value = yes
        }
    }
}