Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions backend/cmd/preview/dist/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>gcsim - simulation impact</title>
<script type="module" crossorigin src="/assets/index-DqCItxjY.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BA-GS8OZ.css">
</head>
<body style="scrollbar-gutter: stable" class="bp4-dark">
<div id="root"></div>
</body>
</html>
Expand Down
32 changes: 19 additions & 13 deletions pkg/agg/failures/failures.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ type buffer struct {
}

type charFailures struct {
energy *calc.StreamStats
stamina *calc.StreamStats
swap *calc.StreamStats
skill *calc.StreamStats
dash *calc.StreamStats
burstcd *calc.StreamStats
energy *calc.StreamStats
stamina *calc.StreamStats
swap *calc.StreamStats
skill *calc.StreamStats
dash *calc.StreamStats
burstcd *calc.StreamStats
timeManip *calc.StreamStats // Not an actual failure. Will probably only be a warning.
}

func NewAgg(cfg *info.ActionList) (agg.Aggregator, error) {
Expand All @@ -36,12 +37,13 @@ func NewAgg(cfg *info.ActionList) (agg.Aggregator, error) {

for i := 0; i < len(cfg.Characters); i++ {
out.failures[i] = charFailures{
energy: &calc.StreamStats{},
stamina: &calc.StreamStats{},
swap: &calc.StreamStats{},
skill: &calc.StreamStats{},
dash: &calc.StreamStats{},
burstcd: &calc.StreamStats{},
energy: &calc.StreamStats{},
stamina: &calc.StreamStats{},
swap: &calc.StreamStats{},
skill: &calc.StreamStats{},
dash: &calc.StreamStats{},
burstcd: &calc.StreamStats{},
timeManip: &calc.StreamStats{},
}
}

Expand All @@ -50,7 +52,7 @@ func NewAgg(cfg *info.ActionList) (agg.Aggregator, error) {

func (b *buffer) Add(result stats.Result) {
for i := range result.Characters {
var energy, stamina, swap, skill, dash, burstcd float64
var energy, stamina, swap, skill, dash, burstcd, timeManip float64

for _, fail := range result.Characters[i].FailedActions {
switch fail.Reason {
Expand All @@ -66,6 +68,8 @@ func (b *buffer) Add(result stats.Result) {
dash += float64(fail.End-fail.Start) / 60
case action.BurstCD.String():
burstcd += float64(fail.End-fail.Start) / 60
case action.TimeManip.String():
timeManip += float64(fail.End-fail.Start) / 60
}
}

Expand All @@ -75,6 +79,7 @@ func (b *buffer) Add(result stats.Result) {
b.failures[i].skill.Add(skill)
b.failures[i].dash.Add(dash)
b.failures[i].burstcd.Add(burstcd)
b.failures[i].timeManip.Add(timeManip)
}
}

Expand All @@ -88,6 +93,7 @@ func (b *buffer) Flush(result *model.SimulationStatistics) {
SkillCd: agg.ToDescriptiveStats(c.skill),
DashCd: agg.ToDescriptiveStats(c.dash),
BurstCd: agg.ToDescriptiveStats(c.burstcd),
TimeManip: agg.ToDescriptiveStats(c.timeManip),
}
}
}
34 changes: 20 additions & 14 deletions pkg/agg/warnings/warnings.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,31 @@ func init() {
}

type buffer struct {
overlap bool
energy calc.StreamStats
stamina calc.StreamStats
swap calc.StreamStats
skill calc.StreamStats
dash calc.StreamStats
burstcd calc.StreamStats
overlap bool
energy calc.StreamStats
stamina calc.StreamStats
swap calc.StreamStats
skill calc.StreamStats
dash calc.StreamStats
burstcd calc.StreamStats
timeManip calc.StreamStats
}

func NewAgg(cfg *info.ActionList) (agg.Aggregator, error) {
out := buffer{
energy: calc.StreamStats{},
stamina: calc.StreamStats{},
swap: calc.StreamStats{},
skill: calc.StreamStats{},
dash: calc.StreamStats{},
burstcd: calc.StreamStats{},
energy: calc.StreamStats{},
stamina: calc.StreamStats{},
swap: calc.StreamStats{},
skill: calc.StreamStats{},
dash: calc.StreamStats{},
burstcd: calc.StreamStats{},
timeManip: calc.StreamStats{},
}
return &out, nil
}

func (b *buffer) Add(result stats.Result) {
var energy, stamina, swap, skill, dash, burstcd float64
var energy, stamina, swap, skill, dash, burstcd, timeManip float64

for i := range result.Characters {
for _, fail := range result.Characters[i].FailedActions {
Expand All @@ -56,6 +58,8 @@ func (b *buffer) Add(result stats.Result) {
dash += float64(fail.End-fail.Start) / 60
case action.BurstCD.String():
burstcd += float64(fail.End-fail.Start) / 60
case action.TimeManip.String():
timeManip += float64(fail.End-fail.Start) / 60
}
}
}
Expand All @@ -66,6 +70,7 @@ func (b *buffer) Add(result stats.Result) {
b.skill.Add(skill)
b.dash.Add(dash)
b.burstcd.Add(burstcd)
b.timeManip.Add(timeManip)
b.overlap = b.overlap || result.TargetOverlap
}

Expand All @@ -78,5 +83,6 @@ func (b *buffer) Flush(result *model.SimulationStatistics) {
SkillCd: b.skill.Mean() >= 1.0,
DashCd: b.dash.Mean() >= 1.0,
BurstCd: b.burstcd.Mean() >= 1.0,
TimeManip: b.timeManip.Mean() > 0.0, // If any time manipulation occurs, display
}
}
2 changes: 2 additions & 0 deletions pkg/core/action/failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
InsufficientStamina
CharacterDeceased // TODO: need chars to die first
DashCD
TimeManip
)

var failureString = [...]string{
Expand All @@ -28,6 +29,7 @@ var failureString = [...]string{
"insufficient_stamina",
"character_deceased",
"dash_cd",
"time_manip",
}

func (e Failure) String() string {
Expand Down
1 change: 1 addition & 0 deletions pkg/core/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const (
OnEnemyAdded // t
OnTick
OnSimEndedSuccessfully // nil
OnTimeManip // Booking event occurred. Param: FramesBooked int
EndEventTypes // elim
)

Expand Down
44 changes: 44 additions & 0 deletions pkg/core/player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,52 @@ func New(opt Opt) *Handler {
return h
}

// Used to simulate booking to reduce the CD between allowable Character Swap occurences without increasing the battle timer
// Because gcsim only has global frames, reduce the swap CD rather than increase the cursed timer
// Param delay: Number of frames to reduce the gcd
// Changing the ICD will effect all future and swap cooldowns, but will not affect the current CD
// "overbooking" will have no adverse effects; the CD will be capped at 1.
// Swap ICD cannot be 0 to prevent a swap from occuring on the same frame the booking occurs.
func (h *Handler) SetSwapICD(delay int) {
prevICD := h.SwapICD

h.SwapICD = delay
if h.SwapICD < 1 {
h.SwapICD = 1
}

postICD := h.SwapICD
log := h.Log.NewEventBuildMsg(glog.LogCooldownEvent, h.active, "New time manipulation event: Default Swap ICD Changed")
log.Write("Old", prevICD).Write("New", postICD)

// It's possible to increase swap ICD if desired, so take abs.
// In practice this won't be used.
f := 60 - delay // This is innacurate since it only emits once instead of every swap. Wontfix, too performance-intensive
if f < 0 {
f = -1 * f
}
h.Events.Emit(event.OnTimeManip, f)
}

// Used to simulate booking to reduce the CD between allowable Character Swap occurences without increasing the battle timer
// Because gcsim only has global frames, reduce the swap CD rather than increase the cursed timer
// Param f: Number of frames to reduce the ccd
// Booking will only have an effect if a swap has already occurred, and will reduce the timer for the next swap instance only.
// Future instances of swapping will still have the default cd- 60f if unchanged by SetSwapICD.
// "overbooking" will have no adverse effects; SwapCD will not be reduced below 0.
func (h *Handler) ReduceSwapCD(f int) {
h.Events.Emit(event.OnTimeManip, f)

prevCD := h.SwapCD

h.SwapCD -= f
if h.SwapCD < 0 {
h.SwapCD = 0
}

postCD := h.SwapCD
log := h.Log.NewEventBuildMsg(glog.LogCooldownEvent, h.active, "New time manipulation event: Swap CD Reduced")
log.Write("Old", prevCD).Write("New", postCD)
}

func (h *Handler) swap(to keys.Char) func() {
Expand Down
Loading