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

Comparing deliantra/server/server/disease.C (file contents):
Revision 1.63 by root, Fri Mar 26 01:04:44 2010 UTC vs.
Revision 1.68 by root, Sun May 1 16:58:17 2011 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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 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
151 if (disease->last_heal) 151 if (disease->last_heal)
152 return 0; 152 return 0;
153 153
154 /* first, search for an immunity of the same name */ 154 /* first, search for an immunity of the same name */
155 for (walk = disease->env->inv; walk; walk = walk->below) 155 for (walk = disease->env->inv; walk; walk = walk->below)
156 if (walk->type == 98 && disease->name == walk->name) 156 if (disease->name == walk->name && walk->is_immunity ())
157 { 157 {
158 walk->level = disease->level; 158 walk->level = disease->level;
159 return 1; /* just update the existing immunity. */ 159 return 1; /* just update the existing immunity. */
160 } 160 }
161 161
162 immunity = get_archetype (shstr_immunity); 162 immunity = archetype::get (shstr_immunity);
163 163
164 immunity->name = disease->name; 164 immunity->name = disease->name;
165 immunity->level = disease->level; 165 immunity->level = disease->level;
166 immunity->move_block = 0; 166 immunity->move_block = 0;
167 167
233 233
234/* check if victim is susceptible to disease. */ 234/* check if victim is susceptible to disease. */
235static int 235static int
236is_susceptible_to_disease (object *victim, object *disease) 236is_susceptible_to_disease (object *victim, object *disease)
237{ 237{
238 if (!QUERY_FLAG (victim, FLAG_ALIVE)) 238 if (!victim->flag [FLAG_ALIVE])
239 return 0; 239 return 0;
240 240
241 if (victim->flag [FLAG_WIZ]) 241 if (victim->flag [FLAG_WIZ])
242 return 0; 242 return 0;
243 243
244 if (disease->race.contains ("*") && !QUERY_FLAG (victim, FLAG_UNDEAD)) 244 if (disease->race.contains ("*") && !victim->flag [FLAG_UNDEAD])
245 return 1; 245 return 1;
246 246
247 if ((disease->race == shstr_undead) && QUERY_FLAG (victim, FLAG_UNDEAD)) 247 if ((disease->race == shstr_undead) && victim->flag [FLAG_UNDEAD])
248 return 1; 248 return 1;
249 249
250 if ((victim->race && disease->race.contains (victim->race)) || disease->race.contains (victim->name)) 250 if ((victim->race && disease->race.contains (victim->race)) || disease->race.contains (victim->name))
251 return 1; 251 return 1;
252 252
289 return 0; 289 return 0;
290 290
291 /* check for an actual immunity */ 291 /* check for an actual immunity */
292 /* do an immunity check */ 292 /* do an immunity check */
293 for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) 293 for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below)
294 if (tmp->type == SIGN) /* possibly an immunity, or diseased */ 294 if (tmp->name == disease->name && tmp->is_immunity ()) /* possibly an immunity, or diseased */
295 if (tmp->name == disease->name && tmp->level >= disease->level) 295 if (tmp->level >= disease->level)
296 return 0; /* Immune! */ 296 return 0; /* Immune! */
297 297
298 object *new_symptom = get_archetype (shstr_symptom); 298 object *new_symptom = archetype::get (shstr_symptom);
299 299
300 /* Something special done with dam. We want diseases to be more 300 /* Something special done with dam. We want diseases to be more
301 * random in what they'll kill, so we'll make the damage they 301 * random in what they'll kill, so we'll make the damage they
302 * do random, note, this has a weird effect with progressive diseases. 302 * do random, note, this has a weird effect with progressive diseases.
303 */ 303 */
318 new_symptom->stats.food = new_symptom->stats.maxgrace; 318 new_symptom->stats.food = new_symptom->stats.maxgrace;
319 319
320 new_symptom->name = new_symptom->name_pl = disease->name; 320 new_symptom->name = new_symptom->name_pl = disease->name;
321 321
322 new_symptom->level = disease->level; 322 new_symptom->level = disease->level;
323 new_symptom->speed = disease->speed;
324 new_symptom->value = 0; 323 new_symptom->value = 0;
324
325 new_symptom->set_speed (disease->speed);
325 326
326 for (int i = 0; i < NUM_STATS; ++i) 327 for (int i = 0; i < NUM_STATS; ++i)
327 new_symptom->stats.stat (i) = disease->stats.stat (i); 328 new_symptom->stats.stat (i) = disease->stats.stat (i);
328 329
329 new_symptom->stats.sp = disease->stats.sp; 330 new_symptom->stats.sp = disease->stats.sp;
370 symptom->msg = disease->msg; 371 symptom->msg = disease->msg;
371 symptom->attacktype = disease->attacktype; 372 symptom->attacktype = disease->attacktype;
372 symptom->other_arch = disease->other_arch; 373 symptom->other_arch = disease->other_arch;
373 } 374 }
374 375
375 SET_FLAG (symptom, FLAG_APPLIED); 376 symptom->set_flag (FLAG_APPLIED);
376 victim->update_stats (); 377 victim->update_stats ();
377 378
378 return 1; 379 return 1;
379} 380}
380 381
435{ 436{
436 object *tmp; 437 object *tmp;
437 object *new_disease; 438 object *new_disease;
438 439
439 /* don't infect inanimate objects */ 440 /* don't infect inanimate objects */
440 if (!QUERY_FLAG (victim, FLAG_MONSTER) && !(victim->type == PLAYER)) 441 if (!victim->flag [FLAG_MONSTER] && !(victim->type == PLAYER))
441 return 0; 442 return 0;
442 443
443 /* check and see if victim can catch disease: diseases 444 /* check and see if victim can catch disease: diseases
444 * are specific 445 * are specific
445 */ 446 */
459 * they were cast in that same order. Instead, change it so that 460 * they were cast in that same order. Instead, change it so that
460 * if you diseased, you can't get diseased more. 461 * if you diseased, you can't get diseased more.
461 */ 462 */
462 463
463 for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) 464 for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below)
464 if (tmp->type == SIGN && tmp->name == disease->name && tmp->level >= disease->level) 465 if (tmp->name == disease->name && tmp->is_immunity () && tmp->level >= disease->level)
465 return 0; /* Immune! */ 466 return 0; /* Immune! */
466 else if (tmp->type == DISEASE && tmp->name == disease->name) 467 else if (tmp->type == DISEASE && tmp->name == disease->name)
467 return 0; /* already diseased */ 468 return 0; /* already diseased */
468 469
469 /* If we've gotten this far, go ahead and infect the victim. */ 470 /* If we've gotten this far, go ahead and infect the victim. */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines