Prev: 37520 Up: Map Next: 37876
37584: CrewHitsAlien
Alien-side combat handler. Called from CrewAction4_Handler (its DispatchHitsAlien branch) when the state-4 actor stands in the alien's room ($737F).
The outcome depends on the WEAPON: FindHeldItems loads the attacking crew member's front-hand item id into HeldItemFront and the effect dispatches on it. It also houses the Harpoon Gun's kill primitive at 37733.
Guards: re-asserts that the attacker still shares the alien's room, then requires strength (IX+4) >= 2 and morale (IX+6) >= 2 — a crew member who is Collapsed or Broken/Shaken cannot fight. Then the front-hand weapon decides:
Weapon Outcome
17 (Cat Box) silent no-op
>= 20 (Cat in Net/Box, or 255 = bare hands) silent no-op
16 (Net) "net" outcome: stamp 255 into the alien's countdown byte ($737E, slot 0 byte +0) — netted, out of action — destroy the Net (single-use), then enqueue message #3 "{actor} nets the ALIEN"
else "hit" outcome at 37646: enqueue message #4 "{actor} hits the ALIEN", then dispatch on the weapon id (table below)
The "hit" outcome's weapon-id dispatch:
Weapon id Effect
0-5 Elctrc Prd/Incineratr, 18-19 Spanner INC alien's wound counter at $7382 (byte +4 of slot 0). If it reaches the AlienKillThreshold (15), JP 44125 (alien-defeated path).
6-7 Tracker the tracker shatters on the alien (destroyed, msg #5 "Tracker is broken") but still wounds it (+1)
8-11 Fire Extng no wound — spend a charge (ItemCharges) and try to scare the alien off (AlienScareCheck); with no charge left, msg #6 "extinguisher empty"
12 Harpn Gun the kill primitive at 37733 — see AlienKillPrimitive below
13-15 Laser Pist spend a charge, wound the alien (+2) and damage the room (+6); with no charge left, msg #7 "Laser is exhausted"
This routine parallels CrewHitsAndroid in structure but refers to the alien (slot 0 at $737E) and emits messages #3 / #4 instead of #31 / #32.
37584 LD A,(29567) A = the alien's current room (slot 0 byte +1)
37587 CP (IX+1) does the attacker still share it?
37590 RET NZ no: the alien slipped away — bail
37591 LD A,(IX+4) attacker's strength >= 2?
37594 CP 2
37596 RET C no: too hurt to fight
37597 LD A,(IX+6) attacker's morale >= 2?
37600 CP 2
37602 RET C no: too scared to fight
37603 CALL 44986 clear the hand cache, A = attacker's slot
37606 CALL 31823 FindHeldItems: what is he holding?
37609 LD A,(31248) A = the front-hand weapon
37612 CP 17 the Cat Box?
37614 JP Z,37555 useless: silent no-op
37617 CP 20 Cat in Net/Box, or bare hands (255)?
37619 JP NC,37555 also useless
37622 CP 16 the Net?
37624 JR NZ,37646 no → "hits the ALIEN" branch
37626 LD HL,29566 yes: stamp 255 into the alien's countdown
37629 LD (HL),255 byte ($737E) — netted, out of action
37631 CALL 37924 the Net is used up (destroyed)
37634 LD A,(33700) A = the attacker's slot
37637 LD L,A L = actor for the name substitution
37638 LD A,3 A = msg #3 "{actor} nets the ALIEN"
37640 CALL 37176 enqueue
37643 JP 37555
"{actor} hits the ALIEN" branch (CrewHitsAlien continued).
37646 PUSH AF stash the weapon id across the message
37647 LD A,(33700) A = the attacker's slot
37650 LD L,A L = actor for the name substitution
37651 LD A,4 A = msg #4 "{actor} hits the ALIEN"
37653 CALL 37176 enqueue
37656 POP AF A = the weapon again
37657 CP 6 0-5: a prod or an incinerator?
37659 JR C,37669
37661 CP 18 18/19: a spanner?
37663 JR Z,37669
37665 CP 19
37667 JR NZ,37683 anything else: weapon-specific handling
37669 LD HL,29570 wound the alien: its +4 counter +1
37672 INC (HL)
37673 LD A,(33745) wounds reached the kill threshold (15)?
37676 CP (HL)
37677 JP Z,44125 yes: the alien dies — endgame
37680 JP 37992 no: it may flee (AlienScareCheck)
37683 CP 8 6/7: a tracker?
37685 JR NC,37700
37687 CALL 37924 yes: it shatters on the alien —
37690 LD HL,(33700) destroyed; L = actor,
37693 LD A,5 msg #5 "{actor}'s Tracker is broken"
37695 CALL 37176
37698 JR 37669 and it still wounds the alien
37700 CP 12 8-11: an extinguisher?
37702 JR NC,37730
37704 LD HL,33746 yes: HL -> its ItemCharges entry
37707 LD E,A
37708 LD D,0
37710 ADD HL,DE
37711 LD A,(HL) any CO2 left?
37712 AND A
37713 JR Z,37719
37715 DEC (HL) yes: spend a charge — no wound, but
37716 JP 37992 the spray may scare the alien off
37719 LD HL,(33700) empty: L = actor,
37722 LD A,6 msg #6 "{actor}'s extinguisher..empty"
37724 CALL 37176
37727 JP 37555
AlienKillPrimitive — the Harpoon Gun outcome, reached from CrewHitsAlien when the attacker's front-hand item (31248) is 12, the Harpn Gun.
A harpoon strike is devastating for both sides: 37876 gathers the attacker and up to two other crew in the alien's room (NearestCrewC + NearestCrewA/B); for each, every ItemLocations entry that the slot carries or that lies in the alien's room is destroyed (set to 255), and if the slot is still alive (+7 = 0) it is killed (+7 = 1, strength +4 cleared) — firing the harpoon kills the firer and every bystander.
The room takes 15 damage points, the alien's own wound counter is bumped by 5 (harpoon hits push it quickly over the kill threshold → dies via JP 44125), the corridor view is rebuilt (CALL 31417) and the chain continues at AlienScareCheck.
37730 JP NZ,37831 weapon != 12 → 13-15, the laser branch
37733 CALL 37876 gather the attacker + up to two other crew in the alien's room
37736 LD DE,33695
37739 LD B,3 all three gathered slots:
37741 PUSH BC
37742 PUSH DE
37743 LD A,(DE) A = victim slot (255 = none)
37744 CP 255
37746 JR Z,37801
37748 PUSH AF
37749 ADD A,128 E = victim's back-hand marker
37751 LD E,A
37752 ADD A,32 D = victim's front-hand marker
37754 LD D,A
37755 LD C,(IX+1) C = the alien's room
37758 LD HL,29940 destroy every item the victim holds
37761 LD B,22 or that lies in the alien's room:
37763 LD A,(HL)
37764 CP E
37765 JR Z,37773
37767 CP D
37768 JR Z,37773
37770 CP C
37771 JR NZ,37775
37773 LD (HL),255 ItemLocations entry -> gone
37775 INC HL
37776 DJNZ 37763
37778 POP AF HL -> the victim's status byte (+7)
37779 LD HL,29566
37782 ADD A,A
37783 ADD A,A
37784 ADD A,A
37785 ADD A,7
37787 LD E,A
37788 LD D,0
37790 ADD HL,DE
37791 XOR A still alive?
37792 CP (HL)
37793 JR NZ,37801
37795 LD (HL),1 yes: killed by the blast (+7 = 1),
37797 DEC HL
37798 DEC HL
37799 DEC HL
37800 LD (HL),A strength (+4) = 0
37801 POP DE
37802 INC DE
37803 POP BC
37804 DJNZ 37741
37806 LD A,15 the blast wrecks the room:
37808 CALL 38182 +15 damage points
37811 LD HL,29570 alien wound counter += 5
37814 LD A,(HL)
37815 ADD A,5
37817 LD (HL),A
37818 LD HL,33745 reached the kill threshold (15)?
37821 CP (HL)
37822 JP NC,44125 yes: the alien dies — endgame
37825 CALL 31417 rebuild the ship view
37828 JP 37992 the alien may flee
37831 LD E,A 13-15, a laser pistol:
37832 LD D,0
37834 LD HL,33746 HL -> its ItemCharges entry
37837 ADD HL,DE
37838 XOR A any shots left?
37839 CP (HL)
37840 JR Z,37865
37842 DEC (HL) yes: spend one
37843 LD A,6 the beam scorches the room:
37845 CALL 38182 +6 damage points
37848 LD HL,29570 alien wound counter += 2
37851 LD A,(HL)
37852 ADD A,2
37854 LD (HL),A
37855 LD HL,33745 reached the kill threshold (15)?
37858 CP (HL)
37859 JP NC,44125 yes: the alien dies — endgame
37862 JP 37992 no: it may flee
37865 LD HL,(33700) out of shots: L = actor,
37868 LD A,7 msg #7 "{actor}'s Laser is exhausted"
37870 CALL 37176
37873 JP 37555
Prev: 37520 Up: Map Next: 37876