Comparing version 0.1.63 to 0.1.64
103
lib/army.js
@@ -88,3 +88,3 @@ 'use strict'; | ||
}); | ||
if (kamikaze) unit.attack = unit.attack + unit.attack / 100 * kamikaze.lvl; | ||
if (kamikaze) unit.attack = unit.attack + unit.attack * kamikaze.lvl / 100; | ||
} else { | ||
@@ -94,3 +94,3 @@ var protection = _this.trainings.find(function (b) { | ||
}); | ||
if (protection) unit.health = unit.health + unit.health / 100 * protection.lvl; | ||
if (protection) unit.health = unit.health + unit.health * protection.lvl / 100; | ||
//ALL MELEE | ||
@@ -101,3 +101,3 @@ if (unit.spec.type === 'Melee') { | ||
}); | ||
if (closecombat) unit.attack = unit.attack + unit.attack / 100 * closecombat.lvl; | ||
if (closecombat) unit.attack = unit.attack + unit.attack * closecombat.lvl / 100; | ||
} else { | ||
@@ -108,3 +108,3 @@ var firearms = _this.trainings.find(function (b) { | ||
if (firearms) { | ||
unit.attack = unit.attack + unit.attack / 100 * firearms.lvl; | ||
unit.attack = unit.attack + unit.attack * firearms.lvl / 100; | ||
} | ||
@@ -116,3 +116,3 @@ } | ||
}); | ||
if (sniping) unit.attack = unit.attack + unit.attack / 100 * sniping.lvl; | ||
if (sniping) unit.attack = unit.attack + unit.attack * sniping.lvl / 100; | ||
} else if (unit.key === "bazooka") { | ||
@@ -122,3 +122,3 @@ var bomb = _this.trainings.find(function (b) { | ||
}); | ||
if (bomb) unit.attack = unit.attack + unit.attack / 100 * bomb.lvl; | ||
if (bomb) unit.attack = unit.attack + unit.attack * bomb.lvl / 100; | ||
} | ||
@@ -131,3 +131,3 @@ //WEAPON | ||
if (_firearms) { | ||
unit.attack = unit.attack + unit.attack / 100 * _firearms.lvl; | ||
unit.attack = unit.attack + unit.attack * _firearms.lvl / 100; | ||
} | ||
@@ -140,3 +140,3 @@ } | ||
}); | ||
if (fire) unit.attack = unit.attack + unit.attack / 100 * fire.lvl; | ||
if (fire) unit.attack = unit.attack + unit.attack * fire.lvl / 100; | ||
} | ||
@@ -149,3 +149,3 @@ | ||
}); | ||
if (chemical) unit.attack = unit.attack + unit.attack / 100 * chemical.lvl; | ||
if (chemical) unit.attack = unit.attack + unit.attack * chemical.lvl / 100; | ||
} | ||
@@ -159,4 +159,4 @@ | ||
if (psychological) { | ||
unit.attack = unit.attack + unit.attack / 200 * psychological.lvl; | ||
unit.defense = unit.defense + unit.defense / 200 * psychological.lvl; | ||
unit.attack = unit.attack + unit.attack * psychological.lvl / 200; | ||
unit.defense = unit.defense + unit.defense * psychological.lvl / 200; | ||
} | ||
@@ -312,12 +312,3 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
var _leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if (_leftdamage > 0) { | ||
console.log('damage left from' + serie[0].author); | ||
attack = {}; | ||
attack.author = serie[0].author; | ||
attack.num = serie[0].num; | ||
attack.dmg = _leftdamage; | ||
serie.push(attack); | ||
} | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
serie.splice(0, 1); | ||
@@ -335,17 +326,6 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
leftdamage = 0; | ||
if (unit.type !== 'Range') { | ||
leftdamage = unit.takeGroupDamages(serie[0].dmg / 2 * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
} else leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
unit.takeGroupDamages(serie[0].dmg / 2 * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
} else unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if (leftdamage > 0) { | ||
console.log('damage left from' + serie[0].author); | ||
attack = {}; | ||
attack.author = serie[0].author; | ||
attack.num = serie[0].num; | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -363,17 +343,7 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
leftdamage = 0; | ||
if (unit.type !== 'Melee') { | ||
leftdamage = unit.takeGroupDamages(serie[0].dmg / 2 * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
} else leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
unit.takeGroupDamages(serie[0].dmg / 2 * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
} else unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if (leftdamage > 0) { | ||
console.log('damage left from' + serie[0].author); | ||
attack = {}; | ||
attack.author = serie[0].author; | ||
attack.num = serie[0].num; | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -398,12 +368,4 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
var _leftdamage2 = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if (_leftdamage2 > 0) { | ||
console.log('damage left from' + serie[0].author); | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
attack = {}; | ||
attack.author = serie[0].author; | ||
attack.num = serie[0].num; | ||
attack.dmg = _leftdamage2; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -421,12 +383,4 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
var _leftdamage3 = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if (_leftdamage3 > 0) { | ||
console.log('damage left from' + serie[0].author); | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
attack = {}; | ||
attack.author = serie[0].author; | ||
attack.num = serie[0].num; | ||
attack.dmg = _leftdamage3; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -438,12 +392,3 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
var _leftdamage4 = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if (_leftdamage4 > 0) { | ||
console.log('damage left from' + serie[0].author); | ||
attack = {}; | ||
attack.author = serie[0].author; | ||
attack.num = serie[0].num; | ||
attack.dmg = _leftdamage4; | ||
serie.push(attack); | ||
} | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
serie.splice(0, 1); | ||
@@ -463,12 +408,4 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
var _leftdamage5 = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if (_leftdamage5 > 0) { | ||
console.log('damage left from' + serie[0].author); | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
attack = {}; | ||
attack.author = serie[0].author; | ||
attack.num = serie[0].num; | ||
attack.dmg = _leftdamage5; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -475,0 +412,0 @@ } |
@@ -607,4 +607,4 @@ { | ||
"feature": "BODYSHIELD : This unit will take also 1 of the next hit.", | ||
"attack": 4, | ||
"health": 3, | ||
"attack": 6, | ||
"health": 4, | ||
"defense":2, | ||
@@ -641,3 +641,3 @@ "weapon_defense":4, | ||
"attack": 7, | ||
"health": 5, | ||
"health": 6, | ||
"defense":2, | ||
@@ -673,4 +673,4 @@ "weapon_defense":6, | ||
"feature": "CRITICAL CHARGE : At each round, the sniper will increase its damage per 2*X, where X is the number of that round.", | ||
"attack": 7, | ||
"health": 6, | ||
"attack": 8, | ||
"health": 8, | ||
"defense":3, | ||
@@ -706,4 +706,4 @@ "weapon_defense":7, | ||
"feature": "DODGE : He will dodge 1 deadly hits. No matter the damage. Elite.", | ||
"attack": 10, | ||
"health": 10, | ||
"attack": 12, | ||
"health": 12, | ||
"defense":2, | ||
@@ -739,5 +739,5 @@ "weapon_defense":5, | ||
"feature": "GRENADE : Hits 5 enemies at once.", | ||
"attack": 10, | ||
"health": 10, | ||
"defense":3, | ||
"attack": 15, | ||
"health": 15, | ||
"defense":2, | ||
"weapon_defense":8, | ||
@@ -774,3 +774,3 @@ "fire_defense":10, | ||
"health": 20, | ||
"defense":5, | ||
"defense":6, | ||
"weapon_defense":6, | ||
@@ -777,0 +777,0 @@ "fire_defense":4, |
{ | ||
"name": "drugwars", | ||
"version": "0.1.63", | ||
"version": "0.1.64", | ||
"description": "A lightweight JavaScript library for DrugWars", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
103
src/army.js
@@ -58,3 +58,3 @@ import { orderBy } from 'lodash'; | ||
if (kamikaze) | ||
unit.attack = unit.attack + (unit.attack / 100 * kamikaze.lvl); | ||
unit.attack = unit.attack + (unit.attack * kamikaze.lvl / 100 ); | ||
} | ||
@@ -64,3 +64,3 @@ else { | ||
if (protection) | ||
unit.health = unit.health + (unit.health / 100 * protection.lvl); | ||
unit.health = unit.health + (unit.health * protection.lvl / 100); | ||
//ALL MELEE | ||
@@ -70,3 +70,3 @@ if (unit.spec.type === 'Melee') { | ||
if (closecombat) | ||
unit.attack = unit.attack + (unit.attack / 100 * closecombat.lvl); | ||
unit.attack = unit.attack + (unit.attack * closecombat.lvl / 100); | ||
} | ||
@@ -76,3 +76,3 @@ else { | ||
if (firearms) { | ||
unit.attack = unit.attack + (unit.attack / 100 * firearms.lvl); | ||
unit.attack = unit.attack + (unit.attack * firearms.lvl / 100); | ||
} | ||
@@ -83,3 +83,3 @@ } | ||
if (sniping) | ||
unit.attack = unit.attack + (unit.attack / 100 * sniping.lvl); | ||
unit.attack = unit.attack + (unit.attack * sniping.lvl / 100); | ||
} | ||
@@ -89,3 +89,3 @@ else if (unit.key === "bazooka") { | ||
if (bomb) | ||
unit.attack = unit.attack + (unit.attack / 100 * bomb.lvl); | ||
unit.attack = unit.attack + (unit.attack * bomb.lvl / 100); | ||
} | ||
@@ -96,3 +96,3 @@ //WEAPON | ||
if (firearms) { | ||
unit.attack = unit.attack + (unit.attack / 100 * firearms.lvl); | ||
unit.attack = unit.attack + (unit.attack * firearms.lvl / 100); | ||
} | ||
@@ -104,3 +104,3 @@ } | ||
if (fire) | ||
unit.attack = unit.attack + (unit.attack / 100 * fire.lvl); | ||
unit.attack = unit.attack + (unit.attack * fire.lvl / 100); | ||
} | ||
@@ -112,3 +112,3 @@ | ||
if (chemical) | ||
unit.attack = unit.attack + (unit.attack / 100 * chemical.lvl); | ||
unit.attack = unit.attack + (unit.attack * chemical.lvl / 100); | ||
} | ||
@@ -120,4 +120,4 @@ | ||
if (psychological) { | ||
unit.attack = unit.attack + (unit.attack / 200 * psychological.lvl); | ||
unit.defense = unit.defense + (unit.defense / 200 * psychological.lvl); | ||
unit.attack = unit.attack + (unit.attack * psychological.lvl / 200); | ||
unit.defense = unit.defense + (unit.defense * psychological.lvl / 200); | ||
} | ||
@@ -273,12 +273,3 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
let leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if(leftdamage > 0){ | ||
console.log('damage left from' + serie[0].author) | ||
attack = {} | ||
attack.author = serie[0].author | ||
attack.num = serie[0].num | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
serie.splice(0, 1); | ||
@@ -296,20 +287,9 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
leftdamage = 0; | ||
if(unit.type !== 'Range') | ||
{ | ||
leftdamage = unit.takeGroupDamages((serie[0].dmg/2) * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
unit.takeGroupDamages((serie[0].dmg/2) * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
} | ||
else | ||
leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if(leftdamage > 0){ | ||
console.log('damage left from' + serie[0].author) | ||
attack = {} | ||
attack.author = serie[0].author | ||
attack.num = serie[0].num | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -327,20 +307,10 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
leftdamage = 0; | ||
if(unit.type !== 'Melee') | ||
{ | ||
leftdamage = unit.takeGroupDamages((serie[0].dmg/2) * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
unit.takeGroupDamages((serie[0].dmg/2) * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
} | ||
else | ||
leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if(leftdamage > 0){ | ||
console.log('damage left from' + serie[0].author) | ||
attack = {} | ||
attack.author = serie[0].author | ||
attack.num = serie[0].num | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -365,12 +335,4 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
let leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if(leftdamage > 0){ | ||
console.log('damage left from' + serie[0].author) | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
attack = {} | ||
attack.author = serie[0].author | ||
attack.num = serie[0].num | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -388,12 +350,4 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
let leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if(leftdamage > 0){ | ||
console.log('damage left from' + serie[0].author) | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
attack = {} | ||
attack.author = serie[0].author | ||
attack.num = serie[0].num | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -405,12 +359,3 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
let leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if(leftdamage > 0){ | ||
console.log('damage left from' + serie[0].author) | ||
attack = {} | ||
attack.author = serie[0].author | ||
attack.num = serie[0].num | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
serie.splice(0, 1); | ||
@@ -430,12 +375,4 @@ } | ||
if (unit.undead > 0 && serie.length > 0) { | ||
let leftdamage = unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
if(leftdamage > 0){ | ||
console.log('damage left from' + serie[0].author) | ||
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead); | ||
attack = {} | ||
attack.author = serie[0].author | ||
attack.num = serie[0].num | ||
attack.dmg = leftdamage; | ||
serie.push(attack); | ||
} | ||
serie.splice(0, 1); | ||
@@ -442,0 +379,0 @@ } |
@@ -607,4 +607,4 @@ { | ||
"feature": "BODYSHIELD : This unit will take also 1 of the next hit.", | ||
"attack": 4, | ||
"health": 3, | ||
"attack": 6, | ||
"health": 4, | ||
"defense":2, | ||
@@ -641,3 +641,3 @@ "weapon_defense":4, | ||
"attack": 7, | ||
"health": 5, | ||
"health": 6, | ||
"defense":2, | ||
@@ -673,4 +673,4 @@ "weapon_defense":6, | ||
"feature": "CRITICAL CHARGE : At each round, the sniper will increase its damage per 2*X, where X is the number of that round.", | ||
"attack": 7, | ||
"health": 6, | ||
"attack": 8, | ||
"health": 8, | ||
"defense":3, | ||
@@ -706,4 +706,4 @@ "weapon_defense":7, | ||
"feature": "DODGE : He will dodge 1 deadly hits. No matter the damage. Elite.", | ||
"attack": 10, | ||
"health": 10, | ||
"attack": 12, | ||
"health": 12, | ||
"defense":2, | ||
@@ -739,5 +739,5 @@ "weapon_defense":5, | ||
"feature": "GRENADE : Hits 5 enemies at once.", | ||
"attack": 10, | ||
"health": 10, | ||
"defense":3, | ||
"attack": 15, | ||
"health": 15, | ||
"defense":2, | ||
"weapon_defense":8, | ||
@@ -774,3 +774,3 @@ "fire_defense":10, | ||
"health": 20, | ||
"defense":5, | ||
"defense":6, | ||
"weapon_defense":6, | ||
@@ -777,0 +777,0 @@ "fire_defense":4, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2980367
17099