LEVEL_VERSION(1)
SET_GENERATE_SPEED(200)
START_MONEY(ALL_PLAYERS,2500)
MAX_CREATURES(PLAYER0,15)
MAX_CREATURES(PLAYER1,60)
MAX_CREATURES(PLAYER2,30)
MAX_CREATURES(PLAYER3,30)
MAX_CREATURES(PLAYER4,30)
MAX_CREATURES(PLAYER5,30)
MAX_CREATURES(PLAYER6,30)

SET_GAME_RULE(AlliesShareCta,1)
SET_GAME_RULE(AlliesShareVision,1)
SET_GAME_RULE(AlliesShareDrop,1)
SET_CREATURE_PROPERTY(KNIGHT,LORD,0)
SET_CREATURE_MAX_LEVEL(PLAYER0,ANY_CREATURE,4)
SET_GAME_RULE(ImpWorkExperience,400)
SET_GAME_RULE(TortureConvertChance,100)
SET_CREATURE_PROPERTY(IMP,NO_IMPRISONMENT,1)
SET_GAME_RULE(TortureConvertChance,100)
SET_GAME_RULE(DisplayPortalLimit,1)

QUICK_OBJECTIVE(1,"Welcome to this massive Realm where Danger awaits in every corner. Build yourself up my Liege and Prosper to Conquer this Realm! But be Careful since Creatures wont go above Level 4 in the beginning until you have proven yourself as strong Leader! Choose your paths wisely,some may be more dangerous then others!")

ALLY_PLAYERS(PLAYER6,PLAYER3,3)
ALLY_PLAYERS(PLAYER3,PLAYER6,3)
ALLY_PLAYERS(PLAYER4,PLAYER2,3)
ALLY_PLAYERS(PLAYER2,PLAYER4,3)
ALLY_PLAYERS(PLAYER1,PLAYER_GOOD,3)
ALLY_PLAYERS(PLAYER_GOOD,PLAYER1,3)


COMPUTER_PLAYER(PLAYER1,0)
COMPUTER_PLAYER(PLAYER2,0)
COMPUTER_PLAYER(PLAYER3,0)
COMPUTER_PLAYER(PLAYER4,0)
COMPUTER_PLAYER(PLAYER5,0)
COMPUTER_PLAYER(PLAYER6,0)

ADD_CREATURE_TO_POOL(TROLL,100)
ADD_CREATURE_TO_POOL(SPIDER,100)
ADD_CREATURE_TO_POOL(TENTACLE,100)
ADD_CREATURE_TO_POOL(SORCEROR,100)
ADD_CREATURE_TO_POOL(ORC,100)
ADD_CREATURE_TO_POOL(BILE_DEMON,100)
ADD_CREATURE_TO_POOL(DRAGON,100)
ADD_CREATURE_TO_POOL(DARK_MISTRESS,100)
ADD_CREATURE_TO_POOL(THIEF,100)
ADD_CREATURE_TO_POOL(DWARFA,100)
ADD_CREATURE_TO_POOL(ARCHER,100)
ADD_CREATURE_TO_POOL(BARBARIAN,100)
ADD_CREATURE_TO_POOL(MONK,100)
ADD_CREATURE_TO_POOL(FAIRY,100)
ADD_CREATURE_TO_POOL(WITCH,100)
ADD_CREATURE_TO_POOL(WIZARD,100)
ADD_CREATURE_TO_POOL(GIANT,100)
ADD_CREATURE_TO_POOL(SAMURAI,100)

rem Human Player Creatures
CREATURE_AVAILABLE(PLAYER0,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER0,SORCEROR,1,0)
CREATURE_AVAILABLE(PLAYER0,ORC,1,0)
CREATURE_AVAILABLE(PLAYER0,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER0,BARBARIAN,1,0)
CREATURE_AVAILABLE(PLAYER0,GIANT,1,0)

rem Player Black Creatures
CREATURE_AVAILABLE(PLAYER5,SPIDER,1,0)
CREATURE_AVAILABLE(PLAYER5,TENTACLE,1,0)
CREATURE_AVAILABLE(PLAYER5,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER5,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER5,FAIRY,1,0)
CREATURE_AVAILABLE(PLAYER5,WITCH,1,0)
CREATURE_AVAILABLE(PLAYER5,WIZARD,1,0)
CREATURE_AVAILABLE(PLAYER5,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER5,TROLL,1,0)

rem Orange&Yellow Player Creatures

CREATURE_AVAILABLE(PLAYER3,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER3,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER3,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER3,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER3,SPIDER,1,0)
CREATURE_AVAILABLE(PLAYER3,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER3,ORC,1,0)

CREATURE_AVAILABLE(PLAYER6,DRAGON,1,0)
CREATURE_AVAILABLE(PLAYER6,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER6,BILE_DEMON,1,0)
CREATURE_AVAILABLE(PLAYER6,TROLL,1,0)
CREATURE_AVAILABLE(PLAYER6,SPIDER,1,0)
CREATURE_AVAILABLE(PLAYER6,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(PLAYER6,ORC,1,0)

rem Purple&Green Creatures
CREATURE_AVAILABLE(PLAYER2,SAMURAI,1,0)
CREATURE_AVAILABLE(PLAYER2,THIEF,1,0)
CREATURE_AVAILABLE(PLAYER2,DWARFA,1,0)
CREATURE_AVAILABLE(PLAYER2,ARCHER,1,0)
CREATURE_AVAILABLE(PLAYER2,MONK,1,0)
CREATURE_AVAILABLE(PLAYER2,WITCH,1,0)
CREATURE_AVAILABLE(PLAYER2,TIME_MAGE,1,0)
CREATURE_AVAILABLE(PLAYER2,FAIRY,1,0)
CREATURE_AVAILABLE(PLAYER2,ARCHER,1,0)
CREATURE_AVAILABLE(PLAYER2,GIANT,1,0)
CREATURE_AVAILABLE(PLAYER2,BARBARIAN,1,0)

CREATURE_AVAILABLE(PLAYER4,SAMURAI,1,0)
CREATURE_AVAILABLE(PLAYER4,THIEF,1,0)
CREATURE_AVAILABLE(PLAYER4,DWARFA,1,0)
CREATURE_AVAILABLE(PLAYER4,ARCHER,1,0)
CREATURE_AVAILABLE(PLAYER4,MONK,1,0)
CREATURE_AVAILABLE(PLAYER4,WITCH,1,0)
CREATURE_AVAILABLE(PLAYER4,TIME_MAGE,1,0)
CREATURE_AVAILABLE(PLAYER4,FAIRY,1,0)
CREATURE_AVAILABLE(PLAYER4,ARCHER,1,0)
CREATURE_AVAILABLE(PLAYER4,GIANT,1,0)
CREATURE_AVAILABLE(PLAYER4,BARBARIAN,1,0)

rem blue player creatures

CREATURE_AVAILABLE(player1,DARK_MISTRESS,1,0)
CREATURE_AVAILABLE(player1,DRAGON,1,0)
CREATURE_AVAILABLE(player1,BILE_DEMON,1,0)
CREATURE_AVAILABLE(player1,TROLL,1,0)
CREATURE_AVAILABLE(player1,BARBARIAN,1,0)
CREATURE_AVAILABLE(player1,GIANT,1,0)
CREATURE_AVAILABLE(player1,THIEF,1,0)
CREATURE_AVAILABLE(player1,FAIRY,1,0)
CREATURE_AVAILABLE(player1,WITCH,1,0)
CREATURE_AVAILABLE(player1,WIZARD,1,0)
CREATURE_AVAILABLE(player1,DWARFA,1,0)
CREATURE_AVAILABLE(player1,ORC,1,0)
CREATURE_AVAILABLE(player1,TROLL,1,0)
CREATURE_AVAILABLE(player1,MONK,1,0)
CREATURE_AVAILABLE(player1,TIME_MAGE,1,0)



rem Rooms

ROOM_AVAILABLE(ALL_PLAYERS,TREASURE,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,LAIR,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GARDEN,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,TRAINING,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,RESEARCH,1,1)
ROOM_AVAILABLE(ALL_PLAYERS,GUARD_POST,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,WORKSHOP,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,PRISON,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,TORTURE,1,0)
ROOM_AVAILABLE(ALL_PLAYERS,BARRACKS,1,0)
ROOM_AVAILABLE(PLAYER5,SCAVENGER,1,1)
ROOM_AVAILABLE(PLAYER3,SCAVENGER,1,1)

Rem Magic

MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HAND,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SLAP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_POSSESS,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_IMP,1,1)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SIGHT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_SPEED,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_OBEY,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CALL_TO_ARMS,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_HEAL_CREATURE,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_PROTECT,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_LIGHTNING,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_CHICKEN,1,0)
MAGIC_AVAILABLE(ALL_PLAYERS,POWER_DISEASE,1,0)

rem human magic
MAGIC_AVAILABLE(PLAYER0,POWER_LIGHTNING,0,0)
MAGIC_AVAILABLE(PLAYER0,POWER_CHICKEN,0,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DISEASE,0,0)
MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,1)
MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,0,0)

TRAP_AVAILABLE(ALL_PLAYERS,LIGHTNING,1,0)
TRAP_AVAILABLE(ALL_PLAYERS,WORD_OF_POWER,1,0)

DOOR_AVAILABLE(ALL_PLAYERS,BRACED,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,STEEL,1,0)
DOOR_AVAILABLE(ALL_PLAYERS,MAGIC,1,0)


REM its PARTY TIME


CREATE_PARTY(weaker)
	ADD_TO_PARTY(weaker,ARCHER,4,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(weaker,BARBARIAN,4,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(weaker,BARBARIAN,4,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(weaker,ARCHER,4,100,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(middle)
	ADD_TO_PARTY(middle,ARCHER,5,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(middle,BARBARIAN,5,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(middle,THIEF,5,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(middle,WITCH,5,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(middle,ARCHER,5,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(middle,ARCHER,5,100,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(strong)
	ADD_TO_PARTY(strong,ARCHER,8,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(strong,BARBARIAN,8,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(strong,THIEF,8,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(strong,WITCH,8,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(strong,ARCHER,8,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(strong,SAMURAI,8,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(strong,SAMURAI,8,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(strong,WITCH,8,100,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(annoy)
	ADD_TO_PARTY(annoy,ARCHER,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,BARBARIAN,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,BARBARIAN,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,THIEF,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,FAIRY,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,ARCHER,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,FAIRY,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,FAIRY,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,SAMURAI,7,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(annoy,SAMURAI,7,100,ATTACK_DUNGEON_HEART,0)

CREATE_PARTY(defense)
	ADD_TO_PARTY(defense,KNIGHT,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,BARBARIAN,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,BARBARIAN,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,WITCH,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,WITCH,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,WIZARD,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,WIZARD,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,ARCHER,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,ARCHER,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,SAMURAI,10,100,DEFEND_LOCATION,0)
	ADD_TO_PARTY(defense,SAMURAI,10,100,DEFEND_LOCATION,0)

CREATE_PARTY(laststand)
	ADD_TO_PARTY(laststand,AVATAR,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,KNIGHT,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,KNIGHT,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,HORNY,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,HORNY,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,WITCH,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,WITCH,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,FAIRY,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,FAIRY,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,WIZARD,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,WIZARD,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,SAMURAI,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,SAMURAI,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,DRAGON,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,DRAGON,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,DARK_MISTRESS,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,DARK_MISTRESS,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,MONK,10,100,DEFEND_HEART,0)
	ADD_TO_PARTY(laststand,MONK,10,100,DEFEND_HEART,0)

CREATE_PARTY(inbetween)
	ADD_TO_PARTY(inbetween,ARCHER,9,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(inbetween,BARBARIAN,9,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(inbetween,THIEF,9,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(inbetween,WITCH,9,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(inbetween,ARCHER,9,100,ATTACK_DUNGEON_HEART,0)
	ADD_TO_PARTY(inbetween,MONK,9,100,ATTACK_DUNGEON_HEART,0)



rem ACtion points

IF_ACTION_POINT(3,PLAYER0)

	QUICK_INFORMATION(2,"Be Careful what you wish for! This path leads to great treasure but comes with Danger in form of its Guards.",3)
	ADD_TO_FLAG(PLAYER0,FLAG0,1)
ENDIF

if(PLAYER0,FLAG0 == 0)
	IF_ACTION_POINT(2,PLAYER0)
		QUICK_INFORMATION(3,"Maybe its to early for this Direction... try to get the North conquered first.",2)
	ENDIF
ENDIF

if(PLAYER0,FLAG0 == 1)
	IF_ACTION_POINT(2,PLAYER0)
		QUICK_INFORMATION(4,"Ahead lies the Dungeon of another Dark Keeper, you should be sure to be strong enough to fight him!",2)
	ENDIF
ENDIF

IF_ACTION_POINT(4,PLAYER0)
	QUICK_INFORMATION(5,"Great work my Lord, you managed to get by this pesky Guards and have proven your Creatures strentgh.Now they are able to train even higher to level 8.Gain more Strentgh to unlock your Servants full potential!",4)
	SET_CREATURE_MAX_LEVEL(PLAYER0,ANY_CREATURE,8)
ENDIF

IF_ACTION_POINT(11,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,weaker,11,1)
ENDIF

IF_ACTION_POINT(5,PLAYER0)
	SET_TIMER(PLAYER0,TIMER0)
	QUICK_INFORMATION(6,"You reached a good spot to defend... but the Landlord is aware of your success and will try to stop you by sending Troops over time! Danger still lies ahead!",5)
ENDIF

IF_ACTION_POINT(1,PLAYER0)
	QUICK_INFORMATION(7,"You managed to defeat the Black Keeper and open this path... your Handsize increased now and another secret path hast revealed and lies ahead!",1)
	CHANGE_SLAB_TYPE(76,74,PATH,NONE)
	CHANGE_SLAB_TYPE(77,74,PATH,NONE)
	CHANGE_SLAB_TYPE(78,74,PATH,NONE)
	CHANGE_SLAB_TYPE(79,74,PATH,NONE)
	CHANGE_SLAB_TYPE(80,74,PATH,NONE)
	CHANGE_SLAB_TYPE(80,75,PATH,NONE)
	CHANGE_SLAB_TYPE(81,75,PATH,NONE)
	CHANGE_SLAB_TYPE(81,76,PATH,NONE)
	CHANGE_SLAB_TYPE(82,76,PATH,NONE)
	CHANGE_SLAB_TYPE(82,77,PATH,NONE)
	CHANGE_SLAB_TYPE(82,78,PATH,NONE)
	CHANGE_SLAB_TYPE(83,78,PATH,NONE)
	CHANGE_SLAB_TYPE(83,79,PATH,NONE)
	CHANGE_SLAB_TYPE(83,80,PATH,NONE)
	CHANGE_SLAB_TYPE(83,81,PATH,NONE)
	CHANGE_SLAB_TYPE(87,81,DIRT,NONE)
	SET_GAME_RULE(MaxThingsInHand,12)
ENDIF

if(PLAYER5,DUNGEON_DESTROYED == 1)
	QUICK_INFORMATION(8,"Great Work Sire, you managed to open a path into the midst of this realm and unlocked the Full Potential of your Creatures!",1)
	CHANGE_SLAB_TYPE(76,68,PATH,NONE)
	SET_CREATURE_MAX_LEVEL(PLAYER0,ANY_CREATURE,10)
ENDIF

if(PLAYER3,DUNGEON_DESTROYED == 1)
	ADD_TO_FLAG(PLAYER0,FLAG2,1)
	ADD_TO_FLAG(PLAYER0,FLAG4,1)
ENDIF

if(PLAYER6,DUNGEON_DESTROYED == 1)
	ADD_TO_FLAG(PLAYER0,FLAG2,1)
	ADD_TO_FLAG(PLAYER0,FLAG4,1)
ENDIF

if(PLAYER0,FLAG2 == 2)
	QUICK_INFORMATION(9,"You defeated another two of those Imbaciles.Now you managed to open another path in the middle.",1)
	CHANGE_SLAB_TYPE(75,74,PATH,NONE)
	CHANGE_SLAB_TYPE(74,74,PATH,NONE)
	CHANGE_SLAB_TYPE(73,74,PATH,NONE)
	CHANGE_SLAB_TYPE(72,74,PATH,NONE)
	CHANGE_SLAB_TYPE(72,75,PATH,NONE)
	CHANGE_SLAB_TYPE(71,75,PATH,NONE)
	CHANGE_SLAB_TYPE(71,76,PATH,NONE)
	CHANGE_SLAB_TYPE(70,76,PATH,NONE)
	CHANGE_SLAB_TYPE(70,77,PATH,NONE)
	CHANGE_SLAB_TYPE(69,77,PATH,NONE)
	CHANGE_SLAB_TYPE(69,78,PATH,NONE)
	CHANGE_SLAB_TYPE(69,79,PATH,NONE)
	CHANGE_SLAB_TYPE(69,80,PATH,NONE)
	CHANGE_SLAB_TYPE(69,81,PATH,NONE)
ENDIF


if(PLAYER2,DUNGEON_DESTROYED == 1)
	ADD_TO_FLAG(PLAYER0,FLAG3,1)
ENDIF

if(PLAYER4,DUNGEON_DESTROYED == 1)
	ADD_TO_FLAG(PLAYER0,FLAG3,1)
ENDIF

if(PLAYER0,FLAG3 == 2)
	QUICK_INFORMATION(10,"That was a great way to show even more power! Now you found the way to build Bridges and get yourself the rest of this Land.But beware since the Blue Keeper is allied to this filthy Good Keeper and pretty strong that way!",PLAYER0)
	ROOM_AVAILABLE(PLAYER0,BRIDGE,1,1)
ENDIF

if(PLAYER1,DUNGEON_DESTROYED == 1)
	MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,0,0)
	MAGIC_AVAILABLE(PLAYER0,POWER_SIGHT,0,0)
	QUICK_INFORMATION(11,"The last safety mechanism kicked in... they managed to subdue your power to destroy walls and Sight!. Find the Entrance to the Good Keepers Castle and Show him nothing can stop you!",PLAYER0)
ENDIF

IF_ACTION_POINT(8,PLAYER0)
	QUICK_INFORMATION(12,"You found the Castle entrance Congrats! But be Wary since this filthy Idiot may have set up some Traps...",PLAYER0)
ENDIF

IF_ACTION_POINT(9,PLAYER0)
	QUICK_INFORMATION(13,"Hmmmm... which way to go? Only one Way to find out...",PLAYER0)
ENDIF

IF_ACTION_POINT(14,PLAYER0)
	QUICK_INFORMATION(14,"Wow you found the power to Destroy Walls again! For what it may be good now?",14)
	MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,1)
ENDIF

IF_ACTION_POINT(13,PLAYER0)
	QUICK_INFORMATION(15,"Aaaaaaaaaaaaaand its gone again... your power... to destroy walls...",13)
	MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,0,0)
ENDIF

IF_ACTION_POINT(7,PLAYER0)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,defense,6,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,laststand,6,1)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,inbetween,5,2)
	ADD_PARTY_TO_LEVEL(PLAYER_GOOD,inbetween,4,1)
	MAGIC_AVAILABLE(PLAYER0,POWER_DESTROY_WALLS,1,1)
ENDIF


rem Imp limitation AI

IF_CONTROLS(PLAYER1,IMP < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER1,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER1,IMP >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER1,POWER_IMP,0,0)
ENDIF

IF_CONTROLS(PLAYER2,IMP < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER2,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER2,IMP >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER2,POWER_IMP,0,0)
ENDIF
IF_CONTROLS(PLAYER3,IMP < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER3,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER3,IMP >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER3,POWER_IMP,0,0)
ENDIF

IF_CONTROLS(PLAYER4,IMP < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER4,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER4,IMP >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER4,POWER_IMP,0,0)
ENDIF
IF_CONTROLS(PLAYER5,IMP < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER5,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER5,IMP >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER5,POWER_IMP,0,0)
ENDIF

IF_CONTROLS(PLAYER6,IMP < 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER6,POWER_IMP,1,1)
 ENDIF

IF_CONTROLS(PLAYER6,IMP >= 16)
  NEXT_COMMAND_REUSABLE
  MAGIC_AVAILABLE(PLAYER6,POWER_IMP,0,0)
ENDIF

rem max creature limit player

IF_CONTROLS(PLAYER0,TOTAL_CREATURES >= 50)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER1,IMPRISON,0)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER2,IMPRISON,0)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER3,IMPRISON,0)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER4,IMPRISON,0)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER5,IMPRISON,0)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER6,IMPRISON,0)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER_GOOD,IMPRISON,0)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(TortureConvertChance,0)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(PrisonSkeletonChance,0)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(BodiesForVampire,100)
	QUICK_INFORMATION(16,"Seems like something is blocking your way to get more Creatures then 50 under your control... did some old curse cause this?",PLAYER0)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(TortureDeathChance,0)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(TortureHealthLoss,0)
ENDIF

IF_CONTROLS(PLAYER0,TOTAL_CREATURES < 50)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER1,IMPRISON,1)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER2,IMPRISON,1)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER3,IMPRISON,1)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER4,IMPRISON,1)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER5,IMPRISON,1)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER6,IMPRISON,1)
	NEXT_COMMAND_REUSABLE
	SET_CREATURE_TENDENCIES(PLAYER_GOOD,IMPRISON,1)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(TortureConvertChance,100)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(PrisonSkeletonChance,15)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(BodiesForVampire,8)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(TortureDeathChance,10)
	NEXT_COMMAND_REUSABLE
	SET_GAME_RULE(TortureHealthLoss,5)
ENDIF





rem TImers

If(PLAYER0,FLAG4 == 0)
	if(PLAYER0,TIMER0 >= 10000)
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,middle,5,1)
		SET_TIMER(PLAYER0,TIMER1)
		SET_TIMER(PLAYER0,TIMER2)
	ENDIF

	if(PLAYER0,TIMER1 >= 8500)
		NEXT_COMMAND_REUSABLE
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,strong,5,1)
		NEXT_COMMAND_REUSABLE
		SET_TIMER(PLAYER0,TIMER1)
	ENDIF

	IF(PLAYER0,TIMER2 >= 13000)
		NEXT_COMMAND_REUSABLE
		ADD_PARTY_TO_LEVEL(PLAYER_GOOD,annoy,5,1)
		NEXT_COMMAND_REUSABLE
		SET_TIMER(PLAYER0,TIMER2)
	ENDIF
ENDIF

rem timer stop condition

IF(PLAYER0,FLAG4 >= 1)
	QUICK_INFORMATION(17,"You proved yourself once more and the Landlord is out of Troops to send... so take a breath before taking on the next Step!",LAST_EVENT)
ENDIF


rem winning condition

IF(PLAYER0,ALL_DUNGEONS_DESTROYED == 1)
	WIN_GAME
ENDIF
