Skip to content

Commit 26714ca

Browse files
committed
Weapon goals
1 parent 10ef2fe commit 26714ca

17 files changed

+11
-6
lines changed

args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def setup():
88
global debug,reference
99
p=argparse.ArgumentParser()
10-
p.add_argument('--reference',action='store',help='path to the "Torchlight II" installation directory',required=True)
10+
p.add_argument('-r','--reference',action='store',help='path to the "Torchlight II" installation directory',required=True)
1111
p.add_argument('--debug',action='store_true')
1212
args=p.parse_args()
1313
debug=args.debug

generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(self,to):
7575
class ReplaceRarity(Replace):
7676
def __init__(self,tier,ratio=1):
7777
self.pattern='<INTEGER>RARITY:'
78-
self.replacement=f'\t<INTEGER>RARITY:{round(tier.rarity*ratio)}\n'
78+
self.replacement=f'\t<INTEGER>RARITY:{round(tier.rarity*goal.maxgoals*2*ratio)}\n'
7979

8080
class ReplaceDungeon(Replace):
8181
def __init__(self,name):

goal.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ class Vendor(Goal):
2828
Vendor('set merchant','AM_NPC_SETS'),Vendor('socketer','AM_NPC_SOCKETER')]#TODO UNIT:GAMBLER_SECRETROOM
2929
potions=[Goal('potions','AM_POTION',0,12)]
3030
shrines=[Goal('shrines','AM_SHRINE')]
31-
categories=[vendors,potions,shrines,]
31+
weapons=[Goal('weapons','am_weapon'),Goal('axes','am_weapon_axe'),Goal('bows','am_weapon_bow'),
32+
Goal('cannons','am_weapon_cannon'),Goal('crossbows','am_weapon_crossbow'),Goal('daggers','am_weapon_dagger'),
33+
Goal('fists','am_weapon_fist'),Goal('maces','am_weapon_mace'),Goal('pistols','am_weapon_pistol'),
34+
Goal('polearms','am_weapon_polearm'),Goal('rifles','am_weapon_rifle'),Goal('staffs','am_weapon_staff'),
35+
Goal('swords','am_weapon_sword'),Goal('wands','am_weapon_wand')]
36+
categories=[vendors,potions,shrines,weapons]
37+
maxgoals=max(len(c) for c in categories)
3238

3339
def search():
3440
import load,generate
@@ -45,19 +51,18 @@ def search():
4551
print(f'{r}: {rewards[r]}')
4652

4753
def distribute():
48-
percategory=1/len(categories)
4954
for c in categories:
5055
n=len(c)
5156
if n==1:
5257
continue
53-
rarity=percategory/2
58+
rarity=1/2
5459
c[0].rarity=rarity
5560
rarity/=n-1
5661
for goal in c[1:]:
5762
goal.rarity=rarity
5863

5964
def reward():
6065
distribute()
61-
for c in [potions,shrines] if args.debug else categories:
66+
for c in [weapons] if args.debug else categories:
6267
for goal in c:
6368
yield goal
3.81 KB
Binary file not shown.
402 Bytes
Binary file not shown.
402 Bytes
Binary file not shown.
414 Bytes
Binary file not shown.
422 Bytes
Binary file not shown.
414 Bytes
Binary file not shown.
406 Bytes
Binary file not shown.
406 Bytes
Binary file not shown.
414 Bytes
Binary file not shown.
418 Bytes
Binary file not shown.
410 Bytes
Binary file not shown.
410 Bytes
Binary file not shown.
410 Bytes
Binary file not shown.
406 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)