-
Notifications
You must be signed in to change notification settings - Fork 16
/
skilluse.pp
582 lines (506 loc) · 19.6 KB
/
skilluse.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
unit SkillUse;
{ This unit should cover the usage of skills for the RPG game. }
{ Actually, it doesn't cover the usage of all skills- most of }
{ them get implemented in other places (combat skills in the }
{ attacker unit, conversation skills in the interact unit, etc). }
{ This unit covers those skills which pretty well need their }
{ own interface/code... repair skills, picking pockets, etc. }
{
GearHead2, a roguelike mecha CRPG
Copyright (C) 2005 Joseph Hewitt
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
The full text of the LGPL can be found in license.txt.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
{$LONGSTRINGS ON}
interface
uses gears,locale,ghchars;
const
Repair_Mental_Strain = 1;
Repair_Max_Tries = 5;
Performance_Range = 9;
Performance_Base_Cash = -50;
TRIGGER_Applause = 'APPLAUSE';
Repair_Skill_Needed: Array [0..NumMaterial] of Byte = (
NAS_Repair, NAS_Medicine, NAS_Repair
);
Function TotalRepairableDamage( Target: GearPtr; Material: Integer ): LongInt;
Procedure ApplyRepairPoints( Target: GearPtr; Material: Integer; var RP: LongInt; CureStatus: Boolean );
Procedure ApplyEmergencyRepairPoints( Target: GearPtr; Material: Integer; var RP: LongInt );
Function RepairNeededBySkill( Target: GearPtr; Skill: Integer ): LongInt;
Function CanRepairUsingSkill( NPC,Target: GearPtr; Skill: Integer ): Boolean;
Function UseRepairSkill( GB: GameBoardPtr; PC,Target: GearPtr; Skill: Integer ): Boolean;
Procedure DoCompleteRepair( Target: GearPtr );
Function SelectPerformanceTarget( GB: GameBoardPtr; PC: GearPtr ): GearPtr;
Function UsePerformance( GB: GameBoardPtr; PC,NPC: GearPtr ): LongInt;
implementation
uses ability,action,gearutil,ghholder,ghmodule,ghmovers,ghswag,
ghweapon,movement,interact,rpgdice,texutil,narration,ghsupport;
Function TotalRepairableDamage( Target: GearPtr; Material: Integer ): LongInt;
{ Search through TARGET, and calculate how much damage it has }
{ that can be repaired using SKILL. }
var
Part: GearPtr;
AD,SD,TCom,SCom,it: LongInt;
T: Integer;
begin
{ Normally damage must be positive I know, but I just had a bug }
{ which resulted in negative damage. This prevented the rest of }
{ the damage to a mek/character from being repaired. So, taking }
{ absolute value should fix all the mess & prevent it from }
{ happening again. }
SD := Abs( NAttValue( Target^.NA , NAG_Damage , NAS_StrucDamage ) );
AD := Abs( NAttValue( Target^.NA , NAG_Damage , NAS_ArmorDamage ) );
it := 0;
{ If this part is damaged, and if the needed repair skill is }
{ the skill we're looking for, add the damage to the total. }
if NAttValue( Target^.NA , NAG_GearOps , NAS_Material ) = Material then begin
it := AD + SD;
{ Modify for complexity. }
if not IsMasterGear( Target ) then begin
TCom := ComponentComplexity( Target );
SCom := SubComComplexity( Target );
if SCom > TCom then begin
it := ( it * SCom ) div TCom;
end;
end;
{ Check for status effects. }
for t := 1 to Num_Status_FX do begin
if SX_Repairable[t] and ( NAttValue( Target^.NA , NAG_StatusEffect , T ) <> 0 ) then begin
it := it + SX_RepCost[ T ];
end;
end;
end;
{ Check the sub-components for damage. }
Part := Target^.SubCom;
while Part <> Nil do begin
it := it + TotalRepairableDamage( Part , Material );
Part := Part^.Next;
end;
{ Check the inv-components for damage. }
Part := Target^.InvCom;
while Part <> Nil do begin
it := it + TotalRepairableDamage( Part , Material );
Part := Part^.Next;
end;
TotalRepairableDamage := it;
end;
Procedure ApplyRepairPoints( Target: GearPtr; Material: Integer; var RP: LongInt; CureStatus: Boolean );
{ Search through TARGET, and restore DPs to parts }
{ that can be repaired using SKILL. }
var
Part: GearPtr;
SD,AD,TCom,SCom,ARP,RPNeeded: LongInt;
T: Integer;
begin
{ Only examine TARGET for damage if it's of a type that can be }
{ repaired using SKILL. }
if NAttValue( Target^.NA , NAG_GearOps , NAS_Material ) = Material then begin
{ Calculate structural damage and armor damage. }
SD := Abs( NAttValue( Target^.NA , NAG_Damage , NAS_StrucDamage ) );
if ( SD > 0 ) and ( RP > 0 ) then begin
{ Modify for complexity. }
ARP := RP;
RPNeeded := SD;
if not IsMasterGear( Target ) then begin
TCom := ComponentComplexity( Target );
SCom := SubComComplexity( Target );
if SCom > TCom then begin
RPNeeded := ( RPNeeded * SCom ) div TCom;
ARP := ( ARP * TCom ) div SCom;
if ARP < 1 then ARP := 1;
end;
end;
SD := SD - ARP;
RP := RP - RPNeeded;
if SD < 0 then SD := 0;
SetNAtt( Target^.NA , NAG_Damage , NAS_StrucDamage , SD );
end;
AD := Abs( NAttValue( Target^.NA , NAG_Damage , NAS_ArmorDamage ) );
if ( AD > 0 ) and ( RP > 0 ) then begin
{ Modify for complexity. }
ARP := RP;
RPNeeded := AD;
if not IsMasterGear( Target ) then begin
TCom := ComponentComplexity( Target );
SCom := SubComComplexity( Target );
if SCom > TCom then begin
RPNeeded := ( RPNeeded * SCom ) div TCom;
ARP := ( ARP * TCom ) div SCom;
if ARP < 1 then ARP := 1;
end;
end;
AD := AD - ARP;
RP := RP - RPNeeded;
if AD < 0 then AD := 0;
SetNAtt( Target^.NA , NAG_Damage , NAS_ArmorDamage , AD );
end;
{ Check for status effects. }
if CureStatus then begin
for t := 1 to Num_Status_FX do begin
if SX_Repairable[ t ] and ( NAttValue( Target^.NA , NAG_StatusEffect , T ) <> 0 ) then begin
if RP >= SX_RepCost[ t ] then begin
RP := RP - SX_RepCost[ t ];
SetNAtt( Target^.NA , NAG_StatusEffect , T , 0 );
end;
end;
end;
end;
end;
{ Check the sub-components for damage. }
Part := Target^.SubCom;
while ( Part <> Nil ) and ( RP > 0 ) do begin
ApplyRepairPoints( Part , Material , RP , CureStatus );
Part := Part^.Next;
end;
{ Check the inv-components for damage. }
Part := Target^.InvCom;
while ( Part <> Nil ) and ( RP > 0 ) do begin
ApplyRepairPoints( Part , Material , RP , CureStatus );
Part := Part^.Next;
end;
end;
Procedure ApplyEmergencyRepairPoints( Target: GearPtr; Material: Integer; var RP: LongInt );
{ Try to apply the repair points first to those parts of TARGET nessecary }
{ for it to function. If there are any points left over, apply these to the rest. }
Procedure ApplyPointsToPart( G,S: Integer );
{ Locate a part with the Gear G and S descriptors provided, }
{ and apply repair points to it first. }
var
Part: GearPtr;
begin
Part := SeekGear( Target , G , S , False );
if ( Part <> Nil ) and ( RP > 0 ) and Destroyed( Part ) then begin
ApplyRepairPoints( Part, Material, RP, False );
end;
end;
begin
if Target^.G = GG_Character then begin
ApplyPointsToPart( GG_Module , GS_Head );
ApplyPointsToPart( GG_Module , GS_Body );
if RP > 0 then ApplyRepairPoints( Target, Material, RP, False );
end else if Target^.G = GG_Mecha then begin
ApplyPointsToPart( GG_Support , GS_Engine );
ApplyPointsToPart( GG_Module , GS_Body );
if RP > 0 then ApplyRepairPoints( Target, Material, RP, False );
end else ApplyRepairPoints( Target, Material, RP, False );
if RP > 0 then ApplyRepairPoints( Target, Material, RP, True );
end;
Function RepairNeededBySkill( Target: GearPtr; Skill: Integer ): LongInt;
{ Return the amount of damage that can be affected by the listed skill. }
var
T,Total,RP: Longint;
begin
Total := 0;
for t := 0 to NumMaterial do begin
if ( Repair_Skill_Needed[ t ] = Skill ) then begin
RP := TotalRepairableDamage( Target , T );
if RP > 0 then Total := Total + RP;
end;
end;
RepairNeededBySkill := Total;
end;
Function AmountOfRepairFuel( PC: GearPtr; Material: Integer ): LongInt;
{ Return the total amount of repair fuel that the PC has. }
var
Total: LongInt;
Procedure SeekRFAlongTrack( LList: GearPtr );
begin
while LList <> Nil do begin
if ( LList^.G = GG_RepairFuel ) and ( LList^.S = Material ) then begin
Total := Total + LList^.V;
end else begin
SeekRFAlongTrack( LList^.SubCom );
SeekRFAlongTrack( LList^.InvCom );
end;
LList := LList^.Next;
end;
end;
begin
PC := FindRoot( PC );
Total := 0;
SeekRFAlongTrack( PC^.InvCom );
SeekRFAlongTrack( PC^.SubCom );
AmountOfRepairFuel := Total;
end;
Function CanRepairUsingSkill( NPC,Target: GearPtr; Skill: Integer ): Boolean;
{ Return TRUE if this target has repairable damage which can be healed using SKILL, }
{ and the NPC has the required repair fuel. Return FALSE otherwise. }
var
CanRepair: Boolean;
T,Total,RP: Longint;
begin
CanRepair := False;
for t := 0 to NumMaterial do begin
if ( Repair_Skill_Needed[ t ] = Skill ) then begin
RP := TotalRepairableDamage( Target , T );
if RP > 0 then begin
{ Alright, we found some damage to repair. }
{ Check for repair fuel. }
if AmountOfRepairFuel( NPC , T ) > 0 then CanRepair := True;
end;
end;
end;
CanRepairUsingSkill := CanRepair;
end;
Function UseRepairSkill( GB: GameBoardPtr; PC,Target: GearPtr; Skill: Integer ): Boolean;
{ The PC wants to use the requested repair SKILL on TARGET. }
{ Roll to see how many DPs will be restored, apply these DPs }
{ to the TARGET, then reduce PC's MPs. }
{ Return TRUE if the repair process went smoothly, or FALSE if it was }
{ halted due to a shortage of materials. Note that this procedure will return }
{ TRUE in the case of a critical failure even if the PC has no repair fuel. }
Function Repair_Skill_Target: Integer;
{ Return a good skill target for repair skills. }
{ This will be decreased as TARGET's scale increases. }
var
RST: Integer;
begin
if Target^.Scale = 0 then begin
RST := 4;
end else if Target^.Scale = 1 then begin
RST := 3;
end else begin
RST := 2;
end;
if Destroyed( Target ) then RST := RST + 3;
Repair_Skill_Target := RST;
end;
Procedure SpendRepairFuel( PC: GearPtr; Material , RP: LongInt );
{ Spend the requested repair fuel. If any fuel is depleted, }
{ remove it from the inventory. }
Procedure SpendRFAlongTrack( LList: GearPtr );
{ Search for repair fuel to use, then use it. }
var
L2: GearPtr;
begin
while ( LList <> Nil ) and ( RP > 0 ) do begin
L2 := LList^.Next;
if ( LList^.G = GG_RepairFuel ) and ( LList^.S = Material ) then begin
if RP >= LList^.V then begin
RP := RP - LList^.V;
if IsInvCom( LList ) then RemoveGear( LList^.Parent^.InvCom , LList )
else RemoveGear( LList^.Parent^.SubCom , LList );
end else begin
LList^.V := LList^.V - RP;
RP := 0;
end;
end else begin
SpendRFAlongTrack( LList^.SubCom );
SpendRFAlongTrack( LList^.InvCom );
end;
LList := L2;
end;
end;
begin
PC := FindRoot( PC );
SpendRFAlongTrack( PC^.InvCom );
SpendRFAlongTrack( PC^.SubCom );
end;
Function ActivateRepair( Material: Integer; var SkRoll: Integer ): Boolean;
{ Activate the repair. Return the number of repair points used. }
{ Reduce SkRoll by this same amount. }
{ Return TRUE if repairfuel was found for this repair job, or FALSE }
{ if no repair at all could take place. }
var
RP: LongInt;
RepairFuel: LongInt;
RFFound: Boolean;
begin
RP := TotalRepairableDamage( Target , Material );
RFFound := False;
{ Locate the repair fuel. }
RepairFuel := AmountOfRepairFuel( PC , Material );
if RepairFuel > 0 then begin
{ The amount of damage recovered will not exceed the skill roll * 2. }
if RP > ( SkRoll * 2 ) then RP := ( SkRoll * 2 );
{ Nor will it exceed the amount of repair fuel. }
if RP > RepairFuel then RP := RepairFuel;
{ The skill roll will be reduced by the amount of damage to be repaired. }
SkRoll := SkRoll - ( RP div 2 );
{ Spend the repair fuel. }
SpendRepairFuel( PC , Material , RP );
{ Apply the repair points. }
ApplyRepairPoints( Target , Material , RP , True );
RFFound := True;
end;
ActivateRepair := RFFound;
end;
var
RP: LongInt;
T,tries,SkRoll,SkTar,PercentDamage: Integer;
IsSafeRepair,HadRepairFuel: Boolean;
TMaster: GearPtr;
begin
{ First, locate the PC. }
PC := LocatePilot( PC );
if PC = Nil then Exit( False );
TMaster := FindMaster( Target );
if TMaster = Nil then TMaster := Target;
PercentDamage := PercentDamaged( TMaster );
{ Depending upon the situation, this repair will either fix some damage or all the }
{ damage in one go. If in a safe area and repairing a mecha which is not currently in play, }
{ the entire thing can be fixed. On the other hand, if in a dangerous area or working on a }
{ mecha which is in play, only a limited amount of DP will be restored. }
{ If the target is destroyed, this never counts as a safe repair. }
IsSafeRepair := IsSafeArea( GB ) and ( not OnTheMap( GB , FindRoot( Target ) ) ) and ( ( TMaster = Nil ) or NotDestroyed( TMaster ) );
{ Assume we have no repair fuel, unless we find some. }
HadRepairFuel := False;
{ Make a skill roll against the base difficulty number. This will determine the rate }
{ at which points may be restored. }
SkTar := Repair_Skill_Target;
SkRoll := SkillRoll( GB , PC , Skill , STAT_Craft , SkTar , 0 , IsSafeArea( GB ) , True ) - SkTar;
tries := 1;
if IsSafeRepair then begin
{ Safe repairs get a bonus to the repair rate, since you don't have to worry }
{ about people shooting at you. This bonus also helps to mitigate the effect of }
{ high and low skill rolls. }
SkRoll := SkRoll + SkillValue( PC , Skill , STAT_Craft );
if SkRoll < 5 then SkRoll := 5;
{ Because a safe repair will repair everything in one go, call the }
{ repair activator with an arbitrarily huge skillroll. }
for t := 0 to NumMaterial do begin
RP := TotalRepairableDamage( Target , T );
if ( Repair_Skill_Needed[ t ] = Skill ) and ( RP > 0 ) then begin
tries := tries + RP div SkRoll;
SkTar := 10000;
HadRepairFuel := HadRepairFuel or ActivateRepair( T , SkTar );
end;
end;
{ Don't make the PC wait for longer than 10 actions. }
if tries > 10 then tries := 10;
end else if SkRoll > 0 then begin
{ Apply the skill roll against all legal materials. }
for t := 0 to NumMaterial do begin
RP := TotalRepairableDamage( Target , T );
if ( Repair_Skill_Needed[ t ] = Skill ) and ( RP > 0 ) and ( SkRoll > 0 ) then begin
HadRepairFuel := HadRepairFuel or ActivateRepair( T , SkRoll );
end;
end;
end else begin
{ The repair attempt failed. }
{ At this point repair fuel is a moot point, so return TRUE. }
HadRepairFuel := True;
end;
{ If you fail to revive a dead character, there's not much else you can do. }
if ( TMaster <> Nil ) and ( TMaster^.G = GG_Character ) and Destroyed( TMaster ) and HadRepairFuel then begin
AddNAtt( TMaster^.NA , NAG_Damage , NAS_StrucDamage , 30 );
end;
{ Determine the percentage of damage repaired. This will determine the XP award. }
PercentDamage := PercentDamaged( TMaster ) - PercentDamage;
if ( PercentDamage > 0 ) and IsMasterGear( TMaster ) then begin
DoleExperience( PC , PercentDamage div 2 );
DoleSkillExperience( PC , Skill , ( PercentDamage + 1 ) div 2 );
end;
{ Using repair takes time and concentration. }
WaitAMinute( GB , PC , ReactionTime( PC ) * Tries );
AddMentalDown( PC , Tries + Random( 3 ) );
UseRepairSkill := HadRepairFuel;
end;
Procedure DoCompleteRepair( Target: GearPtr );
{ Repair everything that can be repaired on Target. }
{ Basically, go through all the repair skills and apply as many points }
{ as are needed of each. }
var
T: Integer;
Pts: LongInt;
begin
for t := 0 to ( NumMaterial - 1 ) do begin
if TotalRepairableDamage( Target , T ) > 0 then begin
Pts := TotalRepairableDamage( Target , T );
ApplyRepairPoints( Target , T , Pts , True );
end;
end;
end;
Function PerformSkillTar( NPC: GearPtr ): Integer;
{ Return the performance skill target for this particular NPC. }
var
it: Integer;
begin
it := CStat( NPC , STAT_Ego ) + NAttValue( NPC^.NA , NAG_Personal , NAS_PerformancePenalty ) - 5;
if it < 5 then it := 5;
PerformSkillTar := it;
end;
Function SelectPerformanceTarget( GB: GameBoardPtr; PC: GearPtr ): GearPtr;
{ Search through the map and locate someone who has not yet responded to }
{ the PC's music today. If nobody is found, return NIL. }
const
PerformanceRange = 8;
var
M,it: GearPtr;
team: Integer;
begin
{ Start looking through the gameboard. }
M := GB^.Meks;
it := Nil;
while M <> Nil do begin
team := NAttValue( M^.NA , NAG_Location , NAS_Team );
if ( M^.G = GG_Character ) and ( team <> NAV_DefPlayerTeam ) and ( team <> NAV_LancemateTeam ) and ( M <> PC ) and ( Range( GB , M , PC ) <= PerformanceRange ) and OnTheMap( GB , M ) and GearActive( M ) and ( not AreEnemies( GB , M , PC ) ) and NotAnAnimal( M ) and ( NAttValue( M^.NA , NAG_Personal , NAS_CashOnHandRestock ) <= GB^.ComTime ) then begin
{ This is a potential target. Check to see if its skill target is lower }
{ than that of the current candidate. }
if it = Nil then begin
it := M;
end else if PerformSkillTar( M ) < PerformSkillTar( it ) then begin
it := M;
end;
end;
M := M^.Next;
end;
SelectPerformanceTarget := it;
end;
Function UsePerformance( GB: GameBoardPtr; PC,NPC: GearPtr ): LongInt;
{ The PC is about to use a performance skill. }
{ 1) Select a nearby non-lancemate NPC }
{ 2) Make a performance roll }
{ 3) Profit }
{ Return -1 for a bad performance, 0 for a mediocre performance, }
{ and a positive number if the PC made any tips. }
var
SkRoll,SkRank,Target: Integer; { Skill roll target }
N: Integer; { Number of successes }
Cash: LongInt;
begin
{ Reduce stamina and mental now. }
{ Performing is both mentally and physically exhausting. }
if Random( 2 ) = 1 then begin
AddStaminaDown( PC , 1 );
end else begin
AddMentalDown( PC , 1 );
end;
Cash := 0;
Target := PerformSkillTar( NPC );
if Target < 5 then Target := 5;
{ Set the recharge timer for this target. }
SetNAtt( NPC^.NA , NAG_Personal , NAS_CashOnHandRestock , GB^.ComTime + 43200 + Random( 86400 ) );
{ Add to the performance resistance. }
if Random( 2 ) = 1 then AddNAtt( NPC^.NA , NAG_Personal , NAS_PerformancePenalty , 1 );
SkRoll := SkillRoll( GB , PC , NAS_Performance , STAT_Charm , Target , 0 , True , False );
if SkRoll > Target then begin
DoleSkillExperience( PC , NAS_Performance , Target );
if SkRoll > ( Target + 5 ) then begin
{ On a good roll, the PC earns some money. }
SkRank := SkillRank( PC , NAS_Performance ) + 1;
N := SkRoll - Target - 5;
if N > SkRank then N := SkRank
else if N < 1 then N := 1;
Cash := SkillAdvCost( Nil , N ) div 10;
AddNAtt( PC^.NA , NAG_Experience , NAS_Credits , Cash );
end;
{ Set the applause trigger. }
SetTrigger( GB , TRIGGER_Applause );
end else if ( SkRoll + PersonalityCompatability( PC , NPC ) - 5 ) < Target then begin
AddMoraleDmg( PC , Rollstep( 1 ) );
Cash := -1;
end;
UsePerformance := Cash;
end;
end.