Vaguer potions info for Dyeworks in Item Getting Guide
This commit is contained in:
parent
97abd6e438
commit
2e3d5d2020
2 changed files with 16 additions and 49 deletions
|
@ -194,50 +194,18 @@ module ItemsHelper
|
|||
end
|
||||
|
||||
def dyeworks_nc_total_for(items)
|
||||
dyeworks_items_nc_total_for(items) + dyeworks_potions_nc_total(items.size)
|
||||
end
|
||||
|
||||
def dyeworks_items_nc_total_for(items)
|
||||
nc_total_for items.map(&:dyeworks_base_item)
|
||||
end
|
||||
|
||||
def dyeworks_potions_nc_total(num_items)
|
||||
dyeworks_potions_nc_breakdown(num_items)[:nc_total]
|
||||
def dyeworks_average_num_potions_for(items)
|
||||
# Compute the number of expected potions for each (inverse of the odds),
|
||||
# sum them, then round up.
|
||||
items.map { |i| 1 / i.dyeworks_odds }.sum.ceil
|
||||
end
|
||||
|
||||
def dyeworks_potions_nc_summary(num_items)
|
||||
dyeworks_potions_nc_breakdown(num_items)[:summary]
|
||||
end
|
||||
|
||||
def dyeworks_potions_nc_breakdown(num_items)
|
||||
nc_total = 0
|
||||
summaries = []
|
||||
|
||||
# For every 10 potions, buy a 10-Bundle for 900 NC.
|
||||
while num_items >= 10
|
||||
nc_total += 900
|
||||
summaries << "10-Bundle (900 NC)"
|
||||
num_items -= 10
|
||||
end
|
||||
|
||||
# For every remaining 5 potions, buy a 5-Bundle for 500 NC.
|
||||
while num_items >= 5
|
||||
nc_total += 500
|
||||
summaries << "5-Bundle (500 NC)"
|
||||
num_items -= 5
|
||||
end
|
||||
|
||||
# For every remaining potion, buy each directly for 125 NC.
|
||||
if num_items >= 1
|
||||
nc_total += num_items * 125
|
||||
summaries << "#{pluralize num_items, "potion"} (#{num_items * 125} NC)"
|
||||
num_items = 0
|
||||
end
|
||||
|
||||
summaries << "0 NC" if summaries.empty?
|
||||
summary = summaries.join(", ")
|
||||
|
||||
{nc_total:, summary:}
|
||||
def dyeworks_estimated_potions_cost_for(items)
|
||||
# NOTE: You could do bundles too, but let's just keep it simple.
|
||||
dyeworks_average_num_potions_for(items) * 125
|
||||
end
|
||||
|
||||
def probability(p)
|
||||
|
|
|
@ -49,16 +49,15 @@
|
|||
alt: "Dyeworks Hue Brew Potion"
|
||||
%th
|
||||
Total: #{dyeworks_nc_total_for @items_needed[:dyeworks]} NC
|
||||
= surround "(", ")" do
|
||||
%span.price-breakdown{
|
||||
title: "#{dyeworks_items_nc_total_for(@items_needed[:dyeworks])} NC"
|
||||
}<
|
||||
#{pluralize @items_needed[:dyeworks].size, "item"}
|
||||
+
|
||||
%span.price-breakdown{
|
||||
title: dyeworks_potions_nc_summary(@items_needed[:dyeworks].size)
|
||||
}<
|
||||
#{pluralize @items_needed[:dyeworks].size, "potion"}
|
||||
title: "At least #{pluralize @items_needed[:dyeworks].size, 'potion'}, " +
|
||||
"average " +
|
||||
"#{dyeworks_average_num_potions_for @items_needed[:dyeworks]}, " +
|
||||
"could be more"
|
||||
}
|
||||
?? potions
|
||||
(~#{dyeworks_estimated_potions_cost_for @items_needed[:dyeworks]} NC)
|
||||
%td.actions-cell
|
||||
- if @items_needed[:dyeworks].present?
|
||||
%button{onclick: "alert('Todo!')"}
|
||||
|
|
Loading…
Reference in a new issue