![]() |
Routines |
| Prev: 914A | Up: Map | Next: 9213 |
|
Attacks the current object, using strength and the combat byte. Reached through the action lists of $3D - "Nasty Goblin", $3F - "Thorin", $45 - "Hideous Goblin", $49 - "Horrible Goblin", $4A - "Mean Goblin", $4B - "Vicious Goblin" and $4C - "Disgusting Goblin" for action 0F, dispatched by TriggerAction. Reached through the action table at ActionTable, dispatched by Turn_RunTheHandlerIfPresent.
|
||||
| Action_Attack | 9171 | CALL Action_TestTheSharedFlagBits | Call Action_TestTheSharedFlagBits to test the shared flag bits. | |
| 9174 | LD A,($B6E9) | Read *B6E9. | ||
| 9177 | LD HL,$026B | Jump to Action_Attack_StoreTheWeapon with the token FIST if no object was named. | ||
| 917A | CP $FF | |||
| 917C | JR Z,Action_Attack_StoreTheWeapon | |||
| 917E | LD IX,($B70A) | Read *B70A. | ||
| 9182 | LD L,(IX+$08) | Read the name token from the object record. | ||
| 9185 | LD H,(IX+$09) | Read the name token's high byte from the object record. | ||
| Action_Attack_StoreTheWeapon | 9188 | LD ($B6FC),HL | Store the weapon-name token at B6FC. | |
| 918B | LD IX,($B70C) | Read *Pointer_CurrentCharacter. | ||
| 918F | LD B,(IX+$05) | Read the strength from the object record. | ||
| 9192 | LD A,($B6E9) | Read *B6E9. | ||
| 9195 | INC A | Jump to Action_Attack_TakeThatLimitBack if the second object is FF. | ||
| 9196 | JR Z,Action_Attack_TakeThatLimitBack | |||
| 9198 | LD IY,($B70A) | Read *B70A. | ||
| 919C | LD A,(IY+$00) | Read the copy count of the object being attacked. | ||
| 919F | DEC A | Jump back to PrintMessage unless that object has one copy. | ||
| 91A0 | LD HL,$AF5F | |||
| 91A3 | JP NZ,PrintMessage | |||
| 91A6 | LD A,(IY+$05) | Read the attacked object's strength. | ||
| 91A9 | ADD A,B | Add the attacker's strength onto the attacked object's strength. | ||
| 91AA | JR NC,Action_Attack_KeepTheRollLimit | Jump to Action_Attack_KeepTheRollLimit if the sum did not overflow. | ||
| 91AC | LD A,$FF | Cap the sum at FF. | ||
| Action_Attack_KeepTheRollLimit | 91AE | LD B,A | Keep the sum in B as the roll limit. | |
| Action_Attack_TakeThatLimitBack | 91AF | LD A,B | Take that limit back into A. | |
| 91B0 | CALL Action_RollAgainstTen | Call Action_RollAgainstTen to roll 0A against the attacker's limit. | ||
| 91B3 | LD B,A | Copy the result into B. | ||
|
If the message is held back, the attack is not resolved.
|
||||
| 91B4 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the attack is not resolved. | ||
| 91B7 | LD IX,($B708) | Read *B708. | ||
| 91BB | LD A,(IX+$06) | Read the combat byte from the object record. | ||
| 91BE | CALL Action_RollAgainstTen | Call Action_RollAgainstTen to roll 0A against the attacker's limit. | ||
| 91C1 | CP B | Jump back to PrintMessage if this roll is not below the first. | ||
| 91C2 | LD HL,$AF50 | |||
| 91C5 | JP NC,PrintMessage | |||
| 91C8 | LD C,A | Keep this roll in C. | ||
| 91C9 | ADD A,$10 | Add 10 to this roll (capped at FF) and jump to Action_Attack_PointAtTheCleaveMessage if the first roll is still higher. | ||
| 91CB | JR NC,Action_Attack_0 | |||
| 91CD | LD A,$FF | |||
| Action_Attack_0 | 91CF | CP B | ||
| 91D0 | JR C,Action_Attack_PointAtTheCleaveMessage | |||
| 91D2 | LD A,B | Take the first roll back into A. | ||
| 91D3 | SUB C | Take this roll off the first. | ||
| 91D4 | RLCA | Double the difference. | ||
| 91D5 | LD E,A | Keep the doubled difference in E. | ||
| 91D6 | LD D,$00 | The message-table offset's high byte is zero. | ||
| 91D8 | LD IY,$9226 | Index the attack-message table at 9226. | ||
| 91DC | ADD IY,DE | |||
| 91DE | LD L,(IY+$00) | Read the low byte of the message address. | ||
| 91E1 | LD H,(IY+$01) | Read the high byte of the message address. | ||
| 91E4 | RRCA | Shift the doubled difference back down. | ||
| 91E5 | RRCA | Shift it down again, undoing the double. | ||
| 91E6 | LD B,A | Keep that difference in B. | ||
| 91E7 | CPL | Complement A. | ||
| 91E8 | ADD A,(IX+$05) | Add the current object's strength. | ||
| 91EB | JR NC,Action_Attack_TakeTheDifferenceBack | Leave the strength unchanged if the damage would take it below zero. | ||
| 91ED | LD (IX+$05),A | Store the reduced strength. | ||
| Action_Attack_TakeTheDifferenceBack | 91F0 | LD A,B | Take the difference back into A. | |
| 91F1 | RRCA | Shift the difference down once more. | ||
| 91F2 | CPL | Complement A. | ||
| 91F3 | ADD A,(IX+$06) | Add the current object's combat byte. | ||
| 91F6 | JR NC,Action_Attack_PrintTheMessage | Leave the combat byte unchanged if the damage would take it below zero. | ||
| 91F8 | LD (IX+$06),A | Store the reduced combat byte. | ||
| Action_Attack_PrintTheMessage | 91FB | JP PrintMessage | Jump to PrintMessage to print the message at HL. | |
| Action_Attack_PointAtTheCleaveMessage | 91FE | LD HL,$AE3A | Point HL at AE3A. | |
| 9201 | CALL PrintMessage | Call PrintMessage to print message. | ||
| 9204 | SET 3,(IX+$07) | Mark the object broken. | ||
| 9208 | LD A,($B6E8) | Read *CurrentObject. | ||
| 920B | CALL Turn_ThePlayerHasDied_0 | Call Turn_ThePlayerHasDied_0. The player dies if no object is left. | ||
| 920E | LD A,$06 | Pass 06 to the routine that names this object. | ||
| 9210 | JP Message_NameFromThisRecord | Jump to Message_NameFromThisRecord to print the object's name. | ||
| Prev: 914A | Up: Map | Next: 9213 |