Prev: 92B5 Up: Map Next: 939E
92ED: 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 83 will not work. Reached through the action lists of $01 - "Heavy Rock Door", $05 - "Round Green Door", $07 - "Spider Web", $0A - "Goblins Back Door", $0C - "Large Trap Door", $0E - "Short Strong Sword", $13 - "Barrel", $19 - "Bow", $1A - "Strong Arrow", $1E - "Trap Door", $21 - "Large Cupboard", $25 - "Wooden Chest" and $29 - "Wooden Boat" for action 0B, dispatched by TriggerAction.
Action_UseTheOtherObject 92ED LD IX,($B708) Read *B708.
92F1 BIT 1,(IX+$07) Jump to ResponseThatWillNotWork if the object is a fluid.
92F5 JP NZ,ResponseThatWillNotWork
92F8 BIT 3,(IX+$07) Jump to Action_UseTheOtherObject_Attack_PrintTheObjectName if the object is broken.
92FC JP NZ,Action_UseTheOtherObject_Attack_PrintTheObjectName
92FF SUB A Jump to ResponseThatWillNotWork if the object's combat byte is zero.
9300 CP (IX+$06)
9303 JP Z,ResponseThatWillNotWork
9306 LD B,A Copy the result into B.
9307 LD A,($B6E9) Read *B6E9.
930A INC A Jump to Action_UseTheOtherObject_Attack_HoldTheMessage if there is no second object (FF).
930B JR Z,Action_UseTheOtherObject_Attack_HoldTheMessage
930D LD IY,($B70A) Read *B70A.
9311 LD A,(IY+$05) Read the strength from IY.
9314 AND A Jump to ResponseThatWillNotWork if the object's strength is zero.
9315 JP Z,ResponseThatWillNotWork
9318 PUSH IX Read *B70A.
931A LD IX,($B70A)
931E LD A,$0B Look up action 0B.
9320 CALL TableFindAnActionRecord Call TableFindAnActionRecord to find an action record.
9323 POP IX Jump to ResponseThatWillNotWork if TableFindAnActionRecord found no action record (FF).
9325 INC A
9326 JP Z,ResponseThatWillNotWork
9329 LD B,(IY+$05) Read the strength from IY.
If the message is held back, the second object is not used.
Action_UseTheOtherObject_Attack_HoldTheMessage 932C CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the second object is not used.
932F LD A,$15 Scale the roll by 15.
9331 CALL CalculateRandom Call CalculateRandom to scale the roll.
9334 ADD A,B Add B to the roll.
9335 LD IY,($B70C) Read *Pointer_CurrentCharacter.
9339 ADD A,(IY+$05) Add the strength of the object at Pointer_CurrentCharacter.
933C JR NC,Action_UseTheOtherObject_Attack_TestTheCombatByte Jump to Action_UseTheOtherObject_Attack_TestTheCombatByte if the sum did not overflow.
933E LD A,$FF Cap the sum at FF.
Action_UseTheOtherObject_Attack_TestTheCombatByte 9340 SUB (IX+$06) Jump to Action_UseTheOtherObject_Attack_ReadSecondObject if the total is below the object's combat byte.
9343 JR C,Action_UseTheOtherObject_Attack_ReadSecondObject
9345 SET 3,(IX+$07) Mark the object broken.
9349 LD A,($B6E8) Read *CurrentObject.
934C CALL Action_ClearTheTie Call Action_ClearTheTie to clear the tie on the object.
934F SRA (IX+$05) Halve the strength.
9353 LD A,(IX+$04) Read the second flag from the object record.
9356 CP $02 Call Condition_WhereTheObjectIs if the object's second flag is below 02.
9358 CALL C,Condition_WhereTheObjectIs
935B LD A,$83 Name this object under code 83.
935D CALL Message_NameFromThisRecord Call Message_NameFromThisRecord to print "is" with this object's name.
Action_UseTheOtherObject_Attack_ReadSecondObject 9360 LD A,($B6E9) Read *B6E9.
9363 CP $FF Return if no object was named.
9365 RET Z
9366 LD IY,($B70A) Read *B70A.
936A BIT 3,(IY+$07) Return if the object is broken.
936E RET NZ
936F LD B,(IY+$06) Read the combat byte from IY.
9372 LD A,$15 Scale the roll by 15.
9374 CALL CalculateRandom Call CalculateRandom to scale the roll.
9377 ADD A,B Add the combat byte in B to the roll.
9378 JR NC,Action_UseTheOtherObject_Attack_ReturnIfWeaker Jump to Action_UseTheOtherObject_Attack_ReturnIfWeaker if the sum did not overflow.
937A LD A,$FF Cap the sum at FF.
Action_UseTheOtherObject_Attack_ReturnIfWeaker 937C SUB (IX+$06) Return if the roll is below the object's combat byte.
937F RET C
9380 SET 3,(IY+$07) Mark the object broken.
9384 LD A,($B6E9) Read *B6E9.
9387 CALL Action_ClearTheTie Call Action_ClearTheTie to clear the tie on the object.
938A LD A,(IY+$05) Read the strength from IY.
938D SRA A Halve the strength.
938F LD (IY+$05),A Update the object's strength.
9392 CALL Condition_WhereTheObjectIs Call Condition_WhereTheObjectIs to find where the object is.
9395 PUSH IY Use the second-object pointer as the object record.
9397 POP IX
Action_UseTheOtherObject_Attack_PrintTheObjectName 9399 LD A,$83 Pass code 83 on to the naming routine.
939B JP Message_NameFromThisRecord Jump to Message_NameFromThisRecord to print the object's name.
Prev: 92B5 Up: Map Next: 939E