REM Level 11/Madr's Castle 2

set_generate_speed(200)

max_creatures(player0,30)
max_creatures(player1,1)

start_money(player0,22000)
start_money(player1,1)

computer_player(player1,10)

ally_players(player1,player_good)

add_creature_to_pool(vampire,8)
add_creature_to_pool(troll,8)
add_creature_to_pool(tentacle,8)
add_creature_to_pool(bile_demon,8)
add_creature_to_pool(hell_hound,8)
add_creature_to_pool(dark_mistress,8)
add_creature_to_pool(sorceror,8)
add_creature_to_pool(skeleton,8)
add_creature_to_pool(orc,8)
add_creature_to_pool(dragon,8)
add_creature_to_pool(druid,8)

creature_available(player0,dragon,1,1)
creature_available(player0,vampire,1,1)
creature_available(player0,troll,1,1)
creature_available(player0,tentacle,1,1)
creature_available(player0,bile_demon,1,1)
creature_available(player0,hell_hound,1,1)
creature_available(player0,dark_mistress,1,1)
creature_available(player0,sorceror,1,1)
creature_available(player0,skeleton,1,1)
creature_available(player0,orc,1,1)
creature_available(player0,druid,1,1)

room_available(player0,treasure,1,1)
room_available(player0,lair,1,1)
room_available(player0,garden,1,1)
room_available(player0,training,1,1)
room_available(player0,research,1,1)
room_available(player0,bridge,1,1)
room_available(player0,graveyard,1,1)
room_available(player0,workshop,1,1)
room_available(player0,prison,1,1)
room_available(player0,barracks,1,1)
room_available(player0,torture,1,1)
room_available(player0,temple,1,1)
room_available(player0,guard_post,1,1)
room_available(player0,scavenger,1,1)

magic_available(player0,power_imp,1,1)
magic_available(player0,power_sight,1,1)
magic_available(player0,power_obey,1,1)
magic_available(player0,power_speed,1,1)
magic_available(player0,power_call_to_arms,1,1)
magic_available(player0,power_cave_in,1,1)
magic_available(player0,power_heal_creature,1,1)
magic_available(player0,power_protect,1,1)
magic_available(player0,power_conceal,1,1)
magic_available(player0,power_hold_audience,1,1)
magic_available(player0,power_chicken,1,1)
magic_available(player0,power_lightning,1,1)
magic_available(player0,power_disease,1,1)

trap_available(all_players,word_of_power,1,0)
trap_available(all_players,lightning,1,0)
trap_available(all_players,boulder,1,0)
door_available(all_players,steel,1,0)
door_available(all_players,magic,1,0)

if(player0,game_turn >= 10)
 quick_objective(1,"Some of your troops remained to defend the northern approach to the castle. Attacking units of the Madr's army from the east will arrive here soon. Prepare to meet his servants.",player0)
endif

create_party(oda)
 add_to_party(oda,sorceror,3,400,attack_enemies,0)
 add_to_party(oda,dragon,2,400,attack_enemies,0)
 add_to_party(oda,dragon,2,400,attack_enemies,0)
 add_to_party(oda,thief,3,400,attack_enemies,0)
 add_to_party(oda,thief,3,400,attack_enemies,0)

create_party(dva)
 add_to_party(dva,giant,4,400,attack_enemies,0)
 add_to_party(dva,archer,2,400,attack_enemies,0)
 add_to_party(dva,barbarian,3,400,attack_enemies,0)
 add_to_party(dva,barbarian,3,400,attack_enemies,0)
 add_to_party(dva,archer,2,400,attack_enemies,0)

create_party(tri)
 add_to_party(tri,witch,5,400,attack_enemies,0)
 add_to_party(tri,witch,5,400,attack_enemies,0)
 add_to_party(tri,ghost,4,400,attack_enemies,0)
 add_to_party(tri,ghost,4,400,attack_enemies,0)
 add_to_party(tri,ghost,4,400,attack_enemies,0)
 
create_party(che)
 add_to_party(che,knight,5,400,attack_enemies,0)
 add_to_party(che,knight,5,400,attack_enemies,0)
 add_to_party(che,dwarfa,6,400,attack_enemies,0)
 add_to_party(che,dwarfa,6,400,attack_enemies,0)

create_party(fio)
 add_to_party(fio,horny,5,400,attack_enemies,0)
 add_to_party(fio,horny,5,400,attack_enemies,0)
 add_to_party(fio,horny,5,400,attack_enemies,0)
 add_to_party(fio,avatar,5,400,attack_enemies,0)
 add_to_party(fio,avatar,5,400,attack_enemies,0)
 add_to_party(fio,avatar,5,400,attack_enemies,0)

create_party(fid)
 add_to_party(fid,wizard,6,400,attack_enemies,0)
 add_to_party(fid,wizard,6,400,attack_enemies,0)
 add_to_party(fid,wizard,6,400,attack_enemies,0)
 add_to_party(fid,wizard,6,400,attack_enemies,0)
 add_to_party(fid,wizard,6,400,attack_enemies,0)
 add_to_party(fid,wizard,6,400,attack_enemies,0)

if(player1,dungeon_destroyed == 1)
  if(player0,game_turn >= 41000)
   if(player_good,total_creatures == 0)
    win_game
   endif
  endif
endif
 
if(player0,game_turn >= 10000)
quick_objective(2,"And here are the advanced detachments.",player0)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
endif

if(player0,game_turn >= 13000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
endif

if(player0,game_turn >= 15000)
add_tunneller_party_to_level(player_good,dva,-2,dungeon,player0,4,400)
endif

if(player0,game_turn >= 16000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
add_tunneller_party_to_level(player_good,tri,-1,dungeon,player0,7,400)
endif

if(player0,game_turn >= 19000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
endif

if(player0,game_turn >= 20000)
add_tunneller_party_to_level(player_good,dva,-2,dungeon,player0,4,400)
add_tunneller_party_to_level(player_good,che,-2,dungeon,player0,8,400)
endif
 
if(player0,game_turn >= 22000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
add_tunneller_party_to_level(player_good,tri,-1,dungeon,player0,7,400)
endif

if(player0,game_turn >= 25000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
add_tunneller_party_to_level(player_good,dva,-2,dungeon,player0,4,400)
endif

if(player0,game_turn >= 28000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
add_tunneller_party_to_level(player_good,tri,-1,dungeon,player0,7,400)
endif

if(player0,game_turn >= 30000)
add_tunneller_party_to_level(player_good,dva,-2,dungeon,player0,4,400)
add_tunneller_party_to_level(player_good,che,-2,dungeon,player0,8,400)
endif

if(player0,game_turn >= 31000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
endif

if(player0,game_turn >= 34000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
add_tunneller_party_to_level(player_good,tri,-1,dungeon,player0,7,400)
endif

if(player0,game_turn >= 35000)
add_tunneller_party_to_level(player_good,dva,-2,dungeon,player0,4,400)
endif

if(player0,game_turn >= 37000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
endif

if(player0,game_turn >= 40000)
add_tunneller_party_to_level(player_good,oda,-1,dungeon,player0,3,400)
add_tunneller_party_to_level(player_good,dva,-2,dungeon,player0,4,400)
add_tunneller_party_to_level(player_good,tri,-1,dungeon,player0,7,400)
add_tunneller_party_to_level(player_good,che,-2,dungeon,player0,8,400)
quick_objective(3,"Here is the commanders squad. Destroy everyone.",player0)
add_party_to_level(player_good,fio,1,1)
add_party_to_level(player_good,fid,1,1)
add_party_to_level(player_good,fid,1,1)
endif

if(player1,dungeon_destroyed == 1)
 magic_available(player0,power_destroy_walls,1,1)
endif

if(player0,dungeon_destroyed == 1)
 lose_game
endif