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.84 by root, Fri May 2 20:24:48 2008 UTC vs.
Revision 1.89 by root, Thu Sep 25 04:09:57 2008 UTC

400 /* MOVE_FLY_HIGH trumps MOVE_FLY_LOW - changing your move_fly_low 400 /* MOVE_FLY_HIGH trumps MOVE_FLY_LOW - changing your move_fly_low
401 * status doesn't make a difference if you are flying high 401 * status doesn't make a difference if you are flying high
402 */ 402 */
403 if (tmp->move_type & MOVE_FLY_LOW && !(op->move_type & MOVE_FLY_HIGH)) 403 if (tmp->move_type & MOVE_FLY_LOW && !(op->move_type & MOVE_FLY_HIGH))
404 { 404 {
405 DIFF_MSG (flag, "You start to float in the air!.", "You float down to the ground."); 405 DIFF_MSG (flag, "You start to float in the air!", "You float down to the ground.");
406 } 406 }
407 407
408 if (tmp->move_type & MOVE_FLY_HIGH) 408 if (tmp->move_type & MOVE_FLY_HIGH)
409 { 409 {
410 /* double conditional - second case covers if you have move_fly_low - 410 /* double conditional - second case covers if you have move_fly_low -
861 continue; 861 continue;
862 862
863 /* See note in map.c:update_position about making this additive 863 /* See note in map.c:update_position about making this additive
864 * since light sources are never applied, need to put check here. 864 * since light sources are never applied, need to put check here.
865 */ 865 */
866 if (tmp->glow_radius > glow_radius)
867 glow_radius = tmp->glow_radius; 866 glow_radius = max (glow_radius, tmp->glow_radius);
868 867
869 /* For some things, we don't care what is equipped */ 868 /* For some things, we don't care what is equipped */
870 if (tmp->type == SKILL) 869 if (tmp->type == SKILL)
871 { 870 {
872 /* Want to take the highest skill here. */ 871 /* Want to take the highest skill here. */
885 else if (tmp->level > grace_obj->level) 884 else if (tmp->level > grace_obj->level)
886 grace_obj = tmp; 885 grace_obj = tmp;
887 } 886 }
888 } 887 }
889 888
890 /* Container objects are not meant to adjust a players, but other applied 889 /* Container objects are not meant to adjust players, but other applied
891 * objects need to make adjustments. 890 * objects need to make adjustments.
892 * This block should handle all player specific changes 891 * This block should handle all player specific changes
893 * The check for Praying is a bit of a hack - god given bonuses are put 892 * The check for Praying is a bit of a hack - god given bonuses are put
894 * in the praying skill, and the player should always get those. 893 * in the praying skill, and the player should always get those.
895 * It also means we need to put in additional checks for applied below, 894 * It also means we need to put in additional checks for applied below,
918 917
919 if (digest_types [tmp->type]) 918 if (digest_types [tmp->type])
920 { 919 {
921 contr->digestion += tmp->stats.food; 920 contr->digestion += tmp->stats.food;
922 contr->gen_hp += tmp->stats.hp; 921 contr->gen_hp += tmp->stats.hp;
922 if (tmp->type != BOW) // ugly exception for bows
923 contr->gen_sp += tmp->stats.sp; 923 contr->gen_sp += tmp->stats.sp;
924 contr->gen_grace += tmp->stats.grace; 924 contr->gen_grace += tmp->stats.grace;
925 contr->gen_sp_armour += tmp->gen_sp_armour; 925 contr->gen_sp_armour += tmp->gen_sp_armour;
926 } 926 }
927 } /* if this is a player */ 927 } /* if this is a player */
928 else 928 else
938 938
939 if (tmp->type == SYMPTOM) 939 if (tmp->type == SYMPTOM)
940 speed_reduce_from_disease = 940 speed_reduce_from_disease =
941 min (speed_reduce_from_disease, tmp->last_sp ? tmp->last_sp / 100.f : 1.f); 941 min (speed_reduce_from_disease, tmp->last_sp ? tmp->last_sp / 100.f : 1.f);
942 942
943 /* Pos. and neg. protections are counted seperate (-> pro/vuln). 943 /* Pos. and neg. protections are counted separate (-> pro/vuln).
944 * (Negative protections are calculated exactly like positive.) 944 * (Negative protections are calculated exactly like positive.)
945 * Resistance from potions are treated special as well. If there's 945 * Resistance from potions are treated special as well. If there's
946 * more than one potion-effect, the bigger prot.-value is taken. 946 * more than one potion-effect, the bigger prot.-value is taken.
947 */ 947 */
948 if (tmp->type != POTION) 948 if (tmp->type != POTION)
1442 1442
1443/* 1443/*
1444 * set the new dragon name after gaining levels or 1444 * set the new dragon name after gaining levels or
1445 * changing ability focus (later this can be extended to 1445 * changing ability focus (later this can be extended to
1446 * eventually change the player's face and animation) 1446 * eventually change the player's face and animation)
1447 *
1448 * Note that the title is written to 'own_title' in the
1449 * player struct. This should be changed to 'ext_title'
1450 * as soon as clients support this!
1451 * Please, anyone, write support for 'ext_title'.
1452 */ 1447 */
1453void 1448void
1454set_dragon_name (object *pl, const object *abil, const object *skin) 1449set_dragon_name (object *pl, const object *abil, const object *skin)
1455{ 1450{
1456 int atnr = -1; /* attacknumber of highest level */ 1451 int atnr = -1; /* attacknumber of highest level */
1474 /* now if there are equals at highest level, pick the one with focus, 1469 /* now if there are equals at highest level, pick the one with focus,
1475 or else at random */ 1470 or else at random */
1476 if (atnr_is_dragon_enabled (abil->stats.exp) && abil->resist[abil->stats.exp] >= level) 1471 if (atnr_is_dragon_enabled (abil->stats.exp) && abil->resist[abil->stats.exp] >= level)
1477 atnr = abil->stats.exp; 1472 atnr = abil->stats.exp;
1478 1473
1479 level = (int) (level / 25.);
1480
1481 /* now set the new title */ 1474 /* now set the new title */
1482 if (pl->contr)
1483 {
1484 if (level == 0)
1485 sprintf (pl->contr->title, "%s hatchling", attacks[atnr]); 1475 if (level < 25) sprintf (pl->contr->title, "%s hatchling", attacks[atnr]);
1486 else if (level == 1)
1487 sprintf (pl->contr->title, "%s wyrm", attacks[atnr]); 1476 else if (level < 50) sprintf (pl->contr->title, "%s wyrm" , attacks[atnr]);
1488 else if (level == 2)
1489 sprintf (pl->contr->title, "%s wyvern", attacks[atnr]); 1477 else if (level < 75) sprintf (pl->contr->title, "%s wyvern" , attacks[atnr]);
1490 else if (level == 3)
1491 sprintf (pl->contr->title, "%s dragon", attacks[atnr]); 1478 else if (level < 100) sprintf (pl->contr->title, "%s dragon" , attacks[atnr]);
1492 else 1479 else
1493 { 1480 {
1494 /* special titles for extra high resistance! */ 1481 /* special titles for extra high resistance! */
1495 if (skin->resist[atnr] > 80)
1496 sprintf (pl->contr->title, "legendary %s dragon", attacks[atnr]); 1482 if (skin->resist[atnr] > 80) sprintf (pl->contr->title, "legendary %s dragon", attacks[atnr]);
1497 else if (skin->resist[atnr] > 50)
1498 sprintf (pl->contr->title, "ancient %s dragon", attacks[atnr]); 1483 else if (skin->resist[atnr] > 50) sprintf (pl->contr->title, "ancient %s dragon" , attacks[atnr]);
1499 else
1500 sprintf (pl->contr->title, "big %s dragon", attacks[atnr]); 1484 else sprintf (pl->contr->title, "big %s dragon" , attacks[atnr]);
1501 }
1502 } 1485 }
1503 1486
1504 strcpy (pl->contr->own_title, ""); 1487 strcpy (pl->contr->own_title, "");
1505} 1488}
1506 1489
1573 object *skill_obj; 1556 object *skill_obj;
1574 1557
1575 skill_obj = get_archetype_by_skill_name (skill_name, SKILL); 1558 skill_obj = get_archetype_by_skill_name (skill_name, SKILL);
1576 if (!skill_obj) 1559 if (!skill_obj)
1577 { 1560 {
1578 LOG (llevError, "add_player_exp: couldn't find skill %s\n", skill_name); 1561 LOG (llevError, "give_skill_by_name: couldn't find skill %s\n", skill_name);
1579 return NULL; 1562 return NULL;
1580 } 1563 }
1581 1564
1582 /* clear the flag - exp goes into this bucket, but player 1565 /* clear the flag - exp goes into this bucket, but player
1583 * still doesn't know it. 1566 * still doesn't know it.
1584 */ 1567 */
1585 CLEAR_FLAG (skill_obj, FLAG_CAN_USE_SKILL); 1568 CLEAR_FLAG (skill_obj, FLAG_CAN_USE_SKILL);
1586 skill_obj->stats.exp = 0; 1569 skill_obj->stats.exp = 0;
1587 skill_obj->level = 1; 1570 skill_obj->level = 1;
1588 insert_ob_in_ob (skill_obj, op); 1571 op->insert (skill_obj);
1589 1572
1590 if (player *pl = op->contr) 1573 if (player *pl = op->contr)
1591 { 1574 pl->link_skills ();
1592 pl->last_skill_ob [skill_obj->subtype] = skill_obj;
1593 if (pl->ns)
1594 pl->ns->last_skill_exp[skill_obj->subtype] = -1;//TODO: should be made superfluous
1595 }
1596 1575
1597 return skill_obj; 1576 return skill_obj;
1598} 1577}
1599 1578
1600/* player_lvl_adj() - for the new exp system. we are concerned with 1579/* player_lvl_adj() - for the new exp system. we are concerned with
1738 { 1717 {
1739 if (op->chosen_skill && op->chosen_skill->type == SKILL && !strcmp (skill_name, op->chosen_skill->skill)) 1718 if (op->chosen_skill && op->chosen_skill->type == SKILL && !strcmp (skill_name, op->chosen_skill->skill))
1740 skill_obj = op->chosen_skill; 1719 skill_obj = op->chosen_skill;
1741 else 1720 else
1742 { 1721 {
1743 for (i = 0; i < NUM_SKILLS; i++) 1722 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1744 if (op->contr->last_skill_ob[i] && !strcmp (op->contr->last_skill_ob[i]->skill, skill_name)) 1723 if (tmp->skill == skill_name && tmp->type == SKILL)
1745 { 1724 {
1746 skill_obj = op->contr->last_skill_ob[i]; 1725 skill_obj = splay (tmp);
1747 break; 1726 break;
1748 } 1727 }
1749 1728
1750 /* Player doesn't have the skill. Check to see what to do, and give 1729 /* Player doesn't have the skill. Check to see what to do, and give
1751 * it to the player if necessary 1730 * it to the player if necessary
1753 if (!skill_obj) 1732 if (!skill_obj)
1754 { 1733 {
1755 if (flag == SK_EXP_NONE) 1734 if (flag == SK_EXP_NONE)
1756 return; 1735 return;
1757 else if (flag == SK_EXP_ADD_SKILL) 1736 else if (flag == SK_EXP_ADD_SKILL)
1758 give_skill_by_name (op, skill_name); 1737 skill_obj = give_skill_by_name (op, skill_name);
1759 } 1738 }
1760 } 1739 }
1761 } 1740 }
1762 1741
1763 if (flag != SK_EXP_SKILL_ONLY) 1742 if (flag != SK_EXP_SKILL_ONLY)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines