def test_random(self):
        """Generate a random weapon"""

        weap = D20Weapon.random_weapon()
        self.assertTrue(weap.value > 0)
        self.assertTrue(weap.sale_value > 0 and weap.sale_value < weap.value)
        self.assertTrue(weap.combat is not None)
        self.assertTrue(weap.material is not None)
Example #2
0
#!/usr/bin/python
from pathfindertreasure import D20Weapon, D20Coin
import sys

n = (len(sys.argv) > 1 and int(sys.argv[1])) or 20
for n in range(n):
    w = D20Weapon.random_weapon()
    print "%s: cost %s" % (w.describe(), D20Coin.coin_value(w.value))