/////////////////////////////////////////////////////////// ////// Released under the GPL ////// see gpl.txt ////// Written by and copyrighted by: ////// Michael Gibson ////// (c)2003, 2004, 2006 /////////////////////////////////////////////////////////// /////////////////////////////// // can player move? /////////////////////////////// int can_player_move(int player_str, int player_rac, int map_tile){ int return_value=0; //default is false //does player have the strength //to move? if(player_rac==1 || player_rac==2 || player_rac==4){ //human, elf, dwarf? if(player_str >= 5){ //must have strength of 5 return_value=1; } } if(player_rac==3){ //halfling? if(player_str >= 4){ //must have strenght of 4 return_value=1; } } if(map_tile==500 || map_tile==501){ //if in a pit return_value=0; //can not move } return(return_value); } //////////////////////////////// // check tile /////////////////////////////// void check_tile(int *map_tile,int *player_charm,int *player_h_in_hand, int *player_cpr,int *player_slv, int *player_gld, int *player_hatchet, int *player_lumber, int *player_x,int *player_y){ //Charmed Tile if(*map_tile==600){ //tile that has charm on it? *player_charm=1; //turn on charmed for player *map_tile=601; //charm now used } if(*map_tile==500){ //if you fall into a covered *map_tile=501; //or hidden pit, it will no } //longer be covered or hidden. //if treasure tile if(*map_tile==800){ //if you land on a small treasure *map_tile=001; //value will be taken and *player_gld=*player_gld +5; } //item will no longer be shown. //if treasure tile if(*map_tile==801){ //if you land on a medium treasure *map_tile=001; //value will be taken and *player_gld=*player_gld +10; } //item will no longer be shown. //if treasure tile if(*map_tile==802){ //if you land on a large treasure *map_tile=001; //value will be taken and *player_gld=*player_gld +20; } //item will no longer be shown. //if copper coin tile if(*map_tile==803){ //if you land on copper coins *map_tile=001; //value will be taken and *player_cpr=*player_cpr +3; } //if silver coin tile if(*map_tile==804){ //if you land on silver coins *map_tile=001; //value will be taken and *player_slv=*player_slv +3; } //if gold coin tile if(*map_tile==805){ //if you land on gold coins *map_tile=001; //clear tile by setting to grass *player_gld=*player_gld +3; //value will be taken } //if land on hatchet tile if(*map_tile==810){ *map_tile=001; //clear tile by setting to grass *player_hatchet=1; //mark the player having a hatchet } //if land on tree tile and own hatchet and holding hatchet if(*map_tile==100 || *map_tile==101 || *map_tile==102){ if(*player_hatchet==1 && *player_h_in_hand==1){ //if player has a hatchet and is in hand *map_tile=001; //set the tile to grass (chopped down tree) *player_lumber++; //increment the players lumber } } if(*map_tile==807){ //if on pile of lumber *player_lumber = *player_lumber + 5; *map_tile=001; } //Teleport Tile 1 if(*map_tile==701){ //set player_x and player_y to telport tile (10,10) *player_x=10; *player_y=10; } //Teleport Tile 2 if(*map_tile==702){ //set player_x and player_y to telport tile (20,10) *player_x=20; *player_y=10; } }