Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Bonuses no longer affect money gained from farming #163

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
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
1 change: 1 addition & 0 deletions src/scripts/Changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const changelogItems = [
new Changelog(changelogType.VERSION, 'v1.0.2'),
new Changelog(changelogType.CHANGE, 'Update how achievement percentages are shown'),
new Changelog(changelogType.CHANGE, 'Update hatch/catch notification message'),
new Changelog(changelogType.CHANGE, 'Amulet coin and battle items no longer affects money gained from farming'),
new Changelog(changelogType.FIXED, 'Plates from underground should now sell for their correct value'),
new Changelog(changelogType.VERSION, 'v1.0.1'),
new Changelog(changelogType.NEW, 'Added changelog'),
Expand Down
23 changes: 15 additions & 8 deletions src/scripts/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,19 +454,26 @@ class Player {
return false;
}

public gainMoney(money: number) {
public gainMoney(money: number, applyBonuses: boolean = true) {
OakItemRunner.use(GameConstants.OakItem.Amulet_Coin);
// TODO add money multipliers
let oakItemBonus = OakItemRunner.isActive(GameConstants.OakItem.Amulet_Coin) ? (1 + OakItemRunner.calculateBonus(GameConstants.OakItem.Amulet_Coin) / 100) : 1;
let moneytogain = Math.floor(money * oakItemBonus * (1 + AchievementHandler.achievementBonus()))
if(EffectEngineRunner.isActive(GameConstants.BattleItemType.Lucky_incense)()){
moneytogain = Math.floor(moneytogain * 1.5);
if (applyBonuses){
// Apply oak item bonus
const oakItemBonus = OakItemRunner.isActive(GameConstants.OakItem.Amulet_Coin) ? (1 + OakItemRunner.calculateBonus(GameConstants.OakItem.Amulet_Coin) / 100) : 1;
money *= oakItemBonus;
// Apply achievemnts bonus
money *= 1 + AchievementHandler.achievementBonus();
// Apply battle item bonus
if(EffectEngineRunner.isActive(GameConstants.BattleItemType.Lucky_incense)()){
money *= 1.5;
}
}
this._money(this._money() + moneytogain);
GameHelper.incrementObservable(this.statistics.totalMoney, moneytogain);
money = Math.floor(money);
this._money(this._money() + money);
GameHelper.incrementObservable(this.statistics.totalMoney, money);
Game.updateMoney();

Game.animateMoney(moneytogain,'playerMoney');
Game.animateMoney(money, 'playerMoney');
}

set itemList(value: { [p: string]: KnockoutObservable<number> }) {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/farm/FarmRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class FarmRunner {
player.gainFarmPoints(plot.berry().farmValue);
FarmRunner.gainBerryById(plot.berry().type, GameConstants.randomIntBetween(2, 3));
let money = plot.berry().moneyValue;
player.gainMoney(money);
player.gainMoney(money, false);
if(!all){
Notifier.notify(`You earned ${money} money from the harvest!`, GameConstants.NotificationOption.success)
}
Expand Down