Information regarding details about the battle engine in E:SoR. I put this in a code box to preserve the fixed-width spacing. Best viewed with a column width of (at least) 86. Tell me what you think.
Code: E:SoR Battle Engine Details: Sorta Pseudocode
Fight Command
(some) variables assumed at start of routine:
%ATKFlag = Status flag indicating increased attack. Result of EMPOWERMENT
%DEFFlag = Status flag indicating increased defense. Result of EARTHEN WALL
%EVAFlag = Status flag indicating increased evade. Result of SHADOW CONJURY
%MULTIHIT = Indexs a value on the table. Increment after every thing
01. Set modifier flags, status inflict flags, all temp variables to zero.
02. If user is in QUICKENED state, Goto ---User Quickened---
03. Calculate rate for critical hit.
If rand(1,32-((4*EMPOWEREDSTRIKE)+(8*CRITICAL-UP)))
04. %ISCRITICAL = 1
05. Check attack multiplier of character by pooling proficiencies and
occurances of {SWIFT ATTACK} in equipment. Must not exceed 3. Monster
skills can change this if it is being passed through the fight portion.
06. Set %LOOPCOUNT to the multiplier found.
06. ---Loop Start---
07. Collect user hit rate from equipment. Stash to %HITRATE
08. If user is blinded...
09. If have [BLIND FIGHTING], %HITRATE = %HITRATE / 4
10. Else %HITRATE = %HITRATE / 2
11. Modify %HITRATE with multihit penalty.
%HITRATE = %HITRATE * MHITEVATAB[%MULTIHIT]
12. Collect opponent evade from equipment. Statsh to %EVADE
13. Add modified collected AGL to evade. %EVADE = %EVADE + (AGL / 8)
14. If opponent is blinded, reduce evade. %EVADE = %EVADE * 0.33
15. Credit evade plus. %HITRATE = %HITRATE + %EVAFlag(rand(2-8))
16. Combine the values in a simple manner. %ISHIT = %HITRATE - %EVADE
17. If %ISHIT < 10, then %ISHIT = 10
18. If %ISHIT > 90, then %ISHIT = 90
19. If rand(0,100) < %ISHIT
20. Goto ---Loop Skip---. Do not credit damage. Do not pass GO. :P
21. Collect damage values from equipment. Set to %DAMAGE
This value is automatically readjusted if user is dual-wielding.
22. Increase %DAMAGE with racial attack bonus (flag in wpn vs enemytype?)
23. Factor in magical boost. %DAMAGE = %DAMAGE + ( rand(12,24) * %ATKFlag )
%DAMAGE = %DAMAGE + some known value based on race
23. %DAMAGE = %DAMAGE * (100 - oppDmgRedux)
24. If %DAMAGE < 1, %DAMAGE = 1
25. If TARGET is using PARRY and it is SUCCESSFUL
26. %DAMAGE = %DAMAGE * %PARRYTABLEDAMAGEREDUCTION[EQUIPINDEX]
27. Adjust damage for multihit penatly.
%DAMAGE = %DAMAGE * MHITDMGTAB[%MULTIHIT]
28. If not(%ISCRITICAL)
29. If enemy is immune to equipped weapon, %DAMAGE = 1
30. If (prof req > your prof) and is equipped w/wpns, %DAMAGE = %DAMAGE * 0.20
31. If your attack has an elemental property
32. If enemy is weak to it, %DAMAGE = %DAMAGE + ( %DAMAGE * 0.40 )
33. If enemy is strong to it and user does not have skl [ELEMENTAL MIGHT]
34. %DAMAGE = %DAMAGE * 0.20
35. Collect defense values from opponent. %DEFENSE = EnemyABSORB
36. Factor in magical boost. %DEFENSE = %DEFENSE + ( rand(8,12) * %DEFFlag )
37. If %ISCRITICAL, %DEFENSE = %DEFENSE - 24
38. If %DEFENSE < 0, %DEFENSE = 0
39. If user has the skill CLEAVING ATTACK and rand(1,12)=1
40. %DEFENSE = 0
41. Calculate damage dealt. This is simple. %DAMAGE = %DAMAGE - %DEFENSE
42. If %DAMAGE < 1, %DAMAGE = 1
43. Add this into the big pool of... %TOTALDAMAGE = %TOTALDAMAGE + %DAMAGE
44. %STATUSTRY = (UserStatusAttack xor OppStatusDefense) and UserStatusAttack
Operators above are bitwise operators. Didn't use symbols coz I dunno xor
45. Run tests on each flag to determine what'll stick. Affect %STATUSTRY for
what status effects affects the final status.
46. %STATUSINFLICT = %STATUSTRY | %STATUSINFLICT
47. Increment %MULTIHIT, decrement %LOOPCOUNT
48. Goto ---Loop Start--- while %LOOPCOUNT is greater than zero.
49.---Loop Skip---
50. If %TOTALDAMAGE = 0 and %STATUSINFLICT = 0, RETURN
Nothing happened this round. Why not exit early?
51. Adjust target HP with damage inflicted against it.
If it would drop below zero, set to zero.
52. Bitwise OR statusinflict flags with target status flags
53. If target is equipped with armor ETERNAL SOUL, reset CURSE flag.
54. If target CURSE flag is set, set HP to zero.
55. If target HP = 0
56. If target DIVINE FAVOUR activates, set HP to 1
57. If target posesses ANGEL TEAR, use item and set HP to 1
58. If target HP is still zero, display "<target> was felled." string
59. End turn.
60.---User Quickened---
61. Collect damage values from equipment
62. Save this value to %TOTALDAMAGE
63. If user posesses [VERGE OF DARKNESS], set BLIND flag in %STATUSINFLICT
64. Goto ---Loop Skip---
65. So much was skipped in a quickening that this is really necessary. Yeah :)