feat: remove instant group breaking
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/iliadenisov/galaxy/internal/util"
|
||||
)
|
||||
|
||||
func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber, quantity uint) error {
|
||||
func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber uint) error {
|
||||
c.validateRaceIndex(ri)
|
||||
|
||||
sgi, ok := c.raceShipGroupIndex(ri, groupID)
|
||||
@@ -25,10 +25,6 @@ func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber, quantity
|
||||
return e.NewShipsBusyError("state: %s", c.ShipGroup(sgi).State())
|
||||
}
|
||||
|
||||
if c.ShipGroup(sgi).Number < quantity {
|
||||
return e.NewBeakGroupNumberNotEnoughError("%d<%d", c.ShipGroup(sgi).Number, quantity)
|
||||
}
|
||||
|
||||
p1, ok := c.Planet(sourcePlanet)
|
||||
if !ok {
|
||||
return e.NewGameStateError("source planet #%d does not exists", sourcePlanet)
|
||||
@@ -42,14 +38,6 @@ func (c *Cache) shipGroupSend(ri int, groupID uuid.UUID, planetNumber, quantity
|
||||
return e.NewSendUnreachableDestinationError("range=%.03f", rangeToDestination)
|
||||
}
|
||||
|
||||
if quantity > 0 && quantity < c.ShipGroup(sgi).Number {
|
||||
nsgi, err := c.breakGroup(ri, groupID, quantity)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sgi = nsgi
|
||||
}
|
||||
|
||||
if p1.Number == p2.Number {
|
||||
c.UnsendShips(sgi)
|
||||
c.shipGroupMerge(ri)
|
||||
|
||||
Reference in New Issue
Block a user