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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.186 by elmex, Tue Jan 13 12:07:42 2009 UTC vs.
Revision 1.187 by elmex, Tue Jan 13 13:29:57 2009 UTC

315 */ 315 */
316 if (tmp->inv) 316 if (tmp->inv)
317 { 317 {
318 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) 318 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))
319 { 319 {
320 object *fball;
321
322 op->failmsg ("Yech! Your lungs are on fire!"); 320 op->failmsg ("Yech! Your lungs are on fire!");
323 321 create_exploding_ball_at (op, op->level);
324 /* Explodes a fireball centered at player */
325 fball = get_archetype (EXPLODING_FIREBALL);
326 fball->dam_modifier = random_roll (1, op->level, op, PREFER_LOW) / 5 + 1;
327 fball->stats.maxhp = random_roll (1, op->level, op, PREFER_LOW) / 10 + 2;
328 fball->x = op->x;
329 fball->y = op->y;
330 insert_ob_in_map (fball, op->map, NULL, 0);
331 } 322 }
332 else 323 else
333 cast_spell (op, tmp, op->facing, tmp->inv, NULL); 324 cast_spell (op, tmp, op->facing, tmp->inv, NULL);
334 325
335 tmp->decrease (); 326 tmp->decrease ();
378 } 369 }
379 370
380 /* Only thing left are the stat potions */ 371 /* Only thing left are the stat potions */
381 if (op->type == PLAYER) 372 if (op->type == PLAYER)
382 { /* only for players */ 373 { /* only for players */
383 if ((QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) && tmp->value != 0) 374 if ((QUERY_FLAG (tmp, FLAG_CURSED)
375 || QUERY_FLAG (tmp, FLAG_DAMNED))
376 && tmp->value != 0)
384 CLEAR_FLAG (tmp, FLAG_APPLIED); 377 CLEAR_FLAG (tmp, FLAG_APPLIED);
385 else 378 else
386 SET_FLAG (tmp, FLAG_APPLIED); 379 SET_FLAG (tmp, FLAG_APPLIED);
387 380
388 if (!change_abil (op, tmp)) 381 if (!change_abil (op, tmp))
2433 else 2426 else
2434 who->failmsg ("You need to mark a lightable object."); 2427 who->failmsg ("You need to mark a lightable object.");
2435} 2428}
2436 2429
2437/** 2430/**
2431 * This function generates a cursed effect for cursed lamps and torches.
2432 */
2433void player_apply_lamp_cursed_effect (object *who, object *op)
2434{
2435 if (op->level)
2436 {
2437 who->failmsg (format (
2438 "The %s was cursed, it explodes in a big fireball!",
2439 &op->name));
2440 create_exploding_ball_at (who, op->level);
2441 }
2442 else
2443 {
2444 who->failmsg (format (
2445 "The %s was cursed, it crumbles to dust, at least it didn't explode.!",
2446 &op->name));
2447 }
2448
2449 op->destroy ();
2450}
2451
2452/**
2438 * Apply for players and lamps 2453 * Apply for players and lamps
2439 * 2454 *
2440 * who - the player 2455 * who - the player
2441 * op - the lamp 2456 * op - the lamp
2442 */ 2457 */
2465 "H<Torches and similar items burn out and become worthless.>", 2480 "H<Torches and similar items burn out and become worthless.>",
2466 &op->name)); 2481 &op->name));
2467 return; 2482 return;
2468 } 2483 }
2469 2484
2485 if (op->flag [FLAG_CURSED])
2486 {
2487 player_apply_lamp_cursed_effect (who, op);
2488 return;
2489 }
2490
2470 if (lighter) 2491 if (lighter)
2471 who->statusmsg (format ( 2492 who->statusmsg (format (
2472 "You light up the %s with the %s.", &op->name, &lighter->name)); 2493 "You light up the %s with the %s.", &op->name, &lighter->name));
2473 else 2494 else
2474 who->statusmsg (format ("You light up the %s.", &op->name)); 2495 who->statusmsg (format ("You light up the %s.", &op->name));
2475 } 2496 }
2476 else 2497 else
2477 { 2498 {
2499 if (op->flag [FLAG_CURSED])
2500 {
2501 player_apply_lamp_cursed_effect (who, op);
2502 return;
2503 }
2504
2478 if (op->type == TORCH) 2505 if (op->type == TORCH)
2479 { 2506 {
2480 if (!op->flag [FLAG_IS_LIGHTABLE]) 2507 if (!op->flag [FLAG_IS_LIGHTABLE])
2481 { 2508 {
2482 who->statusmsg (format ( 2509 who->statusmsg (format (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines