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 583 584 585 586 587
|
unit customization;
{ This unit handles the customization of mecha. }
{
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;
Const
WT_SmallGun = 1;
WT_BigGun = 2;
WT_MissileLauncher = 3;
WT_MeleeWeapon = 4;
Function MechaModPoints( NPC: GearPtr ): Integer;
Function WeaponThemeClass( W: GearPtr ): Integer;
Procedure MechaMakeover( Mek: GearPtr; Skill,Theme,MP: Integer );
Procedure ShopkeeperModifyMek( NPC,Mek: GearPtr );
Procedure CheckTheme( Theme: GearPtr );
implementation
uses ghchars,gearutil,gearparser,ghintrinsic,effects,ghweapon,ability,ui4gh,
texutil,rpgdice,
{$IFDEF ASCII}
vidgfx;
{$ELSE}
{$IFDEF CUTE}
cutegfx;
{$ELSE}
glgfx;
{$ENDIF}
{$ENDIF}
Function MechaModPoints( NPC: GearPtr ): Integer;
{ Return the number of modification points this NPC should be given, based }
{ on his renown and Mecha Engineering skill. }
var
MP: Integer;
begin
MP := NAttValue( NPC^.NA , NAG_CharDescription , NAS_Renowned ) div 10;
if MP < 1 then MP := 1;
MP := MP + ( ( NAttValue( NPC^.NA , NAG_Skill , NAS_MechaEngineering ) + 2 ) div 3 );
MechaModPoints := MP;
end;
Function WeaponThemeClass( W: GearPtr ): Integer;
{ Return the weapon type of this gear. }
begin
if ( W^.S = GS_Melee ) or ( W^.S = GS_EMelee ) then begin
WeaponThemeClass := WT_MeleeWeapon;
end else if W^.S = GS_Missile then begin
WeaponThemeClass := WT_MissileLauncher;
end else if W^.V > 10 then begin
WeaponThemeClass := WT_BigGun;
end else begin
WeaponThemeClass := WT_SmallGun;
end;
end;
Procedure MechaMakeover( Mek: GearPtr; Skill,Theme,MP: Integer );
{ Original title of this procedure was going to be "PimpMyMecha", }
{ but the word "pimp" is awfully overused these days, isn't it? }
var
PartsBox: GearPtr;
OriginalMV,NumMassAdjusts: Integer;
Function SwapParts( OldPart, NewPart: GearPtr ): Boolean;
{ Attempt to swap OldPart with NewPart. If the exchange is impossible }
{ for any reason, return FALSE and dispose of NewPart. Otherwise return TRUE. }
var
Slot: GearPtr;
begin
Slot := OldPart^.Parent;
if IsInvCom( OldPart ) then begin
{ This part is an invcom. Remove it, then insert the NewPart. }
DelinkGear( Slot^.InvCom , OldPart );
{ Attempt to insert NewPart. }
if IsLegalInvCom( Slot , NewPart ) then begin
InsertInvCom( Slot , NewPart );
DisposeGear( OldPart );
SwapParts := True;
end else begin
{ Can't insert the new part. Just stick the old one back. }
InsertInvCom( Slot , OldPart );
DisposeGear( NewPart );
SwapParts := False;
end;
end else if IsSubCom( OldPart ) then begin
{ This part is an subcom. Remove it, then insert the NewPart. }
DelinkGear( Slot^.SubCom , OldPart );
if IsLegalSubCom( Slot , NewPart ) then begin
InsertSubCom( Slot , NewPart );
DisposeGear( OldPart );
SwapParts := True;
end else begin
{ Can't insert the new part. Just stick the old one back. }
InsertSubCom( Slot , OldPart );
DisposeGear( NewPart );
SwapParts := False;
end;
{ If the part to swap isn't an invcom or a subcom, that's a major FUBAR. }
end else SwapParts := False;
end;
Procedure CheckManeuverScore;
{ The maneuverability score of the mecha shouldn't get any worse than }
{ it started. }
Function ComponentExcessMass( Part: GearPtr ): LongInt;
{ Return the excess mass points of this component. }
{ What's an excess mass point? In excess of 1. Weight reduction }
{ should not take any item to Mass:0, so ignore those gears. }
var
it: LongInt;
begin
it := ComponentMass( Part ) - 1;
if it < 0 then it := 0;
ComponentExcessMass := it;
end;
Function NumExcessMassPoints( LList: GearPtr ): LongInt;
{ Add up all the excess mass points in this linked list. }
{ For the point of brevity, ignore gears of a smaller scale }
{ than the Mek itself. }
var
total: LongInt;
begin
total := 0;
while LList <> Nil do begin
if ( LList^.Scale >= Mek^.Scale ) then begin
total := total + ComponentExcessMass( LList );
total := total + NumExcessMassPoints( LList^.SubCom );
total := total + NumExcessMassPoints( LList^.InvCom );
end;
if IsMasterGear( LList ) then LList := Nil
else LList := LList^.Next;
end;
NumExcessMassPoints := total;
end;
Function GetExcessMassPoint( LList: GearPtr; var N: Integer ): GearPtr;
{ Return the gear that has excess mass point N, as if all }
{ the excess mass points were individually numbered. I think maybe }
{ I shouldn't be writing comments in summer when I feel dizzy but }
{ I'm sure you all know what I mean. Still, that sentance looks }
{ messy. Hi Peter. }
var
it: gearPtr;
begin
it := Nil;
while ( LList <> Nil ) and ( it = Nil ) do begin
if ( LList^.Scale >= Mek^.Scale ) then begin
N := N - ComponentExcessMass( LList );
if N < 0 then it := LList;
if it = Nil then it := GetExcessMassPoint( LList^.SubCom , N );
if it = Nil then it := GetExcessMassPoint( LList^.InvCom , N );
end;
if IsMasterGear( LList ) then LList := Nil
else LList := LList^.Next;
end;
GetExcessMassPoint := it;
end;
var
EMP: Integer;
Part: GearPtr;
begin
{ As long as our maneuverability is too high, reduce the mass from }
{ parts randomly. }
While ( MechaManeuver( Mek ) < OriginalMV ) and ( MP > 0 ) do begin
EMP := NumExcessMassPoints( Mek );
if EMP > 0 then begin
EMP := Random( EMP );
Part := GetExcessMassPoint( Mek , EMP );
if Part <> Nil then begin
inc( NumMassAdjusts );
if ( NumMassAdjusts mod 5 ) = 0 then Dec( MP );
AddNAtt( Part^.NA , NAG_GearOps , NAS_MassAdjust , -1 );
if XXRAN_DEBUG then DialogMsg( 'Reducing mass of ' + GearName( Part ) + '.' );
end else begin
DialogMsg( 'ERROR: Part ' + BStr( EMP ) + '/' + BStr( NumExcessMassPoints( Mek ) ) + ' not found in customization/CheckManeuverScore' );
Break;
end;
end else break;
end;
end;
Procedure AddNewWeapon;
{ Add a new weapon to the mecha. }
Function SeekMountingPoint( LList: GearPtr ): GearPtr;
{ Try to find an empty mounting point along this list }
{ or through its equal-scale subcoms. }
var
it: GearPtr;
begin
it := Nil;
while ( LList <> Nil ) and ( it = Nil ) do begin
if LList^.Scale >= Mek^.Scale then begin
if ( LList^.G = GG_Holder ) and ( LList^.InvCom = Nil ) then it := LList
else it := SeekMountingPoint( LList^.SubCom );
end;
LList := LList^.Next;
end;
SeekMountingPoint := it;
end;
Function GetNewWeaponToInstall: GearPtr;
{ Locate a new weapon to install; pick the smallest weapon }
{ listed of a randomly selected category. }
var
WT,Tries: Integer;
Part,it: GearPtr;
PartValue,ItValue: LongInt;
begin
WT := Random( 4 ) + 1;
it := Nil;
Tries := 0;
while ( it = Nil ) and ( Tries < 4 ) do begin
Part := PartsBox^.InvCom;
while Part <> Nil do begin
if ( Part^.G = GG_Weapon ) and ( WeaponThemeClass( Part ) = WT ) then begin
{ We've found a weapon of the appropriate type. Compare }
{ it against IT to see whether or not to choose it. }
PartValue := GearValue( Part );
if ( it = Nil ) then begin
it := Part;
ItValue := GearValue( Part );
end else if ( PartValue < ItValue ) then begin
it := Part;
ItValue := PartValue;
end;
end;
Part := Part^.Next;
end;
WT := WT + 1;
if WT = 5 then WT := 1;
Inc( Tries );
end;
GetNewWeaponToInstall := it;
end;
Function SeekEmptiestModule: GearPtr;
{ Search through the modules of this mecha, looking for one that has }
{ the least amount of junk already installed. }
var
M,it: GearPtr;
MSpace,ItSpace: Integer;
begin
M := Mek^.SubCom;
it := Nil;
itSpace := 0;
while M <> Nil do begin
if ( M^.G = GG_Module ) and ( M^.Scale >= mek^.Scale ) then begin
{ This module is one we'll have to consider. Find out how }
{ much space it has for installing new things. }
if it = Nil then begin
it := M;
ItSpace := ComponentComplexity( M ) - SubComComplexity( M );
end else begin
MSpace := ComponentComplexity( M ) - SubComComplexity( M );
if MSpace > ItSpace then begin
it := M;
ItSpace := MSpace;
end;
end;
end;
M := M^.Next;
end;
SeekEmptiestModule := it;
end;
var
Weapon,Slot: GearPtr; { The new weapon, and the spot to put it. }
begin
{ Step one: Find a weapon to use. }
Weapon := GetNewWeaponToInstall;
if Weapon = Nil then begin
if XXRAN_DEBUG then DialogMsg( 'Error- No weapon found for install.' );
Exit;
end else if XXRAN_DEBUG then DialogMsg( 'Installing new ' + GearName( Weapon ) + '.' );
{ Step two: Find a place to stick it. }
Slot := SeekMountingPoint( Mek^.SubCOm );
if Slot <> Nil then begin
if IsLegalInvCom( Slot , Weapon ) then InsertInvCom( Slot , CloneGear( Weapon ) )
else if XXRAN_DEBUG then DialogMsg( 'Install ' + GearName( Weapon ) + ' failed.' );
end else begin
Slot := SeekEmptiestModule;
if ( Slot <> Nil ) and IsLegalSubCom( Slot , Weapon ) then InsertSubCom( Slot , CloneGear( Weapon ) )
else if XXRAN_DEBUG then DialogMsg( 'Install ' + GearName( Weapon ) + ' failed.' );
end;
end;
Procedure UpgradeWeapons;
{ Replace a weapon on this mecha with an even better weapon taken }
{ from the parts box. }
Function WUWeight( Part: GearPtr ): LongInt;
{ How much do I want to change this weapon? I want to change the }
{ most expensive weapons first, but preference is strongly given }
{ to weapons mounted as InvComs. }
var
it: LongInt;
begin
it := GearValue( Part );
if ( Part^.Parent <> Nil ) and ( Part^.Parent^.G = GG_Holder ) then it := it * 3;
WUWeight := it;
end;
Function LocateWeaponToUpgrade( LList,Best: GearPtr ): GearPtr;
{ Search through this list, its invcoms and subcoms, looking }
{ for a weapon to upgrade. }
var
ASkill1,ASkill2: Integer;
begin
while LList <> Nil do begin
if ( LList^.G = GG_Weapon ) and ( NAttValue( LList^.NA , NAG_EpisodeData , NAS_WeaponUpgrades ) <> -1 ) and ( not PartHasIntrinsic( LList , NAS_Integral ) ) then begin
if Best = Nil then begin
{ Better to have some weapon than no weapon. }
Best := LList;
end else if NAttValue( LList^.NA , NAG_EpisodeData , NAS_WeaponUpgrades ) < NAttValue( Best^.NA , NAG_EpisodeData , NAS_WeaponUpgrades ) then begin
{ The weapon which has been upgraded the least }
{ will always be selected. }
Best := LList;
end else if NAttValue( LList^.NA , NAG_EpisodeData , NAS_WeaponUpgrades ) = NAttValue( Best^.NA , NAG_EpisodeData , NAS_WeaponUpgrades ) then begin
ASkill1 := AttackSkillNeeded( Best );
ASkill2 := AttackSkillNeeded( LList );
if ( ASkill2 = Skill ) and ( ASkill1 <> Skill ) then begin
{ Always go with a weapon that uses the preferred skill. }
Best := LList;
end else if ( ASkill1 = ASkill2 ) and ( ASkill1 = Skill ) and ( WUWeight( LList ) > WUWeight( Best ) ) then begin
{ Both weapons use the preferred skill- modify the most expensive first. }
Best := LList;
end else if ( ASkill1 <> Skill ) and ( WUWeight( LList ) > WUWeight( Best ) ) then begin
{ Neither weapon uses the preferred skill- take the most expensive. }
Best := LList;
end;
end;
end;
{ Check along the subcoms and invcoms. }
if LList^.G <> GG_Cockpit then begin
Best := LocateWeaponToUpgrade( LList^.SubCom , Best );
Best := LocateWeaponToUpgrade( LList^.InvCom , Best );
end;
LList := LList^.Next;
end;
LocateWeaponToUpgrade := Best;
end;
Function SelectReplacementWeapon( WeaponToReplace: GearPtr ): GearPtr;
{ Searching along PartsBox^.InvCom, look for a weapon of the same }
{ type as WeaponToReplace but more expensive. Return the cheapest }
{ such weapon found. }
var
WT: Integer; { Weapon type to match. }
Part,It: GearPtr;
MinValue,PartValue,ItValue: LongInt;
begin
WT := WeaponThemeClass( WeaponToReplace );
MinValue := GearValue( WeaponToReplace );
It := Nil;
ItValue := 0;
Part := PartsBox^.InvCom;
while Part <> Nil do begin
if ( Part^.G = GG_Weapon ) and ( WeaponThemeClass( Part ) = WT ) then begin
{ We've found a weapon of the appropriate type. Compare }
{ it against IT to see whether or not to choose it. }
PartValue := GearValue( Part );
if ( it = Nil ) and ( PartValue > MinValue ) then begin
it := Part;
ItValue := GearValue( Part );
end else if ( PartValue > MinValue ) and ( PartValue < ItValue ) then begin
it := Part;
ItValue := GearValue( Part );
end;
end;
Part := Part^.Next;
end;
SelectReplacementWeapon := it;
end;
var
WeaponToReplace,NewWeapon: GearPtr;
begin
repeat
WeaponToReplace := LocateWeaponToUpgrade( Mek^.SubCom , Nil );
if WeaponToReplace = Nil then break;
{ Step two- locate a new weapon from the parts list which: }
{ 1) is of the same basic type as the weapon being replaced, }
{ 2) has a value greater than that of the weapon being replaced }
{ but smaller than any other weapon matching 1. }
NewWeapon := SelectReplacementWeapon( WeaponToReplace );
{ If no NewWeapon can be found for the current WeaponToReplace, }
{ mark this weapon as unreplacable and attempt another. }
if NewWeapon = Nil then SetNAtt( WeaponToReplace^.NA , NAG_EpisodeData , NAS_WeaponUpgrades , -1 );
until ( WeaponToReplace <> Nil ) and ( NewWeapon <> Nil );
{ If either WeaponToReplace or NewWeapon are Nil, call the AddNewWeapon upgrade }
{ instead. }
if ( WeaponToReplace = Nil ) or ( NewWeapon = Nil ) then begin
AddNewWeapon;
exit;
end;
{ Record the WeaponUpgrades total. }
NewWeapon := CloneGear( NewWeapon );
SetNAtt( NewWeapon^.NA , NAG_EpisodeData , NAS_WeaponUpgrades , NAttValue( WeaponToReplace^.NA , NAG_EpisodeData , NAS_WeaponUpgrades ) + 1 );
if XXRAN_DEBUG then DialogMsg( 'Replacing ' + GearName( WeaponToReplace ) + ' with ' + GearName( NewWeapon ) + '.' );
{ Step three- perform the swap. }
{ Record the number of upgrades + 1 in the new weapon. }
SwapParts( WeaponToReplace , NewWeapon );
end;
Procedure ReDesignate;
{ Since this mecha has been extensively modified, it can't keep the }
{ same old factory designation it once had. Let's give it a name to }
{ indicate its new abilities... a name even StrongBad would be proud }
{ of. }
{ The new designation will consist of an adjective + a noun. Each }
{ theme should have a list of 5 adjectives and 5 nouns specifically }
{ for this purpose. One or the other of the words may be taken from }
{ a general list instead. }
var
NormComp: Integer;
Desig: String;
begin
NormComp := Random( 3 );
if NormComp = 1 then Desig := MSgString( 'CUSTOMIZATION_ADJECTIVE_' + BStr( Random( 5 ) ) )
else Desig := SAttValue( PartsBox^.SA , 'CUSTOMIZATION_ADJECTIVE_' + BStr( Random( 5 ) ) );
if NormComp = 2 then Desig := Desig + ' ' + MSgString( 'CUSTOMIZATION_NOUN_' + BStr( Random( 5 ) ) )
else Desig := Desig + ' ' + SAttValue( PartsBox^.SA , 'CUSTOMIZATION_NOUN_' + BStr( Random( 5 ) ) );
SetSAtt( Mek^.SA , 'DESIG <' + Desig + '>' );
end;
begin
{ Start by locating the parts list. }
{ If Theme = 0 then select a random theme. }
if Theme = 0 then begin
PartsBox := SelectRandomGear( Mecha_Theme_List );
end else begin
{ The actual parts we want will be invcoms of this gear. }
PartsBox := SeekCurrentLevelGear( Mecha_Theme_List , Mecha_Theme_List^.G , Theme );
end;
if PartsBox = Nil then begin
Exit;
end;
{ Record the original maneuverability score of the mecha. If this changes, we }
{ need to lose some weight. }
OriginalMV := MechaManeuver( Mek );
NumMassAdjusts := 0;
while MP > 0 do begin
if Random( 20 ) = 1 then begin
AddNewWeapon;
end else begin
UpgradeWeapons;
end;
Dec( MP );
{ After all modifications, check to make sure the MV is as good as it ever was. }
CheckManeuverScore;
end;
{ Give this mecha a new designation. }
ReDesignate;
end;
Procedure ShopkeeperModifyMek( NPC,Mek: GearPtr );
{ The NPC is going to modify this mecha for sale in his/her shop. }
{ Decide on a random theme and a number of modification points, then send everything }
{ to the above procedure. }
{ Note that if the NPC makes a bad roll, it's quite possible for the mecha to leave this }
{ procedure without being modified at all. }
var
SkRoll,MP: Integer;
Theme: GearPtr;
begin
{ Make a skill roll against the size of the mecha. If it succeeds, then }
{ we'll have some modification points to work with. }
SkRoll := RollStep( SkillValue( NPC , NAS_MechaEngineering , STAT_Knowledge ) ) - ( Mek^.S + 4 );
if SkRoll > 0 then begin
{ Okay, we have some points. Now, pick a theme. }
Theme := SelectRandomGear( Mecha_Theme_List );
MP := ( SkRoll + 2 ) div 3;
if MP > 9 then MP := 9;
{ Send all the info to the MechaMakeover procedure. }
MechaMakeover( Mek , 0 , Theme^.S , MP );
end;
end;
Procedure CheckTheme( Theme: GearPtr );
{ Check this theme. See if it has all the required weapons. }
{ There are four weapon types and about 10 cost classes. }
const
Cost_Max: Array [ 1..4 , 0..10 ] of LongInt = (
( 0 , 30000 , 45000 , 65000 , 90000 , 120000 , 160000 , 210000 , 270000 , 340000 , 420000 ), { Small Guns }
( 0 , 30000 , 45000 , 65000 , 90000 , 120000 , 160000 , 210000 , 270000 , 340000 , 420000 ), { Big Guns }
( 0 , 30000 , 45000 , 65000 , 90000 , 120000 , 160000 , 210000 , 270000 , 340000 , 420000 ), { Missile Launchers }
( 0 , 10000 , 15000 , 25000 , 40000 , 60000 , 90000 , 130000 , 180000 , 240000 , 310000 ) { Melee Weapons }
);
var
Memo: SAttPtr; { List of comments. }
Procedure CheckTypeRank( WP_Type,WP_Rank: Integer );
{ Check this weapon type/rank to make sure one appropriate weapon is present. }
{ If more than one is present, that's an error. If less than one is present, that's }
{ an error too. }
var
W: GearPtr;
N: Integer;
Cost: LongInt;
begin
W := Theme^.InvCom;
N := 0;
while W <> Nil do begin
if WeaponThemeClass( W ) = WP_Type then begin
Cost := GearValue( W );
if ( Cost > Cost_Max[ WP_Type , WP_Rank - 1 ] ) and ( Cost <= Cost_Max[ WP_Type , WP_Rank ] ) then Inc( N );
end;
W := W^.Next;
end;
{ Store any errors in MEMO. }
if N = 0 then begin
StoreSAtt( Memo , 'ERROR: Type ' + BStr( WP_Type ) + ' Rank ' + BStr( WP_Rank ) + ' has no weapon.' );
end else if N > 1 then begin
StoreSAtt( Memo , 'ERROR: Type ' + BStr( WP_Type ) + ' Rank ' + BStr( WP_Rank ) + ' has ' + BStr( N ) + ' weapons.' );
W := Theme^.InvCom;
while W <> Nil do begin
if WeaponThemeClass( W ) = WP_Type then begin
Cost := GearValue( W );
if ( Cost > Cost_Max[ WP_Type , WP_Rank - 1 ] ) and ( Cost <= Cost_Max[ WP_Type , WP_Rank ] ) then begin
if ( WP_Type = WT_MissileLauncher ) and ( W^.SubCom <> Nil ) then StoreSAtt( Memo , ' ->' + FullGearName( W^.SubCom ) + ' [' + BStr( W^.SubCom^.Stat[ STAT_AmmoPresent ] ) + ']' )
else StoreSAtt( Memo , ' ->' + GearName( W ) );
end;
end;
W := W^.Next;
end;
end;
end;
var
C,R: Integer;
begin
Memo := Nil;
for C := 1 to 4 do begin
for R := 1 to 10 do begin
CheckTypeRank( C , R );
end;
end;
if Memo <> Nil then begin
MoreText( Memo , 1 );
DisposeSAtt( Memo );
end;
end;
end.
|