1
0
Fork 0

A bit of balancing

As ship models cannot be changed for now, they are set to be identical
This commit is contained in:
Michaël Lemaire 2017-05-23 18:43:05 +02:00
parent f15352759f
commit c53ceff4df
8 changed files with 49 additions and 62 deletions

View file

@ -76,7 +76,7 @@ module TS.SpaceTac.Specs {
session.startNewGame();
expect(session.player).not.toBeNull();
expect(session.player.fleet.ships.length).toBe(3);
expect(session.player.fleet.ships.length).toBe(4);
expect(session.player.fleet.credits).toBe(500);
expect(session.player.universe.stars.length).toBe(50);
expect(session.getBattle()).toBeNull();

View file

@ -53,7 +53,7 @@ module TS.SpaceTac {
start_location.addShop();
this.player = new Player(this.universe);
this.player.fleet = fleet_generator.generate(1, this.player);
this.player.fleet = fleet_generator.generate(1, this.player, 4);
this.player.fleet.setLocation(start_location);
this.player.fleet.credits = 500;
}

View file

@ -100,7 +100,7 @@ module TS.SpaceTac {
play_priority = 0;
// Create a new ship inside a fleet
constructor(fleet: Fleet | null = null, name = "Ship", model = new ShipModel("default", "Default", 1, 0)) {
constructor(fleet: Fleet | null = null, name = "Ship", model = new ShipModel("default", "Default", 1, 0, false, 0)) {
this.fleet = fleet || new Fleet();
this.name = name;
this.alive = true;

View file

@ -2,14 +2,18 @@ module TS.SpaceTac.Specs {
describe("ShipGenerator", function () {
it("can use ship model", function () {
var gen = new ShipGenerator();
var model = new ShipModel("test", "Test", 1, 2, SlotType.Shield, SlotType.Weapon, SlotType.Weapon);
var model = new ShipModel("test", "Test", 1, 2, true, 3);
var ship = gen.generate(1, model);
expect(ship.model).toBe(model);
expect(ship.cargo_space).toBe(2);
expect(ship.slots.length).toBe(3);
expect(ship.slots[0].type).toBe(SlotType.Shield);
expect(ship.slots[1].type).toBe(SlotType.Weapon);
expect(ship.slots[2].type).toBe(SlotType.Weapon);
expect(ship.slots.length).toBe(7);
expect(ship.slots[0].type).toBe(SlotType.Hull);
expect(ship.slots[1].type).toBe(SlotType.Shield);
expect(ship.slots[2].type).toBe(SlotType.Power);
expect(ship.slots[3].type).toBe(SlotType.Engine);
expect(ship.slots[4].type).toBe(SlotType.Weapon);
expect(ship.slots[5].type).toBe(SlotType.Weapon);
expect(ship.slots[6].type).toBe(SlotType.Weapon);
expect(ship.getAttribute("skill_material")).toBe(1);
});
});

View file

@ -17,12 +17,13 @@ module TS.SpaceTac {
// Available slots
slots: SlotType[];
constructor(code: string, name: string, level: number, cargo: number, ...slots: SlotType[]) {
constructor(code: string, name: string, level = 1, cargo = 6, default_slots = true, weapon_slots = 2) {
this.code = code;
this.name = name;
this.level = level;
this.cargo = cargo;
this.slots = slots;
this.slots = default_slots ? [SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine] : [];
range(weapon_slots).forEach(() => this.slots.push(SlotType.Weapon));
}
// Get the default ship model collection available in-game
@ -30,41 +31,19 @@ module TS.SpaceTac {
// TODO Store in cache
var result: ShipModel[] = [];
result.push(new ShipModel("scout", "Scout", 1, 2, SlotType.Hull, SlotType.Power, SlotType.Power, SlotType.Engine, SlotType.Weapon));
result.push(new ShipModel("breeze", "Breeze", 1, 0, SlotType.Hull, SlotType.Power, SlotType.Power, SlotType.Engine, SlotType.Engine, SlotType.Weapon));
result.push(new ShipModel("creeper", "Creeper", 1, 2, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("whirlwind", "Whirlwind", 1, 8, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("tomahawk", "Tomahawk", 1, 8, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("avenger", "Avenger", 1, 4, SlotType.Hull, SlotType.Shield, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("commodore", "Commodore", 1, 4, SlotType.Hull, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("falcon", "Falcon", 1, 2, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon, SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("flea", "Flea", 1, 0, SlotType.Hull, SlotType.Power, SlotType.Power, SlotType.Engine, SlotType.Engine, SlotType.Weapon));
result.push(new ShipModel("jumper", "Jumper", 1, 2, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("rhino", "Rhino", 1, 16, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon));
result.push(new ShipModel("trapper", "Trapper", 1, 8, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("xander", "Xander", 1, 8, SlotType.Hull, SlotType.Shield, SlotType.Power, SlotType.Engine,
SlotType.Weapon, SlotType.Weapon));
result.push(new ShipModel("scout", "Scout"));
result.push(new ShipModel("breeze", "Breeze"));
result.push(new ShipModel("creeper", "Creeper"));
result.push(new ShipModel("whirlwind", "Whirlwind"));
result.push(new ShipModel("tomahawk", "Tomahawk"));
result.push(new ShipModel("avenger", "Avenger"));
result.push(new ShipModel("commodore", "Commodore"));
result.push(new ShipModel("falcon", "Falcon"));
result.push(new ShipModel("flea", "Flea"));
result.push(new ShipModel("jumper", "Jumper"));
result.push(new ShipModel("rhino", "Rhino"));
result.push(new ShipModel("trapper", "Trapper"));
result.push(new ShipModel("xander", "Xander"));
return result;
}

View file

@ -66,8 +66,12 @@ module TS.SpaceTac {
if (this.encounter_random.random() < 0.8) {
var fleet_generator = new FleetGenerator(this.encounter_random);
var ship_count = this.encounter_random.randInt(1, 5);
this.encounter = fleet_generator.generate(this.star.level, new Player(this.star.universe, "Enemy"), ship_count, true);
let variations: [number, number][] = [[this.star.level, 4], [this.star.level + 1, 3], [this.star.level + 2, 2]];
if (this.star.level > 1) {
variations.push([this.star.level - 1, 5]);
}
let [level, enemies] = this.encounter_random.choice(variations);
this.encounter = fleet_generator.generate(level, new Player(this.star.universe, "Enemy"), enemies, true);
}
}

View file

@ -7,36 +7,36 @@ module TS.SpaceTac.Equipments {
expect(equipment.requirements).toEqual({ "skill_energy": 1 });
expect(equipment.effects).toEqual([
new AttributeEffect("initiative", 1),
new AttributeEffect("power_capacity", 6),
new AttributeEffect("power_initial", 4),
new AttributeEffect("power_recovery", 3),
new AttributeEffect("power_capacity", 8),
new AttributeEffect("power_initial", 5),
new AttributeEffect("power_recovery", 4),
]);
equipment = template.generate(2);
expect(equipment.requirements).toEqual({ "skill_energy": 2 });
expect(equipment.effects).toEqual([
new AttributeEffect("initiative", 2),
new AttributeEffect("power_capacity", 7),
new AttributeEffect("power_initial", 4),
new AttributeEffect("power_recovery", 3),
new AttributeEffect("power_capacity", 9),
new AttributeEffect("power_initial", 5),
new AttributeEffect("power_recovery", 4),
]);
equipment = template.generate(3);
expect(equipment.requirements).toEqual({ "skill_energy": 3 });
expect(equipment.effects).toEqual([
new AttributeEffect("initiative", 3),
new AttributeEffect("power_capacity", 8),
new AttributeEffect("power_initial", 5),
new AttributeEffect("power_recovery", 3),
new AttributeEffect("power_capacity", 10),
new AttributeEffect("power_initial", 6),
new AttributeEffect("power_recovery", 4),
]);
equipment = template.generate(10);
expect(equipment.requirements).toEqual({ "skill_energy": 10 });
expect(equipment.effects).toEqual([
new AttributeEffect("initiative", 10),
new AttributeEffect("power_capacity", 15),
new AttributeEffect("power_initial", 8),
new AttributeEffect("power_recovery", 5),
new AttributeEffect("power_capacity", 17),
new AttributeEffect("power_initial", 9),
new AttributeEffect("power_recovery", 6),
]);
});
});

View file

@ -7,9 +7,9 @@ module TS.SpaceTac.Equipments {
this.setSkillsRequirements({ "skill_energy": 1 });
this.addAttributeEffect("initiative", istep(1));
this.addAttributeEffect("power_capacity", istep(6));
this.addAttributeEffect("power_initial", istep(4, irepeat(0.5)));
this.addAttributeEffect("power_recovery", istep(3, irepeat(0.3)));
this.addAttributeEffect("power_capacity", istep(8));
this.addAttributeEffect("power_initial", istep(5, irepeat(0.5)));
this.addAttributeEffect("power_recovery", istep(4, irepeat(0.3)));
}
}
}