-
Notifications
You must be signed in to change notification settings - Fork 291
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
Advanced Atmospheric Control Roll Errata #5867
Merged
Sleet01
merged 18 commits into
MegaMek:master
from
Algebro7:atmospheric-control-roll-errata
Sep 4, 2024
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8f5d2ed
WIP: implement 02-08-2024 atmospheric control rolls errata
Algebro7 3519d37
WIP: stub out highest threshold override for LAMs
Algebro7 ef95e44
add constant for old/unofficial SO atmospheric control roll rule
Algebro7 a9bfe23
add unofficial option for old stratops rule and update current one
Algebro7 474fb4e
check both old and new control roll rules
Algebro7 c6ab462
implement getHighestThresh() for LAMs
Algebro7 f1f90ad
track avionics and control system hits per round
Algebro7 c1fa70c
switch per-round avionics/control hit tracking to boolean
Algebro7 5879d8b
remove unnecessary hit tracking and extract adv atmo control rolls to…
Algebro7 c0ec68b
check highest thresh even if a normal thresh happened; fix bug in str…
Algebro7 640d05f
rename method and add docstring
Algebro7 6c2ffd2
show all adv atmo control roll reasons in report
Algebro7 5fad07d
add tests for advanced atmospheric control rolls
Algebro7 7c1ef94
add LAM tests
Algebro7 4e381b6
remove redundant asserts
Algebro7 d9886d5
move Unit Tests into correct TW package
Algebro7 c089690
remove erroneous white space
Algebro7 07bce77
fix whitespace for real this time
Algebro7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
megamek/unittests/megamek/server/totalwarfare/TWGameManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package megamek.server.totalwarfare; | ||
|
||
import megamek.common.*; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Vector; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class TWGameManagerTest { | ||
private Player player; | ||
private TWGameManager gameManager; | ||
private Game game; | ||
|
||
@BeforeAll | ||
static void before() { | ||
EquipmentType.initializeTypes(); | ||
} | ||
|
||
@BeforeEach | ||
void setUp() { | ||
player = new Player(0, "Test"); | ||
gameManager = new TWGameManager(); | ||
game = gameManager.getGame(); | ||
game.addPlayer(0, player); | ||
} | ||
|
||
@Test | ||
void testAddControlWithAdvAtmosphericMergesIntoOneRollAero() { | ||
AeroSpaceFighter aero = new AeroSpaceFighter(); | ||
game.addEntity(aero); | ||
Vector<PilotingRollData> rolls = new Vector<>(); | ||
StringBuilder reasons = new StringBuilder(); | ||
|
||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "critical hit")); | ||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "avionics hit")); | ||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "threshold")); | ||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "highest damage threshold exceeded")); | ||
gameManager.addControlWithAdvAtmospheric(aero, rolls, reasons); | ||
assertEquals(1, rolls.size()); | ||
} | ||
|
||
@Test | ||
void testAddControlWithAdvAtmosphericIncludesAllReasonsAero() { | ||
AeroSpaceFighter aero = new AeroSpaceFighter(); | ||
game.addEntity(aero); | ||
Vector<PilotingRollData> rolls = new Vector<>(); | ||
StringBuilder reasons = new StringBuilder(); | ||
|
||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "critical hit")); | ||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "avionics hit")); | ||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "threshold")); | ||
game.addControlRoll(new PilotingRollData(aero.getId(), 0, "highest damage threshold exceeded")); | ||
gameManager.addControlWithAdvAtmospheric(aero, rolls, reasons); | ||
assertTrue(reasons.toString().contains("critical hit")); | ||
assertTrue(reasons.toString().contains("avionics hit")); | ||
assertTrue(reasons.toString().contains("threshold")); | ||
assertTrue(reasons.toString().contains("highest damage threshold exceeded")); | ||
} | ||
|
||
@Test | ||
void testAddControlWithAdvAtmosphericMergesIntoOneRollLAM() { | ||
LandAirMech mech = new LandAirMech(LandAirMech.GYRO_STANDARD, LandAirMech.COCKPIT_STANDARD, LandAirMech.LAM_STANDARD); | ||
game.addEntity(mech); | ||
Vector<PilotingRollData> rolls = new Vector<>(); | ||
StringBuilder reasons = new StringBuilder(); | ||
|
||
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "avionics hit")); | ||
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "threshold")); | ||
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "highest damage threshold exceeded")); | ||
gameManager.addControlWithAdvAtmospheric(mech, rolls, reasons); | ||
assertEquals(1, rolls.size()); | ||
} | ||
|
||
@Test | ||
void testAddControlWithAdvAtmosphericIncludesAllReasonsLAM() { | ||
LandAirMech mech = new LandAirMech(LandAirMech.GYRO_STANDARD, LandAirMech.COCKPIT_STANDARD, LandAirMech.LAM_STANDARD); | ||
game.addEntity(mech); | ||
Vector<PilotingRollData> rolls = new Vector<>(); | ||
StringBuilder reasons = new StringBuilder(); | ||
|
||
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "avionics hit")); | ||
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "threshold")); | ||
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "highest damage threshold exceeded")); | ||
gameManager.addControlWithAdvAtmospheric(mech, rolls, reasons); | ||
assertTrue(reasons.toString().contains("avionics hit")); | ||
assertTrue(reasons.toString().contains("threshold")); | ||
assertTrue(reasons.toString().contains("highest damage threshold exceeded")); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open to suggestions on the naming/wording for these