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

Comparing deliantra/server/server/skill_util.C (file contents):
Revision 1.27 by root, Mon Feb 5 02:07:40 2007 UTC vs.
Revision 1.28 by root, Tue Mar 6 00:51:00 2007 UTC

340 * the player doesn't have a bucket for that, create one. 340 * the player doesn't have a bucket for that, create one.
341 */ 341 */
342 if (skill->type != SKILL && op->type == PLAYER) 342 if (skill->type != SKILL && op->type == PLAYER)
343 { 343 {
344 for (tmp = op->inv; tmp != NULL; tmp = tmp->below) 344 for (tmp = op->inv; tmp != NULL; tmp = tmp->below)
345 {
346 if (tmp->type == SKILL && tmp->skill == skill->skill) 345 if (tmp->type == SKILL && tmp->skill == skill->skill)
347 break; 346 break;
348 } 347
349 if (!tmp) 348 if (!tmp)
350 tmp = give_skill_by_name (op, skill->skill); 349 tmp = give_skill_by_name (op, skill->skill);
350
351 skill = tmp; 351 skill = tmp;
352 } 352 }
353 353
354 // skill, by_whom, on_which_object, which direction, skill_argument 354 // skill, by_whom, on_which_object, which direction, skill_argument
355 if (INVOKE_OBJECT (USE_SKILL, skill, ARG_OBJECT (op), ARG_OBJECT (part), ARG_INT (dir), ARG_STRING (string))) 355 if (INVOKE_OBJECT (USE_SKILL, skill, ARG_OBJECT (op), ARG_OBJECT (part), ARG_INT (dir), ARG_STRING (string)))
356 return 0; 356 return 0;
357 357
358 switch (skill->subtype) 358 switch (skill->subtype)
359 { 359 {
360 case SK_LEVITATION: 360 case SK_LEVITATION:
361 /* Not 100% sure if this will work with new movement code - 361 /* Not 100% sure if this will work with new movement code -
362 * the levitation skill has move_type for flying, so when 362 * the levitation skill has move_type for flying, so when
363 * equipped, that should transfer to player, when not, 363 * equipped, that should transfer to player, when not,
364 * shouldn't. 364 * shouldn't.
365 */ 365 */
366 if (QUERY_FLAG (skill, FLAG_APPLIED)) 366 if (QUERY_FLAG (skill, FLAG_APPLIED))
367 { 367 {
368 CLEAR_FLAG (skill, FLAG_APPLIED); 368 CLEAR_FLAG (skill, FLAG_APPLIED);
369 new_draw_info (NDI_UNIQUE, 0, op, "You come to earth."); 369 new_draw_info (NDI_UNIQUE, 0, op, "You come to earth.");
370 } 370 }
371 else 371 else
372 { 372 {
373 SET_FLAG (skill, FLAG_APPLIED); 373 SET_FLAG (skill, FLAG_APPLIED);
374 new_draw_info (NDI_UNIQUE, 0, op, "You rise into the air!."); 374 new_draw_info (NDI_UNIQUE, 0, op, "You rise into the air!.");
375 } 375 }
376
376 op->update_stats (); 377 op->update_stats ();
377 success = 1; 378 success = 1;
378 break; 379 break;
379 380
380 case SK_STEALING: 381 case SK_STEALING:
381 exp = success = steal (op, dir, skill); 382 exp = success = steal (op, dir, skill);
382 break; 383 break;
383 384
384 case SK_LOCKPICKING: 385 case SK_LOCKPICKING:
385 exp = success = pick_lock (op, dir, skill); 386 exp = success = pick_lock (op, dir, skill);
386 break; 387 break;
387 388
388 case SK_HIDING: 389 case SK_HIDING:
389 exp = success = hide (op, skill); 390 exp = success = hide (op, skill);
390 break; 391 break;
391 392
392 case SK_JUMPING: 393 case SK_JUMPING:
393 success = jump (op, dir, skill); 394 success = jump (op, dir, skill);
394 break; 395 break;
395 396
396 case SK_INSCRIPTION: 397 case SK_INSCRIPTION:
397 exp = success = write_on_item (op, string, skill); 398 exp = success = write_on_item (op, string, skill);
398 break; 399 break;
399 400
400 case SK_MEDITATION: 401 case SK_MEDITATION:
401 meditate (op, skill); 402 meditate (op, skill);
402 success = 1; 403 success = 1;
403 break; 404 break;
404 /* note that the following 'attack' skills gain exp through hit_player() */ 405 /* note that the following 'attack' skills gain exp through hit_player() */
405 406
406 case SK_KARATE: 407 case SK_KARATE:
407 (void) attack_hth (op, dir, "karate-chopped", skill); 408 (void) attack_hth (op, dir, "karate-chopped", skill);
408 break; 409 break;
409 410
410 case SK_PUNCHING: 411 case SK_PUNCHING:
411 (void) attack_hth (op, dir, "punched", skill); 412 (void) attack_hth (op, dir, "punched", skill);
412 break; 413 break;
413 414
414 case SK_FLAME_TOUCH: 415 case SK_FLAME_TOUCH:
415 (void) attack_hth (op, dir, "flamed", skill); 416 (void) attack_hth (op, dir, "flamed", skill);
416 break; 417 break;
417 418
418 case SK_SPARK_TOUCH: 419 case SK_SPARK_TOUCH:
419 (void) attack_hth (op, dir, "zapped", skill); 420 (void) attack_hth (op, dir, "zapped", skill);
420 break; 421 break;
421 422
422 case SK_SHIVER: 423 case SK_SHIVER:
423 (void) attack_hth (op, dir, "froze", skill); 424 (void) attack_hth (op, dir, "froze", skill);
424 break; 425 break;
425 426
426 case SK_ACID_SPLASH: 427 case SK_ACID_SPLASH:
427 (void) attack_hth (op, dir, "dissolved", skill); 428 (void) attack_hth (op, dir, "dissolved", skill);
428 break; 429 break;
429 430
430 case SK_POISON_NAIL: 431 case SK_POISON_NAIL:
431 (void) attack_hth (op, dir, "injected poison into", skill); 432 (void) attack_hth (op, dir, "injected poison into", skill);
432 break; 433 break;
433 434
434 case SK_CLAWING: 435 case SK_CLAWING:
435 (void) attack_hth (op, dir, "clawed", skill); 436 (void) attack_hth (op, dir, "clawed", skill);
436 break; 437 break;
437 438
438 case SK_ONE_HANDED_WEAPON: 439 case SK_ONE_HANDED_WEAPON:
439 case SK_TWO_HANDED_WEAPON: 440 case SK_TWO_HANDED_WEAPON:
440 (void) attack_melee_weapon (op, dir, NULL, skill); 441 (void) attack_melee_weapon (op, dir, NULL, skill);
441 break; 442 break;
442 443
443 case SK_FIND_TRAPS: 444 case SK_FIND_TRAPS:
444 exp = success = find_traps (op, skill); 445 exp = success = find_traps (op, skill);
445 break; 446 break;
446 447
447 case SK_SINGING: 448 case SK_SINGING:
448 exp = success = singing (op, dir, skill); 449 exp = success = singing (op, dir, skill);
449 break; 450 break;
450 451
451 case SK_ORATORY: 452 case SK_ORATORY:
452 exp = success = use_oratory (op, dir, skill); 453 exp = success = use_oratory (op, dir, skill);
453 break; 454 break;
454 455
455 case SK_SMITHERY: 456 case SK_SMITHERY:
456 case SK_BOWYER: 457 case SK_BOWYER:
457 case SK_JEWELER: 458 case SK_JEWELER:
458 case SK_ALCHEMY: 459 case SK_ALCHEMY:
459 case SK_THAUMATURGY: 460 case SK_THAUMATURGY:
460 case SK_LITERACY: 461 case SK_LITERACY:
461 case SK_WOODSMAN: 462 case SK_WOODSMAN:
462 /* first, we try to find a cauldron, and do the alchemy thing. 463 /* first, we try to find a cauldron, and do the alchemy thing.
463 * failing that, we go and identify stuff. 464 * failing that, we go and identify stuff.
464 */ 465 */
465 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = next) 466 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = next)
466 { 467 {
467 next = tmp->above; 468 next = tmp->above;
468 469
469 if (QUERY_FLAG (tmp, FLAG_IS_CAULDRON)) 470 if (QUERY_FLAG (tmp, FLAG_IS_CAULDRON))
470 { 471 {
471 attempt_do_alchemy (op, tmp); 472 attempt_do_alchemy (op, tmp);
472 473
473 if (QUERY_FLAG (tmp, FLAG_APPLIED)) 474 if (QUERY_FLAG (tmp, FLAG_APPLIED))
474 esrv_send_inventory (op, tmp); 475 esrv_send_inventory (op, tmp);
475 476
476 did_alc = 1; 477 did_alc = 1;
477 } 478 }
478 } 479 }
479 480
480 if (did_alc == 0) 481 if (did_alc == 0)
481 exp = success = skill_ident (op, skill);
482
483 break;
484
485 case SK_DET_MAGIC:
486 case SK_DET_CURSE:
487 exp = success = skill_ident (op, skill); 482 exp = success = skill_ident (op, skill);
483
488 break; 484 break;
489 485
486 case SK_DET_MAGIC:
487 case SK_DET_CURSE:
488 exp = success = skill_ident (op, skill);
489 break;
490
490 case SK_DISARM_TRAPS: 491 case SK_DISARM_TRAPS:
491 exp = success = remove_trap (op, dir, skill); 492 exp = success = remove_trap (op, dir, skill);
492 break; 493 break;
493 494
494 case SK_THROWING: 495 case SK_THROWING:
495 success = skill_throw (op, part, dir, string, skill); 496 success = skill_throw (op, part, dir, string, skill);
496 break; 497 break;
497 498
498 case SK_SET_TRAP: 499 case SK_SET_TRAP:
499 new_draw_info (NDI_UNIQUE, 0, op, "This skill is not currently implemented."); 500 new_draw_info (NDI_UNIQUE, 0, op, "This skill is not currently implemented.");
500 break; 501 break;
501 502
502 case SK_USE_MAGIC_ITEM: 503 case SK_USE_MAGIC_ITEM:
503 case SK_MISSILE_WEAPON: 504 case SK_MISSILE_WEAPON:
504 new_draw_info (NDI_UNIQUE, 0, op, "There is no special attack for this skill."); 505 new_draw_info (NDI_UNIQUE, 0, op, "There is no special attack for this skill.");
505 break; 506 break;
506 507
507 case SK_PRAYING: 508 case SK_PRAYING:
508 success = pray (op, skill); 509 success = pray (op, skill);
509 break; 510 break;
510 511
511 case SK_BARGAINING: 512 case SK_BARGAINING:
512 success = describe_shop (op); 513 success = describe_shop (op);
513 break; 514 break;
514 515
515 case SK_SORCERY: 516 case SK_SORCERY:
516 case SK_EVOCATION: 517 case SK_EVOCATION:
517 case SK_PYROMANCY: 518 case SK_PYROMANCY:
518 case SK_SUMMONING: 519 case SK_SUMMONING:
519 case SK_CLIMBING: 520 case SK_CLIMBING:
520 new_draw_info (NDI_UNIQUE, 0, op, "This skill is already in effect."); 521 new_draw_info (NDI_UNIQUE, 0, op, "This skill is already in effect.");
521 break; 522 break;
522 523
523 default: 524 default:
524 LOG (llevDebug, "%s attempted to use unknown skill: %d\n", query_name (op), op->chosen_skill->stats.sp); 525 LOG (llevDebug, "%s attempted to use unknown skill: %d\n", query_name (op), op->chosen_skill->stats.sp);
525 break; 526 break;
526 } 527 }
527 528
528 /* For players we now update the speed_left from using the skill. 529 /* For players we now update the speed_left from using the skill.
529 * Monsters have no skill use time because of the random nature in 530 * Monsters have no skill use time because of the random nature in
530 * which use_monster_skill is called already simulates this. 531 * which use_monster_skill is called already simulates this.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines