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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.133 by root, Sat May 12 22:04:20 2007 UTC vs.
Revision 1.136 by root, Wed May 16 11:10:01 2007 UTC

147 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op, 147 draw_ext_info_format (NDI_UNIQUE | NDI_GREEN, 0, op,
148 MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s\n", (char *)"%s\n%s", subject, news); 148 MSG_TYPE_ADMIN, MSG_TYPE_ADMIN_NEWS, "INFORMATION: %s\n%s\n", (char *)"%s\n%s", subject, news);
149 close_and_delete (fp, comp); 149 close_and_delete (fp, comp);
150} 150}
151 151
152float
153player::weapon_speed () const
154{
155 return ob->speed / weapon_sp * .5f;//TODO, the .5 is arbitrary
156}
157
152/* This loads the first map an puts the player on it. */ 158/* This loads the first map an puts the player on it. */
153static void 159static void
154set_first_map (object *op) 160set_first_map (object *op)
155{ 161{
156 op->contr->maplevel = first_map_path; 162 op->contr->maplevel = first_map_path;
1544 { 1550 {
1545 new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); 1551 new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!");
1546 return 0; 1552 return 0;
1547 } 1553 }
1548 1554
1549 if (player *pl = op->contr) 1555 if (op->contr)
1550 { 1556 bow = op->current_weapon;
1551 bow = pl->ranged_ob;
1552 if (!op->change_weapon (bow))
1553 return 0;
1554 }
1555 else 1557 else
1556 { 1558 {
1557 for (bow = op->inv; bow; bow = bow->below) 1559 for (bow = op->inv; bow; bow = bow->below)
1558 /* Don't check for applied - monsters don't apply bows - in that way, they 1560 /* Don't check for applied - monsters don't apply bows - in that way, they
1559 * don't need to switch back and forth between bows and weapons. 1561 * don't need to switch back and forth between bows and weapons.
1632 if (arrow->slaying) 1634 if (arrow->slaying)
1633 arrow->spellarg = strdup (arrow->slaying); 1635 arrow->spellarg = strdup (arrow->slaying);
1634 1636
1635 if (player *pl = op->contr) 1637 if (player *pl = op->contr)
1636 { 1638 {
1639 if (!pl->has_hit)
1640 {
1637 pl->has_hit = 1; 1641 pl->has_hit = 1;
1642 pl->ob->speed_left += pl->weapon_speed () - pl->ob->speed;
1643 }
1638#if 0 1644#if 0
1639 float speed = pl->weapon_sp; 1645 float speed = pl->weapon_sp;
1640 1646
1641 /* penalize ROF for bestarrow */ 1647 /* penalize ROF for bestarrow */
1642 if (pl->bowtype == bow_bestarrow) 1648 if (pl->bowtype == bow_bestarrow)
1746 } 1752 }
1747 1753
1748 return ret; 1754 return ret;
1749} 1755}
1750 1756
1751
1752/* Fires a misc (wand/rod/horn) object in 'dir'. 1757/* Fires a misc (wand/rod/horn) object in 'dir'.
1753 * Broken apart from 'fire' to keep it more readable. 1758 * Broken apart from 'fire' to keep it more readable.
1754 */ 1759 */
1755void 1760void
1756fire_misc_object (object *op, int dir) 1761fire_misc_object (object *op, int dir)
1844 object *ob = pl->ranged_ob; 1849 object *ob = pl->ranged_ob;
1845 1850
1846 if (!ob) 1851 if (!ob)
1847 return; 1852 return;
1848 1853
1854 if (!op->change_weapon (ob))
1855 return;
1856
1849 switch (ob->type) 1857 switch (ob->type)
1850 { 1858 {
1851 case BOW: 1859 case BOW:
1852 player_fire_bow (op, dir); 1860 player_fire_bow (op, dir);
1853 break; 1861 break;
1859 case BUILDER: 1867 case BUILDER:
1860 apply_map_builder (op, dir); 1868 apply_map_builder (op, dir);
1861 break; 1869 break;
1862 1870
1863 case SKILL: 1871 case SKILL:
1864 case SKILL_TOOL:
1865 do_skill (op, op, ob, dir, 0); 1872 do_skill (op, op, ob, dir, 0);
1866 break; 1873 break;
1867 1874
1868 default: 1875 default:
1869 fire_misc_object (op, dir); 1876 fire_misc_object (op, dir);
2167 * that party_number -1 is no party, so attacks can still happen. 2174 * that party_number -1 is no party, so attacks can still happen.
2168 */ 2175 */
2169 else if ((mon->stats.hp >= 0) && QUERY_FLAG (mon, FLAG_ALIVE) && 2176 else if ((mon->stats.hp >= 0) && QUERY_FLAG (mon, FLAG_ALIVE) &&
2170 ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party))) 2177 ((mon->type != PLAYER || op->contr->party == NULL || op->contr->party != mon->contr->party)))
2171 { 2178 {
2179 if (!op->contr->has_hit)
2180 {
2172 op->contr->has_hit = 1; 2181 op->contr->has_hit = 1;
2182 op->speed_left += op->contr->weapon_speed () - op->speed;
2183 }
2173 2184
2174 skill_attack (mon, op, 0, 0, 0); 2185 skill_attack (mon, op, 0, 0, 0);
2175 2186
2176 /* If attacking another player, that player gets automatic 2187 /* If attacking another player, that player gets automatic
2177 * hitback, and doesn't loose luck either. 2188 * hitback, and doesn't loose luck either.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines