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)
	def target(self, char, mode, targettype, target, args, item):
		if not self.consumerequirements(char, mode, args, target, item):
			return

		char.turnto(target)

		# 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 not mayAreaHarm(char, target):
				continue

			dispelChance = 50.0 + (100 * ((char.magery / 10.0 - (target.getintproperty('dispeldifficulty', 1) / 10)) / ((target.getintproperty('dispelfocus', 1) / 10) * 2))) / 100.0

			if dispelChance > random.random():
				target.effect(0x3779, 10, 20)
				target.fight(char)
			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()
Beispiel #3
0
    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)
Beispiel #4
0
    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)
	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)
	def target(self, char, mode, targettype, target, args, item):
		if not self.consumerequirements(char, mode, args, target, item):
			return

		char.turnto(target)

		# 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 not mayAreaHarm(char, target):
				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()
	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)
Beispiel #8
0
    def target(self, char, mode, targettype, target, args, item):
        if not self.consumerequirements(char, mode, args, target, item):
            return

        char.turnto(target)

        # 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 not mayAreaHarm(char, target):
                continue

            dispelChance = 50.0 + (100 * (
                (char.magery / 10.0 -
                 (target.getintproperty('dispeldifficulty', 1) / 10)) /
                ((target.getintproperty('dispelfocus', 1) / 10) * 2))) / 100.0

            if dispelChance > random.random():
                target.effect(0x3779, 10, 20)
                target.fight(char)
            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()
Beispiel #9
0
    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)
Beispiel #10
0
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
Beispiel #11
0
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 target(self, char, mode, targettype, target, args, item):
		if not self.consumerequirements(char, mode, args, target, item):
			return

		char.turnto(target)

		# Enumerate chars
		chars = wolfpack.chars(target.x, target.y, char.pos.map, 3)
		for target in chars:
			if target == char:
				continue

			if not mayAreaHarm(char, target):
				continue

			target.effect(0x374a, 10, 15)
			target.soundeffect(0x1fb)

			self.harmchar(char, target)
			statmodifier(char, target, 3, 1)
Beispiel #13
0
    def target(self, char, mode, targettype, target, args, item):
        if not self.consumerequirements(char, mode, args, target, item):
            return

        char.turnto(target)

        # Enumerate chars
        chars = wolfpack.chars(target.x, target.y, char.pos.map, 3)
        for target in chars:
            if target == char:
                continue

            if not mayAreaHarm(char, target):
                continue

            target.effect(0x374a, 10, 15)
            target.soundeffect(0x1fb)

            self.harmchar(char, target)
            statmodifier(char, target, 3, 1)
def usehorn(char, firehorn, loc):
	if not checkuse(char, firehorn):
		return False

	char.socket.settag('firehorn_delay', wolfpack.time.currenttime() + FIREHORN_DELAY)

	music = char.skill[MUSICIANSHIP]

	sucChance = 500 + ( music - 775 ) * 2
	dSucChance = sucChance / 1000.0

	if not checksuccess(char, dSucChance):
		char.socket.clilocmessage(1049618) # The horn emits a pathetic squeak.
		char.soundeffect(0x18a)
		return False

	char.useresource(AMOUNT, 0xf8c)

	char.soundeffect(0x15f)
	char.movingeffect(0x36d4, loc, 1, 0, 5)

	eable = wolfpack.chars(loc.x, loc.y, loc.map, RANGE)

	targets = []
	for mobile in eable:
		if mayAreaHarm(char, mobile, excludeself = True, includeinnocents = True):
			targets.append(mobile)
			playerVsPlayer = False
			if mobile.player:
				playerVsPlayer = True

	if len(targets) > 0:
		prov = char.skill[PROVOCATION] / 10
		entic = char.skill[ENTICEMENT] / 10
		peace = char.skill[PEACEMAKING] / 10

		minDamage = 0
		maxDamage = 0

		musicScaled = music + max( 0, music - 900 ) * 2
		provScaled = prov + max( 0, prov - 900 ) * 2
		enticScaled = entic + max( 0, entic - 900 ) * 2
		peaceScaled = peace + max( 0, peace - 900 ) * 2

		weightAvg = ( musicScaled + provScaled * 3 + enticScaled * 3 + peaceScaled ) / 80

		avgDamage = 0
		if playerVsPlayer:
			avgDamage = weightAvg / 3
		else:
			avgDamage = weightAvg / 2

		minDamage = ( avgDamage * 9 ) / 10
		maxDamage = ( avgDamage * 10 ) / 9

		damage = random.randint(minDamage, maxDamage)

		if len(targets) > 1:
			damage = (damage * 2) / len(targets)

		for i in targets:
			if i.checkskill(MAGICRESISTANCE, 0, 1200):
				damage *= 0.5
				if i.socket:
					i.socket.clilocmessage( 501783 ) # You feel yourself resisting magical energy.
				if not i.attacktarget:
					i.fight(char)
				i.damage(1, damage, char)
				i.effect(0x3709, 10, 30)
				i.say("tes")

	if random.random() < BREAK_CHANCE:
		char.socket.clilocmessage( 1049619 ) # The fire horn crumbles in your hands.
		firehorn.delete()
Beispiel #15
0
def usehorn(char, firehorn, loc):
    if not checkuse(char, firehorn):
        return False

    char.socket.settag('firehorn_delay',
                       wolfpack.time.currenttime() + FIREHORN_DELAY)

    music = char.skill[MUSICIANSHIP]

    sucChance = 500 + (music - 775) * 2
    dSucChance = sucChance / 1000.0

    if not checksuccess(char, dSucChance):
        char.socket.clilocmessage(1049618)  # The horn emits a pathetic squeak.
        char.soundeffect(0x18a)
        return False

    char.useresource(AMOUNT, 0xf8c)

    char.soundeffect(0x15f)
    char.movingeffect(0x36d4, loc, 1, 0, 5)

    eable = wolfpack.chars(loc.x, loc.y, loc.map, RANGE)

    targets = []
    for mobile in eable:
        if mayAreaHarm(char, mobile, excludeself=True, includeinnocents=True):
            targets.append(mobile)
            playerVsPlayer = False
            if mobile.player:
                playerVsPlayer = True

    if len(targets) > 0:
        prov = char.skill[PROVOCATION] / 10
        entic = char.skill[ENTICEMENT] / 10
        peace = char.skill[PEACEMAKING] / 10

        minDamage = 0
        maxDamage = 0

        musicScaled = music + max(0, music - 900) * 2
        provScaled = prov + max(0, prov - 900) * 2
        enticScaled = entic + max(0, entic - 900) * 2
        peaceScaled = peace + max(0, peace - 900) * 2

        weightAvg = (musicScaled + provScaled * 3 + enticScaled * 3 +
                     peaceScaled) / 80

        avgDamage = 0
        if playerVsPlayer:
            avgDamage = weightAvg / 3
        else:
            avgDamage = weightAvg / 2

        minDamage = (avgDamage * 9) / 10
        maxDamage = (avgDamage * 10) / 9

        damage = random.randint(minDamage, maxDamage)

        if len(targets) > 1:
            damage = (damage * 2) / len(targets)

        for i in targets:
            if i.checkskill(MAGICRESISTANCE, 0, 1200):
                damage *= 0.5
                if i.socket:
                    i.socket.clilocmessage(
                        501783)  # You feel yourself resisting magical energy.
                if not i.attacktarget:
                    i.fight(char)
                i.damage(1, damage, char)
                i.effect(0x3709, 10, 30)
                i.say("tes")

    if random.random() < BREAK_CHANCE:
        char.socket.clilocmessage(
            1049619)  # The fire horn crumbles in your hands.
        firehorn.delete()