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.290 by root, Mon Oct 29 23:55:55 2012 UTC vs.
Revision 1.296 by root, Thu Nov 17 04:59:33 2016 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
734 ob->player_goto (format ("%s/%s", &first_map_ext_path, &ob->arch->archname), ob->x, ob->y); 734 ob->player_goto (format ("%s/%s", &first_map_ext_path, &ob->arch->archname), ob->x, ob->y);
735 else 735 else
736 LOG (llevDebug, "first_map_ext_path not set\n"); 736 LOG (llevDebug, "first_map_ext_path not set\n");
737} 737}
738 738
739/*
740 * Returns true if the given player is a legal class.
741 * The function to add and remove class-bonuses to the stats doesn't
742 * check if the stat becomes negative, thus this function
743 * merely checks that all stats are 1 or more, and returns
744 * false otherwise.
745 */
746static int
747allowed_class (const object *op)
748{
749 return op->stats.Dex > 0
750 && op->stats.Str > 0
751 && op->stats.Con > 0
752 && op->stats.Int > 0
753 && op->stats.Wis > 0
754 && op->stats.Pow > 0
755 && op->stats.Cha > 0;
756}
757
739void 758void
740player::chargen_race_next () 759player::chargen_race_next ()
741{ 760{
742 /* Following actually changes the race - this is the default command 761 /* Following actually changes the race - this is the default command
743 * if we don't match with one of the options above. 762 * if we don't match with one of the options above.
1445 SET_ANIMATION (arrow, arrow->direction); 1464 SET_ANIMATION (arrow, arrow->direction);
1446 1465
1447 /* update the speed */ 1466 /* update the speed */
1448 1467
1449 arrow->speed_left = 0; 1468 arrow->speed_left = 0;
1450 arrow->set_speed (max (2.f, 1469 arrow->set_speed (max (2.f,
1451 ((bow->flag [FLAG_NO_STRENGTH] ? 0 : dam_bonus[op->stats.Str]) + bow->magic + arrow->magic) / 5.f 1470 ((bow->flag [FLAG_NO_STRENGTH] ? 0 : dam_bonus[op->stats.Str]) + bow->magic + arrow->magic) / 5.f
1452 + bow->stats.dam / 7.f 1471 + bow->stats.dam / 7.f
1453 )); 1472 ));
1454 1473
1455 int wc = op->stats.wc + wc_mod - arrow->magic - arrow->stats.wc; 1474 int wc = op->stats.wc + wc_mod - arrow->magic - arrow->stats.wc;
1479 arrow->stats.dam = clamp (arrow->stats.dam + op->stats.dam + arrow->magic, MIN_DAM, MAX_DAM); 1498 arrow->stats.dam = clamp (arrow->stats.dam + op->stats.dam + arrow->magic, MIN_DAM, MAX_DAM);
1480 1499
1481 arrow->stats.wc = clamp (wc, MIN_WC, MAX_WC); 1500 arrow->stats.wc = clamp (wc, MIN_WC, MAX_WC);
1482 arrow->move_type = MOVE_FLY_LOW; 1501 arrow->move_type = MOVE_FLY_LOW;
1483 arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; 1502 arrow->move_on = MOVE_FLY_LOW | MOVE_WALK;
1503 arrow->set_flag (FLAG_NO_PICK);
1484 1504
1485 op->play_sound (sound_find ("fire_arrow")); 1505 op->play_sound (sound_find ("fire_arrow"));
1486 m->insert (arrow, sx, sy, op); 1506 m->insert (arrow, sx, sy, op);
1487 1507
1488 if (!arrow->destroyed ()) 1508 if (!arrow->destroyed ())
2171 int rate_grace = 2000; 2191 int rate_grace = 2000;
2172 const int max_hp = 1; 2192 const int max_hp = 1;
2173 const int max_sp = 1; 2193 const int max_sp = 1;
2174 const int max_grace = 1; 2194 const int max_grace = 1;
2175 2195
2196#if 0
2176 if (op->contr->hidden) 2197 if (op->contr->hidden)
2177 { 2198 {
2178 op->invisible = 1000; 2199 op->invisible = 1000;
2179 /* the socket code flashes the player visible/invisible 2200 /* the socket code flashes the player visible/invisible
2180 * depending on the value of invisible, so we need to 2201 * depending on the value of invisible, so we need to
2181 * alternate it here for it to work correctly. 2202 * alternate it here for it to work correctly.
2182 */ 2203 */
2183 if (server_tick & 2) 2204 if (server_tick & 2)
2184 op->invisible--; 2205 op->invisible--;
2185 } 2206 }
2207 else
2208#endif
2186 else if (op->invisible && !(op->flag [FLAG_MAKE_INVIS])) 2209 if (op->invisible && !(op->flag [FLAG_MAKE_INVIS]))
2187 { 2210 {
2188 if (!op->invisible--) 2211 if (!op->invisible--)
2189 { 2212 {
2190 make_visible (op); 2213 make_visible (op);
2191 new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out."); 2214 new_draw_info (NDI_UNIQUE, 0, op, "Your invisibility spell runs out.");
2739void 2762void
2740fix_weight () 2763fix_weight ()
2741{ 2764{
2742 for_all_players (pl) 2765 for_all_players (pl)
2743 { 2766 {
2744 sint32 old = pl->ob->carrying; 2767 weight_t old = pl->ob->carrying;
2745 2768
2746 pl->ob->update_weight (); 2769 pl->ob->update_weight ();
2747 2770
2748 if (old != pl->ob->carrying) 2771 if (old != pl->ob->carrying)
2749 { 2772 {
2944 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) 2967 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
2945 { 2968 {
2946 if ((player ||friendly) &&tmp->flag [FLAG_MONSTER] && !tmp->flag [FLAG_UNAGGRESSIVE]) 2969 if ((player ||friendly) &&tmp->flag [FLAG_MONSTER] && !tmp->flag [FLAG_UNAGGRESSIVE])
2947 return 1; 2970 return 1;
2948 else if (tmp->type == PLAYER) 2971 else if (tmp->type == PLAYER)
2949 {
2950 /*don't let a hidden DM prevent you from hiding */
2951 if (!tmp->flag [FLAG_WIZ] || tmp->contr->hidden == 0)
2952 return 1; 2972 return 1;
2953 }
2954 } 2973 }
2955 } 2974 }
2956 return 0; 2975 return 0;
2957} 2976}
2958 2977
2959/* check the player los field for viewability of the 2978/* check the player los field for viewability of the
2960 * object op. This function works fine for monsters, 2979 * object op. This function works fine for monsters,
2961 * but we dont worry if the object isnt the top one in 2980 * but we dont worry if the object isnt the top one in
2962 * a pile (say a coin under a table would return "viewable" 2981 * a pile (say a coin under a table would return "viewable"
2963 * by this routine). Another question, should we be 2982 * by this routine). Another question, should we be
2964 * concerned with the direction the player is looking 2983 * concerned with the direction the player is looking
2965 * in? Realistically, most of us can't see stuff behind 2984 * in? Realistically, most of us can't see stuff behind
2966 * our backs...on the other hand, does the "facing" direction 2985 * our backs...on the other hand, does the "facing" direction
2967 * imply the way your head, or body is facing? It's possible 2986 * imply the way your head, or body is facing? It's possible
2968 * for them to differ. Sigh, this fctn could get a bit more complex. 2987 * for them to differ. Sigh, this fctn could get a bit more complex.
2969 * -b.t. 2988 * -b.t.
2970 * This function is now map tiling safe. 2989 * This function is now map tiling safe.
2971 */ 2990 */
2972int 2991int
2973player_can_view (object *pl, object *op) 2992player_can_view (object *pl, object *op)
2974{ 2993{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines