1{ 2id: "civ_board", 3hitpoints: 2, 4zorder: -11, 5no_compile_image: "experimental/civ-tile.png", 6properties: { 7 tile_side_name: "def(name) switch(name.animation, 'normal', ~White~, 'gold', ~Gold~, 'black', ~Black~, 'silver', ~Silver~, ~Mysterious Stranger~)", 8 tile_name: "def(tile) switch(tile.type, 'civ-tile_mine', ~mine~, 'civ-tile_farm', ~farm~, 'civ-tile_settle', ~settlement~, 'civ-tile_war', ~warrior camp~, ~claim~)", 9 10 #returns the pixel size of the board 11 # 12 board_size: "def() consts.tile_size*consts.tiles", 13 14 #returns the pixels of the board coordinate passed in. 15 # 16 tile_at: "def (coord) [x+consts.tile_size+x_in*consts.tile_size*2,y+consts.tile_size+y_in*consts.tile_size*2] where x_in = coord[0] where y_in = coord[1]", 17 18 #returns the tile number at level coord if available 19 # 20 on_tile: "def(coords) 21 if(not loc in map(vars.play, 'vp', vp.vars.gridloc), loc) where loc = on_any_tile(coords)", 22 23 #returns tile number at level coord 24 on_any_tile: "def(coords) 25 if(mx > x and mx < x+board_size()*2 and my > y and my < y+board_size()*2, 26 [tx, ty]) 27 where tx = (mx-x)/(consts.tile_size*2) 28 where ty = (my-y)/(consts.tile_size*2) 29 where mx = coords[0] where my = coords[1]", 30 31 #returns the played tile at the level coord 32 on_piece: "def(coords) find(vars.play, 'vp', vp.vars.gridloc = on_any_tile(coords))", 33 34 #Returns the tile the mouse is on. 35 # 36 mouse_on_tile: "def() on_any_tile(level.player.vars.mouse.pos)", 37 38 #Takes player (0) and a spot in the hand to deal to. 39 # 40 dealt_hand_loc: "def(player, spot) if(player = 0, 41 [x - consts.tile_size + margin + step * spot, y + board_size()*2 + space_beneath] 42 where step = ((board_size() - margin) * 2) / (vars.hand_size - 1) 43 where margin = 125 44 where space_beneath = 20 45 )", 46 47 #Takes x,y board coordinate, returns terrain name there. 48 # 49 get_terrain: "def(coords) switch(vars.land[coords[0] + coords[1]*consts.tiles], 0, 'ocean_grid', 1, 'plains_grid', 2, 'hill_grid', 3, 'ore_grid', 'ocean_grid')", 50 51 #Can coords tile have food for obj? 52 # 53 has_food: "def(obj, coords) 54 has_food_with(obj, coords, [-1,-1])", 55 56 #list of vectors for adjacent tiles 57 # 58 adjacents: "[[-1,0],[0,-1],[1,0],[0,1]]", 59 60 #returns objects in play adjacent to coords 61 # 62 adjacent_objs: "def(coords) filter(map(adjacents, 'adjv', find(vars.play, 'tile', tile.vars.gridloc = [coords[0]+adjv[0], coords[1]+adjv[1]])), 'list', list != null)", 63 64 #same as has_food, but without taking to account tile at less. 65 # 66 has_food_with: "def(obj, coords, less) 67 if(1 in map(adjacents, 'offset', 68 if(get_terrain([coords[0]+offset[0],coords[1]+offset[1]]) = 'plains_grid' 69 and find(vars.play, 't', t.midpoint_x = tile_at([coords[0]+offset[0], coords[1]+offset[1]])[0] 70 and t.midpoint_y = tile_at([coords[0]+offset[0], coords[1]+offset[1]])[1]) = null, 71 if([coords[0]+offset[0],coords[1]+offset[1]] = less, 0, 1), 72 0) 73 ) 74 or (get_terrain([coords[0], coords[1]]) = 'plains_grid' and cache[consts.tile_types_side[obj.animation]] = 1), 75 1, 76 0) 77 or obj.search_adjacent_connected_to_farm(tile_at(coords)[0], tile_at(coords)[1], obj.animation) 78 # or 'civ-tile_farm' in map(k_group(tile_at(coords), obj.animation), 'k_tile', k_tile.type) 79 #", 80 81 #Well, bother. This bit doesn't work here - a corner case(specifically, the lower right one) is broken. 82 #returns a list of the tiles which will starve if coord is filled with obj. needs work. adjs is the tiles adjacent to coords. 83 # 84 starve: "def(obj, coords) filter(adjacent_objs(coords), 'adjs', not has_food_with(obj, adjs.vars.gridloc, coords))", 85 86 #Is coords tile a valid spot to add obj? 87 # 88 is_valid_addition: "def(obj, coords) 89 switch(obj.type, 90 'civ-tile_farm', if(get_terrain(coords) = 'plains_grid' and (not played(coords)) 91 and (not went_to_war), 92 1, 0), 93 'civ-tile_mine', if(get_terrain(coords) in ['hill_grid', 'ore_grid'] 94 and (not went_to_war) 95 and has_food(obj, coords) and (not played(coords)) 96 and ((not find(starve(obj, coords), 'dead', dead.animation = obj.animation)) 97 or obj.search_adjacent_connected_to_farm(tile_at(coords)[0], tile_at(coords)[1], obj.animation)), 98 1, 0), 99 'civ-tile_settle', if(get_terrain(coords) and (not get_terrain(coords) in ['ocean_grid', 'ore_grid']) 100 and (not went_to_war) 101 and has_food(obj, coords) 102 and (not played(coords)) 103 and ((not find(starve(obj, coords), 'dead', dead.animation = obj.animation)) 104 or obj.search_adjacent_connected_to_farm(tile_at(coords)[0], tile_at(coords)[1], obj.animation)), 105 1, 0), 106 'civ-tile_war', if(get_terrain(coords) and (not get_terrain(coords) in ['ocean_grid', 'ore_grid']) and has_food(obj, coords) 107 and ((not went_to_war) or played(coords)) 108 and (not find(vars.play, 'tile', tile.gridloc = coords and tile.animation = context.consts.tile_types[turn])) 109 and ((not find(starve(obj, coords), 'dead', dead.animation = obj.animation)) 110 or obj.search_adjacent_connected_to_farm(tile_at(coords)[0], tile_at(coords)[1], obj.animation)), 111 1, 0), 112 0)", 113 114 #Returns the tile which was played at coords. 115 # 116 played: "def(coords) find(vars.play, 'tile', tile.gridloc = coords)", 117 118 #Darkens invalid positions for obj to be placed at. 119 # 120 draw_blackout: "def(tile) map(range(consts.tiles), 'cX', map(range(consts.tiles), 'cY', 121 if(not is_valid_addition(tile,[cX, cY]) and 'human' = vars.players[vars.turn], 122 if(not my_valid_bldg_at(tile_at(list_subtract([cX,cY],[0,0])), tile, my_bldg_spots) or 123 my_valid_bldg_at(tile_at(list_subtract([cX,cY],[1,0])), tile, my_bldg_spots) or 124 my_valid_bldg_at(tile_at(list_subtract([cX,cY],[0,1])), tile, my_bldg_spots) or 125 my_valid_bldg_at(tile_at(list_subtract([cX,cY],[1,1])), tile, my_bldg_spots), 126 spawn('civ_board.no', tile_at([cX,cY])[0], tile_at([cX, cY])[1], facing), 127 if(my_valid_bldg_at(tile_at(list_subtract([cX,cY],[0,0])), tile, my_bldg_spots), 128 [add_object(blackout), 129 set(blackout.animation, 'big'), 130 ] where blackout = object('civ_board.no', tile_at([cX,cY])[0], tile_at([cX, cY])[1], facing) 131 ) 132 ) 133 ) 134 ))", 135 136 #Removes all blacked out tiles. 137 # 138 clear_blackout: "map(level.chars, 'obj', if(obj.type = 'civ_board.no', fire_event(obj, 'nix')))", 139 mouse: "level.player.vars.mouse.pos", 140 war_defeat_tile: "def(tile) schedule(2, [ 141 set(vars.play, filter(vars.play, 'vp', vp != tile)), 142 fire_event(tile, 'nix'), 143 [add_object(war_obj), 144 set(war_obj.midpoint_x, tile.midpoint_x), 145 set(war_obj.midpoint_y, tile.midpoint_y) 146 ] where war_obj = object('civ_war', x, y, facing), 147 ])", 148 149 #Uncached kingdom group functions. k_group returns the /side/ kingdom near /level coords/. 150 k_group: "def(coords, side) _k_grow(on_any_tile(coords), filter(vars.play, 'vp', vp.animation=side), [])", 151 _k_grow: "def(gridLocation, potential_tiles, approved_tiles) 152 if(touching, 153 _k_grow(touching[0].gridloc, filter(new_potential, 'np', not np in grew), new_approved + grew) 154 where grew = _k_grow(gridLocation, filter(new_potential, 'np', np != touching[0]), []), 155 new_approved 156 )where new_potential = filter(potential_tiles, 'pt', pt.gridloc != gridLocation) 157 where new_approved = approved_tiles + filter(potential_tiles, 'pt', pt.gridloc = gridLocation) 158 where touching = _k_touching(gridLocation, potential_tiles)", 159 _k_touching: "def(coords, potential_tiles) 160 filter( 161 map(adjacents, 'adjv', 162 find(potential_tiles, 'tile', 163 tile.vars.gridloc = [coords[0]+adjv[0], coords[1]+adjv[1]])), 164 'list', list != null)", 165 166 #returns true if coords is adjacent to a 167 is_adjacent_to_side: "def(coord, side) 168 1 in map(adjacents, 'adj', 169 if( 170 filter(vars.play, 'vp', 171 vp.gridloc = list_add(coord, adj) 172 and context.consts.tile_types_side[vp.animation] = side 173 ), 174 1,0 175 ) 176 )", 177 178 #set the help text to string 179 # 180 help: "def(string) vars.help_obj.set_text(string)", 181 182 #Add a tile at board coordinates to the game data. Doesn't create tile. 183 # 184 add_tile: "def(tile, coords) [ 185 set(tile.vars.gridloc, coords), 186 set(tile.midpoint_x, tile_at(coords)[0]), 187 set(tile.midpoint_y, tile_at(coords)[1]), 188 set(vars.play, vars.play + [tile]),]", 189 190 #Like above, but creates the tile too. 191 # 192 place_tile: "def(tile, coords, team) [ 193 add_object(tile), 194 set(tile.animation, consts.tile_types[team]), 195 add_tile(tile, coords) 196 ]", 197 198 #input is a list of place tile signatures, eg, [[tileA,[1,1],0], [tileB,[1,2],1]] 199 # 200 place_tiles: "def(inputs) [ 201 map(inputs, 'input', place_tile(input[0], input[1], input[2])), 202 set(vars.play, vars.play + map(inputs, 'input', input[0])), 203 ]", 204 205 #the list of current player's potential buildings 206 my_bldg_spots: "bldg_spots[turn]", 207 208 #returns the quad (a list of four buildings) which could support the current tile as an addition. 209 my_valid_bldg: "def(tile, list_of_quads) 210 my_valid_bldg_at([tile.midpoint_x, tile.midpoint_y], tile, list_of_quads)", 211 my_valid_bldg_at: "def(coords, tile, list_of_quads) 212 find(list_of_quads, 'quad', 213 quad[0].gridloc = on_any_tile([coords[0]-consts.tile_size, coords[1]-consts.tile_size]) 214 and bldg_codes[tile.type] 215 and 1 in map(range(size(bldg_codes[tile.type])), 'index', 216 pair_off( 217 map(quad, 'l2', l2.type), 218 map(bldg_codes[tile.type][index][0], 'l1', l1.type) 219 ) 220 ) 221 )", 222 223 #matches pairs elements in the two lists passed in and returns true if it can pair off all elements in at least one list.. It accepts the string 'wild' as a wildcard, but will not attempt to optimise this card's use in any way. To make the wildcard the last resort, put it at the end of the list. Wild cards only accepted in second list. 224 # 225 pair_off: "def(list1, list2) #current bug: pair_off([1,1,'wild','wild'], [5,4,5,1]) matches and shouldn't. Vica-versa is fine.# 226 if(size(list1)=0 and size(list2)=0, 227 1, 228 if((not (size(list1)=0 or size(list2)=0)) and pair, 229 #I think the below filter is off.# 230 pair_off(list1[1:size(list1)#add +1 here to break#], list2[0:index_to_nix] + list2[index_to_nix+1:size(list2)] where index_to_nix = find(map(range(size(list2)), 'index', if(list2[index] = list1[0] or list2[index] = 'wild' or list1[0] = 'wild', index, -1)), 'num', num >= 0)), 231 0 232 ) where pair = list1[0] in list2 or 'wild' in (list2 + list1) 233 )", 234 235 #'draw' is a tile object, such as civ-tile_settle, to be evaluated for placement on the board. Map returns a 2D list of boolean values for placement, while the list version returns a 1D list of point coordinates for placement. 236 # 237 tile_placement_map: "def(draw) map(range(consts.tiles), 'tY', map(range(consts.tiles), 'tX', is_valid_addition(draw, [tX,tY])))", 238 tile_placement_list: "def(draw) filter(flatten(map(range(consts.tiles),'pY', map(range(consts.tiles),'pX', 239 if(tpm[pY][pX], #This gets the x,y locations of all the 'true' occurences in putMap.# 240 [pX,pY])))), #While this could be done in one function, exposing the map allows for much easier debugging.# 241 'coords', coords) 242 where tpm = tile_placement_map(draw)", 243}, 244vars: { 245 players: ["human","ai_die","simple_ai"], 246 247 #types are: 'human', 'ai_die', 'simple_ai', 'bunker' 248 land: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,3,0,1,1,0,0,0,0,0,0,0,0,0,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,2,2,0,0,0,0,0,1,1,0,0,0,0,0,0,2,0,0,0,0,0,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,1,1,1,1,2,2,2,1,1,0,0,0,0,0,1,1,1,2,3,2,2,1,1,1,0,0,0,0,0,1,2,2,2,2,2,0,0,0,0,0,0,1,1,1,1,2,2,3,2,2,0,0,0,0,0,0,1,1,0,0,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], 249 250 #land: See is_valid_addition for types. 251 # 252 next_level: "undefined.cfg", 253 254 # 255 ore_to_win: 1, 256 257 # 258 ai_targets: [[],[],[],[]], 259 260 # contains a list of each side's target board coordinates 261 round: 0, 262 263 # number of rounds played (One round counts as all players having played.) 264 hand: [], 265 266 # tiles in hand 267 play: [], 268 269 # tiles in play 270 cache_version: 0, 271 272 # version of the cache that tiles have 273 turn: 0, 274 275 # current side's turn 276 hand_size: 6, 277 278 # number of tiles in hand 279 camera_pos: [0,0,0,0], 280 281 # initial location of the camera in the level 282 help_text_pos: [50,575], 283 284 # the location of the help text controller 285 recruited: [], 286 287 # warriors which have been selected to go to battle, but have not done so yet? 288 camped: [], 289 290 # encamped warriors, to be unencamped next turn 291 not_refilled_when_played: [], 292 293 # list of tiles in hand which can be refilled 294 max_tiles_to_replace: 6, 295 296 # 297 bldg_spots: [[],[],[],[]], 298 299 # a list of tile quads available for bulding superstructures on 300 bldg_codes: { 301"civ-tile_settle": [ 302 [ 303 [ 304 "civ-tile_farm", 305 "civ-tile_farm", 306 "civ-tile_farm", 307 "civ-tile_farm" 308 ], 309 "cache" 310 ], 311 [ 312 [ 313 "civ-tile_farm", 314 "civ-tile_farm", 315 "civ-tile_settle", 316 "civ-tile_settle" 317 ], 318 "farm_house" 319 ], 320 [ 321 [ 322 "civ-tile_farm", 323 "civ-tile_farm", 324 "civ-tile_mine", 325 "civ-tile_mine" 326 ], 327 "pottery" 328 ], 329 [ 330 [ 331 "civ-tile_farm", 332 "civ-tile_farm", 333 "civ-tile_war", 334 "civ-tile_war" 335 ], 336 "milita" 337 ], 338 [ 339 [ 340 "civ-tile_settle", 341 "civ-tile_settle", 342 "civ-tile_settle", 343 "civ-tile_settle" 344 ], 345 "great_hall" 346 ], 347 [ 348 [ 349 "civ-tile_settle", 350 "civ-tile_settle", 351 "civ-tile_mine", 352 "civ-tile_mine" 353 ], 354 "quarry" 355 ], 356 [ 357 [ 358 "civ-tile_settle", 359 "civ-tile_settle", 360 "civ-tile_war", 361 "civ-tile_war" 362 ], 363 "embassy" 364 ], 365 [ 366 [ 367 "civ-tile_mine", 368 "civ-tile_mine", 369 "civ-tile_mine", 370 "civ-tile_mine" 371 ], 372 "furnace" 373 ], 374 [ 375 [ 376 "civ-tile_mine", 377 "civ-tile_mine", 378 "civ-tile_war", 379 "civ-tile_war" 380 ], 381 "shop" 382 ], 383 [ 384 [ 385 "civ-tile_war", 386 "civ-tile_war", 387 "civ-tile_war", 388 "civ-tile_war" 389 ], 390 "barracks" 391 ] 392 ] 393}, 394 cache: [0,0,0,0], 395 396 # the status of the bonus buildings, for each team 397 farm_house: [0,0,0,0], 398 pottery: [0,0,0,0], 399 militia: [0,0,0,0], 400 great_hall: [0,0,0,0], 401 quarry: [0,0,0,0], 402 quarry_bldg: [0,0,0,0], 403 embassy: [0,0,0,0], 404 furnace: [0,0,0,0], 405 barracks: [0,0,0,0], 406 ai_counter: 0, 407}, 408consts: { 409 tiles: 14, 410 411 # number of tiles on board 412 # 413 tile_size: 16, 414 415 # size of tile image 416 # 417 tile_types: ["normal","gold","black","silver"], 418 tile_types_side: { 419"black": 2, 420"gold": 1, 421"normal": 0, 422"silver": 3 423}, 424}, 425on_create: "[ 426 set(draw_area, [0, 0, board_size(), board_size()]), 427 set(vars.camera_pos, level.camera_position), 428 [set(new_bag.vars.spawner, self), 429 add_object(new_bag), 430 set(vars.bag, new_bag), 431 ]where new_bag = object('civ-tile_bag', x + board_size()*2 + right_column_offset, y+((board_size()*5)/3), facing), 432 433 if(size(vars.land) = consts.tiles*consts.tiles, 434 map(range(size(vars.land)), 'land_index', spawn(self.type + '.' + ltype, lcoord[0], lcoord[1], facing) where lcoord = tile_at([land_index%consts.tiles, land_index/consts.tiles]) where ltype = switch(vars.land[land_index], 0, 'ocean_grid', 1, 'plain_grid', 2, 'hill_grid', 3, 'ore_grid', 'ocean_grid')), 435 debug(size(vars.land), ' does not equal ', consts.tiles*consts.tiles, ', failed creating map tiles from land data.')), 436 437 spawn('civ_logo', x + board_size()*2 + right_column_offset, y+((board_size()*2)/4), facing), 438 439 if(vars.players[0] != 'human' ,[set(vars.turn, -1), schedule(2, fire_event('end_turn'))]), 440 441 schedule(3, fire_event('find_buttons')), 442 443 [set(vars.help_obj, hobj), 444 hobj.set_text('Drag a tile to the board to play. Right-click for help.'), 445 add_object(hobj), 446 ] where hobj = object('text_controller',help_text_pos[0],help_text_pos[1],0), 447 448 schedule(2, [ 449 fire_event('recalculate_end_turn_button_state'), 450 fire_event('tiles_in_play_modified'), 451 ]), 452 453 [set(vars.turn_indicator, blankTile), 454 add_object(blankTile), 455 spawn('text_controller', blankTile.midpoint_x+41, blankTile.midpoint_y+8, 0, [set(txt, ~'s Turn~)]), 456 ] where blankTile = object('civ-tile_blank', x + board_size()*2 + right_column_offset - 40, y+(board_size()), facing), 457 458 set(level.player.vars.board, self), 459 ] where right_column_offset = 125 460 where camera = get_object(level, 'logic')", 461on_find_buttons: "[set(vars.turn_button, bag.turn_button), set(vars.fight_button, get_object(level, 'fight')), set(get_object(level, 'fight').board, self)]", 462on_replace: "if(size(not_refilled_when_played) < max_tiles_to_replace, [ 463 set(vars.replace, 1), 464 help(~Select up to {str(num_to_replace)} {if(num_to_replace = 1, 'tile', 'tiles')} to replace, then press the end turn button.~) where num_to_replace = max_tiles_to_replace - size(not_refilled_when_played), 465 set(vars.trigger_replace, 1), 466 ],[ 467 map(range(max_tiles_to_replace-1), 'tilenum', 468 schedule(tilenum*5, [ 469 set(vars.bag.vars.on_deal_tile, not_refilled_when_played[tilenum].vars.hand_pos), 470 fire_event(vars.bag, 'deal_p1')])), 471 add(bag.turn_button.x, 300), 472 schedule(max_tiles_to_replace*5+5, [fire_event('end_turn'), add(bag.turn_button.x, -300)]), 473 set(not_refilled_when_played, not_refilled_when_played[max_tiles_to_replace: size(not_refilled_when_played)]), 474 help(~Drew additional {str(max_tiles_to_replace)} tile{if(max_tiles_to_replace != 1, 's', '')} to hand to replace warriors.~), 475 ] 476 )", 477on_deal_replace: "[ 478 set(vars.freeze, 1), 479 help(~Replaced {size(toReplace)} tile{if(size(toReplace) != 1, 's', '')}{if(size(not_refilled_when_played) = 0, '.', ', and replaced warriors.')}~), 480 set(vars.hand, filter(vars.hand, 'vh', not vh in allReplace)), 481 map(range(size(allReplace)), 'ind', schedule(2+size(allReplace)*5+35+ind*4, [ 482 set(vars.bag.vars.on_deal_tile, allReplace[ind].vars.hand_pos), 483 fire_event(vars.bag, 'deal_p1'), 484 ])), 485 486 map(allReplace, 'ar', [set(ar.red, 256), set(ar.blue, 256)]), 487 488 if(not shop, 489 schedule(2+size(allReplace)*5+35+size(allReplace)*4+20, [ 490 fire_event('end_turn'), 491 add(bag.turn_button.x, -300), 492 ]), 493 [set(shop, 0), 494 add(bag.turn_button.x, -300), 495 set(vars.replace, 0), 496 set(max_tiles_to_replace, 6), 497 fire_event('recalculate_end_turn_button_state'), 498 ]), 499 500 set(not_refilled_when_played, []), 501 set(toReplace, []), 502 set(vars.bag.vars.piles, list_replace_elements(vars.bag.vars.piles, turn, [vars.bag.vars.piles[turn] + toReplace])), 503 504 map(range(size(toReplace)), 'torp', schedule((torp+2)*2, [ 505 schedule(frames, remove_object(toReplace[torp])), 506 toReplace[torp].go_to_over([replaceTo.x,replaceTo.y], frames), 507 ] where frames = 25)), 508 ] where allReplace = not_refilled_when_played + vars.toReplace 509 where replaceTo = bag.spawn_point", 510on_refresh_warrior_selected_text: "get_object(level, 'strength').set_text(~Armies:~ + '\n' + str(strengths[0]+defending_barracks_bonus) + ~(+?) VS ~ + str(strengths[1]+attacking_barracks_bonus) + ~(+~ + str(size(recruited)) + ~)~)", 511on_rmb_down: "[help(~Try the board or the tiles. Sorry. :(~), 512 #debug(mouse_on_tile()),# 513 if(mouse_on_tile(), 514 help( 515 switch(get_terrain(mouse_on_tile()), 516 'ocean_grid', ~This is an ocean space. Nothing can be built here.~, 517 'plains_grid', ~This rich plain is capable of supporting a farm or a nearby tile.~, 518 'hill_grid', ~The mountains are barren, windswept, and not much use.~, 519 'ore_grid', ~Valuable minerals! Build a mine here to control this resource.~) 520 ) 521 ), 522 map(vars.hand + vars.play, 'tile', if(help_txt, help(help_txt)) where help_txt = tile.help(level.player.vars.mouse)), 523 ]", 524on_lmb_down: "if('human' = vars.players[vars.turn] and (not freeze), [ 525 fire_event(vars.turn_button, 'lmb_hold', level.player.vars.mouse), 526 fire_event(vars.fight_button, 'lmb_hold', level.player.vars.mouse), 527 if(not war, [ 528 if(not replace, [ 529 map(vars.hand, 'tile', fire_event(tile, 'lmb_down', level.player.vars.mouse)), 530 ], 531 map(vars.hand, 'tile', fire_event(tile, 'replace_select', level.player.vars.mouse)), 532 )], 533 map(vars.hand, 'tile', fire_event(tile, 'war_select', level.player.vars.mouse)), 534 )])", 535on_lmb_hold: "if(not war or replace, [ 536 #debug('tile:', mouse_on_tile())# 537 if(ot, 538 [set(tmp.old_ot, ot), 539 if(tmp.old_ot != ot, 540 [set(tmp.tile_highlight, hlt), 541 add_object(hlt), 542 remove_object(tmp.tile_highlight), 543 ] where hlt = object('civ_board.tile', tile_at(ot)[0], tile_at(ot)[1], facing), 544 ), 545 #object('civ_board.tile', tile_at(ot)[0]-consts.tiles, tile_at(ot)[1]-consts.tiles, facing)# 546 ], 547 [set(tmp.old_ot, 0), 548 remove_object(tmp.tile_highlight), 549 ]) 550 where ot = mouse_on_tile(), 551 552 fire_event(vars.turn_button, 'lmb_hold', level.player.vars.mouse), 553 fire_event(vars.fight_button, 'lmb_hold', level.player.vars.mouse), 554 ])", 555on_lmb_up: "[ 556 remove_object(tmp.tile_highlight), 557 fire_event(vars.turn_button, 'lmb_up', level.player.vars.mouse), 558 fire_event(vars.fight_button, 'lmb_up', level.player.vars.mouse), 559 ]", 560on_release_tile: "if(mouse_on_tile() and vars.players[vars.turn] = 'human', 561 [set(arg.midpoint_x, tile_at(mouse_on_tile())[0]), 562 set(arg.midpoint_y, tile_at(mouse_on_tile())[1]), 563 #debug(my_valid_bldg(arg, my_bldg_spots)),# 564 fire_event('release_tile_internal', arg)], 565 fire_event('fail_release_tile', arg))", 566on_release_tile_internal: "if(not vars.war or vars.replace, 567 [#debug(tile_at(mouse_on_tile())),# 568 if(mot and is_valid_addition(arg, mouse_on_tile()) and (not arg.type = 'civ-tile_war' and (played(mouse_on_tile()))), #add a tile normally# 569 [set(arg.vars.gridloc, mot), 570 set(arg.midpoint_x, tile_at(mot)[0]), 571 set(arg.midpoint_y, tile_at(mot)[1]), 572 set(vars.play, vars.play + [arg]), #Setting arg.midpoint_s before this function avoids a [] crash.# 573 set(vars.bag.vars.on_deal_tile, arg.vars.hand_pos), 574 set(arg.animation, consts.tile_types[vars.turn]), 575 set(vars.hand, filter(vars.hand, 'vh', vh != arg)), 576 if(arg.type = 'civ-tile_mine' and get_terrain(mot) = 'ore_grid', fire_event('ore_mine')), 577 if(not arg.type = 'civ-tile_mine' and furnace[turn] = 1, [ 578 fire_event(vars.bag, 'deal_p1'), 579 if(size(vars.bag.vars.piles[vars.turn]) < 6, debug('Game Over'), fire_event('check_cache_bonus')), 580 ],[ 581 set(not_refilled_when_played, not_refilled_when_played + [arg]), 582 ]), 583 ], 584 fire_event('fail_release_tile', arg)) 585 where mot = mouse_on_tile(), 586 ])", 587on_fail_release_tile: "if(quad, schedule(2, 588 [fire_event(find(vars.bldg_codes[arg.type], 'blueprints', pair_off(map(quad, 'q', q.type), blueprints[0]))[1], arg), 589 schedule(2, set(arg.zorder, arg.zorder-9)), 590 set(arg.midpoint_x, quad[3].x), 591 set(arg.midpoint_y, quad[3].y), 592 set(vars.bag.vars.on_deal_tile, arg.vars.hand_pos), 593 fire_event(vars.bag, 'deal_p1'), 594 map(quad, 'quad_tile', set(quad_tile.bldg_status, arg)), 595 ]), 596 if((not on_piece(mouse).animation != arg.animation) or arg.type != 'civ-tile_war' or (not on_any_tile(mouse)), 597 fire_event('rehand_tile', arg), 598 if(is_valid_addition(arg, mouse_on_tile()), #WAR!# 599 [#set(arg.midpoint_x, mouse[0]), 600 set(arg.midpoint_y, mouse[1]),# 601 602 fire_event('war', arg), 603 #war_defeat_tile(on_piece(mouse)),# 604 fire_event('release_tile_internal', arg), 605 606 ], 607 fire_event('rehand_tile', arg),) 608 ) 609 ) where quad = my_valid_bldg_at(mouse, arg, my_bldg_spots)", 610on_recalculate_end_turn_button_state: "if(not went_to_war, 611 bag.turn_button.set_state('replace'), 612 bag.turn_button.set_state('normal'), 613 )", 614on_war: "[ #set up the war# 615 set(vars.war, 1), 616 set(vars.help_obj.x, vars.help_obj.x - 220), 617 set(vars.hand, filter(vars.hand, 'vh', vh != arg)), 618 help('Select additional warrior tiles from hand for one-time use.'), 619 set(level.lock_screen, [vars.camera_pos[0]+vars.camera_pos[2]/2-220,vars.camera_pos[1]+vars.camera_pos[3]/2]), 620 set(arg.zorder, arg.zorder + 1), #doesn't work# 621 fire_event('make_blink', on_piece(mouse)), 622 schedule(20, fire_event('make_blink', arg)), 623 get_object(level, 'vs').set_text(tile_side_name(on_piece(mouse)) + ~ VS ~ + tile_side_name(arg.animation)), 624 [ get_object(level, 'strength').set_text(~Armies:~ + '\n' + str(strengths[0]+dbar) + ~(+?) VS ~ + str(strengths[1]+abar) + ~(+0)~), 625 set(attacking_barracks_bonus, abar), 626 set(defending_barracks_bonus, dbar), 627 ] where dbar = barracks[consts.tile_types_side[on_piece(mouse).animation]]*4 628 where abar = barracks[consts.tile_types_side[arg.animation]]*4, 629 set(vars.strengths, strengths), 630 set(vars.war_arg, arg), set(vars.war_on, on_piece(mouse)), 631 ] where strengths = [size(filter(k_group(mouse, on_piece(mouse).animation), 'tile', tile.type = 'civ-tile_war')), size(filter(k_group(mouse, arg.animation), 'tile', tile.type = 'civ-tile_war'))+1]", 632on_fight: "map(range(size(actions)), 'index', schedule(index * 10, actions[index])) 633 where actions = if(size(recruited) > 0, map(range(size(recruited)), 'rind', [ 634 map(range(res), 'delay', schedule(delay, [ 635 set(recruited[rind].x, (recruited[rind].x*(res-delay) + war_arg.x*delay)/res), 636 set(recruited[rind].y, (recruited[rind].y*(res-delay) + war_arg.y*delay)/res)])) where res = 20, 637 schedule(21, fire_event(recruited[rind], 'nix')) 638 ])) 639 + [schedule(if(size(recruited) > 0, 15, 0), [ #finish the fight# 640 set(vars.war, 0), 641 set(vars.went_to_war, 1), 642 set(vars.help_obj.x, vars.help_obj.x + 220), 643 set(level.lock_screen, [vars.camera_pos[0]+vars.camera_pos[2]/2,vars.camera_pos[1]+vars.camera_pos[3]/2]), 644 set(vars.war_arg.zorder, arg.zorder - 1), 645 schedule(60*farm_house[turn], if(strengths[0] + AIStrength + defBarracks >= strengths[1] + size(recruited) + attBarracks, 646 [war_defeat_tile(vars.war_arg), 647 help(tile_side_name(vars.war_arg) + ~'s warriors have fled! (~ + str(strengths[0]+AIStrength+ defBarracks) + ~ to ~ + str(strengths[1]+size(recruited) + attBarracks) + ~)~), 648 ], 649 [war_defeat_tile(vars.war_on), 650 add_tile(vars.war_arg, on_any_tile([vars.war_arg.midpoint_x,vars.war_arg.midpoint_y])), 651 set(vars.camped, vars.camped + [vars.war_arg]), 652 help(~A ~ + tile_side_name(vars.war_on) + ' ' + tile_name(vars.war_on) + ~ was destroyed by ~ + tile_side_name(vars.war_arg) + ~'s warriors! (~ + str(strengths[0]+AIStrength+defBarracks) + ~ to ~ + str(strengths[1]+size(recruited)+attBarracks) + ~)~), 653 schedule(3, set(vars.play, filter(vars.play, 'vp', vp != context.vars.war_on) + [vars.war_arg])), 654 ])) where defBarracks = defending_barracks_bonus 655 where attBarracks = attacking_barracks_bonus 656 where AIStrength = 0, 657 #schedule(2, [ 658 set(vars.bag.vars.on_deal_tile, vars.war_arg.vars.hand_pos), 659 fire_event(vars.bag, 'deal_p1'), 660 ]),# 661 set(recruited, []), 662 set(not_refilled_when_played, not_refilled_when_played + recruited + [vars.war_arg]), 663 #debug(recruited),# 664 #schedule(30, 665 if(size(vars.bag.vars.piles[vars.turn]) = 1, 666 debug('Game over, no more tiles.'), 667 fire_event('check_cache_bonus') 668 ) 669 ),# 670 schedule(15, fire_event('recalculate_end_turn_button_state')), 671 ])]", 672on_make_blink: "[set(arg.alpha, 0), schedule(20, [set(arg.alpha, 256), schedule(20, if(vars.war, fire_event('make_blink', arg)))])]", 673on_rehand_tile: "arg.go_to(dealt_hand_loc(0,arg.vars.hand_pos))", 674on_tiles_in_play_modified: "[add(vars.cache_version, 1), 675 map(vars.play, 'p', [ 676 fire_event(p, 'calculate_surroundings'), 677 fire_event(p, 'calculate_kingdom', context) 678 ]), 679 set(vars.bldg_spots, map(consts.tile_types, 'ttype', #for each side, a list of quads of tiles available for building on# 680 #'\n' + size(sideTiles) + 'x side ' + ttype# 681 filter(map(sideTiles, 'sideTile', 682 if(not null in tileQuad, tileQuad) 683 where tileQuad = [ 684 sideTile, 685 find(sideTiles, 'st', st.gridloc = list_add(sideTile.gridloc,[1,0])), 686 find(sideTiles, 'st', st.gridloc = list_add(sideTile.gridloc,[0,1])), 687 find(sideTiles, 'st', st.gridloc = list_add(sideTile.gridloc,[1,1])) 688 ] 689 ), 'quads', quads != null) 690 where sideTiles = filter(vars.play, 'inPlay', inPlay.animation = ttype and (not inPlay.bldg_status)) 691 )), 692 #debug(bldg_spots),# 693 ]", 694on_end_turn: "if(vars.trigger_replace = 1, [ 695 fire_event('deal_replace'), 696 set(vars.trigger_replace, 0), 697 add(bag.turn_button.x, 300), 698 ],[ 699 [map(to_decamp, 'camp', [fire_event(camp, 'nix')]), 700 set(vars.play, filter(vars.play, 'in_play', not in_play in context.to_decamp)), 701 set(vars.camp, filter(vars.camp, 'a_camp', not a_camp in context.to_decamp)), 702 ] where to_decamp = filter(vars.camped, 'camp', camp.animation = context.consts.tile_types[nt]), 703 schedule(2, fire_event('tiles_in_play_modified')), #update the cache# 704 schedule(2, fire_event('tiles_in_play_modified')), #for some reason, calling this twice to prevents erronious starves when two 'kingdoms' joined# 705 schedule(3, fire_event('end_turn_compute_starves')), 706 ]) where nt = (vars.turn+1)%size(vars.players)", 707on_end_turn_compute_starves: "[ 708 #if(turn=0, help(' ')),# #timing issues regarding bonus building text# 709 schedule(1, fire_event('recalculate_end_turn_button_state')), 710 set(ai_counter, 0), 711 set(vars.replace, 0), 712 set(vars.went_to_war, 0), 713 set(max_tiles_to_replace, 6), 714 [schedule(15, [ 715 switch(vars.players[nt], 716 'human', [], 717 [fire_event(vars.players[nt] + '_turn')] 718 ), 719 #debug(str(tile.animation) + ' ' + str(tile.type) + ' at ' + str(tile.vars.gridloc)) where tile = vars.play[size(vars.play)-1],# 720 ]), 721 set(vars.turn, nt), 722 if(nt != vars.turn+1, add(vars.round, 1)), 723 set(turn_indicator.animation, consts.tile_types[nt]), 724 ] where nt = (vars.turn+1)%size(vars.players), 725 map(vars.play, 'tile', 726 if(not (has_food(tile, tile.vars.gridloc) or tile.type = 'civ-tile_farm'), 727 if(pottery[consts.tile_types_side[tile.animation]] = 0 or (tile.noPots=1 and consts.tile_types_side[tile.animation] = turn), 728 if(not size(defect) > 0, [ 729 fire_event('hack_remove_play_obj', tile), 730 fire_event(tile, 'nix'), 731 add_starve_object, 732 ],[ 733 set(tile.animation, defect[(1d(size(defect)))-1]), 734 add_starve_object, 735 ] 736 ) where defect = filter(map(adjacent_objs(tile.gridloc), 'adjs', adjs.animation), 'aa', aa != tile.animation and embassy[consts.tile_types_side[aa]] = 1) 737 where add_starve_object = 738 [add_object(starve_obj), 739 set(starve_obj.midpoint_x, tile.midpoint_x), 740 set(starve_obj.midpoint_y, tile.midpoint_y) 741 ] where starve_obj = object('civ_starve', x, y, facing), 742 [ 743 set(tile.noPots, 1), 744 [add_object(starve_obj), 745 set(starve_obj.midpoint_x, tile.midpoint_x), 746 set(starve_obj.midpoint_y, tile.midpoint_y) 747 ] where starve_obj = object('civ_warning', x, y, facing), 748 ]), 749 set(tile.noPots, 0) 750 ) 751 ), 752 #debug(farm_house),# 753 set(vars.freeze, 0), 754 ]", 755on_hack_remove_play_obj: "set(vars.play, filter(vars.play, 'in_play', in_play != arg))", 756 757#Simple_AI - demonstrating the use of some common ai calls. (AI_die was written before 758#these were produced, so it modifies raw data.) This AI is restricted to building 759#adjacent to itself. (At least one tile must be placed via scenario FML to start this 760#process.) You can set vars.ai_targets to a list of grid locations for this AI to 761#try to build to. 762on_simple_ai_turn: "[#debug(~Put map for {draw[0].type}:\n {map(putMap, 'pt', pt + ['\n'])}Put list: {putList}.~),# 763 if(size(putList) = 0, 764 if(ai_counter > max_retries, 765 schedule(2, fire_event('end_turn')), 766 [add(ai_counter, 1), 767 schedule(2, fire_event('simple_ai_turn'))] 768 ),[ 769 if(not played(spotToAdd), #War# 770 schedule(2, place_tile(draw[0], spotToAdd, turn)), 771 if(att_strength <= def_strength, [ 772 help(~{tile_side_name(defender.animation)} repelled an attack from {tile_side_name(consts.tile_types[turn])}. ({def_strength} vs {att_strength})~), 773 [add_object(war_obj), 774 set(war_obj.midpoint_x, tile_at(spotToAdd)[0]), 775 set(war_obj.midpoint_y, tile_at(spotToAdd)[1]) 776 ] where war_obj = object('civ_war', x, y, facing) 777 ],[ 778 help(~{tile_side_name(defender.animation)}'s {tile_name(defender)} was overran by {tile_side_name(consts.tile_types[turn])}'s warriors, {def_strength} to {att_strength}.~), 779 #debug(map(filter(k_group(tile_at(spotToAdd), defender.animation), 'kg', kg.type = 'civ-tile_war'), 'kg', '{kg.type} at {kg.gridloc}')),# 780 #debug(size(k_group(tile_at(spotToAdd), defender.animation))),# 781 remove_object(defender), 782 schedule(4, set(vars.play, filter(vars.play, 'vp', vp != defender) + [draw[0]])), 783 set(vars.camped, vars.camped + [draw[0]]), 784 schedule(3, place_tile(draw[0], spotToAdd, turn)), 785 ] 786 )where att_strength = size(filter(k_group(tile_at(spotToAdd), consts.tile_types[turn]), 'kg', kg.type = 'civ-tile_war')) + 1d3 787 where def_strength = size(filter(k_group(tile_at(spotToAdd), defender.animation), 'kg', kg.type = 'civ-tile_war')) 788 where defender = find(vars.play, 'vp', vp.gridloc = spotToAdd) 789 ), 790 draw[1], #This removes the drawn tile from the bag.# 791 schedule(5, fire_event('end_turn')) 792 ] where spotToAdd = if(ai_counter < max_retries-3 and size(target) > 0 and size(putList) > 0, #This is where you add strategy.# 793 sort(putList, length(a[0], a[1], target[0][0], target[0][1]) < length(b[0], b[1], target[0][0], target[0][1]))[0], 794 list_get_random(putList), 795 ) where target = filter(vars.ai_targets[turn], 'targets', not targets in map(context.vars.play, 'vp', vp.gridloc)) 796 ) 797 ] where putList = filter(tile_placement_list(draw[0]), 'spot', is_adjacent_to_side(spot, turn)) 798 where putMap = tile_placement_map(draw[0]) 799 where draw = vars.bag.extract(vars.turn) 800 where max_retries = 10", 801 802#bunker: It will not expand, but it will attack when appropriate. 803# 804on_bunker_turn: "[ 805 if(size(putList) = 0, 806 if(ai_counter > max_retries, 807 schedule(2, fire_event('end_turn')), 808 [add(ai_counter, 1), 809 schedule(2, fire_event('bunker_turn'))] 810 ),[#debug(putList),# 811 if(not played(spotToAdd), #War# 812 schedule(2, place_tile(draw, spotToAdd, turn)), 813 if(att_strength <= def_strength, [ 814 help(~{tile_side_name(defender.animation)} repelled an attack from {tile_side_name(consts.tile_types[turn])}. ({def_strength} vs {att_strength})~), 815 [add_object(war_obj), 816 set(war_obj.midpoint_x, tile_at(spotToAdd)[0]), 817 set(war_obj.midpoint_y, tile_at(spotToAdd)[1]) 818 ] where war_obj = object('civ_war', x, y, facing) 819 ],[ 820 help(~{tile_side_name(defender.animation)}'s {tile_name(defender)} was overran by {tile_side_name(consts.tile_types[turn])}'s warriors, {def_strength} to {att_strength}.~), 821 #debug(map(filter(k_group(tile_at(spotToAdd), defender.animation), 'kg', kg.type = 'civ-tile_war'), 'kg', '{kg.type} at {kg.gridloc}')),# 822 #debug(size(k_group(tile_at(spotToAdd), defender.animation))),# 823 remove_object(defender), 824 schedule(4, set(vars.play, filter(vars.play, 'vp', vp != defender) + [draw])), 825 set(vars.camped, vars.camped + [draw]), 826 schedule(3, place_tile(draw, spotToAdd, turn)), 827 ] 828 )where att_strength = size(filter(k_group(tile_at(spotToAdd), consts.tile_types[turn]), 'kg', kg.type = 'civ-tile_war')) + 1d3 829 where def_strength = size(filter(k_group(tile_at(spotToAdd), defender.animation), 'kg', kg.type = 'civ-tile_war')) 830 where defender = find(vars.play, 'vp', vp.gridloc = spotToAdd) 831 ), 832 schedule(5, fire_event('end_turn')) 833 ] where spotToAdd = if(ai_counter < max_retries-3 and size(target) > 0 and size(putList) > 0, #This is where you add strategy.# 834 sort(putList, length(a[0], a[1], target[0][0], target[0][1]) < length(b[0], b[1], target[0][0], target[0][1]))[0], 835 list_get_random(putList), 836 ) where target = filter(vars.ai_targets[turn], 'targets', not targets in map(context.vars.play, 'vp', vp.gridloc)) 837 ) 838 ] where putList = filter(tile_placement_list(draw), 'spot', is_adjacent_to_side(spot, turn) and spot in map(context.vars.play, 'vp', vp.gridloc)) 839 where putMap = tile_placement_map(draw) 840 where draw = object('civ-tile_war', bag_x, bag_y, facing) 841 where max_retries = 0", 842 843#depreciated: 844#The logic for the Die AI. This sequence performs the actions every AI should do. Each 845#AI must fire_event('end_turn') when it is done. (This is the 'next turn' button.) 846#Tiles need to be placed manually (by setting an x, y), and each tile played needs 847#to be added to vars.play. -excised bit about cache- 848#A note, vars.bag.extract(vars.turn) returns a list containing the tile 849#object (index 0), which we see, but it also returns a series of instructions (index 1) 850#to remove the object from the tile bag. Make sure to run these instructions, or the 851#bag will never empty. 852# 853on_ai_die_turn: "[ 854 if(size(validity2d) > 0, [ 855 set(tile_to_place[0].midpoint_x, tile_at(validity2d[eY][eX])[0]), #set tile pos to grid we chose# 856 set(tile_to_place[0].midpoint_y, tile_at(validity2d[eY][eX])[1]), 857 set(tile_to_place[0].animation, consts.tile_types[vars.turn]), #set the animation to the current side# 858 set(tile_to_place[0].vars.gridloc, validity2d[eY][eX]), #set the grid location of the tile# 859 set(vars.play, vars.play+[tile_to_place[0]]), #add the tile to the list of tiles in play# 860 add_object(tile_to_place[0]), 861 tile_to_place[1], #actually remove the object from it's bag# 862 ] where eX = (1d (size(validity2d[eY])))-1 #eX and eY are now valid locations coordinates.# 863 where eY = (1d (size(validity2d)))-1, 864 fire_event('ai_die_turn'), 865 ) 866 where validity2d = filter( 867 map(range(consts.tiles), 'cX', 868 filter( 869 map(range(consts.tiles), 'cY', 870 if(is_valid_addition(tile,[cX, cY]) 871 and (not [cX, cY] in map(vars.play, 'tile', tile.vars.gridloc) 872 and ((not find(starve(tile, [cX, cY]), 'dead', dead.animation = tile.animation)) 873 or tile.search_adjacent_connected_to_farm(tile_at([cX, cY])[0], tile_at([cX, cY])[1], consts.tile_types[vars.turn]))) 874 and has_food(tile, [cX, cY]), 875 [cX,cY] 876 ) 877 ), 878 'add', add != null) 879 ), 880 'add', add != []) 881 where tile = tile_to_place[0], 882 883 #debug('ended die`s turn'),# fire_event('end_turn'), 884 ] where tile_to_place = vars.bag.extract(vars.turn)", 885on_check_cache_bonus: "[if(farm_house[turn] = 1, [ 886 set(max_tiles_to_replace, 1), 887 schedule(2, fire_event('replace')), 888 bag.turn_button.set_state('normal'), 889 ], [ 890 schedule(5, fire_event('end_turn')) 891 ])]", 892on_check_ore: "[if(quarry[turn] >= ore_to_win, 893 schedule(30, teleport(next_level, 'camera', 'fade'))), 894 help('Quarry: +1 ore towards victory. You have {quarry[turn]} {if(quarry[turn]=1, ~ore~, ~ores~)} of {ore_to_win}.') 895 ]", 896on_ore_mine: "[set(quarry, list_replace_elements(quarry, turn, [quarry[turn]+1])), 897 schedule(2, fire_event('check_ore')), 898 ]", 899on_cache: "[set(cache, list_replace_elements(cache, turn, [1])), 900 help('Cache: All friendly tiles on plains are fed.'), 901 schedule(25, fire_event('end_turn'))]", 902on_farm_house: "[set(farm_house, list_replace_elements(farm_house, turn, [1])), 903 help('Farmhouse: Trade one tile each turn for free.'), 904 schedule(25, fire_event('end_turn'))]", 905on_pottery: "[set(pottery, list_replace_elements(pottery, turn, [1])), 906 help('Pottery: Grants one turn of warning before a starves.'), 907 schedule(25, fire_event('end_turn'))]", 908on_milita: "[set(militia, list_replace_elements(militia, turn, [1])), 909 help('Militia: Play farm tiles as warriors during battle.'), 910 schedule(25, fire_event('end_turn'))]", 911on_great_hall: "[set(great_hall, list_replace_elements(great_hall, turn, [great_hall[turn]+1])), 912 if(vars.hand_size+great_hall[turn]*2 < 14, [ 913 [set(vars.bag.vars.on_deal_tile, -great_hall[turn]-1), 914 fire_event(vars.bag, 'deal_p1'),], 915 [set(vars.bag.vars.on_deal_tile, vars.hand_size-1+great_hall[turn]+1), 916 fire_event(vars.bag, 'deal_p1'),], 917 help('Great Hall: +2 tiles held in hand, up to 14 total.') 918 ], 919 help('Great Hall: You can`t fit any more tiles in your hand.') 920 ), 921 schedule(25, fire_event('end_turn'))]", 922on_quarry: "[set(quarry_bldg, list_replace_elements(quarry_bldg, turn, [1])), 923 if(quarry_bldg[turn], help('You built a deep quarry, but you already have one.'), fire_event('ore_mine')), 924 schedule(25, fire_event('end_turn')),]", 925on_embassy: "[set(embassy, list_replace_elements(embassy, turn, [1])), 926 help('Embassy: Get an opponent`s starving tiles bordering your tiles.'), 927 schedule(25, fire_event('end_turn'))]", 928on_furnace: "[set(furnace, list_replace_elements(furnace, turn, [1])), 929 help('Furnace: Building a mine does not end the turn.'), 930 schedule(25, fire_event('end_turn'))]", 931on_shop: "[set(shop, 1), 932 set(max_tiles_to_replace, 14), 933 schedule(2, bag.turn_button.set_state('normal')), 934 fire_event('replace'), 935 help('Shop: Immediately replace all tiles without ending the turn.')]", 936on_barracks: "[set(barracks, list_replace_elements(barracks, turn, [1])), 937 help('Having barracks grants +4 to army strength. (Does not stack.)'), 938 schedule(25, fire_event('end_turn'))]", 939on_end_anim: "animation('normal')", 940editor_info: { 941 category: "crazy-stuff", 942}, 943animation: { 944 id: "normal", 945 image: "experimental/civ-tile.png", 946 x: 0, 947 y: 0, 948 w: 16, 949 h: 16, 950 pad: -1, 951 frames: 1, 952 duration: 6541, 953 surface_area: "all", 954}, 955object_type: [ 956 { 957 id: "tile", 958 hitpoints: 2, 959 zorder: -8, 960 on_create: "[ 961 set(alpha, tint), 962 ] where tint = 75", 963 animation: { 964 id: "normal", 965 image: "experimental/civ-stuff.png", 966 x: 11, 967 y: 10, 968 w: 16, 969 h: 16, 970 pad: -1, 971 frames: 1, 972 duration: 5541, 973 surface_area: "all", 974 }, 975 }, 976 { 977 id: "no", 978 hitpoints: 2, 979 zorder: 9, 980 on_create: "[ 981 set(alpha, tint), 982 ] where tint = 75", 983 on_nix: "die()", 984 animation: [ 985 { 986 id: "normal", 987 image: "experimental/civ-stuff.png", 988 x: 30, 989 y: 10, 990 w: 16, 991 h: 16, 992 pad: -1, 993 frames: 1, 994 duration: 6541, 995 surface_area: "all", 996 }, 997 { 998 id: "big", 999 image: "experimental/civ-stuff.png", 1000 x: 117, 1001 y: 418, 1002 w: 32, 1003 h: 32, 1004 pad: -1, 1005 frames: 1, 1006 duration: 6542, 1007 surface_area: "all", 1008 }, 1009 ], 1010 }, 1011 { 1012 id: "ocean_grid", 1013 hitpoints: 2, 1014 zorder: -10, 1015 animation: { 1016 id: "normal", 1017 image: "experimental/civ-stuff.png", 1018 x: 14, 1019 y: 85, 1020 w: 16, 1021 h: 16, 1022 pad: -1, 1023 frames: 1, 1024 duration: 542, 1025 surface_area: "all", 1026 }, 1027 }, 1028 { 1029 id: "plain_grid", 1030 hitpoints: 2, 1031 zorder: -10, 1032 animation: { 1033 id: "normal", 1034 image: "experimental/civ-stuff.png", 1035 x: 14, 1036 y: 108, 1037 w: 16, 1038 h: 16, 1039 pad: -1, 1040 frames: 1, 1041 duration: 543, 1042 surface_area: "all", 1043 }, 1044 }, 1045 { 1046 id: "hill_grid", 1047 hitpoints: 2, 1048 zorder: -10, 1049 animation: { 1050 id: "normal", 1051 image: "experimental/civ-stuff.png", 1052 x: 14, 1053 y: 153, 1054 w: 16, 1055 h: 16, 1056 pad: -1, 1057 frames: 1, 1058 duration: 544, 1059 surface_area: "all", 1060 }, 1061 }, 1062 { 1063 id: "ore_grid", 1064 hitpoints: 2, 1065 zorder: -10, 1066 animation: [ 1067 { 1068 id: "normal", 1069 image: "experimental/civ-stuff.png", 1070 x: 33, 1071 y: 153, 1072 w: 16, 1073 h: 16, 1074 pad: -1, 1075 frames: 1, 1076 duration: 999999999, 1077 surface_area: "all", 1078 }, 1079 { 1080 id: "normal", 1081 image: "experimental/civ-stuff.png", 1082 x: 52, 1083 y: 153, 1084 w: 16, 1085 h: 16, 1086 pad: -1, 1087 frames: 1, 1088 duration: 999999999, 1089 surface_area: "all", 1090 }, 1091 { 1092 id: "normal", 1093 image: "experimental/civ-stuff.png", 1094 x: 71, 1095 y: 153, 1096 w: 16, 1097 h: 16, 1098 pad: -1, 1099 frames: 1, 1100 duration: 999999999, 1101 surface_area: "all", 1102 }, 1103 ], 1104 }, 1105], 1106} 1107