diff --git a/index.html b/index.html index bcdf23b..8dc8a19 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,10 @@ + + + + ß diff --git a/models/monsters/crazy-dove.js b/models/monsters/crazy-dove.js new file mode 100644 index 0000000..c511d23 --- /dev/null +++ b/models/monsters/crazy-dove.js @@ -0,0 +1,10 @@ +var CrazyDove = (function() { + function CrazyDove(level) { + Unit.call(this, 5, 25, level); + } + + CrazyDove.prototype = Object.create(Unit.prototype); + CrazyDove.prototype.constructor = CrazyDove; + + return CrazyDove; + })(); \ No newline at end of file diff --git a/models/monsters/dino-nerve.js b/models/monsters/dino-nerve.js new file mode 100644 index 0000000..85bf052 --- /dev/null +++ b/models/monsters/dino-nerve.js @@ -0,0 +1,10 @@ +var DinoNerve = (function() { + function DinoNerve(level) { + Unit.call(this, 20, 900, level); + } + + DinoNerve.prototype = Object.create(Unit.prototype); + DinoNerve.prototype.constructor = DinoNerve; + + return DinoNerve; + })(); \ No newline at end of file diff --git a/models/monsters/greedy-pig.js b/models/monsters/greedy-pig.js new file mode 100644 index 0000000..4e3e63c --- /dev/null +++ b/models/monsters/greedy-pig.js @@ -0,0 +1,11 @@ +var GreedyPig = (function() { + function GreedyPig(level) { + Unit.call(this, 80, 10, level); + } + + GreedyPig.prototype = Object.create(Unit.prototype); + GreedyPig.prototype.constructor = GreedyPig; + + return GreedyPig; + })(); + \ No newline at end of file diff --git a/models/monsters/lazy-ira.js b/models/monsters/lazy-ira.js new file mode 100644 index 0000000..391c54e --- /dev/null +++ b/models/monsters/lazy-ira.js @@ -0,0 +1,10 @@ +var LazyIra = (function() { + function LazyIra(level) { + Unit.call(this, 10, 1000, level); + } + + LazyIra.prototype = Object.create(Unit.prototype); + LazyIra.prototype.constructor = LazyIra; + + return LazyIra; + })(); \ No newline at end of file diff --git a/models/unit.js b/models/unit.js index 45d2572..01ebdb6 100644 --- a/models/unit.js +++ b/models/unit.js @@ -8,8 +8,11 @@ var Unit = (function() { this.level = level; } - Unit.prototype.attack = function() { - console.log('Attack', this); + Unit.prototype.attack = function(monster) { + if (monster instanceof Unit) { + return this.health -= monster.damage; + } + console.error('You are not a monster!') }; Unit.prototype.render = function() {