// 25.08.2001, MoNK: disable decaying of shields
// 06.08.2001, MoNK: eval for shields
// 26.07.2001, MoNK: syntax error
// 17.07.2001, MoNK: titan and dragon weapon

[DEFNAME dt_colors]
color_a_titan	color_i_titan
color_a_dragon	color_i_dragon
color_w_titan	07dc
color_w_dragon	0845

[FUNCTION f_dragon_increase]
	morey = ((<src.str> + 50) * 14)
	attr = <attr> | attr_identified
	update
	return 1

[FUNCTION f_titan_increase]
	morey = ((<src.str> + 75) * 14)
	attr = <attr> | attr_identified
	update
	return 1

[TYPEDEF t_dragon_spirit]
On=@DClick
	target Show me dragon plate chest...
	return 1

On=@Targon_item
	if <src.targ.baseid>==i_dragon_plate
		src.message You ... Spirit of Dragon into Dragon Plate Chest!
		src.consume 1 t_dragon_spirit
		src.targ.more2 = 1
	else
		src.message You can ... Spirit of Dragon into Dragon Plate Chest only.
	endif
	return 1

[TYPEDEF t_titan_spirit]
On=@DClick
	target Show me Titan Plate Chest...
	return 1

On=@Targon_item
	if <src.targ.baseid>==i_titan_plate
		src.message You ... Spirit of Titan into Titan Plate Chest!
		src.consume 1 t_dragon_spirit
		src.targ.more2 = 1
	else
		src.message You can ... Spirit of Ttian into Titan Plate Chest only.
	endif
	return 1

[CHARDEF c_dragon_ghost]
NAME=Dragon ghost
ID=0c

On=@Create
	color = 07fff
	karma = -10000
	fame = 0

	flags = statf_conjured

	str = 100
	dex = 50
	int = 100

	brain = brain_dragon

	wrestling = 100.0
	magicresistance = 100.0

[CHARDEF c_titan_ghost]
NAME=Titan ghost
ID=c_titan

On=@Create
	color = 07fff
	karma = -10000
	fame = 0

	flags = statf_conjured

	str = 100
	dex = 50
	int = 100

	brain = brain_beserk

	wrestling = 100.0
	magicresistance = 100.0

[CHARDEF c_dragonman]
NAME=Dragon
ID=0c
ARMOR=30
CAN=MT_WALK|MT_RUN|MT_FLY|MT_FIRE_IMMUNE

[CHARDEF c_titanman]
NAME=Titan
ID=c_titan
ARMOR=45
CAN=MT_WALK|MT_RUN

[ITEMDEF i_dragon_magicball]
NAME=Magic ball
ID=i_crystal_ball
WEIGHT=10

On=@DClick
	target Let me see what dragon do you want to ... into me?
	return 1

On=@Targon_item
	if <src.targ.type>!=t_corpse
		return 1
	elseif <src.targ.amount>!=12
		return 1
	else
		src.newnpc c_dragon_ghost
		src.act.p = <src.targ.p>
		link = <src.act.serial>
		src.act.fix
		src.message Catch him!
		target
		return 1
	endif

On=@Targon_char
	if <link>==04fffffff
		return 0
	endif
	if <src.targ.serial>==<link>
		src.targ.kill
		type = t_dragon_spirit
		link = 04fffffff
		return 1
	else
		src.message That is not my dragon!
		return 1
	endif

[ITEMDEF i_titan_magicball]
NAME=Magic ball
ID=i_crystal_ball
WEIGHT=10

On=@DClick
	target Let me see what titan do you want to ... into me?
	return 1

On=@Targon_item
	if <src.targ.type>!=t_corpse
		return 1
	elseif <src.targ.amount>!=75
		return 1
	else
		src.newnpc c_titan_ghost
		src.act.p = <src.targ.p>
		link = <src.act.serial>
		src.act.fix
		src.message Catch him!
		target
		return 1
	endif

On=@Targon_char
	if <link>==04fffffff
		return 0
	endif
	if <src.targ.serial>==<link>
		src.targ.kill
		type = t_titan_spirit
		link = 04fffffff
		return 1
	else
		src.message That is not my titan!
		return 1
	endif

[ITEMDEF i_dragon_timer]
NAME=Dragon timer
ID=i_pet_dragon
TYPE=t_eq_script
LAYER=layer_special

On=@Create
	attr = attr_newbie|attr_invis|attr_decay

On=@Equip
	timer = 1000
	attr = <attr> | attr_decay
	link = <src.serial>

On=@Timer
	if <link>==04fffffff
	else
		if <link.id>==c_dragonman
			link.body = <link.obody>
			link.str = (<link.str> - 150)
			link.dex = <link.dex> + 35
			if <link.hits> > <link.str>
				<link.hits> = <link.str>
			endif
			link.update
		endif
	endif

[ITEMDEF i_titan_timer]
NAME=Titan timer
ID=i_pet_titan
TYPE=t_eq_script
LAYER=layer_special

On=@Create
	attr = attr_newbie|attr_invis|attr_decay

On=@Equip
	timer = 1000
	attr = <attr> | attr_decay
	link = <src.serial>

On=@Timer
	if <link>==04fffffff
	else
		if <link.id>==c_titanman
			link.body = <link.obody>
			link.str = (<link.str> - 100)
			link.dex = <link.dex> + 30
			if <link.hits> > <link.str>
				link.hits = <link.str>
			endif
			link.update
		endif
	endif

//################
// Dragon armour section
//################

[ITEMDEF i_dragon_plate]
NAME=Dragon Chest
ID=i_platemail_chest

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Dragon plate
DESCRIPTION=Dragon chest

RESOURCES=50 i_ingot_dragon
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=25

On=@Create
	hitpoints = {150 180}
	color = color_a_dragon
	attr = attr_magic

On=@Equip
	f_dragon_increase
	timer = 60

On=@Unequip
	timer = -1
	morey = 0

On=@Timer
	if <cont>
		if (<cont.findlayer(layer_collar).baseid>==i_dragon_gorget) && (<cont.findlayer(layer_arms).baseid>==i_dragon_arms) && (<cont.findlayer(layer_legs).baseid>==i_dragon_legs) && (<cont.findlayer(layer_helm).baseid>==i_dragon_helmet) && (<cont.findlayer(layer_gloves).baseid>==i_dragon_gloves)
			if !(<cont.flags> & statf_reflection)
				cont.spelleffect s_magic_reflection 1000
				cont.sfx snd_spell_magic_reflection
				cont.say Spirit of Dragon protect you, <cont.name>!
			endif
		elseif <cont.isgm>
			cont.sysmessage Not full dragon plate equipped: reflection does not work.
		endif
		timer = 60
	endif
	return 1

[ITEMDEF i_dragon_gorget]
NAME=Dragon Gorget
ID=i_platemail_gorget

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Dragon plate
DESCRIPTION=Dragon gorget

RESOURCES=20 i_ingot_dragon
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=10

On=@Create
	hitpoints = {150 180}
	color = color_a_dragon
	attr = attr_magic
	more2 = 0
	morez = {50 100}

On=@Equip
	f_dragon_increase

	if <more2> == 0
		more2 = <morez>
	endif
	timer = 1

On=@Timer
	if <cont>
		if (<cont.findlayer(layer_chest).baseid>==i_dragon_plate) && (<cont.findlayer(layer_arms).baseid>==i_dragon_arms) && (<cont.findlayer(layer_legs).baseid>==i_dragon_legs) && (<cont.findlayer(layer_helm).baseid>==i_dragon_helmet) && (<cont.findlayer(layer_gloves).baseid>==i_dragon_gloves)
			if (<cont.int> > <cont.mana>) && (<more2> > 0)
				cont.mana = <cont.mana> + 1
				more2 = <more2> - 1
				if <cont.isgm>
					cont.sysmessage +1 mana from Dragon Gorget
				endif
			endif
		elseif <cont.isgm>
			cont.sysmessage Not full dragon plate armor equipped: mana refresh does not work.
		endif
		timer = {1 3}
	endif
	return 1

On=@Unequip
	timer = -1
	morey=0

[ITEMDEF i_dragon_arms]
NAME=Dragon Arms
ID=i_platemail_arms

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Dragon plate
DESCRIPTION=Dragon arms

RESOURCES=36 i_ingot_dragon
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=18

On=@Create
	hitpoints = {150 180}
	color = color_a_dragon
	attr = attr_magic

On=@Equip
	f_dragon_increase

On=@Unequip
	morey=0

[ITEMDEF i_dragon_legs]
NAME=Dragon Legs
ID=i_platemail_leggings

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Dragon plate
DESCRIPTION=Dragon legs

RESOURCES=40 i_ingot_dragon
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=20

On=@Create
	hitpoints = {150 180}
	color = color_a_dragon
	attr = attr_magic

On=@Equip
	f_dragon_increase

On=@Unequip
	morey=0

[ITEMDEF i_dragon_gloves]
NAME=Dragon Gloves
ID=i_platemail_gloves

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Dragon plate
DESCRIPTION=Dragon gloves

RESOURCES=24 i_ingot_dragon
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=12

On=@Create
	hitpoints = {150 180}
	color = color_a_dragon
	attr = attr_magic

On=@Equip
	f_dragon_increase

On=@Unequip
	morey=0

[ITEMDEF i_dragon_helmet]
NAME=Dragon Helmet
ID=i_helm_closed

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Dragon plate
DESCRIPTION=Dragon helmet

RESOURCES=30 i_ingot_dragon
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=7

On=@Create
	hitpoints = {150 180}
	color = color_a_dragon
	attr = attr_magic

On=@Equip
	f_dragon_increase

On=@Unequip
	morey=0

[ITEMDEF i_dragon_shield]
NAME=Dragon Wing
ID=i_shield_kite_metal
ARMOR=40
DYE=0

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan shield

RESOURCES=32 i_ingot_dragon
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=7

On=@Create
	hitpoints = {150 180}
	color = color_a_dragon
	more2 = {5 10}
	morez = -1
	attr = attr_magic | attr_decay
	timer = 7200

On=@Equip
	if <morez>==-1
		morez = <more2>	// set maximum of charges
	endif
	if <morez> > 0
		src.spelleffect s_invisibility 1000
		src.sfx snd_spell_invisibility
		src.flags = <src.flags> | statf_hidden
		morez = (<morez> - 1)
	endif
	timer = 7200

On=@Click
	if <morez>==-1
		morez = <more2>
	endif
	if <morez>==0
		if <timer> > 60
			message Uncharged <name> of Invisibility (<eval(<timer> / 60)> minutes to recharging)
		elseif <timer> > 0
			message Uncharged <name> of Invisibility (<timer> seconds to recharging)
		else
			message Uncharged <name> of Invisibility (recharging frozen)
		endif
	elseif <morez>==<more2>
		message <name> of Invisibility (<morez> charges)
	elseif <timer> > 60
		message <name> of Invisibility (<morez> of <eval(<more2>)> charges; <eval(<timer> / 60)> minutes to recharging)
	elseif <timer> > 0
		message <name> of Invisibility (<morez> of <eval(<more2>)> charges; <eval(<timer>) seconds to recharging)
	else
		message <name> of Invisibility (<morez> of <eval(<more2>)> charges; recharging frozen)
	endif
	return 1

On=@Timer
	if <morez>==-1
		morez = <more2>
		return 1
	else
		if <morez> < <more2>
			morez = <morez> + 1
			timer = 7200
		endif
	endif
	return 1

On=@Unequip
	timer = 7200

//###############
// Titan armour section
//###############

[ITEMDEF i_titan_plate]
NAME=Titan Chest
ID=i_platemail_chest

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan chest

RESOURCES=50 i_ingot_titan
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=25

On=@Create
	hitpoints = {150 180}
	color = color_a_titan
	attr = attr_magic

On=@Equip
	f_titan_increase
	timer = {1 3}
	return 0

	if (<src.findlayer(layer_collar).baseid>==i_titan_gorget) && (<src.findlayer(layer_arms).baseid>==i_titan_arms) && (<src.findlayer(layer_legs).baseid>==i_titan_legs) && (<src.findlayer(layer_helm).baseid>==i_titan_helmet) && (<src.findlayer(layer_gloves).baseid>==i_titan_gloves)
		if <src.id>!=c_titanman
			src.body = c_titanman
			src.str = <src.str> + 100
			src.dex = (<src.dex> - 30)
			src.update
			src.anim 6
			src.sfx 0232
			src.sfx 01ab
			src.newitem i_titan_timer
			src.act.equip
		endif
	endif

On=@Unequip
	morey=0

On=@Timer
	if <cont>
		if (<cont.findlayer(layer_collar).baseid>==i_titan_gorget) && (<cont.findlayer(layer_arms).baseid>==i_titan_arms) && (<cont.findlayer(layer_legs).baseid>==i_titan_legs) && (<cont.findlayer(layer_helm).baseid>==i_titan_helmet) && (<cont.findlayer(layer_gloves).baseid>==i_titan_gloves)
			if <cont.hits> < <cont.str>
				cont.hits = <cont.hits> + (1 + rand(3))
			endif
		elseif <cont.isgm>
			cont.sysmessage Not full Titan armor equipped: healing does not work.
		endif
		timer = {1 3}
	endif
	return 1

[ITEMDEF i_titan_gorget]
NAME=Titan Gorget
ID=i_platemail_gorget

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan gorget

RESOURCES=20 i_ingot_titan
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=10

On=@Create
	hitpoints = {150 180}
	color = color_a_titan
	attr = attr_magic

On=@Equip
	f_titan_increase

On=@Unequip
	morey=0

[ITEMDEF i_titan_arms]
NAME=Titan Arms
ID=i_platemail_arms

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan arms

RESOURCES=36 i_ingot_titan
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=18

On=@Create
	hitpoints = {150 180}
	color = color_a_titan
	attr = attr_magic

On=@Equip
	f_titan_increase

On=@Unequip
	morey=0

[ITEMDEF i_titan_legs]
NAME=Titan Legs
ID=i_platemail_leggings

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan legs

RESOURCES=40 i_ingot_titan
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=20

On=@Create
	hitpoints = {150 180}
	color = color_a_titan
	attr = attr_magic

On=@Equip
	f_titan_increase

On=@Unequip
	morey=0

[ITEMDEF i_titan_gloves]
NAME=Titan Gloves
ID=i_platemail_gloves

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan gloves

RESOURCES=24 i_ingot_titan
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=12

On=@Create
	hitpoints = {150 180}
	color = color_a_titan
	attr = attr_magic

On=@Equip
	f_titan_increase

On=@Unequip
	morey=0

[ITEMDEF i_titan_helmet]
NAME=Titan Helmet
ID=i_helm_nose

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan helmet

RESOURCES=30 i_ingot_titan
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=7

On=@Create
	hitpoints = {150 180}
	color = color_a_titan
	attr = attr_magic

On=@Equip
	f_titan_increase
	timer = 60

On=@Unequip
	timer = -1
	morey = 0

On=@Timer
	if <cont>
		if (<cont.findlayer(layer_collar).baseid>==i_titan_gorget) && (<cont.findlayer(layer_arms).baseid>==i_titan_arms) && (<cont.findlayer(layer_legs).baseid>==i_titan_legs) && (<cont.findlayer(layer_chest).baseid>==i_titan_plate) && (<cont.findlayer(layer_gloves).baseid>==i_titan_gloves)
			if !(<cont.flags> & statf_nightsight)
				cont.say Let the Sight of Titan be with you, <cont.name>!
				cont.spelleffect s_night_sight 1000
				cont.sfx snd_spell_night_sight
			endif
		elseif <cont.isgm>
			cont.sysmessage Not full Titan armor equipped: night sight does not work
		endif
		timer = 60
	endif
	return 1

[ITEMDEF i_titan_shield]
NAME=Titan Wall
ID=i_shield_kite_wood
ARMOR=45

CATEGORY=Provisions - Armor - Magic
SUBSECTION=Titan plate
DESCRIPTION=Titan shield

RESOURCES=32 i_ingot_titan
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0
WEIGHT=7

On=@Create
	hitpoints = {150 180}
	color = color_a_titan
	attr = attr_magic
	more2 = {5 10}
	morez = -1
	timer = 7200

On=@Equip
	if <morez>==-1
		morez = <more2>	// set maximum of charges
	endif
	if <morez> > 0
		src.spelleffect s_magic_reflection 1000
		src.sfx snd_spell_magic_reflection
		morez = (<morez> - 1)
	endif
	timer = 7200

On=@Click
	if <morez>==-1
		morez = <more2>
	endif
	if <morez>==0
		if <timer> > 60
			message Uncharged <name> of Magic Reflection (<eval(<timer> / 60)> minutes to recharging)
		elseif <timer> > 0
			message Uncharged <name> of Magic Reflection (<timer> seconds to recharging)
		else
			message Uncharged <name> of Magic Reflection (recharging frozen)
		endif
	elseif <morez>==<more2>
		message <name> of Magic Reflection (<morez> charges)
	elseif <timer> > 60
		message <name> of Magic Reflection (<morez> of <eval(<more2>)> charges; <eval(<timer> / 60)> minutes to recharging)
	elseif <timer> > 0
		message <name> of Magic Reflection (<morez> of <eval(<more2>)> charges; <eval(<timer>)> seconds to recharging)
	else
		message <name> of Magic Reflection (<morez> of <eval(<more2>)> charges; recharging frozen)
	endif
	return 1

On=@Timer
	if <morez>==-1
		morez = <more2>
		return 1
	else
		if <morez> < <more2>
			morez = <morez> + 1
			timer = 7200
		endif
	endif
	return 1

On=@Unequip
	timer = 7200

[ITEMDEF i_dragon_rock]
NAME=Dragon Rock
ID=01f1c
VALUE=10000

RESOURCES=i_crystal_purple, i_reag_dragon_blood

On=@Create
	color = color_w_dragon

[ITEMDEF i_titan_rock]
NAME=Titan Rock
ID=01f1c
VALUE=10000

RESOURCES=i_crystal_purple

On=@Create
	color = color_w_titan

[ITEMDEF i_dragon_claw]
NAME=Dragon Claw
ID=i_scimitar

VALUE=100000

CATEGORY=Provisions - Weapon - Magic
SUBSECTION=Dragon weapon
DESCRIPTION=Dragon Claw

RESOURCES=50 i_ingot_dragon, 1 i_dragon_rock
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0

On=@Create
	attr = attr_magic | attr_identified
	color = color_w_dragon
	hitpoints = {100 200}

On=@DClick
	equip
	return 1

On=@Equip
	morey = ((<src.swordsmanship> / 3) * 2)
	src.sfx 0166

On=@Unequip
	morey = 0
	src.sfx 016b

On=@Damage
	if !<cont>
		return 1
	elseif !<cont.ischar>
		return 1
	elseif <cont.serial>==<src.serial>
		return 1
	endif
	more2 = {4 30}
	if <src.brain>
		if rand(5) == 1
			more2 = (<more2> + <more2>)
			src.effect 3,i_fx_explode,6,15,1
			src.sfx 016a
		else
			dorand 3
				sfx 0167
				sfx 0168
				sfx 016c
			enddo
		endif
	endif
	f_damage_sword
	src.damage <more2>
	f_crash_sword
	more2 = 0
	return 1

[ITEMDEF i_titan_fist]
NAME=Titan's Fist
ID=i_maul

VALUE=100000

CATEGORY=Provisions - Weapon - Magic
SUBSECTION=Titan weapon
DESCRIPTION=Titan's Fist

RESOURCES=50 i_ingot_titan, 1 i_titan_rock
SKILLMAKE=BLACKSMITHING 115.0, MINING 115.0

On=@Create
	attr = attr_magic | attr_identified
	color = color_w_titan
	hitpoints = {100 200}

On=@DClick
	equip
	return 1

On=@Equip
	morey = ((<src.macefighting> / 3) * 2)
	src.sfx 428

On=@Unequip
	morey = 0
	src.sfx 0170

On=@Damage
	if !<cont>
		return 1
	elseif !<cont.ischar>
		return 1
	elseif <cont.serial>==<src.serial>
		return 1
	endif
	more2 = {10 30}
	if <src.brain>
		if rand(5) == 1
			more2 = (<more2> + <more2>)
			src.effect 3,i_fx_field_paralyze,6,15,1
			src.effect 2,i_fx_field_paralyze,6,15,1
			src.sfx 372
		else
			dorand 3
				sfx 0171
				sfx 0172
				sfx 01b3
			enddo
		endif
	endif
	f_damage_mace
	src.damage <more2>
	f_crash_mace
	more2 = 0
	return 1
