Exemplo n.º 1
0
def test_stat_scale_exp():
    owner = StatsOwner()
    s = Stat("int")
    s.base_value = 10
    s.scale_method = s.lvl_scale_exp
    s.scale_amount = 1
    owner.claim(s)
    owner.set_lvl(1)
    s.update()
    lvl1 = s.get_value()
    owner.set_lvl(20)
    s.update()
    lvl20 = s.get_value()
    assert lvl1 == 10 and lvl20 == 18
Exemplo n.º 2
0
def test_stat_scale_flat():
    owner = StatsOwner()
    s = Stat("int")
    s.base_value = 10
    s.scale_method = s.scale_flat
    s.scale_stat = "lvl"
    s.scale_amount = 1
    owner.claim(s)
    owner.set_lvl(1)
    s.update()
    lvl1 = s.get_value()
    owner.set_lvl(10)
    s.update()
    lvl10 = s.get_value()
    assert lvl1 == 10 and lvl10 == 19
Exemplo n.º 3
0
def test_statsowner_claim_multiple():
    so = StatsOwner()
    s1 = Stat("str")
    s2 = Stat("int")
    so.claim([s1, s2])
    assert s1.owner == so and s2.owner == so
Exemplo n.º 4
0
def test_statsowner_claim():
    so = StatsOwner()
    s1 = Stat("str")
    s2 = Stat("int")
    so.claim(s2)
    assert not s1.owner and s2.owner == so