[wpdev-commits] xmlscripts/scripts/wolfpack properties.py,1.18,1.19
Brought to you by:
rip,
thiagocorrea
From: Richard M. <dr...@us...> - 2004-10-08 18:52:10
|
Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12865/wolfpack Modified Files: properties.py Log Message: Meh, possible changes with Samurai Empire Index: properties.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/properties.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** properties.py 6 Oct 2004 20:06:00 -0000 1.18 --- properties.py 8 Oct 2004 18:51:53 -0000 1.19 *************** *** 16,26 **** # def getdelay(attacker, weapon): ! speed = fromitem(weapon, SPEED) ! value = (attacker.stamina + 100) * speed bonus = fromchar(attacker, SPEEDBONUS) ! # Scale value according to bonus value += bonus * value / 100 --- 16,26 ---- # def getdelay(attacker, weapon): ! speed = fromitem(weapon, SPEED) ! value = (attacker.stamina + 100) * speed bonus = fromchar(attacker, SPEEDBONUS) ! # Scale value according to bonus value += bonus * value / 100 *************** *** 54,58 **** SPELLCHANNELING: ['spellchanneling', 0, 0], MAGEARMOR: ['magearmor', 0, 0], ! # % Boni LOWERREQS: ['lower_reqs', 0, 1], --- 54,58 ---- SPELLCHANNELING: ['spellchanneling', 0, 0], MAGEARMOR: ['magearmor', 0, 0], ! # % Boni LOWERREQS: ['lower_reqs', 0, 1], *************** *** 79,83 **** REGENSTAMINA: ['regenstamina', 0, 1], REGENMANA: ['regenmana', 0, 1], ! # Misc LUCK: ['luck', 0, 1], --- 79,83 ---- REGENSTAMINA: ['regenstamina', 0, 1], REGENMANA: ['regenmana', 0, 1], ! # Misc LUCK: ['luck', 0, 1], *************** *** 114,118 **** if property == MAGEARMOR and item.allowmeditation: return True ! if not PROPERTIES.has_key(property): raise Exception, "Unknown property value %u" % property --- 114,118 ---- if property == MAGEARMOR and item.allowmeditation: return True ! if not PROPERTIES.has_key(property): raise Exception, "Unknown property value %u" % property *************** *** 142,146 **** else: return wolfpack.weaponinfo.WEAPONINFO[item.baseid][property] ! # Get the base property from the item if type(info[1]) == int: --- 142,146 ---- else: return wolfpack.weaponinfo.WEAPONINFO[item.baseid][property] ! # Get the base property from the item if type(info[1]) == int: *************** *** 149,153 **** value = item.getstrproperty( info[0], info[1] ) else: ! raise Exception, "Unsupported property type %s for property %u." % (type(info[1]).__name__, property) resboni = None --- 149,153 ---- value = item.getstrproperty( info[0], info[1] ) else: ! raise Exception, "Unsupported property type %s for property %u." % (type(info[1]).__name__, property) resboni = None *************** *** 156,160 **** if itemcheck(item, ITEM_WEAPON): resboni = wolfpack.weaponinfo.WEAPON_RESNAME_BONI ! # Get Resname boni from the ARMOR list elif itemcheck(item, ITEM_ARMOR) or itemcheck(item, ITEM_SHIELD): --- 156,160 ---- if itemcheck(item, ITEM_WEAPON): resboni = wolfpack.weaponinfo.WEAPON_RESNAME_BONI ! # Get Resname boni from the ARMOR list elif itemcheck(item, ITEM_ARMOR) or itemcheck(item, ITEM_SHIELD): *************** *** 165,169 **** if resboni.has_key(resname) and resboni[resname].has_key(property): value += resboni[resname][property] ! if resboni and item.hastag('resname2'): resname = str(item.gettag('resname2')) --- 165,169 ---- if resboni.has_key(resname) and resboni[resname].has_key(property): value += resboni[resname][property] ! if resboni and item.hastag('resname2'): resname = str(item.gettag('resname2')) *************** *** 254,262 **** mindamage = char.mindamage maxdamage = char.maxdamage ! try: if char.hastag('mindamage'): mindamage = int(char.gettag('mindamage')) ! if char.hastag('maxdamage'): maxdamage = int(char.gettag('maxdamage')) --- 254,262 ---- mindamage = char.mindamage maxdamage = char.maxdamage ! try: if char.hastag('mindamage'): mindamage = int(char.gettag('mindamage')) ! if char.hastag('maxdamage'): maxdamage = int(char.gettag('maxdamage')) *************** *** 273,277 **** mindamage = fromitem(weapon, MINDAMAGE) maxdamage = fromitem(weapon, MAXDAMAGE) ! return (mindamage, maxdamage) else: --- 273,277 ---- mindamage = fromitem(weapon, MINDAMAGE) maxdamage = fromitem(weapon, MAXDAMAGE) ! return (mindamage, maxdamage) else: *************** *** 303,311 **** # Only type check yet. if check == ITEM_WEAPON: ! return item.type >= 1001 and item.type <= 1007 # Only type check yet. if check == ITEM_MELEE: ! return item.type >= 1001 and item.type <= 1005 # Only type check yet. --- 303,311 ---- # Only type check yet. if check == ITEM_WEAPON: ! return item.type >= 1000 and item.type <= 1007 # Only type check yet. if check == ITEM_MELEE: ! return item.type >= 1000 and item.type <= 1005 # Only type check yet. *************** *** 344,358 **** if maxprops > 5: maxprops = 5 ! if maxprops < 1: return 0 ! maxprops -= 1 ! chances = CHANCES[maxprops] chancesum = sum(chances) ! result = 0 ! rnd = random.randrange(0, chancesum) for i in [5, 4, 3, 2, 1, 0]: --- 344,358 ---- if maxprops > 5: maxprops = 5 ! if maxprops < 1: return 0 ! maxprops -= 1 ! chances = CHANCES[maxprops] chancesum = sum(chances) ! result = 0 ! rnd = random.randrange(0, chancesum) for i in [5, 4, 3, 2, 1, 0]: *************** *** 362,366 **** else: rnd -= chances[i] ! # Take luck into account if result < maxprops and luckChance > random.randint(0, 10000): --- 362,366 ---- else: rnd -= chances[i] ! # Take luck into account if result < maxprops and luckChance > random.randint(0, 10000): *************** *** 376,388 **** propmin = propmin / float(scale) propmax = propmax / float(scale) ! # Although this is the "Worst system ever" (c) RunUO # I think the basic idea of having the chance increase slower than ! # using a normal rand function is good. percent = 100 - sqrt(random.randint(0, 10000)) # Range of the property value ! if luckchance > random.randint(0, 10000): percent += 10 ! # Normalize the percentage percent = min(maximum, max(minimum, percent)) --- 376,388 ---- propmin = propmin / float(scale) propmax = propmax / float(scale) ! # Although this is the "Worst system ever" (c) RunUO # I think the basic idea of having the chance increase slower than ! # using a normal rand function is good. percent = 100 - sqrt(random.randint(0, 10000)) # Range of the property value ! if luckchance > random.randint(0, 10000): percent += 10 ! # Normalize the percentage percent = min(maximum, max(minimum, percent)) *************** *** 422,426 **** def applyArmorRandom(item, props, minintensity, maxintensity, luckchance): properties = ARMOR_PROPERTIES.keys() ! # Remove MageArmor from the list if it's already on the item magearmor = fromitem(item, MAGEARMOR) --- 422,426 ---- def applyArmorRandom(item, props, minintensity, maxintensity, luckchance): properties = ARMOR_PROPERTIES.keys() ! # Remove MageArmor from the list if it's already on the item magearmor = fromitem(item, MAGEARMOR) *************** *** 432,436 **** property = random.choice(properties) properties.remove(property) ! if not PROPERTIES.has_key(property): continue --- 432,436 ---- property = random.choice(properties) properties.remove(property) ! if not PROPERTIES.has_key(property): continue *************** *** 448,454 **** # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! ! item.settag(PROPERTIES[property][0], value) item.resendtooltip() --- 448,454 ---- # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! ! item.settag(PROPERTIES[property][0], value) item.resendtooltip() *************** *** 476,480 **** property = random.choice(properties) properties.remove(property) ! if not PROPERTIES.has_key(property): continue --- 476,480 ---- property = random.choice(properties) properties.remove(property) ! if not PROPERTIES.has_key(property): continue *************** *** 496,502 **** # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! ! item.settag(PROPERTIES[property][0], value) item.resendtooltip() --- 496,502 ---- # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! ! item.settag(PROPERTIES[property][0], value) item.resendtooltip() *************** *** 516,520 **** RESISTANCE_COLD: [1, 15, 1, False], RESISTANCE_POISON: [1, 15, 1, False], ! RESISTANCE_ENERGY: [1, 15, 1, False], DAMAGEBONUS: [1, 25, 1, False], DEFENSEBONUS: [1, 15, 1, False], --- 516,520 ---- RESISTANCE_COLD: [1, 15, 1, False], RESISTANCE_POISON: [1, 15, 1, False], ! RESISTANCE_ENERGY: [1, 15, 1, False], DAMAGEBONUS: [1, 25, 1, False], DEFENSEBONUS: [1, 15, 1, False], *************** *** 539,543 **** def applyJuwelRandom(item, props, minintensity, maxintensity, luckchance): properties = JUWEL_PROPERTIES.keys() ! # Possible bonus skills skills = [SWORDSMANSHIP, FENCING, MACEFIGHTING, ARCHERY, WRESTLING, PARRYING, TACTICS, ANATOMY, HEALING, MAGERY, MEDITATION, EVALUATINGINTEL, --- 539,543 ---- def applyJuwelRandom(item, props, minintensity, maxintensity, luckchance): properties = JUWEL_PROPERTIES.keys() ! # Possible bonus skills skills = [SWORDSMANSHIP, FENCING, MACEFIGHTING, ARCHERY, WRESTLING, PARRYING, TACTICS, ANATOMY, HEALING, MAGERY, MEDITATION, EVALUATINGINTEL, *************** *** 549,564 **** property = random.choice(properties) properties.remove(property) ! if property in [SKILLBONUS1, SKILLBONUS2, SKILLBONUS3, SKILLBONUS4, SKILLBONUS5]: # Apply a random skillbonus info = JUWEL_PROPERTIES[property] value = scaleValue(minintensity, maxintensity, info[0], info[1], info[2], luckchance) ! skill = random.choice(skills) skills.remove(skill) ! item.settag('skillbonus_%u' % (property - 1000), '%u,%u' % (skill, value * 10)) continue ! if not PROPERTIES.has_key(property): continue --- 549,564 ---- property = random.choice(properties) properties.remove(property) ! if property in [SKILLBONUS1, SKILLBONUS2, SKILLBONUS3, SKILLBONUS4, SKILLBONUS5]: # Apply a random skillbonus info = JUWEL_PROPERTIES[property] value = scaleValue(minintensity, maxintensity, info[0], info[1], info[2], luckchance) ! skill = random.choice(skills) skills.remove(skill) ! item.settag('skillbonus_%u' % (property - 1000), '%u,%u' % (skill, value * 10)) continue ! if not PROPERTIES.has_key(property): continue *************** *** 570,575 **** # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! item.settag(PROPERTIES[property][0], value) --- 570,575 ---- # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! item.settag(PROPERTIES[property][0], value) *************** *** 584,593 **** #SPLASH_POISON: [2, 50, 2, False], #SPLASH_ENERGY: [2, 50, 2, False], ! #HIT_MAGICARROW: [2, 50, 2, False], #HIT_HARM: [2, 50, 2, False], #HIT_FIREBALL: [2, 50, 2, False], #HIT_LIGHTNING: [2, 50, 2, False], ! #HIT_DISPEL: [2, 50, 2, False], #HIT_LEECHHITS: [2, 50, 2, False], --- 584,593 ---- #SPLASH_POISON: [2, 50, 2, False], #SPLASH_ENERGY: [2, 50, 2, False], ! #HIT_MAGICARROW: [2, 50, 2, False], #HIT_HARM: [2, 50, 2, False], #HIT_FIREBALL: [2, 50, 2, False], #HIT_LIGHTNING: [2, 50, 2, False], ! #HIT_DISPEL: [2, 50, 2, False], #HIT_LEECHHITS: [2, 50, 2, False], *************** *** 596,600 **** #HIT_LOWERATTACK: [2, 50, 2, False], #HIT_LOWERDEFEND: [2, 50, 2, False], ! BESTSKILL: [1, 1, 1, False], #MAGEWEAPON: [29, 20, 1, False], --- 596,600 ---- #HIT_LOWERATTACK: [2, 50, 2, False], #HIT_LOWERDEFEND: [2, 50, 2, False], ! BESTSKILL: [1, 1, 1, False], #MAGEWEAPON: [29, 20, 1, False], *************** *** 604,608 **** RESISTANCE_COLD: [1, 15, 1, True], RESISTANCE_POISON: [1, 15, 1, True], ! RESISTANCE_ENERGY: [1, 15, 1, True], DAMAGEBONUS: [1, 25, 1, True], DEFENSEBONUS: [1, 15, 1, True], --- 604,608 ---- RESISTANCE_COLD: [1, 15, 1, True], RESISTANCE_POISON: [1, 15, 1, True], ! RESISTANCE_ENERGY: [1, 15, 1, True], DAMAGEBONUS: [1, 25, 1, True], DEFENSEBONUS: [1, 15, 1, True], *************** *** 615,619 **** DURABILITYBONUS: [10, 100, 10, True], LOWERREQS: [10, 100, 10, True], ! SLAYER: [1, 1, 1, False], # Special } --- 615,619 ---- DURABILITYBONUS: [10, 100, 10, True], LOWERREQS: [10, 100, 10, True], ! SLAYER: [1, 1, 1, False], # Special } *************** *** 621,625 **** def applyWeaponRandom(item, props, minintensity, maxintensity, luckchance): properties = WEAPON_PROPERTIES.keys() ! # No bestskill property for ranged weapons if itemcheck(item, ITEM_RANGED): --- 621,625 ---- def applyWeaponRandom(item, props, minintensity, maxintensity, luckchance): properties = WEAPON_PROPERTIES.keys() ! # No bestskill property for ranged weapons if itemcheck(item, ITEM_RANGED): *************** *** 632,636 **** if not PROPERTIES.has_key(property): continue ! # Special handling for slayers if property == SLAYER: --- 632,636 ---- if not PROPERTIES.has_key(property): continue ! # Special handling for slayers if property == SLAYER: *************** *** 655,660 **** # Set cast speed to -1 elif property == SPELLCHANNELING: ! item.settag(PROPERTIES[CASTSPEEDBONUS][0], -1) ! # MageWeapon and BestSkill are exclusive elif property == BESTSKILL: --- 655,660 ---- # Set cast speed to -1 elif property == SPELLCHANNELING: ! item.settag(PROPERTIES[CASTSPEEDBONUS][0], -1) ! # MageWeapon and BestSkill are exclusive elif property == BESTSKILL: *************** *** 667,673 **** # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! ! item.settag(PROPERTIES[property][0], value) item.resendtooltip() --- 667,673 ---- # Resistances are cummulative if info[3]: ! value += fromitem(item, property) ! ! item.settag(PROPERTIES[property][0], value) item.resendtooltip() *************** *** 678,685 **** def applyRandom(item, maxprops, minintensity, maxintensity, luckchance=0 ): props = 1 + bonusProps(maxprops, luckchance) ! if itemcheck(item, ITEM_ARMOR): applyArmorRandom(item, props, minintensity, maxintensity, luckchance) ! elif itemcheck(item, ITEM_SHIELD): applyShieldRandom(item, props, minintensity, maxintensity, luckchance) --- 678,685 ---- def applyRandom(item, maxprops, minintensity, maxintensity, luckchance=0 ): props = 1 + bonusProps(maxprops, luckchance) ! if itemcheck(item, ITEM_ARMOR): applyArmorRandom(item, props, minintensity, maxintensity, luckchance) ! elif itemcheck(item, ITEM_SHIELD): applyShieldRandom(item, props, minintensity, maxintensity, luckchance) *************** *** 687,691 **** elif itemcheck(item, ITEM_WEAPON): applyWeaponRandom(item, props, minintensity, maxintensity, luckchance) ! else: applyJuwelRandom(item, props, minintensity, maxintensity, luckchance) --- 687,691 ---- elif itemcheck(item, ITEM_WEAPON): applyWeaponRandom(item, props, minintensity, maxintensity, luckchance) ! else: applyJuwelRandom(item, props, minintensity, maxintensity, luckchance) *************** *** 696,700 **** def luckchance(char): luck = fromchar(char, LUCK) ! if luck < 0: luck = 0 --- 696,700 ---- def luckchance(char): luck = fromchar(char, LUCK) ! if luck < 0: luck = 0 *************** *** 702,705 **** if luck > 1200: luck = 1200 ! return LUCKTABLE[luck] --- 702,705 ---- if luck > 1200: luck = 1200 ! return LUCKTABLE[luck] |