Skip to content

Commit

Permalink
#432 Changes tractor beam so orbital and bases cannot be pulled.
Browse files Browse the repository at this point in the history
This also means that orbital and starbases cannot be steal with
tractor beam.
  • Loading branch information
tuomount committed Sep 14, 2021
1 parent d50f053 commit e1e9e20
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public boolean canTractor(final CombatShip tractor, final CombatShip target) {
if (weapon != null && weapon.getType() == ShipComponentType.TRACTOR_BEAM) {
int tratocSize = tractor.getShip().getHull().getSize().getMass();
int pullSize = target.getShip().getHull().getSize().getMass();
if (tratocSize >= pullSize) {
if (tratocSize >= pullSize && !target.getShip().isStarBaseOrOrbital()) {
double xAxisDistance = Math.abs(tractor.getX() - target.getX());
double yAxisDistance = Math.abs(tractor.getY() - target.getY());
int distance;
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/openRealmOfStars/player/ship/Ship.java
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,19 @@ public boolean isStarBase() {
return hull.getHullType() == ShipHullType.STARBASE;
}

/**
* Is ship starbase or orbital.
* @return True if ship is either starbase or orbital.
*/
public boolean isStarBaseOrOrbital() {
if (hull.getHullType() == ShipHullType.STARBASE) {
return true;
}
if (hull.getHullType() == ShipHullType.ORBITAL) {
return true;
}
return false;
}
/**
* Get total research bonus, does not check if starbase is deployed
* @return Research bonus
Expand Down

0 comments on commit e1e9e20

Please sign in to comment.