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

Comparing deliantra/server/server/attack.C (file contents):
Revision 1.91 by root, Wed Sep 24 02:28:36 2008 UTC vs.
Revision 1.92 by root, Thu Sep 25 04:09:57 2008 UTC

1381 */ 1381 */
1382int 1382int
1383kill_object (object *op, int dam, object *hitter, int type) 1383kill_object (object *op, int dam, object *hitter, int type)
1384{ 1384{
1385 char buf[MAX_BUF]; 1385 char buf[MAX_BUF];
1386 const char *skill; 1386 shstr skill;
1387 int maxdam = 0; 1387 int maxdam = 0;
1388 int battleg = 0; /* true if op standing on battleground */ 1388 int battleg = 0; /* true if op standing on battleground */
1389 int pk = 0; /* true if op and what controls hitter are both players */ 1389 int pk = 0; /* true if op and what controls hitter are both players */
1390 object *owner = 0; 1390 object *owner = 0;
1391 object *skop = 0; 1391 object *skop = 0;
1480 1480
1481 /* This code below deals with finding the appropriate skill 1481 /* This code below deals with finding the appropriate skill
1482 * to credit exp to. This is a bit problematic - we should 1482 * to credit exp to. This is a bit problematic - we should
1483 * probably never really have to look at current_weapon->skill 1483 * probably never really have to look at current_weapon->skill
1484 */ 1484 */
1485 skill = 0;
1486
1487 if (hitter->skill && hitter->type != PLAYER) 1485 if (hitter->skill && hitter->type != PLAYER)
1488 skill = hitter->skill; 1486 skill = hitter->skill;
1489 else if (owner->chosen_skill) 1487 else if (owner->chosen_skill)
1490 { 1488 {
1491 skop = owner->chosen_skill; 1489 skop = owner->chosen_skill;
1492 skill = skop->skill; 1490 skill = skop->skill;
1493 } 1491 }
1494 else if (QUERY_FLAG (owner, FLAG_READY_WEAPON)) 1492 else if (QUERY_FLAG (owner, FLAG_READY_WEAPON))
1495 skill = owner->current_weapon->skill; 1493 skill = owner->current_weapon->skill;
1496 else 1494 else
1495 {
1497 LOG (llevError, "kill_object - unable to find skill that killed monster\n"); 1496 LOG (llevError, "kill_object - unable to find skill that killed monster\n");
1497 skill = 0;
1498 }
1498 1499
1499 /* We have the skill we want to credit to - now find the object this goes 1500 /* We have the skill we want to credit to - now find the object this goes
1500 * to. Make sure skop is an actual skill, and not a skill tool! 1501 * to. Make sure skop is an actual skill, and not a skill tool!
1501 */ 1502 */
1502 if ((!skop || skop->type != SKILL) && skill) 1503 if ((!skop || skop->type != SKILL) && skill)
1503 for (int i = 0; i < NUM_SKILLS; i++) 1504 for (object *tmp = owner->inv; tmp; tmp = tmp->below)
1504 if (owner->contr->last_skill_ob[i] && !strcmp (owner->contr->last_skill_ob[i]->skill, skill)) 1505 if (tmp->skill == skill && tmp->type == SKILL)
1505 { 1506 {
1506 skop = owner->contr->last_skill_ob[i]; 1507 skop = splay (tmp);
1507 break; 1508 break;
1508 } 1509 }
1509 } /* Was it a player that hit somethign */ 1510 } /* Was it a player that hit somethign */
1510 else 1511 else
1511 skill = 0; 1512 skill = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines