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

Comparing deliantra/server/common/living.C (file contents):
Revision 1.55 by root, Sat May 12 19:41:02 2007 UTC vs.
Revision 1.60 by root, Fri May 18 01:01:01 2007 UTC

866 && tmp->subtype == SK_PRAYING)) 866 && tmp->subtype == SK_PRAYING))
867 { 867 {
868 if (type == PLAYER) 868 if (type == PLAYER)
869 { 869 {
870 if (tmp == contr->combat_ob || tmp == contr->ranged_ob) 870 if (tmp == contr->combat_ob || tmp == contr->ranged_ob)
871 if (tmp != current_weapon
871 if (tmp != current_weapon && (tmp->type != SKILL || tmp->subtype != SK_PRAYING)) 872 && (tmp->type != SKILL || tmp->subtype != SK_PRAYING)
873 && !tmp->flag [FLAG_CURSED]
874 && !tmp->flag [FLAG_DAMNED])
872 continue; 875 continue;
873 876
874 for (i = 0; i < NUM_STATS; i++) 877 for (i = 0; i < NUM_STATS; i++)
875 change_attr_value (&stats, i, tmp->stats.stat (i)); 878 change_attr_value (&stats, i, tmp->stats.stat (i));
876 879
877 /* these are the items that currently can change digestion, regeneration, 880 /* These are the items that currently can change digestion, regeneration,
878 * spell point recovery and mana point recovery. Seems sort of an arbitary 881 * spell point recovery and mana point recovery. Seems sort of an arbitary
879 * list, but other items store other info into stats array. 882 * list, but other items store other info into stats array.
880 */ 883 */
881 if (tmp->type == WEAPON || tmp->type == BOW || 884 if (tmp->type == WEAPON || tmp->type == BOW ||
882 tmp->type == ARMOUR || tmp->type == HELMET || 885 tmp->type == ARMOUR || tmp->type == HELMET ||
883 tmp->type == SHIELD || tmp->type == RING || 886 tmp->type == SHIELD || tmp->type == RING ||
995 case SKILL: 998 case SKILL:
996 if (!QUERY_FLAG (tmp, FLAG_APPLIED)) 999 if (!QUERY_FLAG (tmp, FLAG_APPLIED))
997 break; 1000 break;
998 1001
999 if (chosen_skill) 1002 if (chosen_skill)
1000 LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); 1003 LOG (llevDebug, "fix_player, op %s has multiple skills applied (%s and %s)\n",
1004 &name, &chosen_skill->name, &tmp->name);
1001 1005
1002 chosen_skill = tmp; 1006 chosen_skill = tmp;
1003 1007
1004 if (tmp->stats.dam > 0) 1008 if (tmp->stats.dam > 0)
1005 { /* skill is a 'weapon' */ 1009 { /* skill is a 'weapon' */
1026 ac -= tmp->stats.ac + tmp->magic; 1030 ac -= tmp->stats.ac + tmp->magic;
1027 1031
1028 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1032 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1029 contr->encumbrance += (int) 3 *tmp->weight / 1000; 1033 contr->encumbrance += (int) 3 *tmp->weight / 1000;
1030 1034
1031 break;
1032
1033 case SKILL_TOOL:
1034 if (chosen_skill)
1035 LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name);
1036
1037 chosen_skill = tmp;
1038 break; 1035 break;
1039 1036
1040 case SHIELD: 1037 case SHIELD:
1041 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1038 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1042 contr->encumbrance += (int) tmp->weight / 2000; 1039 contr->encumbrance += (int) tmp->weight / 2000;
1360 * that would just be a real pain to read. 1357 * that would just be a real pain to read.
1361 */ 1358 */
1362 float M = (max_carry[stats.Str] - 121) / 121.f; 1359 float M = (max_carry[stats.Str] - 121) / 121.f;
1363 float M2 = max_carry[stats.Str] / 100.f; 1360 float M2 = max_carry[stats.Str] / 100.f;
1364 float W = weapon_weight / 20000.f; 1361 float W = weapon_weight / 20000.f;
1365 float s = 2 - weapon_speed / 10.f; 1362 float s = (20 - weapon_speed) / 10.f;
1366 float D = (stats.Dex - 14) / 14.f; 1363 float D = (stats.Dex - 14) / 14.f;
1367 float K = 1 + M / 3.f - W / (3 * M2) + speed / 5.f + D / 2.f; 1364 float K = 1 + M / 3.f - W / (3 * M2) + speed / 5.f + D / 2.f;
1368 1365
1369 K *= (4 + level) *1.2f / (6 + level); 1366 K *= (4 + level) * 1.2f / (6 + level);
1370 1367
1371 if (K <= 0.f) 1368 if (K <= 0.01f)
1372 K = 0.01f; 1369 K = 0.01f;
1373 1370
1374 float S = speed / (K * s); 1371 float S = speed / (K * s);
1375 1372
1376 contr->weapon_sp = S; 1373 contr->weapon_sp = S;
1378 1375
1379 /* I want to limit the power of small monsters with big weapons: */ 1376 /* I want to limit the power of small monsters with big weapons: */
1380 if (type != PLAYER && arch && stats.dam > arch->clone.stats.dam * 3) 1377 if (type != PLAYER && arch && stats.dam > arch->clone.stats.dam * 3)
1381 stats.dam = arch->clone.stats.dam * 3; 1378 stats.dam = arch->clone.stats.dam * 3;
1382 1379
1383 /* Prevent overflows of wc - best you can get is ABS(120) - this 1380 stats.wc = clamp (wc, MIN_WC, MAX_WC);
1384 * should be more than enough - remember, AC is also in 8 bits, 1381 stats.ac = clamp (ac, MIN_AC, MAX_AC);
1385 * so its value is the same.
1386 */
1387 if (wc > 120)
1388 wc = 120;
1389 else if (wc < -120)
1390 wc = -120;
1391
1392 stats.wc = wc;
1393
1394 if (ac > 120)
1395 ac = 120;
1396 else if (ac < -120)
1397 ac = -120;
1398
1399 stats.ac = ac;
1400 1382
1401 /* if for some reason the creature doesn't have any move type, 1383 /* if for some reason the creature doesn't have any move type,
1402 * give them walking as a default. 1384 * give them walking as a default.
1403 * The second case is a special case - to more closely mimic the 1385 * The second case is a special case - to more closely mimic the
1404 * old behaviour - if your flying, your not walking - just 1386 * old behaviour - if your flying, your not walking - just
1593 CLEAR_FLAG (skill_obj, FLAG_CAN_USE_SKILL); 1575 CLEAR_FLAG (skill_obj, FLAG_CAN_USE_SKILL);
1594 skill_obj->stats.exp = 0; 1576 skill_obj->stats.exp = 0;
1595 skill_obj->level = 1; 1577 skill_obj->level = 1;
1596 insert_ob_in_ob (skill_obj, op); 1578 insert_ob_in_ob (skill_obj, op);
1597 1579
1598 if (op->contr) 1580 if (player *pl = op->contr)
1599 { 1581 {
1600 op->contr->last_skill_ob [skill_obj->subtype] = skill_obj; 1582 pl->last_skill_ob [skill_obj->subtype] = skill_obj;
1601 if (op->contr->ns) 1583 if (pl->ns)
1602 op->contr->ns->last_skill_exp[skill_obj->subtype] = -1;//TODO: should be made superfluous 1584 pl->ns->last_skill_exp[skill_obj->subtype] = -1;//TODO: should be made superfluous
1603 } 1585 }
1604 1586
1605 return skill_obj; 1587 return skill_obj;
1606} 1588}
1607 1589

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines