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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 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 |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
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 | |
… | |
… | |
216 | object *op = disease->outer_env_or_self (); |
216 | object *op = disease->outer_env_or_self (); |
217 | |
217 | |
218 | if (!op->is_on_map ()) |
218 | if (!op->is_on_map ()) |
219 | return 0; |
219 | return 0; |
220 | |
220 | |
|
|
221 | dynbuf buf; |
221 | unordered_mapwalk (op, -range, -range, range, range) |
222 | unordered_mapwalk (buf, op, -range, -range, range, range) |
222 | { |
223 | { |
223 | mapspace &ms = m->at (nx, ny); |
224 | mapspace &ms = m->at (nx, ny); |
224 | |
225 | |
225 | if (ms.flags () & P_IS_ALIVE) |
226 | if (ms.flags () & P_IS_ALIVE) |
226 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
227 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
… | |
… | |
288 | return 0; |
289 | return 0; |
289 | |
290 | |
290 | /* check for an actual immunity */ |
291 | /* check for an actual immunity */ |
291 | /* do an immunity check */ |
292 | /* do an immunity check */ |
292 | for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) |
293 | for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) |
293 | if (tmp->type == SIGN) /* possibly an immunity, or diseased */ |
294 | if (tmp->name == disease->name && tmp->is_immunity ()) /* possibly an immunity, or diseased */ |
294 | if (tmp->name == disease->name && tmp->level >= disease->level) |
295 | if (tmp->level >= disease->level) |
295 | return 0; /* Immune! */ |
296 | return 0; /* Immune! */ |
296 | |
297 | |
297 | object *new_symptom = get_archetype (shstr_symptom); |
298 | object *new_symptom = get_archetype (shstr_symptom); |
298 | |
299 | |
299 | /* Something special done with dam. We want diseases to be more |
300 | /* Something special done with dam. We want diseases to be more |
… | |
… | |
458 | * they were cast in that same order. Instead, change it so that |
459 | * they were cast in that same order. Instead, change it so that |
459 | * if you diseased, you can't get diseased more. |
460 | * if you diseased, you can't get diseased more. |
460 | */ |
461 | */ |
461 | |
462 | |
462 | for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) |
463 | for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) |
463 | if (tmp->type == SIGN && tmp->name == disease->name && tmp->level >= disease->level) |
464 | if (tmp->name == disease->name && tmp->is_immunity () && tmp->level >= disease->level) |
464 | return 0; /* Immune! */ |
465 | return 0; /* Immune! */ |
465 | else if (tmp->type == DISEASE && tmp->name == disease->name) |
466 | else if (tmp->type == DISEASE && tmp->name == disease->name) |
466 | return 0; /* already diseased */ |
467 | return 0; /* already diseased */ |
467 | |
468 | |
468 | /* If we've gotten this far, go ahead and infect the victim. */ |
469 | /* If we've gotten this far, go ahead and infect the victim. */ |