Skip to content

Commit

Permalink
Merge pull request #6304 from psikomonkie/issue-5115-nova-cews-bv
Browse files Browse the repository at this point in the history
Issue 5115: Added Nova CEWS to getExtraC3BV
  • Loading branch information
HammerGS authored Dec 22, 2024
2 parents e9f736f + 3b7ac02 commit 00cb633
Showing 1 changed file with 27 additions and 15 deletions.
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

0 comments on commit 00cb633

Please sign in to comment.