Comparing version 0.0.42 to 0.0.43
@@ -81,7 +81,7 @@ 'use strict'; | ||
this.units.forEach(function (unit) { | ||
var protection = _this.trainings.find(function (b) { | ||
return b.key === 'protection'; | ||
}); | ||
if (protection) unit.defense = unit.defense + unit.defense / 100 * protection.lvl; | ||
if (unit.spec.type === 'Melee') { | ||
var protection = _this.trainings.find(function (b) { | ||
return b.key === 'protection'; | ||
}); | ||
if (protection) unit.defense = unit.defense + unit.defense / 50 * protection.lvl; | ||
@@ -91,3 +91,3 @@ var closecombat = _this.trainings.find(function (b) { | ||
}); | ||
if (closecombat) unit.attack = unit.attack + unit.attack / 100 * closecombat.lvl; | ||
if (closecombat) unit.attack = unit.attack + unit.attack / 1000 * closecombat.lvl; | ||
} else { | ||
@@ -99,3 +99,3 @@ //ALL RANGE | ||
if (firearms) { | ||
unit.attack = unit.attack + unit.attack / 100 * firearms.lvl; | ||
unit.attack = unit.attack + unit.attack / 1000 * firearms.lvl; | ||
} | ||
@@ -108,3 +108,3 @@ | ||
}); | ||
if (sniping) unit.attack = unit.attack + unit.attack / 100 * sniping.lvl; | ||
if (sniping) unit.attack = unit.attack + unit.attack / 1000 * sniping.lvl; | ||
} | ||
@@ -117,3 +117,3 @@ | ||
}); | ||
if (bomb) unit.attack = unit.attack + unit.attack / 100 * bomb.lvl; | ||
if (bomb) unit.attack = unit.attack + unit.attack / 1000 * bomb.lvl; | ||
} | ||
@@ -127,4 +127,4 @@ | ||
if (psychological) { | ||
unit.attack = unit.attack + unit.attack / 100 * psychological.lvl; | ||
unit.defense = unit.defense + unit.attack / 100 * psychological.lvl; | ||
unit.attack = unit.attack + unit.attack / 1000 * psychological.lvl; | ||
unit.defense = unit.defense + unit.attack / 1000 * psychological.lvl; | ||
} | ||
@@ -138,3 +138,3 @@ } | ||
}); | ||
if (chemical) unit.attack = unit.attack + unit.attack / 100 * chemical.lvl; | ||
if (chemical) unit.attack = unit.attack + unit.attack / 1000 * chemical.lvl; | ||
} | ||
@@ -141,0 +141,0 @@ } |
@@ -44,6 +44,6 @@ 'use strict'; | ||
value: function takeDamages(damages, skill_type, round, name, num) { | ||
// damages = damages - (this.defense/10) | ||
damages = damages - this.defense; | ||
var current = ''; | ||
if (this.name === 'attacker') current = "D";else current = "A"; | ||
var currentlog = '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with ' + parseFloat(this.health).toFixed(2) + ' HP take <span style="color:red">' + damages + ' DMG</span> from [' + current + '] ' + name + ' (' + num + ') with <span style="color:blueviolet"> "' + skill_type + '"</span>.'; | ||
var currentlog = '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with ' + parseFloat(this.health).toFixed(2) + ' HP take <span style="color:red">' + parseFloat(damages).toFixed(2) + ' DMG</span> from [' + current + '] ' + name + ' (' + num + ') with <span style="color:blueviolet"> "' + skill_type + '"</span>.'; | ||
@@ -50,0 +50,0 @@ if (this.type === 'Melee' && skill_type === 'accuratehit' && this.type != 'tastynasty') { |
{ | ||
"name": "drugwars", | ||
"version": "0.0.42", | ||
"version": "0.0.43", | ||
"description": "A lightweight JavaScript library for DrugWars", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -58,11 +58,11 @@ import { orderBy } from 'lodash'; | ||
this.units.forEach(unit => { | ||
const protection = this.trainings.find(b => b.key === 'protection'); | ||
if(protection) | ||
unit.defense = unit.defense + unit.defense/100*protection.lvl; | ||
if(unit.spec.type === 'Melee') | ||
{ | ||
const protection = this.trainings.find(b => b.key === 'protection'); | ||
if(protection) | ||
unit.defense = unit.defense + unit.defense/50*protection.lvl; | ||
const closecombat = this.trainings.find(b => b.key === 'closecombat'); | ||
if(closecombat) | ||
unit.attack = unit.attack + unit.attack /100 * closecombat.lvl; | ||
unit.attack = unit.attack + unit.attack /1000 * closecombat.lvl; | ||
} | ||
@@ -74,3 +74,3 @@ else{ | ||
{ | ||
unit.attack = unit.attack + unit.attack /100 * firearms.lvl; | ||
unit.attack = unit.attack + unit.attack /1000 * firearms.lvl; | ||
} | ||
@@ -83,3 +83,3 @@ | ||
if(sniping) | ||
unit.attack = unit.attack + unit.attack /100 * sniping.lvl; | ||
unit.attack = unit.attack + unit.attack /1000 * sniping.lvl; | ||
} | ||
@@ -92,3 +92,3 @@ | ||
if(bomb) | ||
unit.attack = unit.attack + unit.attack /100 * bomb.lvl; | ||
unit.attack = unit.attack + unit.attack /1000 * bomb.lvl; | ||
} | ||
@@ -102,4 +102,4 @@ | ||
{ | ||
unit.attack = unit.attack + unit.attack /100 *psychological.lvl; | ||
unit.defense = unit.defense + unit.attack /100 *psychological.lvl; | ||
unit.attack = unit.attack + unit.attack /1000 *psychological.lvl; | ||
unit.defense = unit.defense + unit.attack /1000 *psychological.lvl; | ||
} | ||
@@ -113,3 +113,3 @@ } | ||
if(chemical) | ||
unit.attack = unit.attack + unit.attack /100 *chemical.lvl; | ||
unit.attack = unit.attack + unit.attack /1000 *chemical.lvl; | ||
} | ||
@@ -116,0 +116,0 @@ |
@@ -22,3 +22,3 @@ import units from './units.json'; | ||
takeDamages(damages,skill_type,round,name,num) { | ||
// damages = damages - (this.defense/10) | ||
damages = damages - (this.defense) | ||
let current ='' | ||
@@ -28,3 +28,3 @@ if(this.name === 'attacker') | ||
else current = "A" | ||
let currentlog = `[${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with ${parseFloat(this.health).toFixed(2)} HP take <span style="color:red">${damages} DMG</span> from [${current}] ${name} (${num}) with <span style="color:blueviolet"> "${skill_type}"</span>.` | ||
let currentlog = `[${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with ${parseFloat(this.health).toFixed(2)} HP take <span style="color:red">${parseFloat(damages).toFixed(2)} DMG</span> from [${current}] ${name} (${num}) with <span style="color:blueviolet"> "${skill_type}"</span>.` | ||
@@ -31,0 +31,0 @@ if(this.type === 'Melee' && skill_type === 'accuratehit' && this.type != 'tastynasty') |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2279941