Prev: 37557 Up: Map Next: 37790
37613: Action: Use The Other Object
Used by the routines at Action_Shoot and Event_TheBarrel.
Uses the second object on the current one. A fluid, a broken object, or a combat byte of 131 will not work. Reached through the action lists of 1 - "Heavy Rock Door", 5 - "Round Green Door", 7 - "Spider Web", 10 - "Goblins Back Door", 12 - "Large Trap Door", 14 - "Short Strong Sword", 19 - "Barrel", 25 - "Bow", 26 - "Strong Arrow", 30 - "Trap Door", 33 - "Large Cupboard", 37 - "Wooden Chest" and 41 - "Wooden Boat" for action 11, dispatched by TriggerAction.
Action_UseTheOtherObject 37613 LD IX,(46856) Read *46856.
37617 BIT 1,(IX+7) Jump to ResponseThatWillNotWork if the object is a fluid.
37621 JP NZ,ResponseThatWillNotWork
37624 BIT 3,(IX+7) Jump to Action_UseTheOtherObject_Attack_PrintTheObjectName if the object is broken.
37628 JP NZ,Action_UseTheOtherObject_Attack_PrintTheObjectName
37631 SUB A Jump to ResponseThatWillNotWork if the object's combat byte is zero.
37632 CP (IX+6)
37635 JP Z,ResponseThatWillNotWork
37638 LD B,A Copy the result into B.
37639 LD A,(46825) Read *46825.
37642 INC A Jump to Action_UseTheOtherObject_Attack_HoldTheMessage if there is no second object (255).
37643 JR Z,Action_UseTheOtherObject_Attack_HoldTheMessage
37645 LD IY,(46858) Read *46858.
37649 LD A,(IY+5) Read the strength from IY.
37652 AND A Jump to ResponseThatWillNotWork if the object's strength is zero.
37653 JP Z,ResponseThatWillNotWork
37656 PUSH IX Read *46858.
37658 LD IX,(46858)
37662 LD A,11 Look up action 11.
37664 CALL TableFindAnActionRecord Call TableFindAnActionRecord to find an action record.
37667 POP IX Jump to ResponseThatWillNotWork if TableFindAnActionRecord found no action record (255).
37669 INC A
37670 JP Z,ResponseThatWillNotWork
37673 LD B,(IY+5) Read the strength from IY.
If the message is held back, the second object is not used.
Action_UseTheOtherObject_Attack_HoldTheMessage 37676 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the second object is not used.
37679 LD A,21 Scale the roll by 21.
37681 CALL CalculateRandom Call CalculateRandom to scale the roll.
37684 ADD A,B Add B to the roll.
37685 LD IY,(46860) Read *Pointer_CurrentCharacter.
37689 ADD A,(IY+5) Add the strength of the object at Pointer_CurrentCharacter.
37692 JR NC,Action_UseTheOtherObject_Attack_TestTheCombatByte Jump to Action_UseTheOtherObject_Attack_TestTheCombatByte if the sum did not overflow.
37694 LD A,255 Cap the sum at 255.
Action_UseTheOtherObject_Attack_TestTheCombatByte 37696 SUB (IX+6) Jump to Action_UseTheOtherObject_Attack_ReadSecondObject if the total is below the object's combat byte.
37699 JR C,Action_UseTheOtherObject_Attack_ReadSecondObject
37701 SET 3,(IX+7) Mark the object broken.
37705 LD A,(46824) Read *CurrentObject.
37708 CALL Action_ClearTheTie Call Action_ClearTheTie to clear the tie on the object.
37711 SRA (IX+5) Halve the strength.
37715 LD A,(IX+4) Read the second flag from the object record.
37718 CP 2 Call Condition_WhereTheObjectIs if the object's second flag is below 2.
37720 CALL C,Condition_WhereTheObjectIs
37723 LD A,131 Name this object under code 131.
37725 CALL Message_NameFromThisRecord Call Message_NameFromThisRecord to print "is" with this object's name.
Action_UseTheOtherObject_Attack_ReadSecondObject 37728 LD A,(46825) Read *46825.
37731 CP 255 Return if no object was named.
37733 RET Z
37734 LD IY,(46858) Read *46858.
37738 BIT 3,(IY+7) Return if the object is broken.
37742 RET NZ
37743 LD B,(IY+6) Read the combat byte from IY.
37746 LD A,21 Scale the roll by 21.
37748 CALL CalculateRandom Call CalculateRandom to scale the roll.
37751 ADD A,B Add the combat byte in B to the roll.
37752 JR NC,Action_UseTheOtherObject_Attack_ReturnIfWeaker Jump to Action_UseTheOtherObject_Attack_ReturnIfWeaker if the sum did not overflow.
37754 LD A,255 Cap the sum at 255.
Action_UseTheOtherObject_Attack_ReturnIfWeaker 37756 SUB (IX+6) Return if the roll is below the object's combat byte.
37759 RET C
37760 SET 3,(IY+7) Mark the object broken.
37764 LD A,(46825) Read *46825.
37767 CALL Action_ClearTheTie Call Action_ClearTheTie to clear the tie on the object.
37770 LD A,(IY+5) Read the strength from IY.
37773 SRA A Halve the strength.
37775 LD (IY+5),A Update the object's strength.
37778 CALL Condition_WhereTheObjectIs Call Condition_WhereTheObjectIs to find where the object is.
37781 PUSH IY Use the second-object pointer as the object record.
37783 POP IX
Action_UseTheOtherObject_Attack_PrintTheObjectName 37785 LD A,131 Pass code 131 on to the naming routine.
37787 JP Message_NameFromThisRecord Jump to Message_NameFromThisRecord to print the object's name.
Prev: 37557 Up: Map Next: 37790