Prev: 37944 Up: Map Next: 38182
37992: AlienScareCheck — will the alien flee the fight?
After a crew attack: total up how frightening the resistance is, then roll a script nibble — if the nibble is below the total (and is not 15), the alien flees to a random adjacent room and every fighter present gains courage and morale (+1 each, courage capped at 8). The total counts, for each of up to three crew in the room (the attacker + room-mates from 37876): +1 if a fit (strength 3+), in-combat (state 4) fighter is Confident (morale 4+); plus the alien's wounds / 4 — a hurt alien is easier to drive off.
The INC (HL) at the end of the 38050 weapon check is unreachable: the two comparisons before it demand A = 6 AND A = 7 at once (JR NZ where the intent was presumably a 6-12 weapon range check), so the intended "armed with something serious" bonus never applies — an original-game bug, preserved as-is.
37992 CALL 37876 gather the attacker + up to two other
37995 XOR A crew in the alien's room; scare total = 0
37996 LD (33698),A
37999 PUSH IX
38001 LD DE,33695
38004 LD B,3 all three gathered slots:
38006 PUSH BC
38007 PUSH DE
38008 LD A,(DE) A = slot (>= 8 = none)
38009 CP 8
38011 JR NC,38084
38013 PUSH AF
38014 LD IX,29566 IX -> his record
38018 ADD A,A
38019 ADD A,A
38020 ADD A,A
38021 LD E,A
38022 LD D,0
38024 ADD IX,DE
38026 LD A,2 fit to fight (strength 3+)?
38028 CP (IX+4)
38031 JR NC,38083 no: he doesn't scare anything
38033 LD A,4 actually in combat (state 4)?
38035 CP (IX+3)
38038 JR NZ,38083 no: doesn't count
38040 LD HL,33698
38043 DEC A Confident (morale 4+)?
38044 CP (IX+6)
38047 JR NC,38050
38049 INC (HL) yes: +1 to the scare total
38050 POP AF A = the slot again
38051 CALL 31823 FindHeldItems: what does he hold?
38054 LD HL,33698
38057 LD A,(31248) front-hand weapon check —
38060 CP 13 but the INC below is unreachable:
38062 JR NC,38073 the two equality tests demand
38064 CP 6 A = 6 and A = 7 at once
38066 JR NZ,38073 (original-game bug, see the header)
38068 CP 7
38070 JR NZ,38073
38072 INC (HL) (never executed)
38073 LD A,(29570) + the alien's wounds / 4:
38076 SRA A a hurt alien is easier
38078 SRA A to drive off
38080 ADD A,(HL)
38081 LD (HL),A
38082 PUSH AF (balances the POP below)
38083 POP AF
38084 POP DE
38085 INC DE next gathered slot
38086 POP BC
38087 DJNZ 38006
38089 CALL 33589 roll the next script nibble (0-15)
38092 CP 15 15 = the alien always stands firm
38094 JR Z,38177
38096 LD HL,33698 nibble below the scare total?
38099 CP (HL)
38100 JR NC,38177 no: it stays and fights
38102 LD IX,29566 yes: it flees — IX -> the alien
38106 CALL 36717 pick an adjacent room, rerolling
38109 LD A,(IX+1) until it actually leaves
38112 CP (IX+2) (destination != current)
38115 JR Z,38106
38117 LD A,(33700) move it there at once:
38120 PUSH AF run CrewAction1_Arrive with
38121 XOR A CrewIndex temporarily = 0
38122 LD (33700),A
38125 CALL 36034
38128 POP AF
38129 LD (33700),A
38132 CALL 39695 restart the encounter-screen animation
38135 LD (IX+0),0 park the alien's countdown
38139 LD DE,33695 every fighter present is emboldened:
38142 LD B,3
38144 PUSH BC
38145 PUSH DE
38146 LD A,(DE) A = slot (>= 8 = none)
38147 CP 8
38149 JR NC,38169
38151 ADD A,A +1 courage and +1 morale
38152 ADD A,A (IncPairAt on his +5/+6),
38153 ADD A,A
38154 LD E,A
38155 LD D,0
38157 LD HL,29571
38160 CALL 45366
38163 CP 9 courage capped at 8
38165 JR C,38169
38167 LD (HL),8
38169 POP DE
38170 INC DE
38171 POP BC
38172 DJNZ 38144
38174 JP 45373 refresh the viewed condition line
38177 POP IX
38179 JP 37555 keep ATTACK on the special row
Prev: 37944 Up: Map Next: 38182