ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.84 by root, Wed Jan 3 20:32:13 2007 UTC vs.
Revision 1.85 by root, Thu Jan 4 16:19:32 2007 UTC

2084 */ 2084 */
2085 if ((op->contr->braced || !move_ob (op, dir, op)) && !out_of_map (op->map, nx, ny)) 2085 if ((op->contr->braced || !move_ob (op, dir, op)) && !out_of_map (op->map, nx, ny))
2086 { 2086 {
2087 if (OUT_OF_REAL_MAP (op->map, nx, ny)) 2087 if (OUT_OF_REAL_MAP (op->map, nx, ny))
2088 { 2088 {
2089 m = get_map_from_coord (op->map, &nx, &ny); 2089 m = op->map->xy_find (nx, ny);
2090 if (!m) 2090 if (!m)
2091 return; /* Don't think this should happen */ 2091 return; /* Don't think this should happen */
2092 } 2092 }
2093 else 2093 else
2094 m = op->map; 2094 m = op->map;
2095 2095
2096 if ((tmp = GET_MAP_OB (m, nx, ny)) == NULL) 2096 if (!(tmp = m->at (nx, ny).bot))
2097 {
2098 /* LOG(llevError,"player_move_attack: GET_MAP_OB returns NULL, but player can not move there.\n"); */
2099 return; 2097 return;
2100 }
2101 2098
2102 mon = 0; 2099 mon = 0;
2103 /* Go through all the objects, and find ones of interest. Only stop if 2100 /* Go through all the objects, and find ones of interest. Only stop if
2104 * we find a monster - that is something we know we want to attack. 2101 * we find a monster - that is something we know we want to attack.
2105 * if its a door or barrel (can roll) see if there may be monsters 2102 * if its a door or barrel (can roll) see if there may be monsters
2158 && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) 2155 && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)))
2159 { 2156 {
2160 /* If we're braced, we don't want to switch places with it */ 2157 /* If we're braced, we don't want to switch places with it */
2161 if (op->contr->braced) 2158 if (op->contr->braced)
2162 return; 2159 return;
2160
2163 play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); 2161 play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER);
2164 (void) push_ob (mon, dir, op); 2162 (void) push_ob (mon, dir, op);
2165 if (op->contr->tmp_invis || op->hide) 2163 if (op->contr->tmp_invis || op->hide)
2166 make_visible (op); 2164 make_visible (op);
2165
2167 return; 2166 return;
2168 } 2167 }
2169 2168
2170 /* in certain circumstances, you shouldn't attack friendly 2169 /* in certain circumstances, you shouldn't attack friendly
2171 * creatures. Note that if you are braced, you can't push 2170 * creatures. Note that if you are braced, you can't push
2185 !on_battleground)) 2184 !on_battleground))
2186 { 2185 {
2187 if (!op->contr->braced) 2186 if (!op->contr->braced)
2188 { 2187 {
2189 play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); 2188 play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER);
2190 (void) push_ob (mon, dir, op); 2189 push_ob (mon, dir, op);
2191 } 2190 }
2192 else 2191 else
2193 new_draw_info (0, 0, op, "You withhold your attack"); 2192 new_draw_info (0, 0, op, "You withhold your attack");
2194 2193
2195 if (op->contr->tmp_invis || op->hide) 2194 if (op->contr->tmp_invis || op->hide)
2210 * Way it works is like this: First, it must have some hit points 2209 * Way it works is like this: First, it must have some hit points
2211 * and be living. Then, it must be one of the following: 2210 * and be living. Then, it must be one of the following:
2212 * 1) Not a player, 2) A player, but of a different party. Note 2211 * 1) Not a player, 2) A player, but of a different party. Note
2213 * that party_number -1 is no party, so attacks can still happen. 2212 * that party_number -1 is no party, so attacks can still happen.
2214 */ 2213 */
2215
2216 else if ((mon->stats.hp >= 0) && QUERY_FLAG (mon, FLAG_ALIVE) && 2214 else if ((mon->stats.hp >= 0) && QUERY_FLAG (mon, FLAG_ALIVE) &&
2217 ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party))) 2215 ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party)))
2218 { 2216 {
2219 2217
2220 /* If the player hasn't hit something this tick, and does 2218 /* If the player hasn't hit something this tick, and does
3224 3222
3225 skop = find_obj_by_type_subtype (op, SKILL, SK_HIDING); 3223 skop = find_obj_by_type_subtype (op, SKILL, SK_HIDING);
3226 3224
3227 /* its *extremely* hard to run and sneak/hide at the same time! */ 3225 /* its *extremely* hard to run and sneak/hide at the same time! */
3228 if (op->type == PLAYER && op->contr->run_on) 3226 if (op->type == PLAYER && op->contr->run_on)
3229 {
3230 if (!skop || num >= skop->level) 3227 if (!skop || num >= skop->level)
3231 { 3228 {
3232 new_draw_info (NDI_UNIQUE, 0, op, "You ran too much! You are no longer hidden!"); 3229 new_draw_info (NDI_UNIQUE, 0, op, "You ran too much! You are no longer hidden!");
3233 make_visible (op); 3230 make_visible (op);
3234 return; 3231 return;
3235 } 3232 }
3236 else 3233 else
3237 num += 20; 3234 num += 20;
3238 } 3235
3239 num += op->map->difficulty; 3236 num += op->map->difficulty;
3240 hide = hideability (op); /* modify by terrain hidden level */ 3237 hide = hideability (op); /* modify by terrain hidden level */
3241 num -= hide; 3238 num -= hide;
3239
3242 if ((op->type == PLAYER && hide < -10) || ((op->invisible -= num) <= 0)) 3240 if ((op->type == PLAYER && hide < -10) || ((op->invisible -= num) <= 0))
3243 { 3241 {
3244 make_visible (op); 3242 make_visible (op);
3245 if (op->type == PLAYER) 3243 if (op->type == PLAYER)
3246 new_draw_info (NDI_UNIQUE, 0, op, "You moved out of hiding! You are visible!"); 3244 new_draw_info (NDI_UNIQUE, 0, op, "You moved out of hiding! You are visible!");
3247 } 3245 }
3248 else if (op->type == PLAYER && skop) 3246 else if (op->type == PLAYER && skop)
3249 {
3250 change_exp (op, calc_skill_exp (op, NULL, skop), skop->skill, 0); 3247 change_exp (op, calc_skill_exp (op, NULL, skop), skop->skill, 0);
3251 }
3252} 3248}
3253 3249
3254/* determine if who is standing near a hostile creature. */ 3250/* determine if who is standing near a hostile creature. */
3255 3251
3256int 3252int

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines