Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RISC Heat Sink Override Kit (Construction) #6149

Merged
merged 2 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions megamek/src/megamek/common/Mek.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ public abstract class Mek extends Entity {

public static final String FULL_HEAD_EJECT_STRING = "Full Head Ejection System";

public static final String RISC_HEAT_SINK_OVERRIDE_KIT = "RISC Heat Sink Override Kit";

/**
* Contains a mapping of locations which are blocked when carrying cargo in the
* "key" location
Expand Down Expand Up @@ -297,6 +299,8 @@ public abstract class Mek extends Entity {

private boolean fullHeadEject = false;

private boolean riscHeatSinkKit = false;

protected static int[] EMERGENCY_COOLANT_SYSTEM_FAILURE = { 3, 5, 7, 10, 13, 13, 13 };

// nCoolantSystemLevel is the # of turns RISC emergency coolant system has been
Expand Down Expand Up @@ -3149,6 +3153,16 @@ public static TechAdvancement getFullHeadEjectAdvancement() {
.setStaticTechLevel(SimpleTechLevel.STANDARD);
}

public static TechAdvancement getRiscHeatSinkOverrideKitAdvancement() {
return new TechAdvancement(ITechnology.TECH_BASE_IS)
.setAdvancement(3134, DATE_NONE, DATE_NONE, DATE_NONE, DATE_NONE)
.setApproximate(false, false, false, false, false)
.setPrototypeFactions(F_RS)
.setTechRating(RATING_D)
.setAvailability(RATING_X, RATING_X, RATING_X, RATING_F)
.setStaticTechLevel(SimpleTechLevel.EXPERIMENTAL);
}

@Override
protected void addSystemTechAdvancement(CompositeTechLevel ctl) {
super.addSystemTechAdvancement(ctl);
Expand All @@ -3168,6 +3182,9 @@ protected void addSystemTechAdvancement(CompositeTechLevel ctl) {
if (hasFullHeadEject()) {
ctl.addComponent(getFullHeadEjectAdvancement());
}
if (hasRiscHeatSinkOverrideKit()) {
ctl.addComponent(getRiscHeatSinkOverrideKitAdvancement());
}
// FIXME: Clan interface cockpit has higher tech rating
// if (getCockpitType() == COCKPIT_INTERFACE && isClan()) {
// techAdvancement.setTechRating(Math.max(techAdvancement.getTechRating(),
Expand Down Expand Up @@ -4389,6 +4406,11 @@ public String getMtf() {
sb.append(Mek.FULL_HEAD_EJECT_STRING);
sb.append(newLine);
}
if (hasRiscHeatSinkOverrideKit()) {
sb.append(MtfFile.HEAT_SINK_KIT);
sb.append(Mek.RISC_HEAT_SINK_OVERRIDE_KIT);
sb.append(newLine);
}
sb.append(newLine);

sb.append(MtfFile.HEAT_SINKS).append(heatSinks()).append(" ");
Expand Down Expand Up @@ -5796,6 +5818,14 @@ public boolean hasFullHeadEject() {
return fullHeadEject;
}

public void setRiscHeatSinkOverrideKit(boolean heatSinkKit) {
this.riscHeatSinkKit = heatSinkKit;
}

public boolean hasRiscHeatSinkOverrideKit() {
return riscHeatSinkKit;
}

public abstract boolean hasMPReducingHardenedArmor();

/**
Expand Down
20 changes: 15 additions & 5 deletions megamek/src/megamek/common/battlevalue/MekBVCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ protected void processWeight() {
@Override
protected void processSummarize() {
double cockpitMod = 1;
double riscKitMod = 1;
String modifier = "";
if ((mek.getCockpitType() == Mek.COCKPIT_SMALL)
|| (mek.getCockpitType() == Mek.COCKPIT_TORSO_MOUNTED)
Expand All @@ -425,17 +426,26 @@ protected void processSummarize() {
cockpitMod = 1.3;
modifier = " (" + mek.getCockpitTypeString() + ")";
}
if (cockpitMod != 1) {

if (mek.hasRiscHeatSinkOverrideKit()) {
riscKitMod = 1.01;
}

if ((cockpitMod != 1) || (riscKitMod != 1)) {
baseBV = defensiveValue + offensiveValue;
bvReport.addEmptyLine();
bvReport.addSubHeader("Battle Value:");
bvReport.addLine("Defensive BR + Offensive BR:",
formatForReport(defensiveValue) + " + " + formatForReport(offensiveValue),
"= " + formatForReport(baseBV));
bvReport.addLine("Cockpit Modifier:",
formatForReport(baseBV) + " x " + formatForReport(cockpitMod) + modifier,
"= " + formatForReport(baseBV * cockpitMod));
baseBV *= cockpitMod;
if (cockpitMod != 1) {
bvReport.addLine("Cockpit Modifier:", formatForReport(baseBV) + " x " + formatForReport(cockpitMod) + modifier, "= " + formatForReport(baseBV * cockpitMod));
baseBV *= cockpitMod;
}
if (riscKitMod != 1) {
bvReport.addLine("RISC Heat Sink Override Kit: ", formatForReport(baseBV) + " x " + formatForReport(riscKitMod) + modifier, "= " + formatForReport(baseBV * riscKitMod));
baseBV *= riscKitMod;
}
bvReport.addLine("--- Base Unit BV:", "" + (int) Math.round(baseBV));
} else {
super.processSummarize();
Expand Down
14 changes: 14 additions & 0 deletions megamek/src/megamek/common/loaders/MtfFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class MtfFile implements IMekLoader {
private String lamType;
private String motiveType;
private String ejectionType;
private String heatSinkKit;

private String heatSinks;
private String jumpMP;
Expand Down Expand Up @@ -110,6 +111,7 @@ public class MtfFile implements IMekLoader {
public static final String GYRO = "gyro:";
public static final String MOTIVE = "motive:";
public static final String EJECTION = "ejection:";
public static final String HEAT_SINK_KIT = "heat sink kit:";
public static final String MASS = "mass:";
public static final String ENGINE = "engine:";
public static final String STRUCTURE = "structure:";
Expand Down Expand Up @@ -201,6 +203,12 @@ public Entity getEntity() throws Exception {
} catch (Exception ignored) {
fullHead = false;
}
boolean riscHeatSinkKit;
try {
riscHeatSinkKit = heatSinkKit.substring(HEAT_SINK_KIT.length()).equals(Mek.RISC_HEAT_SINK_OVERRIDE_KIT);
} catch (Exception ignored) {
riscHeatSinkKit = false;
}
if (chassisConfig.contains("QuadVee")) {
int iMotiveType;
try {
Expand Down Expand Up @@ -231,6 +239,7 @@ public Entity getEntity() throws Exception {
mek = new BipedMek(iGyroType, iCockpitType);
}
mek.setFullHeadEject(fullHead);
mek.setRiscHeatSinkOverrideKit(riscHeatSinkKit);
mek.setChassis(chassis.trim());
mek.setClanChassisName(clanChassisName);
mek.setModel(model.trim());
Expand Down Expand Up @@ -1133,6 +1142,11 @@ private boolean isProcessedComponent(String line) {
return true;
}

if (lineLower.startsWith(HEAT_SINK_KIT)) {
heatSinkKit = line;
return true;
}

if (lineLower.startsWith(MASS)) {
tonnage = line;
return true;
Expand Down