Limit allowed range of stats for rings of Occidental Mages in /python/items/ring_occidental_mages.py
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@11414 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
694b57694c
commit
f7fc91ba12
|
@ -5,30 +5,41 @@ me = Crossfire.WhoAmI()
|
|||
ac = Crossfire.WhoIsActivator()
|
||||
r = random.random()
|
||||
|
||||
# Event is called before object is applied, so changing our properties just before it's actually
|
||||
# applied instead of when removed
|
||||
# Event is called before object is applied, so changing our properties just
|
||||
# before it's actually applied instead of when removed
|
||||
#
|
||||
# To prevent insane stats like (Dex+127)(Con+85)(Int+57) (see bug #2369654) we
|
||||
# limit allowed range to +/- 2 for each stat. If we don't change due to these
|
||||
# limits, we will not fall back to next (to make it harder to get a "perfect"
|
||||
# ring), but instead just do nothing.
|
||||
if (me.Applied == 0):
|
||||
if (r <= 0.01):
|
||||
me.Cursed= 1
|
||||
me.Dex = me.Dex + 1
|
||||
me.Identified=0
|
||||
if me.Dex < 2:
|
||||
me.Cursed= 1
|
||||
me.Dex = me.Dex + 1
|
||||
me.Identified=0
|
||||
elif (r <= 0.02):
|
||||
me.Cursed= 1
|
||||
me.Int = me.Int + 1
|
||||
me.Identified=0
|
||||
if me.Int < 2:
|
||||
me.Cursed= 1
|
||||
me.Int = me.Int + 1
|
||||
me.Identified=0
|
||||
elif (r <= 0.03):
|
||||
me.Cursed= 1
|
||||
me.Con = me.Con + 1
|
||||
me.Identified=0
|
||||
if me.Con < 2:
|
||||
me.Cursed= 1
|
||||
me.Con = me.Con + 1
|
||||
me.Identified=0
|
||||
elif (r >= 0.97):
|
||||
me.Cursed= 1
|
||||
me.Dex = me.Dex - 1
|
||||
me.Identified=0
|
||||
if me.Dex > -2:
|
||||
me.Cursed= 1
|
||||
me.Dex = me.Dex - 1
|
||||
me.Identified=0
|
||||
elif (r >= 0.98):
|
||||
me.Cursed= 1
|
||||
me.Int = me.Int - 1
|
||||
me.Identified=0
|
||||
if me.Int > -2:
|
||||
me.Cursed= 1
|
||||
me.Int = me.Int - 1
|
||||
me.Identified=0
|
||||
elif (r >= 0.99):
|
||||
me.Cursed= 1
|
||||
me.Con = me.Con - 1
|
||||
me.Identified=0
|
||||
if me.Con > -2:
|
||||
me.Cursed= 1
|
||||
me.Con = me.Con - 1
|
||||
me.Identified=0
|
||||
|
|
Loading…
Reference in New Issue