1
0
Fork 0

Continued main story

This commit is contained in:
Michaël Lemaire 2017-09-12 01:29:15 +02:00
parent 884e634d5f
commit 55d83b1649
8 changed files with 76 additions and 4 deletions

View file

@ -7,6 +7,7 @@ Menu/settings/saves
* Save locally first, make saving to cloud an option
* Allow to delete cloud saves
* Fix cloud save games with "Level 0 - 0 ships"
* Store the game version in saves (for future work on compatibility)
Map/story
---------
@ -20,6 +21,7 @@ Map/story
* Forbid to end up with more than 5 ships in the fleet because of escorts
* Fix problems when several dialogs are active at the same time
* Handle case where cargo is full to give a reward (give money?)
* Fix question mark not being cleared on no encounter
Character sheet
---------------

View file

@ -42,6 +42,14 @@ module TS.SpaceTac.Specs {
expect(fleet.ships.length).toBe(fleet_size + 1);
goTo(fleet, (<MissionPartEscort>story.current_part).destination);
checkPart(story, 4, "^Listen to .*$");
(<MissionPartConversation>story.current_part).skip();
expect(session.getBattle()).toBeNull();
checkPart(story, 5, "^Fight the arrived fleet$");
expect(session.getBattle()).not.toBeNull();
nn(session.getBattle()).endBattle(fleet);
expect(story.checkStatus()).toBe(false, "story not complete");
})
})

View file

@ -37,12 +37,28 @@ module TS.SpaceTac {
conversation.addPiece(null, "So where do we go from here? In your last message, you told us of a resistance group growing.");
conversation.addPiece(contact_character, "Yes, some merchants and miners have rallied behind a retired TSF general, but I lost contact with them weeks ago.");
conversation.addPiece(contact_character, "We may go to their last known location, but first I want you to see something in a nearby system.");
conversation.addPiece(contact_character, "If you need any equipment before going, there is a dockyard in this system. They often offer some missions if you need money too.");
conversation.addPiece(null, "Yes, we came here with basic equipment as to not raise suspicion, but it looks like we will need more to defend ourselves.");
conversation.addPiece(null, "Ok, let's go...");
// Go take a look at the graveyard
let nearby_systems = nna(start_location.star.getLinks().map(link => link.getPeer(contact_location.star)));
let graveyard_location = randomLocation(random, [minBy(nearby_systems, system => system.level)]);
this.addPart(new MissionPartEscort(this, graveyard_location, contact_character, `Go with ${contact_character.name} in ${graveyard_location.star.name} system`));
conversation = this.addPart(new MissionPartConversation(this, [contact_character], `Listen to ${contact_character.name}`));
conversation.addPiece(null, "What is all this junk?");
conversation.addPiece(contact_character, "This was until recently an unofficial ship scrap yard. Lots of abandoned ship carcasses were floating in here, and many smugglers used to camouflage their activities amongst those.");
conversation.addPiece(contact_character, "I don't know what happened of the ship relics themselves, they disappeared, but all you see left are their quantum matrix computers.");
conversation.addPiece(null, "This makes no sense, ship bodies have no value without their brains!");
conversation.addPiece(contact_character, "Exactly. Someone went through a lot of work, but I do not see the reason why.");
conversation.addPiece(null, "Do you have any clue on where the ships were taken?");
conversation.addPiece(contact_character, "From what I gathered from locals, they were taken far away, maybe to the other side of the galaxy.");
conversation.addPiece(null, "So many ship structures stripped and transported elsewhere is weird. You're right, it's a LOT of work. We definitely need to know what is going on with it.");
conversation.addPiece(null, "...");
conversation.addPiece(null, "But it seems that we will have to deal with something else first! My high-spectrum sensors just picked an incoming fleet that will emerge near us.");
// Fight with the patrol
this.addPart(new MissionPartCleanLocation(this, graveyard_location, "Fight the arrived fleet"));
}
}
}

View file

@ -21,5 +21,21 @@ module TS.SpaceTac.Specs {
destination.clearEncounter();
expect(part.checkCompleted()).toBe(true, "Encouter cleared");
})
it("generates the battle immediately if the fleet is already at the destination", function () {
let destination = new StarLocation(new Star(null, 0, 0, "Atanax"));
destination.clearEncounter();
let universe = new Universe();
let fleet = new Fleet();
fleet.setLocation(destination, true);
let part = new MissionPartCleanLocation(new Mission(universe, fleet), destination);
expect(fleet.battle).toBeNull();
part.onStarted();
expect(fleet.battle).not.toBeNull();
expect(nn(fleet.battle).fleets).toEqual([fleet, nn(destination.encounter)]);
expect(part.checkCompleted()).toBe(false);
})
})
}

View file

@ -17,6 +17,14 @@ module TS.SpaceTac {
onStarted(): void {
this.destination.setupEncounter();
if (this.fleet.location == this.destination) {
// Already there, re-enter the location to start the fight
let battle = this.destination.enterLocation(this.fleet);
if (battle) {
this.fleet.setBattle(battle);
}
}
}
}
}

View file

@ -17,6 +17,9 @@ module TS.SpaceTac.UI {
// For now, we create a random fleet
this.gameui.session.setCampaignFleet();
this.backToRouter();
return false;
} else {
return true;
}
};
@ -25,6 +28,10 @@ module TS.SpaceTac.UI {
this.inputs.bind("Home", "Rewind", () => steps.rewind());
this.inputs.bind("Space", "Next step", nextStep);
this.inputs.bind("Enter", "Next step", nextStep);
this.inputs.bind("Escape", "Skip all", () => {
while (nextStep()) {
}
});
this.gameui.audio.startMusic("division");
}

View file

@ -52,8 +52,19 @@ module TS.SpaceTac.UI {
}
}
this.addText(offset + (style.center ? width / 2 : style.padding), style.center ? height / 2 : style.padding, message,
let text = this.addText(offset + (style.center ? width / 2 : style.padding), style.center ? height / 2 : style.padding, message,
style.text_color, style.text_size, style.text_bold, style.center, width - style.padding * 2, style.center);
let i = 0;
let colorchar = () => {
text.clearColors();
if (i < message.length) {
text.addColor("transparent", i);
i++;
this.view.timer.schedule(10, colorchar);
}
}
colorchar();
}
}
}

View file

@ -163,9 +163,13 @@ module TS.SpaceTac.UI {
* Refresh the view
*/
refresh() {
this.setZoom(this.zoom);
this.character_sheet.updateFleet(this.player.fleet);
this.player_fleet.updateShipSprites();
if (this.player.getBattle()) {
this.backToRouter();
} else {
this.setZoom(this.zoom);
this.character_sheet.updateFleet(this.player.fleet);
this.player_fleet.updateShipSprites();
}
}
/**