protected void hitBone(String string, Shot shot, Point3d point3d) {
if (string.startsWith("xx")) {
if (string.startsWith("xxarmor")) {
if (string.endsWith("p1"))
getEnergyPastArmor(0.2F, shot);
else if (string.endsWith("p2"))
getEnergyPastArmor(0.2F, shot);
}
if (string.startsWith("xxcontrols")) {
int i = string.charAt(10) - 48;
switch (i) {
case 1:
if (World.Rnd().nextFloat() < 0.05F
|| (shot.mass > 0.092F
&& World.Rnd().nextFloat() < 0.1F)) {
if (World.Rnd().nextFloat() < 0.1F)
FM.AS.setEngineSpecificDamage(shot.initiator, 0,
1);
if (World.Rnd().nextFloat() < 0.5F)
FM.AS.setEngineSpecificDamage(shot.initiator, 0,
6);
}
break;
case 2:
if (World.Rnd().nextFloat() < 0.05F
|| (shot.mass > 0.092F
&& World.Rnd().nextFloat() < 0.1F)) {
if (World.Rnd().nextFloat() < 0.1F)
FM.AS.setEngineSpecificDamage(shot.initiator, 1,
1);
if (World.Rnd().nextFloat() < 0.5F)
FM.AS.setEngineSpecificDamage(shot.initiator, 1,
6);
}
break;
case 3:
if (getEnergyPastArmor(1.0F, shot) > 0.0F) {
if (World.Rnd().nextFloat() < 0.12F) {
FM.AS.setControlsDamage(shot.initiator, 1);
debugprintln(this, "*** Evelator Controls Out..");
}
if (World.Rnd().nextFloat() < 0.12F) {
FM.AS.setControlsDamage(shot.initiator, 2);
debugprintln(this, "*** Rudder Controls Out..");
}
}
break;
}
}
if (string.startsWith("xxspar")) {
if (string.startsWith("xxspart")
&& World.Rnd().nextFloat() < 0.36F
&& chunkDamageVisible("Tail1") > 2
&& getEnergyPastArmor(6.8F, shot) > 0.0F) {
debugprintln(this, "*** Tail1 Spars Broken in Half..");
msgCollision(this, "Tail1_D0", "Tail1_D0");
}
if (string.startsWith("xxsparli")
&& chunkDamageVisible("WingLIn") > 2
&& getEnergyPastArmor(14.8F * World.Rnd().nextFloat(1.0F,
3.0F),
shot) > 0.0F) {
debugprintln(this, "*** WingLIn Spars Damaged..");
nextDMGLevels(1, 2, "WingLIn_D3", shot.initiator);
}
if (string.startsWith("xxsparri")
&& chunkDamageVisible("WingRIn") > 2
&& getEnergyPastArmor(14.8F * World.Rnd().nextFloat(1.0F,
3.0F),
shot) > 0.0F) {
debugprintln(this, "*** WingRIn Spars Damaged..");
nextDMGLevels(1, 2, "WingRIn_D3", shot.initiator);
}
if (string.startsWith("xxsparlm")
&& chunkDamageVisible("WingLMid") > 2
&& getEnergyPastArmor(12.8F * World.Rnd().nextFloat(1.0F,
2.0F),
shot) > 0.0F) {
debugprintln(this, "*** WingLMid Spars Damaged..");
nextDMGLevels(1, 2, "WingLMid_D3", shot.initiator);
}
if (string.startsWith("xxsparrm")
&& chunkDamageVisible("WingRMid") > 2
&& getEnergyPastArmor(12.8F * World.Rnd().nextFloat(1.0F,
2.0F),
shot) > 0.0F) {
debugprintln(this, "*** WingRMid Spars Damaged..");
nextDMGLevels(1, 2, "WingRMid_D3", shot.initiator);
}
if (string.startsWith("xxsparlo")
&& ((double) World.Rnd().nextFloat()
< 1.0 - 0.7900000214576721 * Math.abs(v1.x))
&& chunkDamageVisible("WingLOut") > 2
&& getEnergyPastArmor(9.1F * World.Rnd().nextFloat(1.0F,
2.0F),
shot) > 0.0F) {
debugprintln(this, "*** WingLOut Spars Damaged..");
nextDMGLevels(1, 2, "WingLOut_D3", shot.initiator);
}
if (string.startsWith("xxsparro")
&& ((double) World.Rnd().nextFloat()
< 1.0 - 0.7900000214576721 * Math.abs(v1.x))
&& chunkDamageVisible("WingROut") > 2
&& getEnergyPastArmor(9.1F * World.Rnd().nextFloat(1.0F,
2.0F),
shot) > 0.0F) {
debugprintln(this, "*** WingROut Spars Damaged..");
nextDMGLevels(1, 2, "WingROut_D3", shot.initiator);
}
if (string.startsWith("xxsparsl")
&& chunkDamageVisible("StabL") > 1
&& getEnergyPastArmor(5.2F * World.Rnd().nextFloat(1.0F,
3.0F),
shot) > 0.0F) {
debugprintln(this, "*** StabL Spars Damaged..");
nextDMGLevels(1, 2, "StabL_D2", shot.initiator);
}
if (string.startsWith("xxsparsr")
&& chunkDamageVisible("StabR") > 1
&& getEnergyPastArmor(5.2F * World.Rnd().nextFloat(1.0F,
3.0F),
shot) > 0.0F) {
debugprintln(this, "*** StabR Spars Damaged..");
nextDMGLevels(1, 2, "StabR_D2", shot.initiator);
}
if (string.startsWith("xxspare1")
&& getEnergyPastArmor(28.0F, shot) > 0.0F) {
debugprintln(this,
"*** Engine1 Suspension Broken in Half..");
nextDMGLevels(3, 2, "Engine1_D0", shot.initiator);
}
if (string.startsWith("xxspare2")
&& getEnergyPastArmor(28.0F, shot) > 0.0F) {
debugprintln(this,
"*** Engine2 Suspension Broken in Half..");
nextDMGLevels(3, 2, "Engine2_D0", shot.initiator);
}
}
if (string.startsWith("xxbmb") && World.Rnd().nextFloat() < 0.01F
&& FM.CT.Weapons[3] != null
&& FM.CT.Weapons[3][0].haveBullets()) {
debugprintln(this, "*** Bomb Payload Detonates..");
FM.AS.hitTank(shot.initiator, 0, 10);
FM.AS.hitTank(shot.initiator, 1, 10);
FM.AS.hitTank(shot.initiator, 2, 10);
FM.AS.hitTank(shot.initiator, 3, 10);
nextDMGLevels(3, 2, "CF_D0", shot.initiator);
}
if (string.startsWith("xxeng")) {
int i = string.charAt(5) - 49;
if (string.endsWith("prop")
&& getEnergyPastArmor(World.Rnd().nextFloat(0.0F, 0.4F),
shot) > 0.0F) {
FM.EI.engines[i].setKillPropAngleDevice(shot.initiator);
debugprintln(this, ("*** Engine" + (i + 1)
+ " Prop Governor Failed.."));
}
if (string.endsWith("gear")
&& getEnergyPastArmor(World.Rnd().nextFloat(0.0F, 1.1F),
shot) > 0.0F) {
FM.EI.engines[i]
.setKillPropAngleDeviceSpeeds(shot.initiator);
debugprintln(this, ("*** Engine" + (i + 1)
+ " Prop Governor Damaged.."));
}
if (string.endsWith("case")) {
if (getEnergyPastArmor(World.Rnd().nextFloat(0.0F, 6.8F),
shot)
> 0.0F) {
if (World.Rnd().nextFloat() < shot.power / 200000.0F) {
FM.AS.setEngineStuck(shot.initiator, i);
debugprintln
(this,
("*** Engine" + (i + 1)
+ " Crank Case Hit - Engine Stucks.."));
}
if (World.Rnd().nextFloat() < shot.power / 50000.0F) {
FM.AS.hitEngine(shot.initiator, i, 2);
debugprintln
(this,
("*** Engine" + (i + 1)
+ " Crank Case Hit - Engine Damaged.."));
}
if (World.Rnd().nextFloat() < shot.power / 28000.0F) {
FM.EI.engines[i].setCyliderKnockOut(shot.initiator,
1);
debugprintln
(this,
("*** Engine" + (i + 1)
+ " Crank Case Hit - Cylinder Feed Out, "
+ FM.EI.engines[i].getCylindersOperable()
+ "/" + FM.EI.engines[i].getCylinders()
+ " Left.."));
}
if (World.Rnd().nextFloat() < 0.08F) {
FM.EI.engines[i].setEngineStuck(shot.initiator);
debugprintln
(this,
("*** Engine" + (i + 1)
+ " Crank Case Hit - Ball Bearing Jammed - Engine Stuck.."));
}
FM.EI.engines[i].setReadyness
(shot.initiator,
(FM.EI.engines[i].getReadyness()
- World.Rnd().nextFloat(0.0F,
shot.power / 48000.0F)));
debugprintln
(this, ("*** Engine" + (i + 1)
+ " Crank Case Hit - Readyness Reduced to "
+ FM.EI.engines[i].getReadyness() + ".."));
}
if (World.Rnd().nextFloat() < 0.01F) {
FM.EI.engines[i].setEngineStops(shot.initiator);
debugprintln(this,
("*** Engine" + (i + 1)
+ " Crank Case Hit - Engine Stalled.."));
}
if (World.Rnd().nextFloat() < 0.01F) {
FM.AS.hitEngine(shot.initiator, i, 10);
debugprintln
(this,
("*** Engine" + (i + 1)
+ " Crank Case Hit - Fuel Feed Hit - Engine Flamed.."));
}
getEnergyPastArmor(6.0F, shot);
}
if ((string.endsWith("cyl1") || string.endsWith("cyl2"))
&& getEnergyPastArmor(World.Rnd().nextFloat(0.5F, 2.542F),
shot) > 0.0F
&& (World.Rnd().nextFloat()
< FM.EI.engines[i].getCylindersRatio() * 1.72F)) {
FM.EI.engines[i].setCyliderKnockOut
(shot.initiator,
World.Rnd().nextInt(1, (int) (shot.power / 4800.0F)));
debugprintln(this,
("*** Engine" + (i + 1) + " Cylinders Hit, "
+ FM.EI.engines[i].getCylindersOperable()
+ "/" + FM.EI.engines[i].getCylinders()
+ " Left.."));
if (World.Rnd().nextFloat() < 0.01F) {
FM.EI.engines[i].setEngineStuck(shot.initiator);
debugprintln
(this,
("*** Engine" + (i + 1)
+ " Cylinder Case Broken - Engine Stuck.."));
}
if (World.Rnd().nextFloat() < shot.power / 24000.0F) {
FM.AS.hitEngine(shot.initiator, i, 3);
debugprintln(this,
("*** Engine" + (i + 1)
+ " Cylinders Hit - Engine Fires.."));
}
getEnergyPastArmor(World.Rnd().nextFloat(3.0F, 46.7F),
shot);
}
if (string.endsWith("supc")
&& getEnergyPastArmor(0.05F, shot) > 0.0F
&& World.Rnd().nextFloat() < 0.89F) {
FM.EI.engines[i].setKillCompressor(shot.initiator);
debugprintln(this, ("*** Engine" + (i + 1)
+ " Supercharger Out.."));
}
if (string.endsWith("eqpt")
&& getEnergyPastArmor(World.Rnd().nextFloat(0.001F, 0.2F),
shot) > 0.0F
&& World.Rnd().nextFloat() < 0.89F) {
if (World.Rnd().nextFloat() < 0.11F) {
FM.EI.engines[i].setMagnetoKnockOut
(shot.initiator, World.Rnd().nextInt(0, 1));
debugprintln(this, ("*** Engine" + (i + 1)
+ " Magneto Out.."));
}
if (World.Rnd().nextFloat() < 0.11F) {
FM.EI.engines[i].setKillCompressor(shot.initiator);
debugprintln(this, ("*** Engine" + (i + 1)
+ " Compressor Feed Out.."));
}
}
}
if (string.startsWith("xxoil")) {
int i = 0;
if (string.endsWith("2"))
i = 1;
if (getEnergyPastArmor(0.21F, shot) > 0.0F)
FM.AS.hitOil(shot.initiator, i);
}
if (string.startsWith("xxtank")) {
int i = string.charAt(6) - 49;
if (getEnergyPastArmor(0.03F, shot) > 0.0F) {
if (FM.AS.astateTankStates[i] == 0) {
FM.AS.hitTank(shot.initiator, i, 2);
FM.AS.doSetTankState(shot.initiator, i, 2);
}
if (shot.powerType == 3) {
if (shot.power < 14100.0F) {
if (FM.AS.astateTankStates[i] < 4
&& World.Rnd().nextFloat() < 0.1F)
FM.AS.hitTank(shot.initiator, i, 1);
} else
FM.AS.hitTank
(shot.initiator, i,
World.Rnd().nextInt(0, (int) (shot.power
/ 28200.0F)));
}
}
}
if (string.startsWith("xxhyd"))
FM.AS.setInternalDamage(shot.initiator, 3);
if (string.startsWith("xxpnm"))
FM.AS.setInternalDamage(shot.initiator, 1);
} else if (string.startsWith("xcf")) {
if (chunkDamageVisible("CF") < 3)
hitChunk("CF", shot);
if (shot.power > 33000.0F && point3d.x > 1.0) {
FM.AS.hitPilot(shot.initiator, 0,
World.Rnd().nextInt(30, 192));
FM.AS.hitPilot(shot.initiator, 1,
World.Rnd().nextInt(30, 192));
}
} else if (string.startsWith("xtail")) {
if (chunkDamageVisible("Tail1") < 3)
hitChunk("Tail1", shot);
} else if (string.startsWith("xkeel")) {
if (chunkDamageVisible("Keel1") < 2)
hitChunk("Keel1", shot);
} else if (string.startsWith("xrudder"))
hitChunk("Rudder1", shot);
else if (string.startsWith("xstabl")) {
if (chunkDamageVisible("StabL") < 2)
hitChunk("StabL", shot);
} else if (string.startsWith("xstabr")) {
if (chunkDamageVisible("StabR") < 2)
hitChunk("StabR", shot);
} else if (string.startsWith("xvatorl"))
hitChunk("VatorL", shot);
else if (string.startsWith("xvatorr"))
hitChunk("VatorR", shot);
else if (string.startsWith("xwinglin")) {
if ((FM.AS.astateTankStates[0] > 1
|| FM.AS.astateTankStates[1] > 1)
&& shot.powerType == 3
&& getEnergyPastArmor(0.45F, shot) > 0.0F
&& World.Rnd().nextFloat() < 0.33F
&& World.Rnd().nextFloat() < curTakeem)
FM.AS.hitTank(shot.initiator, World.Rnd().nextInt(0, 1), 3);
if (chunkDamageVisible("WingLIn") < 3)
hitChunk("WingLIn", shot);
} else if (string.startsWith("xwingrin")) {
if ((FM.AS.astateTankStates[2] > 1
|| FM.AS.astateTankStates[3] > 1)
&& shot.powerType == 3
&& getEnergyPastArmor(0.45F, shot) > 0.0F
&& World.Rnd().nextFloat() < 0.33F
&& World.Rnd().nextFloat() < curTakeem)
FM.AS.hitTank(shot.initiator, World.Rnd().nextInt(2, 3), 3);
if (chunkDamageVisible("WingRIn") < 3)
hitChunk("WingRIn", shot);
} else if (string.startsWith("xwinglmid")) {
if (chunkDamageVisible("WingLMid") < 3)
hitChunk("WingLMid", shot);
} else if (string.startsWith("xwingrmid")) {
if (chunkDamageVisible("WingRMid") < 3)
hitChunk("WingRMid", shot);
} else if (string.startsWith("xwinglout")) {
if (chunkDamageVisible("WingLOut") < 3)
hitChunk("WingLOut", shot);
} else if (string.startsWith("xwingrout")) {
if (chunkDamageVisible("WingROut") < 3)
hitChunk("WingROut", shot);
} else if (string.startsWith("xaronel"))
hitChunk("AroneL", shot);
else if (string.startsWith("xaroner"))
hitChunk("AroneR", shot);
else if (string.startsWith("xengine1")) {
if (chunkDamageVisible("Engine1") < 2)
hitChunk("Engine1", shot);
FM.EI.engines[0].setReadyness
(shot.initiator,
(FM.EI.engines[0].getReadyness()
- World.Rnd().nextFloat(0.0F, shot.power / 168000.0F)));
debugprintln(this, ("*** Engine1 Hit - Readyness Reduced to "
+ FM.EI.engines[0].getReadyness() + ".."));
} else if (string.startsWith("xengine2")) {
if (chunkDamageVisible("Engine2") < 2)
hitChunk("Engine2", shot);
FM.EI.engines[1].setReadyness
(shot.initiator,
(FM.EI.engines[1].getReadyness()
- World.Rnd().nextFloat(0.0F, shot.power / 168000.0F)));
debugprintln(this, ("*** Engine2 Hit - Readyness Reduced to "
+ FM.EI.engines[1].getReadyness() + ".."));
} else if (string.startsWith("xgear")) {
if (World.Rnd().nextFloat() < 0.1F) {
debugprintln(this, "*** Gear Hydro Failed..");
FM.Gears.setHydroOperable(false);
}
} else if (string.startsWith("xturret")) {
if (string.startsWith("xturret1")) {
FM.AS.setJamBullets(10, 0);
FM.AS.setJamBullets(10, 1);
}
if (string.startsWith("xturret2"))
FM.AS.setJamBullets(11, 0);
if (string.startsWith("xturret3"))
FM.AS.setJamBullets(12, 0);
} else if (string.startsWith("xpilot") || string.startsWith("xhead")) {
int i = 0;
int i_3_;
if (string.endsWith("a")) {
i = 1;
i_3_ = string.charAt(6) - 49;
} else if (string.endsWith("b")) {
i = 2;
i_3_ = string.charAt(6) - 49;
} else
i_3_ = string.charAt(5) - 49;
hitFlesh(i_3_, shot, i);
}
}