-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
485 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,67 @@ | ||
|
||
import {scalar, spline} from "@benev/toolbox" | ||
|
||
import {behavior, system} from "../hub.js" | ||
import {Intent} from "../components/plain_components.js" | ||
import {Inventory} from "../components/topics/warrior.js" | ||
import {ParryReport} from "../../models/activity/reports/parry.js" | ||
import {InventoryManager} from "../../models/armory/inventory-manager.js" | ||
import {ActivityComponent, Inventory} from "../components/topics/warrior.js" | ||
import {meleeReport} from "../../models/activity/reports/melee/melee-report.js" | ||
|
||
export const turncaps = system("turncaps", () => [ | ||
// behavior("turncaps slow down your aim during melee") | ||
// .select({Intent, Inventory}) | ||
// .logic(({seconds}) => ({components}) => { | ||
// const {meleeAction: action} = components | ||
// const inventory = new InventoryManager(components.inventory) | ||
|
||
// if (Melee.is.attack(action) || Melee.is.parry(action)) { | ||
// const {weapon} = inventory | ||
// const [x, y] = components.intent.glance | ||
|
||
// const turncap = ( | ||
// Melee.is.parry(action) ? weapon.parry.turncap | ||
// : Melee.is.swing(action) ? weapon.swing.turncap | ||
// : weapon.stab.turncap | ||
// ) | ||
|
||
// if (turncap !== null) { | ||
// const ease_in_and_out = scalar.bottom( | ||
// spline.linear(action.weights.progress, [ | ||
// [0.0, 10], | ||
// [0.1, 1], | ||
// [0.9, 1], | ||
// [1.0, 10], | ||
// ]) | ||
// ) | ||
// // console.log(ease_in_and_out.toFixed(2)) | ||
// const cap = (turncap * ease_in_and_out) * seconds | ||
// components.intent.glance = [ | ||
// scalar.clamp(x, -cap, cap), | ||
// scalar.clamp(y, -cap, cap), | ||
// ] | ||
// } | ||
// } | ||
// }), | ||
behavior("turncaps slow down your aim during melee") | ||
.select({Intent, Inventory, ActivityComponent}) | ||
.logic(({seconds}) => ({components}) => { | ||
const {activityComponent: activity} = components | ||
const inventory = new InventoryManager(components.inventory) | ||
|
||
if (!activity) | ||
return | ||
|
||
const isMelee = activity.kind === "melee" | ||
const isParry = activity.kind === "parry" | ||
|
||
if (!(isMelee || isParry)) | ||
return | ||
|
||
const {weapon} = inventory | ||
const [x, y] = components.intent.glance | ||
|
||
const {turncap, progress} = (() => { | ||
if (isParry) { | ||
const parry = new ParryReport(activity) | ||
return { | ||
progress: parry.progress, | ||
turncap: weapon.parry.turncap, | ||
} | ||
} | ||
else { | ||
const melee = meleeReport(activity) | ||
const {technique} = melee.logicalSnapshot.chart.maneuver | ||
return { | ||
progress: melee.logicalSnapshot.progress, | ||
turncap: technique === "swing" | ||
? weapon.swing.turncap | ||
: weapon.stab.turncap, | ||
} | ||
} | ||
})() | ||
|
||
if (turncap !== null) { | ||
const ease_in_and_out = scalar.bottom( | ||
spline.linear(progress, [ | ||
[0.0, 10], | ||
[0.1, 1], | ||
[0.9, 1], | ||
[1.0, 10], | ||
]) | ||
) | ||
const cap = (turncap * ease_in_and_out) * seconds | ||
components.intent.glance = [ | ||
scalar.clamp(x, -cap, cap), | ||
scalar.clamp(y, -cap, cap), | ||
] | ||
} | ||
}), | ||
]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
export const canComboFromSwing = true | ||
export const canComboToSwing = true | ||
|
||
export const canComboFromStab = false | ||
export const canComboToStab = false | ||
|
||
export const comboableReleaseThreshold = 1 / 2 | ||
export const minimumFeint = 0 | ||
export const maximumFeint = 1 | ||
|
Oops, something went wrong.