@ -18,56 +18,56 @@ let game = new Vue({
@@ -18,56 +18,56 @@ let game = new Vue({
gold : {
amount : 500 ,
name : 'Gold' ,
worth : 100 ,
worth : 1 ,
icon : 'img/gold.png' ,
unlocked : true
} ,
wood : {
amount : 0 ,
name : 'Wood' ,
worth : 10 ,
worth : 5 ,
icon : 'img/wood.png' ,
unlocked : false
} ,
stone : {
amount : 0 ,
name : 'Stone' ,
worth : 25 ,
worth : 10 ,
icon : 'img/stone.png' ,
unlocked : false
} ,
iron : {
amount : 0 ,
name : 'Iron' ,
worth : 100 ,
worth : 25 ,
icon : 'img/iron.png' ,
unlocked : false
} ,
bricks : {
amount : 0 ,
name : 'Bricks' ,
worth : 20 0,
worth : 5 0,
icon : 'img/bricks.png' ,
unlocked : false
} ,
corn : {
amount : 0 ,
name : 'Corn' ,
worth : 7 5,
worth : 3 5,
icon : 'img/corn.png' ,
unlocked : false
} ,
coal : {
amount : 0 ,
name : 'Coal' ,
worth : 25 ,
worth : 30 ,
icon : 'img/coal.png' ,
unlocked : false
} ,
planks : {
amount : 0 ,
name : 'Planks' ,
worth : 100 ,
worth : 75 ,
icon : 'img/planks.png' ,
unlocked : false
}
@ -85,7 +85,7 @@ let game = new Vue({
@@ -85,7 +85,7 @@ let game = new Vue({
amount : 100 ,
intervalInSeconds : 15 ,
price : 500 ,
amountPerLevel : [ 100 , 2 50, 500 , 750 , 1000 , 1500 , 2000 , 2500 , 3000 , 5000 ] ,
amountPerLevel : [ 100 , 1 50, 500 , 750 , 1000 , 1500 , 2000 , 2500 , 3000 , 5000 ] ,
pricePerLevel : [ 500 , 1000 , 1500 , 2000 , 2500 , 3000 , 3500 , 4000 , 4500 , 5000 ] ,
intervalPerLevel : [ 15 , 25 , 30 , 45 , 60 , 90 , 90 , 120 , 120 , 120 ] ,
} ,
@ -100,9 +100,12 @@ let game = new Vue({
@@ -100,9 +100,12 @@ let game = new Vue({
amount : 2 ,
intervalInSeconds : 10 ,
price : 250 ,
amountPerLevel : [ 10 , 15 , 20 , 25 , 30 , 35 , 40 , 45 , 50 , 55 ] ,
pricePerLevel : [ 500 , 1000 , 1500 , 2000 , 2500 , 3000 , 3500 , 4000 , 4500 , 5000 ] ,
intervalPerLevel : [ 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 ] ,
resourcesToBuild : {
gold : 250
} ,
amountPerLevel : [ 10 , 15 , 20 , 25 , 30 , 30 , 30 , 30 , 30 , 30 ] ,
pricePerLevel : [ 250 , 500 , 1000 , 1250 , 1500 , 2000 , 3000 , 4000 , 5000 , 6000 ] ,
intervalPerLevel : [ 15 , 15 , 15 , 15 , 15 , 15 , 10 , 10 , 5 , 5 ] ,
} ,
carpenter : {
name : 'Carpenter' ,
@ -119,6 +122,10 @@ let game = new Vue({
@@ -119,6 +122,10 @@ let game = new Vue({
requires : {
wood : 2
} ,
resourcesToBuild : {
wood : 600 ,
stone : 250
} ,
amountPerLevel : [ 100 , 250 , 500 , 750 , 1000 , 1500 , 2000 , 2500 , 3000 , 5000 ] ,
pricePerLevel : [ 500 , 1000 , 1500 , 2000 , 2500 , 3000 , 3500 , 4000 , 4500 , 5000 ] ,
intervalPerLevel : [ 15 , 25 , 30 , 45 , 60 , 90 , 90 , 120 , 120 , 120 ] ,
@ -134,6 +141,9 @@ let game = new Vue({
@@ -134,6 +141,9 @@ let game = new Vue({
amount : 2 ,
intervalInSeconds : 20 ,
price : 500 ,
resourcesToBuild : {
wood : 500
} ,
amountPerLevel : [ 100 , 250 , 500 , 750 , 1000 , 1500 , 2000 , 2500 , 3000 , 5000 ] ,
pricePerLevel : [ 500 , 1000 , 1500 , 2000 , 2500 , 3000 , 3500 , 4000 , 4500 , 5000 ] ,
intervalPerLevel : [ 15 , 25 , 30 , 45 , 60 , 90 , 90 , 120 , 120 , 120 ] ,
@ -404,8 +414,9 @@ let game = new Vue({
@@ -404,8 +414,9 @@ let game = new Vue({
if ( resourcesMissing . length ) {
resourcesMissing . forEach ( ( resource ) => {
game . sendWarning (
'Not enough ' + resource + ' to build ' + building . name + '!'
game . sendNotEnoughResourceToBuildWarning (
'Not enough ' + resource + ' to build ' + building . name + '!' ,
building
) ;
} ) ;
@ -432,6 +443,10 @@ let game = new Vue({
@@ -432,6 +443,10 @@ let game = new Vue({
upgradeBuilding ( building , first = false ) {
if ( building . level < ( building . maxLevel ) ) {
building . level ++ ;
this . sendBuildingUpgradedNotification (
building . name + ' has been upgraded to level ' + building . level + '!' ,
building
) ;
if ( building . level === building . maxLevel ) {
building . isUpgradeable = false ;
@ -531,7 +546,13 @@ let game = new Vue({
@@ -531,7 +546,13 @@ let game = new Vue({
if ( rewardSum > 0 ) {
if ( skip ) {
game . questSkipCounter ++ ;
if ( game . resources . gold . amount > 250 ) {
game . resources . gold . amount -= 250 ;
game . questSkipCounter ++ ;
} else {
game . sendWarning ( 'Not enough gold to skip this quest' ) ;
return false ;
}
}
quest [ 'reward' ] = rewardSum ;
@ -681,6 +702,28 @@ let game = new Vue({
@@ -681,6 +702,28 @@ let game = new Vue({
} ) ;
} ,
sendNotEnoughResourceToBuildWarning ( message , building ) {
iziToast . show ( {
color : 'red' ,
message : message ,
image : 'img/' + building . icon + '.png' ,
position : 'bottomCenter' ,
transitionIn : 'boundInRight' ,
transitionInMobile : 'boundInRight'
} ) ;
} ,
sendBuildingUpgradedNotification ( message , building ) {
iziToast . show ( {
color : 'green' ,
message : message ,
image : 'img/' + building . icon + '.png' ,
position : 'bottomCenter' ,
transitionIn : 'boundInRight' ,
transitionInMobile : 'boundInRight'
} ) ;
} ,
sendWarning ( message ) {
iziToast . show ( {
color : 'red' ,