Prev: 9171 Up: Map Next: 92B5
9213: Action: Roll Against Ten
Used by the routine at Action_Attack.
Rolls 0A against the caller's limit and returns the hit or the miss for the attack.
Action_RollAgainstTen 9213 PUSH BC Save BC and keep the roll limit in B.
9214 LD B,A
9215 LD A,$0A Load 0A as the range of the roll.
9217 CALL CalculateRandom Call CalculateRandom to scale the roll.
921A LD C,A Copy the result into C.
921B ADD A,B Add the limit in B to the scaled roll.
921C JR NC,Action_RollAgainstTen_Attack_RestoreTheRoll Return (through Action_RollAgainstTen_Attack_RestoreTheRoll) if the sum did not overflow.
921E XOR A Clear A, and jump to Action_RollAgainstTen_Attack_RestoreTheRoll if bit 7 of the scaled roll in C is set.
921F BIT 7,C
9221 JR NZ,Action_RollAgainstTen_Attack_RestoreTheRoll
9223 DEC A Step a zero result down by one.
Action_RollAgainstTen_Attack_RestoreTheRoll 9224 POP BC Restore BC from the stack.
9225 RET Return.
9226 DEFW $AF3C
9228 DEFW $AF2B
922A DEFW $AF20
922C DEFW $AF15
922E DEFW $AF09
9230 DEFW $AEF4
9232 DEFW $AEE2
9234 DEFW $AED1
9236 DEFW $AEBA
9238 DEFW $AEAC
923A DEFW $AE98
923C DEFW $AE8B
923E DEFW $AE7A
9240 DEFW $AE70
9242 DEFW $AE5A
9244 DEFW $AE49
This entry point is used by the routine at Action_StopIfTheObjectIsFixed.
Action_RollAgainstTen_0 9246 LD IX,($B708) Read *B708.
924A LD A,(IX+$00) Read the copy count from the object record.
924D DEC A Take one off the copy count.
924E RET Return.
Reached through the action lists of $13 - "Barrel", $1D - "Sand", $1F - "Goblins Cache" and $21 - "Large Cupboard" for action 11, and of $25 - "Wooden Chest" and $29 - "Wooden Boat" for actions 0E and 11, dispatched by TriggerAction.
924F CALL Action_StopIfTheObjectIsFixed Call Action_StopIfTheObjectIsFixed to stop the verb when the object is fixed or a fluid.
9252 LD A,($B6E9) Read *B6E9.
9255 CP (IX+$01) Jump back to Response_ICannotDoThat if the second object is where this object is.
9258 JP Z,Response_ICannotDoThat
925B LD IY,($B70A) Read *B70A.
Test the current action.
925F LD A,($B6E7) Jump to Action_RollAgainstTen_Attack_ReadTheVolume if *CurrentAction is 12 (put on).
9262 CP $12
9264 JR Z,Action_RollAgainstTen_Attack_ReadTheVolume
9266 BIT 5,(IY+$07) Jump to Action_RollAgainstTen_Attack_NameTheSecondObject if the object is not open.
926A JR Z,Action_RollAgainstTen_Attack_NameTheSecondObject
Action_RollAgainstTen_Attack_ReadTheVolume 926C LD A,(IY+$02) Read the volume from IY.
926F SUB (IX+$02) Jump to Action_RollAgainstTen_Attack_PrintTooFull if the volume just read is below the volume of the object at B708.
9272 JR C,Action_RollAgainstTen_Attack_PrintTooFull
9274 PUSH AF Read *B6E9.
9275 LD A,($B6E9)
9278 CALL Condition_TotalTheVolumeInside Call Condition_TotalTheVolumeInside to total the volume inside this object.
927B LD B,A Copy the result into B.
927C POP AF Subtract that volume from the value saved on the stack.
927D SUB B
Action_RollAgainstTen_Attack_PrintTooFull 927E LD HL,$AE1A Point HL at AE1A and jump back to PrintMessage if the result went below zero.
9281 JP C,PrintMessage
9284 JP Z,PrintMessage Jump back to PrintMessage if the result is zero.
If the message is held back, the hit is not applied.
9287 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the hit is not applied.
928A LD A,(IY+$10) Read the location from IY.
928D LD (IX+$10),A Update the object's location.
9290 LD A,($B6E9) Read *B6E9.
9293 LD (IX+$01),A Update where this object is.
9296 RET Return.
Action_RollAgainstTen_Attack_NameTheSecondObject 9297 LD A,$05 Pass 05 to the routine that names the second object.
9299 JP Message_NameFromTheOtherRecord Jump to Message_NameFromTheOtherRecord to name the second object.
If the message is held back, the holder's flag is not cleared.
Reached through the action lists of $14 - "Wine" and $15 - "Water" for action 21, dispatched by TriggerAction.
929C CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the holder's flag is not cleared.
929F LD IX,($B708) Read *B708.
92A3 LD A,(IX+$01) Read where this object is from the object record.
92A6 CP $FF Jump to Action_AddToThePlayersStrength if this object is not inside another object.
92A8 JR Z,Action_AddToThePlayersStrength
Find the object's record.
92AA CALL LocateObject Call LocateObject to locate object.
92AD RES 2,(IX+$07) Mark the object not full.
92B1 LD A,$01 The strength added here is 01.
92B3 JR Action_AddToThePlayersStrength_AddToTheStrength Jump to Action_AddToThePlayersStrength_AddToTheStrength to add 01 to the character's strength.
Prev: 9171 Up: Map Next: 92B5