Prev: 39242 Up: Map Next: 39365
39256: CrewAction5_AlienAttack — the alien's attack tick (action state 5)
Dispatched via CrewActionDispatch entry 5, queued by UpdateAlienAI when crew share the alien's spot. Re-gathers the crew on the alien's spot (up to three into NearestCrewC/A/B), picks one by script roll, and drains a strength point: below 2 the victim collapses (VictimItemDrop, msg #21), at 2-3 msg #10 "is being wounded", and a still-fit victim (4+) gets msg #1 "The ALIEN is attacking {actor}". A chosen victim who is already dead may be dragged off the ship (Wound_PanicRoll, in the 39400 block), else another gathered slot is tried; with nobody left the alien moves on.
39256 LD HL,65535 NearestCrewA/B = 255/255
39259 LD (33696),HL
39262 LD DE,33695 NearestCrewC = 255 too
39265 LD A,255
39267 LD (DE),A
39268 XOR A gather the crew on the alien's spot
39269 CALL 37891 into C/A/B ("self" = slot 0)
39272 LD C,0 count them:
39274 LD HL,33695
39277 LD A,255
39279 LD B,3
39281 CP (HL)
39282 JR Z,39285
39284 INC C
39285 INC HL
39286 DJNZ 39281
39288 LD A,C nobody there after all?
39289 AND A
39290 RET Z then no attack
39291 CP 1 one victim:
39293 JR NZ,39298
39295 XOR A take entry 0
39296 JR 39317
39298 CP 2 two victims:
39300 JR NZ,39309
39302 CALL 33589 a script roll picks
39305 AND 1 entry 0 or 1
39307 JR 39317
39309 CALL 33589 three victims: script roll & 7,
39312 AND 7 mapped through the direction table,
39314 CALL 36763 picks entry 0-2
39317 LD E,A
39318 LD D,0
39320 LD HL,33695 C = the chosen victim's slot,
39323 ADD HL,DE
39324 LD C,(HL)
39325 LD (HL),255 taken off the list
39327 LD A,C
39328 ADD A,A HL -> the victim's status byte (+7)
39329 ADD A,A
39330 ADD A,A
39331 ADD A,7
39333 LD E,A
39334 LD D,0
39336 LD HL,29566
39339 ADD HL,DE
39340 XOR A still alive?
39341 CP (HL)
39342 JP NZ,39459 no: a corpse — maybe drag it off
39345 DEC HL
39346 DEC HL
39347 DEC HL HL -> victim's +4 strength
39348 DEC (HL) the alien drains one strength point
39349 LD A,(HL)
39350 CP 2 below 2: victim collapses
39352 JR C,39400
39354 CP 4 2-3: wounded
39356 JR C,39365
39358 LD L,C still healthy:
39359 LD A,1 msg #1 "The ALIEN is attacking {actor}"
39361 CALL 37176
39364 RET
Prev: 39242 Up: Map Next: 39365