экономика

This commit is contained in:
listik committed 2026-11-11 15:53:07 +03:00
1 parent 296988b199
commit 58ae93f9e6
28 files changed
+6503 -299

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
"""Read-only balance analysis; no game files modified. Python standard library only.
Expected-value budgets, NOT a full gameplay simulation. Run from any directory.
"""
import json
import math
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
# баланс ДО экономики v2 (снимок); текущий баланс считает tools/economy_model.py
source = (ROOT / 'tools/baseline/FishConfig_v1.lua').read_text(encoding='utf-8-sig')
fish_section = source.split('Config.Zones = {', 1)[1].split('Config.Rods = {', 1)[0]
fish = re.findall(r'rarity = "(\w+)",\s+price = (\d+),\s+xp = (\d+)', fish_section)
assert len(fish) == 36
rarities = ['Common', 'Uncommon', 'Rare', 'Epic', 'Legendary', 'Mythic']
base_weights = [55, 27, 11, 4.5, 1.2, .25]
def old_expectation(world, luck):
rows = fish[(world-1)*12:world*12]
weights = []
for rarity, _, _ in rows:
rank = rarities.index(rarity)
weights.append(base_weights[rank] / max(1, luck) if rank == 0
else base_weights[rank] * max(.2, 1 + (luck-1)*rank))
ps = [w / sum(weights) for w in weights]
# Sequential independent mutation rolls, no weather/event/bait mutation multipliers.
remaining, mutation_p, value_mult = 1., 0., 0.
for chance, mult in [(.002, 10), (.01, 5), (.04, 2)]:
p = remaining * min(1, chance*luck)
mutation_p += p
value_mult += p * mult
remaining -= p
value_mult += remaining
xp = sum(p*int(row[2]) for p, row in zip(ps, rows)) * (1 + mutation_p)
value = sum(p*int(row[1]) for p, row in zip(ps, rows)) * (0.75 + .9/3.2) * value_mult
return dict(world=world, luck=luck, xp_per_catch=round(xp, 3),
silver_per_catch_before_combo_sale=round(value, 3),
xp_per_min_4_catches_combo2=round(xp*8, 2))
minutes = [5,8,12,15,20,25,35,35,40,45,45,50,55,60,65,70,75,75,80,85,90,95,100,115]
rows, elapsed = [], 0
for level, target in enumerate(minutes, 1):
world = 1 if level < 8 else 2 if level < 18 else 3
rate = {1:20, 2:28, 3:36}[world]
elapsed += target
rows.append(dict(from_level=level, to_level=level+1, world=world,
xp_required=target*rate, target_minutes=target,
cumulative_minutes=elapsed))
milestones = [r for r in rows if r['to_level'] in [3,5,8,10,13,18,25]]
# Proposed career XP = fixed 5/7/9 per successful manual catch by world.
# Other rewards move to silver/materials/research, not career XP.
scenarios = []
for catches in [3,4,5]:
rates = {w:catches*base for w,base in [(1,5),(2,7),(3,9)]}
for milestone in [8,18,25]:
t = sum(r['xp_required']/rates[r['world']] for r in rows if r['to_level'] <= milestone)
scenarios.append(dict(catches_per_effective_minute=catches,to_level=milestone,minutes=round(t,1)))
result = dict(
assumptions='Current: stationary catch expectations, excludes quests, first discoveries, collection rewards and catch timing. Proposed: budget model, 4 successful manual catches/effective minute, fixed career XP 5/7/9 per world; no other career XP sources or multipliers. Proposed world access exactly at levels 8/18; guild must not add delays. Effective minutes include normal travel/selling, exclude AFK.',
current_xp_to_level={str(l):sum(math.floor(50*k**1.6) for k in range(1,l)) for l in [3,5,8,18,25]},
current_expectations=[old_expectation(w,luck) for w,luck in [(1,1),(1,1.8),(2,2.5),(3,4)]],
proposed_levels=rows, milestones=milestones, sensitivity=scenarios)
out = ROOT/'docs'/'progression-budget-results.json'
out.write_text(json.dumps(result,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
table = ['| Переход | Мир | XP на переход | Минут на переход | Минут всего |',
'|---|---:|---:|---:|---:|']
for r in rows:
table.append(f"| {r['from_level']} → {r['to_level']} | {r['world']} | {r['xp_required']} | {r['target_minutes']} | {r['cumulative_minutes']} |")
(ROOT/'docs'/'progression-level-table.md').write_text(
'# Предлагаемая кривая уровней\n\n'
'Расчёт бюджета, не замер живых игроков и не симуляция клиента. '
'4 успешные ручные поимки за минуту эффективной игры, включая обычные перемещения и продажу, без AFK. '
'Опыт карьеры: 5/7/9 за рыбу миров 1/2/3. Других источников и множителей XP карьеры нет. '
'Доступ к мирам на уровнях 8/18; ранг не добавляет ожидания. '
'Таблица не применена к игре.\n\n'+'\n'.join(table)+'\n',encoding='utf-8')
print(json.dumps({k:v for k,v in result.items() if k not in ['proposed_levels','assumptions']}, ensure_ascii=False,indent=2))