Repository navigation
Combined all of the basic stats modifier #3621
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
b217fd6
fe88d23
bba651a
0907c9b
cd6cb17
6661fea
7f5bf66
565e3c2
1d4f3ee
bb44a4c
ce89c93
3dee6fb
c0c9b4e
85cb92d
0a87c7a
7e037b5
1a12312
97155bf
bf8f638
a52aad2
34667ae
dcfb4e3
83ca9dc
db4be3c
e7ec715
c28f6b2
3a325e9
f9f6880
1b09c2b
2df1886
a563df0
f856b85
75bd7ce
1444196
f6b5eed
d29fe32
905f9c4
e2423c0
2e90d3f
c204714
8b7df7e
aaf1624
d6a9bcf
ea822e9
42946ea
2fe83cb
4570179
47b2951
3f95f17
de24822
0942848
84cc01b
76c17e9
2e1bf8c
b33fba3
a56efec
19f34f8
ae67bc0
edd67bf
ff552e6
072ec05
3f2f1da
9d98ce2
c135181
8c59731
64dc03d
e7018f7
8d4376c
99dd254
96f40bb
719ad24
71d33c3
be4b814
3b7db74
f5869e5
b4de959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,4 @@ | ||
| pub const bad_at = @import("bad_at.zig"); | ||
| pub const durable = @import("durable.zig"); | ||
| pub const fragile = @import("fragile.zig"); | ||
| pub const good_at = @import("good_at.zig"); | ||
| pub const heavy = @import("heavy.zig"); | ||
| pub const light = @import("light.zig"); | ||
| pub const powerful = @import("powerful.zig"); | ||
| pub const single_use = @import("single_use.zig"); | ||
| pub const weak = @import("weak.zig"); | ||
| pub const base_stat = @import("base_stat.zig"); | ||
|
IntegratedQuantum marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| const std = @import("std"); | ||
|
|
||
| const main = @import("main"); | ||
| const ProceduralItem = main.items.ProceduralItem; | ||
|
|
||
| pub const Data = packed struct(u128) { strength: f32, targetProperty: main.items.ProceduralItemProperty, pad: u88 = undefined }; | ||
|
|
||
| pub const priority = 1; | ||
|
|
||
| fn getModifierName(data: Data) []const u8 { | ||
| if (data.strength >= 0) { | ||
| switch (data.targetProperty) { | ||
| .damage => return "#f84a00**Powerful**", | ||
| .maxDurability => return "#500090**Durable**", | ||
| .swingSpeed => return "#9fffde**Light**", | ||
| } | ||
| } else { | ||
| switch (data.targetProperty) { | ||
| .damage => return "#fcb5e3**Weak**", | ||
| .maxDurability => return "#ccddff**Fragile**", | ||
| .swingSpeed => return "#ffcc30**Heavy**", | ||
| } | ||
| } | ||
| } | ||
|
|
||
| pub fn loadData(zon: main.ZonElement) Data { | ||
| return .{ | ||
| .strength = zon.get(f32, "strength") orelse 0, | ||
| .targetProperty = main.items.ProceduralItemProperty.fromString(zon.get([]const u8, "targetProperty") orelse "missing .targetProperty field") orelse blk: { | ||
| std.log.err("replacing with .damage", .{}); | ||
|
IntegratedQuantum marked this conversation as resolved.
Outdated
|
||
| break :blk .damage; | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| pub fn combineModifiers(data1: Data, data2: Data) ?Data { | ||
| if (data1.targetProperty != data2.targetProperty) return null; | ||
| return .{ | ||
| .strength = std.math.hypot(data1.strength, data2.strength), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://www.desmos.com/calculator i have chosen this function for that because
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and it follows the old scaling on the positive numbers
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok it is swapped now
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you change the function, please explain (in the code) how you derived it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be best to just preserve status quo behavior.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops forgot to save the graph to be able to be shared
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also i wrote the function wrong the first time
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it does preserve the status quo (matching the old scaling exactly) for
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't see that. Please try to understand the old code before making these claims. The old code ensured that the negative value was never below 100% |
||
| .targetProperty = data1.targetProperty, | ||
| }; | ||
| } | ||
|
|
||
| pub fn changeProceduralItemParameters(proceduralItem: *ProceduralItem, data: Data) void { | ||
| proceduralItem.setProperty(data.targetProperty, proceduralItem.getProperty(data.targetProperty)*(1 + data.strength)); | ||
| } | ||
|
|
||
| pub fn printTooltip(outString: *main.ListManaged(u8), data: Data) void { | ||
| if (data.strength >= 0) { | ||
| outString.print("{s} #808080(#30ca64+**{d:.0}% #808080{})", .{getModifierName(data), data.strength*100, data.targetProperty}); | ||
| } else { | ||
| outString.print("{s} #808080(#fd3535**{d:.0}% #808080{})", .{getModifierName(data), data.strength*100, data.targetProperty}); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think we should use the Also in my opinion the parenthesis are also kind of pointless. The different colors already provide enough seperation.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think the parethisis just look nice |
||
| } | ||
| } | ||
This file was deleted.

Uh oh!
There was an error while loading. Please reload this page.