… | |
… | |
1028 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |
1028 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |
1029 | contr->encumbrance += (int) 3 *tmp->weight / 1000; |
1029 | contr->encumbrance += (int) 3 *tmp->weight / 1000; |
1030 | |
1030 | |
1031 | break; |
1031 | break; |
1032 | |
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; |
|
|
1039 | |
|
|
1040 | case SHIELD: |
1033 | case SHIELD: |
1041 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |
1034 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |
1042 | contr->encumbrance += (int) tmp->weight / 2000; |
1035 | contr->encumbrance += (int) tmp->weight / 2000; |
1043 | case RING: |
1036 | case RING: |
1044 | case AMULET: |
1037 | case AMULET: |
… | |
… | |
1360 | * that would just be a real pain to read. |
1353 | * that would just be a real pain to read. |
1361 | */ |
1354 | */ |
1362 | float M = (max_carry[stats.Str] - 121) / 121.f; |
1355 | float M = (max_carry[stats.Str] - 121) / 121.f; |
1363 | float M2 = max_carry[stats.Str] / 100.f; |
1356 | float M2 = max_carry[stats.Str] / 100.f; |
1364 | float W = weapon_weight / 20000.f; |
1357 | float W = weapon_weight / 20000.f; |
1365 | float s = 2 - weapon_speed / 10.f; |
1358 | float s = (20 - weapon_speed) / 10.f; |
1366 | float D = (stats.Dex - 14) / 14.f; |
1359 | float D = (stats.Dex - 14) / 14.f; |
1367 | float K = 1 + M / 3.f - W / (3 * M2) + speed / 5.f + D / 2.f; |
1360 | float K = 1 + M / 3.f - W / (3 * M2) + speed / 5.f + D / 2.f; |
1368 | |
1361 | |
1369 | K *= (4 + level) *1.2f / (6 + level); |
1362 | K *= (4 + level) * 1.2f / (6 + level); |
1370 | |
1363 | |
1371 | if (K <= 0.f) |
1364 | if (K <= 0.01f) |
1372 | K = 0.01f; |
1365 | K = 0.01f; |
1373 | |
1366 | |
1374 | float S = speed / (K * s); |
1367 | float S = speed / (K * s); |
1375 | |
1368 | |
1376 | contr->weapon_sp = S; |
1369 | contr->weapon_sp = S; |
… | |
… | |
1378 | |
1371 | |
1379 | /* I want to limit the power of small monsters with big weapons: */ |
1372 | /* I want to limit the power of small monsters with big weapons: */ |
1380 | if (type != PLAYER && arch && stats.dam > arch->clone.stats.dam * 3) |
1373 | if (type != PLAYER && arch && stats.dam > arch->clone.stats.dam * 3) |
1381 | stats.dam = arch->clone.stats.dam * 3; |
1374 | stats.dam = arch->clone.stats.dam * 3; |
1382 | |
1375 | |
1383 | /* Prevent overflows of wc - best you can get is ABS(120) - this |
1376 | stats.wc = clamp (wc, MIN_WC, MAX_WC); |
1384 | * should be more than enough - remember, AC is also in 8 bits, |
1377 | 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 | |
1378 | |
1401 | /* if for some reason the creature doesn't have any move type, |
1379 | /* if for some reason the creature doesn't have any move type, |
1402 | * give them walking as a default. |
1380 | * give them walking as a default. |
1403 | * The second case is a special case - to more closely mimic the |
1381 | * The second case is a special case - to more closely mimic the |
1404 | * old behaviour - if your flying, your not walking - just |
1382 | * old behaviour - if your flying, your not walking - just |
… | |
… | |
1593 | CLEAR_FLAG (skill_obj, FLAG_CAN_USE_SKILL); |
1571 | CLEAR_FLAG (skill_obj, FLAG_CAN_USE_SKILL); |
1594 | skill_obj->stats.exp = 0; |
1572 | skill_obj->stats.exp = 0; |
1595 | skill_obj->level = 1; |
1573 | skill_obj->level = 1; |
1596 | insert_ob_in_ob (skill_obj, op); |
1574 | insert_ob_in_ob (skill_obj, op); |
1597 | |
1575 | |
1598 | if (op->contr) |
1576 | if (player *pl = op->contr) |
1599 | { |
1577 | { |
1600 | op->contr->last_skill_ob [skill_obj->subtype] = skill_obj; |
1578 | pl->last_skill_ob [skill_obj->subtype] = skill_obj; |
1601 | if (op->contr->ns) |
1579 | if (pl->ns) |
1602 | op->contr->ns->last_skill_exp[skill_obj->subtype] = -1;//TODO: should be made superfluous |
1580 | pl->ns->last_skill_exp[skill_obj->subtype] = -1;//TODO: should be made superfluous |
1603 | } |
1581 | } |
1604 | |
1582 | |
1605 | return skill_obj; |
1583 | return skill_obj; |
1606 | } |
1584 | } |
1607 | |
1585 | |