Prev: 37233 Up: Map Next: 37557
37395: Action: Roll Against Ten
Used by the routine at Action_Attack.
Rolls 10 against the caller's limit and returns the hit or the miss for the attack.
Action_RollAgainstTen 37395 PUSH BC Save BC and keep the roll limit in B.
37396 LD B,A
37397 LD A,10 Load 10 as the range of the roll.
37399 CALL CalculateRandom Call CalculateRandom to scale the roll.
37402 LD C,A Copy the result into C.
37403 ADD A,B Add the limit in B to the scaled roll.
37404 JR NC,Action_RollAgainstTen_Attack_RestoreTheRoll Return (through Action_RollAgainstTen_Attack_RestoreTheRoll) if the sum did not overflow.
37406 XOR A Clear A, and jump to Action_RollAgainstTen_Attack_RestoreTheRoll if bit 7 of the scaled roll in C is set.
37407 BIT 7,C
37409 JR NZ,Action_RollAgainstTen_Attack_RestoreTheRoll
37411 DEC A Step a zero result down by one.
Action_RollAgainstTen_Attack_RestoreTheRoll 37412 POP BC Restore BC from the stack.
37413 RET Return.
37414 DEFW 44860
37416 DEFW 44843
37418 DEFW 44832
37420 DEFW 44821
37422 DEFW 44809
37424 DEFW 44788
37426 DEFW 44770
37428 DEFW 44753
37430 DEFW 44730
37432 DEFW 44716
37434 DEFW 44696
37436 DEFW 44683
37438 DEFW 44666
37440 DEFW 44656
37442 DEFW 44634
37444 DEFW 44617
This entry point is used by the routine at Action_StopIfTheObjectIsFixed.
Action_RollAgainstTen_0 37446 LD IX,(46856) Read *46856.
37450 LD A,(IX+0) Read the copy count from the object record.
37453 DEC A Take one off the copy count.
37454 RET Return.
Reached through the action lists of 19 - "Barrel", 29 - "Sand", 31 - "Goblins Cache" and 33 - "Large Cupboard" for action 17, and of 37 - "Wooden Chest" and 41 - "Wooden Boat" for actions 14 and 17, dispatched by TriggerAction.
37455 CALL Action_StopIfTheObjectIsFixed Call Action_StopIfTheObjectIsFixed to stop the verb when the object is fixed or a fluid.
37458 LD A,(46825) Read *46825.
37461 CP (IX+1) Jump back to Response_ICannotDoThat if the second object is where this object is.
37464 JP Z,Response_ICannotDoThat
37467 LD IY,(46858) Read *46858.
Test the current action.
37471 LD A,(46823) Jump to Action_RollAgainstTen_Attack_ReadTheVolume if *CurrentAction is 18 (put on).
37474 CP 18
37476 JR Z,Action_RollAgainstTen_Attack_ReadTheVolume
37478 BIT 5,(IY+7) Jump to Action_RollAgainstTen_Attack_NameTheSecondObject if the object is not open.
37482 JR Z,Action_RollAgainstTen_Attack_NameTheSecondObject
Action_RollAgainstTen_Attack_ReadTheVolume 37484 LD A,(IY+2) Read the volume from IY.
37487 SUB (IX+2) Jump to Action_RollAgainstTen_Attack_PrintTooFull if the volume just read is below the volume of the object at 46856.
37490 JR C,Action_RollAgainstTen_Attack_PrintTooFull
37492 PUSH AF Read *46825.
37493 LD A,(46825)
37496 CALL Condition_TotalTheVolumeInside Call Condition_TotalTheVolumeInside to total the volume inside this object.
37499 LD B,A Copy the result into B.
37500 POP AF Subtract that volume from the value saved on the stack.
37501 SUB B
Action_RollAgainstTen_Attack_PrintTooFull 37502 LD HL,44570 Point HL at 44570 and jump back to PrintMessage if the result went below zero.
37505 JP C,PrintMessage
37508 JP Z,PrintMessage Jump back to PrintMessage if the result is zero.
If the message is held back, the hit is not applied.
37511 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the hit is not applied.
37514 LD A,(IY+16) Read the location from IY.
37517 LD (IX+16),A Update the object's location.
37520 LD A,(46825) Read *46825.
37523 LD (IX+1),A Update where this object is.
37526 RET Return.
Action_RollAgainstTen_Attack_NameTheSecondObject 37527 LD A,5 Pass 5 to the routine that names the second object.
37529 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 20 - "Wine" and 21 - "Water" for action 33, dispatched by TriggerAction.
37532 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the holder's flag is not cleared.
37535 LD IX,(46856) Read *46856.
37539 LD A,(IX+1) Read where this object is from the object record.
37542 CP 255 Jump to Action_AddToThePlayersStrength if this object is not inside another object.
37544 JR Z,Action_AddToThePlayersStrength
Find the object's record.
37546 CALL LocateObject Call LocateObject to locate object.
37549 RES 2,(IX+7) Mark the object not full.
37553 LD A,1 The strength added here is 1.
37555 JR Action_AddToThePlayersStrength_AddToTheStrength Jump to Action_AddToThePlayersStrength_AddToTheStrength to add 1 to the character's strength.
Prev: 37233 Up: Map Next: 37557