… | |
… | |
145 | } |
145 | } |
146 | |
146 | |
147 | void |
147 | void |
148 | remove_force (object *op) |
148 | remove_force (object *op) |
149 | { |
149 | { |
|
|
150 | fprintf (stderr, "duration %s %d\n", &op->name, op->duration);//D |
150 | if (--op->duration > 0) |
151 | if (--op->duration > 0) |
151 | return; |
152 | return; |
152 | |
153 | |
153 | if (op->env) |
154 | if (op->env) |
154 | switch (op->subtype) |
155 | switch (op->subtype) |
… | |
… | |
1240 | void |
1241 | void |
1241 | move_marker (object *op) |
1242 | move_marker (object *op) |
1242 | { |
1243 | { |
1243 | if (object *tmp = op->ms ().player ()) |
1244 | if (object *tmp = op->ms ().player ()) |
1244 | { |
1245 | { |
1245 | object *tmp2; |
|
|
1246 | |
|
|
1247 | /* remove an old force with a slaying field == op->name */ |
1246 | /* remove an old force with a slaying field == op->name */ |
1248 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
1247 | if (object *force = tmp->force_find (op->name)) |
1249 | if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->name) |
1248 | force->destroy (); |
|
|
1249 | |
|
|
1250 | if (!tmp->force_find (op->slaying)) |
1250 | { |
1251 | { |
1251 | tmp2->destroy (); |
1252 | tmp->force_add (op->slaying, op->stats.food); |
1252 | break; |
|
|
1253 | } |
|
|
1254 | |
1253 | |
1255 | /* cycle through his inventory to look for the MARK we want to |
|
|
1256 | * place |
|
|
1257 | */ |
|
|
1258 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
|
|
1259 | if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying) |
|
|
1260 | break; |
|
|
1261 | |
|
|
1262 | /* if we didn't find our own MARK */ |
|
|
1263 | if (!tmp2) |
|
|
1264 | { |
|
|
1265 | object *force = get_archetype (FORCE_NAME); |
|
|
1266 | |
|
|
1267 | if (op->stats.food) |
|
|
1268 | { |
|
|
1269 | force->set_speed (0.01); |
|
|
1270 | force->speed_left = -op->stats.food; |
|
|
1271 | } |
|
|
1272 | else |
|
|
1273 | force->set_speed (0); |
|
|
1274 | |
|
|
1275 | /* put in the lock code */ |
|
|
1276 | force->slaying = op->slaying; |
|
|
1277 | |
|
|
1278 | if (op->lore) |
|
|
1279 | force->lore = op->lore; |
|
|
1280 | |
|
|
1281 | insert_ob_in_ob (force, tmp); |
|
|
1282 | if (op->msg) |
1254 | if (op->msg) |
1283 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); |
1255 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); |
1284 | |
1256 | |
1285 | if (op->stats.hp > 0) |
1257 | if (op->stats.hp > 0) |
1286 | { |
1258 | { |
1287 | op->stats.hp--; |
1259 | op->stats.hp--; |
|
|
1260 | |
1288 | if (op->stats.hp == 0) |
1261 | if (op->stats.hp == 0) |
1289 | { |
1262 | { |
1290 | /* marker expires--granted mark number limit */ |
1263 | /* marker expires--granted mark number limit */ |
1291 | op->destroy (); |
1264 | op->destroy (); |
1292 | return; |
1265 | return; |