changing the altar of Valkyrie to use flesh exp if available

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@4903 282e977c-c81d-0410-88c4-b93c2d0d6712
master
lalo 2006-09-09 16:59:07 +00:00
parent 7eeea86ac4
commit c2bcf26d79
1 changed files with 21 additions and 12 deletions

View File

@ -14,35 +14,44 @@ if praying and praying.Title == 'Valkyrie':
obj = altar.Above obj = altar.Above
while obj: while obj:
if obj.Type & 0xffff == t.FLESH: if obj.Type & 0xffff == t.FLESH:
factor = 0 level_factor = 0
part_factor = 1
if obj.Level < praying.Level / 2: if obj.Level < praying.Level / 2:
pl.Write('Valkyrie scorns your pathetic sacrifice!') pl.Write('Valkyrie scorns your pathetic sacrifice!')
elif obj.Level < praying.Level: elif obj.Level < praying.Level:
accept('poor') accept('poor')
factor = 0.5 level_factor = 0.5
elif obj.Level < praying.Level * 1.5: elif obj.Level < praying.Level * 1.5:
accept('modest') accept('modest')
factor = 1 level_factor = 1
elif obj.Level < praying.Level * 2: elif obj.Level < praying.Level * 2:
accept('adequate') accept('adequate')
factor = 1.5 level_factor = 1.5
elif obj.Level < praying.Level * 5: elif obj.Level < praying.Level * 5:
accept('devout') accept('devout')
factor = 2 level_factor = 2
else: else:
accept('heroic') accept('heroic')
factor = 2.5 level_factor = 2.5
# heads and hearts are worth more. Because. # heads and hearts are worth more. Because.
if obj.Name.endswith('head') or obj.Name.endswith('heart'): if obj.Name.endswith('head') or obj.Name.endswith('heart'):
factor *= 1.5 part_factor = 1.5
# flesh with lots of resists is worth more if obj.Exp:
res = 0 # obj has stored exp, use it
for at in range(26): # XXX should be NROFATTACKS value = obj.Exp / 5 * part_factor
res += obj.GetResist(at)
else:
# no stored exp, estimate
# flesh with lots of resists is worth more
res = 0
for at in range(26): # XXX should be NROFATTACKS
res += obj.GetResist(at)
value = max(res, 10) * level_factor * part_factor
value = max(res, 10) * factor
if obj.Quantity > 1: if obj.Quantity > 1:
obj.Quantity -= 1 obj.Quantity -= 1
else: else: