From afa24a6c76ff1799aefb02e6a94e7647db1863eb Mon Sep 17 00:00:00 2001 From: Pavel Braginskiy Date: Tue, 29 Oct 2024 01:55:52 -0700 Subject: [PATCH] RISC HS Override Kit: Gameplay --- .../i18n/megamek/client/messages.properties | 1 + .../megamek/common/report-messages.properties | 2 + .../megamek/common/templates/tro/mek.ftl | 2 +- .../megamek/common/templates/tro/mek.ftlh | 2 +- .../ui/swing/unitDisplay/ExtraPanel.java | 4 ++ megamek/src/megamek/common/MekView.java | 3 + .../megamek/common/templates/MekTROView.java | 3 + .../server/totalwarfare/TWGameManager.java | 59 +++++++++++++++++-- 8 files changed, 69 insertions(+), 7 deletions(-) diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 2da514580c3..4c96ba383f0 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -2096,6 +2096,7 @@ MekDisplay.SelectMulti.question=Which ammobin do you want to select? MekDisplay.over=over MekDisplay.NoTarget=No Target Selected MekDisplay.AimingAt=Aiming at %s +MekDisplay.RiscKit=\ w/ RISC HS Override Kit MekGroupView.title=Group View diff --git a/megamek/i18n/megamek/common/report-messages.properties b/megamek/i18n/megamek/common/report-messages.properties index d9a11ddd3d1..c7431827b9c 100755 --- a/megamek/i18n/megamek/common/report-messages.properties +++ b/megamek/i18n/megamek/common/report-messages.properties @@ -743,6 +743,7 @@ 5541=Radical heat sinks failure check, needs +, rolls: , 5542=failure! 5543=success! +5545=RISC Heat Sink Override Kit failure! Determining critical hits. 5550=External heat reduced due to intact heat-dissipating armor! 5560= takes over as of (). 5600=Bomb Bay Explosions------------------- @@ -893,6 +894,7 @@ 6315=\ 1 location. 6320=\ 2 locations. 6325=\ 3 locations. +6328=\ locations. 6330=HEAD BLOWN OFF blown off. 6335=Location is empty, so criticals transfer to . 6340=Location has no more hittable critical slots. diff --git a/megamek/resources/megamek/common/templates/tro/mek.ftl b/megamek/resources/megamek/common/templates/tro/mek.ftl index 8c8a0b9051c..ec1473e2f15 100644 --- a/megamek/resources/megamek/common/templates/tro/mek.ftl +++ b/megamek/resources/megamek/common/templates/tro/mek.ftl @@ -29,7 +29,7 @@ ${formatBasicDataRow("Engine", engineName, engineMass)} ${qvType} Cruising MP: ${qvCruise} ${qvType} Flanking MP: ${qvFlank} -${formatBasicDataRow(hsType, hsCount, hsMass)} +${formatBasicDataRow(hsType, hsCount, hsMass)}<#if riscKit> w/ RISC Heat Sink Override Kit ${formatBasicDataRow(gyroType, "", gyroMass)} ${formatBasicDataRow(cockpitType, "", cockpitMass)} ${formatBasicDataRow("Armor Factor" + armorType, armorFactor, armorMass)} diff --git a/megamek/resources/megamek/common/templates/tro/mek.ftlh b/megamek/resources/megamek/common/templates/tro/mek.ftlh index 48c88c5020c..4c0a082f80d 100644 --- a/megamek/resources/megamek/common/templates/tro/mek.ftlh +++ b/megamek/resources/megamek/common/templates/tro/mek.ftlh @@ -36,7 +36,7 @@      ${qvType} Cruising MP:${qvCruise}      ${qvType} Flanking MP:${qvFlank} - ${hsType}:${hsCount}${hsMass} + ${hsType}:${hsCount}${hsMass}<#if riscKit??>w/ RISC Heat Sink Override Kit ${gyroType}:${gyroMass} ${cockpitType}:${cockpitMass} Armor Factor${armorType}:${armorFactor}${armorMass} diff --git a/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java b/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java index 68b662ddf10..4fe23a911c6 100644 --- a/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java +++ b/megamek/src/megamek/client/ui/swing/unitDisplay/ExtraPanel.java @@ -546,6 +546,10 @@ public void displayMek(Entity en) { sinksR.append(Messages.getString("MekDisplay.activeSinksTextSingle", sinks)); } + if (m.hasRiscHeatSinkOverrideKit()) { + sinksR.append(Messages.getString("MekDisplay.RiscKit")); + } + boolean hasTSM = false; boolean mtHeat = false; if (((Mek) en).hasTSM(false)) { diff --git a/megamek/src/megamek/common/MekView.java b/megamek/src/megamek/common/MekView.java index a37b1eb3c64..fb9e8d2122f 100644 --- a/megamek/src/megamek/common/MekView.java +++ b/megamek/src/megamek/common/MekView.java @@ -471,6 +471,9 @@ public MekView(final Entity entity, final boolean showDetail, final boolean useA if (!aMek.formatHeat().equals(Integer.toString(aMek.heatSinks()))) { hsString.append(" [").append(aMek.formatHeat()).append("]"); } + if (aMek.hasRiscHeatSinkOverrideKit()) { + hsString.append(" w/ RISC Heat Sink Override Kit"); + } if (aMek.damagedHeatSinks() > 0) { hsString.append(" ").append(warningStart()).append("(") .append(aMek.damagedHeatSinks()) diff --git a/megamek/src/megamek/common/templates/MekTROView.java b/megamek/src/megamek/common/templates/MekTROView.java index 023003fe339..aa7ea51ab00 100644 --- a/megamek/src/megamek/common/templates/MekTROView.java +++ b/megamek/src/megamek/common/templates/MekTROView.java @@ -71,6 +71,9 @@ protected void initModel(EntityVerifier verifier) { setModelData("hsType", mek.getHeatSinkTypeName()); setModelData("hsCount", mek.hasDoubleHeatSinks() ? mek.heatSinks() + " [" + (mek.heatSinks() * 2) + "]" : mek.heatSinks()); + if (mek.hasRiscHeatSinkOverrideKit()) { + setModelData("riscKit", true); + } setModelData("hsMass", NumberFormat.getInstance().format(testMek.getWeightHeatSinks())); if (mek.getGyroType() == Mek.GYRO_STANDARD) { setModelData("gyroType", mek.getRawSystemName(Mek.SYSTEM_GYRO)); diff --git a/megamek/src/megamek/server/totalwarfare/TWGameManager.java b/megamek/src/megamek/server/totalwarfare/TWGameManager.java index bce0f09ebb9..3b11af7ce30 100644 --- a/megamek/src/megamek/server/totalwarfare/TWGameManager.java +++ b/megamek/src/megamek/server/totalwarfare/TWGameManager.java @@ -15466,28 +15466,38 @@ else if ((entity.heat >= 14) && !entity.isShutDown()) { entity.setShutDown(true); } else { int shutdown = (4 + (((entity.heat - 14) / 4) * 2)) - hotDogMod; + TargetRoll target; if (mtHeat) { shutdown -= 5; + target = new TargetRoll(shutdown, "Base tacops shutdown TN"); switch (entity.getCrew().getPiloting()) { case 0: case 1: - shutdown -= 2; + target.addModifier(-2, "Piloting skill"); break; case 2: case 3: - shutdown -= 1; + target.addModifier(-1, "Piloting skill"); break; case 6: case 7: - shutdown += 1; + target.addModifier(+1, "Piloting skill"); } + } else { + target = new TargetRoll(shutdown, "Base shutdown TN"); + } + boolean riscKit = false; + Mek mek = (Mek) entity; + if (mek.hasRiscHeatSinkOverrideKit()) { + riscKit = true; + target.addModifier(-2, "RISC Heat Sink Override Kit"); } Roll diceRoll = Compute.rollD6(2); int rollValue = diceRoll.getIntValue(); r = new Report(5060); r.subject = entity.getId(); r.addDesc(entity); - r.add(shutdown); + r.add(target); if (entity.getCrew().hasActiveTechOfficer()) { rollValue += 2; @@ -15496,7 +15506,8 @@ else if ((entity.heat >= 14) && !entity.isShutDown()) { } else { r.add(diceRoll); } - if (rollValue >= shutdown) { + + if (rollValue >= target.getValue()) { // avoided r.choose(true); addReport(r); @@ -15512,6 +15523,44 @@ else if ((entity.heat >= 14) && !entity.isShutDown()) { // okay, now mark shut down entity.setShutDown(true); } + + if (diceRoll.getIntValue() == 2 && riscKit) { + r = new Report(5545); + r.subject(entity.getId()); + addReport(r); + + int hits = 0; + Roll diceRoll2 = Compute.rollD6(2); + r = new Report(6310); + r.subject = entity.getId(); + r.add(diceRoll2); + r.newlines = 0; + addReport(r); + + if ((diceRoll2.getIntValue() == 8) || (diceRoll2.getIntValue() == 9)) { + hits = 1; + } else if ((diceRoll2.getIntValue() == 10) || (diceRoll2.getIntValue() == 11)) { + hits = 2; + } else if (diceRoll2.getIntValue() == 12) { + hits = 3; + } + + r = new Report(6328); + r.subject = entity.getId(); + r.add("%d+1=%d".formatted(hits, hits+1)); + addReport(r); + + hits++; + + for (int j = 0; (j < 12) && (hits > 0); j++) { + var crit = mek.getCritical(Mek.LOC_CT, j); + if ((crit.getType() == CriticalSlot.TYPE_SYSTEM) + && (crit.getIndex() == Mek.SYSTEM_ENGINE) && crit.isHittable()) { + addReport(applyCriticalHit(entity, Mek.LOC_CT, crit, true, 0, false)); + hits--; + } + } + } } } }