2017-06-27 15:42:28 +00:00
|
|
|
/// <reference path="MissionPart.ts" />
|
|
|
|
|
|
|
|
module TS.SpaceTac {
|
|
|
|
/**
|
|
|
|
* A mission part that requires the fleet to go to a specific location
|
|
|
|
*/
|
|
|
|
export class MissionPartGoTo extends MissionPart {
|
|
|
|
destination: StarLocation
|
|
|
|
|
2017-06-29 17:25:38 +00:00
|
|
|
constructor(mission: Mission, destination: StarLocation, directive: string, hint = true) {
|
|
|
|
super(mission, hint ? `${directive} in ${destination.star.name} system` : directive);
|
2017-06-27 15:42:28 +00:00
|
|
|
|
|
|
|
this.destination = destination;
|
|
|
|
}
|
|
|
|
|
2017-06-29 17:25:38 +00:00
|
|
|
checkCompleted(): boolean {
|
|
|
|
return this.fleet.location === this.destination && this.destination.isClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
forceComplete(): void {
|
|
|
|
this.destination.clearEncounter();
|
|
|
|
this.fleet.setLocation(this.destination, true);
|
2017-06-27 15:42:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|