Skip to content

Commit

Permalink
Added new scene: rest.
Browse files Browse the repository at this point in the history
  • Loading branch information
devapromix committed Jul 4, 2017
1 parent 7d0e814 commit 02bcc06
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
6 changes: 3 additions & 3 deletions uPlayer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ TPlayer = class(TEntity)
procedure AddExp(Value: Byte = 1);
procedure SkillSet;
procedure StarterSet;
procedure Rest(ATurns: Byte);
procedure Rest(ATurns: Word);
procedure Dialog(AMob: TMob);
procedure AutoPickup();
end;
Expand Down Expand Up @@ -963,9 +963,9 @@ procedure TPlayer.Wait;
Move(0, 0);
end;

procedure TPlayer.Rest(ATurns: Byte);
procedure TPlayer.Rest(ATurns: Word);
var
T: Byte;
T: Word;
begin
IsRest := True;
MsgLog.Add(Format(_('Start rest (%d turns)!'), [ATurns]));
Expand Down
48 changes: 45 additions & 3 deletions uScenes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface
type
TSceneEnum = (scTitle, scLoad, scHelp, scGame, scQuit, scWin, scDef, scInv,
scDrop, scItems, scAmount, scPlayer, scMessages, scStatistics, scDialog,
scSell, scRepair, scBuy, scCalendar, scDifficulty);
// scSpells, scIdentification, scRest
scSell, scRepair, scBuy, scCalendar, scDifficulty, scRest);
// scSpells, scIdentification

type
TScene = class(TObject)
Expand Down Expand Up @@ -78,6 +78,13 @@ TSceneCalendar = class(TScene)
procedure Update(var Key: Word); override;
end;

type
TSceneRest = class(TScene)
public
procedure Render; override;
procedure Update(var Key: Word); override;
end;

type
TSceneDialog = class(TScene)
public
Expand Down Expand Up @@ -316,6 +323,8 @@ constructor TScenes.Create;
FScene[I] := TSceneCalendar.Create;
scDifficulty:
FScene[I] := TSceneDifficulty.Create;
scRest:
FScene[I] := TSceneRest.Create;
end;
end;

Expand Down Expand Up @@ -741,7 +750,10 @@ procedure TSceneGame.Update(var Key: Word);
TK_K:
Scenes.SetScene(scCalendar);
TK_R:
Player.Rest(100);
begin
Game.Timer := High(Byte);
Scenes.SetScene(scRest);
end;
TK_G:
Player.Pickup;
TK_I:
Expand Down Expand Up @@ -1629,6 +1641,36 @@ procedure TSceneDifficulty.Update(var Key: Word);
end;
end;

{ TSceneRest }

procedure TSceneRest.Render;
var
Y: Byte;
begin
Self.Title(_('Rest'));

Self.FromAToZ;
Y := 1;

Inc(Y); Terminal.Print(1, Y, KeyStr(Chr(Y + 95)) + ' ' + _('Rest 10 turns'), TK_ALIGN_LEFT);
Inc(Y); Terminal.Print(1, Y, KeyStr(Chr(Y + 95)) + ' ' + _('Rest 100 turns'), TK_ALIGN_LEFT);
Inc(Y); Terminal.Print(1, Y, KeyStr(Chr(Y + 95)) + ' ' + _('Rest 1000 turns'), TK_ALIGN_LEFT);

MsgLog.Render(2, True);

AddKey('Esc', _('Back'), True, True);
end;

procedure TSceneRest.Update(var Key: Word);
begin
case Key of
TK_A, TK_B, TK_C:
Player.Rest(StrToInt('1' + StringOfChar('0', Key - TK_A + 1)));
TK_ESCAPE:
Scenes.SetScene(scGame);
end
end;

initialization

Scenes := TScenes.Create;
Expand Down

0 comments on commit 02bcc06

Please sign in to comment.