ReflectBugFix

Fixing several odd bugs of skill-reflection in the engine's default battle-system. Reflected animations will stop playing three times, animation-targets of reflection are no longer in the same slot as the original skill's target, actors with database-ID above 4 stop making the game crash and targeting enemies with a troop-slot above actor-party's size won't crash it aswell.

Originally made and first released by bugmenot.

RPG2003
1.00UNKNOWN1UNKNOWN21.0.2.1
1.0.2.1
1.0.3.0
1.0.4.0
1.0.5.0
1.0.5.0
1.0.6.0
1.0.6.0
1.0.7.0
1.0.7.0
1.0.8.0
1.0.8.0
1.0.9.1
1.0.9.1
1.101.111.12mp210414

Segment 1/4

Offsets

RPG2003
1.0.8.0
1.0.8.0
0049C36Eh
0009B76Eh

Sourcecode

			NOP
			CALL PROC__0049C4F0h

Bytes

90 E87C010000

Segment 2/4

Offsets

RPG2003
1.0.8.0
1.0.8.0
0049C45Ch
0009B85Ch

Sourcecode

			NOP
			NOP
			NOP
			NOP
			NOP
			NOP
			DEC AL
			NOP
			NOP

Bytes

90 90 90 90 90 90 FEC8 90 90

Segment 3/4

Offsets

RPG2003
1.0.8.0
1.0.8.0
0049C4B2h
0009B8B2h

Sourcecode

			NOP
			MOV EAX, [004CDDC8h]
			MOV EAX, [EAX]
			CALL PROC__004B4870h

Bytes

90 A1C8DD4C00 8B00 E8B1830100

Segment 4/4

Offsets

RPG2003
1.0.8.0
1.0.8.0
0049C4D3h
0009B8D3h

Sourcecode

			MOV [EDI+350h], EAX
			MOV EAX, [EDI+294h]
			CMP EAX, [EDI+350h]
			JGE __004BB0F5h
			JMP __004BB0B0h
			MOV EAX, [004CDB74h]
			MOV EAX, [EAX]
			PUSH EAX
			XOR EDX, EDX
			PUSH EDX
__0049C4FBh:
			POP EDX
			POP EAX
			PUSH EAX
			PUSH EDX
			CALL PROC__004A6014h
			MOV ECX, [EAX+04h]
			CMP ECX, [ESI+04h]
			JNE __0049C50Fh
			POP EAX
			POP ECX
			RET
__0049C50Fh:
			POP EDX
			INC EDX
			PUSH EDX
			CMP EDX, 4
			JNE __0049C4FBh
			POP EDX
			POP EAX
			XOR EAX, EAX
			RET

Bytes

898750030000 8B8794020000 3B8750030000 0F8D0AEC0100
E9C0EB0100
A174DB4C00 8B00 50 31D2 52 5A 58 50 52 E8109B0000
8B4804 3B4E04 7503
58 5A C3

5A 42 52 83FA04 75E4
5A 58 31C0 C3