LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code






Select speed
X Number is every how many milliseconds item will be sold. Decimals are not allowed
The speed will update, once the past one has run, meaning if you put 100 seconds, then change it, you need to wait 100 seconds for it to update.
1 second = 1000 ms

Food sell speed
Wood sell speed
Stone sell speed
Iron sell speed


Sell food
Sell wood
Sell stone
Sell iron

Farmers

Lumberjacks

Stone miners

Iron miners

Hire menu







Upgrades




Level up reward


Buildings

Storages

Quest




Save and load

If something comes up as NaN, that means you have old save file, and it has been probably corrupted.


Pop up settings
Position:
Close time:
Choose background color
(Doesnt work full screen)


Tutorial

Hire menu

Hire menu allows you to hire workers. Remember they cost population. Keep your population high or you will have to wait for people to arrive to your village (you might be waiting long time).
Hiring workers allows you to get resources. Resources can be used to build, be sold or to upgrade. Remember it is better to upgrade some workers than hire lots of them.


Population

Population only increases if you have more than 2 people. Remember the more people you have to bigger the population gain rate. Population can also do something e.g. steal your gold etc. You cannot prevent that. People will also eat food. It is important you keep your food level high.


Upgrades

Upgrades will greatly boost your production rate of certain resource. Use them wisely. Some upgrades can be expensive but rewarding.


Build menu

Build menu will allow you to expand your resource storage. This will allow you to not lose resource that you produce too much. Buildings take some time to build but will increase your storage or population capacity. You should build lots of them throughtout the game.


Quest

To go on quests you need questpoints. Questpoints allow you to go on quest. On quests you can find resources based on your level. The bigger your level the more resources you gain in quests.



Resources

Resources can be used to build and be sold. Here is what resources are needed for: Stone and Iron for building. Gold for buying stuff. Food for feeding people. Wood for building. Food is the most important resource in the game. Make sure you always have a lot of it. Otherwise you might need to wait for new people to join your village (it might take some time if you have less than 2 people).




Map




You vs monster

















TASKS
CSS
@import url(https://fonts.googleapis.com/css?family=Nunito:700);
@import url(https://fonts.googleapis.com/css?family=Pacifico);
* {
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
}

#resources {
  border: 2px solid black;
  float: left;
  font-size: 20px;
  font-weight: 900;
  padding: 10px;
  width: 306px;
}

#info {
  background-color: black;
  color: white;
}

#gold {
  color: darkorange;
}

#wood {
  color: brown;
}

#stone {
  color: grey;
}

#iron {
  color: white;
  background-color: black;
}

#workerstats {
  border: 2px solid black;
  padding: 0;
  margin: 0;
  font-size: 16px;
}

#buildbar {
  width: 100%;
}

h1 {
  font-size: 20px;
  border-bottom: 2px dashed black;
}

#upgrades {
  border: 2px solid black;
  shadow-box: 15px 15px 15px;
  float: left;
  width: 500px;
  height: 450px;
  overflow: auto;
  resize: both;
}

#buildmenu {
  border: 2px solid black;
  shadow-box: 15px 15px 15px;
  float: left;
  width: 650px;
  overflow: auto;
  resize: both;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  width: 2px;
  border: 1px dashed goldenrod;
}

::-webkit-scrollbar-thumb {
  background: goldenrod;
}

::-webkit-scrollbar-thumb:hover {
  background: darkgoldenrod;
}

#level {
  float: right;
  font-size: 24px;
}

#hire {
  float: left;
  border: 2px solid black;
  width: 500px;
  overflow: auto;
  resize: both;
}

#left {
  float: left;
}

#center {
  float: left;
}

progress {
  width: 90%;
  height: 20px;
  display: block;
  float: left;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  position: relative;
  overflow: hidden;
}

button {
  position: relative;
  background-color: #4CAF50;
  border: none;
  font-size: 16px;
  color: #FFFFFF;
  padding: 8px;
  width: 100%;
  text-align: center;
  -webkit-transition-duration: 0.4s;
  transition-duration: 0.4s;
  text-decoration: none;
  overflow: hidden;
  cursor: pointer;
}

button:after {
  content: "";
  background: #90EE90;
  display: block;
  position: absolute;
  padding-top: 300%;
  padding-left: 350%;
  margin-left: -20px !important;
  margin-top: -120%;
  opacity: 0;
  transition: all 0.8s;
}

button:active:after {
  padding: 0;
  margin: 0;
  opacity: 1;
  transition: 0s;
}

#quest {
  border: 2px solid black;
  shadow-box: 15px 15px 15px;
  float: left;
  width: 750px;
  height: 350px;
  overflow: auto;
  resize: both;
}

#loot {
  font-size: 24px;
  color: red;
}

h4 {
  float: left;
}

#sellspeed {
  -webkit-appearance: button;
  -webkit-border-radius: 2px;
  -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
  -webkit-padding-end: 20px;
  -webkit-padding-start: 2px;
  -webkit-user-select: none;
  background-image: url(http://i62.tinypic.com/15xvbd5.png), -webkit-linear-gradient(#FAFAFA, #F4F4F4 40%, #E5E5E5);
  background-position: 97% center;
  background-repeat: no-repeat;
  border: 1px solid #AAA;
  color: #555;
  font-size: 16px;
  margin: 20px;
  overflow: hidden;
  padding: 5px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100px;
}

input[type=checkbox] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

span {
  display: none;
  color: #000066;
}

button:hover span {
  display: block;
}

button:hover {
  border: 2px solid red;
  width: 90%;
  height: auto;
}

#fight {
  margin-top: 10px;
}

#fightmenu {
  float: left;
  width: 150px;
}

meter {
  width: 25%;
}

#fightinfo {
  font-size: 16px;
  float: left;
}

#player {
  float: left;
  font-size: 24px;
  color: #cc0000;
}

#monster {
  float: right;
  font-size: 24px;
  color: #cc0000;
}

#questbut {
  width: 200px;
}

#navbar {
  margin-left: auto;
  margin-right: auto;
  height: 50px;
}

#navbar > button {
  float: left;
  width: 250px;
  margin-top: 15px;
  margin-left: 15px;
  margin-right: 15px;
}

.menu {
  width: 100px;
  font-size: 16px;
  height: 35px;
  border: 2px solid black;
}

.menu:hover {
  width: 125px;
  height: 35px;
  margin-right: 8px;
  margin-left: 8px;
  transform: scale(1.15, 1.15);
}

#player {
  float: left;
}

#monster {
  float: right;
}

#battlebut {
  width: 200px;
}

table {
  border: 2px solid black;
  margin-left: auto;
  margin-right: auto;
}

td {
  border: 2px solid black;
  width: 25px;
  height: 25px;
}

h2 {
  font-size: 24px;
  font-family: 'Pacifico', cursive;
}

#questbar {
  width: 100%;
  height: 10%;
  border: 2px solid black;
  border-radius: 25px;
  margin-left: auto;
  margin-right: auto;
}

select {
  font-size: 20px;
}

#upquest {
  width: 200px;
}

img {
  width: 75%;
  height: 75%;
}

img:hover {
  transform: scale(1.2, 1.2);
}

#quest img {
  width: 75px;
  height: 75px;
}

#buildmenu img {
  width: 100px;
  height: 100px;
}

#hire img {
  width: 100px;
  height: 100px;
}

#tutorial {
  border: 2px solid black;
  height: 400px;
  padding: 0;
  float: left;
  text-align: center;
  width: 500px;
  margin: 0;
  font-size: 16px;
  overflow: auto;
  resize: both;
}

#upgrades button {
  border: 1px solid black;
}

#buildbar::-webkit-progress-value {
  background: #990033;
}

#levelbar::-webkit-progress-value {
  background: blue;
}

td:hover span {
  display: block;
}

#mapshow {
  font-size: 24px;
}

#playerstuff {
  float: left;
  margin-left: 250px;
}

#monsterinfo {
  float: right;
  margin-right: 250px;
}

#log {
  overflow: auto;
  border: 2px solid black;
  width: 25%;
  margin-left: auto;
  margin-right: auto;
  height: 200px;
}

#stonebutton {
  margin-top: -22px;
}

#ironbutton {
  margin-top: -22px;
}

#playerstuff > button {
  width: 150px;
  margin-top: 2px;
  border: 2px solid black;
}

#herobar {
  width: 100px;
}

.build {
  width: 150px;
}

.build:hover {
  width: 175px;
}

#skilltree {
  border: 2px solid black;
  float: left;
  width: 100%;
  font-size: 20px;
  font-weight: 900;
  padding: 10px;
}

#skilltree button {
  padding-left: 10px;
  margin-top: 10px;
  width: 250px;
  background-color: #f4511e;
  height: 40px;
  font-size: 20px;
}

#skilltree button:hover {
  background-color: #d2411e;
  color: black;
  border-radius: 10px;
}

.info {
  color: red;
}

#settings {
  font-size: 36px;
  margin-top: 200px;
  margin-bottom: 200px;
}

#taskbox {
  border: 2px solid black;
  background-color: #4CAF50;
  width: 150px;
  border-radius: 10px;
  float: right;
  font-family: 'Roboto';
  margin-left: 88%;
  margin-top: -50px;
  position: fixed;
}

#task {
  color: blue;
  text-decoration: underline;
  font-size: 16px;
}

#taskprogress {
  width: 90%;
  border: 2px solid black;
}

#fullscreen {
  width: 40px;
  height: 40px;
  border: 2px solid black;
  float: left;
  padding: 10px;
}

.modalDialog {
  position: fixed;
  font-family: Arial, Helvetica, sans-serif;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 99999;
  opacity: 0;
  -webkit-transition: opacity 400ms ease-in;
  -moz-transition: opacity 400ms ease-in;
  transition: opacity 400ms ease-in;
  pointer-events: none;
}

.modalDialog:target {
  opacity: 1;
  pointer-events: auto;
}

.modalDialog > div {
  width: 400px;
  position: relative;
  margin: 10% auto;
  padding: 5px 20px 13px 20px;
  border-radius: 10px;
  background: #fff;
  background: -moz-linear-gradient(#fff, #999);
  background: -webkit-linear-gradient(#fff, #999);
  background: -o-linear-gradient(#fff, #999);
}

.close {
  background: #606061;
  color: #FFFFFF;
  line-height: 25px;
  position: absolute;
  right: -12px;
  text-align: center;
  top: -10px;
  width: 24px;
  text-decoration: none;
  font-weight: bold;
  -webkit-border-radius: 12px;
  -moz-border-radius: 12px;
  border-radius: 12px;
  -moz-box-shadow: 1px 1px 3px #000;
  -webkit-box-shadow: 1px 1px 3px #000;
  box-shadow: 1px 1px 3px #000;
}

.close:hover {
  background: #00d9ff;
}

input[type="number"] {
  width: 150px;
  height: 20px;
  font-size: 24px;
  margin-left: 50px;
  margin-right: 10px;
  display: table;
  float: left;
}

/*!
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE
 POP UPS CODE

 */
.spop-container {
  z-index: 2000;
  position: fixed;
}
.spop-container,
.spop-container *,
.spop-container *:after,
.spop-container *:before {
  box-sizing: border-box;
}

.spop--top-left {
  top: 0;
  left: 0;
}
.spop--top-left .spop {
  transform-origin: 0 0;
}

.spop--top-center {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}
.spop--top-center .spop {
  transform-origin: 50% 0;
}

.spop--top-right {
  top: 0;
  right: 0;
}
.spop--top-right .spop {
  transform-origin: 100% 0;
}

.spop--center {
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
}
.spop--center .spop {
  transform-origin: 50% 0;
}

.spop--bottom-left {
  bottom: 0;
  left: 0;
}
.spop--bottom-left .spop {
  transform-origin: 0 100%;
}

.spop--bottom-center {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}
.spop--bottom-center .spop {
  transform-origin: 50% 100%;
}

.spop--bottom-right {
  bottom: 0;
  right: 0;
}
.spop--bottom-right .spop {
  transform-origin: 100% 100%;
}

@media screen and (max-width: 30em) {
  .spop--top-left,
  .spop--top-center,
  .spop--top-right,
  .spop--bottom-left,
  .spop--bottom-center,
  .spop--bottom-right {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    margin-left: 0;
    transform: translateX(0);
  }
  .spop--top-left .spop,
  .spop--top-center .spop,
  .spop--top-right .spop,
  .spop--bottom-left .spop,
  .spop--bottom-center .spop,
  .spop--bottom-right .spop {
    transform-origin: 50% 100%;
  }

  .spop {
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  }
}
.spop {
  position: relative;
  min-height: 56px;
  line-height: 1.25;
  font-size: 14px;
  transform: translateZ(0);
}
@media screen and (min-width: 30em) {
  .spop {
    border-radius: 2px;
    width: 320px;
    margin: 0.7em;
  }
}

.spop--info,
.spop--error,
.spop--warning,
.spop--success {
  color: #fff;
  background-color: #454A56;
}

@keyframes spopIn {
  0% {
    transform: scale(0.2, 0.2);
  }
  95% {
    transform: scale(1.1, 1.1);
  }
  100% {
    transform: scale(1, 1);
  }
}
@keyframes spopOut {
  0% {
    opacity: 1;
    transform: scale(1, 1);
  }
  20% {
    transform: scale(1.1, 1.1);
  }
  100% {
    opacity: 0;
    transform: scale(0, 0);
  }
}
.spop--out {
  animation: spopOut 0.4s ease-in-out;
}

.spop--in {
  animation: spopIn 0.4s ease-in-out;
}

.spop-body {
  padding: 1.4em;
}
.spop-body p {
  margin: 0;
}
.spop-body a {
  color: #fff;
  text-decoration: underline;
}
.spop-body a:hover {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.spop-title {
  margin-top: 0;
  margin-bottom: 0.25em;
  color: #fff;
}

.spop-close {
  position: absolute;
  right: 0;
  top: 0;
  height: 32px;
  width: 32px;
  padding-top: 7px;
  padding-right: 7px;
  font-size: 22px;
  font-weight: bold;
  text-align: right;
  line-height: 0.6;
  color: #fff;
  opacity: 0.5;
}
.spop-close:hover {
  opacity: 0.7;
  cursor: pointer;
}

.spop-icon {
  position: absolute;
  top: 13px;
  left: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  animation: spopIn 0.4s 0.4s ease-in-out;
}
.spop-icon:after, .spop-icon:before {
  content: "";
  position: absolute;
  display: block;
}
.spop-icon + .spop-body {
  padding-left: 4.2em;
}

.spop-icon--error,
.spop-icon--info {
  border: 2px solid #3a95ed;
}
.spop-icon--error:before,
.spop-icon--info:before {
  top: 5px;
  left: 11px;
  width: 4px;
  height: 4px;
  background-color: #3a95ed;
}
.spop-icon--error:after,
.spop-icon--info:after {
  top: 12px;
  left: 11px;
  width: 4px;
  height: 9px;
  background-color: #3a95ed;
}

.spop-icon--error {
  border-color: #ff5656;
}
.spop-icon--error:before {
  top: 16px;
  background-color: #ff5656;
}
.spop-icon--error:after {
  top: 5px;
  background-color: #ff5656;
}

.spop-icon--success {
  border: 2px solid #2ecc54;
}
.spop-icon--success:before {
  top: 7px;
  left: 7px;
  width: 13px;
  height: 8px;
  border-bottom: 3px solid #2ecc54;
  border-left: 3px solid #2ecc54;
  transform: rotate(-45deg);
}

.spop-icon--warning {
  border: 2px solid #fcd000;
}
.spop-icon--warning:before {
  top: 7px;
  left: 7px;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent transparent #fcd000 transparent;
  border-width: 0 6px 10px 6px;
}

/* Extra styles for playgroud */
body {
  font-family: 'Roboto', sans-serif;
  background-color: #ddd;
  font-size: 100%;
  font-weight: 400;
  line-height: 1.47;
  min-width: 320px;
}

.container {
  position: relative;
  max-width: 42em;
  padding-left: 1rem;
  padding-right: 1rem;
  margin: 0 auto;
  text-align: center;
}

h1, h2, h3, .h1, .h2, .h3 {
  margin-top: 0;
  font-weight: 300;
  color: #555;
  line-height: 1.1;
}

h1, .h1 {
  font-size: 2.5rem;
}

h2, .h2 {
  font-size: 1.8rem;
}

h3, .h3 {
  font-size: 1.3rem;
  font-weight: 400;
}

a {
  color: #5c83b0;
  text-decoration: none;
}
a:hover {
  text-decoration: none;
  color: #3d5b7e;
}

.header {
  padding: 2rem;
  padding-bottom: 1rem;
  background-color: #eee;
}

.section {
  padding: 2rem;
  background-color: #f7f7f7;
}

.btn {
  display: inline-block;
  vertical-align: middle;
  padding: 6px 12px;
  margin: 2px;
  color: #fff;
  background-color: #5c83b0;
  border-radius: 3px;
  transition: background-color 0.3s ease-in-out;
  cursor: pointer;
  text-align: center;
}
.btn:hover, .btn:focus {
  color: #fff;
  background-color: #476a92;
}

.btn-play {
  background-color: #505664;
}
.btn-play span {
  margin-right: 0.4em;
}

.text-info {
  color: #3a95ed;
}

.text-success {
  color: #2ecc54;
}

.text-error {
  color: #ff5656;
}

.text-warning {
  color: #fcd000;
}
JS
/*
Map section seems unnecessary: by the time you can afford to spend resources on it, fight rewards are too weak to compensate the investment.
*/

var position = "top-left";

var gold = 5,
    goldmax = 5,
    food = 4,
    foodmax = 5,
    wood = 0,
    woodmax = 2,
    stone = 0,
    stonemax = 2,
    iron = 0,
    ironmax = 2,
    population = 3,
    populationrate = 0,
    populationgain = 0,
    populationmax = 5.1,
    level = 1,
    xp = 0,
    xpN = 2,
    xpgained = 0,
    questpoint = 0,
    questpointspeed = 1/20,
    random = 0,
    rand = 0,
    sellf = document.getElementById("sellfood").checked,
    sellw = document.getElementById("sellwood").checked,
    sells = document.getElementById("sellstone").checked,
    selli = document.getElementById("selliron").checked,
    buildValue = 0,
    buildQueue = [],
    buildSpeed = 1/100,
    loot,
    max,
    map = [],
    i = 1,
    maplevel = 1,
    playerPos = 0,
    currentLevel,
    mapsize,
    heroxp = 0,
    heroxpN = 1,
    herolevel = 1,
    skillpoint = 0,
    tips = ["Instead of buying lots of workers, upgrade them!","Make sure food and gold is highly stocked!","If you have high food production, sell it!","There is hidden buttons that give you rewards!","If your population is high, check out tab map!","If quest button is red, this means you can go on quest!","Game auto saves every 60 seconds, so don't worry about losing progress","Get lower tier workers first, instead of saving up for better ones!","When buying new workers, you are risking of losing them very fast, so be prepared to lose them.","Some upgrades are more expensive than others, but give exactly the same, so Watch out!","Check out settings tab to save, load, read tutorial and customize your game!","This is a very early alpha of the game","Be prepared to find glitches sometimes.","Build speed is a very rare upgrade, if you see one on level up upgrade, GET IT!","To sell faster, use sell speed above the resources","You can sell resources using checkboxes.","Skill points are very useful, you get them when leveling up","level upgrades are randomized, there is a 0.5% chance of there being just one upgrade available","You can gain lots of damage, by fighting.","This is a very long sentence you won't be bothered to read anyway, so why are you still reading this, i have nothing to put so stop reading this and get to the game now! why you still reading this ? okay, i will stop.","You can resize every window using small arrows in bottom right corner. Click and drag them to resize the window.","Have fun!","People pay you taxes, more people = more tax"],
    
    tasktype,
    tasktoget = 0,
    taskprogress = 0,
    foodsellspeed = 0,
    woodsellspeed = 0,
    stonesellspeed = 0,
    ironsellspeed = 0;


var farmer = {
  persec: 0,
  efficiency: 0.01,
  amount: 0,
};
var lumberjack = {
  persec: 0,
  efficiency: 0.01,
  amount: 0,
};
var stoneminer = {
  persec: 0,
  efficiency: 0.02,
  amount: 0,
};
var ironminer = {
  persec: 0,
  efficiency: 0.01,
  amount: 0,
};
var time = {
  sec: 0,
  min: 0,
  hour: 0,
};

var player = {
  min_dmg: 8,
  max_dmg: 12,
  hp: 0,
  hpmax: 20,
};
var enemy = {
  min_dmg: 8,
  max_dmg: 12,
  hp: 20,
  hpmax: 20,
};



  document.getElementById("up1").style.display = "none";
  document.getElementById("up2").style.display = "none";
  document.getElementById("up3").style.display = "none";
  document.getElementById("up4").style.display = "none";
  document.getElementById("up5").style.display = "none";
  document.getElementById("up6").style.display = "none";
  document.getElementById("up7").style.display = "none";
  document.getElementById("up8").style.display = "none";
  document.getElementById("up9").style.display = "none";
  document.getElementById("up10").style.display = "none";
  document.getElementById("up11").style.display = "none";
  document.getElementById("up12").style.display = "none";
  document.getElementById("up13").style.display = "none";
  document.getElementById("up14").style.display = "none";
  document.getElementById("up15").style.display = "none";
  document.getElementById("up16").style.display = "none";
  document.getElementById("up17").style.display = "none";
  document.getElementById("up18").style.display = "none";
  document.getElementById("up19").style.display = "none";
  document.getElementById("up20").style.display = "none";
  document.getElementById("up21").style.display = "none";
  document.getElementById("up22").style.display = "none";
  document.getElementById("up23").style.display = "none";
  document.getElementById("up24").style.display = "none";
  document.getElementById("up25").style.display = "none";


  document.getElementById("upgrades").style.display = "none";
  document.getElementById("hire").style.display = "block";
  document.getElementById("buildmenu").style.display = "none";
  document.getElementById("quest").style.display = "none";
  document.getElementById("tutorial").style.display = "none";
  document.getElementById("map").style.display = "none";


function display(){
  document.getElementById("levelbar").max = xpN;
  document.getElementById("levelbar").value = xp;
  document.getElementById("herobar").max = heroxpN;
  document.getElementById("herobar").value = heroxp;
  document.getElementById("gold").innerHTML = "Gold: "+gold.toFixed(2)+" / "+goldmax.toFixed(0);
  document.getElementById("food").innerHTML = "Food: "+food.toFixed(2)+" / "+foodmax.toFixed(0);
  document.getElementById("wood").innerHTML = "Wood: "+wood.toFixed(2)+" / "+woodmax.toFixed(0);
  document.getElementById("stone").innerHTML = "Stone: "+stone.toFixed(2)+" / "+stonemax.toFixed(0);
  document.getElementById("iron").innerHTML = "Iron: "+iron.toFixed(2)+" / "+ironmax.toFixed(0);
  
  document.getElementById("population").innerHTML = "Population: "+population.toFixed(2)+" / "+populationmax.toFixed(0)+"
Population income: "+populationgain.toFixed(2)+" /sec"; if (farmer.amount >= 1){ document.getElementById("showfarmer").innerHTML = "Farmers: "+farmer.amount.toFixed(0)+"
Per sec: "+farmer.persec.toFixed(2)+"
Efficiency: x"+farmer.efficiency.toFixed(3); } if (lumberjack.amount >= 1){ document.getElementById("showlumberjack").innerHTML = "Lumberjacks: "+lumberjack.amount.toFixed(0)+"
Per sec: "+lumberjack.persec.toFixed(2)+"
Efficiency: x"+lumberjack.efficiency.toFixed(2); } if (stoneminer.amount >= 1){ document.getElementById("showstoneminer").innerHTML = "Stone miners: "+stoneminer.amount.toFixed(0)+"
Per sec: "+stoneminer.persec.toFixed(2)+"
Efficiency: x"+stoneminer.efficiency.toFixed(3); } if (ironminer.amount >= 1){ document.getElementById("showironminer").innerHTML = "Iron miners: "+ironminer.amount.toFixed(0)+"
Per sec: "+ironminer.persec.toFixed(2)+"
Efficiency: x"+ironminer.efficiency.toFixed(4); } document.getElementById("level").innerHTML = "Level: "+level.toFixed(0)+"
"+xp.toFixed(2)+" / "+xpN.toFixed(1); document.getElementById("questpoints").innerHTML = "Quest point speed: x"+questpointspeed.toFixed(2)+"
Quest points: "+questpoint.toFixed(3); var buildSpeedShow = buildSpeed*100; document.getElementById("buildbar").max = 100; document.getElementById("buildbar").value = buildValue; document.getElementById("build").innerHTML = "Build progress: "+buildValue.toFixed(2)+"%"+" / +"+buildSpeedShow.toFixed(2)+" sec"+"
Queue: "+buildQueue; document.getElementById("skillshow").innerHTML = "Skill points: "+skillpoint.toFixed(0); document.getElementById("playerinfo").innerHTML = "Dmg: "+player.min_dmg.toFixed(0)+" - "+player.max_dmg.toFixed(0)+"
HP: "+player.hp.toFixed(0)+" / "+player.hpmax.toFixed(0)+"

Lvl: "+herolevel.toFixed(0)+"
"+heroxp.toFixed(1)+" / "+heroxpN.toFixed(0); document.getElementById("monsterinfo").innerHTML = "Dmg: "+enemy.min_dmg.toFixed(0)+" - "+enemy.max_dmg.toFixed(0)+"
HP: "+enemy.hp.toFixed(0)+" / "+enemy.hpmax.toFixed(0); document.getElementById("playerbar").max = player.hpmax; document.getElementById("playerbar").value = player.hp; document.getElementById("enemybar").max = enemy.hpmax; document.getElementById("enemybar").value = enemy.hp; if (level >= 2){ document.getElementById("upbutton").style.display = "block"; } if (level < 2){ document.getElementById("upbutton").style.display = "none"; } if (level >= 4){ document.getElementById("buildbutton").style.display = "block"; } if (level < 4){ document.getElementById("buildbutton").style.display = "none"; } if (level >= 6){ document.getElementById("mapbutton").style.display = "block"; } if (level < 6){ document.getElementById("mapbutton").style.display = "none"; } if (level >= 8){ document.getElementById("questbutton").style.display = "block"; } if (level < 8){ document.getElementById("questbutton").style.display = "none"; } if (level >= 5){ document.getElementById("lumberbutton").style.display = "block"; } if (level < 5){ document.getElementById("lumberbutton").style.display = "none"; } if (level >= 10){ document.getElementById("stonebutton").style.display = "block"; } if (level < 10){ document.getElementById("stonebutton").style.display = "none"; } if (level >= 15){ document.getElementById("ironbutton").style.display = "block"; } if (level < 15){ document.getElementById("ironbutton").style.display = "none"; } if(questpoint >= 1){ document.getElementById("questbutton").style.background = "red"; } if (questpoint <= 1){ document.getElementById("questbutton").style.background = "#4CAF50"; } if(skillpoint >= 1){ document.getElementById("upbutton").style.background = "red"; } if (skillpoint < 1){ document.getElementById("upbutton").style.background = "#4CAF50"; } var queueLength = buildQueue.length; if (buildQueue[0] !== null){ document.getElementById("buildbutton").style.background = "red"; } if (buildQueue[0]){ document.getElementById("buildbutton").style.background = "#4CAF50"; } if (buildQueue[0]){ buildValue += buildSpeed; } if (buildValue >= 100){ buildValue = 100; } if (buildValue === 100 && buildQueue.indexOf("house") === 0){ buildQueue.shift(); populationmax++; xpgained+=4; buildValue = 0; } if (buildValue === 100 && buildQueue.indexOf("big house") === 0){ populationmax+=4; buildQueue.shift(); xpgained += 10; buildValue = 0; } if (buildValue === 100 && buildQueue.indexOf("gold storage") === 0){ goldmax++; buildQueue.shift(); xpgained+=2; buildValue = 0; } if (buildValue === 100 && buildQueue.indexOf("food storage") === 0){ foodmax+=1; buildQueue.shift(); xpgained+=1; buildValue = 0; } if (buildValue === 100 && buildQueue.indexOf("wood storage") === 0){ woodmax++; buildQueue.shift(); xpgained+=1; buildValue = 0; } if (buildValue === 100 && buildQueue.indexOf("stone storage") === 0){ stonemax++; buildQueue.shift(); xpgained+=2; buildValue = 0; } if (buildValue === 100 && buildQueue.indexOf("iron storage") === 0){ ironmax++; buildQueue.shift(); xpgained+=4; buildValue = 0; } farmer.persec = farmer.amount * farmer.efficiency; lumberjack.persec = lumberjack.amount * lumberjack.efficiency; stoneminer.persec = stoneminer.amount * stoneminer.efficiency; ironminer.persec = ironminer.amount * ironminer.efficiency; if (questpoint < 5){ questpoint += questpointspeed/1000; } sellf = document.getElementById("sellfood").checked; sellw = document.getElementById("sellwood").checked; sells = document.getElementById("sellstone").checked; selli = document.getElementById("selliron").checked; if (food < foodmax){ food += farmer.persec/100; if (tasktype === "food"){ taskprogress += farmer.persec/100; } } if (wood < woodmax){ wood += lumberjack.persec/100; if (tasktype === "wood"){ taskprogress += lumberjack.persec/100; } } if (stone < stonemax){ stone += stoneminer.persec/100; if (tasktype === "stone"){ taskprogress += stoneminer.persec/100; } } if (iron < ironmax){ iron += ironminer.persec/100; if (tasktype === "iron"){ taskprogress += ironminer.persec/100; } } if (xp >= xpN-0.01){ level++; xp -= xpN; xpN += level/2; skillpoint++; spop("You have levelled up!") levelup(); if (level <= 50){ max = Math.floor(level/2); } if (level >= 51){ max = Math.floor((Math.random()*25)+1); } var rrandom = Math.floor((Math.random()*max)+1); if (level % 2 === 0 && level <= 25){ document.getElementById("up"+(level+1)).style.display = "block"; } document.getElementById("up"+rrandom).style.display = "block"; } if (heroxp >= heroxpN){ heroxp-=heroxpN; herolevel++; heroxpN *= Math.floor((Math.random()*3)+2); player.min_dmg += herolevel*5; player.max_dmg += herolevel*5; player.hpmax += herolevel*20; } if (xpgained >= 0){ xp += xpgained/100; if (tasktype === "xp"){ taskprogress += xpgained/100; } xpgained *= 0.99; } populationgain = populationrate*100; populationrate = population/10000; food -= population/5000; if (population < populationmax && food > 0 && population >= 2){ population += populationrate; } if (population > populationmax){ population -= 1/1000; } if (gold < goldmax){ gold += population/8000; } if (food <= 0){ population -= population/5000; document.getElementById("food").style.color = "red"; document.getElementById("food").style.fontSize = "30px"; } if (food > 0){ document.getElementById("food").style.fontSize = "20px"; document.getElementById("food").style.color = "green"; } if (population < 2){ document.getElementById("population").style.fontSize = "24px"; document.getElementById("population").style.color = "red"; } if (population > 2){ document.getElementById("population").style.fontSize = "20px"; document.getElementById("population").style.color = "black"; } if (skillpoint >= 1){ document.getElementById("skilltree").style.display = "block"; } if (skillpoint < 1){ document.getElementById("skilltree").style.display = "none"; } if (gold > goldmax){ gold = goldmax; } if (food > foodmax){ food = foodmax; } if (wood > woodmax){ wood = woodmax; } if (stone > stonemax){ stone = stonemax; } if (iron > ironmax){ iron = ironmax; } foodsellspeed = Math.abs(document.getElementById("foodsellspeed").value); woodsellspeed = Math.abs(document.getElementById("woodsellspeed").value); stonesellspeed = Math.abs(document.getElementById("stonesellspeed").value); ironsellspeed = Math.abs(document.getElementById("ironsellspeed").value); setTimeout(display,1); } display(); function openhire(){ document.getElementById("upgrades").style.display = "none"; document.getElementById("hire").style.display = "block"; document.getElementById("buildmenu").style.display = "none"; document.getElementById("quest").style.display = "none"; document.getElementById("tutorial").style.display = "none"; document.getElementById("map").style.display = "none"; } function openupgrades(){ document.getElementById("upgrades").style.display = "block"; document.getElementById("hire").style.display = "none"; document.getElementById("buildmenu").style.display = "none"; document.getElementById("quest").style.display = "none"; document.getElementById("tutorial").style.display = "none"; document.getElementById("map").style.display = "none"; } function openbuildmenu(){ document.getElementById("upgrades").style.display = "none"; document.getElementById("hire").style.display = "none"; document.getElementById("buildmenu").style.display = "block"; document.getElementById("quest").style.display = "none"; document.getElementById("tutorial").style.display = "none"; document.getElementById("map").style.display = "none"; } function openquest(){ document.getElementById("upgrades").style.display = "none"; document.getElementById("hire").style.display = "none"; document.getElementById("buildmenu").style.display = "none"; document.getElementById("quest").style.display = "block"; document.getElementById("tutorial").style.display = "none"; document.getElementById("map").style.display = "none"; } function opentutorial(){ document.getElementById("upgrades").style.display = "none"; document.getElementById("hire").style.display = "none"; document.getElementById("buildmenu").style.display = "none"; document.getElementById("quest").style.display = "none"; document.getElementById("tutorial").style.display = "block"; document.getElementById("map").style.display = "none"; } function openmap(){ document.getElementById("upgrades").style.display = "none"; document.getElementById("hire").style.display = "none"; document.getElementById("buildmenu").style.display = "none"; document.getElementById("quest").style.display = "none"; document.getElementById("tutorial").style.display = "none"; document.getElementById("map").style.display = "block"; } function showtime(){ time.sec+= 1; if (time.sec >= 60){ time.min++; time.sec -= 60; } if (time.min >= 60){ time.hour++; time.min -= 60; } if (population < 2){ population += 0.05; } document.getElementById("time").innerHTML = "You played for: "+time.hour+"h "+time.min+"min "+time.sec+"sec"; setTimeout(showtime,1000); } showtime(); function sellfood(){ if (food >= 1 && sellf){ food--; gold += 0.1; } setTimeout(sellfood,foodsellspeed); } function sellwood(){ if (wood >= 1 && sellw){ wood--; gold += 0.25; } setTimeout(sellwood,woodsellspeed); } function sellstone(){ if (stone >= 1 && sells){ stone--; gold += 0.5; } setTimeout(sellstone,stonesellspeed); } function selliron(){ if (iron >= 1 && selli){ iron--; gold += 1; } setTimeout(selliron,ironsellspeed); } sellfood(); sellwood(); sellstone(); selliron(); function hirefarmer(){ if (gold >= 1 && population >= 1){ gold -= 1; population -= 1; farmer.amount++; xpgained += 1; } } function hirelumberjack(){ if (gold >= 10 && population >= 5){ gold -= 10; lumberjack.amount++; population -= 5; xpgained += 5; } } function hirestoneminer(){ if(gold >= 25 && population >= 10){ gold -= 25; population -= 10; stoneminer.amount++; xpgained += 10; } } function hireironminer(){ if(gold >= 50 && population >= 10){ gold -= 50; population -= 10; ironminer.amount++; xpgained += 20; } } function house(){ if(wood >= 5){ wood -= 5; buildQueue.push("house"); } } function bighouse(){ if(wood >= 15){ wood -= 15; buildQueue.push("big house"); } } function gstore(){ if(gold >= 1.5){ gold -= 1.5; buildQueue.push("gold storage"); } } function fstore(){ if(gold >= 1){ gold--; buildQueue.push("food storage"); } } function wstore(){ if(gold >= 1){ gold--; buildQueue.push("wood storage"); } } function sstore(){ if(gold >= 2){ gold-=2; buildQueue.push("stone storage"); } } function istore(){ if(gold >= 4){ gold -= 4; buildQueue.push("iron storage"); } } function cancel(){ var userAns = confirm("Are you sure? (No refunds)"); if (userAns){ buildQueue.shift(); buildValue = 0; } } function quest(){ if (questpoint >= 1){ questpoint--; questloot(); } } function questloot(){ loot = Math.floor((Math.random()*level*20)+1)/100; var randomloot = Math.floor((Math.random()*6)+1); var showloot = ""; // GOLD if (randomloot === 1){ showloot = loot; document.getElementById("loot").innerHTML = "You have found +"+showloot.toFixed(2)+" gold!"; gold += loot; } // FOOD if (randomloot === 2){ showloot = loot; document.getElementById("loot").innerHTML = "You have found +"+showloot.toFixed(2)+" food!"; food += loot; } // WOOD if (randomloot === 3){ showloot = loot; document.getElementById("loot").innerHTML = "You have found +"+showloot.toFixed(2)+" wood!"; wood += loot; } // STONE if (randomloot === 4){ showloot = loot/2; document.getElementById("loot").innerHTML = "You have found +"+showloot.toFixed(2)+" stone!"; stone += loot/2; } // IRON if (randomloot === 5){ showloot = loot/5; document.getElementById("loot").innerHTML = "You have found +"+showloot.toFixed(2)+" iron!"; iron += loot/5; } if (randomloot === 6){ showloot = loot; document.getElementById("loot").innerHTML = "You have found +"+showloot.toFixed(2)+" XP!"; xpgained += loot; } } function up1(){ if (gold >= 3){ gold-=3; farmer.efficiency += 0.005; document.getElementById("up1").style.display = "none"; xpgained += 1; } } function up2(){ if (gold >= 2){ gold-=2; farmer.efficiency += 0.005; document.getElementById("up2").style.display = "none"; xpgained += 1; } } function up3(){ if (gold >= 4){ gold-=4; farmer.efficiency += 0.005; document.getElementById("up3").style.display = "none"; xpgained += 1.5; } } function up4(){ if (gold >= 6){ gold-=6; farmer.efficiency += 0.005; document.getElementById("up4").style.display = "none"; xpgained += 2.5; } } function up5(){ if (gold >= 5){ gold-=5; farmer.efficiency += 0.005; document.getElementById("up5").style.display = "none"; xpgained += 2; } } function up6(){ if(gold >= 3){ gold-=3; questpointspeed += 0.03; buildSpeed += 0.0005; document.getElementById("up6").style.display = "none"; xpgained += 1.5; } } function up7(){ if(gold >= 4){ gold-=4; questpointspeed += 0.03; buildSpeed += 0.0005; document.getElementById("up7").style.display = "none"; xpgained += 2; } } function up8(){ if(gold >= 6){ gold-=6; questpointspeed += 0.03; buildSpeed += 0.0005; document.getElementById("up8").style.display = "none"; xpgained += 3; } } function up9(){ if(gold >= 7){ gold-=7; questpointspeed += 0.03; buildSpeed += 0.0005; document.getElementById("up9").style.display = "none"; xpgained += 3.5; } } function up10(){ if(gold >= 8){ gold-=8; questpointspeed += 0.03; buildSpeed += 0.0005; document.getElementById("up10").style.display = "none"; xpgained += 4; } } function up11(){ if (gold >= 4){ gold -= 4; lumberjack.efficiency += 0.01; document.getElementById("up11").style.display = "none"; xgained += 2; } } function up12(){ if (gold >= 5){ gold -= 5; lumberjack.efficiency += 0.01; document.getElementById("up12").style.display = "none"; xgained += 2.5; } } function up13(){ if (gold >= 6){ gold -= 6; lumberjack.efficiency += 0.01; document.getElementById("up13").style.display = "none"; xgained += 3; } } function up14(){ if (gold >= 3){ gold -= 3; lumberjack.efficiency += 0.01; document.getElementById("up14").style.display = "none"; xgained += 1.5; } } function up15(){ if(gold >= 4){ gold -= 4; lumberjack.efficiency += 0.01; document.getElementById("up15").style.display = "none"; xgained += 2; } } function up16(){ if(gold >= 8){ gold -= 8; stoneminer.efficiency += 0.005; document.getElementById("up16").style.display = "none"; xgained += 4; } } function up17(){ if(gold >= 10){ gold -= 10; stoneminer.efficiency += 0.005; document.getElementById("up17").style.display = "none"; xgained += 5; } } function up18(){ if(gold >= 12){ gold -= 12; stoneminer.efficiency += 0.005; document.getElementById("up18").style.display = "none"; xgained += 6; } } function up19(){ if(gold >= 6){ gold -= 6; stoneminer.efficiency += 0.005; document.getElementById("up19").style.display = "none"; xgained += 3; } } function up20(){ if( gold >= 8){ gold -= 8; stoneminer.efficiency += 0.005; document.getElementById("up20").style.display = "none"; xpgained += 4; } } function up21(){ if( gold >= 16){ gold -= 16; ironminer.efficiency += 0.0025; document.getElementById("up21").style.display = "none"; xpgained += 8; } } function up22(){ if( gold >= 20){ gold -= 20; ironminer.efficiency += 0.0025; document.getElementById("up22").style.display = "none"; xpgained += 10; } } function up23(){ if( gold >= 24){ gold -= 24; ironminer.efficiency += 0.0025; document.getElementById("up23").style.display = "none"; xpgained += 12; } } function up24(){ if( gold >= 12){ gold -= 12; ironminer.efficiency += 0.0025; document.getElementById("up24").style.display = "none"; xpgained += 6; } } function up25(){ if( gold >= 16){ gold -= 16; ironminer.efficiency += 0.0025; document.getElementById("up25").style.display = "none"; xpgained += 8; } } // variables // map level // map // i // playerPos // http://fsymbols.com/signs/ // icons 💪😊 ☠ maplevel = 2; i = 1; currentLevel = 0; mapsize = 5; var log = []; function mapstuff(){ document.getElementById("map"+i).innerHTML = "✓"; document.getElementById("map25").innerHTML = "☠"; if (i >= currentLevel){ i = 1; } i++; if (currentLevel >= 26){ currentLevel = 0; document.getElementById("map1").innerHTML = ""; document.getElementById("map2").innerHTML = ""; document.getElementById("map3").innerHTML = ""; document.getElementById("map4").innerHTML = ""; document.getElementById("map5").innerHTML = ""; document.getElementById("map6").innerHTML = ""; document.getElementById("map7").innerHTML = ""; document.getElementById("map8").innerHTML = ""; document.getElementById("map9").innerHTML = ""; document.getElementById("map10").innerHTML = ""; document.getElementById("map11").innerHTML = ""; document.getElementById("map12").innerHTML = ""; document.getElementById("map13").innerHTML = ""; document.getElementById("map14").innerHTML = ""; document.getElementById("map15").innerHTML = ""; document.getElementById("map16").innerHTML = ""; document.getElementById("map17").innerHTML = ""; document.getElementById("map18").innerHTML = ""; document.getElementById("map19").innerHTML = ""; document.getElementById("map20").innerHTML = ""; document.getElementById("map21").innerHTML = ""; document.getElementById("map22").innerHTML = ""; document.getElementById("map23").innerHTML = ""; document.getElementById("map24").innerHTML = ""; document.getElementById("map25").innerHTML = ""; i = 1; } setTimeout(mapstuff,1); } mapstuff(); function nextlevel(){ enemy.hp = Math.floor((Math.random()*level*2)+level); enemy.min_dmg += level * 2; enemy.max_dmg += level * 2; enemy.hpmax += level * 10; if (currentLevel === 25){ enemy.hpmax += level * 100; enemy.min_dmg += level * 10; enemy.max_dmg += level * 10; } } function battle(){ if (player.hp > 0){ enemy.hp -= Math.floor((Math.random()*player.max_dmg)+player.min_dmg); player.hp -= Math.floor((Math.random()*enemy.max_dmg)+enemy.min_dmg); } if (enemy.hp < 0){ log.push("Killed a monster!
"); enemy.hpmax += Math.floor((Math.random()*25)+1); enemy.min_dmg += Math.floor((Math.random()*2)+1); enemy.max_dmg += Math.floor((Math.random()*4)+2); currentLevel++; var randloot = Math.floor((Math.random()*5)+1); var lootsize = Math.floor((Math.random()*level*3)+1)/10; if (randloot === 1){ log.push("Found +"+lootsize+" food!
"); food += lootsize; } if (randloot === 2){ log.push("Found +"+lootsize+" wood!
"); wood += lootsize; } if (randloot === 3){ log.push("Found +"+lootsize+" gold!
"); gold += lootsize; } if (randloot === 4){ log.push("Found +"+lootsize+" stone!
"); stone += lootsize; } if (randloot === 5){ log.push("Found +"+lootsize+" iron!
"); iron += lootsize; } log.push("Found +"+lootsize+" xp!
"); xpgained+=lootsize; heroxp+=enemy.hpmax/5; nextlevel(); } if (log.length >= 50){ log.shift(); } document.getElementById("log").innerHTML = log; setTimeout(battle,1000); } battle(); function sendtobattle(){ if (population >= 1){ player.hp = player.hpmax; population--; } } function buyattack(){ if (iron >= 1){ iron--; player.min_dmg += 5; player.max_dmg += 5; } } function buyhealth(){ if(iron >= 2){ iron-=2; player.hpmax += 30; } } function buyatk(){ if(wood >= 1){ wood--; player.min_dmg += 1; player.max_dmg += 1; } } function buyhp(){ if(wood >= 2){ wood -= 2; player.hpmax += 5; } } function build(){ if(gold >= 1){ buildValue += 20; gold--; } } function reward(){ population += 2; xpgained += 2; document.getElementById("reward").style.display = "none"; } function upgradebuild(){ if(gold >= 2){ gold-=2; buildSpeed += 0.0001; } } var randombutton; function levelup(){ document.getElementById("st1").style.display = "none"; document.getElementById("st2").style.display = "none"; document.getElementById("st3").style.display = "none"; document.getElementById("st4").style.display = "none"; document.getElementById("st5").style.display = "none"; document.getElementById("st6").style.display = "none"; document.getElementById("st7").style.display = "none"; document.getElementById("st8").style.display = "none"; document.getElementById("st9").style.display = "none"; document.getElementById("st10").style.display = "none"; document.getElementById("st11").style.display = "none"; document.getElementById("st12").style.display = "none"; document.getElementById("st13").style.display = "none"; document.getElementById("st14").style.display = "none"; randombutton = Math.floor((Math.random()*14)+1); document.getElementById("st"+randombutton).style.display = "block"; randombutton = Math.floor((Math.random()*14)+1); document.getElementById("st"+randombutton).style.display = "block"; randombutton = Math.floor((Math.random()*14)+1); document.getElementById("st"+randombutton).style.display = "block"; } function st1(){ buildSpeed += 0.001; skillpoint--; levelup(); } function st2(){ population += 2; skillpoint--; levelup(); } function st3(){ gold++; skillpoint--; levelup(); } function st4(){ wood += 2; skillpoint--; levelup(); } function st5(){ iron += 2; skillpoint--; levelup(); } function st6(){ foodmax += 5; skillpoint--; levelup(); } function st7(){ foodmax += 1; woodmax += 1; goldmax += 1; stonemax += 1; ironmax += 1; skillpoint--; levelup(); } function st8(){ populationmax++; skillpoint--; levelup(); } function st9(){ xpgained += xpN/4; skillpoint--; levelup(); } function st10(){ player.min_dmg += 10; player.max_dmg += 10; skillpoint--; levelup(); } function st11(){ player.hpmax += 20; skillpoint--; levelup(); } function st12(){ questpoint++; skillpoint--; levelup(); } function st13(){ farmer.amount += 2; skillpoint--; levelup(); } function st14(){ farmer.efficiency+= 0.01; skillpoint--; levelup(); } function settings(){ var pos = document.getElementById("position").selectedIndex; if (pos === 0){ position = "top-left"; } if (pos === 1){ position = "top-center"; } if (pos === 2){ position = "top-right"; } if (pos === 3){ position = "bottom-left"; } if (pos === 4){ position = "bottom-center"; } if (pos === 5){ position = "bottom-right"; } var closetime = document.getElementById("closetime").selectedIndex; if (closetime === 0){ closetime = false; } if (closetime === 1){ closetime = 2000; } if (closetime === 2){ closetime = 3000; } if (closetime === 3){ closetime = 4000; } if (closetime === 4){ closetime = 5000; } var color = document.getElementById("background").value; document.body.style.backgroundColor = color; spop.defaults = { style : 'error', autoclose : closetime, position : position, }; } setInterval(settings,1); function save(){ localStorage["gold"] = gold; localStorage["goldmax"] = goldmax; localStorage["food"] = food; localStorage["foodmax"] = foodmax; localStorage["wood"] = wood; localStorage["woodmax"] = woodmax; localStorage["stone"] = stone; localStorage["stonemax"] = stonemax; localStorage["iron"] = iron; localStorage["ironmax"] = ironmax; localStorage["level"] = level; localStorage["xp"] = xp; localStorage["xpN"] = xpN; localStorage["xpgained"] = xpgained; localStorage["questpoint"] = questpoint; localStorage["questpointspeed"] = questpointspeed; localStorage["buildSpeed"] = buildSpeed; localStorage["heroxp"] = heroxp; localStorage["herolevel"] = herolevel; localStorage["skillpoint"] = skillpoint; localStorage["population"] = population; localStorage["populationmax"] = populationmax; localStorage["farmer.efficiency"] = farmer.efficiency; localStorage["farmer.amount"] = farmer.amount; localStorage["lumberjack.efficiency"] = lumberjack.efficiency; localStorage["lumberjack.amount"] = lumberjack.amount; localStorage["stoneminer.efficiency"] = stoneminer.efficiency; localStorage["stoneminer.amount"] = stoneminer.amount; localStorage["ironminer.efficiency"] = ironminer.efficiency; localStorage["ironminer.amount"] = ironminer.amount; localStorage["time.sec"] = time.sec; localStorage["time.min"] = time.min; localStorage["time.hour"] = time.hour; localStorage["player.min_dmg"] = player.min_dmg; localStorage["player.max_dmg"] = player.max_dmg; localStorage["player.hp"] = player.hp; localStorage["player.hpmax"] = player.hpmax; localStorage["enemy.min_dmg"] = enemy.min_dmg; localStorage["enemy.max_dmg"] = enemy.max_dmg; localStorage["enemy.hp"] = enemy.hp; localStorage["enemy.hpmax"] = enemy.hpmax; spop("Game has been successfully saved!","success") } function load(){ if (localStorage.getItem("gold") === null){ spop('Save file has been corrupted!', 'error'); } if (localStorage.getItem("gold") !== null){ gold = parseFloat(localStorage["gold"]); goldmax = parseFloat(localStorage["goldmax"]); food = parseFloat(localStorage["food"]); foodmax = parseFloat(localStorage["foodmax"]); wood = parseFloat(localStorage["wood"]); woodmax = parseFloat(localStorage["woodmax"]); stone = parseFloat(localStorage["stone"]); stonemax = parseFloat(localStorage["stonemax"]); iron = parseFloat(localStorage["iron"]); ironmax = parseFloat(localStorage["ironmax"]); level = parseFloat(localStorage["level"]); xp = parseFloat(localStorage["xp"]); xpN = parseFloat(localStorage["xpN"]); xpgained = parseFloat(localStorage["xpgained"]); questpoint = parseFloat(localStorage["questpoint"]); questpointspeed = parseFloat(localStorage["questpointspeed"]); buildSpeed = parseFloat(localStorage["buildSpeed"]); heroxp = parseFloat(localStorage["heroxp"]); herolevel = parseFloat(localStorage["herolevel"]); skillpoint = parseFloat(localStorage["skillpoint"]); population = parseFloat(localStorage["population"]); populationmax = parseFloat(localStorage["populationmax"]); farmer.efficiency = parseFloat(localStorage["farmer.efficiency"]); farmer.amount = parseFloat(localStorage["farmer.amount"]); lumberjack.efficiency = parseFloat(localStorage["lumberjack.efficiency"]); lumberjack.amount = parseFloat(localStorage["lumberjack.amount"]); stoneminer.efficiency = parseFloat(localStorage["stoneminer.efficiency"]); stoneminer.amount = parseFloat(localStorage["stoneminer.amount"]); ironminer.efficiency = parseFloat(localStorage["ironminer.efficiency"]); ironminer.amount = parseFloat(localStorage["ironminer.amount"]); time.sec = parseInt(localStorage["time.sec"]); time.min = parseInt(localStorage["time.min"]); time.hour = parseInt(localStorage["time.hour"]); player.min_dmg = parseInt(localStorage["player.min_dmg"]); player.max_dmg = parseInt(localStorage["player.max_dmg"]); player.hp = parseInt(localStorage["player.hp"]); player.hpmax = parseInt(localStorage["player.hpmax"]); enemy.min_dmg = parseInt(localStorage["enemy.min_dmg"]); enemy.max_dmg = parseInt(localStorage["enemy.max_dmg"]); enemy.hp = parseInt(localStorage["enemy.hp"]); enemy.hpmax = parseInt(localStorage["enemy.hpmax"]); spop("Game has been successfully loaded!","success") } } setInterval(save,60000); function tip(){ var randomtip = tips[Math.floor(Math.random()*tips.length)+1] spop(randomtip,"default") } setInterval(tip,30000); function toggleFullScreen() { if ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitIsFullScreen)) { if (document.documentElement.requestFullScreen) { document.documentElement.requestFullScreen(); } else if (document.documentElement.mozRequestFullScreen) { document.documentElement.mozRequestFullScreen(); } else if (document.documentElement.webkitRequestFullScreen) { document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); } } else { if (document.cancelFullScreen) { document.cancelFullScreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } } } function tasks(){ document.getElementById("taskprogress").max = tasktoget; document.getElementById("taskprogress").value = taskprogress; document.getElementById("task").innerHTML = "Collect "+tasktype+"
"+taskprogress.toFixed(2)+" / "+tasktoget.toFixed(0); if (taskprogress >= tasktoget){ newtask(); taskreward(); } setTimeout(tasks,1); } tasks(); function newtask(){ if (level >= 15){ tasktype = Math.floor((Math.random()*5)+1); } if (level >= 10){ tasktype = Math.floor((Math.random()*4)+1); } if (level >= 5){ tasktype = Math.floor((Math.random()*3)+1); } if (level <= 4){ tasktype = Math.floor((Math.random()*1)+1); } taskprogress = 0; tasktoget = Math.floor((Math.random()*level*5)+level*2); if(tasktype === 1){ tasktype = "food"; } if(tasktype === 2){ tasktype = "wood"; tasktoget = tasktoget / 10; } if(tasktype === 3){ tasktype = "stone"; tasktoget = tasktoget / 20; } if(tasktype === 4){ tasktype = "iron"; tasktoget = tasktoget / 50; } if (tasktype === 5){ tasktype = "xp"; tasktoget = level * 4; } } newtask(); function taskreward(){ var amount = Math.floor((Math.random()*level*2)+level); var rewardtype = Math.floor((Math.random()*3)+1); if (rewardtype === 1){ food += amount; spop("TASK REWARD
You have received, "+amount+" food!") } if (rewardtype === 2){ wood += amount/10; spop("TASK REWARD
You have received, "+amount/10+" wood!") } if (rewardtype === 3){ gold += level/2; spop("TASK REWARD
You have received, "+level/2+" gold!") } } function reset(){ var userAns = confirm("Are you sure? It will delete your entire progress."); if (userAns){ gold = 5, goldmax = 5, food = 4, foodmax = 5, wood = 0, woodmax = 2, stone = 0, stonemax = 2, iron = 0, ironmax = 2, population = 3, populationrate = 0, populationgain = 0, populationmax = 5, level = 1, xp = 0, xpN = 2, xpgained = 0, questpoint = 0, questpointspeed = 1/20, random = 0, rand = 0, sellf = document.getElementById("sellfood").checked, sellw = document.getElementById("sellwood").checked, sells = document.getElementById("sellstone").checked, selli = document.getElementById("selliron").checked, selectedSpeed, sellingSpeed = 1000, buildValue = 0, buildQueue = [], buildSpeed = 1/100, loot, max, map = [], i = 1, maplevel = 1, playerPos = 0, currentLevel, mapsize, heroxp = 0, heroxpN = 1, herolevel = 1, skillpoint = 0, tasktype, tasktoget = 0, taskprogress = 0; farmer.persec= 0, farmer.efficiency= 0.01, farmer.amount= 0, lumberjack.persec= 0, lumberjack.efficiency= 0.01, lumberjack.amount= 0, stoneminer.persec= 0, stoneminer.efficiency= 0.02, stoneminer.amount= 0, ironminer.persec= 0, ironminer.efficiency= 0.01, ironminer.amount= 0, time.sec= 0, time.min= 0, time.hour= 0, player.min_dmg= 8, player.max_dmg= 12, player.hp= 0, player.hpmax= 20, enemy.min_dmg= 8, enemy.max_dmg= 12, enemy.hp= 20, enemy.hpmax= 20, spop("Game has been reset!","error"); save(); } } function checkall(){ document.getElementById("sellfood").checked = true; document.getElementById("sellwood").checked = true; document.getElementById("sellstone").checked = true; document.getElementById("selliron").checked = true; } function skiptask(){ if (gold >= 15){ gold -= 15; newtask(); } }
Host Instantly Drag and Drop Website Builder

 

Term
Mon, 11/27/2017 - 21:48

Related Codes

Pen ID
Pen ID
Pen ID