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.101 by root, Fri Dec 26 13:33:22 2008 UTC vs.
Revision 1.107 by elmex, Mon Jan 12 00:17:23 2009 UTC

79 int i, roll, saves = 0, attacks = 0, number; 79 int i, roll, saves = 0, attacks = 0, number;
80 materialtype_t *mt; 80 materialtype_t *mt;
81 81
82 if (!op->materialname) 82 if (!op->materialname)
83 { 83 {
84 for (mt = materialt; mt && mt->next; mt = mt->next) 84 for (mt = materialt; mt; mt = mt->next)
85 if (op->materials & mt->material) 85 if (op->materials & mt->material)
86 break; 86 break;
87 } 87 }
88 else 88 else
89 mt = name_to_material (op->materialname); 89 mt = name_to_material (op->materialname);
159 * object with +/- glow_radius and an "other_arch" to change to. 159 * object with +/- glow_radius and an "other_arch" to change to.
160 * (and please note that we cant fail our save and reach this 160 * (and please note that we cant fail our save and reach this
161 * function if the object doesnt contain a material that can burn. 161 * function if the object doesnt contain a material that can burn.
162 * So forget lighting magical swords on fire with this!) -b.t. 162 * So forget lighting magical swords on fire with this!) -b.t.
163 */ 163 */
164 if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) 164 if (type & (AT_FIRE | AT_ELECTRICITY)
165 && (QUERY_FLAG (op, FLAG_IS_LIGHTABLE)
166 || op->type == LAMP
167 || op->type == TORCH
165 { 168 ))
166 const char *arch = op->other_arch->archname; 169 {
167 170 switch (op->type)
168 if (op->decrease ())
169 fix_stopped_item (op, m, originator);
170
171 if ((op = archetype::get (arch)))
172 { 171 {
172 case LAMP:
173 // turn on a lamp
174 apply_lamp (op, true);
175 break;
176
177 default:
178 // for instance icecubes:
179 if (op->other_arch)
180 {
181 const char *arch = op->other_arch->archname;
182
183 if (op->decrease ())
184 fix_stopped_item (op, m, originator);
185
186 if ((op = archetype::get (arch)))
187 {
173 if (env) 188 if (env)
174 env->insert (op); 189 env->insert (op);
175 else 190 else
176 m->insert (op, x, y, originator); 191 m->insert (op, x, y, originator);
192 }
193 }
177 } 194 }
178
179 return; 195 return;
180 } 196 }
181 197
182 if (type & AT_CANCELLATION) 198 if (type & AT_CANCELLATION)
183 { /* Cancellation. */ 199 { /* Cancellation. */
1068 if (attacknum == ATNR_INTERNAL) 1084 if (attacknum == ATNR_INTERNAL)
1069 return dam; 1085 return dam;
1070 1086
1071 if (hitter->slaying) 1087 if (hitter->slaying)
1072 { 1088 {
1073 if ((op->race && strstr (hitter->slaying, op->race)) 1089 if ((op->race && hitter->slaying.contains (op->race))
1074 || (op->arch && op->arch->archname && strstr (op->arch->archname, hitter->slaying))) 1090 || (op->arch && op->arch->archname.contains (hitter->slaying)))
1075 { 1091 {
1076 doesnt_slay = 0; 1092 doesnt_slay = 0;
1077 dam *= 3; 1093 dam *= 3;
1078 } 1094 }
1079 } 1095 }
1281 object *god = find_god (determine_god (owner)); 1297 object *god = find_god (determine_god (owner));
1282 int div = 1; 1298 int div = 1;
1283 1299
1284 /* if undead are not an enemy of your god, you turn them 1300 /* if undead are not an enemy of your god, you turn them
1285 * at half strength */ 1301 * at half strength */
1286 if (!god || !god->slaying || strstr (god->slaying, shstr_undead) == NULL) 1302 if (!god || !god->slaying.contains (shstr_undead))
1287 div = 2; 1303 div = 2;
1288 1304
1289 /* Give a bonus if you resist turn undead */ 1305 /* Give a bonus if you resist turn undead */
1290 if (op->level * div < (turn_bonus[owner->stats.Wis] + owner->level + (op->resist[ATNR_TURN_UNDEAD] / 100))) 1306 if (op->level * div < (turn_bonus[owner->stats.Wis] + owner->level + (op->resist[ATNR_TURN_UNDEAD] / 100)))
1291 scare_creature (op, owner); 1307 scare_creature (op, owner);
1769 */ 1785 */
1770 if (type & AT_HOLYWORD) 1786 if (type & AT_HOLYWORD)
1771 { 1787 {
1772 object *god; 1788 object *god;
1773 1789
1774 if ((!hitter->slaying || 1790 if ((!hitter->slaying
1775 (!(op->race && strstr (hitter->slaying, op->race)) && 1791 || (!(op->race && hitter->slaying.contains (op->race))
1776 !(op->name && strstr (hitter->slaying, op->name)))) && 1792 && !(op->name && hitter->slaying.contains (op->name))))
1777 (!QUERY_FLAG (op, FLAG_UNDEAD) || 1793 && (!QUERY_FLAG (op, FLAG_UNDEAD)
1778 (hitter->title != NULL 1794 || (hitter->title
1779 && (god = find_god (determine_god (hitter))) != NULL && god->race != NULL && strstr (god->race, shstr_undead) != NULL))) 1795 && (god = find_god (determine_god (hitter))) != NULL
1796 && god->race.contains (shstr_undead))))
1780 return 0; 1797 return 0;
1781 } 1798 }
1782 1799
1783 maxattacktype = type; /* initialise this to something */ 1800 maxattacktype = type; /* initialise this to something */
1784 for (attacknum = 0; attacknum < NROFATTACKS; attacknum++, attacktype = 1 << attacknum) 1801 for (attacknum = 0; attacknum < NROFATTACKS; attacknum++, attacktype = 1 << attacknum)
2157 ** field of the deathstriking object */ 2174 ** field of the deathstriking object */
2158 2175
2159 int atk_lev, def_lev, kill_lev; 2176 int atk_lev, def_lev, kill_lev;
2160 2177
2161 if (hitter->slaying) 2178 if (hitter->slaying)
2162 if (!((QUERY_FLAG (op, FLAG_UNDEAD) && strstr (hitter->slaying, shstr_undead)) || (op->race && strstr (hitter->slaying, op->race)))) 2179 if (!((QUERY_FLAG (op, FLAG_UNDEAD) && hitter->slaying.contains (shstr_undead))
2180 || (op->race && hitter->slaying.contains (op->race))))
2163 return; 2181 return;
2164 2182
2165 def_lev = op->level; 2183 def_lev = op->level;
2166 if (def_lev < 1) 2184 if (def_lev < 1)
2167 { 2185 {
2266 { 2284 {
2267 /* target is unseen */ 2285 /* target is unseen */
2268 if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND)) 2286 if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND))
2269 adjust -= 10; 2287 adjust -= 10;
2270 /* dark map penalty for the hitter (lacks infravision if we got here). */ 2288 /* dark map penalty for the hitter (lacks infravision if we got here). */
2271 else if (target->map && target->map->darklevel () > 0 && !stand_in_light (target)) 2289 else if (!stand_in_light (target))
2272 adjust -= target->map->darklevel (); 2290 adjust -= target->map->darklevel ();
2273 } 2291 }
2274 2292
2275 if (QUERY_FLAG (attacker, FLAG_SCARED)) 2293 if (QUERY_FLAG (attacker, FLAG_SCARED))
2276 adjust -= 3; 2294 adjust -= 3;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines