00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "config.h"
00013
00014 #include "mech.h"
00015 #include "muxevent.h"
00016 #include "mech.events.h"
00017 #include "mech.tech.h"
00018 #include "p.econ.h"
00019 #include "p.mech.tech.h"
00020 #include "p.mech.status.h"
00021 #include "p.mech.utils.h"
00022
00023 #define PARTCHECK_SUB(m,a,b,c) \
00024 AVCHECKM(m,a,b,c); \
00025 GrabPartsM(m,a,b,c);
00026
00027 #ifndef BT_COMPLEXREPAIRS
00028 #define PARTCHECK(m,a,b,c) \
00029 { PARTCHECK_SUB(m, alias_part(m, a), b, c); }
00030 #else
00031 #define PARTCHECK(m,a,b,c) \
00032 { PARTCHECK_SUB(m, alias_part(m, a, loc), b, c); }
00033 #endif
00034
00035 #define PARTCHECKTWO(m,a,b,c,d,e,f) \
00036 AVCHECKM(m,a,b,c); \
00037 AVCHECKM(m,d,e,f); \
00038 GrabPartsM(m,a,b,c); \
00039 GrabPartsM(m,d,e,f);
00040
00041 #define PARTCHECKTHREE(m,a,b,c,d,e,f,g,h,i) \
00042 AVCHECKM(m,a,b,c); \
00043 AVCHECKM(m,d,e,f); \
00044 AVCHECKM(m,g,h,i); \
00045 GrabPartsM(m,a,b,c); \
00046 GrabPartsM(m,d,e,f); \
00047 GrabPartsM(m,g,h,i);
00048
00049 #define PARTCHECKFOUR(m,a,b,c,d,e,f,g,h,i,j,k,l) \
00050 AVCHECKM(m,a,b,c); \
00051 AVCHECKM(m,d,e,f); \
00052 AVCHECKM(m,g,h,i); \
00053 AVCHECKM(m,j,k,l); \
00054 GrabPartsM(m,a,b,c); \
00055 GrabPartsM(m,d,e,f); \
00056 GrabPartsM(m,g,h,i); \
00057 GrabPartsM(m,j,k,l);
00058
00059 static struct {
00060 char name;
00061 char *lname;
00062 int aflag;
00063 int rtype;
00064
00065 int ntype;
00066
00067 int rspec;
00068
00069
00070
00071 int nspec;
00072
00073
00074 } ammo_types[] = {
00075 {
00076 '-', "normal", 0, -1, -1, 0, 0}, {
00077 'L', "cluster", LBX_MODE, -1, -1, LBX, 0}, {
00078 'A', "artemis", ARTEMIS_MODE, TMISSILE, -1, 0, DAR | NARC | INARC}, {
00079 'N', "narc", NARC_MODE, TMISSILE, -1, 0, DAR | NARC | INARC}, {
00080 'S', "swarm", SWARM_MODE, TMISSILE, -1, IDF, DAR | NARC | INARC}, {
00081 '1', "swarm-1", SWARM1_MODE, TMISSILE, -1, IDF, DAR | NARC | INARC}, {
00082 'I', "inferno", INFERNO_MODE, TMISSILE, -1, 0,
00083 IDF | DAR | NARC | INARC}, {
00084 'X', "explosive", INARC_EXPLO_MODE, TMISSILE, -1, INARC, 0}, {
00085 'Y', "haywire", INARC_HAYWIRE_MODE, TMISSILE, -1, INARC, 0}, {
00086 'E', "ecm", INARC_ECM_MODE, TMISSILE, -1, INARC, 0}, {
00087 'Z', "nemesis", INARC_NEMESIS_MODE, TMISSILE, -1, INARC, 0}, {
00088 'R', "ap", AC_AP_MODE, TAMMO, -1, RFAC, 0}, {
00089 'F', "flechette", AC_FLECHETTE_MODE, TAMMO, -1, RFAC, 0}, {
00090 'D', "incendiary", AC_INCENDIARY_MODE, TAMMO, -1, RFAC, 0}, {
00091 'P', "precision", AC_PRECISION_MODE, TAMMO, -1, RFAC, 0}, {
00092 'T', "stinger", STINGER_MODE, TMISSILE, -1, IDF, DAR}, {
00093 'U', "caseless", AC_CASELESS_MODE, TAMMO, -1, RFAC, 0}, {
00094 'G', "semiguided", SGUIDED_MODE, TMISSILE, -1, IDF, DAR}, {
00095 0, NULL, 0, 0, 0, 0, 0}
00096 };
00097
00098 int valid_ammo_mode(MECH * mech, int loc, int part, int let)
00099 {
00100 int w, i;
00101
00102 if(!IsAmmo(GetPartType(mech, loc, part)) || !let)
00103 return -1;
00104 let = toupper(let);
00105 w = Ammo2I(GetPartType(mech, loc, part));
00106
00107 if(MechWeapons[w].special & NOSPA)
00108 return -1;
00109
00110 for(i = 0; ammo_types[i].name; i++) {
00111 if(ammo_types[i].name != let)
00112 continue;
00113 if(ammo_types[i].rtype >= 0 &&
00114 MechWeapons[w].type != ammo_types[i].rtype)
00115 continue;
00116 if(ammo_types[i].rspec &&
00117 !(MechWeapons[w].special & ammo_types[i].rspec))
00118 continue;
00119 if(ammo_types[i].ntype >= 0 &&
00120 MechWeapons[w].type == ammo_types[i].ntype)
00121 continue;
00122 if(ammo_types[i].nspec &&
00123 (MechWeapons[w].special & ammo_types[i].nspec))
00124 continue;
00125 return ammo_types[i].aflag;
00126 }
00127 return -1;
00128 }
00129
00130 int FindAmmoType(MECH * mech, int loc, int part)
00131 {
00132 int t = GetPartType(mech, loc, part);
00133 int m = GetPartAmmoMode(mech, loc, part);
00134 int base = -1;
00135
00136 if(!IsAmmo(t))
00137 return t;
00138 t = Ammo2I(t);
00139
00140 if(strstr(MechWeapons[t].name, "StreakSRM"))
00141 base = SSRM_AMMO;
00142 else if(strstr(MechWeapons[t].name, "StreakLRM"))
00143 base = SLRM_AMMO;
00144 else if(strstr(MechWeapons[t].name, "ELRM"))
00145 base = ELRM_AMMO;
00146 else if(strstr(MechWeapons[t].name, "LR_DFM"))
00147 base = LR_DFM_AMMO;
00148 else if(strstr(MechWeapons[t].name, "SR_DFM"))
00149 base = SR_DFM_AMMO;
00150 else if(strstr(MechWeapons[t].name, "LRM"))
00151 base = LRM_AMMO;
00152 else if(strstr(MechWeapons[t].name, "SRM"))
00153 base = SRM_AMMO;
00154 else if(strstr(MechWeapons[t].name, "MRM"))
00155 base = MRM_AMMO;
00156
00157 if(!(m & AMMO_MODES)) {
00158 if(base < 0)
00159 return I2Ammo(t);
00160 else
00161 return Cargo(base);
00162 }
00163
00164 if(m & LBX_MODE) {
00165 if(strstr(MechWeapons[t].name, "LB20"))
00166 base = LBX20_AMMO;
00167 else if(strstr(MechWeapons[t].name, "LB10"))
00168 base = LBX10_AMMO;
00169 else if(strstr(MechWeapons[t].name, "LB5"))
00170 base = LBX5_AMMO;
00171 else if(strstr(MechWeapons[t].name, "LB2"))
00172 base = LBX2_AMMO;
00173 if(base < 0)
00174 return I2Ammo(t);
00175 return Cargo(base);
00176 }
00177
00178 if(m & AC_MODES) {
00179 if(m & AC_AP_MODE) {
00180 if(strstr(MechWeapons[t].name, "AC/2"))
00181 base = AC2_AP_AMMO;
00182 if(strstr(MechWeapons[t].name, "AC/5"))
00183 base = AC5_AP_AMMO;
00184 if(strstr(MechWeapons[t].name, "AC/10"))
00185 base = AC10_AP_AMMO;
00186 if(strstr(MechWeapons[t].name, "AC/20"))
00187 base = AC20_AP_AMMO;
00188 if(strstr(MechWeapons[t].name, "LightAC/2"))
00189 base = LAC2_AP_AMMO;
00190 if(strstr(MechWeapons[t].name, "LightAC/5"))
00191 base = LAC5_AP_AMMO;
00192 }
00193
00194 if(m & AC_FLECHETTE_MODE) {
00195 if(strstr(MechWeapons[t].name, "AC/2"))
00196 base = AC2_FLECHETTE_AMMO;
00197 if(strstr(MechWeapons[t].name, "AC/5"))
00198 base = AC5_FLECHETTE_AMMO;
00199 if(strstr(MechWeapons[t].name, "AC/10"))
00200 base = AC10_FLECHETTE_AMMO;
00201 if(strstr(MechWeapons[t].name, "AC/20"))
00202 base = AC20_FLECHETTE_AMMO;
00203 if(strstr(MechWeapons[t].name, "LightAC/2"))
00204 base = LAC2_FLECHETTE_AMMO;
00205 if(strstr(MechWeapons[t].name, "LightAC/5"))
00206 base = LAC5_FLECHETTE_AMMO;
00207 }
00208
00209 if(m & AC_INCENDIARY_MODE) {
00210 if(strstr(MechWeapons[t].name, "AC/2"))
00211 base = AC2_INCENDIARY_AMMO;
00212 if(strstr(MechWeapons[t].name, "AC/5"))
00213 base = AC5_INCENDIARY_AMMO;
00214 if(strstr(MechWeapons[t].name, "AC/10"))
00215 base = AC10_INCENDIARY_AMMO;
00216 if(strstr(MechWeapons[t].name, "AC/20"))
00217 base = AC20_INCENDIARY_AMMO;
00218 if(strstr(MechWeapons[t].name, "LightAC/2"))
00219 base = LAC2_INCENDIARY_AMMO;
00220 if(strstr(MechWeapons[t].name, "LightAC/5"))
00221 base = LAC5_INCENDIARY_AMMO;
00222 }
00223
00224 if(m & AC_PRECISION_MODE) {
00225 if(strstr(MechWeapons[t].name, "AC/2"))
00226 base = AC2_PRECISION_AMMO;
00227 if(strstr(MechWeapons[t].name, "AC/5"))
00228 base = AC5_PRECISION_AMMO;
00229 if(strstr(MechWeapons[t].name, "AC/10"))
00230 base = AC10_PRECISION_AMMO;
00231 if(strstr(MechWeapons[t].name, "AC/20"))
00232 base = AC20_PRECISION_AMMO;
00233 if(strstr(MechWeapons[t].name, "LightAC/2"))
00234 base = LAC2_PRECISION_AMMO;
00235 if(strstr(MechWeapons[t].name, "LightAC/5"))
00236 base = LAC5_PRECISION_AMMO;
00237 }
00238
00239 if(m & AC_CASELESS_MODE) {
00240 if(strstr(MechWeapons[t].name, "AC/2"))
00241 base = AC2_CASELESS_AMMO;
00242 if(strstr(MechWeapons[t].name, "AC/5"))
00243 base = AC5_CASELESS_AMMO;
00244 if(strstr(MechWeapons[t].name, "AC/10"))
00245 base = AC10_CASELESS_AMMO;
00246 if(strstr(MechWeapons[t].name, "AC/20"))
00247 base = AC20_CASELESS_AMMO;
00248 if(strstr(MechWeapons[t].name, "LightAC/2"))
00249 base = LAC2_CASELESS_AMMO;
00250 if(strstr(MechWeapons[t].name, "LightAC/5"))
00251 base = LAC5_CASELESS_AMMO;
00252 }
00253 if(base < 0)
00254 return I2Ammo(t);
00255 return Cargo(base);
00256 }
00257
00258 if(m & INARC_EXPLO_MODE)
00259 return Cargo(INARC_EXPLO_AMMO);
00260 else if(m & INARC_HAYWIRE_MODE)
00261 return Cargo(INARC_HAYWIRE_AMMO);
00262 else if(m & INARC_ECM_MODE)
00263 return Cargo(INARC_ECM_AMMO);
00264 else if(m & INARC_NEMESIS_MODE)
00265 return Cargo(INARC_NEMESIS_AMMO);
00266
00267 if(base < 0)
00268 return I2Ammo(t);
00269 if(m & NARC_MODE)
00270 return Cargo(base) + NARC_LRM_AMMO - LRM_AMMO;
00271 if(m & ARTEMIS_MODE)
00272 return Cargo(base) + ARTEMIS_LRM_AMMO - LRM_AMMO;
00273 if(m & SWARM_MODE)
00274 return Cargo(base) + SWARM_LRM_AMMO - LRM_AMMO;
00275 if(m & SWARM1_MODE)
00276 return Cargo(base) + SWARM1_LRM_AMMO - LRM_AMMO;
00277 if(m & INFERNO_MODE)
00278 return Cargo(base) + INFERNO_SRM_AMMO - SRM_AMMO;
00279 if(m & STINGER_MODE)
00280 return Cargo(base) + AMMO_LRM_STINGER - LRM_AMMO;
00281 if(m & SGUIDED_MODE)
00282 return Cargo(base) + AMMO_LRM_SGUIDED - LRM_AMMO;
00283 return Cargo(base);
00284 }
00285
00286 TFUNC_LOCPOS(replace_econ)
00287 {
00288 if(IsAmmo(GetPartType(mech, loc, part)))
00289 return 0;
00290 PARTCHECK(mech, GetPartType(mech, loc, part), GetPartBrand(mech, loc,
00291 part), 1);
00292 return 0;
00293 }
00294
00295 TFUNC_LOCPOS_VAL(reload_econ)
00296 {
00297 int ammotype = FindAmmoType(mech, loc, part);
00298
00299 PARTCHECK(mech, ammotype, GetPartBrand(mech, loc, part), 1);
00300 return 0;
00301 }
00302
00303 TFUNC_LOC_VAL(fixarmor_econ)
00304 {
00305 PARTCHECK(mech, ProperArmor(mech), 0, *val);
00306 return 0;
00307 }
00308
00309 TFUNC_LOC_VAL(fixinternal_econ)
00310 {
00311 PARTCHECK(mech, ProperInternal(mech), 0, *val);
00312 return 0;
00313 }
00314
00315 TFUNC_LOCPOS(repair_econ)
00316 {
00317 if(IsAmmo(GetPartType(mech, loc, part)))
00318 return 0;
00319 PARTCHECKTWO(mech, Cargo(S_ELECTRONIC), 0, PartIsDestroyed(mech, loc,
00320 part) ? 3 : 1,
00321 ProperInternal(mech), 0, PartIsDestroyed(mech, loc,
00322 part) ? 3 : 1);
00323 return 0;
00324 }
00325
00326 TFUNC_LOCPOS(repairenhcrit_econ)
00327 {
00328 PARTCHECK(mech, Cargo(S_ELECTRONIC), 0, 1);
00329 return 0;
00330 }
00331
00332 TFUNC_LOC(reattach_econ)
00333 {
00334 #ifndef BT_COMPLEXREPAIRS
00335 PARTCHECKTWO(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc),
00336 Cargo(S_ELECTRONIC), 0, GetSectOInt(mech, loc));
00337 #else
00338 if(mudconf.btech_complexrepair) {
00339 if(MechType(mech) == CLASS_MECH) {
00340 PARTCHECKTWO(mech, ProperInternal(mech), 0,
00341 GetSectOInt(mech, loc), ProperMyomer(mech), 0, 1);
00342 } else {
00343 PARTCHECK(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc));
00344 }
00345 } else {
00346 PARTCHECKTWO(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc),
00347 Cargo(S_ELECTRONIC), 0, GetSectOInt(mech, loc));
00348 }
00349 #endif
00350 return 0;
00351 }
00352
00353 #define BSUIT_REPAIR_INTERNAL_NEEDED 10
00354 #define BSUIT_REPAIR_SENSORS_NEEDED 2
00355 #define BSUIT_REPAIR_LIFESUPPORT_NEEDED 2
00356 #define BSUIT_REPAIR_ELECTRONICS_NEEDED 10
00357
00358 TFUNC_LOC(replacesuit_econ)
00359 {
00360 PARTCHECKFOUR(mech,
00361 ProperInternal(mech), 0, BSUIT_REPAIR_INTERNAL_NEEDED,
00362 Cargo(BSUIT_SENSOR), 0, BSUIT_REPAIR_SENSORS_NEEDED,
00363 Cargo(BSUIT_LIFESUPPORT), 0,
00364 BSUIT_REPAIR_LIFESUPPORT_NEEDED, Cargo(BSUIT_ELECTRONIC), 0,
00365 BSUIT_REPAIR_ELECTRONICS_NEEDED);
00366 return 0;
00367 }
00368
00369
00370
00371
00372
00373
00374 TFUNC_LOC(reseal_econ)
00375 {
00376 PARTCHECKTWO(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc),
00377 Cargo(S_ELECTRONIC), 0, GetSectOInt(mech, loc));
00378 return 0;
00379 }
00380
00381
00382
00383
00384
00385 NFUNC(TFUNC_LOCPOS(replacep_succ));
00386 NFUNC(TFUNC_LOCPOS(replaceg_succ));
00387 NFUNC(TFUNC_LOCPOS_VAL(reload_succ));
00388 NFUNC(TFUNC_LOC_VAL(fixinternal_succ));
00389 NFUNC(TFUNC_LOC_VAL(fixarmor_succ));
00390 NFUNC(TFUNC_LOC(reattach_succ));
00391 NFUNC(TFUNC_LOC_RESEAL(reseal_succ));
00392 NFUNC(TFUNC_LOC(replacesuit_succ));
00393
00394
00395 NFUNC(TFUNC_LOCPOS(repairg_succ));
00396 NFUNC(TFUNC_LOCPOS(repairenhcrit_succ));
00397 NFUNC(TFUNC_LOCPOS(repairp_succ));
00398
00399
00400
00401
00402
00403 TFUNC_LOCPOS(replaceg_fail)
00404 {
00405 int w = (IsWeapon(GetPartType(mech, loc, part)));
00406
00407 if(tech_roll(player, mech, REPLACE_DIFFICULTY) < 0) {
00408 notify_printf(player,
00409 "You muck around, wasting the %s in the progress.",
00410 w ? "weapon" : "part");
00411 return -1;
00412 }
00413 notify_printf(player,
00414 "Despite messing the repair, you manage not to waste the %s.",
00415 w ? "weapon" : "part");
00416 #ifndef BT_COMPLEXREPAIRS
00417 AddPartsM(mech, FindAmmoType(mech, loc, part), GetPartBrand(mech, loc,
00418 part), 1);
00419 #else
00420 AddPartsM(mech, loc, FindAmmoType(mech, loc, part),
00421 GetPartBrand(mech, loc, part), 1);
00422 #endif
00423 return -1;
00424 }
00425
00426 TFUNC_LOCPOS(repairg_fail)
00427 {
00428 if(PartIsDestroyed(mech, loc, part))
00429
00430
00431 if(GetWeaponCrits(mech, Weapon2I(GetPartType(mech, loc, part)))
00432 > 4) {
00433 DestroyPart(mech, loc, part + 1);
00434 notify(player,
00435 "You muck around, trashing the gun in the process.");
00436 return -1;
00437 }
00438 notify(player, "Your repair fails.. all the parts are wasted for good.");
00439 return -1;
00440 }
00441
00442 TFUNC_LOCPOS(repairenhcrit_fail)
00443 {
00444 notify(player, "You don't manage to repair the damage.");
00445 return -1;
00446 }
00447
00448
00449 TFUNC_LOCPOS(replacep_fail)
00450 {
00451 notify(player, "Your repair fails.. all the parts are wasted for good.");
00452 return -1;
00453 }
00454
00455
00456 TFUNC_LOCPOS(repairp_fail)
00457 {
00458 return repairg_fail(player, mech, loc, part);
00459 }
00460
00461
00462 TFUNC_LOCPOS_VAL(reload_fail)
00463 {
00464 notify(player, "You fumble around, wasting the ammo in the progress.");
00465 return -1;
00466 }
00467
00468
00469
00470 TFUNC_LOC_VAL(fixarmor_fail)
00471 {
00472 int tot = 0;
00473 int should = *val;
00474
00475 if(tech_roll(player, mech, FIXARMOR_DIFFICULTY) >= 0)
00476 tot += 50;
00477 tot += random() % 40 + 5;
00478 tot = (tot * should) / 100;
00479 if(tot == 0)
00480 tot = 1;
00481 if(tot == should)
00482 tot = should - 1;
00483 notify_printf(player, "Your armor patching isn't exactly perfect.. "
00484 "You managed to fix %d out of %d.", tot, should);
00485 *val = tot;
00486 return 0;
00487 }
00488
00489 TFUNC_LOC_VAL(fixinternal_fail)
00490 {
00491 int tot = 0;
00492 int should = *val;
00493
00494 if(tech_roll(player, mech, FIXARMOR_DIFFICULTY) >= 0)
00495 tot += 50;
00496 tot += random() % 40 + 5;
00497 tot = (tot * should) / 100;
00498 if(tot == 0)
00499 tot = 1;
00500 if(tot == should)
00501 tot = should - 1;
00502 notify_printf(player,
00503 "Your internal patching isn't exactly perfect.. You managed to fix %d out of %d.",
00504 tot, should);
00505 *val = tot;
00506 return 0;
00507 }
00508
00509
00510
00511
00512
00513 TFUNC_LOC(reattach_fail)
00514 {
00515 int tot;
00516
00517 if(tech_roll(player, mech, REATTACH_DIFFICULTY) >= 0)
00518 return 0;
00519 tot = random() % 90 + 5;
00520 notify_printf(player,
00521 "Despite your disastrous failure, you recover %d%% of the materials.",
00522 tot);
00523 tot = (tot * GetSectOInt(mech, loc)) / 100;
00524 if(tot == 0)
00525 tot = 1;
00526 if(tot == GetSectOInt(mech, loc))
00527 tot = GetSectOInt(mech, loc) - 1;
00528 #ifndef BT_COMPLEXREPAIRS
00529 AddPartsM(mech, Cargo(S_ELECTRONIC), 0, tot);
00530 AddPartsM(mech, ProperInternal(mech), 0, tot);
00531 #else
00532 AddPartsM(mech, loc, Cargo(S_ELECTRONIC), 0, tot);
00533 AddPartsM(mech, loc, ProperInternal(mech), 0, tot);
00534 if(mudconf.btech_complexrepair && MechType(mech) == CLASS_MECH)
00535 AddPartsM(mech, loc, ProperMyomer(mech), 0, 1);
00536 #endif
00537 return -1;
00538 }
00539
00540 TFUNC_LOC(replacesuit_fail)
00541 {
00542 int wRand = 0;
00543
00544 if(tech_roll(player, mech, REATTACH_DIFFICULTY) >= 0)
00545 return 0;
00546
00547 wRand = random() % 90 + 5;
00548 notify_printf(player,
00549 "Despite your disastrous failure, you recover %d%% of the materials.",
00550 wRand);
00551 #ifndef BT_COMPLEXREPAIRS
00552 AddPartsM(mech, Cargo(BSUIT_SENSOR), 0,
00553 MAX(((BSUIT_REPAIR_SENSORS_NEEDED * wRand) / 100), 1));
00554 AddPartsM(mech, Cargo(BSUIT_LIFESUPPORT), 0,
00555 ((BSUIT_REPAIR_LIFESUPPORT_NEEDED * wRand) / 100));
00556 AddPartsM(mech, Cargo(BSUIT_ELECTRONIC), 0,
00557 ((BSUIT_REPAIR_ELECTRONICS_NEEDED * wRand) / 100));
00558 AddPartsM(mech, ProperInternal(mech), 0,
00559 MAX(((BSUIT_REPAIR_INTERNAL_NEEDED * wRand) / 100), 1));
00560 #else
00561 AddPartsM(mech, loc, Cargo(BSUIT_SENSOR), 0,
00562 MAX(((BSUIT_REPAIR_SENSORS_NEEDED * wRand) / 100), 1));
00563 AddPartsM(mech, loc, Cargo(BSUIT_LIFESUPPORT), 0,
00564 ((BSUIT_REPAIR_LIFESUPPORT_NEEDED * wRand) / 100));
00565 AddPartsM(mech, loc, Cargo(BSUIT_ELECTRONIC), 0,
00566 ((BSUIT_REPAIR_ELECTRONICS_NEEDED * wRand) / 100));
00567 AddPartsM(mech, loc, ProperInternal(mech), 0,
00568 MAX(((BSUIT_REPAIR_INTERNAL_NEEDED * wRand) / 100), 1));
00569 #endif
00570 return -1;
00571 }
00572
00573
00574
00575
00576
00577
00578 TFUNC_LOC_RESEAL(reseal_fail)
00579 {
00580 int tot;
00581
00582 if(tech_roll(player, mech, RESEAL_DIFFICULTY) >= 0)
00583 return 0;
00584 tot = random() % 90 + 5;
00585 notify_printf(player,
00586 "You don't manage to get all the water out and seal the section, though you recover %d%% of the materials.",
00587 tot);
00588 tot = (tot * GetSectOInt(mech, loc)) / 100;
00589 if(tot == 0)
00590 tot = 1;
00591 if(tot == GetSectOInt(mech, loc))
00592 tot = GetSectOInt(mech, loc) - 1;
00593 #ifndef BT_COMPLEXREPAIRS
00594 AddPartsM(mech, Cargo(S_ELECTRONIC), 0, tot);
00595 AddPartsM(mech, ProperInternal(mech), 0, tot);
00596 #else
00597 AddPartsM(mech, loc, Cargo(S_ELECTRONIC), 0, tot);
00598 AddPartsM(mech, loc, ProperInternal(mech), 0, tot);
00599 #endif
00600 return -1;
00601 }