Thanks to visit codestin.com
Credit goes to github.com

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
6 changes: 6 additions & 0 deletions src/components/breedingModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@ <h5 class="card-header d-flex align-items-center py-2">
</div>
</td>
</tr>
<tr>
<td class="text-left text-nowrap">Total Efficiency:</td>
<td class="text-right">
<knockout data-bind="text: `${$data.totalEfficiency().toLocaleString('en-US')}%`, css: $data.totalEfficiencyColor(), attr: {title: `The total effectiveness is the result of both efficiency stats multiplied proportionally to manual breeding.`}">0%</knockout>
</td>
</tr>
<tr>
<td class="text-left align-middle">Sort:</td>
<td class="text-center align-middle">
Expand Down
23 changes: 22 additions & 1 deletion src/scripts/breeding/HatcheryHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class HatcheryHelper {
public hatchBonus: KnockoutObservable<number> = ko.observable(0).extend({ numeric: 1 });
public stepEfficiency: KnockoutObservable<number> = ko.observable(0).extend({ numeric: 1 });
public attackEfficiency: KnockoutObservable<number> = ko.observable(0).extend({ numeric: 1 });
public totalEfficiency: KnockoutComputed<number> = ko.computed(() => {
return (this.stepEfficiency() / 100) * (this.attackEfficiency() / 100) * 100;
});
public prevBonus: KnockoutObservable<number> = ko.observable(0).extend({ numeric: 0 });
public nextBonus: KnockoutObservable<number> = ko.observable(1).extend({ numeric: 0 });
public categories: KnockoutObservableArray<number> = ko.observableArray([]);
Expand All @@ -53,7 +56,8 @@ class HatcheryHelper {
Cost: <img src="assets/images/currency/${GameConstants.Currency[this.cost.currency]}.svg" width="20px">&nbsp;${(this.cost.amount).toLocaleString('en-US')}/hatch<br/>
Step Efficiency: ${this.stepEfficiency()}%<br/>
Attack Efficiency: ${this.attackEfficiency()}%<br/>
Hatched: ${this.hatched().toLocaleString('en-US')}<br/>`
Hatched: ${this.hatched().toLocaleString('en-US')}<br/>
Total Efficiency: ${this.totalEfficiency().toLocaleString('en-US')}%<br/>`
);

// Update our bonus values
Expand Down Expand Up @@ -144,6 +148,23 @@ class HatcheryHelper {
}
}

totalEfficiencyColor(): string {
const totalEff = this.totalEfficiency();

switch (true) {

case totalEff < 33:
return 'text-danger';
case totalEff < 100:
return 'text-warning';
case totalEff < 150:
return 'text-success';
default:
return 'text-primary';
}

}

toJSON(): Record<string, any> {
return {
name: this.name,
Expand Down