Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for wfrp4e #113

Closed
StevenEvans1966 opened this issue Jun 30, 2024 · 3 comments
Closed

Add Support for wfrp4e #113

StevenEvans1966 opened this issue Jun 30, 2024 · 3 comments

Comments

@StevenEvans1966
Copy link

Looking at the API the code only supports movement multipliers from a base value. wfrp4e uses two variables

  • actor.system.details.move.walk
  • actor.system.details.move.run

run is >= walk
here is some code I Wrote for Drag Ruler if that helps

class WFRPSpeedProvider extends SpeedProvider {
			get colors() {
				return [
					{ id: "walk", default: 0x00ff00, name: "walk" },
					{ id: "run", default: 0xffff00, name: "run" },
				];
			}

			getRanges(token) {
				const walkSpeedAttribute = this.getSetting("walkSpeedAttribute");

				if (!walkSpeedAttribute) return [];

				const tokenWalkSpeed = parseFloat(getProperty(token, walkSpeedAttribute));

				if (tokenWalkSpeed === undefined) {
					console.warn(`Drag Ruler (WFRPSpeedProvider) | The configured token speed attribute "${walkSpeedAttribute}" didn't return a speed value. To use colors based on drag distance set the setting to the correct value (or clear the box to disable this feature).`,);
					return [];
				}

				const runSpeedAttribute = this.getSetting("runSpeedAttribute");

				if (!runSpeedAttribute)
					return [{ range: tokenWalkSpeed, color: "walk" }];

				const tokenRunSpeed = parseFloat(getProperty(token, runSpeedAttribute));

				return [
					{ range: tokenWalkSpeed, color: "walk" },
					{ range: tokenRunSpeed, color: "run" },
				];
			}

			get settings() {
				return [
					{
						id: "walkSpeedAttribute",
						name: "walk",
						hint: "Walk Speed",
						scope: "world",
						config: true,
						type: String,
						default: "actor.system.details.move.walk",
					},
					{
						id: "runSpeedAttribute",
						name: "run",
						hint: "Run Speed",
						scope: "world",
						config: true,
						type: String,
						default: "actor.system.details.move.run",
					},
				];
			}
		}

		dragRuler.registerSystem("wfrp4e", WFRPSpeedProvider)
	}
@caewok
Copy link
Owner

caewok commented Jun 30, 2024

Elevation Ruler already uses the default walk for wfrp4e, and then doubles it for "dash", which looks equivalent to run? Is that incorrect? Perhaps the run is not always simply double walk? If you can point me to the rules for walk/run, I could probably figure it out. But right now, I don't quite understand what is missing from ER's version.

@StevenEvans1966
Copy link
Author

wfrp4e has Talents which modify walk and run separately from a Movement Attribute value. simple run = walk * 2 approach will not work. The core system handles calculating the 2 system.details.move values (system.details.move.walk & system.details.move.run)

just to give you an hint at complexity
base rules are theses
Walk = Movement Attribute * 2
Run= Movement Attribute * 4

but the Talent Sprinter gives
Walk = Movement Attribute * 2
Run= (Movement Attribute +1) * 4

I have a player with an item that gives an additional multiplier on run of *2.
Walk = Movement Attribute * 2
Run= Movement Attribute * 8

encumbrance also effects movement by giving -1 or -2 to Movement Attribute or a multiplier of 0.

As you see wfrp4e requires the ruler to get values from system calculated variables.

caewok added a commit that referenced this issue Jul 3, 2024
Use the system property instead of multiplying by 2.
Issue #113.
@caewok
Copy link
Owner

caewok commented Jul 3, 2024

Added in v0.9.7.

@caewok caewok closed this as completed Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants