本文整理汇总了Python中wolfpack.utilities.energydamage函数的典型用法代码示例。如果您正苦于以下问题:Python energydamage函数的具体用法?Python energydamage怎么用?Python energydamage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了energydamage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: potiondamage
def potiondamage( char, target, potion, dmgbonus ):
if potion.gettag('potiontype') == 11:
damage = randint(POTION_LESSEREXPLOSION_RANGE[0], POTION_LESSEREXPLOSION_RANGE[1])
elif potion.gettag('potiontype') == 12:
damage = randint(POTION_EXPLOSION_RANGE[0], POTION_EXPLOSION_RANGE[1])
elif potion.gettag('potiontype') == 13:
damage = randint(POTION_GREATEREXPLOSION_RANGE[0], POTION_GREATEREXPLOSION_RANGE[1])
else:
damage = randint(POTION_LESSEREXPLOSION_RANGE[0], POTION_GREATEREXPLOSION_RANGE[1])
if char.skill[ALCHEMY] == 1200:
bonus = 10
elif char.skill[ALCHEMY] >= 1100:
bonus = randint(8,9)
elif char.skill[ALCHEMY] >= 1000:
bonus = randint(6,7)
else:
bonus = randint(0,5)
if potion.amount > 1:
damage = damage * potion.amount
if dmgbonus > 1:
damage = damage * dmgbonus
damage += bonus
if not potion.container:
if char.distanceto(potion) > 1:
damage = (damage / char.distanceto(potion))
# Flamestrike effect
if damage >= (target.maxhitpoints / 2):
target.effect(0x3709, 10, 30)
target.effect( explosions[randint(0,2)], 20, 10)
energydamage(target, char, damage, fire=100 )
return
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:potions.py
示例2: hit
def hit(self, attacker, defender, damage):
if not self.checkuse(attacker):
return
# Clear Ability, then check if it really can be used
clearability(attacker)
if not defender.socket or not defender.itemonlayer(LAYER_MOUNT):
if attacker.socket:
attacker.socket.clilocmessage(1060848)
return
self.use(attacker) # Use Mana
if attacker.socket:
attacker.socket.clilocmessage(1060082)
mounted = attacker.itemonlayer(LAYER_MOUNT)
if mounted:
defender.socket.clilocmessage(1062315)
else:
defender.socket.clilocmessage(1060083)
defender.soundeffect(0x140)
defender.effect(0x3728, 10, 15)
defender.unmount()
# Make it impossible to mount a horse for 10 seconds
defender.socket.settag('block_mount', wolfpack.currenttime() + 10000)
if not mounted:
energydamage(defender, attacker, random.randint(15, 25), physical=100, damagetype=DAMAGE_PHYSICAL)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:34,代码来源:specialmoves.py
示例3: cast
def cast(self, char, mode, args=[], target=None, item=None):
if not self.consumerequirements(char, mode, args, target, item):
return
targets = []
chars = wolfpack.chars(char.pos.x, char.pos.y, char.pos.map, 3)
for target in chars:
if not mayAreaHarm(char, target):
continue
if not char.canreach(target, 3):
continue
targets.append(target)
char.soundeffect( 0x212 )
char.soundeffect( 0x206 )
char.effect(0x376A, 1, 29)
char.effect(0x37C4, 1, 29)
damage = ComputePowerValue( char, 10 ) + random.randint( 0, 3 )
if damage < 8:
damage = 8
elif damage > 24:
damage = 24
for target in targets:
energydamage(target, char, damage, 0, 0, 0, 0, 100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:29,代码来源:chivalry.py
示例4: hit
def hit(self, attacker, defender, damage):
if not self.checkuse(attacker):
return
self.use(attacker)
if defender.dead or defender.pos.map == 0xFF:
return # Out of reach
if attacker.socket:
attacker.socket.clilocmessage(1060090) # You have delivered a crushing blow!
if defender.socket:
defender.socket.clilocmessage(1060091) # You take extra damage from the crushing attack!
defender.soundeffect(0x1E1)
# defender.effect(0x377a, 1, 32)
source = defender.pos
target = defender.pos
source.z += 50
target.z += 20
sendmovingeffect(source, target, model=0xFB4)
amount = floor(0.5 * damage)
if amount != 0:
energydamage(defender, attacker, amount, physical=100, damagetype=DAMAGE_PHYSICAL)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:26,代码来源:specialmoves.py
示例5: hit
def hit(attacker, defender, weapon, time):
combat.utilities.playhitsound(attacker, defender)
(mindamage, maxdamage) = properties.getdamage(attacker)
damage = random.randint(mindamage, maxdamage)
damage = scaledamage(attacker, damage)
# Give the defender a chance to absorb damage
damage = absorbdamage(defender, damage)
# Get the damage distribution of the attackers weapon
(physical, fire, cold, poison, energy) = damagetypes(attacker)
energydamage(defender, attacker, damage, physical, fire, cold, poison, energy, 0, DAMAGE_PHYSICAL)
# Wear out the weapon
if weapon:
# poisoning
if weapon.hastag( 'poisoning_uses' ):
poisoning.hitEffect( defender, weapon )
# 4% chance for losing one hitpoint
if 0.04 >= random.random():
if weapon.health > 0:
weapon.health -= 1
weapon.resendtooltip()
if weapon.health <= 0:
tobackpack(weapon, attacker)
weapon.update()
if attacker.socket:
attacker.socket.clilocmessage(500645)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:30,代码来源:aos.py
示例6: damage
def damage(self, char, target):
target.effect(0x374a, 10, 15)
target.soundeffect(0x213)
damage = min(60, int((char.skill[MAGERY] / 10.0 + char.intelligence) / 5.0))
damage = random.randint(damage, damage + 4)
energydamage(target, char, damage, cold=100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:7,代码来源:circle5.py
示例7: target
def target(self, char, mode, targettype, target, args, item):
if not self.consumerequirements(char, mode, args, target, item):
return
char.turnto(target)
targets = []
damage = self.scaledamage(char, None, 48, 1, 5)
# Enumerate chars
chars = wolfpack.chars(target.x, target.y, char.pos.map, 2)
for target in chars:
if mayAreaHarm(char, target):
targets.append(target)
# Re-scale the damage
if len(targets) > 1:
damage = ceil((damage * 2.0) / len(targets))
for target in targets:
target.lightning()
target.soundeffect(0x29)
self.harmchar(char, target)
energydamage(target, char, damage, energy=100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:25,代码来源:circle7.py
示例8: cast
def cast(self, char, mode, args=[], target=None, item=None):
if not self.consumerequirements(char, mode, args, target, item):
return
targets = []
spellrange = 1 + int(char.skill[MAGERY] / 150.0)
chars = wolfpack.chars(char.pos.x, char.pos.y, char.pos.map, spellrange)
for target in chars:
if not mayAreaHarm(char, target):
continue
if not char.canreach(target, spellrange):
continue
targets.append(target)
for target in targets:
target.soundeffect(0x2F3)
self.harmchar(char, target)
damage = target.hitpoints / 2
if target.player:
damage += random.randint(0, 15)
if damage > 75:
damage = 75
elif damage < 15:
damage = 15
energydamage(target, char, damage, physical=100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:circle8.py
示例9: damage
def damage(self, char, target):
distance = target.distanceto(char)
damage = self.scaledamage(char, target, 17, 1, 5)
if distance > 2:
damage = max(1, damage * 0.25)
elif distance == 2:
damage = max(1, damage * 0.5)
energydamage(target, char, damage, cold=100)
target.effect(0x374a, 10, 30)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:circle2.py
示例10: splashdamage
def splashdamage(attacker, effect):
(physical, cold, fire, poison, energy) = (0, 0, 0, 0, 0)
if effect == SPLASHPHYSICAL:
sound = 0x10e
hue = 50
physical = 100
elif effect == SPLASHFIRE:
sound = 0x11d
hue = 1160
fire = 100
elif effect == SPLASHCOLD:
sound = 0xfc
hue = 2100
cold = 100
elif effect == SPLASHPOISON:
sound = 0x205
hue = 1166
poison = 100
elif effect == SPLASHENERGY:
sound = 0x1f1
hue = 120
energy = 100
else:
raise RuntimeError, "Invalid effect passed to splashdamage: %s" % effect
guild = attacker.guild # Cache the guild
party = attacker.guild # Cache the party
didsound = False # Did we play a soundeffect yet?
(mindamage, maxdamage) = properties.getdamage(attacker) # Cache the min+maxdamage
pos = attacker.pos
chariterator = wolfpack.charregion(pos.x - 10, pos.y - 10, pos.x + 10, pos.y + 10, pos.map)
target = chariterator.first
while target:
if attacker != target and (not party or party != target.party) and (not guild or guild != target.guild):
if not target.dead and not target.invulnerable and not target.invisible and not target.hidden:
tpos = target.pos
# Calculate the real distance between the two characters
distance = sqrt((pos.x - tpos.x) * (pos.x - tpos.x) + (pos.y - tpos.y) * (pos.y - tpos.y))
factor = min(1.0, (11 - distance) / 10)
if factor > 0.0:
damage = int(random.randint(mindamage, maxdamage) * factor)
if damage > 0:
if not didsound:
attacker.soundeffect(sound)
didsound = True
target.effect(0x3779, 1, 15, hue)
energydamage(target, attacker, damage, physical, fire, cold, poison, energy, 0, DAMAGE_MAGICAL)
target = chariterator.next
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:53,代码来源:aos.py
示例11: onCollide
def onCollide(char, item):
if char.dead or char.invulnerable:
return
if not char.hastag( 'in_firefield' ):
source = None
if item.hastag('source'):
source = wolfpack.findchar( int( item.gettag('source') ) )
char.settag( 'in_firefield', 1)
energydamage( char, source, 2, fire=100 )
char.addtimer( 350, expire, [] )
return 0
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:13,代码来源:firefield.py
示例12: hitharm
def hitharm(attacker, defender):
if defender.invulnerable or defender.dead or defender.invisible or defender.hidden:
return
damage = scaledamage(attacker, 6, 9, 0.015)
distance = defender.distanceto(attacker)
if distance > 2:
damage /= 4
elif distance > 1:
damage /= 2
defender.effect(0x374a, 10, 30)
defender.soundeffect(0xfc)
energydamage(defender, attacker, damage, 0, 0, 100, 0, 0, 0, DAMAGE_MAGICAL)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:16,代码来源:hiteffects.py
示例13: stroke
def stroke(char, arguments):
strokes = arguments[0]
# First: Check if the character disconnected
# If he did, save the strokes and level and restore it later
if char.player and not char.socket and char.logouttime == 0:
if not char.hasscript( 'system.poison' ):
char.settag( 'poison_strokes', strokes )
char.addscript( 'system.poison' )
return
if not POISONS.has_key(char.poison):
if char.poison != -1:
char.poison = -1
char.updateflags()
return
poison = POISONS[char.poison]
# Show a message if the cycle is ok
if strokes % poison[7] == 0:
chars = wolfpack.chars(char.pos.x, char.pos.y, char.pos.map, 18)
for viewer in chars:
if viewer.socket and viewer.cansee(char):
if viewer != char:
viewer.socket.clilocmessage(1042858 + char.poison * 2, char.name, 34, 3, char)
else:
viewer.socket.clilocmessage(1042857 + char.poison * 2, '', 34, 3, char)
damage = 1 + int(char.hitpoints * poison[3])
damage = min(poison[2], max(poison[1], damage))
energydamage(char, None, damage, poison=100)
# See if we should add another timer
strokes += 1
if strokes == poison[6]:
if char.poison != -1:
char.poison = -1
char.updateflags()
if char.socket:
char.socket.clilocmessage(502136)
return
char.addtimer(poison[5], "system.poison.stroke", [strokes], 0, 0, "poison_timer")
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:44,代码来源:poison.py
示例14: expire
def expire(char, arguments):
if char.dead :
char.deltag( 'in_firefield' )
return
items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)
for item in items:
if item.hasscript( 'magic.firefield' ):
source = None
if item.hastag('source'):
source = wolfpack.findchar( int( item.gettag('source') ) )
energydamage(char, source, 2, fire=100)
char.addtimer(350, expire, [])
char.soundeffect(0x208)
return
char.deltag( 'in_firefield' )
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:19,代码来源:firefield.py
示例15: target
def target(self, char, mode, targettype, target, args, item):
if not self.consumerequirements(char, mode, args, target, item):
return
char.turnto(target)
if char.player:
party = char.party
guild = char.guild
else:
party = None
guild = None
targets = []
damage = self.scaledamage(char, None, 48, 1, 5)
# Enumerate chars
chars = wolfpack.chars(target.x, target.y, char.pos.map, 2)
for target in chars:
if target == char:
continue
# We also ignore people from the same guild or party.
# Or targets who are innocent.
if (guild and target.guild == guild) or (party and target.party == party):
continue
targets.append(target)
# Re-scale the damage
if len(targets) > 1:
damage = ceil((damage * 2.0) / len(targets))
for target in targets:
target.lightning()
target.soundeffect(0x29)
self.harmchar(char, target)
energydamage(target, char, damage, energy=100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:39,代码来源:circle7.py
示例16: cast
def cast(self, char, mode, args=[], target=None, item=None):
if not self.consumerequirements(char, mode, args, target, item):
return
if char.player:
party = char.party
guild = char.guild
else:
party = None
guild = None
targets = []
spellrange = 1 + int(char.skill[MAGERY] / 150.0)
chars = wolfpack.chars(char.pos.x, char.pos.y, char.pos.map, spellrange)
for target in chars:
if target == char:
continue
if (guild and target.guild == guild) or (party and target.party == party):
continue
if not char.canreach(target, spellrange):
continue
targets.append(target)
for target in targets:
target.soundeffect(0x2F3)
self.harmchar(char, target)
damage = target.hitpoints / 2
if target.player:
damage += random.randint(0, 15)
damage = min(100, max(15, damage))
energydamage(target, char, damage, physical=100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:37,代码来源:circle8.py
示例17: damage_callback
def damage_callback(defender, args):
(attacker, damage) = (wolfpack.findchar(args[0]), args[1])
if attacker and defender and not defender.invulnerable and not defender.dead and not defender.invisible and not defender.hidden:
energydamage(defender, attacker, damage, 0, 100, 0, 0, 0, 0, DAMAGE_MAGICAL)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:4,代码来源:hiteffects.py
示例18: hit
def hit(attacker, defender, weapon, time):
combat.utilities.playhitsound(attacker, defender)
(mindamage, maxdamage) = properties.getdamage(attacker)
damage = random.randint(mindamage, maxdamage)
damage = scaledamage(attacker, damage, checkability = True)
# Slaying? (only against NPCs)
if weapon and defender.npc and checkSlaying(weapon, defender):
defender.effect(0x37B9, 5, 10)
damage *= 2
# Get the ability used by the attacker
ability = getability(attacker)
# Scale Damage using a weapons ability
if ability:
damage = ability.scaledamage(attacker, defender, damage)
# Give the defender a chance to absorb damage
damage = absorbdamage(defender, damage)
# If the attack was parried, the ability was wasted
if damage == 0 and ability:
ability.use(attacker)
if attacker.socket:
attacker.socket.clilocmessage(1061140) # Your attack was parried
ability = None # Reset ability
ignorephysical = False
if ability:
ignorephysical = ability.ignorephysical
# Get the damage distribution of the attackers weapon
(physical, fire, cold, poison, energy) = damagetypes(attacker)
damagedone = energydamage(defender, attacker, damage, physical, fire, cold, poison, energy, 0, DAMAGE_PHYSICAL, ignorephysical=ignorephysical)
# Wear out the weapon
if weapon:
# Leeching
leech = properties.fromitem(weapon, LIFELEECH)
if leech and leech > random.randint(0, 99) and attacker.maxhitpoints > attacker.hitpoints:
amount = (damagedone * 30) / 100 # Leech 30% Health
if amount > 0:
attacker.hitpoints = min(attacker.maxhitpoints, attacker.hitpoints + amount)
attacker.updatehealth()
leech = properties.fromitem(weapon, STAMINALEECH)
if leech and leech > random.randint(0, 99) and attacker.maxhitpoints > attacker.stamina:
amount = (damagedone * 100) / 100 # Leech 100% Stamina
if amount > 0:
attacker.stamina = min(attacker.maxstamina, attacker.stamina + amount)
attacker.updatehealth()
leech = properties.fromitem(weapon, MANALEECH)
if leech and leech > random.randint(0, 99) and attacker.maxmana > attacker.mana:
amount = (damagedone * 40) / 100 # Leech 40% Mana
if amount > 0:
attacker.mana = min(attacker.maxmana, attacker.mana + amount)
attacker.updatemana()
# Splash Damage
for effectid in [SPLASHPHYSICAL, SPLASHFIRE, SPLASHCOLD, SPLASHPOISON, SPLASHENERGY]:
effect = properties.fromitem(weapon, effectid)
if effect and effect > random.randint(0, 99):
splashdamage(attacker, effectid)
# Hit Spell effects
for (effectid, callback) in combat.hiteffects.EFFECTS.items():
effect = properties.fromitem(weapon, effectid)
if effect and effect > random.randint(0, 99):
callback(attacker, defender)
# poisoning doesn't work that way anymore
#if weapon.hastag( 'poisoning_uses' ):
# poisoning.hitEffect( defender, weapon )
# 4% chance for losing one hitpoint
if 0.04 >= random.random():
# If it's a self repairing item, grant health instead of reducing it
selfrepair = properties.fromitem(weapon, SELFREPAIR)
if selfrepair > 0 and weapon.health < weapon.maxhealth - 1:
if selfrepair > random.randint(0, 9):
weapon.health += 2
weapon.resendtooltip()
elif weapon.health > 0:
weapon.health -= 1
weapon.resendtooltip()
if weapon.health <= 0:
tobackpack(weapon, attacker)
weapon.update()
if attacker.socket:
attacker.socket.clilocmessage(500645)
# Notify the weapon ability
if ability:
ability.hit(attacker, defender, damage)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:98,代码来源:aos.py
示例19: damage
def damage(self, char, target):
target.soundeffect(0x307)
target.effect(0x36BD, 20, 10)
damage = self.scaledamage(char, target, 38, 1, 5)
energydamage(target, char, damage, fire=100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:5,代码来源:circle6.py
示例20: damage
def damage(self, char, target):
target.effect(0x3709, 10, 30)
target.soundeffect(0x208)
damage = self.scaledamage(char, target, 48, 1, 5)
energydamage(target, char, damage, fire=100)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:5,代码来源:circle7.py
注:本文中的wolfpack.utilities.energydamage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论