Skip to content

Commit

Permalink
Minor bug fixes.
Browse files Browse the repository at this point in the history
Fixes fleet commander stats calculations for planet discovery and
trading.
Fleet commander gains experience by finding planets.
Ruler needs to more diplomatic trades before gains negotiator perk.
  • Loading branch information
tuomount committed May 18, 2024
1 parent eaf5694 commit 1a2265e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,7 @@ public static int calculateMapValue(final StarMap starMap,
private static void checkNegotiatorPerk(final PlayerInfo info) {
if (info.getRuler() != null
&& info.getRuler().getStats().getStat(
StatType.DIPLOMATIC_TRADE) >= 4
StatType.DIPLOMATIC_TRADE) >= 8
&& !info.getRuler().hasPerk(Perk.NEGOTIATOR)) {
Perk perk = Perk.NEGOTIATOR;
Leader leader = info.getRuler();
Expand Down Expand Up @@ -2898,15 +2898,9 @@ private int doTrade(final NegotiationList offerList, final PlayerInfo info,
if (giver.getRuler() != null) {
giver.getRuler().getStats().addOne(StatType.WAR_DECLARATIONS);
}
} else if (countAsDiplomaticTrade) {
if (giver.getRuler() != null) {
giver.getRuler().getStats().addOne(StatType.DIPLOMATIC_TRADE);
checkNegotiatorPerk(giver);
}
if (info.getRuler() != null) {
info.getRuler().getStats().addOne(StatType.DIPLOMATIC_TRADE);
checkNegotiatorPerk(info);
}
} else if (countAsDiplomaticTrade && info.getRuler() != null) {
info.getRuler().getStats().addOne(StatType.DIPLOMATIC_TRADE);
checkNegotiatorPerk(info);
}
if (planetTraded) {
if (majorDeals != null) {
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/openRealmOfStars/starMap/StarMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.openRealmOfStars.player.leader.Leader;
import org.openRealmOfStars.player.leader.LeaderUtility;
import org.openRealmOfStars.player.leader.Perk;
import org.openRealmOfStars.player.leader.stats.StatType;
import org.openRealmOfStars.player.message.Message;
import org.openRealmOfStars.player.message.MessageType;
import org.openRealmOfStars.player.ship.Ship;
Expand Down Expand Up @@ -2703,6 +2704,9 @@ private void messageBasedOnTiles(final PlayerInfo info, final int sx,
sb.append(" gained ");
sb.append(exp);
sb.append(" amount of experience.");
fleet.getCommander().addExperience(exp);
fleet.getCommander().getStats().addOne(
StatType.NUMBER_OF_PLANETS_EXPLORED);
}
Message msg = new Message(MessageType.FLEET,
sb.toString(), Icons.getIconByName(Icons.ICON_PLANET));
Expand Down Expand Up @@ -2734,6 +2738,9 @@ private void messageBasedOnTiles(final PlayerInfo info, final int sx,
sb.append(" gained ");
sb.append(exp);
sb.append(" amount of experience.");
fleet.getCommander().addExperience(exp);
fleet.getCommander().getStats().addOne(
StatType.NUMBER_OF_PLANETS_EXPLORED);
}
Message msg = new Message(MessageType.FLEET,
sb.toString(), Icons.getIconByName(Icons.ICON_PLANET));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.openRealmOfStars.player.diplomacy.DiplomacyBonusType;
import org.openRealmOfStars.player.fleet.Fleet;
import org.openRealmOfStars.player.leader.Perk;
import org.openRealmOfStars.player.leader.stats.StatType;
import org.openRealmOfStars.player.message.Message;
import org.openRealmOfStars.player.message.MessageType;
import org.openRealmOfStars.player.race.trait.TraitIds;
Expand Down Expand Up @@ -758,6 +759,7 @@ public static void doTradeWithShips(final DiplomacyBonusList diplomacy,
info.setTotalCredits(info.getTotalCredits() + credits);
if (fleet.getCommander() != null) {
fleet.getCommander().addExperience(credits);
fleet.getCommander().getStats().addOne(StatType.NUMBER_OF_TRADES);
}
planet.getPlanetPlayerInfo().setTotalCredits(
planet.getPlanetPlayerInfo().getTotalCredits()
Expand Down Expand Up @@ -799,6 +801,7 @@ public static void doTradeWithShips(final DiplomacyBonusList diplomacy,
}
if (fleet.getCommander() != null) {
fleet.getCommander().addExperience(credits);
fleet.getCommander().getStats().addOne(StatType.NUMBER_OF_TRADES);
}
info.setTotalCredits(info.getTotalCredits() + credits);
Message msg = new Message(MessageType.PLANETARY,
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/resources/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
- Bugfixes -

* Realm wide espionage is now called intelligence. Commander doing espionage on planets is called espionage.
* Fleet commander did not gains statistics for finding planets.
* Fleet commander did not get experience by finding planets.
* Ruler got too easily negotiator perk when doing diplomatic trades.
* Fleet commander did not gains statistics for trading.

# Open Realm of Stars 0.25.0

Expand Down

0 comments on commit 1a2265e

Please sign in to comment.