Easier Perfect Parry and Dodge - PBZPerfectDefense
Version 1.3.0 by SLEEP. Phantom Blade Zero on Steam. No other mods or tools needed.

What it does
Wider timing for perfect deflects, which most players call parries, and for both perfect dodges, or every guard and
dodge perfect. Deflect and dodge have their own setting, and either can be off. Works on every difficulty, Hellwalker
and 66 Days included. The game has two perfect dodges and this mod changes both:
- the perfect evade: a hit that touches your dodge early in the dash is evaded perfectly;
- the slow-motion perfect dodge: dodging a red (unblockable) attack at the right moment slows time and opens a counter.

Settings
Two settings, in PBZ\ProjectPBZ\Content\Paks\~mods\PBZPerfectDefense.txt. The mod creates that file the first time
you load a save. Change a value, save the file, and the game picks it up within 2 seconds, no restart. The settings
also appear in the optional Mods Menu, under SYSTEM in the game:
https://www.nexusmods.com/phantombladezero/mods/149
Each one takes Off, 1.5, 2, 3 or Always (1.5 is the default). Off keeps the game's own timing.
- Deflect=
  Perfect deflect, in frames at 30 a second (normal / while your stance is broken), stock -> x2:
     Wayfarer 10 / 14 -> 20 / 28, Pathbreaker 8 / 12 -> 16 / 24, Hellwalker 8 / 6 -> 16 / 12, 66 Days 6 / 6 -> 12 / 12.
  The window opens when you press guard, so a wider one catches presses that come early. On Pathbreaker or
  Hellwalker a press up to 0.27 s before the hit is perfect in the base game, 0.4 s at x1.5, 0.53 s at x2, 0.8 s at x3.
  A press after the hit lands gets no help at any size.
  Always: every hit you guard or deflect counts as a perfect deflect, even when holding guard. This uses the game's own
  developer switch for perfect deflects.
- Dodge=
  Perfect evade: the first 0.15 s of a dodge stock -> 0.225 s, 0.3 s or 0.45 s. A dodge is untouchable for 0.25 s
  anyway, so x1.5 changes nothing you can feel here, x2 adds 0.05 s and x3 adds 0.2 s.
  Slow-motion perfect dodge: the game only gives it when you press dodge in the short window before a red attack lands
  (0.3 to 0.5 s for most red attacks). With this mod a dodge you started up to 0.225 s, 0.3 s or 0.45 s before that
  window opens also turns into the slow-motion dodge, as long as the dodge is still running when the window opens.
  Always: your whole dodge stays in its perfect state, so any hit that touches it is a perfect evade, and any dodge
  still running when a red attack's window opens becomes the slow-motion perfect dodge.
Deflect=Off and Dodge=Off together switch the mod off without uninstalling it.

The base game's own rules still apply unless Deflect is Always:
- With your Sha-Chi bar empty, every deflect is a normal one.
- Mashing guard shrinks the window: a second press within 0.4 s gets under a third of it, a third press gets none.
- Holding guard does not keep the window open. Hits that land after it closes are not perfect.
Accessories that add perfect frames still add theirs on top: the game adds their 1, 1.5 or 2 frames after it reads the
window this mod widened. The slow-motion dodge only comes from red attacks; other attacks never offer it. For the
slow-motion dodge you must be on the ground, and attacks or enemies that never allow it (a shielded target, for one)
still do not. Holding dodge to sprint ends the dodge after 0.25 s, and its perfect state with it. Weapon skills with
their own guard timing, such as the Iron Gauntlets' Fist Guard, keep the game's timing. Nothing is written to your
save, and no game data file is replaced.

Install
1. Close the game.
2. Open the game folder, steamapps\common\PBZ. It holds the ProjectPBZ, Engine, platform and steam folders.
3. Vortex: install the download as usual. By hand: extract the zip into the game folder, so its ProjectPBZ folder
   merges with the game's. Either way the game needs these three files in PBZ\ProjectPBZ\Content\Paks\~mods\
   zzz_PBZPerfectDefense_P.pak
   zzz_PBZPerfectDefense_P.utoc
   zzz_PBZPerfectDefense_P.ucas
   The game ignores a .pak without its .utoc, so keep all three together.
4. Launch the game and load a save.

Updating from 1.2.0: install over the top. Your settings carry over: the first start on 1.3.0 adds Deflect= and Dodge=
lines to PBZPerfectDefense.txt with the values your Window= and AlwaysPerfect= stood for, and turns those two old lines
into comments. Window= and AlwaysPerfect= still work in a file that has no Deflect= or Dodge= line.
Updating from 1.1.1 or older: install over the top. The x1.5, x2, x3 and Always Perfect downloads are gone; pick yours
with the settings above. Later updates never touch PBZPerfectDefense.txt, so your settings stay.

Seems to do nothing?
- Check that the three files are in PBZ\ProjectPBZ\Content\Paks\~mods\ itself, or in a folder inside it.
- Folders named x1.5, x2, x3 or Always Perfect directly in PBZ mean an old install landed where the game never looks.
  Remove that install (in Vortex, or delete those folders by hand) and install this one as above.
- Check that Deflect= and Dodge= are not set to Off.
- x1.5 and x2 help guard presses that come early. If you press late or mash guard, try Deflect=3 or Deflect=Always.

Uninstall
1. Close the game.
2. Delete the three files above from PBZ\ProjectPBZ\Content\Paks\~mods\, or remove the mod in Vortex. You can delete
   PBZPerfectDefense.txt too.

Compatibility
The mod replaces one game script, WeaponAdvancdTextEntry.js, a small HUD script that colours a weapon stat effect. That
effect works the same; the mod's code rides along in that file. It conflicts with any other mod that replaces that file.
Data mods that change the deflect frames still load, and this mod multiplies their numbers. Mods that keep rewriting the deflect frames while you play (a live tuner) fight with this one: use one or the other.
If a game patch changes that script, the mod rolls the change back. After a game update, remove the mod until an update is posted.
