Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dismiss Angel/Suit Exclamation #45

Open
wants to merge 19 commits into
base: master
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
3 changes: 3 additions & 0 deletions New planet requirements
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ Events are loaded from a Google Sheet url so if I can get the URL or the file it
1. The cost.
2. Which business the manager effects.
3. The amount of the manager discount.

12. The angel/suit exclamation state
Allows for us to track whether the user has seen the angel and suit exclamation notification for dismissal
73 changes: 68 additions & 5 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,16 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
}
}
}

$scope.calc($scope[planets[k]]);

// set notification properties after calculating to prevent calculation from overriding
if (obj.hasOwnProperty(planets[k])) {
$scope[planets[k]].hasSeenSuitExclamation = obj[planets[k]].seenSuit;
$scope[planets[k]].hasSeenAngelExclamation = obj[planets[k]].seenAngel;
$scope[planets[k]].suitExclamation = obj[planets[k]].suitExclamation;
$scope[planets[k]].angelExclamation = obj[planets[k]].angelExclamation;
}
}
$scope.$digest();
}
Expand Down Expand Up @@ -335,7 +344,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
function calcAngels(loc) {
var i = 0,
tempPlanet = null;
loc.angelExclamation = false;
//loc.angelExclamation = false;
for (; i < loc.angelUpgrades.length; i++) {
if (!tupleIsActive(loc.angelUpgrades[i]) && loc.angelUpgrades[i][0] < loc.numAngels) {
tempPlanet = JSON.parse(JSON.stringify(loc));
Expand All @@ -344,15 +353,25 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
calcState(tempPlanet);
var delta = tempPlanet.totalMoneyPerSecond - loc.totalMoneyPerSecond;
var percent = delta / loc.totalMoneyPerSecond;
if (delta > 0) {
if (delta > 0 && typeof loc.angelUpgrades[i][loc.angelUpgrades[i].length - 2] === 'boolean') {
loc.angelUpgrades[i][loc.angelUpgrades[i].length - 2] = percent;
loc.angelExclamation = true;
} else {
loc.hasSeenAngelExclamation = false;
} else if (delta <= 0) {
loc.angelUpgrades[i][loc.angelUpgrades[i].length - 2] = false;
}
} else if (loc.angelUpgrades[i][0] >= loc.numAngels && typeof loc.angelUpgrades[i][loc.angelUpgrades[i].length - 2] !== 'boolean') {
loc.angelUpgrades[i][loc.angelUpgrades[i].length - 2] = false;
}
}
};

$scope.$watch('accOpen[2]', function(newVal, oldVal, $scope){
if (newVal && $scope.ref.angelExclamation && !$scope.ref.hasSeenAngelExclamation) {
$scope.ref.hasSeenAngelExclamation = true;
$scope.ref.angelExclamation = false;
}
});

function calcRecommendations(loc) {
var i = 0, j = 0, k = 0,
Expand Down Expand Up @@ -568,7 +587,10 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
var percent = delta / loc.totalMoneyPerSecond;
if (delta > 0) {
loc.suits[i][1] = percent;
loc.suitExclamation = true;
if (!loc.hasSeenSuitExclamation) {
loc.suitExclamation = true;
loc.hasSeenSuitExclamation = false;
}
if (percent > max[1]) {
max[0] = i;
max[1] = percent;
Expand All @@ -584,6 +606,14 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
loc.bestSuit = null;
}
};

$scope.$watch('accOpen[4]', function(newVal, oldVal, $scope){
if (newVal && $scope.ref.suitExclamation && !$scope.ref.hasSeenSuitExclamation) {
$scope.ref.hasSeenSuitExclamation = true;
$scope.ref.suitExclamation = false;
console.log("Suit Accordion Opened");
}
});

function calcUpgradeScore(planet, loc, unlockCost) {
var overflowPotential = planet.totalMoneyPerSecond * unlockCost,
Expand Down Expand Up @@ -794,7 +824,11 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
string += ' ' + i;
}
}
string += '\r\n ]\r\n}';
string += '\r\n ],\r\n "suitExclamation": ' + (typeof loc.suitExclamation === 'undefined' ? false : loc.suitExclamation);
string += ',\r\n "seenSuit": ' + (typeof loc.hasSeenSuitExclamation === 'undefined' ? false : loc.hasSeenSuitExclamation);
string += ',\r\n "angelExclamation": ' + (typeof loc.angelExclamation === 'undefined' ? false : loc.angelExclamation);
string += ',\r\n "seenAngel": ' + (typeof loc.hasSeenAngelExclamation === 'undefined' ? false : loc.hasSeenAngelExclamation);
string += '\r\n}';
return string;
};

Expand All @@ -814,6 +848,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
}
loc.angelEffectiveness = 2;
loc.angelExclamation = false;
loc.hasSeenAngelExclamation = false;
loc.bonusAngelEffectiveness = 0;
loc.bonusMultiplier = 0;
loc.flux = 0;
Expand All @@ -831,6 +866,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
loc.recTable = [];
loc.recommendation = '';
loc.suitExclamation = false;
loc.hasSeenSuitExclamation = false;
loc.totalMoneyPerSecond = 0;
loc.triples = 0;
loc.upgradeCosts = [];
Expand Down Expand Up @@ -1028,6 +1064,8 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
loc.lifetimeEarnings = obj.totalCash || obj.sessionCash + obj.totalPreviousCash;
loc.numAngels = obj.angelInvestors;
loc.sacAngels = obj.angelInvestorsSpent;
loc.hasSeenSuitExclamation = obj.seenSuit;
loc.hasSeenAngelExclamation = obj.seenAngel;
// how to find gold multipliers, flux, bonus angel effectiveness (kong login etc), suits
};

Expand All @@ -1038,6 +1076,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
}
for (i = 0; i < loc.angelUpgrades.length; i++) {
loc.angelUpgrades[i][loc.angelUpgrades[i].length - 1] = false;
loc.angelUpgrades[i][loc.angelUpgrades[i].length] = false;
}
for (i = 0; i < loc.managerUpgrades.length; i++) {
loc.managerUpgrades[i][0][loc.managerUpgrades[i][0].length - 1] = false;
Expand All @@ -1047,6 +1086,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
}
loc.angelEffectiveness = 2;
loc.angelExclamation = false;
loc.hasSeenAngelExclamation = false;
loc.bonusAngelEffectiveness = 0;
loc.bonusMultiplier = 0;
for (i = 0; i < loc.investments.length; i++) {
Expand Down Expand Up @@ -1105,6 +1145,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($

function suitFromName(name) {
var i = 0;

for (; i < $scope.suitList.length; i++) {
if ($scope.suitList[i][0].toLowerCase() === name) {
return i;
Expand All @@ -1126,7 +1167,21 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
};

$scope.updateAngels = function() {
var prevAngels = $scope.ref.numAngels;
var i = 0;

updateIllionize('numAngels', 'viewNumAngels', 'illions');

// re-enables the notification
if ($scope.ref.numAngels != prevAngels) {
if ($scope.ref.hasSeenAngelExclamation) {
for (i = 0; i < $scope.ref.angelUpgrades.length; i++) {
$scope.ref.angelUpgrades[i][$scope.ref.angelUpgrades[i].length - 2] = false;
}
}
$scope.ref.hasSeenAngelExclamation = false;
$scope.calc($scope.ref);
}
};

$scope.updateEarnings = function() {
Expand Down Expand Up @@ -1178,6 +1233,8 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
$scope.earth.baseProfit = [1, 60, 540, 4320, 51840, 622080, 7464960, 89579520, 1074954240, 29668737024];
$scope.earth.baseSpeed = [0.6, 3, 6, 12, 24, 96, 384, 1536, 6144, 36864];
$scope.earth.hasMegaTickets = true;
$scope.earth.hasSeenAngelExclamation = false;
$scope.earth.hasSeenSuitExclamation = false;
$scope.earth.investments = [
['Lemon', 1, false, 0, 0, 0, 0],
['Newspaper', 0, false, 0, 0, 0, 0],
Expand All @@ -1196,6 +1253,8 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
$scope.liverich.baseProfit = [2, 25, 77, 189, 3333, 13, 110, 412, 2900, 666666]; // Figure out when event starts
$scope.liverich.baseSpeed = [1, 3, 5, 7, 9, 10, 19, 25, 42, 96]; // Figure out when event starts
$scope.liverich.hasMegaTickets = false;
$scope.liverich.hasSeenAngelExclamation = false;
$scope.liverich.hasSeenSuitExclamation = false;
$scope.liverich.investments = [
['Investment 1', 1, false, 0, 0, 0, 0],
['Investment 2', 0, false, 0, 0, 0, 0],
Expand All @@ -1214,6 +1273,8 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
$scope.moon.baseProfit = [1, 21, 2001, 376, 98820, 1976400, 32940000, 1152900000, 11067840000, 332035000000];
$scope.moon.baseSpeed = [2, 7, 28, 2, 45, 180, 600, 3000, 14400, 86400];
$scope.moon.hasMegaTickets = true;
$scope.moon.hasSeenAngelExclamation = false;
$scope.moon.hasSeenSuitExclamation = false;
$scope.moon.investments = [
['Moon Shoe', 1, false, 0, 0, 0, 0],
['Gravity Booth', 0, false, 0, 0, 0, 0],
Expand All @@ -1232,6 +1293,8 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
$scope.mars.baseProfit = [0.011, 1, 4321, 4007310, 518783295, 500634321, 7543177325, 69263532485, 99760273916482500];
$scope.mars.baseSpeed = [0.5, 3, 9, 32, 64, 4, 18, 42, 43200];
$scope.mars.hasMegaTickets = true;
$scope.mars.hasSeenAngelExclamation = false;
$scope.mars.hasSeenSuitExclamation = false;
$scope.mars.investments = [
['Red Dirt', 1, false, 0, 0, 0, 0],
['Marsies', 0, false, 0, 0, 0, 0],
Expand Down