//################################
// Good and evil weapon - heritage from TUS 48
//################################

// 04.08.2001, MoNK: messages of Crystal Ball of Reputation
// 26.07.2001, MoNK: syntax errors

[ITEMDEF 06000]
DEFNAME=i_claymore_protection
NAME=Claymore of protection
ID=i_sword_broad
SKILL=Swordsmanship
REQSTR=100

On=@Create
	hitpoints={53 113}
	attr=attr_magic|attr_newbie
	morey=70.0

On=@Click
	if <link>==04fffffff
		say This <name> has no owner yet
	else
		say <link.name>'s <name>
	endif
	return 1

On=@Equip
	if <link>==04fffffff
		link = <src.serial>
	endif

	if <link>!=<src.serial>
		attr = <attr> & ~attr_newbie
	else
		attr = <attr> | attr_newbie
	endif

	src.tactics = <src.tactics> + 15.0

On=@Unequip
	src.tactics = (<src.tactics> - 15.0)

On=@Targon_ground
	if <src.account.plevel> > 1
		src.sysmessage Turn off GM Mode first!
		return 1
	endif

On=@Targon_item
	if (<src.targ.type>==t_corpse) && (<src.targ.region.flags> & 04000) && (<src.targ.link>!=04fffffff)
		src.sysmessage You can't carve <src.targ.name>
		return 1
	endif

CATEGORY=Other
SUBSECTION=Weapons - Good
DESCRIPTION=Claymore of protection

[ITEMDEF 06001]
DEFNAME=i_dragon_slayer
NAME=Dragon Slayer Sword
ID=i_sword_viking
SKILL=Swordsmanship
REQSTR=100

On=@Create
	attr=attr_newbie
	COLOR=golden_armor_color
	HITPOINTS={40 150}

On=@Click
	if <link>==04fffffff
		say This <name> has no owner yet
	else
		say <link.name>'s <name>
	endif
	return 1

On=@Equip
	if <link>==04fffffff
		link = <src.serial>
	endif

	if <link>!=<src.serial>
		attr = <attr> & ~attr_newbie
	else
		attr = <attr> | attr_newbie
	endif

	src.message You now wield the powerful Dragon Slayer sword!
	src.effect 3,i_FX_BLESS_effect,6,15,1
	src.sfx snd_SPELL_PROTECTION

On=@Damage
	if <src.npc>==BRAIN_DRAGON
		src.damage={55 195}
		src.effect 3,i_FX_CURSE,6,15,1
		src.sfx snd_SPELL_POISON
	endif

On=@Targon_ground
	if <src.account.plevel> > 1
		src.sysmessage Turn off GM Mode first!
		return 1
	endif

On=@Targon_item
	if (<src.targ.type>==t_corpse) && (<src.targ.region.flags> & 04000) && (<src.targ.link>!=04fffffff)
		src.sysmessage You can't carve <src.targ.name>
		return 1
	endif

CATEGORY=Other
SUBSECTION=Weapons - Good
DESCRIPTION=The Dragon Slayer Sword

[ITEMDEF 06002]
DEFNAME=i_ball_reputation
NAME=Crystal ball of Reputation
ID=0e2d
WEIGHT=10.0
VALUE=5000

On=@Dclick
	if <src.restest 100 i_gold>
		src.consume 100 i_gold
		src.message That is 100 gold coins worth of knowledge!
		src.message Thy fame is <src.fame> and thy karma is <src.karma>.
		if <src.kills> > 0
			src.message Thou have <src.kills> kills now.
		endif
		if <src.deaths> > 0
			src.message That is thy <eval(<src.deaths> + 1)> life.
		endif
		src.effect 3,i_fx_explode,6,15,1
		src.sfx snd_SPELL_LIGHTNING
		return 1
	else
		src.message Thou lack 100 gold coins to pay for it.
		return 1
	endif

CATEGORY=Other
SUBSECTION=Magic
DESCRIPTION=Crystal ball of reputation

[ITEMDEF 06003]
DEFNAME=i_daemon_sword
NAME=Daemon Sword
ID=i_sword_viking
DAM=10,35
SKILL=Swordsmanship
REQSTR=100

On=@Create
	attr = attr_newbie
	COLOR = blackrock_armor_color
	HITPOINTS = {75 150}

On=@Click
	if <link>==04fffffff
		say This <name> has no owner yet
	else
		say <link.name>'s <name>
	endif
	return 1

On=@Equip
	if <link>==04fffffff
		link = <src.serial>
	endif

	if <link>!=<src.serial>
		attr = <attr> & ~attr_newbie
	else
		attr = <attr> | attr_newbie
	endif

	src.swordsmanship = <src.swordsmanship> + 25.0
	src.tactics = <src.tactics> + 25.0
	src.kills = <src.kills> + 5
	src.karma = (<src.karma> - 5000)
	src.str = 125
	if <src.hits> > <src.str>
		src.hits = <src.str>
	endif
	src.color = 04c2
	src.update
	src.message The power of daemon growth in you!

On=@Unequip
	src.message You feel terribly weak!
	src.swordsmanship = (<src.swordsmanship> - 25.0)
	src.tactics = (<src.tactics> - 25.0)
	src.karma = <src.karma> + 5000
	src.kills = (<src.kills> - 5)
	src.str = 35
	if <src.hits> > <src.str>
		src.hits = <src.str>
	endif
	src.color = 0
	src.update
	return 0

On=@Damage
	if rand(5)==1
		src.effect=3,i_fire_column,6,15,1
		src.sfx snd_SPELL_FLAMESTRIKE
		src.damdage={10 50}
	endif

On=@Targon_ground
	if <src.account.plevel> > 1
		src.sysmessage Turn off GM Mode first!
		return 1
	endif

On=@Targon_item
	if (<src.targ.type>==t_corpse) && (<src.targ.region.flags> & 04000) && (<src.targ.link>!=04fffffff)
		src.sysmessage You can't carve <src.targ.name>
		return 1
	endif

CATEGORY=Other
SUBSECTION=Weapons - Evil
DESCRIPTION=Daemon Sword

[ITEMDEF 06004]
DEFNAME i_undead_slayer
NAME=Undead Slayer Sword
ID=i_sword_viking
DAM=10,35
SKILL=swordsmanship
REQSTR=100

On=@Create
	attr=attr_newbie
	COLOR=silver_armor_color
	HITPOINTS={40 150}

On=@Click
	if <link>==04fffffff
		say This <name> has no owner yet
	else
		say <link.name>'s <name>
	endif
	return 1

On=@Equip
	if <link>==04fffffff
		link = <src.serial>
	endif

	if <link>!=<src.serial>
		attr = <attr> & ~attr_newbie
	else
		attr = <attr> | attr_newbie
	endif

	src.message You now wield the powerful Undead Slayer sword!
	src.effect 3,i_FX_BLESS_effect,6,15,1
	src.sfx snd_SPELL_PROTECTION

On=@Damage
	if <src.brain> && (<src.npc>==BRAIN_UNDEAD)
		src.damage={20 70}
		src.effect 3,i_FX_CURSE,6,15,1
		src.sfx snd_SPELL_POISON
	endif
	return 1

On=@Targon_ground
	if <src.account.plevel> > 1
		src.sysmessage Turn off GM Mode first!
		return 1
	endif

On=@Targon_item
	if (<src.targ.type>==t_corpse) && (<src.targ.region.flags> & 04000) && (<src.targ.link>!=04fffffff)
		src.sysmessage You can't carve <src.targ.name>
		return 1
	endif

CATEGORY=Other
SUBSECTION=Weapons - Good
DESCRIPTION=The Undead Slayer Sword

[ITEMDEF 06005]
DEFNAME i_sword_justice
NAME=Sword of Justice
ID=i_sword_viking
DAM=10,35
SKILL=Swordsmanship
REQSTR=100

On=@Create
	HITPOINTS={35 120}

On=@Equip
	if <src.karma> >= 0
		if <src.karma> <= 2500
			src.message Thou hath a good soul indeed, but not good enough...
			unequip
			return 1
		endif
	endif
	if <src.karma> <= 0
		src.message Thou dost not have a good soul, thou mayest not use this sword...
		unequip
		return 1
	endif
	src.message May the Light be with you!
	return 0

On=@Damage
	if <src.karma> <= -500
		if rand(2)==1
			src.effect=3,i_fx_curse,6,15,1
			src.sfx snd_spell_poison
			src.damage {20 45}
		endif
	endif
	return 0

On=@Targon_ground
	if <src.account.plevel> > 1
		src.sysmessage Turn off GM Mode first!
		return 1
	endif

On=@Targon_item
	if (<src.targ.type>==t_corpse) && (<src.targ.region.flags> & 04000) && (<src.targ.link>!=04fffffff)
		src.sysmessage You can't carve <src.targ.name>
		return 1
	endif

CATEGORY=Other
SUBSECTION=Weapons - Good
DESCRIPTION=Sword of Justice

[ITEMDEF 06006]
DEFNAME i_stormbringer
NAME=Stormbringer
ID=i_sword_viking
SKILL=Swordsmanship
REQSTR=125
TWOHANDS=N
repair=0

On=@Create
	HITPOINTS={150 180}
	COLOR=066d

On=@Click
	if <link>==04fffffff
		say This <name> has no owner yet
	else
		say <link.name>'s <name>
	endif
	return 1

On=@Equip
	if <link>==04fffffff
		link = <src.serial>
	endif
	if <link>!=<src.serial>
		attr = <attr> & ~attr_newbie
	else
		attr = <attr> | attr_newbie
	endif


	src.flags = (<src.flags> | statf_polymorph)

	src.sfx 019c
	src.message Stormbringer says: Your soul is mine, mortal!
	src.sysmessage You lose alot of karma.
	src.karma = (<src.karma> - 3000)
	src.str = (<src.str> + 100)
	src.hits = <src.str>
	src.sysmessage You feel a great deal stronger.

On=@Unequip
	src.sfx 019c
	src.message Stormbringer says: You will be back mortal! My power is too great to you can resist it!
	src.karma = (<src.karma> + 3000)
	src.sysmessage You regain your karma.
	src.str = (<src.str> - 100)
	if <src.hits> > <src.str>
		src.hits = <src.str>
	endif
		src.flags = (<src.flags> & ~statf_polymorph)
	src.sysmessage You feel much weaker.

On=@Damage
	if <src.brain>
		// npc
		if rand(20)==0
			src.sfx 019c
			src.sfx 20
			src.sfx 230
			src.effect 3,i_fx_curse,6,15,1
			src.kill
		endif
	else
		// player
		if rand(100)==0
			say Stormbringer steals <src.name>'s soul, and lets out a pericing scream.
			src.sfx 019c
			src.sfx 20
			src.sfx 230
			src.effect 3,i_fx_curse,6,15,1
			src.color = 0
			src.update
			src.kill
		endif
	endif

On=@Targon_ground
	if <src.account.plevel> > 1
		src.sysmessage Turn off GM Mode first!
		return 1
	endif

On=@Targon_item
	if (<src.targ.type>==t_corpse) && (<src.targ.region.flags> & 04000) && (<src.targ.link>!=04fffffff)
		src.sysmessage You can't carve <src.targ.name>
		return 1
	endif

CATEGORY=Other
SUBSECTION=Weapons - Evil
DESCRIPTION=Stormbringer

[ITEMDEF 06007]
DEFNAME=i_soul_ripper
NAME=Soul Ripper
ID=0f4e
DAM=15,40
SKILL=Swordsmanship
REQSTR=125
TWOHANDS=Y

On=@Create
	HITPOINTS={100 120}
	color = 066d

On=@Click
	if <link>==04fffffff
		say This <name> has no owner yet
	else
		say <link.name>'s <name>
	endif
	return 1

On=@Equip
	if <link>==04fffffff
		link = <src.serial>
	endif
	if <link>!=<src.serial>
		attr = <attr> & ~attr_newbie
	else
		attr = <attr> | attr_newbie
	endif

	sfx 019c
	src.message Soul Ripper says: Your soul is mine, mortal!
	src.message You feel the urge to kill!
	src.sysmessage You loose alot of karma!
	src.karma = (<src.karma> - 9000)
	src.color = 0
	src.update

On=@Unequip
	sfx 019c
	src.message Soul Ripper says: You cannot get rid of me that easily! You will be back!
	src.message You came to your senses!
	src.sysmessage You regain your karma!
	src.karma = (<src.karma> + 9000)
	src.color = <src.oskin>
	src.update

On=@Damage
	if <src.brain>
		if rand(15)==0
			sfx 019c
			sfx 0230
			sfx 0206
			src.effect 3,i_fx_curse,6,15,1
			src.kill
		endif
	else
		if rand(150)==0
			say Soul Ripper steals <src.name>'s soul, and lets out an eerie laugh.
			sfx 019c
			sfx 0230
			sfx 0206
			src.effect 3,i_fx_curse,6,15,1
			src.color 038a
			src.update
			src.kill
		endif
	return 0

On=@Targon_ground
	if <src.account.plevel> > 1
		src.sysmessage Turn off GM Mode first!
		return 1
	endif

On=@Targon_item
	if (<src.targ.type>==t_corpse) && (<src.targ.region.flags> & 04000) && (<src.targ.link>!=04fffffff)
		src.sysmessage You can't carve <src.targ.name>
		return 1
	endif

CATEGORY=Other
SUBSECTION=Weapons - Evil
DESCRIPTION=Soul Ripper (bardiche)

[ITEMDEF I_BOOKOFHELL]
NAME=Book of Hell
ID=i_BOOK_OPEN

CATEGORY=Trigger Items
SUBSECTION=Magic Items
DESCRIPTION=Book of Hell

ON=@Create
more=b_hitchhiker // some book number

ON=@DClick
	src.effect=3,i_FIRE_COLUMN,6,15,1	// flamestrike
	src.sfx=snd_SPELL_FLAMESTRIKE
	src.DAMAGE={5 20}	// damage the person who did this
	TIMER=4

ON=@TIMER
	SPEAK Run away !
	return 1

[ITEMDEF I_FIRE_STORM]
// Fire Storm
NAME=a Fire Storm
ID=i_fx_explode
type=T_SPELL

CATEGORY=TFL Additions
SUBSECTION=Animations
DESCRIPTION=Fire Storm Piece

ON=@Create
	attr=attr_magic|attr_move_never
	more=0
	moreP=42,55,99
	TIMER=1

ON=@DClick
	more=<more>+1
	if (<more> > 15)
		REMOVE
		return 1
	endif
	moreP=<LINK.P>
	VAR.NEG=RAND(2)
	VAR.TX=RAND(6)
	if (<VAR.NEG> == 1)
		moreX= <moreX> - <VAR.TX>
	else
		moreX= <moreX> + <VAR.TX>
	endif
	VAR.NEG=RAND(2)
	VAR.TY=RAND(6)
	if (<VAR.NEG> == 1)
		moreY= <moreY> - <VAR.TY>
	else
		moreY= <moreY> + <VAR.TY>
	endif
	attr=attr_move_never|attr_invis|attr_magic  //set invs
	P=<moreP>
	attr=attr_magic|attr_move_never  //unhide object, shos it at new location
	moreP=42,55,99
	TIMER=1
	return 1

[ITEMDEF I_BARDICHE_SA]
//Bardiche (this may not work!)
//Using Sword type below
NAME=Supremely Accurate Bardiche
ID=i_bardiche
type=T_WEAPON_SWORD
RESOURCES=i_bardiche,i_enchant_weapon,i_scroll_bless	// ,5 i_enchant_weapon

ON=@Create
	HITPOINTS={31 100}
	COLOR=color_magic_weap
	attr=attr_magic
	//moreY=100.0

ON=@EQUIP
	src.swordsmanship = (<src.swordsmanship> + 25.0)
	src.tactics = (<src.tactics> + 25.0)
	src.DEX = (<src.DEX> + 1)

ON=@UNEQUIP
	src.swordsmanship = (<src.swordsmanship> - 25.0)
	src.tactics = (<src.tactics> - 25.0)
	src.DEX = (<src.DEX> - 1)

[ITEMDEF 069c0]
//Lock for made locable chests and boxes
NAME=Lock
ID=01051
type=13
WEIGHT=1
RESOURCES=1 i_ingot_iron, 1 i_ingot_copper
SKILLMAKE=TINKERING 90.0, t_tinker_tools


On=@Create
	COLOR=0543

On=@targon_item
	if (<src.targ.type>)==2
		src.message This <src.targ.name> already has a lock.
		return 1
	elseif (<src.targ.attr>&08010)
		src.message You can't install lock into this <src.targ.name>.
		return 1
	endif

	if (<src.targ.id>==0e40) || (<src.targ.id>==0e42) || (<src.targ.id>==0e7c) || (<src.targ.id>==0e80) || (<src.targ.id>==09a8) || (<src.targ.id>==0e80)
		// some "lockable" container
		src.consume 1 069c0
		src.targ.type = 2
		src.targ.more = <src.targ.UID>
		src.newitem i_key_copper
		src.act.more = <src.targ.UID>
		src.act.bounce
		src.SFX 0ee		// make some noise (1f5?)
		src.SALUTE		// make some animation
		return 1
	else
		src.message You can't install lock into this <src.targ.name>.
		return 1
	endif

[ITEMDEF 069c1]
//Hammer for repair
DEFNAME=i_repairer
NAME=Hammer for repair
ID=i_hammer_sledge
WEIGHT=4

On=@Create
	COLOR = 0543

On=@Targon_item
	if <src.targ.repair>!=1
		src.message You can't repair this <src.targ.name>.
		return 1
	endif

	if <src.targ.more2>!=0
		src.message You can't repair this <src.targ.name>.
		return 1
	endif

	if <src.targ.more>==0
		src.message You can't repair this <src.targ.name>.
		return 1
	endif

	src.sysmessage Before: <src.targ.more>
	src.targ.more = ((<src.targ.more> & 0ffff0000) | (<eval(<src.targ.more>/65536)>))
	src.sysmessage After: <src.targ.more>
	return 1

[EOF]

