883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
52 lines
2.6 KiB
Python
52 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Focused offline checks for source random properties -> native ItemBonus lists."""
|
|
import sys
|
|
from pathlib import Path
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'ops'))
|
|
import item_random_property_compat as m # noqa: E402
|
|
from item_sparse_compat import intrinsic_stat_fields # noqa: E402
|
|
|
|
COLS = ['entry'] + ['effect%d' % i for i in (1, 2, 3)] + ['effectApplyAuraName%d' % i for i in (1, 2, 3)] + \
|
|
['effectMiscValue%d' % i for i in (1, 2, 3)] + ['effectBasePoints%d' % i for i in (1, 2, 3)] + ['effectDieSides%d' % i for i in (1, 2, 3)]
|
|
|
|
|
|
def spell(*effects):
|
|
row = dict.fromkeys(COLS, 0)
|
|
for i, (aura, misc, bp) in enumerate(effects, 1):
|
|
row.update({'effect%d' % i: 6, 'effectApplyAuraName%d' % i: aura, 'effectMiscValue%d' % i: misc,
|
|
'effectBasePoints%d' % i: bp, 'effectDieSides%d' % i: 1})
|
|
return row
|
|
|
|
|
|
def test_spell_families():
|
|
assert m.spell_stats(spell((29, 2, 4)))[0] == [(7, 5)] # +5 Stamina
|
|
assert m.spell_stats(spell((22, 4, 9)))[0] == [(51, 10)] # fire resistance
|
|
assert m.spell_stats(spell((13, 4, 16)))[0] == [(85, 17)] # "of Fiery Wrath"
|
|
assert m.spell_stats(spell((99, 0, 23), (124, 0, 23)))[0] == [(38, 24)]
|
|
assert m.spell_stats(spell((13, 126, 6), (135, 126, 6)))[0] == [(45, 7)]
|
|
assert m.spell_stats(spell((49, 0, 0)))[0] is None
|
|
|
|
|
|
def test_budget_column_matches_item_sparse():
|
|
points = dict(GoodF=[10, 20, 30, 40, 50], SuperiorF=[1] * 5, EpicF=[1] * 5)
|
|
for cls, sub, inv in ((4, 1, 1), (4, 2, 5), (4, 3, 7), (4, 4, 10), (4, 1, 16), (2, 7, 13), (2, 1, 17),
|
|
(2, 2, 15), (2, 19, 26), (2, 16, 25), (4, 6, 14), (4, 0, 2), (4, 0, 11)):
|
|
proto = {'armor': 0, 'item_level': 10, 'entry': 1, 'inventory_type': inv, 'quality': 2, 'class': cls, 'subclass': sub, 'stat_value1': 7, 'stat_type1': 7,
|
|
**{'stat_value%d' % i: 0 for i in range(2, 11)}, **{'stat_type%d' % i: 0 for i in range(2, 11)}}
|
|
expected = intrinsic_stat_fields(proto, points)['StatPercentEditor'][0]
|
|
column = m.budget_column(inv, cls, sub)
|
|
assert int(expected * points['GoodF'][column] * .0001 + .5) == 7, (cls, sub, inv)
|
|
|
|
|
|
def test_header_resolve_rows_sorted():
|
|
text = m.header([(10, 5, 14000), (10, 9, 14001), (12, 5, 14002)])
|
|
assert 'Rows[]={{10,5,14000},{10,9,14001},{12,5,14002}}' in text
|
|
assert 'Rows[]={{0,0,0}}' in m.header([])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
for name, fn in list(globals().items()):
|
|
if name.startswith('test_'):
|
|
fn()
|
|
print('item_random_property_compat_test PASS')
|