Diferent Cyborg purchase strategy

This commit is contained in:
Pecusx
2022-08-05 10:12:44 +02:00
parent e60776fd57
commit 05409fa301
5 changed files with 121 additions and 9 deletions
+42 -3
View File
@@ -843,8 +843,8 @@ PurchaseAIRoutines
.word PoolsharkPurchase-1 ;PoolsharkPurchase .word PoolsharkPurchase-1 ;PoolsharkPurchase
.word TosserPurchase-1 ;TosserPurchase .word TosserPurchase-1 ;TosserPurchase
.word TosserPurchase-1 ;ChooserPurchase .word TosserPurchase-1 ;ChooserPurchase
.word TosserPurchase-1 ;SpoilerPurchase .word CyborgPurchase-1 ;SpoilerPurchase
.word TosserPurchase-1 ;CyborgPurchase .word CyborgPurchase-1 ;CyborgPurchase
.word TosserPurchase-1 ;UnknownPurchase .word TosserPurchase-1 ;UnknownPurchase
;---------------------------------------------- ;----------------------------------------------
@@ -853,6 +853,16 @@ PurchaseAIRoutines
rts rts
.endp .endp
;------- ;-------
.proc TryToPurchaseOnePiece2 ; for Cyborg
; A - weapon number, better it will be in range(1,32)
; TankNr in X
; DOES NOT CHANGE X
tay
lda PurchaseMeTable2,y
beq TryToPurchaseOnePiece.SorryNoPurchase
jmp TryToPurchaseOnePiece.PurchaseIt
.endp
;-------
.proc TryToPurchaseOnePiece .proc TryToPurchaseOnePiece
; A - weapon number, better it will be in range(1,32) ; A - weapon number, better it will be in range(1,32)
; TankNr in X ; TankNr in X
@@ -860,6 +870,7 @@ PurchaseAIRoutines
tay tay
lda PurchaseMeTable,y lda PurchaseMeTable,y
beq SorryNoPurchase beq SorryNoPurchase
PurchaseIt
lda WeaponPriceL,y lda WeaponPriceL,y
sta temp sta temp
lda WeaponPriceH,y lda WeaponPriceH,y
@@ -953,7 +964,7 @@ SorryNoPurchase
lda MoneyH,x ; money / 256 lda MoneyH,x ; money / 256
sta tempXroller ; perform this many purchase attempts sta tempXroller ; perform this many purchase attempts
; first try to buy defensives ; first try to buy defensives
mva #3 tempXroller; number of defensive purchases to perform mva #2 tempXroller; number of defensive purchases to perform
@ @
randomize ind_Battery________ ind_Auto_Defense___ randomize ind_Battery________ ind_Auto_Defense___
jsr TryToPurchaseOnePiece jsr TryToPurchaseOnePiece
@@ -972,3 +983,31 @@ SorryNoPurchase
rts rts
.endp .endp
;----------------------------------------------
.proc CyborgPurchase
; what is my money level
ldx TankNr
;lda MoneyH,x ; money / 256
;sta tempXroller ; perform this many purchase attempts
; first try to buy defensives
mva #2 tempXroller; number of defensive purchases to perform
@
randomize ind_Battery________ ind_Auto_Defense___
jsr TryToPurchaseOnePiece2
dec tempXroller
bne @-
; and now offensives
lda MoneyH,x ; money / 256
asl ;*4
asl
sta tempXroller ; perform this many purchase attempts
@
randomize ind_Missile________ ind_Plasma_Blast___
jsr TryToPurchaseOnePiece2
dec tempXroller
bne @-
rts
.endp
+66
View File
@@ -568,6 +568,72 @@ PurchaseMeTable ;weapons good to be purchased by the robot
dta 0 ;"Fuel Tank " ; 62 dta 0 ;"Fuel Tank " ; 62
dta 0 ;"Nuclear Winter " ; 63 dta 0 ;"Nuclear Winter " ; 63
PurchaseMeTable2 ;weapons good to be purchased by the robot (Cyborg)
;the comment is an index in the tables
dta 1 ;"Baby Missile " ; 0
dta 1 ;"Missile " ; 1
dta 1 ;"Baby Nuke " ; 2
dta 1 ;"Nuke " ; 3
dta 0 ;"LeapFrog " ; 4
dta 0 ;"Funky Bomb " ; 5
dta 0 ;"MIRV " ; 6
dta 0 ;"Death's Head " ; 7
dta 0 ;"Napalm " ; 8
dta 1 ;"Hot Napalm " ; 9
dta 0 ;"Tracer " ; 10
dta 0 ;"Smoke Tracer " ; 11
dta 0 ;"Baby Roller " ; 12
dta 0 ;"Roller " ; 13
dta 0 ;"Heavy Roller " ; 14
dta 0 ;"Riot Charge " ; 15
dta 0 ;"Riot Blast " ; 16
dta 0 ;"Riot Bomb " ; 17
dta 0 ;"Heavy Riot Bomb " ; 18
dta 0 ;"Baby Digger " ; 19
dta 0 ;"Digger " ; 20
dta 0 ;"Heavy Digger " ; 21
dta 0 ;"Baby Sandhog " ; 22
dta 0 ;"Sandhog " ; 23
dta 0 ;"Heavy Sandhog " ; 24
dta 0 ;"Dirt Clod " ; 25
dta 0 ;"Dirt Ball " ; 26
dta 0 ;"Ton of Dirt " ; 27
dta 0 ;"Liquid Dirt " ; 28
dta 0 ;"Dirt Charge " ; 29
dta 0 ;"Earth Disrupter " ; 30
dta 1 ;"Plasma Blast " ; 31
dta 1 ;"Laser " ; 32
dta 0 ;"----------------" ; 33
dta 0 ;"----------------" ; 34
dta 0 ;"----------------" ; 35
dta 0 ;"----------------" ; 36
dta 0 ;"----------------" ; 37
dta 0 ;"----------------" ; 38
dta 0 ;"----------------" ; 39
dta 0 ;"----------------" ; 40
dta 0 ;"----------------" ; 41
dta 0 ;"----------------" ; 42
dta 0 ;"----------------" ; 43
dta 0 ;"----------------" ; 44
dta 0 ;"----------------" ; 45
dta 0 ;"----------------" ; 46
dta 0 ;"----------------" ; 47
dta 0 ;"White Flag " ; 48
dta 1 ;"Battery " ; 49
dta 0 ;"Bal Guidance " ; 50
dta 0 ;"Horz Guidance " ; 51
dta 0 ;"Vert Guidance " ; 52
dta 0 ;"Lazy Boy " ; 53
dta 1 ;"Parachute " ; 54
dta 1 ;"Strong Parachute" ; 55
dta 1 ;"Mag Deflector " ; 56
dta 1 ;"Shield " ; 57
dta 1 ;"Heavy Shield " ; 58
dta 1 ;"Force Shield " ; 59
dta 0 ;"Super Mag " ; 60
dta 1 ;"Auto Defense " ; 61
dta 0 ;"Fuel Tank " ; 62
dta 0 ;"Nuclear Winter " ; 63
;------------------------------------------------- ;-------------------------------------------------
; Screen codes of icons (chars) representing a given weapon ; Screen codes of icons (chars) representing a given weapon
+1 -1
View File
@@ -210,5 +210,5 @@ purchaseTextEnd
GameOverTitle GameOverTitle
dta d" game over "* dta d" game over "*
GameOverTitle2 GameOverTitle2
dta d" Player Points Hits Earned Money " dta d" Player Points Hits Earned Money "
.endif .endif
BIN
View File
Binary file not shown.
+12 -5
View File
@@ -1854,8 +1854,15 @@ FinalResultOfTheNextPlayer
adw temp #40 adw temp #40
jmp @- jmp @-
LineAdresReady LineAdresReady
; put position of tank on the screen
pla
pha ; now we have line number in A register
ldy #1
tax
lda zero+1,x
sta (temp),y
; puts name of the tank on the screen ; puts name of the tank on the screen
ldy #$01 ldy #$03
lda TankNr lda TankNr
:3 asl ; 8 chars per name :3 asl ; 8 chars per name
tax tax
@@ -1864,14 +1871,14 @@ NextChar
sta (temp),y sta (temp),y
inx inx
iny iny
cpy #$08+1 cpy #$08+3
bne NextChar bne NextChar
; put big points on the screen ; put big points on the screen
ldx TankNr ldx TankNr
lda ResultsTable,x lda ResultsTable,x
sta decimal sta decimal
mva #0 decimal+1 mva #0 decimal+1
adw temp #10 displayposition adw temp #12 displayposition
jsr displaydec5 jsr displaydec5
mva #0 displayposition ; overwrite first digit mva #0 displayposition ; overwrite first digit
; put hits points on the screen ; put hits points on the screen
@@ -1889,9 +1896,9 @@ NextChar
sta decimal sta decimal
lda EarnedMoneyH,x lda EarnedMoneyH,x
sta decimal+1 sta decimal+1
adw temp #28 displayposition adw temp #30 displayposition
jsr displaydec5 jsr displaydec5
ldy #33 ldy #35
lda zero lda zero
sta (temp),y ; and last zero sta (temp),y ; and last zero
ply ply