Skip to content

Commit 4660c65

Browse files
committed
Format source.
1 parent 8a165b2 commit 4660c65

File tree

4 files changed

+69
-59
lines changed

4 files changed

+69
-59
lines changed

uEntity.pas

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,24 @@ procedure TEntity.OnTurn;
8080
Value: Byte;
8181
begin
8282
for I := Low(TAbilityEnum) to High(TAbilityEnum) do
83-
if (Ability[I] > 0) then
84-
begin
85-
if (I in [abSleeping]) then Continue;
86-
Ability[I] := Ability[I] - 1;
87-
if (I in [abPoisoned, abBurning]) and not IsDead then
83+
if (Ability[I] > 0) then
8884
begin
89-
case I of
90-
abPoisoned:
91-
Value := Ability[I] div 10;
92-
abBurning:
93-
Value := Math.RandomRange(3, 5);
85+
if (I in [abSleeping]) then
86+
Continue;
87+
Ability[I] := Ability[I] - 1;
88+
if (I in [abPoisoned, abBurning]) and not IsDead then
89+
begin
90+
case I of
91+
abPoisoned:
92+
Value := Ability[I] div 10;
93+
abBurning:
94+
Value := Math.RandomRange(3, 5);
9495
else
9596
Value := 0;
97+
end;
98+
Life := Math.EnsureRange(Life - Value, 0, MaxLife);
9699
end;
97-
Life := Math.EnsureRange(Life - Value, 0, MaxLife);
98100
end;
99-
end;
100101
end;
101102

102103
destructor TEntity.Destroy;
@@ -177,7 +178,8 @@ procedure TEntity.ClearAbilities;
177178
var
178179
I: TAbilityEnum;
179180
begin
180-
for I := Low(TAbilityEnum) to High(TAbilityEnum) do Ability[I] := 0;
181+
for I := Low(TAbilityEnum) to High(TAbilityEnum) do
182+
Ability[I] := 0;
181183
end;
182184

183185
function TEntity.IsAbility(Value: TAbilityEnum): Boolean;

uItem.pas

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ interface
99
itBook, itFood, itBlade, itAxe, itSpear, itMace, itShield, itHeadgear,
1010
itBodyArmor);
1111

12-
// From Angband:
13-
// ! A potion (or flask) / A pole-arm
14-
// ? A scroll (or book) | An edged weapon
15-
// , Food \ A hafted weapon
16-
// - A wand or rod } A sling, bow, or x-bow
17-
// _ A staff { A shot, arrow, or bolt
18-
// = A ring ( Soft armour (cloak, robes, leather armor)
19-
// " An amulet [ Hard armour (metal armor)
20-
// $ Money or gems ] Misc. armour (gloves, helm, boots)
21-
// ~ Pelts and body parts ) A shield
22-
// & Chests, Containers
12+
// From Angband:
13+
// ! A potion (or flask) / A pole-arm
14+
// ? A scroll (or book) | An edged weapon
15+
// , Food \ A hafted weapon
16+
// - A wand or rod } A sling, bow, or x-bow
17+
// _ A staff { A shot, arrow, or bolt
18+
// = A ring ( Soft armour (cloak, robes, leather armor)
19+
// " An amulet [ Hard armour (metal armor)
20+
// $ Money or gems ] Misc. armour (gloves, helm, boots)
21+
// ~ Pelts and body parts ) A shield
22+
// & Chests, Containers
2323

2424
const
2525
PotionTypeItems = [itPotion];
@@ -69,12 +69,13 @@ TItemBase = record
6969
iLesserHealingPotion, iGreaterHealingPotion, iHeroicHealingPotion,
7070
iPotionOfFullHealing, iLesserRejuvenationPotion, iGreaterRejuvenationPotion,
7171
iHeroicRejuvenationPotion, iPotionOfFullRejuvenation, iLesserManaPotion,
72-
iGreaterManaPotion, iHeroicManaPotion, iPotionOfFullMana,
73-
iSoothingBalm, iHealingPoultice, iAntidote,
72+
iGreaterManaPotion, iHeroicManaPotion, iPotionOfFullMana, iSoothingBalm,
73+
iHealingPoultice, iAntidote,
7474
// Scrolls
7575
iScrollOfMinorHealing, iScrollOfLesserHealing, iScrollOfGreaterHealing,
76-
iScrollOfFullHealing, iScrollOfHunger, iScrollOfSidestepping, iScrollOfPhasing,
77-
iScrollOfTeleportation, iScrollOfDisappearing, iScrollOfTownPortal,
76+
iScrollOfFullHealing, iScrollOfHunger, iScrollOfSidestepping,
77+
iScrollOfPhasing, iScrollOfTeleportation, iScrollOfDisappearing,
78+
iScrollOfTownPortal,
7879
// Runes
7980
iRuneOfMinorHealing, iRuneOfLesserHealing, iRuneOfGreaterHealing,
8081
iRuneOfFullHealing, iRuneOfTeleportation, iRuneOfTownPortal,
@@ -195,17 +196,18 @@ TItemBase = record
195196
// Soothing Balm
196197
(Symbol: '!'; ItemType: itPotion; SlotType: stNone; MaxStack: 10;
197198
MaxDurability: 0; Level: 1; Price: 90; Color: clLightestYellow;
198-
Deep: [deDarkWood .. deDeepCave]; Effects: [efLife, efMana, efFood]; Value: 40;),
199+
Deep: [deDarkWood .. deDeepCave]; Effects: [efLife, efMana, efFood];
200+
Value: 40;),
199201
// Healing Poultice
200202
(Symbol: '!'; ItemType: itPotion; SlotType: stNone; MaxStack: 10;
201203
MaxDurability: 0; Level: 3; Price: 180; Color: clLightYellow;
202-
Deep: [deGrayCave .. deBloodCave]; Effects: [efLife, efMana, efCurePoison]; Value: 80;),
204+
Deep: [deGrayCave .. deBloodCave]; Effects: [efLife, efMana, efCurePoison];
205+
Value: 80;),
203206
// Antidote
204207
(Symbol: '!'; ItemType: itPotion; SlotType: stNone; MaxStack: 10;
205208
MaxDurability: 0; Level: 1; Price: 250; Color: clLightestGreen;
206209
Deep: [deDarkWood .. deDrom]; Effects: [efCurePoison]; Value: 100;),
207210

208-
209211
// Scroll of minor healing
210212
(Symbol: '?'; ItemType: itScroll; SlotType: stNone; MaxStack: 16;
211213
MaxDurability: 0; Level: 1; Price: 40; Color: clLightestBlue;

uPlayer.pas

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ procedure TPlayer.Attack(Index: Integer);
204204
Dam, Cr: Word;
205205
CrStr, The: string;
206206
begin
207-
if (Index < 0) then Exit;
207+
if (Index < 0) then
208+
Exit;
208209
Mob := Mobs.Mob[Index];
209210
if not Mob.Alive then
210211
Exit;
@@ -885,7 +886,9 @@ procedure TPlayer.PickUp;
885886
Game.Timer := High(Byte);
886887
Scenes.SetScene(scItems);
887888
end;
888-
end else MsgLog.Add(_('There is nothing here.'));
889+
end
890+
else
891+
MsgLog.Add(_('There is nothing here.'));
889892
end;
890893

891894
procedure TPlayer.PickUpAmount(Index: Integer);
@@ -938,7 +941,7 @@ procedure TPlayer.RenderInfo;
938941
begin
939942
Terminal.Print(Status.Left + Status.Width - 1, Status.Top + 1,
940943
Terminal.Colorize(Format('P%d', [Ability[abPoisoned]]), 'Poison'),
941-
TK_ALIGN_RIGHT);
944+
TK_ALIGN_RIGHT);
942945
end;
943946
//
944947
Terminal.Print(Status.Left - 1, Status.Top + 3,
@@ -1229,11 +1232,13 @@ procedure TPlayer.DoEffects(const Effects: TEffects; const Value: Word = 0);
12291232
if IsAbility(abPoisoned) then
12301233
begin
12311234
V := Self.GetSkillValue(skHealing) + Value;
1232-
Ability[abPoisoned] := Math.EnsureRange(Ability[abPoisoned] - V, 0, High(Word));
1235+
Ability[abPoisoned] := Math.EnsureRange(Ability[abPoisoned] - V, 0,
1236+
High(Word));
12331237
Self.Skill(skHealing);
12341238
if IsAbility(abPoisoned) then
12351239
MsgLog.Add(_('You feel better.'))
1236-
else MsgLog.Add(_('You are better now.'));
1240+
else
1241+
MsgLog.Add(_('You are better now.'));
12371242
end;
12381243
end;
12391244
// Gold

uScenes.pas

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ TScene = class(TObject)
2222
procedure AddLine(AHotKey, AText: string);
2323
procedure Add(); overload;
2424
procedure Add(AText: string; AValue: Integer); overload;
25-
procedure Add(AText: string; AValue: string; AColor: Cardinal = $FF00FF00); overload;
25+
procedure Add(AText: string; AValue: string;
26+
AColor: Cardinal = $FF00FF00); overload;
2627
public
2728
procedure Render; virtual; abstract;
2829
procedure Update(var Key: Word); virtual; abstract;
@@ -272,7 +273,7 @@ procedure TScene.Add;
272273
end;
273274

274275
procedure TScene.AddOption(AHotKey, AText: string; AOption: Boolean;
275-
AColor: Cardinal);
276+
AColor: Cardinal);
276277
begin
277278
Terminal.ForegroundColor(AColor);
278279
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, KeyStr(AHotKey) + ' ' + AText +
@@ -349,30 +350,30 @@ procedure TScene.FromAToZ;
349350

350351
procedure TScene.AddLine(AHotKey, AText: string);
351352
begin
352-
Terminal.Print(Math.IfThen(X = 1, 5, CX + 5), Y,
353-
KeyStr(AHotKey, AText), TK_ALIGN_LEFT);
353+
Terminal.Print(Math.IfThen(X = 1, 5, CX + 5), Y, KeyStr(AHotKey, AText),
354+
TK_ALIGN_LEFT);
354355
Self.Add();
355356
end;
356357

357-
procedure TScene.Add(AText: string; AValue: Integer);
358-
begin
359-
Terminal.ForegroundColor(clWhite);
360-
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
361-
Terminal.ForegroundColor(clGreen);
362-
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, IntToStr(AValue),
363-
TK_ALIGN_RIGHT);
364-
Self.Add();
365-
end;
358+
procedure TScene.Add(AText: string; AValue: Integer);
359+
begin
360+
Terminal.ForegroundColor(clWhite);
361+
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
362+
Terminal.ForegroundColor(clGreen);
363+
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, IntToStr(AValue),
364+
TK_ALIGN_RIGHT);
365+
Self.Add();
366+
end;
366367

367-
procedure TScene.Add(AText: string; AValue: string; AColor: Cardinal);
368-
begin
369-
Terminal.ForegroundColor(clWhite);
370-
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
371-
Terminal.ForegroundColor(AColor);
372-
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, AValue,
373-
TK_ALIGN_RIGHT);
374-
Self.Add();
375-
end;
368+
procedure TScene.Add(AText: string; AValue: string; AColor: Cardinal);
369+
begin
370+
Terminal.ForegroundColor(clWhite);
371+
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
372+
Terminal.ForegroundColor(AColor);
373+
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, AValue,
374+
TK_ALIGN_RIGHT);
375+
Self.Add();
376+
end;
376377

377378
{ TScenes }
378379

@@ -558,7 +559,7 @@ procedure TSceneHelp.Render;
558559
[_('Move'), KeyStr('arrow keys'), KeyStr('numpad'), KeyStr('QWEADZXC'),
559560
_('Wait'), KeyStr('5'), KeyStr('S')]), TK_ALIGN_CENTER);
560561

561-
X := 0;
562+
X := 0;
562563
Y := 15;
563564
AddLine('<', _('Go upstairs'));
564565
AddLine('>', _('Go downstairs'));

0 commit comments

Comments
 (0)