00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <math.h>
00014
00015 #include "mech.h"
00016 #include "mech.events.h"
00017 #include "p.mech.utils.h"
00018 #include "p.mech.combat.h"
00019 #include "p.mech.damage.h"
00020 #include "p.mech.los.h"
00021 #include "p.mech.move.h"
00022 #include "p.crit.h"
00023 #include "p.mech.bth.h"
00024 #include "p.mech.update.h"
00025
00028
00029
00030
00031
00032
00033 #define MyHiddenTurns(mech) ((MechType(mech) == CLASS_MW ? 1 : MechType(mech) == CLASS_BSUIT ? 3 : MechType(mech) == CLASS_VTOL ? 4 : 5) * ((MechSpecials2(mech) & CAMO_TECH) ? 1 : 2))
00034
00035
00036
00037 #define RECYCLE_SWARM (PHYSICAL_RECYCLE_TIME / 3)
00038 #define RECYCLE_ATTACKLEG (PHYSICAL_RECYCLE_TIME / 2)
00039 #define RECYCLE_INT_STOPSWARM (PHYSICAL_RECYCLE_TIME / 3)
00040 #define RECYCLE_UNINT_STOPSWARM (PHYSICAL_RECYCLE_TIME / 2)
00041 #define RECYCLE_FALL_STOPSWARM ((PHYSICAL_RECYCLE_TIME / 4) * 3)
00042
00043 char *GetBSuitName(MECH * mech)
00044 {
00045 return (MechSpecials(mech) & CLAN_TECH) ? "Point" : "Squad";
00046 }
00047
00048 char *GetLCaseBSuitName(MECH * mech)
00049 {
00050 return (MechSpecials(mech) & CLAN_TECH) ? "point" : "squad";
00051 }
00052
00053 void StartBSuitRecycle(MECH * mech, int time)
00054 {
00055 int i;
00056
00057 for(i = 0; i < NUM_BSUIT_MEMBERS; i++)
00058 if(GetSectInt(mech, i))
00059 SetRecycleLimb(mech, i, time);
00060 }
00061
00062 void StopSwarming(MECH * mech, int intentional)
00063 {
00064 MECH *target = getMech(MechSwarmTarget(mech));
00065
00066 if(!target || MechSwarmTarget(mech) <= 0)
00067 return;
00068
00069 MechSwarmTarget(mech) = -1;
00070 MechSwarmer(target) = -1;
00071
00072 MechStatus2(mech) &= ~UNIT_MOUNTING;
00073 MechStatus2(target) &= ~UNIT_MOUNTED;
00074
00075 if(intentional > 0) {
00076 mech_notify(mech, MECHALL,
00077 "You let your hold loosen and you drop from the 'mech!");
00078 mech_printf(target, MECHALL, "%s lets go of you!",
00079 GetMechToMechID(target, mech));
00080 MechLOSBroadcasti(mech, target, "lets go of %s!");
00081
00082 StartBSuitRecycle(mech, RECYCLE_INT_STOPSWARM);
00083 } else {
00084 if(MadePilotSkillRoll(mech, 4)) {
00085 mech_notify(mech, MECHALL,
00086 "The hold loosens and you drop from the 'mech!");
00087 MechLOSBroadcasti(mech, target, "jumps off of %s!");
00088 mech_printf(target, MECHALL, "%s jumps off!",
00089 GetMechToMechID(target, mech));
00090
00091 StartBSuitRecycle(mech, RECYCLE_UNINT_STOPSWARM);
00092 } else {
00093 mech_notify(mech, MECHALL,
00094 "You're suprised by the sudden action and find yourself rapidly approaching the ground!");
00095 MechLOSBroadcasti(mech, target, "falls off %s!");
00096 mech_printf(target, MECHALL, "%s falls off!",
00097 GetMechToMechID(target, mech));
00098
00099 DamageMech(mech, mech, 1, -1, Number(0, NUM_BSUIT_MEMBERS - 1),
00100 0, 0, 11, 0, -1, 0, -1, 0, 1);
00101
00102 StartBSuitRecycle(mech, RECYCLE_FALL_STOPSWARM);
00103 }
00104 }
00105
00106 MechSpeed(mech) = 0;
00107 MaybeMove(mech);
00108 DropSetElevation(mech, 0);
00109 MechFloods(mech);
00110 }
00111
00112 int IsMechSwarmed(MECH * mech)
00113 {
00114 MAP *map = FindObjectsData(mech->mapindex);
00115 int count = 0, i, j;
00116 MECH *t;
00117
00118 if(!map)
00119 return 0;
00120
00121 for(i = 0; i < map->first_free; i++)
00122 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) {
00123 if(!(t = FindObjectsData(j)))
00124 continue;
00125
00126 if(MechSwarmTarget(t) != mech->mynum)
00127 continue;
00128
00129 if(MechTeam(mech) == MechTeam(t))
00130 continue;
00131
00132 count++;
00133 break;
00134 }
00135 return count > 0;
00136 }
00137
00138 int IsMechMounted(MECH * mech)
00139 {
00140 MAP *map = FindObjectsData(mech->mapindex);
00141 int count = 0, i, j;
00142 MECH *t;
00143
00144 if(!map)
00145 return 0;
00146
00147 for(i = 0; i < map->first_free; i++)
00148 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) {
00149 if(!(t = FindObjectsData(j)))
00150 continue;
00151
00152 if(MechSwarmTarget(t) != mech->mynum)
00153 continue;
00154
00155 if(MechTeam(mech) != MechTeam(t))
00156 continue;
00157
00158 count++;
00159 break;
00160 }
00161 return count > 0;
00162 }
00163
00164 int CountSwarmers(MECH * mech)
00165 {
00166 MAP *map = FindObjectsData(mech->mapindex);
00167 int count = 0, i, j;
00168 MECH *t;
00169
00170 if(!map)
00171 return 0;
00172 for(i = 0; i < map->first_free; i++)
00173 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) {
00174 if(!(t = FindObjectsData(j)))
00175 continue;
00176 if(MechSwarmTarget(t) != mech->mynum)
00177 continue;
00178 count++;
00179 }
00180 return count;
00181 }
00182
00183 MECH *findSwarmers(MECH * mech)
00184 {
00185 MAP *map = FindObjectsData(mech->mapindex);
00186 int i, j;
00187 MECH *t;
00188
00189 if(!map)
00190 return 0;
00191
00192 for(i = 0; i < map->first_free; i++)
00193 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) {
00194 if(!(t = FindObjectsData(j)))
00195 continue;
00196
00197 if(MechSwarmTarget(t) == mech->mynum) {
00198 return t;
00199 }
00200 }
00201
00202 return NULL;
00203 }
00204
00205 void StopBSuitSwarmers(MAP * map, MECH * mech, int intentional)
00206 {
00207 int i, j;
00208 MECH *t;
00209
00210 if(!map || !mech)
00211 return;
00212 for(i = 0; i < map->first_free; i++)
00213 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) {
00214 if(!(t = FindObjectsData(j)))
00215 continue;
00216 if(MechSwarmTarget(t) != mech->mynum)
00217 continue;
00218 StopSwarming(t, intentional);
00219 }
00220 }
00221
00222 void BSuitMirrorSwarmedTarget(MAP * map, MECH * mech)
00223 {
00224 int i, j;
00225 MECH *t;
00226
00227 for(i = 0; i < map->first_free; i++)
00228 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) {
00229 if(!(t = FindObjectsData(j)))
00230 continue;
00231 if(MechSwarmTarget(t) != mech->mynum)
00232 continue;
00233 MirrorPosition(mech, t, 1);
00234 }
00235 }
00236
00237 int doBSuitCommonChecks(MECH * mech, dbref player)
00238 {
00239 int i;
00240
00241 DOCHECK1(Jumping(mech), "Unavailable when jumping - sorry.");
00242 DOCHECK1(MechSwarmTarget(mech) > 0,
00243 "You are already busy with a special attack!");
00244 #ifdef BT_MOVEMENT_MODES
00245 DOCHECK1(MoveModeLock(mech),
00246 "Unavailable when performing movement modes - deal.");
00247 #endif
00248 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) {
00249 DOCHECK1(!SectIsDestroyed(mech, i) &&
00250 MechSections(mech)[i].recycle,
00251 tprintf("Suit %d is still recovering from attack.", i + 1));
00252 DOCHECK1(SectHasBusyWeap(mech,i),"You have weapons recycling!");
00253 }
00254
00255 return 0;
00256 }
00257
00258 int CountBSuitMembers(MECH * mech)
00259 {
00260 int i, j = 0;
00261
00262 for(i = 0; i < NUM_BSUIT_MEMBERS; i++)
00263 if(GetSectInt(mech, i))
00264 j++;
00265 return j;
00266 }
00267
00268 int FindBSuitTarget(dbref player, MECH * mech, MECH ** target, char *buffer)
00269 {
00270 int argc;
00271 char *args[3];
00272 float range;
00273 char targetID[2];
00274 int targetnum;
00275 MECH *t = NULL;
00276
00277 DOCHECK1((argc =
00278 mech_parseattributes(buffer, args, 3)) > 1,
00279 "Invalid arguments!");
00280 switch (argc) {
00281 case 0:
00282 DOCHECK1(MechTarget(mech) <= 0,
00283 "You do not have a default target set!");
00284 t = getMech(MechTarget(mech));
00285 if(!(t)) {
00286 mech_notify(mech, MECHALL, "Invalid default target!");
00287 MechTarget(mech) = -1;
00288 return 1;
00289 }
00290 break;
00291 case 1:
00292 targetID[0] = args[0][0];
00293 targetID[1] = args[0][1];
00294 targetnum = FindTargetDBREFFromMapNumber(mech, targetID);
00295 DOCHECK1(targetnum <= 0, "Target is not in line of sight!");
00296 t = getMech(targetnum);
00297 DOCHECK1(!(t), "Invalid default target!");
00298 break;
00299 default:
00300 notify(player, "Invalid target!");
00301 return 1;
00302 }
00303 range = FaMechRange(mech, t);
00304 DOCHECK1(!InLineOfSight_NB(mech, t, MechX(t), MechY(t), range),
00305 "Target is not in line of sight!");
00306 DOCHECK1(range >= 1.0, "Target out of range!");
00307 DOCHECK1(Jumping(t), "That target's unreachable right now!");
00308 DOCHECK1(MechType(t) != CLASS_MECH, "That target is of invalid type.");
00309 DOCHECK1(Destroyed(t), "A dead 'mech? C'mon :P");
00310 *target = t;
00311 return 0;
00312 }
00313
00314 int doJettisonChecks(MECH * mech)
00315 {
00316 int i, j;
00317
00318 if(!(MechInfantrySpecials(mech) & MUST_JETTISON_TECH))
00319 return 0;
00320
00321 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) {
00322 for(j = 0; j < NUM_CRITICALS; j++) {
00323 if((GetPartFireMode(mech, i, j) & WILL_JETTISON_MODE) &&
00324 (!(GetPartFireMode(mech, i, j) & IS_JETTISONED_MODE))) {
00325 mech_printf(mech, MECHALL,
00326 "Suit %d can not perform this feat before it jettisons its backpack!",
00327 i + 1);
00328
00329 return 1;
00330 }
00331 }
00332 }
00333
00334 return 0;
00335 }
00336
00337 void bsuit_swarm(dbref player, void *data, char *buffer)
00338 {
00339 MECH *mech = data;
00340 MECH *target;
00341 int baseToHit = 4;
00342 int tIsMount = 0;
00343
00344 cch(MECH_USUALO);
00345 skipws(buffer);
00346
00347
00348 if(!strcmp(buffer, "-")) {
00349 if(MechSwarmTarget(mech) > 0) {
00350 StopSwarming(mech, 1);
00351 return;
00352 }
00353 }
00354
00355 if(doBSuitCommonChecks(mech, player))
00356 return;
00357
00358 if(FindBSuitTarget(player, mech, &target, buffer))
00359 return;
00360
00361
00362 if(MechTeam(target) == MechTeam(mech)) {
00363
00364 if(!(MechInfantrySpecials(mech) & INF_SWARM_TECH)) {
00365 mech_notify(mech, MECHALL,
00366 "These battlesuits are not capable of mounting mechs!");
00367 return;
00368 }
00369
00370 tIsMount = 1;
00371 } else {
00372 if(doJettisonChecks(mech))
00373 return;
00374
00375
00376 if(!(MechInfantrySpecials(mech) & INF_SWARM_TECH)) {
00377 mech_notify(mech, MECHALL,
00378 "These battlesuits are not capable of performing swarm attacks!");
00379 return;
00380 }
00381 }
00382
00383
00384 if(CountSwarmers(mech) > 0) {
00385 mech_notify(mech, MECHALL,
00386 "That target already have battlesuits crawling all over it! There's no room for you!");
00387
00388 return;
00389 }
00390
00391
00392 switch (CountBSuitMembers(mech)) {
00393 case 1:
00394 case 2:
00395 case 3:
00396 baseToHit = 5;
00397 break;
00398
00399 default:
00400 baseToHit = 2;
00401 break;
00402 }
00403
00404 if(tIsMount)
00405 baseToHit -= 4;
00406
00407 if(MechCritStatus(mech) & HIDDEN) {
00408 if(Immobile(target))
00409 baseToHit -= 4;
00410
00411 if(Fallen(target))
00412 baseToHit -= 4;
00413 } else {
00414 baseToHit += TargetMovementMods(mech, target, 0.0);
00415
00416 if(Fallen(target))
00417 baseToHit -= 2;
00418 }
00419
00420
00421 if(MadePilotSkillRoll(mech, baseToHit)) {
00422 mech_printf(target, MECHALL, "%s %s you!",
00423 GetMechToMechID(target, mech),
00424 (tIsMount ? "mounts" : "swarms"));
00425 mech_printf(mech, MECHALL, "You %s %s!",
00426 (tIsMount ? "mount" : "swarm"), GetMechToMechID(mech,
00427 target));
00428
00429 MechSwarmTarget(mech) = target->mynum;
00430 MechSwarmer(target) = mech->mynum;
00431 MechStatus2(mech) |= UNIT_MOUNTING;
00432 MechStatus2(target) |= UNIT_MOUNTED;
00433
00434 if(tIsMount) {
00435 MechLOSBroadcasti(mech, target, "mounts %s!");
00436 } else {
00437 MechLOSBroadcasti(mech, target, "swarms %s!");
00438 }
00439
00440 MechSpeed(mech) = 0.0;
00441 MechDesiredSpeed(mech) = 0.0;
00442 SetFacing(mech, 270);
00443 MechDesiredFacing(mech) = 270;
00444 MirrorPosition(target, mech, 1);
00445 StopLock(mech);
00446 } else {
00447 mech_printf(target, MECHALL, "%s attempts to %s you!",
00448 GetMechToMechID(target, mech),
00449 (tIsMount ? "mount" : "swarm"));
00450 mech_printf(mech, MECHALL,
00451 "Nice try, but you don't succeed in your attempt at %s %s!",
00452 (tIsMount ? "mounting" : "swarming"),
00453 GetMechToMechID(mech, target));
00454 }
00455
00456 StartBSuitRecycle(mech, RECYCLE_SWARM);
00457 }
00458
00459 void bsuit_attackleg(dbref player, void *data, char *buffer)
00460 {
00461 MECH *mech = data;
00462 MECH *target;
00463 int baseToHit = 0;
00464 int wLegTemp = -1;
00465 int wLegID = -1;
00466 int wCritRoll = 0;
00467 char strAttackLoc[50];
00468
00469 cch(MECH_USUALO);
00470
00471 if(!(MechInfantrySpecials(mech) & INF_ANTILEG_TECH)) {
00472 mech_notify(mech, MECHALL,
00473 "These battlesuits are not capable of performing leg attacks!");
00474 return;
00475 }
00476
00477 if(doBSuitCommonChecks(mech, player))
00478 return;
00479
00480 if(doJettisonChecks(mech))
00481 return;
00482
00483 if(FindBSuitTarget(player, mech, &target, buffer))
00484 return;
00485
00486 DOCHECK(IsMechLegLess(mech), "That mech has no legs to grab!");
00487 DOCHECK((MechTeam(mech) == MechTeam(target)),
00488 "You can't attack the leg of a friendly mech!");
00489
00490 switch (CountBSuitMembers(mech)) {
00491 case 1:
00492 baseToHit = 7;
00493 break;
00494
00495 case 2:
00496 baseToHit = 5;
00497 break;
00498
00499 case 3:
00500 baseToHit = 2;
00501 break;
00502
00503 default:
00504 baseToHit = -1;
00505 break;
00506 }
00507
00508 if(MechCritStatus(mech) & HIDDEN) {
00509 if(Immobile(target))
00510 baseToHit -= 4;
00511
00512 if(Fallen(target))
00513 baseToHit -= 2;
00514 } else {
00515 baseToHit += TargetMovementMods(mech, target, 0.0);
00516 }
00517
00518 if(MechIsQuad(target)) {
00519 do {
00520 switch (Number(0, 3)) {
00521 case 0:
00522 wLegTemp = RLEG;
00523 break;
00524
00525 case 1:
00526 wLegTemp = LLEG;
00527 break;
00528
00529 case 2:
00530 wLegTemp = RARM;
00531 break;
00532
00533 case 3:
00534 wLegTemp = LARM;
00535 break;
00536 }
00537
00538 if(GetSectInt(target, wLegTemp))
00539 wLegID = wLegTemp;
00540
00541 } while (wLegID == -1);
00542 } else {
00543 wLegTemp = (Number(0, 1)) ? RLEG : LLEG;
00544
00545 if(GetSectInt(target, wLegTemp) == 0) {
00546 wLegID = (wLegTemp == RLEG) ? LLEG : RLEG;
00547 } else {
00548 wLegID = wLegTemp;
00549 }
00550 }
00551
00552 ArmorStringFromIndex(wLegID, strAttackLoc, MechType(target),
00553 MechMove(target));
00554
00555 mech_printf(mech, MECHALL,
00556 "You go for %s's %s, placing explosives in the joints!",
00557 GetMechToMechID(mech, target), strAttackLoc);
00558
00559 if(MadePilotSkillRoll(mech, baseToHit)) {
00560 mech_printf(target, MECHALL,
00561 "%s swarms your %s putting small packets of explosives all over it!",
00562 GetMechToMechID(target, mech), strAttackLoc);
00563
00564 MechLOSBroadcasti(mech, target, "attacks %s's legs!");
00565
00566
00567 wCritRoll = Roll();
00568
00569 if(wCritRoll >= 8) {
00570 mech_printf(target, MECHALL,
00571 "The explosives manage to rip into the internals of your %s!",
00572 strAttackLoc);
00573
00574 switch (wCritRoll) {
00575 case 8:
00576 case 9:
00577 HandleCritical(target, mech, 1, wLegID, 1);
00578 break;
00579 case 10:
00580 case 11:
00581 HandleCritical(target, mech, 1, wLegID, 2);
00582 break;
00583 case 12:
00584 switch (wLegID) {
00585 case RARM:
00586 case LARM:
00587 case RLEG:
00588 case LLEG:
00589
00590 mech_notify(target, MECHALL, "%ch%cyCRITICAL HIT!!%c");
00591
00592 MechLOSBroadcast(target,
00593 tprintf
00594 ("'s %s is blown off in a shower of sparks and smoke!",
00595 strAttackLoc));
00596 DestroySection(target, mech, 1, wLegID);
00597 default:
00598 HandleCritical(target, mech, 1, wLegID, 3);
00599 }
00600 break;
00601 default:
00602 break;
00603 }
00604 } else {
00605 mech_printf(target, MECHALL,
00606 "The explosives explode on the surface of your %s!",
00607 strAttackLoc);
00608 DamageMech(target, mech, 1, MechPilot(mech), wLegID, 0, 1, 4,
00609 0, -1, 0, -1, 0, 1);
00610 }
00611 } else {
00612 mech_printf(target, MECHALL,
00613 "%s attempts to attacks your legs, but misses miserably.",
00614 GetMechToMechID(target, mech));
00615
00616 mech_printf(mech, MECHALL,
00617 "You realize that this is harder than it looks and fail in your attempt at hitting %s's legs!",
00618 GetMechToMechID(mech, target));
00619
00620 MechLOSBroadcasti(mech, target,
00621 "attacks to climb %s's legs, but fails miserably!");
00622 }
00623
00624 StartBSuitRecycle(mech, RECYCLE_ATTACKLEG);
00625 }
00626
00627 static void mech_hide_event(MUXEVENT * e)
00628 {
00629 MECH *mech = (MECH *) e->data;
00630 MECH *t;
00631 MAP *map = getMap(mech->mapindex);
00632 int fail = 0, i;
00633 int tic = (int) e->data2;
00634
00635 if(!map)
00636 return;
00637
00638 for(i = 0; i < map->first_free; i++) {
00639 if(map->mechsOnMap[i] <= 0)
00640 continue;
00641 if(!(t = getMech(map->mechsOnMap[i])))
00642 continue;
00643 if(MechCritStatus(t) & (CLAIRVOYANT | OBSERVATORIC | INVISIBLE))
00644 continue;
00645 if(MechTeam(t) == MechTeam(mech))
00646 continue;
00647 if(!Started(t))
00648 continue;
00649 if(Destroyed(t))
00650 continue;
00651 if(InLineOfSight(t, mech, MechX(mech), MechY(mech),
00652 FaMechRange(t, mech)))
00653 fail = 1;
00654 }
00655
00656 if(MechsElevation(mech))
00657 fail = 1;
00658
00659 if(fail) {
00660 mech_notify(mech, MECHALL,
00661 "Your spidey sense tingles, telling you this isn't going to work......");
00662 return;
00663 } else if(tic < (MyHiddenTurns(mech) * HIDE_TICK)) {
00664 tic++;
00665 MECHEVENT(mech, EVENT_HIDE, mech_hide_event, 1, tic);
00666 } else if(!fail) {
00667 mech_notify(mech, MECHALL, "You are now hidden!");
00668 MechCritStatus(mech) |= HIDDEN;
00669 }
00670 return;
00671 }
00672
00673 void bsuit_hide(dbref player, void *data, char *buffer)
00674 {
00675 int i;
00676 MECH *mech = data;
00677 MECH *t;
00678 MAP *map = FindObjectsData(mech->mapindex);
00679 int terrain;
00680
00681 cch(MECH_USUALO);
00682 DOCHECK(((HasCamo(mech))
00683 || (Wizard(player))) ? 0 : MechType(mech) != CLASS_BSUIT
00684 && MechType(mech) != CLASS_MW,
00685 "You aren't capable of such curious things.");
00686
00687 if(!map) {
00688 mech_notify(mech, MECHALL, "You are not on a map!");
00689 return;
00690 }
00691
00692 DOCHECK(Jumping(mech) || OODing(mech), "Hide where? Up here?");
00693 DOCHECK((fabs(MechSpeed(mech)) > MP1), "Come to a complete stop first.");
00694 DOCHECK(Hiding(mech), "You are looking for cover already!");
00695 DOCHECK(MechMove(mech) == MOVE_VTOL
00696 && !Landed(mech), "You must be landed!");
00697
00698 terrain = GetRTerrain(map, MechX(mech), MechY(mech));
00699
00700 if(IsForest(terrain)) {
00701 mech_notify(mech, MECHALL, "You start to hide amongst the trees...");
00702 } else if(IsMountains(terrain)) {
00703 mech_notify(mech, MECHALL,
00704 "You start to hide behind some rocky outcroppings...");
00705 } else if(IsRough(terrain)) {
00706 mech_notify(mech, MECHALL,
00707 "You find some boulders to try to hide behind...");
00708 } else if((IsBuilding(terrain)) && (MechType(mech) == CLASS_BSUIT)) {
00709 mech_notify(mech, MECHALL,
00710 "You break into a building and look for a spot to hide...");
00711 } else {
00712 mech_notify(mech, MECHALL, "You begin to hide in this terrain...");
00713 mech_notify(mech, MECHALL,
00714 "... then realize that just isn't going to work!");
00715 return;
00716 }
00717
00718 MECHEVENT(mech, EVENT_HIDE, mech_hide_event, 1, 0);
00719 }
00720
00721 void JettisonPacks(dbref player, void *data, char *buffer)
00722 {
00723 MECH *mech = data;
00724 int wcJettisoned = 0;
00725 int wcSuits = 0;
00726 int i, j;
00727
00728 cch(MECH_USUALO);
00729 DOCHECK((!(MechInfantrySpecials(mech) & CAN_JETTISON_TECH)),
00730 "You have no backpack that is capable of being jettisoned!");
00731
00732 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) {
00733 for(j = 0; j < NUM_CRITICALS; j++) {
00734 if((GetPartFireMode(mech, i, j) & WILL_JETTISON_MODE) &&
00735 (!(GetPartFireMode(mech, i, j) & IS_JETTISONED_MODE))) {
00736
00737 GetPartFireMode(mech, i, j) |= DESTROYED_MODE;
00738 GetPartFireMode(mech, i, j) |= IS_JETTISONED_MODE;
00739 GetPartFireMode(mech, i, j) &= ~(BROKEN_MODE | DISABLED_MODE);
00740
00741 wcJettisoned++;
00742 }
00743 }
00744 }
00745
00746 if(wcJettisoned > 0) {
00747 wcSuits = CountBSuitMembers(mech);
00748
00749 if(wcSuits > 1) {
00750 mech_notify(mech, MECHALL,
00751 "The explosive bolts that hold the backpacks on blow, allowing them to drop to the ground.");
00752 MechLOSBroadcast(mech,
00753 "'s backpacks blow off in a shower of small explosions!");
00754 } else {
00755 mech_notify(mech, MECHALL,
00756 "The explosive bolts that hold your backpack on blows, allowing it to drop to the ground.");
00757 MechLOSBroadcast(mech,
00758 "'s backpack blows off in a puff of grey smoke!");
00759 }
00760 } else {
00761 mech_notify(mech, MECHALL,
00762 "You realize you have nothing to jettison. Maybe you already did it?");
00763 }
00764 }