Ejemplo n.º 1
0
	def effect(self, char, target, mode, args, item):
		target.disturb()

		if self.checkresist(char, target):
			if target.socket:
				target.socket.clilocmessage(501783)
		else:
			total = char.skill[MAGERY] + char.skill[POISONING]
			distance = char.distanceto(target)
			if distance >= 3:
				total -= (distance - 3) * 10.0

			level = 0

			if total >= 2000:
				level = 3
			elif total > 1701:
				level = 2
			elif total > 1301:
				level = 1

			poison.poison(target, level)

		target.effect(0x374A, 10, 15)
		target.soundeffect(0x474)
Ejemplo n.º 2
0
def onUse(char, item):
	if item.getoutmostchar() != char:
		char.socket.clilocmessage(502946)
		return True

	# poisoned drink
	if item.hastag( 'poisoning_char' ):
		poison.poison( char, item.gettag( 'poisoning_strength' ) )
		char.socket.clilocmessage( 1010512 )
		skills.poisoning.wearoff( item )

	quantity = 0
	if item.hastag('quantity'):
		quantity = int(item.gettag('quantity'))
	cprops = CONTAINERS[item.id]
	if quantity == 0:
		if item.id in CONTAINERS:
			cprops = CONTAINERS[item.id]

			if cprops[3]:
				char.socket.clilocmessage(500837)
				char.socket.attachtarget('beverage.refill_target', [item.serial])
				return True
		return False
	# pitcher filled with water
	elif item.id in [0xff8, 0xff9, 0x1f9d, 0x1f9e] and CONTAINERS[item.id][4] == 'water':
		char.socket.attachtarget('beverage.water', [item.serial, cprops, quantity])
	else:
		return drink(char, item)
	return True
Ejemplo n.º 3
0
def onUse(player, item):
	# Has to belong to us.
	if item.getoutmostchar() != player:
		player.socket.clilocmessage(500866)
		return 1

	# Can we eat anymore?
	if player.hunger >= 6:
		player.socket.clilocmessage(500867)
		return 1

	player.socket.clilocmessage(min(500872, 500868 + player.hunger))

	# Fidget animation and munch munch sound
	player.soundeffect( random.choice([0x03a, 0x03b, 0x03c]), 1 )
	if not player.itemonlayer( LAYER_MOUNT ):
		player.action(ANIM_FIDGET3)

	player.hunger += 1

	# poisoned food
	if item.hastag( 'poisoning_char' ):
		poison.poison( player, item.gettag( 'poisoning_strength' ) )
		player.socket.clilocmessage( 1010512 )
		skills.poisoning.wearoff( item )

	if item.amount > 1:
		item.amount -= 1
		item.update()
	else:
		item.delete()

	return 1
Ejemplo n.º 4
0
def onUse(char, item):
    if item.getoutmostchar() != char:
        char.socket.clilocmessage(502946)
        return 1

        # poisoned drink
    if item.hastag("poisoning_char"):
        poison.poison(char, item.gettag("poisoning_strength"))
        char.socket.clilocmessage(1010512)
        skills.poisoning.wearoff(item)

    quantity = 0
    if item.hastag("quantity"):
        quantity = int(item.gettag("quantity"))

    if quantity == 0:
        if CONTAINERS.has_key(item.id):
            cprops = CONTAINERS[item.id]

            if cprops[3]:
                char.socket.clilocmessage(500837)
                char.socket.attachtarget("beverage.refill_target", [item.serial])
                return 1
        return 0
    else:
        return drink(char, item)
Ejemplo n.º 5
0
    def effect(self, char, target, mode, args, item):
        target.disturb()

        if self.checkresist(char, target):
            if target.socket:
                target.socket.clilocmessage(501783)
        else:
            total = char.skill[MAGERY] + char.skill[POISONING]
            distance = char.distanceto(target)
            if distance >= 3:
                total -= (distance - 3) * 10.0

            level = 0

            if total >= 2000:
                level = 3
            elif total > 1701:
                level = 2
            elif total > 1301:
                level = 1

            poison.poison(target, level)

        target.effect(0x374A, 10, 15)
        target.soundeffect(0x474)
Ejemplo n.º 6
0
def onCollide(char, item):
	if char.dead or char.invulnerable:
		return

	if not char.hastag('in_poisonfield'):
		level = 0
		if item.hastag('level'):
			level = int(item.gettag('level'))

		char.settag('in_poisonfield', 1)
		if char.poison < level:
			char.soundeffect(0x474)
			poison.poison(char, level)
		char.addtimer(350, expire, [])
	return 0
Ejemplo n.º 7
0
def onCollide(char, item):
    if char.dead or char.invulnerable or char.region.safe:
        return

    if not char.hastag('in_poisonfield'):
        level = 0
        if item.hastag('level'):
            level = int(item.gettag('level'))

        char.settag('in_poisonfield', 1)
        if char.poison < level:
            char.soundeffect(0x474)
            poison.poison(char, level)
        char.addtimer(350, expire, [])
    return 0
Ejemplo n.º 8
0
def onShurikenHit(target, args):
	player = wolfpack.findchar(args[0])
	belt = wolfpack.finditem(args[1])
	if not player or not belt:
		return

	target.damage(0, random.randint(3, 5), player)

	poison_lvl = -1
	poisoning_uses = 0
	if belt.hastag('poisoning_strength'):
		poison_lvl = belt.gettag('poisoning_strength')
	if belt.hastag('poisoning_uses'):
		poisoning_uses = belt.gettag('poisoning_uses')

	if poison_lvl != -1 and poisoning_uses > 0:
		poison(target, poison_lvl)

	ConsumeUse(belt)
Ejemplo n.º 9
0
def onShurikenHit(target, args):
    player = wolfpack.findchar(args[0])
    belt = wolfpack.finditem(args[1])
    if not player or not belt:
        return

    target.damage(0, random.randint(3, 5), player)

    poison_lvl = -1
    poisoning_uses = 0
    if belt.hastag('poisoning_strength'):
        poison_lvl = belt.gettag('poisoning_strength')
    if belt.hastag('poisoning_uses'):
        poisoning_uses = belt.gettag('poisoning_uses')

    if poison_lvl != -1 and poisoning_uses > 0:
        poison(target, poison_lvl)

    ConsumeUse(belt)
Ejemplo n.º 10
0
def expire(char, arguments):
	if char.dead:
		char.deltag('in_poisonfield')
		return

	items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)

	for item in items:
		if item.hasscript( 'magic.poisonfield' ):
			level = 0
			if item.hastag('level'):
				level = int(item.gettag('level'))

			if char.poison < level:
				char.soundeffect(0x474)
				poison.poison(char, level)

			char.addtimer(350, expire, [])
			return

	char.deltag('in_poisonfield')
Ejemplo n.º 11
0
def expire(char, arguments):
    if char.dead:
        char.deltag('in_poisonfield')
        return

    items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)

    for item in items:
        if item.hasscript('magic.poisonfield'):
            level = 0
            if item.hastag('level'):
                level = int(item.gettag('level'))

            if char.poison < level:
                char.soundeffect(0x474)
                poison.poison(char, level)

            char.addtimer(350, expire, [])
            return

    char.deltag('in_poisonfield')
Ejemplo n.º 12
0
def Eat(player, item):
	if FillHunger( player, item ):
		# Fidget animation and munch munch sound
		player.soundeffect( random.choice([0x03a, 0x03b, 0x03c]), 1 )
		if not player.ismounted():
			player.action(ANIM_FIDGET3)

		# poisoned food
		if item.hastag( 'poisoning_char' ):
			poison.poison( player, item.gettag( 'poisoning_strength' ) )
			player.socket.clilocmessage( 1010512 ) # You have been poisoned!
			skills.poisoning.wearoff( item )

		if item.amount > 1:
			item.amount -= 1
			item.update()
		else:
			item.delete()

		return True
	return False
Ejemplo n.º 13
0
def hitEffect( char, weapon ):
	if not char or not weapon:
		return
	if not weapon.hastag( 'poisoning_uses' ):
		return
	uses = weapon.gettag( 'poisoning_uses' )
	if uses < 1:
		skills.poisoning.wearoff( weapon )
		return
	strength = weapon.gettag( 'poisoning_strength' )
	if not strength or not ( strength > 0 and strength < 5 ):
		skills.poisoning.wearoff( weapon )
		return
	skill = weapon.gettag( 'poisoning_skill' )
	chance = int( skill / 40 )
	if chance > random.randint( 0, 100 ):
		poison.poison( char, strength )
		uses = uses - 1
		if uses > 0:
			weapon.deltag( 'poisoning_uses' )
			weapon.settag( 'poisoning_uses', uses )
		else:
			skills.poisoning.wearoff( weapon )
Ejemplo n.º 14
0
def hitEffect(char, weapon):
    if not char or not weapon:
        return
    if not weapon.hastag('poisoning_uses'):
        return
    uses = weapon.gettag('poisoning_uses')
    if uses < 1:
        skills.poisoning.wearoff(weapon)
        return
    strength = weapon.gettag('poisoning_strength')
    if not strength or not (strength > 0 and strength < 5):
        skills.poisoning.wearoff(weapon)
        return
    skill = weapon.gettag('poisoning_skill')
    chance = int(skill / 40)
    if chance > random.randint(0, 100):
        poison.poison(char, strength)
        uses = uses - 1
        if uses > 0:
            weapon.deltag('poisoning_uses')
            weapon.settag('poisoning_uses', uses)
        else:
            skills.poisoning.wearoff(weapon)
Ejemplo n.º 15
0
def poisonPotion( char, potion, poisontype ):
	socket = char.socket
	levels = [14, 15, 16, 17]
	if poisontype == levels[0]:
		poison.poison(char, 0)
	elif poisontype == levels[1]:
		poison.poison(char, 1)
	elif poisontype == levels[2]:
		poison.poison(char, 2)
	elif poisontype == levels[3]:
		poison.poison(char, 3)
	else:
		return False

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ poisontype ][ POT_RETURN_BOTTLE ] )
	return True
Ejemplo n.º 16
0
def potion( char, potion, poisontype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	# Weakest to strongest
	levels = [14, 15, 16, 17, 34, 35]
	if poisontype == levels[0]:
		poison.poison( char, 0 )
	elif poisontype == levels[1]:
		poison.poison( char, 1 )
	elif poisontype == levels[2] or poisontype == levels[5]: # darkglow poison has the same effect as greater poison
		poison.poison( char, 2 )
	elif poisontype == levels[3] or poisontype == levels[4]: # parasitic poison has the same effect as deadly poison
		poison.poison( char, 3 )
	else:
		return False

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ poisontype ][ POT_RETURN_BOTTLE ] )
	return True
Ejemplo n.º 17
0
def potion(char, potion, poisontype):
    socket = char.socket
    if not canUsePotion(char, potion):
        return False

    # Weakest to strongest
    levels = [14, 15, 16, 17, 34, 35]
    if poisontype == levels[0]:
        poison.poison(char, 0)
    elif poisontype == levels[1]:
        poison.poison(char, 1)
    elif poisontype == levels[2] or poisontype == levels[
            5]:  # darkglow poison has the same effect as greater poison
        poison.poison(char, 2)
    elif poisontype == levels[3] or poisontype == levels[
            4]:  # parasitic poison has the same effect as deadly poison
        poison.poison(char, 3)
    else:
        return False

    char.action(ANIM_FIDGET3)
    char.soundeffect(SOUND_DRINK1)
    consumePotion(char, potion, POTIONS[poisontype][POT_RETURN_BOTTLE])
    return True