Skip to content

Commit

Permalink
add initiative to Campaign and pull it into Gamethread
Browse files Browse the repository at this point in the history
  • Loading branch information
DM0000 committed Nov 28, 2024
1 parent 6975c49 commit 7127244
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions MekHQ/src/mekhq/AtBGameThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public void run() {

client.getLocalPlayer().setCamouflage(app.getCampaign().getCamouflage().clone());
client.getLocalPlayer().setColour(app.getCampaign().getColour());
client.getLocalPlayer().setConstantInitBonus(campaign.getInitiativeBonus());

if (started) {
client.getGame().getOptions().loadOptions();
Expand Down
1 change: 1 addition & 0 deletions MekHQ/src/mekhq/GameThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public void run() {
client.getLocalPlayer().setStartingAnyNWy(scenario.getStartingAnyNWy());
client.getLocalPlayer().setStartingAnySEx(scenario.getStartingAnySEx());
client.getLocalPlayer().setStartingAnySEy(scenario.getStartingAnySEy());
client.getLocalPlayer().setConstantInitBonus(campaign.getInitiativeBonus());

client.getLocalPlayer().setTeam(1);

Expand Down
18 changes: 18 additions & 0 deletions MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ public class Campaign implements ITechManager {
private int crimeRating;
private int crimePirateModifier;
private LocalDate dateOfLastCrime;
private int initiativeBonus;
private final CampaignSummary campaignSummary;
private final Quartermaster quartermaster;
private StoryArc storyArc;
Expand Down Expand Up @@ -306,6 +307,7 @@ public Campaign() {
crimeRating = 0;
crimePirateModifier = 0;
dateOfLastCrime = null;
initiativeBonus = 10;
setRankSystemDirect(Ranks.getRankSystemFromCode(Ranks.DEFAULT_SYSTEM_CODE));
forces = new Force(name);
forceIds.put(0, forces);
Expand Down Expand Up @@ -4465,6 +4467,22 @@ private void processReputationChanges() {
}
}

public int getInitiativeBonus(){
System.out.println("reached here"+ initiativeBonus);
return initiativeBonus;
}
public void setInitiativeBonus(int bonus){
initiativeBonus = bonus;
}

public void initiativeBonusIncrement(boolean change){
if(change){
setInitiativeBonus(++initiativeBonus);
}else{
setInitiativeBonus(--initiativeBonus);
}
}

/**
* This method processes the random dependents for a campaign. It shuffles the active dependents list and performs
* actions based on the campaign options and unit rating modifiers.
Expand Down

0 comments on commit 7127244

Please sign in to comment.