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

Issue 5115: Added Nova CEWS to getExtraC3BV #6304

Merged
merged 3 commits into from
Dec 22, 2024
Merged
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
42 changes: 27 additions & 15 deletions megamek/src/megamek/common/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13167,26 +13167,38 @@ public int getExtraC3BV(int baseBV) {
// extra from c3 networks. a valid network requires at least 2 members
// some hackery and magic numbers here. could be better
// also, each 'has' loops through all equipment. inefficient to do it 3 times
int xbv = 0;
if ((game != null)
&& ((hasC3MM() && (calculateFreeC3MNodes() < 2))
// Nova CEWS is quirky and handled apart from the other C3
int extraBV = 0;
if (game != null) {
int totalForceBV = 0;
double multiplier = 0.05;
if ((hasC3MM() && (calculateFreeC3MNodes() < 2))
|| (hasC3M() && (calculateFreeC3Nodes() < 3))
|| (hasC3S() && (c3Master > NONE))
|| ((hasC3i() || hasNavalC3()) && (calculateFreeC3Nodes() < 5)))) {
int totalForceBV = 0;
totalForceBV += baseBV;
for (Entity e : game.getC3NetworkMembers(this)) {
if (!equals(e) && onSameC3NetworkAs(e)) {
totalForceBV += e.calculateBattleValue(true, true);
|| ((hasC3i() || hasNavalC3()) && (calculateFreeC3Nodes() < 5))) {
totalForceBV += baseBV;
for (Entity entity : game.getC3NetworkMembers(this)) {
if (!equals(entity) && onSameC3NetworkAs(entity)) {
totalForceBV += entity.calculateBattleValue(true, true);
}
}
if (hasBoostedC3()) {
multiplier = 0.07;
}

} else if (hasNovaCEWS()) { //Nova CEWS applies 5% to every mek with Nova on the team {
for (Entity entity : game.getEntitiesVector()) {
if (!equals(entity) && entity.hasNovaCEWS() && !(entity.owner.isEnemyOf(this.owner))) {
totalForceBV += entity.calculateBattleValue(true, true);
}
}
if (totalForceBV > 0) { //But only if there's at least one other mek with Nova CEWS
totalForceBV += baseBV;
}
}
double multiplier = 0.05;
if (hasBoostedC3()) {
multiplier = 0.07;
}
xbv += (int) Math.round(totalForceBV * multiplier);
extraBV += (int) Math.round(totalForceBV * multiplier);
}
return xbv;
return extraBV;
}

public boolean hasUnloadedUnitsFromBays() {
Expand Down
Loading