REM Level 13/Madr's Castle 4

set_generate_speed(300)

max_creatures(player0,30)
max_creatures(player1,30)
max_creatures(player2,30)
max_creatures(player3,30)

start_money(player0,10000)
start_money(player1,8300000)
start_money(player2,8300000)
start_money(player3,8300000)

computer_player(player1,0)
computer_player(player2,0)
computer_player(player3,0)

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)
add_creature_to_pool(barbarian,20)
add_creature_to_pool(giant,20)
add_creature_to_pool(dwarfa,20)
add_creature_to_pool(archer,20)
add_creature_to_pool(monk,20)
add_creature_to_pool(wizard,20)
add_creature_to_pool(witch,20)
add_creature_to_pool(fairy,20)
add_creature_to_pool(thief,20)
add_creature_to_pool(samurai,20)

creature_available(player0,dragon,1,1)
creature_available(player0,druid,1,1)
creature_available(all_players,vampire,1,1)
creature_available(player0,troll,1,1)
creature_available(player0,tentacle,1,1)
creature_available(player0,bile_demon,1,1)
creature_available(all_players,hell_hound,1,1)
creature_available(all_players,dark_mistress,1,1)
creature_available(all_players,sorceror,1,1)
creature_available(player0,skeleton,1,1)
creature_available(all_players,orc,1,1)
creature_available(all_players,barbarian,1,1)
creature_available(all_players,giant,1,1)
creature_available(all_players,dwarfa,1,1)
creature_available(all_players,archer,1,1)
creature_available(all_players,monk,1,1)
creature_available(all_players,wizard,1,1)
creature_available(all_players,witch,1,1)
creature_available(all_players,fairy,1,1)
creature_available(all_players,thief,1,1)
creature_available(all_players,samurai,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)

magic_available(player0,power_imp,1,1)
magic_available(player0,power_sight,1,1)
magic_available(player0,power_obey,1,1)
magic_available(all_players,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(all_players,power_chicken,1,1)
magic_available(all_players,power_lightning,1,1)
magic_available(all_players,power_disease,1,1)
magic_available(player0,power_destroy_walls,1,1)

trap_available(player0,word_of_power,1,0)
trap_available(player0,lightning,1,0)
trap_available(player0,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,"It seems that the gates to Madr were not guarded by the most devoted warriors. Two of its guardians tried to escape in the confusion, but they failed. In addition, they also quarreled among themselves. Get rid of them while they are weak. After this, only Madr will remain!",player0)
 creature_available(player0,barbarian,0,0)
 creature_available(player0,giant,0,0)
 creature_available(player0,dwarfa,0,0)
 creature_available(player0,archer,0,0)
 creature_available(player0,monk,0,0)
 creature_available(player0,wizard,0,0)
 creature_available(player0,witch,0,0)
 creature_available(player0,fairy,0,0)
 creature_available(player0,thief,0,0)
 creature_available(player0,samurai,0,0)
magic_available(player3,power_chicken,0,0)
magic_available(player3,power_lightning,0,0)
magic_available(player3,power_disease,0,0)
endif

create_party(oda)
 add_to_party(oda,archer,5,4800,attack_enemies,1)
 add_to_party(oda,archer,5,4800,attack_enemies,1)
 add_to_party(oda,archer,5,4800,attack_enemies,1)
 add_to_party(oda,archer,5,4800,attack_enemies,1)
 add_to_party(oda,archer,5,4800,attack_enemies,1)

create_party(dva)
 add_to_party(dva,dragon,4,0,attack_enemies,1)
 add_to_party(dva,dragon,4,0,attack_enemies,1)
 add_to_party(dva,demonspawn,7,0,attack_enemies,1)
 add_to_party(dva,demonspawn,7,0,attack_enemies,1)
 add_to_party(dva,demonspawn,7,0,attack_enemies,1)
 add_to_party(dva,demonspawn,7,0,attack_enemies,1)

create_party(kor)
 add_to_party(kor,avatar,8,1,attack_enemies,0)
 add_to_party(kor,knight,9,10000,attack_enemies,0)
 add_to_party(kor,knight,9,10000,attack_enemies,0)
 add_to_party(kor,knight,9,10000,attack_enemies,0)
 add_to_party(kor,knight,9,10000,attack_enemies,0)
 
create_party(kors)
 add_to_party(kors,barbarian,8,6000,attack_enemies,1)
 add_to_party(kors,barbarian,8,6000,attack_enemies,1)
 add_to_party(kors,barbarian,8,6000,attack_enemies,1)
 add_to_party(kors,barbarian,8,6000,attack_enemies,1)
 add_to_party(kors,barbarian,8,6000,attack_enemies,1)
 add_to_party(kors,barbarian,8,6000,attack_enemies,1)
 
if(player1,dungeon_destroyed == 1)
 if(player2,dungeon_destroyed == 1)
  if(player3,dungeon_destroyed == 1)
   if(player_good,total_creatures == 0)
    win_game
   endif
  endif
 endif
endif

if_action_point(4,player0)
add_creature_to_level(player0,horny,5,3,7,0)
endif

if(player3,dungeon_destroyed == 1)
add_party_to_level(player_good,oda,2,1)
add_party_to_level(player_good,dva,3,1)
endif

if(player1,dungeon_destroyed == 1)
 if(player2,dungeon_destroyed == 1)
  if(player3,dungeon_destroyed == 1)
  quick_objective(2,"Madr's scout , a coward, does not want to come out of hiding for a fair (no) fight. The scout shouldn't return.",player0)
add_party_to_level(player_good,kor,1,1)
add_party_to_level(player_good,kors,1,1)
add_party_to_level(player_good,kors,1,1)
  endif
 endif
endif

if(player0,dungeon_destroyed == 1)
 lose_game
endif