Skip to content

Commit 02bcc06

Browse files
committed
Added new scene: rest.
1 parent 7d0e814 commit 02bcc06

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

uPlayer.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ TPlayer = class(TEntity)
144144
procedure AddExp(Value: Byte = 1);
145145
procedure SkillSet;
146146
procedure StarterSet;
147-
procedure Rest(ATurns: Byte);
147+
procedure Rest(ATurns: Word);
148148
procedure Dialog(AMob: TMob);
149149
procedure AutoPickup();
150150
end;
@@ -963,9 +963,9 @@ procedure TPlayer.Wait;
963963
Move(0, 0);
964964
end;
965965

966-
procedure TPlayer.Rest(ATurns: Byte);
966+
procedure TPlayer.Rest(ATurns: Word);
967967
var
968-
T: Byte;
968+
T: Word;
969969
begin
970970
IsRest := True;
971971
MsgLog.Add(Format(_('Start rest (%d turns)!'), [ATurns]));

uScenes.pas

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ interface
88
type
99
TSceneEnum = (scTitle, scLoad, scHelp, scGame, scQuit, scWin, scDef, scInv,
1010
scDrop, scItems, scAmount, scPlayer, scMessages, scStatistics, scDialog,
11-
scSell, scRepair, scBuy, scCalendar, scDifficulty);
12-
// scSpells, scIdentification, scRest
11+
scSell, scRepair, scBuy, scCalendar, scDifficulty, scRest);
12+
// scSpells, scIdentification
1313

1414
type
1515
TScene = class(TObject)
@@ -78,6 +78,13 @@ TSceneCalendar = class(TScene)
7878
procedure Update(var Key: Word); override;
7979
end;
8080

81+
type
82+
TSceneRest = class(TScene)
83+
public
84+
procedure Render; override;
85+
procedure Update(var Key: Word); override;
86+
end;
87+
8188
type
8289
TSceneDialog = class(TScene)
8390
public
@@ -316,6 +323,8 @@ constructor TScenes.Create;
316323
FScene[I] := TSceneCalendar.Create;
317324
scDifficulty:
318325
FScene[I] := TSceneDifficulty.Create;
326+
scRest:
327+
FScene[I] := TSceneRest.Create;
319328
end;
320329
end;
321330

@@ -741,7 +750,10 @@ procedure TSceneGame.Update(var Key: Word);
741750
TK_K:
742751
Scenes.SetScene(scCalendar);
743752
TK_R:
744-
Player.Rest(100);
753+
begin
754+
Game.Timer := High(Byte);
755+
Scenes.SetScene(scRest);
756+
end;
745757
TK_G:
746758
Player.Pickup;
747759
TK_I:
@@ -1629,6 +1641,36 @@ procedure TSceneDifficulty.Update(var Key: Word);
16291641
end;
16301642
end;
16311643

1644+
{ TSceneRest }
1645+
1646+
procedure TSceneRest.Render;
1647+
var
1648+
Y: Byte;
1649+
begin
1650+
Self.Title(_('Rest'));
1651+
1652+
Self.FromAToZ;
1653+
Y := 1;
1654+
1655+
Inc(Y); Terminal.Print(1, Y, KeyStr(Chr(Y + 95)) + ' ' + _('Rest 10 turns'), TK_ALIGN_LEFT);
1656+
Inc(Y); Terminal.Print(1, Y, KeyStr(Chr(Y + 95)) + ' ' + _('Rest 100 turns'), TK_ALIGN_LEFT);
1657+
Inc(Y); Terminal.Print(1, Y, KeyStr(Chr(Y + 95)) + ' ' + _('Rest 1000 turns'), TK_ALIGN_LEFT);
1658+
1659+
MsgLog.Render(2, True);
1660+
1661+
AddKey('Esc', _('Back'), True, True);
1662+
end;
1663+
1664+
procedure TSceneRest.Update(var Key: Word);
1665+
begin
1666+
case Key of
1667+
TK_A, TK_B, TK_C:
1668+
Player.Rest(StrToInt('1' + StringOfChar('0', Key - TK_A + 1)));
1669+
TK_ESCAPE:
1670+
Scenes.SetScene(scGame);
1671+
end
1672+
end;
1673+
16321674
initialization
16331675

16341676
Scenes := TScenes.Create;

0 commit comments

Comments
 (0)