本文整理汇总了Python中wolfpack.chars函数的典型用法代码示例。如果您正苦于以下问题:Python chars函数的具体用法?Python chars怎么用?Python chars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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
# Enumerate chars
range = 1 + int(char.skill[MAGERY] / 200.0)
chars = wolfpack.chars(target.x, target.y, char.pos.map, range)
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
if target.hidden:
target.reveal()
target.effect(0x375a, 9, 20)
target.soundeffect(0x1fd)
示例2: GetPackInstinctBonus
def GetPackInstinctBonus( attacker, defender ):
if attacker.player or defender.player:
return 0
packinstinct = attacker.getstrproperty('packinstinct', '')
if not packinstinct or (not attacker.owner and not attacker.summoned):
return 0
master = attacker.owner
if not master:
return 0
inPack = 1
chars = wolfpack.chars(defender.pos.x, defender.pos.y, defender.pos.map, 1)
for char in chars:
if char != attacker:
if packinstinct == char.getstrproperty('packinstinct', '') or char.player or (not char.owner and not char.summoned):
continue
theirMaster = char.owner
if master == theirMaster and defender in char.getopponents():
inPack += 1
if inPack >= 5:
return 100
elif inPack >= 4:
return 75
elif inPack >=3:
return 50
elif inPack >= 2:
return 25
return 0
示例3: 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)
示例4: attack_target
def attack_target(char, arguments, target):
if not target.char or target.char == char:
char.socket.sysmessage(tr("Your pets cannot attack that."))
return
(pet, all) = arguments
if all:
if char.gm:
pos = char.pos
pets = wolfpack.chars(pos.x, pos.y, pos.map, 18, False)
for follower in pets:
if follower.npc and not follower.frozen:
attack_target(char, [follower.serial, False], target)
else:
for follower in char.followers:
attack_target(char, [follower.serial, False], target)
else:
pet = wolfpack.findchar(pet)
if target.char == pet:
char.socket.sysmessage(tr("Your pet refuses to kill itself."))
return
if pet and (pet.owner == char or char.gm) and pet.distanceto(char) < 18:
startfight(pet, target.char)
pet.fight(target.char)
# right here we need to not interrupt the target, but i can't register a fight unless i do, right? not sure.
target.char.fight(pet)
target.char.follow(pet)
go_target(char, arguments, target)
follow_target(char, arguments, target)
pet.sound(SND_ATTACK)
示例5: 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)
示例6: allshow
def allshow(socket, command, arguments):
player = socket.player
offlineChars = wolfpack.chars(player.pos.x, player.pos.y, player.pos.map, player.visrange, True)
for oc in offlineChars:
socket.removeobject(oc)
socket.sendobject(oc)
socket.sysmessage( tr( "The offline characters on your screen have been revealed." ) )
示例7: 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
# Enumerate chars
chars = wolfpack.chars(target.x, target.y, char.pos.map, 8)
items = wolfpack.items(target.x, target.y, char.pos.map, 8)
for target in chars:
if char == target or not target.npc or target.summontimer == 0:
continue
if self.checkresist(char, target):
target.effect(0x3779, 10, 20)
else:
wolfpack.effect(0x3728, target.pos, 8, 20)
target.soundeffect(0x201)
target.delete()
# Field spells
for item in items:
if item.hastag("dispellable_field"):
wolfpack.effect(0x376A, item.pos, 9, 20)
item.soundeffect(0x201)
item.delete()
示例8: onDamage
def onDamage(char, type, amount, source):
# Find the spiderweb
items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)
spiderweb = None
for item in items:
if item.hasscript( 'spiderweb' ):
spiderweb = item
break
if spiderweb:
if type == DAMAGE_MAGICAL:
spiderweb.health = max(0, spiderweb.health - amount * 2)
elif type == DAMAGE_PHYSICAL:
spiderweb.health = max(0, spiderweb.health - amount * 4)
if spiderweb.health == 0:
spiderweb.delete()
targets = wolfpack.chars(char.pos.x, char.pos.y, char.pos.map, 0)
for target in targets:
target.removescript( 'spiderweb' )
return amount
示例9: 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
# Enumerate chars
chars = wolfpack.chars(target.x, target.y, char.pos.map, 3)
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
if target.invulnerable or target.notoriety(char) == 1:
continue
target.effect(0x374a, 10, 15)
target.soundeffect(0x1fb)
self.harmchar(char, target)
statmodifier(char, target, 3, 1)
示例10: target
def target(self, char, mode, targettype, target, args, item):
if not self.consumerequirements(char, mode, args, target, item):
return
char.turnto(target)
char.soundeffect(0x299)
cured = 0
# Enumerate chars
chars = wolfpack.chars(target.x, target.y, char.pos.map, 3)
for target in chars:
# Check if we should affect the char
if not mayAreaBenefit(char, target, includeinnocents = True):
continue
target.effect(0x373a, 10, 15)
target.soundeffect(0x1e0)
if target.poison != -1:
chance = (10000 + int(char.skill[MAGERY] * 7.5) - ((target.poison + 1) * 1750)) / 10000.0
if chance >= random.random():
poison.cure(target)
cured += 1
if target.socket:
target.socket.clilocmessage(1010059)
if cured > 0 and char.socket:
char.socket.clilocmessage(1010058)
示例11: target
def target(self, char, mode, targettype, target, args, item):
if not self.consumerequirements(char, mode, args, target, item):
return
char.turnto(target)
char.soundeffect(0x299)
cured = 0
# Enumerate chars
chars = wolfpack.chars(target.x, target.y, char.pos.map, 3)
for target in chars:
target.effect(0x373A, 10, 15)
target.soundeffect(0x1E0)
if target.poison != -1:
chance = (10000 + int(char.skill[MAGERY] * 7.5) - ((target.poison + 1) * 1750)) / 10000.0
if chance >= random.random():
poison.cure(target)
cured += 1
if target.socket:
target.socket.clilocmessage(1010059)
if cured > 0:
if char.socket:
char.socket.clilocmessage(1010058)
示例12: sendmovingeffect
def sendmovingeffect(source, target, model, hue=0, speed=1, rendermode=0):
# Build the packet
packet = wolfpack.packet(0xC0, 36)
packet.setbyte(1, 0) # Moving
packet.setint(2, 0) # Source
packet.setint(6, 0) # Target
packet.setshort(10, model) # Effect Model
packet.setshort(12, source.x) # Source X
packet.setshort(14, source.y) # Source Y
packet.setbyte(16, source.z) # Source Z
packet.setshort(17, target.x) # Target X
packet.setshort(19, target.y) # Target Y
packet.setbyte(21, target.z) # Target Z
packet.setbyte(22, speed) # Speed
packet.setbyte(23, 0) # Duration
packet.setshort(24, 0) # Unknown
packet.setbyte(26, 1) # Fixed Direction
packet.setbyte(27, 0) # Explode on Impact
packet.setint(28, hue) # Hue
packet.setint(32, rendermode) # Rendermode
# Search for sockets at the source location
chars = wolfpack.chars(source.x, source.y, source.map, 18)
for char in chars:
if char.socket:
packet.send(char.socket)
示例13: target
def target(self, char, mode, targettype, target, args, item):
char.turnto(target)
if not self.consumerequirements(char, mode, args, target, item):
return
xdiff = abs(target.x - char.pos.x)
ydiff = abs(target.y - char.pos.y)
positions = []
# North/South
if xdiff > ydiff:
itemid = 0x3922
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))
# West/East
else:
itemid = 0x3915
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))
serials = []
char.soundeffect(0x20c)
total = (char.skill[MAGERY] + char.skill[POISONING]) / 2.0
if total >= 1000:
level = 3
elif total > 850:
level = 2
elif total > 650:
level = 1
else:
level = 0
for pos in positions:
newitem = wolfpack.newitem(1)
newitem.id = itemid
#newitem.direction = 29
newitem.moveto(pos)
newitem.decay = 0 # Dont decay. TempEffect will take care of them
newitem.settag('dispellable_field', 1)
newitem.settag('level', level)
newitem.addscript( 'magic.poisonfield' )
newitem.update()
serials.append(newitem.serial)
# Affect chars who are occupying the field cells
chars = wolfpack.chars( newitem.pos.x, newitem.pos.y, newitem.pos.map, 0 )
for affected in chars:
if affected.pos.z >= newitem.pos.z - 10 and affected.pos.z <= newitem.pos.z + 10:
newitem.callevent(EVENT_COLLIDE, (affected, newitem))
duration = int((3 + char.skill[MAGERY] / 25.0) * 1000)
wolfpack.addtimer(duration, field_expire, serials, 1)
示例14: target
def target(self, char, mode, targettype, target, args, item):
if not self.consumerequirements(char, mode, args, target, item):
return
char.turnto(target)
char.soundeffect(0x299)
cured = 0
if char.player:
party = char.party
guild = char.guild
else:
party = None
guild = None
# Enumerate chars
chars = wolfpack.chars(target.x, target.y, char.pos.map, 3)
for target in chars:
if not target.player:
continue
if target == char or (guild and target.guild == guild) or (party and target.party == party):
# Toggle Protection
if target.propertyflags & 0x20000:
target.propertyflags &= ~ 0x20000
target.effect(0x375a, 9, 20)
target.soundeffect(0x1ed)
try:
if target.hastag('protection_skill'):
skill = int(target.gettag('protection_skill'))
if target.skill[MAGICRESISTANCE] + skill > target.skillcap[MAGICRESISTANCE]:
target.skill[MAGICRESISTANCE] = target.skillcap[MAGICRESISTANCE]
else:
target.skill[MAGICRESISTANCE] += skill
except:
pass
target.deltag('protection_skill')
else:
target.propertyflags |= 0x20000
target.effect(0x375a, 9, 20)
target.soundeffect(0x1e9)
# Remove Magic Resistance Skill
amount = 35 - int(target.skill[INSCRIPTION] / 200)
if target.skill[MAGICRESISTANCE] - amount < 0:
amount = target.skill[MAGICRESISTANCE]
target.settag('protection_skill', amount)
target.skill[MAGICRESISTANCE] -= amount
if target.socket:
target.socket.resendstatus()
示例15: follow_me
def follow_me(char, pet, all=False):
if all:
if char.gm:
pos = char.pos
pets = wolfpack.chars(pos.x, pos.y, pos.map, 18, False)
for follower in pets:
if follower.npc and not follower.frozen:
follow_me(char, follower, False)
else:
for follower in char.followers:
follow_me(char, follower, False)
if pet and (pet.owner == char or char.gm or isPetFriend(char, pet)) and pet.distanceto(char) < 18:
stopfight(pet)
pet.follow(char)
pet.sound(SND_ATTACK)