Skip to content

Commit 5d80f0c

Browse files
committed
Adjust resource collection rates and graphs for LotV game speed.
1 parent 2ed5b95 commit 5d80f0c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

app/assets/javascripts/angular/resources/match.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,11 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
622622
is_team: false
623623
}
624624

625+
speed_multiplier = 1
626+
if (this.expansion_tag == 'LotV') {
627+
speed_multiplier = Sc2.LOTV_SPEEDUP
628+
}
629+
625630
// Income and army graphs from summary
626631
// Graph data is already prepared currently, so we just have to add it
627632
if(entity.summary) {
@@ -633,11 +638,16 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
633638
if (entity.summary.upgradespendinggraph) {
634639
this._series.summary_upgradespending.entities[_entity] = $.extend({data: entity.summary.upgradespendinggraph}, base_series);
635640
}
641+
642+
entity.summary.resource_collection_rate_adjusted = Math.round(entity.summary.resource_collection_rate*speed_multiplier)
636643
}
637644

638-
if(this.MineralsCurrent) {
639-
this._series.replayincome.entities[_entity] = $.extend({data: statx(this.MineralsCollectionRate[entity.identity.id])}, base_series);
640-
this._series.replaygasincome.entities[_entity] = $.extend({data: statx(this.VespeneCollectionRate[entity.identity.id])}, base_series);
645+
if(this.MineralsCurrent && this.MineralsCurrent[entity.identity.id]) {
646+
function getResourceCollectionRate(x) {
647+
return x*speed_multiplier
648+
}
649+
this._series.replayincome.entities[_entity] = $.extend({data: statx(this.MineralsCollectionRate[entity.identity.id].map(getResourceCollectionRate))}, base_series);
650+
this._series.replaygasincome.entities[_entity] = $.extend({data: statx(this.VespeneCollectionRate[entity.identity.id].map(getResourceCollectionRate))}, base_series);
641651
this._series.replaylost.entities[_entity] = $.extend({data: statx(this.Lost[entity.identity.id])}, base_series);
642652
this._series.replayminerals.entities[_entity] = $.extend({data: statx(this.MineralsCurrent[entity.identity.id])}, base_series);
643653
this._series.replaygas.entities[_entity] = $.extend({data: statx(this.VespeneCurrent[entity.identity.id])}, base_series);

app/views/matches/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
</td>
138138
<td ng-hide='match.entities[0].summary.workers_created == null'>{{ entity.summary.workers_created }}</td>
139139
<td>{{ entity.summary.structures_built }}</td>
140-
<td>{{ entity.summary.resource_collection_rate }}</td>
140+
<td>{{ entity.summary.resource_collection_rate_adjusted }}</td>
141141
<td>{{ entity.summary.average_unspent_resources }}</td>
142142
<td class="league"><a href class="ggtipper2" title="SQ: {{ entity.summary.spending_quotient.toFixed(0) }}"><league data-league="{{ entity.summary.spending_skill }}"></league></a></td>
143143
<td>{{ entity.summary.units_trained }}</td>

0 commit comments

Comments
 (0)