Skip to content

Commit

Permalink
Added damage modifier stats in radial graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitcheljager committed Oct 6, 2019
1 parent 85c2aa1 commit b07bbb7
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 8 deletions.
6 changes: 6 additions & 0 deletions app/assets/javascripts/modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function setModifier(event) {

targetElements.forEach((targetElement) => {
const dataTarget = targetElement.dataset.target

console.log(targetElement)

const targetValue = parseFloat(currentItemData[dataTarget])
const attachmentValue = parseFloat(targets[target])

Expand All @@ -30,6 +33,9 @@ function setModifier(event) {
return
}

console.log(targetElement)
console.log(targetValue)

const alreadyActiveModifier = targetElement.querySelector(".item__small-info-modify-value")
if (alreadyActiveModifier) alreadyActiveModifier.remove()

Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/elements/_attachments_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
filter: brightness(20%);
}
}

span:first-child {
font-weight: bold;
}
}

.attachments-table__dropdown {
Expand Down
12 changes: 12 additions & 0 deletions app/assets/stylesheets/elements/_circle-graph.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,22 @@
z-index: 2;

h4 {
position: relative;
display: block;
margin: 0 0 -.25em;
text-align: center;
font-weight: 700;
font-family: "Teko", sans-serif;
color: var(--title-color);

.modify-element {
position: absolute;
font-size: 18px;
line-height: 1em;
left: 0;
top: 50%;
transform: translateY(-50%) translateX(-100%);
}
}

[class^="compare-"] {
Expand Down
4 changes: 3 additions & 1 deletion app/views/pages/item_columns/_attachments_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
<% end %>
<% end %>

<%= attachment["name"].downcase.gsub(" ", "_").gsub("'", "") %>

<a class="attachments-table__dropdown-item"
data-action="set-modifier"
data-modify-rarity="<%= rarity %>"
data-to-modify="<%= attachment[rarity].without("description").to_json %>">
data-to-modify="<%= to_modify = attachment[rarity].without("description").to_json %>">
<%= image_tag "attachments/#{ attachment["name"].downcase.gsub(" ", "_").gsub("'", "") }.png", alt: attachment["name"].humanize %>

<div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/item_columns/_radial_graph.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="circle-graph" data-role="circle-graph" data-target="<%= target %>">
<div class="circle-graph__label">
<%= label %>
<h4 data-role="circle-graph-value" data-compare-circle="<%= target %>"></h4>
<h4 data-role="circle-graph-value" data-compare-circle="<%= target %>" data-modify-target="<%= modify_target %>" data-target="<%= target %>"></h4>
<% if defined?(damage_modifier) %>
<div class="circle-graph__extra-modifier" data-role="damage-modifier"></div>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/pages/item_columns/_weapons.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
</div>

<div class="item-columns__radial-graphs">
<%= render "pages/item_columns/radial_graph", target: "damage", label: "DMG", max: get_max_value(items, "damage"), damage_modifier: true, extra_damage: true %>
<%= render "pages/item_columns/radial_graph", target: "rate_of_fire", label: "RPM", max: get_max_value(items, "rate_of_fire") %>
<%= render "pages/item_columns/radial_graph", target: "damage", label: "DMG", max: get_max_value(items, "damage"), modify_target: "damage_modifier", damage_modifier: true, extra_damage: true %>
<%= render "pages/item_columns/radial_graph", target: "rate_of_fire", label: "RPM", max: get_max_value(items, "rate_of_fire"), modify_target: "rate_of_fire" %>
</div>

<%= render "pages/item_columns/bar_graph", target: "damage_per_second", label: "Damage per second", max: get_max_value(items, "damage_per_second") %>
Expand Down
6 changes: 6 additions & 0 deletions config/content/assault_rifles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
ammo_increase: 40%
epic:
ammo_increase: 50%
anvil_receiver:
legendary:
damage_modifier: 126.3%
fire_modes:
single: true
auto: true
Expand Down Expand Up @@ -165,6 +168,9 @@
ammo_increase: 40%
epic:
ammo_increase: 55%
anvil_receiver:
legendary:
damage_modifier: 150%
fire_modes:
single: true
auto: true
Expand Down
5 changes: 3 additions & 2 deletions config/content/pistols.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
- 2x_hcog_bruiser
- 1x-2x_variable_holo
- 1x_digital_threat
hop_up:
- disruptor_rounds
attachments_overwrite:
extended_light_mag:
basic:
Expand Down Expand Up @@ -103,6 +101,9 @@
ammo_increase: 50%
epic:
ammo_increase: 80%
hammerpoint_rounds:
epic:
damage_modifier: 161.5%
fire_modes:
single: true
-
Expand Down
4 changes: 4 additions & 0 deletions config/content/shotguns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
- hammerpoint_rounds
stock:
- shotgun_bolt
attachments_overwrite:
hammerpoint_rounds:
epic:
damage_modifier: 53.32%
fire_modes:
auto: true
spray_pattern:
Expand Down
2 changes: 0 additions & 2 deletions config/content/sub_machine_guns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
- 2x_hcog_bruiser
- 1x-2x_variable_holo
- 1x_digital_threat
hop_up:
- disruptor_rounds
stock:
- standard_stock
attachments_overwrite:
Expand Down

0 comments on commit b07bbb7

Please sign in to comment.