Fix progbar on Prologue

This commit is contained in:
Eric Fredricksen
2010-07-06 12:28:56 -07:00
parent 3a95afe007
commit 6ccb3c4d0b
2 changed files with 39 additions and 27 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ function template(tmpl, data) {
} }
return null; return null;
}); });
return dict || ''; if (dict === undefined) dict = '';
return dict;
}); });
return brag; return brag;
} }
+37 -26
View File
@@ -3,7 +3,6 @@
// TODO: Test use of seed as DNA // TODO: Test use of seed as DNA
// TODO: Layout newguy and main better // TODO: Layout newguy and main better
// TODO: fix Prologue plot bar // TODO: fix Prologue plot bar
// TODO: limit number of Acts
// TODO: get first quest // TODO: get first quest
// revs: // revs:
@@ -535,7 +534,34 @@ var Kill;
var AllBars, AllLists; var AllBars, AllLists;
function GoButtonClick() { function InitializeCharacter(sheet) {
game = sheet;
Put(Traits, 'Name', sheet.name);
Put(Traits, 'Level', 1);
Put(Traits, 'Race', sheet.race);
Put(Traits, 'Class', sheet['class']);
Put(Stats, 'STR', sheet.STR);
Put(Stats, 'CON', sheet.CON);
Put(Stats, 'DEX', sheet.DEX);
Put(Stats, 'INT', sheet.INT);
Put(Stats, 'WIS', sheet.WIS);
Put(Stats, 'CHA', sheet.CHA);
Put(Stats, 'HP Max', Random(8) + sheet.CON.div(6));
Put(Stats, 'MP Max', Random(8) + sheet.INT.div(6));
game.Equips = {best: 'Sharp Stick'};
Put(Equips, 'Weapon', game.Equips.best);
Put(Inventory,'Gold',0);
SaveGame();
ClearAllSelections();
// GoButtonClick();
ExpBar.reset(LevelUpTime(1)); ExpBar.reset(LevelUpTime(1));
game.task = ''; game.task = '';
@@ -551,13 +577,13 @@ function GoButtonClick() {
PlotBar.reset(26); PlotBar.reset(26);
Plots.Add('Prologue'); Plots.Add('Prologue');
game.act = 0;
//debugger;
QuestBar.reset(1); QuestBar.reset(1);
EncumBar.reset(GetI(Stats, "STR") + 10); EncumBar.reset(GetI(Stats, "STR") + 10);
Put(Inventory, "Gold", 0);
Put(Equips, "Hauberk", "-3 Burlap"); Put(Equips, "Hauberk", "-3 Burlap");
ClearAllSelections(); ClearAllSelections();
@@ -793,8 +819,11 @@ function toArabic(s) {
function CompleteAct() { function CompleteAct() {
Plots.rows().find("input:checkbox").attr("checked", "true"); Plots.rows().find("input:checkbox").attr("checked", "true");
PlotBar.reset(60 * 60 * (1 + 5 * Plots.length())); // 1 hr + 5/act game.act += 1;
Plots.Add('Act ' + toRoman(Plots.length())); PlotBar.reset(60 * 60 * (1 + 5 * game.act)); // 1 hr + 5/act
while (Plots.length() > 99)
Plots.remove(0);
Plots.Add('Act ' + toRoman(game.act));
WinItem(); WinItem();
WinEquip(); WinEquip();
@@ -924,7 +953,7 @@ function Timer1Timer() {
} }
// advance plot // advance plot
if (gain) { if (gain || !game.act) {
if (PlotBar.done()) if (PlotBar.done())
InterplotCinematic(); InterplotCinematic();
else else
@@ -982,25 +1011,7 @@ function LoadCharacter() {
if (!sheet.Traits) { if (!sheet.Traits) {
// New game // New game
game = sheet; InitializeCharacter(sheet);
Put(Traits, 'Name', sheet.name);
Put(Traits, 'Level', 1);
Put(Traits, 'Race', sheet.race);
Put(Traits, 'Class', sheet['class']);
Put(Stats, 'STR', sheet.STR);
Put(Stats, 'CON', sheet.CON);
Put(Stats, 'DEX', sheet.DEX);
Put(Stats, 'INT', sheet.INT);
Put(Stats, 'WIS', sheet.WIS);
Put(Stats, 'CHA', sheet.CHA);
Put(Stats, 'HP Max', Random(8) + sheet.CON.div(6));
Put(Stats, 'MP Max', Random(8) + sheet.INT.div(6));
game.Equips = {best: 'Sharp Stick'};
Put(Equips, 'Weapon', game.Equips.best);
Put(Inventory,'Gold',0);
SaveGame();
ClearAllSelections();
GoButtonClick();
} else { } else {
LoadGame(sheet); LoadGame(sheet);
} }