Skip to content

Commit

Permalink
Format source.
Browse files Browse the repository at this point in the history
  • Loading branch information
devapromix committed Aug 20, 2017
1 parent 8a165b2 commit 4660c65
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 59 deletions.
28 changes: 15 additions & 13 deletions uEntity.pas
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,24 @@ procedure TEntity.OnTurn;
Value: Byte;
begin
for I := Low(TAbilityEnum) to High(TAbilityEnum) do
if (Ability[I] > 0) then
begin
if (I in [abSleeping]) then Continue;
Ability[I] := Ability[I] - 1;
if (I in [abPoisoned, abBurning]) and not IsDead then
if (Ability[I] > 0) then
begin
case I of
abPoisoned:
Value := Ability[I] div 10;
abBurning:
Value := Math.RandomRange(3, 5);
if (I in [abSleeping]) then
Continue;
Ability[I] := Ability[I] - 1;
if (I in [abPoisoned, abBurning]) and not IsDead then
begin
case I of
abPoisoned:
Value := Ability[I] div 10;
abBurning:
Value := Math.RandomRange(3, 5);
else
Value := 0;
end;
Life := Math.EnsureRange(Life - Value, 0, MaxLife);
end;
Life := Math.EnsureRange(Life - Value, 0, MaxLife);
end;
end;
end;

destructor TEntity.Destroy;
Expand Down Expand Up @@ -177,7 +178,8 @@ procedure TEntity.ClearAbilities;
var
I: TAbilityEnum;
begin
for I := Low(TAbilityEnum) to High(TAbilityEnum) do Ability[I] := 0;
for I := Low(TAbilityEnum) to High(TAbilityEnum) do
Ability[I] := 0;
end;

function TEntity.IsAbility(Value: TAbilityEnum): Boolean;
Expand Down
38 changes: 20 additions & 18 deletions uItem.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ interface
itBook, itFood, itBlade, itAxe, itSpear, itMace, itShield, itHeadgear,
itBodyArmor);

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

const
PotionTypeItems = [itPotion];
Expand Down Expand Up @@ -69,12 +69,13 @@ TItemBase = record
iLesserHealingPotion, iGreaterHealingPotion, iHeroicHealingPotion,
iPotionOfFullHealing, iLesserRejuvenationPotion, iGreaterRejuvenationPotion,
iHeroicRejuvenationPotion, iPotionOfFullRejuvenation, iLesserManaPotion,
iGreaterManaPotion, iHeroicManaPotion, iPotionOfFullMana,
iSoothingBalm, iHealingPoultice, iAntidote,
iGreaterManaPotion, iHeroicManaPotion, iPotionOfFullMana, iSoothingBalm,
iHealingPoultice, iAntidote,
// Scrolls
iScrollOfMinorHealing, iScrollOfLesserHealing, iScrollOfGreaterHealing,
iScrollOfFullHealing, iScrollOfHunger, iScrollOfSidestepping, iScrollOfPhasing,
iScrollOfTeleportation, iScrollOfDisappearing, iScrollOfTownPortal,
iScrollOfFullHealing, iScrollOfHunger, iScrollOfSidestepping,
iScrollOfPhasing, iScrollOfTeleportation, iScrollOfDisappearing,
iScrollOfTownPortal,
// Runes
iRuneOfMinorHealing, iRuneOfLesserHealing, iRuneOfGreaterHealing,
iRuneOfFullHealing, iRuneOfTeleportation, iRuneOfTownPortal,
Expand Down Expand Up @@ -195,17 +196,18 @@ TItemBase = record
// Soothing Balm
(Symbol: '!'; ItemType: itPotion; SlotType: stNone; MaxStack: 10;
MaxDurability: 0; Level: 1; Price: 90; Color: clLightestYellow;
Deep: [deDarkWood .. deDeepCave]; Effects: [efLife, efMana, efFood]; Value: 40;),
Deep: [deDarkWood .. deDeepCave]; Effects: [efLife, efMana, efFood];
Value: 40;),
// Healing Poultice
(Symbol: '!'; ItemType: itPotion; SlotType: stNone; MaxStack: 10;
MaxDurability: 0; Level: 3; Price: 180; Color: clLightYellow;
Deep: [deGrayCave .. deBloodCave]; Effects: [efLife, efMana, efCurePoison]; Value: 80;),
Deep: [deGrayCave .. deBloodCave]; Effects: [efLife, efMana, efCurePoison];
Value: 80;),
// Antidote
(Symbol: '!'; ItemType: itPotion; SlotType: stNone; MaxStack: 10;
MaxDurability: 0; Level: 1; Price: 250; Color: clLightestGreen;
Deep: [deDarkWood .. deDrom]; Effects: [efCurePoison]; Value: 100;),


// Scroll of minor healing
(Symbol: '?'; ItemType: itScroll; SlotType: stNone; MaxStack: 16;
MaxDurability: 0; Level: 1; Price: 40; Color: clLightestBlue;
Expand Down
15 changes: 10 additions & 5 deletions uPlayer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ procedure TPlayer.Attack(Index: Integer);
Dam, Cr: Word;
CrStr, The: string;
begin
if (Index < 0) then Exit;
if (Index < 0) then
Exit;
Mob := Mobs.Mob[Index];
if not Mob.Alive then
Exit;
Expand Down Expand Up @@ -885,7 +886,9 @@ procedure TPlayer.PickUp;
Game.Timer := High(Byte);
Scenes.SetScene(scItems);
end;
end else MsgLog.Add(_('There is nothing here.'));
end
else
MsgLog.Add(_('There is nothing here.'));
end;

procedure TPlayer.PickUpAmount(Index: Integer);
Expand Down Expand Up @@ -938,7 +941,7 @@ procedure TPlayer.RenderInfo;
begin
Terminal.Print(Status.Left + Status.Width - 1, Status.Top + 1,
Terminal.Colorize(Format('P%d', [Ability[abPoisoned]]), 'Poison'),
TK_ALIGN_RIGHT);
TK_ALIGN_RIGHT);
end;
//
Terminal.Print(Status.Left - 1, Status.Top + 3,
Expand Down Expand Up @@ -1229,11 +1232,13 @@ procedure TPlayer.DoEffects(const Effects: TEffects; const Value: Word = 0);
if IsAbility(abPoisoned) then
begin
V := Self.GetSkillValue(skHealing) + Value;
Ability[abPoisoned] := Math.EnsureRange(Ability[abPoisoned] - V, 0, High(Word));
Ability[abPoisoned] := Math.EnsureRange(Ability[abPoisoned] - V, 0,
High(Word));
Self.Skill(skHealing);
if IsAbility(abPoisoned) then
MsgLog.Add(_('You feel better.'))
else MsgLog.Add(_('You are better now.'));
else
MsgLog.Add(_('You are better now.'));
end;
end;
// Gold
Expand Down
47 changes: 24 additions & 23 deletions uScenes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ TScene = class(TObject)
procedure AddLine(AHotKey, AText: string);
procedure Add(); overload;
procedure Add(AText: string; AValue: Integer); overload;
procedure Add(AText: string; AValue: string; AColor: Cardinal = $FF00FF00); overload;
procedure Add(AText: string; AValue: string;
AColor: Cardinal = $FF00FF00); overload;
public
procedure Render; virtual; abstract;
procedure Update(var Key: Word); virtual; abstract;
Expand Down Expand Up @@ -272,7 +273,7 @@ procedure TScene.Add;
end;

procedure TScene.AddOption(AHotKey, AText: string; AOption: Boolean;
AColor: Cardinal);
AColor: Cardinal);
begin
Terminal.ForegroundColor(AColor);
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, KeyStr(AHotKey) + ' ' + AText +
Expand Down Expand Up @@ -349,30 +350,30 @@ procedure TScene.FromAToZ;

procedure TScene.AddLine(AHotKey, AText: string);
begin
Terminal.Print(Math.IfThen(X = 1, 5, CX + 5), Y,
KeyStr(AHotKey, AText), TK_ALIGN_LEFT);
Terminal.Print(Math.IfThen(X = 1, 5, CX + 5), Y, KeyStr(AHotKey, AText),
TK_ALIGN_LEFT);
Self.Add();
end;

procedure TScene.Add(AText: string; AValue: Integer);
begin
Terminal.ForegroundColor(clWhite);
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
Terminal.ForegroundColor(clGreen);
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, IntToStr(AValue),
TK_ALIGN_RIGHT);
Self.Add();
end;
procedure TScene.Add(AText: string; AValue: Integer);
begin
Terminal.ForegroundColor(clWhite);
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
Terminal.ForegroundColor(clGreen);
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, IntToStr(AValue),
TK_ALIGN_RIGHT);
Self.Add();
end;

procedure TScene.Add(AText: string; AValue: string; AColor: Cardinal);
begin
Terminal.ForegroundColor(clWhite);
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
Terminal.ForegroundColor(AColor);
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, AValue,
TK_ALIGN_RIGHT);
Self.Add();
end;
procedure TScene.Add(AText: string; AValue: string; AColor: Cardinal);
begin
Terminal.ForegroundColor(clWhite);
Terminal.Print(IfThen(X = 1, 3, CX + 3), Y, AText + ':', TK_ALIGN_LEFT);
Terminal.ForegroundColor(AColor);
Terminal.Print(IfThen(X = 1, CX - 1, CX + (CX - 1)), Y, AValue,
TK_ALIGN_RIGHT);
Self.Add();
end;

{ TScenes }

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

X := 0;
X := 0;
Y := 15;
AddLine('<', _('Go upstairs'));
AddLine('>', _('Go downstairs'));
Expand Down

0 comments on commit 4660c65

Please sign in to comment.