phylll / mychs-macro-magic

A simple, sane, and friendly little scripting language for your Roll20 macros.
MIT License
0 stars 0 forks source link

Handle combat effects of surprise attacks that don't allow for a full defense #46

Closed phylll closed 2 years ago

phylll commented 2 years ago

Surprised targets of attacks do not get to defend, but still suffer -- potentially lethal -- effects that need to be recorded properly. The defense script or a version of it should be able to handle this edge case.

phylll commented 2 years ago

Quick review of defense code says this should be doable by injecting a bunch of conditional blocks that executes the actual defense logic only if the noDefense flag (whatever it will be called) is not present.

Research question: How about health <= 3, aren't those tokens equally defenseless? Are we handling this case properly so far? -- No, we have not. According to Kodex:64, less than 4 health points means that someone is incapacitated and doesn't get a defense at all.

So, when does the target of an attack not get a defense roll?

In those cases, the player should not even need to enter various pointless modifiers for a roll that is not being made. Since we cannot build logical forks between scripts (because Roll20 doesn't evaluate user input in scripts dynamically called through !mmm chat: %{char|ability}), the way to do this is to pull the defensibility determination back into all kinds of attack scripts. To cover all use cases, that means:

  1. Any attack script can determine the target's health or endurance being at defenseless levels (a new game-public function would be useful here);
  2. meleeAttack already has the player select a modifier if they attack an otherwise defenseless target;
  3. rangedAttack doesn't but could add such a modifier easily;
  4. our magic script doesn't, either, but it could;
  5. and finally, we could build a very simple wrapper to call in any other weird case of defenselessness.

So, these four attack scripts (no. 2 through 5, above) would check for health/endurance and the player's manual determinations and as a result either call the main defense script directly (if no further input is necessary because there won't be a real defense), or a customize wrapper to collect defense modifiers and then call the main defense script to do its thing.

Or, we simply offer players a "defenseless" option for every call, and that's it.

phylll commented 2 years ago

Closed via https://github.com/michael-buschbeck/mychs-macro-magic/pull/188