S = P * 2400 - N * 800 + BP - DP
where:
S — the final cost of the artifact;
P — the number of positive bonuses to the hero's stats;
N — the number of negative bonuses to the hero's stats;
BP — the strength of the buff, not related to the hero's stats;
DP — the strength of the debuff, not related to the hero's stats;
The attachment shows the program calculating the final cost of the "Sea Elf Sextant" artifact using the formula (the artifact in the mod not only allows movement across the sea but also gives +1 to luck and morale). Please do not pay attention to "artifact works from the backpack" and "artifact is part of a set."