def hit(self, attacker, defender, damage): if not self.checkuse(attacker): return self.use(attacker) attacker.effect(0x3728, 10, 15) attacker.soundeffect(0x2a1) # Compile a list of targets targets = [] center = attacker.pos chariter = wolfpack.charregion(center.x - 1, center.y - 1, center.x + 1, center.y + 1, center.map) char = chariter.first while char: if char != attacker and char != defender: targets.append(char) char = chariter.next # Our own party party = attacker.party guild = attacker.guild weapon = attacker.getweapon() for target in targets: if not attacker.canreach(target, 1): continue if not target.dead and not target.invulnerable and (not party or party != target.party) and (not guild or target.guild != guild): if attacker.socket: attacker.socket.clilocmessage(1060161) # The whirling attack strikes a target! if defender.socket: defender.socket.clilocmessage(1060162) # You are struck by the whirling attack and take damage! combat.aos.hit(attacker, target, weapon, wolfpack.currenttime())
def splashdamage(attacker, effect, excludechar=None): (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 - 3, pos.y - 3, pos.x + 3, pos.y + 3, pos.map) target = chariterator.first while target: if attacker != target and excludechar != target and mayAreaHarm( attacker, target): 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, (4 - distance) / 3) 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
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
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 attacker.effect(0x3728, 10, 15) attacker.soundeffect(0x2a1) # Compile a list of targets targets = [] center = attacker.pos chariter = wolfpack.charregion(center.x - 1, center.y - 1, center.x + 1, center.y + 1, center.map) char = chariter.first while char: if char != attacker and char != defender: targets.append(char) char = chariter.next # Our own party party = attacker.party guild = attacker.guild weapon = attacker.getweapon() for target in targets: if not attacker.canreach(target, 1): continue if not target.dead and not target.invulnerable and not target.region.safe and ( not party or party != target.party) and (not guild or target.guild != guild): if attacker.socket: attacker.socket.clilocmessage( 1060161) # The whirling attack strikes a target! if defender.socket: defender.socket.clilocmessage( 1060162 ) # You are struck by the whirling attack and take damage! combat.aos.hit(attacker, target, weapon, wolfpack.time.currenttime())
def trackWhatResponse( char, args, target ): # what the range, hypothesis : skill 100%==radius 50==the small map ingame rayon= char.skill[ TRACKING ]*50/1000 button=target.button liste=[] #look around characters (not really a circle but nervermind) iterator = wolfpack.charregion(char.pos.x -rayon,char.pos.y-rayon,char.pos.x +rayon,char.pos.y+rayon,char.pos.map) # filter the list with the player's choice charcible = iterator.first while charcible: # NEVER track invisible staff members if not charcible.invisible and not charcible.dead: if target.button == 4 : #have to exit non-players and exit self if charcible.player and char.serial != charcible.serial : liste.append(charcible) if target.button == 3 : #have to exit non-PNJ humans if charcible.bodytype==4 and charcible.npc: liste.append(charcible) if target.button == 2 : #have to exit non-Monsters if charcible.bodytype==1 and charcible.npc: liste.append(charcible) if target.button == 1 : #have to exit non-animals if charcible.bodytype==3 and charcible.npc: liste.append(charcible) charcible = iterator.next #Answer to the player if liste==[]: #nothing to find if target.button == 4 or target.button == 3: char.socket.clilocmessage( 502995, '', GRAY )#502995 You see no evidence of people in the area. elif target.button == 1: char.socket.clilocmessage( 502991, '', GRAY )#502991 You see no evidence of animals in the area. else: char.socket.clilocmessage( 502993, '', GRAY )#502993 You see no evidence of creatures in the area. else: #list is not empty for charcible in liste: char.socket.sysmessage("%s %s"%(charcible.name,dircard(char.directionto(charcible)))) #check skill success = char.checkskill( TRACKING, 0, 1000 ) return True
def potionregion( cserial, iserial, bonus=0 ): char = wolfpack.findchar( cserial ) item = wolfpack.finditem( iserial ) if not item or not char: return False ppos = item.pos # Defaults outradius = 0 potiontype = 11 kegfill = 0 iskeg = False potiontype = getPotionType( item ) if not potiontype in [ 11, 12, 13 ]: potiontype = 11 if potiontype == 11: outradius = 1 elif potiontype == 12: outradius = 2 elif potiontype == 13: outradius = randint( 2, 3 ) else: outradius = 1 # Potion Keg Radius Override! if isPotionkeg( item ): kegfill = int( item.gettag( 'kegfill' ) ) if potiontype in [11, 12, 13] and kegfill >= 1: if kegfill == 100: outradius = 13 elif kegfill >= 90: outradius = 12 elif kegfill >= 80: outradius = 11 elif kegfill >= 70: outradius = 10 elif kegfill >= 60: outradius = 9 elif kegfill >= 50: outradius = 8 elif kegfill >= 40: outradius = 7 elif kegfill >= 30: outradius = 6 else: outradius = 5 outradius = max( 1, outradius ) # Potion is thrown on the ground if not item.container: x1 = min( int( ppos.x - outradius ), int( ppos.x + outradius ) ) x2 = max( int( ppos.x - outradius ), int( ppos.x + outradius ) ) y1 = min( int( ppos.y - outradius ), int( ppos.y + outradius ) ) y2 = max( int( ppos.y - outradius ), int( ppos.y + outradius ) ) # Character Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, ppos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( target, item, outradius ): potiondamage( cserial, target, iserial, bonus, potiontype ) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, ppos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( cserial, iserial, chainbomb.serial, outradius ) chainbomb = chainregion.next return # Potion is in a container else: x1 = min( int(char.pos.x - outradius), int(char.pos.x + outradius) ) x2 = max( int(char.pos.x - outradius), int(char.pos.x + outradius) ) y1 = min( int(char.pos.y - outradius), int(char.pos.y + outradius) ) y2 = max( int(char.pos.y - outradius), int(char.pos.y + outradius) ) # Area Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, char.pos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( char, target, outradius ): potiondamage( cserial, target, iserial, bonus, potiontype ) target = damageregion.next else: target = damageregion.next potion_chainlist = [] # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, char.pos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( cserial, iserial, chainbomb.serial, outradius ) chainbomb = chainregion.next return True
def potionregion( args ): char = args[0] potion = args[1] bonus = args[2] if potion.gettag('potiontype') == 11: outradius = 1 elif potion.gettag('potiontype') == 12: outradius = 2 elif potion.gettag('potiontype') == 13: outradius = randint(2,3) else: outradius = 1 # Potion Keg Radius Override! if potion.hastag('kegfill') and potion.hastag('potiontype'): if potion.gettag('potiontype') in [11, 12, 13] and potion.gettag('kegfill') >= 1: kegfill = potion.gettag('kegfill') if kegfill == 100: outradius = 13 elif kegfill >= 90: outradius = 12 elif kegfill >= 80: outradius = 11 elif kegfill >= 70: outradius = 10 elif kegfill >= 60: outradius = 9 elif kegfill >= 50: outradius = 8 elif kegfill >= 40: outradius = 7 elif kegfill >= 30: outradius = 6 else: outradius = 5 # Potion thrown on the ground if not potion.container: x1 = int(potion.pos.x - outradius) y1 = int(potion.pos.y - outradius) x2 = int(potion.pos.x + outradius) y2 = int(potion.pos.y + outradius) damageregion = wolfpack.charregion( x1, y1, x2, y2, potion.pos.map ) # Character Bombing target = damageregion.first while target: if checkLoS( target, potion, outradius ): potiondamage(char, target, potion, bonus) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, potion.pos.map ) chainbomb= chainregion.first while chainbomb: if checkLoS( potion, chainbomb, outradius ) and not chainbomb.hastag('exploding'): if chainbomb.baseid in explodables: chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 0, chainbomb.amount] ) chainbomb = chainregion.next # Potion Kegs elif (chainbomb.hastag('kegfill') and chainbomb.hastag('potiontype')) and ( chainbomb.gettag('potiontype') in [11, 12, 13] and chainbomb.gettag('kegfill') >= 1 ): chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 11, chainbomb.gettag('kegfill') ] ) chainbomb = chainregion.next else: chainbomb = chainregion.next else: chainbomb = chainregion.next return # Potion is in a container else: x1 = int(char.pos.x - outradius) y1 = int(char.pos.y - outradius) x2 = int(char.pos.x + outradius) y2 = int(char.pos.y + outradius) damageregion = wolfpack.charregion( x1, y1, x2, y2, char.pos.map ) # Area Bombing target = damageregion.first while target: if checkLoS( char, target, outradius ): potiondamage(char, target, potion, bonus) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, char.pos.map ) chainbomb = chainregion.first while chainbomb: if checkLoS( char, chainbomb, outradius ) and not chainbomb.hastag('exploding'): if chainbomb.baseid in explodables: chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 0, chainbomb.amount] ) chainbomb = chainregion.next elif ( chainbomb.hastag('kegfill') and chainbomb.hastag('potiontype') ) and ( chainbomb.gettag('potiontype') in [11, 12, 13] and chainbomb.gettag('kegfill') >= 1 ): chainbomb.settag('exploding', 'true') chainbomb.addtimer( randint(1000, 2250), "potions.potioncountdown", [char.serial, 11, chainbomb.gettag('kegfill') ] ) chainbomb = chainregion.next else: chainbomb = chainregion.next else: chainbomb = chainregion.next # Potion Kegs return
def potionregion( char, potion, bonus=0 ): if potion.gettag('potiontype') == 11: outradius = 1 elif potion.gettag('potiontype') == 12: outradius = 2 elif potion.gettag('potiontype') == 13: outradius = randint(2,3) else: outradius = 1 # Potion Keg Radius Override! if potion.hastag('kegfill') and potion.hastag('potiontype'): if potion.gettag('potiontype') in [11, 12, 13] and potion.gettag('kegfill') >= 1: kegfill = potion.gettag('kegfill') if kegfill == 100: outradius = 13 elif kegfill >= 90: outradius = 12 elif kegfill >= 80: outradius = 11 elif kegfill >= 70: outradius = 10 elif kegfill >= 60: outradius = 9 elif kegfill >= 50: outradius = 8 elif kegfill >= 40: outradius = 7 elif kegfill >= 30: outradius = 6 else: outradius = 5 outradius = max( 1, outradius ) # Potion is thrown on the ground if not potion.container: x1 = min( int(potion.pos.x - outradius), int(potion.pos.x + outradius) ) x2 = max( int(potion.pos.x - outradius), int(potion.pos.x + outradius) ) y1 = min( int(potion.pos.y - outradius), int(potion.pos.y + outradius) ) y2 = max( int(potion.pos.y - outradius), int(potion.pos.y + outradius) ) # Character Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, potion.pos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( target, potion, outradius ): potiondamage( char, target, potion, bonus ) target = damageregion.next else: target = damageregion.next # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, potion.pos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( char, potion, chainbomb, outradius ) chainbomb = chainregion.next return # Potion is in a container else: x1 = min( int(char.pos.x - outradius), int(char.pos.x + outradius) ) x2 = max( int(char.pos.x - outradius), int(char.pos.x + outradius) ) y1 = min( int(char.pos.y - outradius), int(char.pos.y + outradius) ) y2 = max( int(char.pos.y - outradius), int(char.pos.y + outradius) ) # Area Bombing damageregion = wolfpack.charregion( x1, y1, x2, y2, potion.pos.map ) target = damageregion.first while target: if not target.ischar: target = damageregion.next if checkLoS( char, target, outradius ): potiondamage( char, target, potion, bonus ) target = damageregion.next else: target = damageregion.next potion_chainlist = [] # Chain Reaction Bombing chainregion = wolfpack.itemregion( x1, y1, x2, y2, char.pos.map ) chainbomb = chainregion.first # Scan the region, build a list of explosives while chainbomb: chainpotiontimer( char, potion, chainbomb, outradius ) chainbomb = chainregion.next return