• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python properties.fromitem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中wolfpack.properties.fromitem函数的典型用法代码示例。如果您正苦于以下问题:Python fromitem函数的具体用法?Python fromitem怎么用?Python fromitem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了fromitem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: applyproperties

	def applyproperties(self, player, arguments, item, exceptional):
		# Get the color of the cloth this item has been crafted with
		if self.cloth > 0:
			assert(len(arguments) >= 2)
			item.color = arguments[1]		
		
		# All tailoring items crafted out of leather gain the special color
		if self.submaterial1 > 0:
			material = self.parent.getsubmaterial1used(player, arguments)
			material = self.parent.submaterials1[material]
			item.color = material[4]
			item.settag('resname', material[5])

		# Distribute another 6 points randomly between the resistances an armor alread
		# has. There are no tailored weapons.
		if exceptional:
			if itemcheck(item, ITEM_ARMOR) or itemcheck(item, ITEM_SHIELD):
				# Copy all the values to tags
				boni = [0, 0, 0, 0, 0]

				for i in range(0, 6):
					boni[random.randint(0,4)] += 1

				item.settag('res_physical', fromitem(item, RESISTANCE_PHYSICAL) + boni[0])
				item.settag('res_fire', fromitem(item, RESISTANCE_FIRE) + boni[1])
				item.settag('res_cold', fromitem(item, RESISTANCE_COLD) + boni[2])
				item.settag('res_energy', fromitem(item, RESISTANCE_ENERGY) + boni[3])
				item.settag('res_poison', fromitem(item, RESISTANCE_POISON) + boni[4])
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:28,代码来源:tailoring.py


示例2: damagetypes

def damagetypes(char, defender):
	fire = 0
	cold = 0
	poison = 0
	energy = 0

	weapon = char.getweapon()

	# See if the npc has specific energy distribution values.
	if char.npc and not weapon:
		fire = char.getintproperty( 'dmg_fire', 0 )
		if char.hastag('dmg_fire'):
			fire = int(char.gettag('dmg_fire'))

		cold = char.getintproperty( 'dmg_cold', 0 )
		if char.hastag('dmg_cold'):
			cold = int(char.gettag('dmg_cold'))

		poison = char.getintproperty( 'dmg_poison', 0 )
		if char.hastag('dmg_poison'):
			poison = int(char.gettag('dmg_poison'))

		energy = char.getintproperty( 'dmg_energy', 0 )
		if char.hastag('dmg_energy'):
			energy = int(char.gettag('dmg_energy'))
	elif weapon:
		if magic.chivalry.isConsecrated(weapon):
			(physical, fire, cold, poison, energy) = consecratedweapon( defender )

		else:
			fire = properties.fromitem(weapon, DAMAGE_FIRE)

			cold = properties.fromitem(weapon, DAMAGE_COLD)

			poison = properties.fromitem(weapon, DAMAGE_POISON)

			energy = properties.fromitem(weapon, DAMAGE_ENERGY)

	# See if the energy distribution is correct
	if fire + cold + poison + energy > 100:
		fire = 0
		cold = 0
		poison = 0
		energy = 0
		if weapon:
			if DEBUG_COMBAT_INFO == 1:
				char.log(LOG_WARNING, "Character is using broken weapon (0x%x) with wrong damage types.\n" % weapon.serial)
		else:
			if DEBUG_COMBAT_INFO == 1:
				char.log(LOG_WARNING, "NPC (0x%x) has wrong damage types.\n" % char.serial)

	physical = 100 - (fire + cold + poison + energy)

	return (physical, fire, cold, poison, energy)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:54,代码来源:aos.py


示例3: hasHandFree

def hasHandFree( char, item ):
	firsthand = char.itemonlayer( 1 )
	secondhand = char.itemonlayer( 2 )

	if not firsthand and not secondhand:
		return True

	if firsthand and not secondhand and not firsthand.twohanded or properties.fromitem(firsthand, BALANCED):
		return True

	if not firsthand and secondhand and not secondhand.twohanded or properties.fromitem(secondhand, BALANCED):
		return True
	return False
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:13,代码来源:utilities.py


示例4: applyproperties

	def applyproperties(self, player, arguments, item, exceptional):
		item.decay = 1

		# See if this item
		if self.retaincolor and self.submaterial1 > 0:
			material = self.parent.getsubmaterial1used(player, arguments)
			material = self.parent.submaterials1[material]
			item.color = material[4]
			item.settag('resname', material[5])
			
		# Apply properties of secondary material
		if self.submaterial2 > 0:
			material = self.parent.getsubmaterial2used(player, arguments)
			material = self.parent.submaterials2[material]
			item.color = material[4]
			item.settag('resname2', material[5])


		# Apply one-time boni
		healthbonus = fromitem(item, DURABILITYBONUS)
		if healthbonus != 0:
			bonus = int(math.ceil(item.maxhealth * (healthbonus / 100.0)))
			item.maxhealth = max(1, item.maxhealth + bonus)
			item.health = item.maxhealth

		# Reduce the uses remain count
		checktool(player, wolfpack.finditem(arguments[0]), 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:27,代码来源:tinkering.py


示例5: modifiers

def modifiers(object, tooltip):
	modifiers = {
		"boni_dex": 1060409,
		"boni_int": 1060432,
		"boni_str": 1060485,
		"remaining_uses": 1060584,
		"aos_boni_damage": 1060401,
		"regenhitpoints": 1060444,
		"regenstamina": 1060443,
		"regenmana": 1060440,
	}

	for (tag, cliloc) in modifiers.items():
		if object.hastag(tag):
			tooltip.add(cliloc, str(object.gettag(tag)))

	reflectphysical = properties.fromitem(object, REFLECTPHYSICAL)

	if reflectphysical:
		tooltip.add(1060442, str(reflectphysical))

	if object.hastag("bestskill"):
		tooltip.add(1060400, "")

	if object.hastag('magearmor'):
		tooltip.add(1060437, "")
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:26,代码来源:equipment.py


示例6: onWearItem

def onWearItem(player, wearer, item, layer):
	lower = properties.fromitem(item, LOWERREQS) / 100.0

	req_str = properties.fromitem(item, REQSTR)
	if lower:
		req_str = int(ceil(req_str) * (1.0 - lower))

	req_dex = properties.fromitem(item, REQDEX)
	if lower:
		req_dex = int(ceil(req_dex) * (1.0 - lower))

	req_int = properties.fromitem(item, REQINT)
	if lower:
		req_int = int(ceil(req_int) * (1.0 - lower))

	if wearer.strength < req_str:
		if player != wearer:
			player.socket.sysmessage('This person can\'t wear that item, seems not strong enough.')
		else:
			player.socket.clilocmessage(500213)
		return 1

	if wearer.dexterity < req_dex:
		if player != wearer:
			player.socket.sysmessage('This person can\'t wear that item, seems not agile enough.')
		else:
			player.socket.clilocmessage(502077)
		return 1

	if wearer.intelligence < req_int:
		if player != wearer:
			player.socket.sysmessage('This person can\'t wear that item, seems not smart enough.')
		else:
			player.socket.sysmessage('You are not ingellgent enough to equip this item.')
		return 1

	# Reject equipping an item with durability 1 or less
	# if it's an armor, shield or weapon
	armor = properties.itemcheck(item, ITEM_ARMOR)
	weapon = properties.itemcheck(item, ITEM_WEAPON)
	shield = properties.itemcheck(item, ITEM_SHIELD)

	if (armor or weapon or shield) and item.health < 1:
		player.socket.sysmessage('You need to repair this before using it again.')
		return 1

	return 0
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:47,代码来源:equipment.py


示例7: onShowTooltip

def onShowTooltip(viewer, object, tooltip):
	slayer = properties.fromitem(object, SLAYER)
	if slayer != '':
		slayers = slayer.split(',')
		for slayer in slayers:
			slayer = system.slayer.findEntry(slayer)
			if slayer:
				tooltip.add(slayer.name, '')
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:8,代码来源:musicianship.py


示例8: playmisssound

def playmisssound(attacker, defender):
	weapon = attacker.getweapon()
	sounds = properties.fromitem(weapon, MISSSOUND)

	# No sounds
	if len(sounds) == 0:
		return

	attacker.soundeffect(random.choice(sounds))
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:9,代码来源:utilities.py


示例9: fireweapon

def fireweapon(attacker, defender, weapon):
	ammo = properties.fromitem(weapon, AMMUNITION)

	# Only consume ammo if this weapon requires it
	if len(ammo) != 0:
		if not consumeresources(attacker.getbackpack(), ammo, 1):
			if attacker.socket:
				attacker.socket.sysmessage('You are out of ammo.')
			if attacker.npc:
				tobackpack(weapon, attacker)
			return False

		if random.random() >= 0.50:
			if defender.player:
				item = wolfpack.additem(ammo)
				if not tobackpack(item, defender):
					item.update()
			else:
				# Search for items at the same position
				items = wolfpack.items(defender.pos.x, defender.pos.y, defender.pos.map)
				handled = 0

				for item in items:
					if item.baseid == ammo:
						item.amount += 1
						item.update()
						handled = 1
						break

				if not handled:
					item = wolfpack.additem(ammo)
					item.moveto(defender.pos)
					item.update()

	projectile = properties.fromitem(weapon, PROJECTILE)

	# Fire a projectile if applicable.
	if projectile:
		hue = properties.fromitem(weapon, PROJECTILEHUE)
		attacker.movingeffect(projectile, defender, 0, 0, 14, hue)

	return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:42,代码来源:aos.py


示例10: checkSlaying

def checkSlaying(weapon, defender):
	slayer = properties.fromitem(weapon, SLAYER)
	if slayer == '':
		return False
				
	slayer = system.slayer.findEntry(slayer)
	
	if not slayer:
		return False
		
	return slayer.slays(defender)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:aos.py


示例11: weaponskill

def weaponskill(char, weapon, bestskill = False):
	if not weapon:
		return WRESTLING
	else:
		if bestskill and properties.fromitem(weapon, BESTSKILL):
			return getbestskill(char)

		if not WEAPON_INFORMATION.has_key(weapon.type):
			return WRESTLING
		else:
			return WEAPON_INFORMATION[weapon.type][SKILL]
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:utilities.py


示例12: modifiers

def modifiers(object, tooltip):
	modifiers = {
		"boni_dex": 1060409,
		"boni_int": 1060432,
		"boni_str": 1060485,
		"remaining_uses": 1060584,
		"aos_boni_damage": 1060401,
		"regenhitpoints": 1060444,
		"regenstamina": 1060443,
		"regenmana": 1060440,
	}

	for (tag, cliloc) in modifiers.items():
		if object.hastag(tag):
			tooltip.add(cliloc, str(object.gettag(tag)))

	reflectphysical = properties.fromitem(object, REFLECTPHYSICAL)

	if reflectphysical:
		tooltip.add(1060442, str(reflectphysical))
		
	castrecovery = properties.fromitem(object, CASTRECOVERYBONUS)
	
	if castrecovery:
		tooltip.add(1060412, str(castrecovery))
		
	castspeed = properties.fromitem(object, CASTSPEEDBONUS)
	
	if castspeed:
		tooltip.add(1060413, str(castspeed))
	
	spelldamagebonus = properties.fromitem(object, SPELLDAMAGEBONUS)

	if spelldamagebonus:
		tooltip.add(1060483, str(spelldamagebonus))	

	if object.hastag("bestskill"):
		tooltip.add(1060400, "")

	if object.hastag('magearmor'):
		tooltip.add(1060437, "")
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:41,代码来源:equipment.py


示例13: applyproperties

	def applyproperties(self, player, arguments, item, exceptional):
		# See if special ingots were used in the creation of
		# this item. All items crafted by blacksmiths gain the
		# color!
		if self.submaterial1 > 0:
			material = self.parent.getsubmaterial1used(player, arguments)
			material = self.parent.submaterials1[material]
			item.color = material[4]
			item.settag('resname', material[5])

		# Apply properties of secondary material
		if self.submaterial2 > 0:
			material = self.parent.getsubmaterial2used(player, arguments)
			material = self.parent.submaterials2[material]
			item.color = material[4]
			item.settag('resname2', material[5])

		# Apply one-time boni
		healthbonus = fromitem(item, DURABILITYBONUS)
		if healthbonus != 0:
			bonus = int(math.ceil(item.maxhealth * (healthbonus / 100.0)))
			item.maxhealth = max(1, item.maxhealth + bonus)
			item.health = item.maxhealth

		weightbonus = fromitem(item, WEIGHTBONUS)
		if weightbonus != 0:
			bonus = int(math.ceil(item.weight * (weightbonus / 100.0)))
			item.weight = max(0, item.weight + bonus)

		# Distribute another 6 points randomly between the resistances this armor already has
		if exceptional:
			if itemcheck(item, ITEM_ARMOR) or itemcheck(item, ITEM_SHIELD):
				# Copy all the values to tags
				boni = [0, 0, 0, 0, 0]

				for i in range(0, 6):
					boni[random.randint(0,4)] += 1

				item.settag('res_physical', fromitem(item, RESISTANCE_PHYSICAL) + boni[0])
				item.settag('res_fire', fromitem(item, RESISTANCE_FIRE) + boni[1])
				item.settag('res_cold', fromitem(item, RESISTANCE_COLD) + boni[2])
				item.settag('res_energy', fromitem(item, RESISTANCE_ENERGY) + boni[3])
				item.settag('res_poison', fromitem(item, RESISTANCE_POISON) + boni[4])
			elif itemcheck(item, ITEM_WEAPON):
				# Increase the damage bonus by 20%
				bonus = fromitem(item, DAMAGEBONUS)
				bonus += 20
				item.settag('aos_boni_damage', bonus)

		# Reduce the uses remain count
		checktool(player, wolfpack.finditem(arguments[0]), 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:51,代码来源:blacksmithing.py


示例14: playhitsound

def playhitsound(attacker, defender):
	weapon = attacker.getweapon()

	# Play a special sound for monsters
	if not weapon and attacker.id < 0x190:
		attacker.sound(SND_ATTACK)
	else:
		sounds = properties.fromitem(weapon, HITSOUND)

		# Only play a sound if there are any
		if len(sounds) != 0:
			attacker.soundeffect(random.choice(sounds))
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:12,代码来源:utilities.py


示例15: fireweapon

def fireweapon(attacker, defender, weapon):
	ammo = properties.fromitem(weapon, AMMUNITION)

	# Only consume ammo if this weapon requires it
	if len(ammo) != 0:
		if not consumeresources(attacker.getbackpack(), ammo, 1):
			if attacker.socket:
				attacker.socket.sysmessage(tr('You are out of ammo.'))
			if attacker.npc:
				tobackpack(weapon, attacker)
			return False

		# The ammo is created and packed into the defenders backpack/put on the ground
		createammo(defender, ammo)

	projectile = properties.fromitem(weapon, PROJECTILE)

	# Fire a projectile if applicable.
	if projectile:
		hue = properties.fromitem(weapon, PROJECTILEHUE)
		attacker.movingeffect(projectile, defender, 0, 0, 14, hue)

	return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:23,代码来源:aos.py


示例16: checkweapon

	def checkweapon(self, char):
		weapon = char.itemonlayer(LAYER_RIGHTHAND)
		
		if not weapon or not properties.itemcheck(weapon, ITEM_WEAPON):
			weapon = char.itemonlayer(LAYER_LEFTHAND)
			
		if not weapon:
			return True
			
		# Check if the spellchanneling property is true for this item
		if properties.fromitem(weapon, SPELLCHANNELING) == 0:
			return False
		else:
			return True						
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:14,代码来源:spell.py


示例17: requirements

def requirements(object, tooltip):
	# Tag will override.
	lower = properties.fromitem(object, LOWERREQS)
	if lower:
		tooltip.add(1060435, str(lower))
	lower /= 100.0

	req_str = object.getintproperty( 'req_strength', 0 )
	if object.hastag( 'req_strength' ):
		req_str = int( object.gettag( 'req_strength' ) )

	if lower:
		req_str = int(ceil(req_str) * (1.0 - lower))
	if req_str:
		tooltip.add(1061170, str(req_str))
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:15,代码来源:equipment.py


示例18: GetDifficultyFor

def GetDifficultyFor( player, instrument, target ):
	# Difficulty TODO: Add another 100 points for each of the following abilities:
	#	- Radiation or Aura Damage (Heat, Cold etc.)
	#	- Summoning Undead
	#
	totalskills = 0
	val = target.hitpoints + target.stamina + target.mana
	skills = target.skill
	for i in range(0, ALLSKILLS):
		totalskills += skills[i] / 100.0

	if val > 700:
		val = 700 + ((val - 700) / 3.66667)

	# Target is Magery Creature
	if target.ai == "Monster_Mage" and target.skill[MAGERY] > 50:
		val += 100

	#if IsFireBreathingCreature( bc ):
	#	val += 100

	if IsPoisonImmune( target ):
		val += 100

	if target.id == 317:
		val += 100

	val += (target.getintproperty('hit_poison_level', 0) + 1) * 20

	val /= 10

	#if ( bc != null && bc.IsParagon )
	#	val += 40.0;

	if instrument.hastag('exceptional'):
		val -= 5.0 # 10%

	slayer = properties.fromitem(instrument, SLAYER)
	if slayer != '':
		slayers = slayer.split(',')
		for slayer in slayers:
			slayer = system.slayer.findEntry(slayer)
			if slayer:
				if slayer.slays(target):
					val -= 10.0 # 20%
				elif slayer.group.opposition.super.slays(target): # not sure if this is correct
					val += 10.0 # -20%
	return val
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:48,代码来源:musicianship.py


示例19: applyproperties

	def applyproperties(self, player, arguments, item, exceptional):
		# Stackable items consume all resources
		if self.stackable:
			backpack = player.getbackpack()
			count = -1
			for (materials, amount, name) in self.materials:
				items = backpack.countitems(materials)
				if count == -1:
					count = items / amount
				else:
					count = min(count, items / amount)
			for (materials, amount, name) in self.materials:
				backpack.removeitems( materials, count )
			if count != -1:
				item.amount += count
			else:
				item.amount = 1 + count
			item.update()
		
		# All carpentry items crafted out of ingots keep a resname
		if self.submaterial1 > 0:
			material = self.parent.getsubmaterial1used(player, arguments)
			material = self.parent.submaterials1[material]
			item.color = material[4]
			item.settag('resname', material[5])

		# Distribute another 6 points randomly between the resistances an armor alread
		# has. There are no tailored weapons.
		if exceptional:
			if properties.itemcheck(item, ITEM_SHIELD):
				# Copy all the values to tags
				boni = [0, 0, 0, 0, 0]

				for i in range(0, 6):
					boni[random.randint(0,4)] += 1

				item.settag('res_physical', properties.fromitem(item, RESISTANCE_PHYSICAL) + boni[0])
				item.settag('res_fire', properties.fromitem(item, RESISTANCE_FIRE) + boni[1])
				item.settag('res_cold', properties.fromitem(item, RESISTANCE_COLD) + boni[2])
				item.settag('res_energy', properties.fromitem(item, RESISTANCE_ENERGY) + boni[3])
				item.settag('res_poison', properties.fromitem(item, RESISTANCE_POISON) + boni[4])

			elif properties.itemcheck(item, ITEM_WEAPON):
				# Increase the damage bonus by 20%
				bonus = properties.fromitem(item, DAMAGEBONUS)
				bonus += 20
				item.settag('aos_boni_damage', bonus)

			# Exceptional Containers get a key
			if item.type == 1:
				if item.baseid == '9aa' or item.baseid == '9a9' or item.baseid == 'e3f' or item.baseid == 'e3d' or item.baseid == 'e42' or item.baseid == 'a4d' or item.baseid == 'a4f':
					createlockandkey( item )

		# Reduce the uses remain count
		checktool(player, wolfpack.finditem(arguments[0]), 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:55,代码来源:carpentry.py


示例20: checkweapon

	def checkweapon(self, char):
		weapon = char.itemonlayer(LAYER_RIGHTHAND)

		if not weapon or not properties.itemcheck(weapon, ITEM_WEAPON):
			weapon = char.itemonlayer(LAYER_LEFTHAND)

		if not weapon:
			return True

		# Check if the spellchanneling property is true for this item
		if not properties.fromitem(weapon, SPELLCHANNELING):
			if not wolfpack.utilities.tobackpack(weapon, char):
				weapon.update()

			return True
		else:
			return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:17,代码来源:spell.py



注:本文中的wolfpack.properties.fromitem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utilities.energydamage函数代码示例发布时间:2022-05-26
下一篇:
Python gumps.cGump函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap