tscommon namespace renamed
This commit is contained in:
parent
d3f4cffde8
commit
e511b78754
2
TODO.md
2
TODO.md
|
@ -57,6 +57,7 @@ Battle
|
||||||
* Add a battle log display
|
* Add a battle log display
|
||||||
* Allow to move targetting indicator with arrow keys
|
* Allow to move targetting indicator with arrow keys
|
||||||
* Add targetting shortcuts for "previous target", "next enemy" and "next ally"
|
* Add targetting shortcuts for "previous target", "next enemy" and "next ally"
|
||||||
|
* Area targetting should include the hotkeyed ship at best (apply exclusion and power limit), not necessarily center on it
|
||||||
|
|
||||||
Ships models and equipments
|
Ships models and equipments
|
||||||
---------------------------
|
---------------------------
|
||||||
|
@ -89,6 +90,7 @@ Common UI
|
||||||
|
|
||||||
* Add caret/focus to text input
|
* Add caret/focus to text input
|
||||||
* Add a standard confirm dialog
|
* Add a standard confirm dialog
|
||||||
|
* Hover out when using keyboard shortcuts
|
||||||
* Mobile: think UI layout so that fingers do not block the view (right and left handed)
|
* Mobile: think UI layout so that fingers do not block the view (right and left handed)
|
||||||
* Mobile: display tooltips larger and on the side of screen where the finger is not
|
* Mobile: display tooltips larger and on the side of screen where the finger is not
|
||||||
* Mobile: targetting in two times, using a draggable target indicator
|
* Mobile: targetting in two times, using a draggable target indicator
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
TS.SpaceTac.AIDuel.setup(document.getElementById("duel"));
|
TK.SpaceTac.AIDuel.setup(document.getElementById("duel"));
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<script>
|
<script>
|
||||||
window.oncontextmenu = function (e) { e.preventDefault(); };
|
window.oncontextmenu = function (e) { e.preventDefault(); };
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
window.game = new TS.SpaceTac.MainUI();
|
window.game = new TK.SpaceTac.MainUI();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -65,17 +65,17 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
var generator = new TS.SpaceTac.LootGenerator();
|
var generator = new TK.SpaceTac.LootGenerator();
|
||||||
var result = document.getElementById("result");
|
var result = document.getElementById("result");
|
||||||
var current_level = 1;
|
var current_level = 1;
|
||||||
var current_name = "";
|
var current_name = "";
|
||||||
var qualities = {}
|
var qualities = {}
|
||||||
|
|
||||||
qualities[TS.SpaceTac.EquipmentQuality.WEAK] = "#e66";
|
qualities[TK.SpaceTac.EquipmentQuality.WEAK] = "#e66";
|
||||||
qualities[TS.SpaceTac.EquipmentQuality.COMMON] = "#eee";
|
qualities[TK.SpaceTac.EquipmentQuality.COMMON] = "#eee";
|
||||||
qualities[TS.SpaceTac.EquipmentQuality.FINE] = "#669";
|
qualities[TK.SpaceTac.EquipmentQuality.FINE] = "#669";
|
||||||
qualities[TS.SpaceTac.EquipmentQuality.PREMIUM] = "#66b";
|
qualities[TK.SpaceTac.EquipmentQuality.PREMIUM] = "#66b";
|
||||||
qualities[TS.SpaceTac.EquipmentQuality.LEGENDARY] = "#66e";
|
qualities[TK.SpaceTac.EquipmentQuality.LEGENDARY] = "#66e";
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
result.innerHTML = "";
|
result.innerHTML = "";
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
if (template.name != current_name) {
|
if (template.name != current_name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TS.iterenum(TS.SpaceTac.EquipmentQuality, function (quality) {
|
TK.iterenum(TK.SpaceTac.EquipmentQuality, function (quality) {
|
||||||
var loot = template.generate(current_level, quality);
|
var loot = template.generate(current_level, quality);
|
||||||
|
|
||||||
var block = document.createElement("div");
|
var block = document.createElement("div");
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TS.sortedBy(generator.templates, function (template) {
|
TK.sortedBy(generator.templates, function (template) {
|
||||||
return template.name;
|
return template.name;
|
||||||
}).forEach(function (template) {
|
}).forEach(function (template) {
|
||||||
var opt = document.createElement('option');
|
var opt = document.createElement('option');
|
||||||
|
|
|
@ -4,7 +4,7 @@ if (typeof window != "undefined") {
|
||||||
(<any>window).describe = (<any>window).describe || function () { };
|
(<any>window).describe = (<any>window).describe || function () { };
|
||||||
}
|
}
|
||||||
|
|
||||||
module TS.SpaceTac.UI.Specs {
|
module TK.SpaceTac.UI.Specs {
|
||||||
class FakeStorage {
|
class FakeStorage {
|
||||||
data: any = {}
|
data: any = {}
|
||||||
getItem(name: string) {
|
getItem(name: string) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ if (typeof window != "undefined") {
|
||||||
(<any>window).describe = (<any>window).describe || function () { };
|
(<any>window).describe = (<any>window).describe || function () { };
|
||||||
}
|
}
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Router between game views
|
// Router between game views
|
||||||
export class MainUI extends Phaser.Game {
|
export class MainUI extends Phaser.Game {
|
||||||
// Current game session
|
// Current game session
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 18a9b3c75b576af53362b7ce6d5081d71050cde4
|
Subproject commit c77c859359e3cee3700dcd7a28431f2f0b49e0a2
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("ArenaLocation", () => {
|
describe("ArenaLocation", () => {
|
||||||
it("gets distance and angle between two locations", () => {
|
it("gets distance and angle between two locations", () => {
|
||||||
expect(arenaDistance({ x: 0, y: 0 }, { x: 1, y: 1 })).toBeCloseTo(Math.sqrt(2), 8);
|
expect(arenaDistance({ x: 0, y: 0 }, { x: 1, y: 1 })).toBeCloseTo(Math.sqrt(2), 8);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Location in the arena (coordinates only)
|
* Location in the arena (coordinates only)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("Battle", function () {
|
describe("Battle", function () {
|
||||||
it("defines play order by initiative throws", function () {
|
it("defines play order by initiative throws", function () {
|
||||||
var fleet1 = new Fleet();
|
var fleet1 = new Fleet();
|
||||||
|
@ -372,7 +372,7 @@ module TS.SpaceTac {
|
||||||
let battle = Battle.newQuickRandom();
|
let battle = Battle.newQuickRandom();
|
||||||
battle.ai_playing = true;
|
battle.ai_playing = true;
|
||||||
|
|
||||||
let serializer = new Serializer(TS.SpaceTac);
|
let serializer = new Serializer(TK.SpaceTac);
|
||||||
let data = serializer.serialize(battle);
|
let data = serializer.serialize(battle);
|
||||||
|
|
||||||
let loaded = serializer.unserialize(data);
|
let loaded = serializer.unserialize(data);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// A turn-based battle between fleets
|
// A turn-based battle between fleets
|
||||||
export class Battle {
|
export class Battle {
|
||||||
// Flag indicating if the battle is ended
|
// Flag indicating if the battle is ended
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("BattleCheats", function () {
|
describe("BattleCheats", function () {
|
||||||
it("wins a battle", function () {
|
it("wins a battle", function () {
|
||||||
let battle = Battle.newQuickRandom();
|
let battle = Battle.newQuickRandom();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Cheat helpers for current battle
|
* Cheat helpers for current battle
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="events/BaseBattleEvent.ts"/>
|
/// <reference path="events/BaseBattleEvent.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Check a single game log event
|
// Check a single game log event
|
||||||
function checkEvent(got: BaseBattleEvent, ship: Ship, code: string,
|
function checkEvent(got: BaseBattleEvent, ship: Ship, code: string,
|
||||||
target_ship: Ship | null = null, target_x: number | null = null, target_y: number | null = null): void {
|
target_ship: Ship | null = null, target_x: number | null = null, target_y: number | null = null): void {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Function called to inform subscribers of new events.
|
* Function called to inform subscribers of new events.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("BattleOutcome", () => {
|
describe("BattleOutcome", () => {
|
||||||
it("generates loot from defeated ships", () => {
|
it("generates loot from defeated ships", () => {
|
||||||
var fleet1 = new Fleet();
|
var fleet1 = new Fleet();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Result of an ended battle
|
* Result of an ended battle
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("BattleStats", function () {
|
describe("BattleStats", function () {
|
||||||
it("collects stats", function () {
|
it("collects stats", function () {
|
||||||
let stats = new BattleStats();
|
let stats = new BattleStats();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Statistics collection over a battle
|
* Statistics collection over a battle
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Cooldown", function () {
|
describe("Cooldown", function () {
|
||||||
it("applies overheat and cooldown", function () {
|
it("applies overheat and cooldown", function () {
|
||||||
let cooldown = new Cooldown();
|
let cooldown = new Cooldown();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Cooldown system for equipments
|
* Cooldown system for equipments
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="effects/BaseEffect.ts" />
|
/// <reference path="effects/BaseEffect.ts" />
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Fake effect to capture apply requests
|
* Fake effect to capture apply requests
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Drones are static objects that apply effects in a circular zone around themselves.
|
* Drones are static objects that apply effects in a circular zone around themselves.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Equipment", () => {
|
describe("Equipment", () => {
|
||||||
it("generates a full name", function () {
|
it("generates a full name", function () {
|
||||||
let equipment = new Equipment(SlotType.Weapon, "rayofdeath");
|
let equipment = new Equipment(SlotType.Weapon, "rayofdeath");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Quality of loot.
|
* Quality of loot.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("ExclusionAreas", function () {
|
describe("ExclusionAreas", function () {
|
||||||
it("constructs from a ship or battle", function () {
|
it("constructs from a ship or battle", function () {
|
||||||
let battle = new Battle();
|
let battle = new Battle();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Helper for working with exclusion areas (areas where a ship cannot go)
|
* Helper for working with exclusion areas (areas where a ship cannot go)
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("Fleet", function () {
|
describe("Fleet", function () {
|
||||||
it("get average level", function () {
|
it("get average level", function () {
|
||||||
var fleet = new Fleet();
|
var fleet = new Fleet();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* A fleet of ships, all belonging to the same player
|
* A fleet of ships, all belonging to the same player
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Generator of balanced ships to form a fleet
|
// Generator of balanced ships to form a fleet
|
||||||
export class FleetGenerator {
|
export class FleetGenerator {
|
||||||
// Random generator to use
|
// Random generator to use
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("GameSession", () => {
|
describe("GameSession", () => {
|
||||||
/**
|
/**
|
||||||
* Compare two sessions
|
* Compare two sessions
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* A game session, binding a universe and a player
|
* A game session, binding a universe and a player
|
||||||
*
|
*
|
||||||
|
@ -41,13 +41,13 @@ module TS.SpaceTac {
|
||||||
|
|
||||||
// Load a game state from a string
|
// Load a game state from a string
|
||||||
static loadFromString(serialized: string): GameSession {
|
static loadFromString(serialized: string): GameSession {
|
||||||
var serializer = new Serializer(TS.SpaceTac);
|
var serializer = new Serializer(TK.SpaceTac);
|
||||||
return <GameSession>serializer.unserialize(serialized);
|
return <GameSession>serializer.unserialize(serialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serializes the game state to a string
|
// Serializes the game state to a string
|
||||||
saveToString(): string {
|
saveToString(): string {
|
||||||
var serializer = new Serializer(TS.SpaceTac);
|
var serializer = new Serializer(TK.SpaceTac);
|
||||||
return serializer.serialize(this);
|
return serializer.serialize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="LootTemplate.ts" />
|
/// <reference path="LootTemplate.ts" />
|
||||||
|
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
class TestTemplate extends LootTemplate {
|
class TestTemplate extends LootTemplate {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(SlotType.Shield, "Hexagrid Shield");
|
super(SlotType.Shield, "Hexagrid Shield");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Equipment generator from loot templates
|
* Equipment generator from loot templates
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,7 @@ module TS.SpaceTac {
|
||||||
// Fill the list of templates
|
// Fill the list of templates
|
||||||
populate(): void {
|
populate(): void {
|
||||||
let templates: LootTemplate[] = [];
|
let templates: LootTemplate[] = [];
|
||||||
let namespace: any = TS.SpaceTac.Equipments;
|
let namespace: any = TK.SpaceTac.Equipments;
|
||||||
for (var template_name in namespace) {
|
for (var template_name in namespace) {
|
||||||
if (template_name && template_name.indexOf("Abstract") != 0) {
|
if (template_name && template_name.indexOf("Abstract") != 0) {
|
||||||
let template_class = namespace[template_name];
|
let template_class = namespace[template_name];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Modifiers of basic loot, to obtain different quality levels
|
* Modifiers of basic loot, to obtain different quality levels
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="effects/BaseEffect.ts" />
|
/// <reference path="effects/BaseEffect.ts" />
|
||||||
|
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
class FakeEffect extends BaseEffect {
|
class FakeEffect extends BaseEffect {
|
||||||
fakevalue: number
|
fakevalue: number
|
||||||
constructor(val = 5) {
|
constructor(val = 5) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* A leveled value is an iterator yielding the desired value for each level (first item is for level 1, and so on)
|
* A leveled value is an iterator yielding the desired value for each level (first item is for level 1, and so on)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("MoveFireSimulator", function () {
|
describe("MoveFireSimulator", function () {
|
||||||
|
|
||||||
function simpleWeaponCase(distance = 10, ship_ap = 5, weapon_ap = 3, engine_distance = 5): [Ship, MoveFireSimulator, BaseAction] {
|
function simpleWeaponCase(distance = 10, ship_ap = 5, weapon_ap = 3, engine_distance = 5): [Ship, MoveFireSimulator, BaseAction] {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Error codes for approach simulation
|
* Error codes for approach simulation
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("NameGenerator", () => {
|
describe("NameGenerator", () => {
|
||||||
it("generates unique names", () => {
|
it("generates unique names", () => {
|
||||||
var random = new SkewedRandomGenerator([0.48, 0.9, 0.1]);
|
var random = new SkewedRandomGenerator([0.48, 0.9, 0.1]);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// A unique name generator
|
// A unique name generator
|
||||||
export class NameGenerator {
|
export class NameGenerator {
|
||||||
// List of available choices
|
// List of available choices
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("Player", function () {
|
describe("Player", function () {
|
||||||
it("keeps track of visited locations", function () {
|
it("keeps track of visited locations", function () {
|
||||||
let player = new Player();
|
let player = new Player();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// One player (human or IA)
|
// One player (human or IA)
|
||||||
export class Player {
|
export class Player {
|
||||||
// Player's name
|
// Player's name
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
function checkProportional(range: Range, value1: number, value2: number) {
|
function checkProportional(range: Range, value1: number, value2: number) {
|
||||||
expect(range.getProportional(value1)).toEqual(value2);
|
expect(range.getProportional(value1)).toEqual(value2);
|
||||||
expect(range.getReverseProportional(value2)).toEqual(value1);
|
expect(range.getReverseProportional(value2)).toEqual(value1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Range of number values
|
// Range of number values
|
||||||
export class Range {
|
export class Range {
|
||||||
// Minimal value
|
// Minimal value
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Ship", function () {
|
describe("Ship", function () {
|
||||||
it("creates a full name", function () {
|
it("creates a full name", function () {
|
||||||
let ship = new Ship();
|
let ship = new Ship();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* A single ship in a fleet
|
* A single ship in a fleet
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("ShipGenerator", function () {
|
describe("ShipGenerator", function () {
|
||||||
it("can use ship model", function () {
|
it("can use ship model", function () {
|
||||||
var gen = new ShipGenerator();
|
var gen = new ShipGenerator();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Generator of random ship
|
* Generator of random ship
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("ShipLevel", () => {
|
describe("ShipLevel", () => {
|
||||||
it("level up from experience points", () => {
|
it("level up from experience points", () => {
|
||||||
let level = new ShipLevel();
|
let level = new ShipLevel();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Level and experience system for a ship.
|
* Level and experience system for a ship.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// A model of ship
|
// A model of ship
|
||||||
// It defines the ship looks, and available slots for equipment
|
// It defines the ship looks, and available slots for equipment
|
||||||
export class ShipModel {
|
export class ShipModel {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("ShipValue", function () {
|
describe("ShipValue", function () {
|
||||||
it("is initially not limited", function () {
|
it("is initially not limited", function () {
|
||||||
var attr = new ShipValue("test");
|
var attr = new ShipValue("test");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
const SHIP_VALUES_DESCRIPTIONS: { [name: string]: string } = {
|
const SHIP_VALUES_DESCRIPTIONS: { [name: string]: string } = {
|
||||||
"materials skill": "Usage of physical materials such as bullets, shells...",
|
"materials skill": "Usage of physical materials such as bullets, shells...",
|
||||||
"photons skill": "Forces of light, and electromagnetic radiation",
|
"photons skill": "Forces of light, and electromagnetic radiation",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Shop", () => {
|
describe("Shop", () => {
|
||||||
it("generates a stock", () => {
|
it("generates a stock", () => {
|
||||||
let shop = new Shop();
|
let shop = new Shop();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* A shop is a place to buy/sell equipments
|
* A shop is a place to buy/sell equipments
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Slot", () => {
|
describe("Slot", () => {
|
||||||
it("checks equipment type", () => {
|
it("checks equipment type", () => {
|
||||||
var ship = new Ship();
|
var ship = new Ship();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Types of slots
|
// Types of slots
|
||||||
export enum SlotType {
|
export enum SlotType {
|
||||||
Hull,
|
Hull,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Star", () => {
|
describe("Star", () => {
|
||||||
it("lists links to other stars", () => {
|
it("lists links to other stars", () => {
|
||||||
var universe = new Universe();
|
var universe = new Universe();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// A star system
|
// A star system
|
||||||
export class Star {
|
export class Star {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("StarLink", () => {
|
describe("StarLink", () => {
|
||||||
it("checks link intersection", () => {
|
it("checks link intersection", () => {
|
||||||
var star1 = new Star(null, 0, 0);
|
var star1 = new Star(null, 0, 0);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// An hyperspace link between two star systems
|
// An hyperspace link between two star systems
|
||||||
export class StarLink {
|
export class StarLink {
|
||||||
// Stars
|
// Stars
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("StarLocation", () => {
|
describe("StarLocation", () => {
|
||||||
it("removes generated encounters that lose", function () {
|
it("removes generated encounters that lose", function () {
|
||||||
var location = new StarLocation(undefined, StarLocationType.PLANET, 0, 0);
|
var location = new StarLocation(undefined, StarLocationType.PLANET, 0, 0);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
export enum StarLocationType {
|
export enum StarLocationType {
|
||||||
STAR,
|
STAR,
|
||||||
WARP,
|
WARP,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Target", () => {
|
describe("Target", () => {
|
||||||
it("initializes from ship or location", () => {
|
it("initializes from ship or location", () => {
|
||||||
var target: Target;
|
var target: Target;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Find the nearest intersection between a line and a circle
|
// Find the nearest intersection between a line and a circle
|
||||||
// Circle is supposed to be centered at (0,0)
|
// Circle is supposed to be centered at (0,0)
|
||||||
// Nearest intersection to (x1,y1) is returned
|
// Nearest intersection to (x1,y1) is returned
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("TestTools", () => {
|
describe("TestTools", () => {
|
||||||
it("set ship power", () => {
|
it("set ship power", () => {
|
||||||
let ship = new Ship();
|
let ship = new Ship();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// unit testing utilities
|
// unit testing utilities
|
||||||
export class TestTools {
|
export class TestTools {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Universe", () => {
|
describe("Universe", () => {
|
||||||
it("generates star systems", () => {
|
it("generates star systems", () => {
|
||||||
var universe = new Universe();
|
var universe = new Universe();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Main game universe
|
* Main game universe
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("BaseAction", function () {
|
describe("BaseAction", function () {
|
||||||
it("check if equipment can be used with remaining AP", function () {
|
it("check if equipment can be used with remaining AP", function () {
|
||||||
var equipment = new Equipment(SlotType.Hull);
|
var equipment = new Equipment(SlotType.Hull);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Targetting mode for an action.
|
* Targetting mode for an action.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="../effects/BaseEffect.ts" />
|
/// <reference path="../effects/BaseEffect.ts" />
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("DeployDroneAction", function () {
|
describe("DeployDroneAction", function () {
|
||||||
it("stores useful information", function () {
|
it("stores useful information", function () {
|
||||||
let equipment = new Equipment(SlotType.Weapon, "testdrone");
|
let equipment = new Equipment(SlotType.Weapon, "testdrone");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseAction.ts"/>
|
/// <reference path="BaseAction.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Action to deploy a drone in space
|
* Action to deploy a drone in space
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("EndTurnAction", () => {
|
describe("EndTurnAction", () => {
|
||||||
it("can't be applied to non-playing ship", () => {
|
it("can't be applied to non-playing ship", () => {
|
||||||
spyOn(console, "warn").and.stub();
|
spyOn(console, "warn").and.stub();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Action to end the ship's turn
|
// Action to end the ship's turn
|
||||||
export class EndTurnAction extends BaseAction {
|
export class EndTurnAction extends BaseAction {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="../effects/BaseEffect.ts" />
|
/// <reference path="../effects/BaseEffect.ts" />
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("FireWeaponAction", function () {
|
describe("FireWeaponAction", function () {
|
||||||
it("constructs correctly", function () {
|
it("constructs correctly", function () {
|
||||||
let equipment = new Equipment(SlotType.Weapon, "testweapon");
|
let equipment = new Equipment(SlotType.Weapon, "testweapon");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseAction.ts"/>
|
/// <reference path="BaseAction.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Action to fire a weapon on another ship, or in space
|
* Action to fire a weapon on another ship, or in space
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("MoveAction", function () {
|
describe("MoveAction", function () {
|
||||||
it("checks movement against remaining AP", function () {
|
it("checks movement against remaining AP", function () {
|
||||||
var ship = new Ship();
|
var ship = new Ship();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
// Action to move to a given location
|
// Action to move to a given location
|
||||||
export class MoveAction extends BaseAction {
|
export class MoveAction extends BaseAction {
|
||||||
// Distance allowed for each power point (raw, without applying maneuvrability)
|
// Distance allowed for each power point (raw, without applying maneuvrability)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseAction.ts"/>
|
/// <reference path="BaseAction.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Action to toggle some effects on the ship or around it, until next turn start
|
* Action to toggle some effects on the ship or around it, until next turn start
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Duel between two AIs, over multiple battles
|
* Duel between two AIs, over multiple battles
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Base class for all Artificial Intelligence interaction
|
* Base class for all Artificial Intelligence interaction
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("Maneuver", function () {
|
describe("Maneuver", function () {
|
||||||
it("guesses weapon effects", function () {
|
it("guesses weapon effects", function () {
|
||||||
let battle = new Battle();
|
let battle = new Battle();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Ship maneuver for an artifical intelligence
|
* Ship maneuver for an artifical intelligence
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="Maneuver.ts" />
|
/// <reference path="Maneuver.ts" />
|
||||||
|
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("TacticalAI", function () {
|
describe("TacticalAI", function () {
|
||||||
class FixedManeuver extends Maneuver {
|
class FixedManeuver extends Maneuver {
|
||||||
score: number;
|
score: number;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="AbstractAI.ts"/>
|
/// <reference path="AbstractAI.ts"/>
|
||||||
/// <reference path="Maneuver.ts"/>
|
/// <reference path="Maneuver.ts"/>
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
|
|
||||||
export type TacticalProducer = Iterator<Maneuver>;
|
export type TacticalProducer = Iterator<Maneuver>;
|
||||||
export type TacticalEvaluator = (maneuver: Maneuver) => number;
|
export type TacticalEvaluator = (maneuver: Maneuver) => number;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("TacticalAIHelpers", function () {
|
describe("TacticalAIHelpers", function () {
|
||||||
it("produces direct weapon shots", function () {
|
it("produces direct weapon shots", function () {
|
||||||
let battle = new Battle();
|
let battle = new Battle();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Iterator of a list of "random" arena coordinates, based on a grid
|
* Iterator of a list of "random" arena coordinates, based on a grid
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("AttributeEffect", function () {
|
describe("AttributeEffect", function () {
|
||||||
it("is not applied directly", function () {
|
it("is not applied directly", function () {
|
||||||
let ship = new Ship();
|
let ship = new Ship();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseEffect.ts"/>
|
/// <reference path="BaseEffect.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Effect to modify an attribute.
|
* Effect to modify an attribute.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
describe("AttributeLimitEffect", function () {
|
describe("AttributeLimitEffect", function () {
|
||||||
it("limits an attribute", function () {
|
it("limits an attribute", function () {
|
||||||
let battle = new Battle();
|
let battle = new Battle();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseEffect.ts"/>
|
/// <reference path="BaseEffect.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Enforce a limitation on ship attribute final value
|
* Enforce a limitation on ship attribute final value
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("BaseEffect", function () {
|
describe("BaseEffect", function () {
|
||||||
it("gets a fixed or variable amount", function () {
|
it("gets a fixed or variable amount", function () {
|
||||||
let effect = new BaseEffect("test");
|
let effect = new BaseEffect("test");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
export type EffectAmount = number | { base: number, span: number };
|
export type EffectAmount = number | { base: number, span: number };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("DamageEffect", function () {
|
describe("DamageEffect", function () {
|
||||||
it("applies damage and wear", function () {
|
it("applies damage and wear", function () {
|
||||||
var ship = new Ship();
|
var ship = new Ship();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseEffect.ts"/>
|
/// <reference path="BaseEffect.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Apply damage on a ship.
|
* Apply damage on a ship.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseEffect.ts"/>
|
/// <reference path="BaseEffect.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Modify damage on ships.
|
* Modify damage on ships.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module TS.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
describe("RepelEffect", function () {
|
describe("RepelEffect", function () {
|
||||||
it("shows a textual description", function () {
|
it("shows a textual description", function () {
|
||||||
expect(new RepelEffect(34).getDescription()).toEqual("repel ships 34km away");
|
expect(new RepelEffect(34).getDescription()).toEqual("repel ships 34km away");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference path="BaseEffect.ts"/>
|
/// <reference path="BaseEffect.ts"/>
|
||||||
|
|
||||||
module TS.SpaceTac {
|
module TK.SpaceTac {
|
||||||
/**
|
/**
|
||||||
* Repel ships from a central point
|
* Repel ships from a central point
|
||||||
*/
|
*/
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue