1
0
Fork 0

Fixed loot level generation

This commit is contained in:
Michaël Lemaire 2015-01-14 01:00:00 +01:00 committed by Michaël Lemaire
parent 968c22c59f
commit 2a12a671a2
2 changed files with 4 additions and 3 deletions

View file

@ -80,7 +80,7 @@ module SpaceTac.Game {
if (level.max >= this.min_level.max) {
max = 1.0;
} else {
max = this.min_level.getReverseProportional(level.max);
max = this.min_level.getReverseProportional(level.max + 1);
}
return new Range(min, max);
@ -93,6 +93,7 @@ module SpaceTac.Game {
random = random || new RandomGenerator();
var random_range = this.getPowerRangeForLevel(level);
console.log(level, random_range);
if (random_range) {
var power = random.throw() * (random_range.max - random_range.min) + random_range.min;
return this.generateFixed(power);

View file

@ -8,7 +8,7 @@ module SpaceTac.Game.Specs {
super(SlotType.Shield, "Hexagrid Shield");
this.min_level = new IntegerRange(2, 100);
this.ap_usage = new Range(6, 8);
this.ap_usage = new Range(6, 15);
}
}
@ -23,7 +23,7 @@ module SpaceTac.Game.Specs {
expect(equipment.slot).toBe(SlotType.Shield);
expect(equipment.name).toEqual("Hexagrid Shield");
expect(equipment.min_level).toBe(5);
expect(equipment.ap_usage).toEqual(7);
expect(equipment.ap_usage).toBeCloseTo(6.2727, 0.00001);
});
});
}