1
0
Fork 0
spacetac/src/core/missions/MissionPartGoTo.ts

41 lines
1.2 KiB
TypeScript
Raw Normal View History

/// <reference path="MissionPart.ts" />
2017-09-24 22:23:22 +00:00
module TK.SpaceTac {
2017-07-11 22:28:45 +00:00
/**
* Level of hint to help find a destination
*/
export enum MissionPartDestinationHint {
PRECISE,
SYSTEM_AND_INFO,
SYSTEM
}
/**
* A mission part that requires the fleet to go to a specific location
*/
export class MissionPartGoTo extends MissionPart {
destination: StarLocation
2017-07-11 22:28:45 +00:00
hint: MissionPartDestinationHint
2017-07-11 22:28:45 +00:00
constructor(mission: Mission, destination: StarLocation, directive?: string, hint = MissionPartDestinationHint.PRECISE) {
2017-07-02 18:21:04 +00:00
super(mission, directive || `Go to ${destination.star.name} system`);
this.destination = destination;
2017-07-11 22:28:45 +00:00
this.hint = hint;
}
2017-06-29 17:25:38 +00:00
checkCompleted(): boolean {
return this.destination.is(this.fleet.location) && this.destination.isClear();
2017-06-29 17:25:38 +00:00
}
forceComplete(): void {
this.destination.clearEncounter();
this.fleet.setLocation(this.destination);
}
2017-07-11 22:28:45 +00:00
getLocationHint(): Star | StarLocation | null {
return (this.hint == MissionPartDestinationHint.PRECISE) ? this.destination : this.destination.star;
}
}
}