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

Comparing deliantra/server/server/attack.C (file contents):
Revision 1.81 by root, Tue Apr 22 02:46:18 2008 UTC vs.
Revision 1.85 by root, Tue May 6 16:44:54 2008 UTC

62 CLEAR_FLAG (op, FLAG_DAMNED); 62 CLEAR_FLAG (op, FLAG_DAMNED);
63 CLEAR_FLAG (op, FLAG_CURSED); 63 CLEAR_FLAG (op, FLAG_CURSED);
64 CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); 64 CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL);
65 CLEAR_FLAG (op, FLAG_KNOWN_CURSED); 65 CLEAR_FLAG (op, FLAG_KNOWN_CURSED);
66 66
67 if (op->env && op->env->type == PLAYER) 67 if (object *pl = op->visible_to ())
68 esrv_send_item (op->env, op); 68 esrv_update_item (UPD_FLAGS, pl, op);
69 } 69 }
70} 70}
71 71
72/* did_make_save_item just checks to make sure the item actually 72/* did_make_save_item just checks to make sure the item actually
73 * made its saving throw based on the tables. It does not take 73 * made its saving throw based on the tables. It does not take
166 const char *arch = op->other_arch->archname; 166 const char *arch = op->other_arch->archname;
167 167
168 if (op->decrease ()) 168 if (op->decrease ())
169 fix_stopped_item (op, m, originator); 169 fix_stopped_item (op, m, originator);
170 170
171 if ((op = get_archetype (arch))) 171 if ((op = archetype::get (arch)))
172 { 172 {
173 if (env) 173 if (env)
174 { 174 {
175 op->x = env->x, op->y = env->y; 175 op->x = env->x, op->y = env->y; //???? wtf
176 insert_ob_in_ob (op, env); 176 env->insert (op);
177 if (env->contr)
178 esrv_send_item (env, op);
179 } 177 }
180 else 178 else
181 { 179 {
182 op->x = x, op->y = y; 180 op->x = x, op->y = y;
183 insert_ob_in_map (op, m, originator, 0); 181 insert_ob_in_map (op, m, originator, 0);
203 op->destroy (); 201 op->destroy ();
204 202
205 if (type & (AT_FIRE | AT_ELECTRICITY)) 203 if (type & (AT_FIRE | AT_ELECTRICITY))
206 if (env) 204 if (env)
207 { 205 {
208 op = get_archetype ("burnout"); 206 op = archetype::get (shstr_burnout);
209 op->x = env->x, op->y = env->y; 207 op->x = env->x, op->y = env->y;
210 insert_ob_in_ob (op, env); 208 env->insert (op);
211 } 209 }
212 else 210 else
213 replace_insert_ob_in_map ("burnout", originator); 211 replace_insert_ob_in_map (shstr_burnout, originator);
214 212
215 return; 213 return;
216 } 214 }
217 215
218 /* The value of 50 is arbitrary. */ 216 /* The value of 50 is arbitrary. */
219 if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2)) 217 if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2))
220 { 218 {
221 object *tmp; 219 object *tmp;
222 archetype *at = archetype::find ("icecube"); 220 archetype *at = archetype::find (shstr_icecube);
223 221
224 if (at == NULL) 222 if (at == NULL)
225 return; 223 return;
226 224
227 op = stop_item (op); 225 op = stop_item (op);
871 * debate - 5000 is 5 kg, so arrows, knives, and other light weapons 869 * debate - 5000 is 5 kg, so arrows, knives, and other light weapons
872 * stick around. 870 * stick around.
873 */ 871 */
874 if (op->weight <= 5000 && tmp->stats.hp >= 0) 872 if (op->weight <= 5000 && tmp->stats.hp >= 0)
875 { 873 {
876 tmp = tmp->head_ (); 874 tmp->head_ ()->insert (op);
877
878 op->remove ();
879 op = insert_ob_in_ob (op, tmp);
880
881 if (tmp->type == PLAYER)
882 esrv_send_item (tmp, op);
883
884 return 1; 875 return 1;
885 } 876 }
886 else 877 else
887 return 0; 878 return 0;
888} 879}
1202 1193
1203 /* High damage acid has better chance of corroding 1194 /* High damage acid has better chance of corroding
1204 objects */ 1195 objects */
1205 if (rndm (0, dam + 4) > random_roll (0, 39, op, PREFER_HIGH) + 2 * tmp->magic) 1196 if (rndm (0, dam + 4) > random_roll (0, 39, op, PREFER_HIGH) + 2 * tmp->magic)
1206 { 1197 {
1207 if (op->type == PLAYER)
1208 /* Make this more visible */
1209 new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, op,
1210 "The %s's acid corrodes your %s!", query_name (hitter), query_name (tmp));
1211 flag = 1; 1198 flag = 1;
1212 tmp->magic--; 1199 tmp->magic--;
1213 if (op->type == PLAYER) 1200
1214 esrv_send_item (op, tmp); 1201 if (object *pl = tmp->visible_to ())
1202 {
1203 /* Make this more visible */
1204 new_draw_info_format (NDI_UNIQUE | NDI_RED, 0, pl,
1205 "The %s's acid corrodes your %s!", query_name (hitter), query_name (tmp));
1206
1207 esrv_send_item (op, tmp); //TODO: UPD_NAME should be enough (it's enough in other cases)
1208 }
1215 } 1209 }
1216 } 1210 }
1217 1211
1218 if (flag) 1212 if (flag)
1219 op->update_stats (); /* Something was corroded */ 1213 op->update_stats (); /* Something was corroded */
1441 pk = 1; 1435 pk = 1;
1442 1436
1443 /* Player killed something */ 1437 /* Player killed something */
1444 if (owner->type == PLAYER) 1438 if (owner->type == PLAYER)
1445 { 1439 {
1446 Log_Kill (owner->name,
1447 query_name (op), op->type, (owner != hitter) ? query_name (hitter) : NULL, (owner != hitter) ? hitter->type : 0);
1448
1449 /* Log players killing other players - makes it easier to detect 1440 /* Log players killing other players - makes it easier to detect
1450 * and filter out malicious player killers - that is why the 1441 * and filter out malicious player killers - that is why the
1451 * ip address is included. 1442 * ip address is included.
1452 */ 1443 */
1453 if (op->type == PLAYER && !battleg) 1444 if (op->type == PLAYER && !battleg)
1630 } 1621 }
1631 1622
1632 op->destroy (); 1623 op->destroy ();
1633 } 1624 }
1634 else 1625 else
1635 {
1636 /* Player has been killed! */ 1626 /* Player has been killed! */
1637 if (owner->type == PLAYER) 1627 op->contr->killer = owner->type == PLAYER ? owner : hitter;
1638 snprintf (op->contr->killer, sizeof (op->contr->killer), "%s the %s", &owner->name, owner->contr->title);
1639 else
1640 assign (op->contr->killer, hitter->name);
1641 }
1642 1628
1643 /* This was return -1 - that doesn't seem correct - if we return -1, process 1629 /* This was return -1 - that doesn't seem correct - if we return -1, process
1644 * continues in the calling function. 1630 * continues in the calling function.
1645 */ 1631 */
1646 return maxdam; 1632 return maxdam;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines