New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

drugwars

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drugwars - npm Package Compare versions

Comparing version 0.0.97 to 0.0.98

192

lib/army.js

@@ -48,49 +48,29 @@ 'use strict';

this.log = log;
this.groupid = 0;
this.groupid = 1;
units.forEach(function (unit) {
var effect = _units2.default[unit.key].skill.effect;
if (unit.amount > 0) {
if (_units2.default[unit.key].skill.type === "group" && !unit.key === 'spy' || _units2.default[unit.key].skill.type === "group" && (_this.name === 'attacker' || _this.name === 'defender' && unit.key === 'hobo' && unit.amount < 50000)) {
var group_amount = unit.amount;
while (group_amount > 0) {
if (group_amount >= effect) {
group_amount = group_amount - effect;
_this.groups.push(new _troop2.default(unit.key, effect, _this.groupid++, name, log));
} else {
if (group_amount > 0) {
_this.groups.push(new _troop2.default(unit.key, group_amount, _this.groupid++, name, log));
group_amount = 0;
}
var baseAmount = _units2.default[unit.key].group;
if (_this.name === "defender" && unit.key === 'spy') {} else if (_this.name === "defender" && unit.key === 'hobo') {} else if (unit.amount > 0) {
var group_amount = unit.amount;
while (group_amount > 0) {
if (group_amount >= baseAmount) {
group_amount = group_amount - baseAmount;
_this.groups.push(new _troop2.default(unit.key, Number(baseAmount), _this.groupid++, name, log));
} else {
if (group_amount > 0) {
_this.groups.push(new _troop2.default(unit.key, Number(group_amount), _this.groupid++, name, log));
group_amount = 0;
}
}
} else if (_this.name === 'attacker' && unit.key === 'hobo' && unit.amount > 25000) {
var units_per_group = 0;
if (unit.amount > 100000) {
units_per_group = 5000;
} else if (unit.amount > 50000) {
units_per_group = 1000;
} else if (unit.amount > 25000) {
units_per_group = 500;
} else if (unit.amount > 15000) {
units_per_group = 100;
}
var _group_amount = unit.amount;
while (_group_amount > 0) {
if (_group_amount >= units_per_group) {
_group_amount = _group_amount - units_per_group;
_this.groups.push(new _troop2.default(unit.key, units_per_group, _this.groupid++, name, log));
} else {
if (_group_amount > 0) {
_this.groups.push(new _troop2.default(unit.key, _group_amount, _this.groupid++, name, log));
_group_amount = 0;
}
}
}
} else {
for (var i = 0; i < unit.amount; i += 1) {
if (_this.name === 'defender' && unit.key === 'hobo' || _this.name === 'defender' && unit.key === 'spy') {} else {
_this.units.push(new _unit2.default(unit.key, i + 1, name, log));
}
}
}
// else{
// for (let i = 0; i < unit.amount; i += 1) {
// if (this.name === 'defender' && unit.key === 'hobo' || this.name === 'defender' && unit.key === 'spy' ) {
// }
// else
// {
// this.units.push(new Unit(unit.key, i + 1, name, log));
// }
// }
// }
}

@@ -102,3 +82,3 @@ });

//ATTRIBUTE TRAINING MODIFICATOR
this.units.forEach(function (unit) {
this.groups.forEach(function (unit) {
// HOBO

@@ -187,26 +167,15 @@ if (unit.key === "hobo") {

var actions = [];
this.units.forEach(function (unit) {
if (!unit.dead && unit.spec.attack > 0) {
if (round != 1 || unit.spec.range > 4 || unit.spec.skill.type === 'tastynasty' || unit.key === 'hobo') {
// if(unit.use > 0 || unit.use === -1)
// {
// actions.push([unit.attack, unit.skill, unit.key, unit.i]);
// }
// else{
// unit.skill_type = 'attack'
// actions.push([unit.attack, unit.skill, unit.key, unit.i]);
// }
actions.push([unit.attack, unit.skill, unit.key, unit.i]);
}
if (unit.health < 0 || unit.health === 0 && !unit.dead) unit.kill();
}
});
this.groups.forEach(function (group) {
if (group.undead > 0 && round != 1) {
if (group.undead > 0 && group.key != 'spy' && round != 1 || group.spec.range > 4 || group.spec.skill.type === 'tastynasty' || group.key === 'hobo') {
var attack = group.getAttack();
if (attack > 0) {
actions.push([attack, group.skill, group.key, group.i]);
actions.push([attack, group.skill, group.key, group.i, parseInt(group.undead)]);
}
} else if (group.undead > 0 && group.key != 'spy') {
var _attack = group.getAttack() / 3;
if (_attack > 0) {
actions.push([_attack, group.skill, group.key, group.i, parseInt(group.undead / 3)]);
}
}
if (group.grouhealth < 0 || group.grouhealth === 0 && !group.dead) group.kill();
if (group.grouphealth < 0 || group.grouphealth === 0 && !group.dead) group.kill();
});

@@ -227,6 +196,4 @@ return actions;

value: function processArmyActions(target, actions, attackpower, round) {
var _this2 = this;
var unitsSorted = (0, _lodash.orderBy)(this.units, ['priority'], ['asc']);
var unitsByHighestPriority = (0, _lodash.orderBy)(this.units, ['priority'], ['desc']);
var unitsSorted = (0, _lodash.orderBy)(this.groups, ['priority'], ['asc']);
var unitsByHighestPriority = (0, _lodash.orderBy)(this.groups, ['priority'], ['desc']);
actions.forEach(function (action) {

@@ -237,2 +204,3 @@ var serie = [];

var num = action[3];
var undead = action[4];
var attack = 0;

@@ -262,4 +230,4 @@ var buff = 0;

unitsSorted.forEach(function (unit) {
if (serie.length > 0 && !unit.dead) {
unit.takeBuff(serie[0].points, skill_type, round, serie[0].author, serie[0].num);
if (serie.length > 0 && unit.undead > 0) {
unit.takeGroupBuff(serie[0].points, skill_type, round, serie[0].author, serie[0].num);
serie.splice(0, 1);

@@ -274,3 +242,3 @@ }

attack.num = num;
attack.dmg = parseInt(action[1].effect);
attack.dmg = action[0];
for (var _i = 0; _i < action[1].range; _i += 1) {

@@ -296,4 +264,4 @@ serie.push(attack);

unitsSorted.forEach(function (unit) {
if (!unit.dead && serie.length > 0) {
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num);
if (unit.undead > 0 && serie.length > 0) {
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead);
serie.splice(0, 1);

@@ -317,4 +285,4 @@ }

unitsByHighestPriority.forEach(function (unit) {
if (!unit.dead && serie.length > 0) {
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num);
if (unit.undead > 0 && serie.length > 0) {
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead);
serie.splice(0, 1);

@@ -330,13 +298,8 @@ }

serie.push(attack);
console.log(name);
break;
}
_this2.groups.forEach(function (group) {
if (group.undead > 0 && serie.length > 0) {
group.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num);
serie.splice(0, 1);
}
});
unitsSorted.forEach(function (unit) {
if (!unit.dead && serie.length > 0) {
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num);
if (unit.undead > 0 && serie.length > 0) {
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num, undead);
serie.splice(0, 1);

@@ -353,9 +316,9 @@ }

value: function updateAliveStatus() {
var unitsAlive = this.units.filter(function (unit) {
return !unit.dead;
}).length;
var groupAlive = this.groups.filter(function (group) {
return !group.dead;
}).length;
if (!unitsAlive && !groupAlive) {
var size = 0;
this.groups.forEach(function (group) {
if (group.undead > 0) {
size += Number(group.undead);
}
});
if (size < 1) {
this.alive = false;

@@ -367,5 +330,9 @@ }

value: function size() {
return this.units.filter(function (unit) {
return !unit.dead;
}).length;
var size = 0;
this.groups.forEach(function (group) {
if (group.undead > 0) {
size += Number(group.undead);
}
});
return size;
}

@@ -378,14 +345,7 @@ }, {

var alcohol_cost = 0;
this.units.forEach(function (unit) {
if (!unit.dead) {
drug_cost += _units2.default[unit.key].drugs_cost;
weapon_cost += _units2.default[unit.key].weapons_cost;
alcohol_cost += _units2.default[unit.key].alcohols_cost;
}
});
this.groups.forEach(function (group) {
if (!group.dead) {
drug_cost += _units2.default[group.key].drugs_cost * group.amount;
weapon_cost += _units2.default[group.key].weapons_cost * group.amount;
alcohol_cost += _units2.default[group.key].alcohols_cost * group.amount;
if (group.undead > 0) {
drug_cost += _units2.default[group.key].drugs_cost * group.undead;
weapon_cost += _units2.default[group.key].weapons_cost * group.undead;
alcohol_cost += _units2.default[group.key].alcohols_cost * group.undead;
}

@@ -399,4 +359,4 @@ });

var supply = 0;
this.units.forEach(function (unit) {
if (!unit.dead) supply += _units2.default[unit.key].supply;
this.groups.forEach(function (unit) {
if (unit.undead > 0) supply += _units2.default[unit.key].supply * unit.undead;
});

@@ -409,4 +369,4 @@ return supply;

var capacity = 0;
this.units.forEach(function (unit) {
if (!unit.dead) capacity += _units2.default[unit.key].capacity;
this.groups.forEach(function (unit) {
if (unit.undead > 0) capacity += _units2.default[unit.key].capacity * unit.undead;
});

@@ -419,4 +379,4 @@ return capacity;

var supply = 0;
this.units.forEach(function (unit) {
if (!unit.dead) supply += _units2.default[unit.key].supply;
this.groups.forEach(function (unit) {
if (unit.undead > 0) supply += _units2.default[unit.key].supply * unit.undead;
});

@@ -437,4 +397,4 @@ var power = Math.round(100 - parseFloat(supply / 6).toFixed(0) / 100);

var supply = 0;
this.units.forEach(function (unit) {
if (!unit.dead) supply += _units2.default[unit.key].supply;
this.groups.forEach(function (unit) {
if (unit.undead > 0) supply += _units2.default[unit.key].supply * unit.undead;
});

@@ -465,12 +425,2 @@ var power = Math.round(100 - parseFloat(supply / 5).toFixed(0) / 100);

});
this.units.forEach(function (unit) {
if (!unitsObj[unit.key]) {
unitsObj[unit.key] = {
amount: 0,
dead: 0
};
}
unitsObj[unit.key].amount += 1;
unitsObj[unit.key].dead += unit.dead ? 1 : 0;
});

@@ -477,0 +427,0 @@ return (0, _keys2.default)(unitsObj).map(function (key) {

@@ -46,2 +46,3 @@ 'use strict';

this.log.add('Fight start [A] Attacker - [D] Defender');
var sendDate = new Date().getTime();
var attackers = new _army2.default(this.attackers, 'attacker', this.attackersTrainings, null, this.log);

@@ -56,6 +57,8 @@ var defenders = new _army2.default(this.defenders, 'defender', this.defendersTrainings, this.defendersBuildings, this.log);

round += 1;
this.log.add('Round ' + round);
this.log.add('<div class="round">Round ' + round + ' Attacker AP : ' + attackers.attackPower() + '% - Defender AP : ' + defenders.defensiveAttackPower() + '%</div>');
var defendersActions = defenders.chooseActions(round);
var attackersActions = attackers.chooseActions(round);
defenders.processAllActions(defendersActions, attackers.attackPower(), attackersActions, round);
defendersActions = defenders.chooseActions(round);
attackersActions = attackers.chooseActions(round);
attackers.processAllActions(attackersActions, defenders.defensiveAttackPower(), defendersActions, round);

@@ -76,2 +79,4 @@ }

this.log.add('Fight ended in round ' + round + ', Winner is : ' + winner);
var receiveDate = new Date().getTime();
console.log('Ended in ' + (receiveDate - sendDate + 'ms'));
return {

@@ -78,0 +83,0 @@ result: result,

@@ -33,3 +33,3 @@ 'use strict';

this.health = _units2.default[key].health;
this.grouhealth = _units2.default[key].health * amount;
this.grouphealth = _units2.default[key].health * amount;
this.max_health = _units2.default[key].health;

@@ -52,12 +52,45 @@ this.dead = 0;

key: 'takeGroupDamages',
value: function takeGroupDamages(damage, skill_type, round, name, num) {
value: function takeGroupDamages(damage, sender_skill, round, name, num, sender_amount) {
var damages = 5;
if (damage - this.defense > 0) damages = damage - this.defense;
if (damage - this.defense > 0) damages = parseInt(damage - this.defense);
var current = '';
if (this.name === 'attacker') current = "D";else current = "A";
var currentlog = '[' + this.name.substring(0, 1).toUpperCase() + '] group (' + this.i + ') with ' + this.undead + ' x ' + this.key + ' with ' + parseFloat(this.grouhealth).toFixed(3) + ' HP take <span style="color:red">' + damages + ' DMG</span> from [' + current + '] ' + name + ' (' + num + ') with <span style="color:blueviolet"> "' + skill_type + '"</span>.';
this.grouhealth = this.grouhealth - damages;
var healthAfterDamage = this.grouhealth;
var healthAfterDamage = this.grouphealth;
this.undead = Math.floor(healthAfterDamage / this.health);
var currentlog = '<div class="tick ' + this.name + '">';
if (this.type === 'Melee' && sender_skill === 'accuratehit' && this.type != 'tastynasty') {
currentlog += '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') took <span style="color:red"> ' + damages / 10 + ' DMG</span> bonus.';
this.grouphealth = this.grouphealth - damages / 10;
healthAfterDamage = this.grouphealth;
}
if (this.type === 'Range' && sender_skill === 'accurateprecision') {
currentlog += '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') took <span style="color:red"> ' + damages / 10 + ' DMG</span> bonus.';
this.grouphealth = this.grouphealth - damages / 10;
healthAfterDamage = this.grouphealth;
}
if (this.skill.type === 'shield' && this.use > 0 && this.undead != this.amount && this.grouphealth + this.skill.effect * this.undead < this.amount * this.max_health) {
currentlog += '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') used his (' + this.use + ') shield. ';
this.use -= 1;
this.grouphealth = this.grouphealth + this.skill.effect * this.undead;
healthAfterDamage = this.grouphealth;
}
if (this.skill.type === 'bulletproof' && this.grouphealth < damages && this.use > 0) {
currentlog += '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') used his (' + this.use + ') bulletproof.';
this.use -= 1;
this.grouphealth = 250 * this.undead;
healthAfterDamage = this.grouphealth;
} else if (this.skill.type === 'dodge' && this.use > 0 && damages > this.grouphealth) {
this.use -= 1;
currentlog += '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ')<span style="color:blueviolet"> dodged</span> ' + parseFloat(damages).toFixed(0) + ' DMG.';
} else {
currentlog += '[' + this.name.substring(0, 1).toUpperCase() + '] (' + this.i + ') with ' + this.undead + ' x ' + this.key + ' with <span style="color:green">' + parseFloat(this.grouphealth).toFixed(0) + '</span> HP take <span style="color:red">' + parseFloat(damages).toFixed(0) + ' DMG</span> from [' + current + '] (' + num + ') with ' + sender_amount + ' x ' + name + ' <span style="color:blueviolet"> "' + sender_skill + '"</span>.';
this.grouphealth = this.grouphealth - damages;
healthAfterDamage = this.grouphealth;
}
if (healthAfterDamage <= 0) {
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] group (' + this.i + ') ' + this.undead + ' x ' + this.key + ' are <span style="color:darkorange">now dead.</span>';
currentlog += '<br/> [' + this.name.substring(0, 1).toUpperCase() + '] (' + this.i + ') ' + this.undead + ' x ' + this.key + ' are <span style="color:darkorange">now dead.</span>';
this.dead = Number(this.amount);

@@ -67,6 +100,5 @@ this.undead = 0;

} else {
var undead = Math.ceil(healthAfterDamage / this.health);
var undead = parseInt(Math.floor(healthAfterDamage / this.health));
if (undead !== this.undead) {
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + undead + ' x ' + this.key + ' group (' + this.i + ') are left.';
currentlog += '<br/> [' + this.name.substring(0, 1).toUpperCase() + '] (' + this.i + ') ' + undead + ' x ' + this.key + ' are left.';
this.dead += Number(this.undead - undead);

@@ -76,2 +108,3 @@ this.undead = undead;

}
currentlog += "</div>";
this.log.add(currentlog);

@@ -81,5 +114,5 @@ }

key: 'takeGroupBuff',
value: function takeGroupBuff(points, skill_type, round, name, num) {
if (this.health < this.max_health && skill_type === 'heal' || this.health < this.max_health && skill_type === 'groupheal') {
this.log.add(' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with ' + this.health + ' HP take ' + skill_type + ' <span style="color:chartreuse">+' + points + ' HP</span> from [' + this.name.substring(0, 1).toUpperCase() + '] ' + name + ' (' + num + ').');
value: function takeGroupBuff(points, sender_skill, round, name, num) {
if (this.health < this.max_health && sender_skill === 'heal' || this.health < this.max_health && sender_skill === 'groupheal') {
this.log.add('<br/> [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with ' + this.health + ' HP take ' + sender_skill + ' <span style="color:chartreuse">+' + points + ' HP</span> from [' + this.name.substring(0, 1).toUpperCase() + '] (' + num + ') with' + name + ' .');
this.health = this.health + points;

@@ -86,0 +119,0 @@ if (this.health > this.max_health) this.health = this.max_health;

@@ -49,3 +49,3 @@ 'use strict';

if (this.name === 'attacker') current = "D";else current = "A";
var currentlog = '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with <span style="color:green">' + parseFloat(this.health).toFixed(2) + '</span> HP and ' + this.defense + ' DEF take <span style="color:red">' + damages + ' DMG</span> from [' + current + '] ' + name + ' (' + num + ') with <span style="color:blueviolet"> "' + sender_skill + '"</span>.';
var currentlog = '[' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with <span style="color:green">' + parseFloat(this.health).toFixed(0) + '</span> HP and ' + this.defense + ' DEF take <span style="color:red">' + damages + ' DMG</span> from [' + current + '] ' + name + ' (' + num + ') with <span style="color:blueviolet"> "' + sender_skill + '"</span>.';

@@ -77,3 +77,3 @@ if (this.type === 'Melee' && sender_skill === 'accuratehit' && this.type != 'tastynasty') {

this.health = this.health - damages;
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') got now <span style="color:green">' + parseFloat(this.health).toFixed(2) + '</span> HP.';
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') got now <span style="color:green">' + parseFloat(this.health).toFixed(0) + '</span> HP.';
} else {

@@ -89,3 +89,3 @@ currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') is <span style="color:darkorange">now dead.</span>';

if (this.health < this.max_health && sender_skill === 'heal' || this.health < this.max_health && sender_skill === 'groupheal') {
this.log.add(' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with <span style="color:green">' + parseFloat(this.health).toFixed(2) + '</span> HP and ' + this.defense + ' DEF take ' + sender_skill + ' <span style="color:chartreuse">+' + points + ' HP</span> from [' + this.name.substring(0, 1).toUpperCase() + '] ' + name + ' (' + num + ').');
this.log.add(' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') with <span style="color:green">' + parseFloat(this.health).toFixed(0) + '</span> HP and ' + this.defense + ' DEF take ' + sender_skill + ' <span style="color:chartreuse">+' + points + ' HP</span> from [' + this.name.substring(0, 1).toUpperCase() + '] ' + name + ' (' + num + ').');
this.health = this.health + points;

@@ -92,0 +92,0 @@ if (this.health > this.max_health) this.health = this.max_health;

@@ -12,8 +12,9 @@ {

"attack": 5,
"health": 20,
"defense":10,
"weapon_defense":10,
"fire_defense":10,
"chemical_defense":10,
"health": 2,
"defense":1,
"weapon_defense":1,
"fire_defense":1,
"chemical_defense":1,
"dmg_type":"physical",
"group":5000,
"speed": 3,

@@ -30,3 +31,3 @@ "range": 3,

"use":-1,
"skill": {"type":"group","effect":100,"range":1,"use":-1,"passive":true}
"skill": {"type":"spy","effect":1,"range":1,"use":-1,"passive":true}
},

@@ -42,3 +43,3 @@ "hobo": {

"feature": "GROUP KAMIKAZE : If he meets an enemy he will die. This unit can not defend and split into group if they are a lot!",
"attack": 130,
"attack": 13,
"health": 0,

@@ -50,2 +51,3 @@ "defense":0,

"dmg_type":"physical",
"group":5000,
"speed": 13,

@@ -73,9 +75,10 @@ "range": 1,

"feature": "GROUP : The rowdy always fights in groups of 4.",
"attack": 200,
"health": 300,
"defense":40,
"weapon_defense":20,
"attack": 20,
"health": 30,
"defense":4,
"weapon_defense":2,
"fire_defense":0,
"chemical_defense":0,
"dmg_type":"weapon",
"group":4000,
"speed": 12,

@@ -103,9 +106,10 @@ "range": 1,

"feature": "SHIELD : He can use it once and obtain +200 health.",
"attack": 500,
"health": 1400,
"defense":60,
"weapon_defense":40,
"fire_defense":20,
"chemical_defense":20,
"attack": 50,
"health": 140,
"defense":6,
"weapon_defense":4,
"fire_defense":2,
"chemical_defense":2,
"dmg_type":"physical",
"group":3000,
"speed": 11,

@@ -122,3 +126,3 @@ "range": 1,

"use":1,
"skill": {"type":"shield","effect":200,"range":1,"use":1,"passive":true}
"skill": {"type":"shield","effect":20,"range":1,"use":1,"passive":true}
},

@@ -134,9 +138,10 @@ "big_mama": {

"feature": "GROUPHEAL : She can heal 5 allies for 200HP at each round. Elite.",
"attack": 500,
"health": 21000,
"defense":80,
"weapon_defense":80,
"fire_defense":80,
"chemical_defense":80,
"attack": 50,
"health": 2100,
"defense":8,
"weapon_defense":8,
"fire_defense":8,
"chemical_defense":8,
"dmg_type":"physical",
"group":1000,
"speed": 20,

@@ -164,9 +169,10 @@ "range": 3,

"feature": "TASTY NASTY : He does not respect any rules, not even those about priority. Elite.",
"attack": 600,
"health": 400,
"defense":50,
"weapon_defense":20,
"fire_defense":20,
"chemical_defense":20,
"attack": 60,
"health": 40,
"defense":5,
"weapon_defense":2,
"fire_defense":2,
"chemical_defense":2,
"dmg_type":"chemical",
"group":2000,
"speed": 10,

@@ -194,9 +200,10 @@ "range": 1,

"feature": "ACCURATE HIT : He's pretty good against melee and gives a bonus damage.",
"attack": 1600,
"health": 1200,
"defense":50,
"weapon_defense":10,
"fire_defense":30,
"chemical_defense":20,
"attack": 160,
"health": 120,
"defense":5,
"weapon_defense":1,
"fire_defense":3,
"chemical_defense":2,
"dmg_type":"fire",
"group":1500,
"speed": 9,

@@ -224,9 +231,10 @@ "range": 5,

"feature": "FORTUNE : Each lawyer reduce the safe of your opponent by 0.01% (max 5%). This unit cover himself behind your big mamas.",
"attack": 200,
"health": 2000,
"defense":50,
"weapon_defense":50,
"fire_defense":50,
"chemical_defense":50,
"attack": 20,
"health": 200,
"defense":5,
"weapon_defense":5,
"fire_defense":5,
"chemical_defense":5,
"dmg_type":"physical",
"group":1000,
"speed": 14,

@@ -254,9 +262,10 @@ "range": 3,

"feature": "CRITICAL CHARGE : At each round, the sniper will increase its damage per 1.5*X, where X is the number of that round.",
"attack": 1500,
"health": 900,
"defense":50,
"weapon_defense":20,
"fire_defense":10,
"chemical_defense":20,
"attack": 150,
"health": 90,
"defense":5,
"weapon_defense":2,
"fire_defense":1,
"chemical_defense":2,
"dmg_type":"weapon",
"group":1500,
"speed": 14,

@@ -284,9 +293,10 @@ "range": 6,

"feature": "MULTIPLE HIT : He will use two guns to take two shots.",
"attack": 1100,
"health": 1500,
"defense":50,
"weapon_defense":30,
"fire_defense":40,
"chemical_defense":100,
"attack": 110,
"health": 150,
"defense":7,
"weapon_defense":3,
"fire_defense":4,
"chemical_defense":10,
"dmg_type":"weapon",
"group":1000,
"speed": 8,

@@ -314,9 +324,10 @@ "range": 5,

"feature": "DODGE : She will dodge 2 deadly hits. No matter the damage. Elite.",
"attack": 4000,
"health": 3000,
"defense":100,
"weapon_defense":50,
"fire_defense":30,
"chemical_defense":60,
"attack": 400,
"health": 300,
"defense":5,
"weapon_defense":5,
"fire_defense":3,
"chemical_defense":6,
"dmg_type":"physical",
"group":1000,
"speed": 6,

@@ -344,9 +355,10 @@ "range": 4,

"feature": "SPLASH : Hits 10 enemies at once.",
"attack": 6000,
"health": 2500,
"defense":50,
"weapon_defense":40,
"fire_defense":10,
"chemical_defense":10,
"attack": 600,
"health": 250,
"defense":7,
"weapon_defense":4,
"fire_defense":1,
"chemical_defense":1,
"dmg_type":"fire",
"group":500,
"speed": 17,

@@ -374,9 +386,10 @@ "range": 7,

"feature": "BULLETPROOF : This unit will obtain 250HP back when he reaches 0. Elite.",
"attack": 10000,
"health": 7500,
"attack": 1000,
"health": 750,
"defense":80,
"weapon_defense":60,
"fire_defense":40,
"chemical_defense":40,
"weapon_defense":6,
"fire_defense":4,
"chemical_defense":4,
"dmg_type":"chemical",
"group":500,
"speed": 15,

@@ -404,9 +417,10 @@ "range": 6,

"feature": "BUILDER : Permit to occup new base and expand your empire.",
"attack": 1000,
"health": 20000,
"defense":40,
"weapon_defense":50,
"attack": 100,
"health": 2000,
"defense":4,
"weapon_defense":5,
"fire_defense":0,
"chemical_defense":50,
"chemical_defense":5,
"dmg_type":"physical",
"group":500,
"speed": 35,

@@ -434,9 +448,10 @@ "range": 4,

"feature": "GROUP : The guard always fights in groups of 2.",
"attack": 250,
"health": 400,
"defense":20,
"weapon_defense":20,
"attack": 20,
"health": 25,
"defense":2,
"weapon_defense":2,
"fire_defense":0,
"chemical_defense":0,
"dmg_type":"weapon",
"group":1000,
"speed": 12,

@@ -464,9 +479,10 @@ "range": 1,

"feature": "ACCURATE PRECISION : He's pretty good against range and gives a bonus damage.",
"attack": 1600,
"health": 1200,
"defense":20,
"weapon_defense":10,
"fire_defense":30,
"chemical_defense":20,
"attack": 70,
"health": 60,
"defense":2,
"weapon_defense":1,
"fire_defense":3,
"chemical_defense":2,
"dmg_type":"fire",
"group":500,
"speed": 9,

@@ -494,9 +510,10 @@ "range": 5,

"feature": "BODYSHIELD : This unit will take also 1 of the next hit.",
"attack": 200,
"health": 10000,
"attack": 25,
"health": 600,
"defense":30,
"weapon_defense":40,
"fire_defense":20,
"chemical_defense":20,
"weapon_defense":4,
"fire_defense":2,
"chemical_defense":2,
"dmg_type":"physical",
"group":500,
"speed": 11,

@@ -524,9 +541,10 @@ "range": 1,

"feature": "MULTIPLE HIT : He will use two guns to take two shots.",
"attack": 3000,
"health": 4000,
"attack": 120,
"health": 280,
"defense":20,
"weapon_defense":60,
"fire_defense":40,
"chemical_defense":40,
"weapon_defense":6,
"fire_defense":4,
"chemical_defense":4,
"dmg_type":"chemical",
"group":250,
"speed": 15,

@@ -543,3 +561,3 @@ "range": 6,

"use":1,
"skill": {"type":"multiplehit","effect":700,"range":3,"use":-1,"passive":true}
"skill": {"type":"multiplehit","effect":120,"range":3,"use":-1,"passive":true}
},

@@ -555,9 +573,10 @@ "elitesniper": {

"feature": "CRITICAL CHARGE : At each round, the sniper will increase its damage per 2*X, where X is the number of that round.",
"attack": 1500,
"health": 900,
"defense":20,
"weapon_defense":20,
"fire_defense":10,
"chemical_defense":20,
"attack": 100,
"health": 80,
"defense":2,
"weapon_defense":2,
"fire_defense":1,
"chemical_defense":2,
"dmg_type":"weapon",
"group":250,
"speed": 14,

@@ -574,3 +593,3 @@ "range": 6,

"use":-1,
"skill": {"type":"criticalhit","effect":1500,"range":2,"use":-1,"passive":false}
"skill": {"type":"criticalhit","effect":150,"range":2,"use":-1,"passive":false}
},

@@ -586,9 +605,10 @@ "fbi": {

"feature": "DODGE : He will dodge 1 deadly hits. No matter the damage. Elite.",
"attack": 5000,
"health": 4000,
"defense":30,
"weapon_defense":50,
"fire_defense":30,
"chemical_defense":60,
"attack": 400,
"health": 300,
"defense":3,
"weapon_defense":5,
"fire_defense":3,
"chemical_defense":6,
"dmg_type":"physical",
"group":250,
"speed": 6,

@@ -616,9 +636,10 @@ "range": 4,

"feature": "GRENADE : Hits 15 enemies at once.",
"attack": 6000,
"health": 2500,
"defense":30,
"weapon_defense":40,
"fire_defense":10,
"chemical_defense":10,
"attack": 500,
"health": 250,
"defense":3,
"weapon_defense":4,
"fire_defense":1,
"chemical_defense":1,
"dmg_type":"fire",
"group":250,
"speed": 17,

@@ -646,9 +667,10 @@ "range": 7,

"feature": "BULLETPROOF : This unit will obtain 500HP back when he reaches 0. Elite.",
"attack": 15000,
"health": 10000,
"defense":40,
"weapon_defense":60,
"fire_defense":40,
"chemical_defense":40,
"attack": 800,
"health": 800,
"defense":4,
"weapon_defense":6,
"fire_defense":4,
"chemical_defense":4,
"dmg_type":"chemical",
"group":250,
"speed": 15,

@@ -655,0 +677,0 @@ "range": 6,

{
"name": "drugwars",
"version": "0.0.97",
"version": "0.0.98",
"description": "A lightweight JavaScript library for DrugWars",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -15,16 +15,22 @@ import { orderBy } from 'lodash';

this.log = log;
this.groupid = 0;
this.groupid = 1;
units.forEach(unit => {
const effect = dwunits[unit.key].skill.effect
if(unit.amount>0)
const baseAmount = dwunits[unit.key].group;
if(this.name === "defender" && unit.key ==='spy')
{
if(dwunits[unit.key].skill.type === "group" && !unit.key === 'spy' || dwunits[unit.key].skill.type === "group" && (this.name === 'attacker' || this.name === 'defender' && unit.key === 'hobo' && unit.amount < 50000 ))
{
}
else if(this.name ==="defender" && unit.key ==='hobo')
{
}
else if(unit.amount>0)
{
let group_amount = unit.amount;
while(group_amount>0)
{
if(group_amount >= effect)
if(group_amount >= baseAmount)
{
group_amount = group_amount - effect
this.groups.push(new Troop(unit.key, effect, this.groupid++, name, log));
group_amount = group_amount - baseAmount
this.groups.push(new Troop(unit.key, Number(baseAmount), this.groupid++, name, log));
}

@@ -34,3 +40,3 @@ else{

{
this.groups.push(new Troop(unit.key, group_amount, this.groupid++, name, log));
this.groups.push(new Troop(unit.key, Number(group_amount), this.groupid++, name, log));
group_amount = 0

@@ -40,50 +46,13 @@ }

}
}
else if (this.name === 'attacker' && unit.key === 'hobo' && unit.amount > 25000)
{
let units_per_group = 0;
if(unit.amount > 100000)
{
units_per_group = 5000;
}
else if(unit.amount > 50000)
{
units_per_group = 1000;
}
else if(unit.amount > 25000)
{
units_per_group = 500;
}
else if(unit.amount > 15000)
{
units_per_group = 100;
}
let group_amount = unit.amount;
while(group_amount>0)
{
if(group_amount >= units_per_group)
{
group_amount = group_amount - units_per_group
this.groups.push(new Troop(unit.key, units_per_group, this.groupid++, name, log));
}
else{
if(group_amount>0)
{
this.groups.push(new Troop(unit.key, group_amount, this.groupid++, name, log));
group_amount = 0
}
}
}
}
else{
for (let i = 0; i < unit.amount; i += 1) {
if (this.name === 'defender' && unit.key === 'hobo' || this.name === 'defender' && unit.key === 'spy' ) {
// else{
// for (let i = 0; i < unit.amount; i += 1) {
// if (this.name === 'defender' && unit.key === 'hobo' || this.name === 'defender' && unit.key === 'spy' ) {
}
else
{
this.units.push(new Unit(unit.key, i + 1, name, log));
}
}
}
// }
// else
// {
// this.units.push(new Unit(unit.key, i + 1, name, log));
// }
// }
// }
}

@@ -98,3 +67,3 @@ });

//ATTRIBUTE TRAINING MODIFICATOR
this.units.forEach(unit => {
this.groups.forEach(unit => {
// HOBO

@@ -182,27 +151,16 @@ if(unit.key === "hobo")

const actions = [];
this.units.forEach(unit => {
if (!unit.dead && unit.spec.attack > 0) {
if(round != 1 || unit.spec.range > 4 || unit.spec.skill.type === 'tastynasty' || unit.key === 'hobo' )
{
// if(unit.use > 0 || unit.use === -1)
// {
// actions.push([unit.attack, unit.skill, unit.key, unit.i]);
// }
// else{
// unit.skill_type = 'attack'
// actions.push([unit.attack, unit.skill, unit.key, unit.i]);
// }
actions.push([unit.attack, unit.skill, unit.key, unit.i]);
}
if (unit.health < 0 || unit.health === 0 && !unit.dead) unit.kill();
}
});
this.groups.forEach(group => {
if (group.undead > 0 && round != 1) {
if (group.undead > 0 && group.key != 'spy' && round != 1 || group.spec.range > 4 || group.spec.skill.type === 'tastynasty' || group.key === 'hobo') {
const attack = group.getAttack();
if (attack > 0) {
actions.push([attack, group.skill, group.key, group.i]);
actions.push([attack, group.skill, group.key, group.i, parseInt(group.undead)]);
}
}
if (group.grouhealth < 0 || group.grouhealth === 0 && !group.dead) group.kill();
else if(group.undead > 0 && group.key != 'spy'){
const attack = group.getAttack()/3;
if (attack > 0) {
actions.push([attack, group.skill, group.key, group.i,parseInt(group.undead/3)]);
}
}
if (group.grouphealth < 0 || group.grouphealth === 0 && !group.dead) group.kill();
});

@@ -219,4 +177,4 @@ return actions;

processArmyActions(target, actions, attackpower,round) {
const unitsSorted = orderBy(this.units, ['priority'], ['asc']);
const unitsByHighestPriority = orderBy(this.units, ['priority'], ['desc']);
const unitsSorted = orderBy(this.groups, ['priority'], ['asc']);
const unitsByHighestPriority = orderBy(this.groups, ['priority'], ['desc']);
actions.forEach(action => {

@@ -227,2 +185,3 @@ const serie = [];

const num = action[3];
const undead = action[4];
let attack = 0;

@@ -252,4 +211,4 @@ let buff = 0;

unitsSorted.forEach(unit => {
if (serie.length > 0 && !unit.dead) {
unit.takeBuff(serie[0].points , skill_type, round ,serie[0].author, serie[0].num);
if (serie.length > 0 && unit.undead>0) {
unit.takeGroupBuff(serie[0].points , skill_type, round ,serie[0].author, serie[0].num);
serie.splice(0, 1);

@@ -265,3 +224,3 @@ }

attack.num = num
attack.dmg = parseInt(action[1].effect);
attack.dmg = action[0];
for (let i = 0; i < action[1].range; i += 1) {

@@ -287,4 +246,4 @@ serie.push(attack);

unitsSorted.forEach(unit => {
if (!unit.dead && serie.length > 0) {
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round , serie[0].author, serie[0].num);
if (unit.undead>0 && serie.length > 0) {
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round , serie[0].author, serie[0].num,undead);
serie.splice(0, 1);

@@ -308,4 +267,4 @@ }

unitsByHighestPriority.forEach(unit => {
if (!unit.dead && serie.length > 0) {
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round,serie[0].author, serie[0].num);
if (unit.undead>0 && serie.length > 0) {
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round,serie[0].author, serie[0].num,undead);
serie.splice(0, 1);

@@ -320,14 +279,9 @@ }

attack.dmg = action[0];
serie.push(attack);
serie.push(attack);
console.log(name)
break;
}
this.groups.forEach(group => {
if (group.undead > 0 && serie.length > 0) {
group.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round , serie[0].author, serie[0].num);
serie.splice(0, 1);
}
})
unitsSorted.forEach(unit => {
if (!unit.dead && serie.length > 0) {
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round , serie[0].author, serie[0].num);
if (unit.undead>0 && serie.length > 0) {
unit.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round , serie[0].author, serie[0].num,undead);
serie.splice(0, 1);

@@ -343,5 +297,9 @@ }

updateAliveStatus() {
const unitsAlive = this.units.filter(unit => !unit.dead).length;
const groupAlive = this.groups.filter(group => !group.dead).length;
if (!unitsAlive && !groupAlive) {
let size = 0;
this.groups.forEach(group => {
if (group.undead>0) {
size += Number(group.undead)
}
});
if (size<1) {
this.alive = false;

@@ -352,3 +310,9 @@ }

size() {
return this.units.filter(unit => !unit.dead).length
let size = 0;
this.groups.forEach(group => {
if (group.undead>0) {
size += Number(group.undead)
}
});
return size
}

@@ -360,14 +324,7 @@

let alcohol_cost = 0;
this.units.forEach(unit => {
if (!unit.dead) {
drug_cost += dwunits[unit.key].drugs_cost
weapon_cost += dwunits[unit.key].weapons_cost
alcohol_cost += dwunits[unit.key].alcohols_cost
}
});
this.groups.forEach(group => {
if (!group.dead) {
drug_cost += dwunits[group.key].drugs_cost * group.amount
weapon_cost += dwunits[group.key].weapons_cost * group.amount
alcohol_cost += dwunits[group.key].alcohols_cost * group.amount
if (group.undead>0) {
drug_cost += dwunits[group.key].drugs_cost * group.undead
weapon_cost += dwunits[group.key].weapons_cost * group.undead
alcohol_cost += dwunits[group.key].alcohols_cost * group.undead
}

@@ -380,5 +337,5 @@ });

let supply = 0;
this.units.forEach(unit => {
if (!unit.dead)
supply += dwunits[unit.key].supply
this.groups.forEach(unit => {
if (unit.undead>0)
supply += dwunits[unit.key].supply * unit.undead
});

@@ -390,5 +347,5 @@ return supply

let capacity = 0;
this.units.forEach(unit => {
if (!unit.dead)
capacity += dwunits[unit.key].capacity
this.groups.forEach(unit => {
if (unit.undead>0)
capacity += dwunits[unit.key].capacity * unit.undead
});

@@ -400,5 +357,5 @@ return capacity

let supply = 0;
this.units.forEach(unit => {
if (!unit.dead)
supply += dwunits[unit.key].supply
this.groups.forEach(unit => {
if (unit.undead>0)
supply += dwunits[unit.key].supply * unit.undead
});

@@ -420,5 +377,5 @@ let power = Math.round(100 - parseFloat(supply / 6).toFixed(0) / 100)

let supply = 0;
this.units.forEach(unit => {
if (!unit.dead)
supply += dwunits[unit.key].supply
this.groups.forEach(unit => {
if (unit.undead>0)
supply += dwunits[unit.key].supply * unit.undead
});

@@ -450,12 +407,2 @@ let power = Math.round(100 - parseFloat(supply / 5).toFixed(0) / 100)

})
this.units.forEach(unit => {
if (!unitsObj[unit.key]) {
unitsObj[unit.key] = {
amount: 0,
dead: 0,
};
}
unitsObj[unit.key].amount += 1;
unitsObj[unit.key].dead += unit.dead ? 1 : 0;
});

@@ -462,0 +409,0 @@ return Object.keys(unitsObj).map(key => {

@@ -18,2 +18,3 @@ import Army from './army';

this.log.add('Fight start [A] Attacker - [D] Defender');
const sendDate = (new Date()).getTime();
const attackers = new Army(this.attackers, 'attacker', this.attackersTrainings, null, this.log);

@@ -28,6 +29,8 @@ const defenders = new Army(this.defenders, 'defender', this.defendersTrainings, this.defendersBuildings, this.log);

round += 1;
this.log.add(`Round ${round}`);
this.log.add(`<div class="round">Round ${round} Attacker AP : ${attackers.attackPower()}% - Defender AP : ${defenders.defensiveAttackPower()}%</div>`);
let defendersActions = defenders.chooseActions(round);
let attackersActions = attackers.chooseActions(round);
defenders.processAllActions(defendersActions,attackers.attackPower(),attackersActions,round);
defendersActions = defenders.chooseActions(round);
attackersActions = attackers.chooseActions(round);
attackers.processAllActions(attackersActions,defenders.defensiveAttackPower(),defendersActions,round);

@@ -48,2 +51,4 @@ }

this.log.add(`Fight ended in round ${round}, Winner is : ${winner}`);
const receiveDate = (new Date()).getTime();
console.log('Ended in '+ (receiveDate - sendDate +'ms'));
return {

@@ -50,0 +55,0 @@ result,

@@ -13,3 +13,3 @@ import units from './units.json';

this.health = units[key].health;
this.grouhealth = units[key].health*amount;
this.grouphealth = units[key].health*amount;
this.max_health = units[key].health;

@@ -29,6 +29,6 @@ this.dead = 0;

takeGroupDamages(damage,skill_type,round,name,num) {
takeGroupDamages(damage,sender_skill,round,name,num,sender_amount) {
let damages = 5;
if((damage - this.defense)>0)
damages = damage - (this.defense);
damages = parseInt(damage - (this.defense));
let current =''

@@ -39,15 +39,53 @@ if(this.name === 'attacker')

current = "A"
let currentlog = `[${this.name.substring(0,1).toUpperCase()}] group (${this.i}) with ${this.undead} x ${this.key} with ${parseFloat(this.grouhealth).toFixed(3)} HP take <span style="color:red">${damages} DMG</span> from [${current}] ${name} (${num}) with <span style="color:blueviolet"> "${skill_type}"</span>.`
this.grouhealth = this.grouhealth - damages
let healthAfterDamage = this.grouhealth ;
let healthAfterDamage = this.grouphealth ;
this.undead = Math.floor(healthAfterDamage / this.health);
let currentlog=`<div class="tick ${this.name}">`;
if(this.type === 'Melee' && sender_skill === 'accuratehit' && this.type != 'tastynasty')
{
currentlog +=`[${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) took <span style="color:red"> ${damages/10} DMG</span> bonus.`
this.grouphealth = this.grouphealth - (damages/10);
healthAfterDamage = this.grouphealth ;
}
if(this.type === 'Range' && sender_skill === 'accurateprecision')
{
currentlog +=`[${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) took <span style="color:red"> ${damages/10} DMG</span> bonus.`
this.grouphealth = this.grouphealth - (damages/10);
healthAfterDamage = this.grouphealth ;
}
if (this.skill.type === 'shield' && this.use > 0 && this.undead != this.amount && (this.grouphealth + (this.skill.effect * this.undead)) < this.amount * this.max_health ) {
currentlog += `[${this.name.substring(0, 1).toUpperCase()}] ${this.key} (${this.i}) used his (${this.use}) shield. `;
this.use -= 1;
this.grouphealth = this.grouphealth + (this.skill.effect * this.undead);
healthAfterDamage = this.grouphealth ;
}
if(this.skill.type === 'bulletproof' && this.grouphealth < damages && this.use > 0){
currentlog += `[${this.name.substring(0, 1).toUpperCase()}] ${this.key} (${this.i}) used his (${this.use}) bulletproof.`
this.use -= 1;
this.grouphealth = 250 * this.undead;
healthAfterDamage = this.grouphealth ;
}
else if(this.skill.type === 'dodge' && this.use > 0 && damages > this.grouphealth)
{
this.use -= 1;
currentlog +=`[${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i})<span style="color:blueviolet"> dodged</span> ${parseFloat(damages).toFixed(0)} DMG.`;
}
else {
currentlog += `[${this.name.substring(0,1).toUpperCase()}] (${this.i}) with ${this.undead} x ${this.key} with <span style="color:green">${parseFloat(this.grouphealth).toFixed(0)}</span> HP take <span style="color:red">${parseFloat(damages).toFixed(0)} DMG</span> from [${current}] (${num}) with ${sender_amount} x ${name} <span style="color:blueviolet"> "${sender_skill}"</span>.`
this.grouphealth = this.grouphealth - damages
healthAfterDamage = this.grouphealth ;
}
if (healthAfterDamage <= 0) {
currentlog+= ` [${this.name.substring(0,1).toUpperCase()}] group (${this.i}) ${this.undead} x ${this.key} are <span style="color:darkorange">now dead.</span>`;
currentlog+= `<br/> [${this.name.substring(0,1).toUpperCase()}] (${this.i}) ${this.undead} x ${this.key} are <span style="color:darkorange">now dead.</span>`;
this.dead = Number(this.amount);
this.undead = 0;
this.kill();
} else {
const undead = Math.ceil(healthAfterDamage / this.health);
}
else {
const undead = parseInt(Math.floor(healthAfterDamage / this.health));
if (undead !== this.undead) {
currentlog+= ` [${this.name.substring(0,1).toUpperCase()}] ${undead} x ${this.key} group (${this.i}) are left.`;
currentlog+= `<br/> [${this.name.substring(0,1).toUpperCase()}] (${this.i}) ${undead} x ${this.key} are left.`;
this.dead += Number(this.undead - undead);

@@ -57,2 +95,3 @@ this.undead = undead;

}
currentlog+= "</div>"
this.log.add(

@@ -63,7 +102,7 @@ currentlog

takeGroupBuff(points,skill_type,round,name,num) {
if(this.health < this.max_health && skill_type === 'heal' || this.health < this.max_health && skill_type === 'groupheal')
takeGroupBuff(points,sender_skill,round,name,num) {
if(this.health < this.max_health && sender_skill === 'heal' || this.health < this.max_health && sender_skill === 'groupheal')
{
this.log.add(
` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with ${this.health} HP take ${skill_type} <span style="color:chartreuse">+${points} HP</span> from [${this.name.substring(0,1).toUpperCase()}] ${name} (${num}).`,
`<br/> [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with ${this.health} HP take ${sender_skill} <span style="color:chartreuse">+${points} HP</span> from [${this.name.substring(0,1).toUpperCase()}] (${num}) with${name} .`,
);

@@ -70,0 +109,0 @@ this.health = this.health + points;

@@ -30,3 +30,3 @@ import dunits from './units.json';

else current = "A";
let currentlog = `[${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with <span style="color:green">${parseFloat(this.health).toFixed(2)}</span> HP and ${this.defense} DEF take <span style="color:red">${damages} DMG</span> from [${current}] ${name} (${num}) with <span style="color:blueviolet"> "${sender_skill}"</span>.`
let currentlog = `[${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with <span style="color:green">${parseFloat(this.health).toFixed(0)}</span> HP and ${this.defense} DEF take <span style="color:red">${damages} DMG</span> from [${current}] ${name} (${num}) with <span style="color:blueviolet"> "${sender_skill}"</span>.`

@@ -65,3 +65,3 @@ if(this.type === 'Melee' && sender_skill === 'accuratehit' && this.type != 'tastynasty')

this.health = this.health - damages
currentlog += ` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) got now <span style="color:green">${parseFloat(this.health).toFixed(2)}</span> HP.`
currentlog += ` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) got now <span style="color:green">${parseFloat(this.health).toFixed(0)}</span> HP.`
}

@@ -79,3 +79,3 @@ else {

this.log.add(
` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with <span style="color:green">${parseFloat(this.health).toFixed(2)}</span> HP and ${this.defense} DEF take ${sender_skill} <span style="color:chartreuse">+${points} HP</span> from [${this.name.substring(0,1).toUpperCase()}] ${name} (${num}).`,
` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with <span style="color:green">${parseFloat(this.health).toFixed(0)}</span> HP and ${this.defense} DEF take ${sender_skill} <span style="color:chartreuse">+${points} HP</span> from [${this.name.substring(0,1).toUpperCase()}] ${name} (${num}).`,
);

@@ -82,0 +82,0 @@ this.health = this.health + points;

@@ -12,8 +12,9 @@ {

"attack": 5,
"health": 20,
"defense":10,
"weapon_defense":10,
"fire_defense":10,
"chemical_defense":10,
"health": 2,
"defense":1,
"weapon_defense":1,
"fire_defense":1,
"chemical_defense":1,
"dmg_type":"physical",
"group":5000,
"speed": 3,

@@ -30,3 +31,3 @@ "range": 3,

"use":-1,
"skill": {"type":"group","effect":100,"range":1,"use":-1,"passive":true}
"skill": {"type":"spy","effect":1,"range":1,"use":-1,"passive":true}
},

@@ -42,3 +43,3 @@ "hobo": {

"feature": "GROUP KAMIKAZE : If he meets an enemy he will die. This unit can not defend and split into group if they are a lot!",
"attack": 130,
"attack": 13,
"health": 0,

@@ -50,2 +51,3 @@ "defense":0,

"dmg_type":"physical",
"group":5000,
"speed": 13,

@@ -73,9 +75,10 @@ "range": 1,

"feature": "GROUP : The rowdy always fights in groups of 4.",
"attack": 200,
"health": 300,
"defense":40,
"weapon_defense":20,
"attack": 20,
"health": 30,
"defense":4,
"weapon_defense":2,
"fire_defense":0,
"chemical_defense":0,
"dmg_type":"weapon",
"group":4000,
"speed": 12,

@@ -103,9 +106,10 @@ "range": 1,

"feature": "SHIELD : He can use it once and obtain +200 health.",
"attack": 500,
"health": 1400,
"defense":60,
"weapon_defense":40,
"fire_defense":20,
"chemical_defense":20,
"attack": 50,
"health": 140,
"defense":6,
"weapon_defense":4,
"fire_defense":2,
"chemical_defense":2,
"dmg_type":"physical",
"group":3000,
"speed": 11,

@@ -122,3 +126,3 @@ "range": 1,

"use":1,
"skill": {"type":"shield","effect":200,"range":1,"use":1,"passive":true}
"skill": {"type":"shield","effect":20,"range":1,"use":1,"passive":true}
},

@@ -134,9 +138,10 @@ "big_mama": {

"feature": "GROUPHEAL : She can heal 5 allies for 200HP at each round. Elite.",
"attack": 500,
"health": 21000,
"defense":80,
"weapon_defense":80,
"fire_defense":80,
"chemical_defense":80,
"attack": 50,
"health": 2100,
"defense":8,
"weapon_defense":8,
"fire_defense":8,
"chemical_defense":8,
"dmg_type":"physical",
"group":1000,
"speed": 20,

@@ -164,9 +169,10 @@ "range": 3,

"feature": "TASTY NASTY : He does not respect any rules, not even those about priority. Elite.",
"attack": 600,
"health": 400,
"defense":50,
"weapon_defense":20,
"fire_defense":20,
"chemical_defense":20,
"attack": 60,
"health": 40,
"defense":5,
"weapon_defense":2,
"fire_defense":2,
"chemical_defense":2,
"dmg_type":"chemical",
"group":2000,
"speed": 10,

@@ -194,9 +200,10 @@ "range": 1,

"feature": "ACCURATE HIT : He's pretty good against melee and gives a bonus damage.",
"attack": 1600,
"health": 1200,
"defense":50,
"weapon_defense":10,
"fire_defense":30,
"chemical_defense":20,
"attack": 160,
"health": 120,
"defense":5,
"weapon_defense":1,
"fire_defense":3,
"chemical_defense":2,
"dmg_type":"fire",
"group":1500,
"speed": 9,

@@ -224,9 +231,10 @@ "range": 5,

"feature": "FORTUNE : Each lawyer reduce the safe of your opponent by 0.01% (max 5%). This unit cover himself behind your big mamas.",
"attack": 200,
"health": 2000,
"defense":50,
"weapon_defense":50,
"fire_defense":50,
"chemical_defense":50,
"attack": 20,
"health": 200,
"defense":5,
"weapon_defense":5,
"fire_defense":5,
"chemical_defense":5,
"dmg_type":"physical",
"group":1000,
"speed": 14,

@@ -254,9 +262,10 @@ "range": 3,

"feature": "CRITICAL CHARGE : At each round, the sniper will increase its damage per 1.5*X, where X is the number of that round.",
"attack": 1500,
"health": 900,
"defense":50,
"weapon_defense":20,
"fire_defense":10,
"chemical_defense":20,
"attack": 150,
"health": 90,
"defense":5,
"weapon_defense":2,
"fire_defense":1,
"chemical_defense":2,
"dmg_type":"weapon",
"group":1500,
"speed": 14,

@@ -284,9 +293,10 @@ "range": 6,

"feature": "MULTIPLE HIT : He will use two guns to take two shots.",
"attack": 1100,
"health": 1500,
"defense":50,
"weapon_defense":30,
"fire_defense":40,
"chemical_defense":100,
"attack": 110,
"health": 150,
"defense":7,
"weapon_defense":3,
"fire_defense":4,
"chemical_defense":10,
"dmg_type":"weapon",
"group":1000,
"speed": 8,

@@ -314,9 +324,10 @@ "range": 5,

"feature": "DODGE : She will dodge 2 deadly hits. No matter the damage. Elite.",
"attack": 4000,
"health": 3000,
"defense":100,
"weapon_defense":50,
"fire_defense":30,
"chemical_defense":60,
"attack": 400,
"health": 300,
"defense":5,
"weapon_defense":5,
"fire_defense":3,
"chemical_defense":6,
"dmg_type":"physical",
"group":1000,
"speed": 6,

@@ -344,9 +355,10 @@ "range": 4,

"feature": "SPLASH : Hits 10 enemies at once.",
"attack": 6000,
"health": 2500,
"defense":50,
"weapon_defense":40,
"fire_defense":10,
"chemical_defense":10,
"attack": 600,
"health": 250,
"defense":7,
"weapon_defense":4,
"fire_defense":1,
"chemical_defense":1,
"dmg_type":"fire",
"group":500,
"speed": 17,

@@ -374,9 +386,10 @@ "range": 7,

"feature": "BULLETPROOF : This unit will obtain 250HP back when he reaches 0. Elite.",
"attack": 10000,
"health": 7500,
"attack": 1000,
"health": 750,
"defense":80,
"weapon_defense":60,
"fire_defense":40,
"chemical_defense":40,
"weapon_defense":6,
"fire_defense":4,
"chemical_defense":4,
"dmg_type":"chemical",
"group":500,
"speed": 15,

@@ -404,9 +417,10 @@ "range": 6,

"feature": "BUILDER : Permit to occup new base and expand your empire.",
"attack": 1000,
"health": 20000,
"defense":40,
"weapon_defense":50,
"attack": 100,
"health": 2000,
"defense":4,
"weapon_defense":5,
"fire_defense":0,
"chemical_defense":50,
"chemical_defense":5,
"dmg_type":"physical",
"group":500,
"speed": 35,

@@ -434,9 +448,10 @@ "range": 4,

"feature": "GROUP : The guard always fights in groups of 2.",
"attack": 250,
"health": 400,
"defense":20,
"weapon_defense":20,
"attack": 20,
"health": 25,
"defense":2,
"weapon_defense":2,
"fire_defense":0,
"chemical_defense":0,
"dmg_type":"weapon",
"group":1000,
"speed": 12,

@@ -464,9 +479,10 @@ "range": 1,

"feature": "ACCURATE PRECISION : He's pretty good against range and gives a bonus damage.",
"attack": 1600,
"health": 1200,
"defense":20,
"weapon_defense":10,
"fire_defense":30,
"chemical_defense":20,
"attack": 70,
"health": 60,
"defense":2,
"weapon_defense":1,
"fire_defense":3,
"chemical_defense":2,
"dmg_type":"fire",
"group":500,
"speed": 9,

@@ -494,9 +510,10 @@ "range": 5,

"feature": "BODYSHIELD : This unit will take also 1 of the next hit.",
"attack": 200,
"health": 10000,
"attack": 25,
"health": 600,
"defense":30,
"weapon_defense":40,
"fire_defense":20,
"chemical_defense":20,
"weapon_defense":4,
"fire_defense":2,
"chemical_defense":2,
"dmg_type":"physical",
"group":500,
"speed": 11,

@@ -524,9 +541,10 @@ "range": 1,

"feature": "MULTIPLE HIT : He will use two guns to take two shots.",
"attack": 3000,
"health": 4000,
"attack": 120,
"health": 280,
"defense":20,
"weapon_defense":60,
"fire_defense":40,
"chemical_defense":40,
"weapon_defense":6,
"fire_defense":4,
"chemical_defense":4,
"dmg_type":"chemical",
"group":250,
"speed": 15,

@@ -543,3 +561,3 @@ "range": 6,

"use":1,
"skill": {"type":"multiplehit","effect":700,"range":3,"use":-1,"passive":true}
"skill": {"type":"multiplehit","effect":120,"range":3,"use":-1,"passive":true}
},

@@ -555,9 +573,10 @@ "elitesniper": {

"feature": "CRITICAL CHARGE : At each round, the sniper will increase its damage per 2*X, where X is the number of that round.",
"attack": 1500,
"health": 900,
"defense":20,
"weapon_defense":20,
"fire_defense":10,
"chemical_defense":20,
"attack": 100,
"health": 80,
"defense":2,
"weapon_defense":2,
"fire_defense":1,
"chemical_defense":2,
"dmg_type":"weapon",
"group":250,
"speed": 14,

@@ -574,3 +593,3 @@ "range": 6,

"use":-1,
"skill": {"type":"criticalhit","effect":1500,"range":2,"use":-1,"passive":false}
"skill": {"type":"criticalhit","effect":150,"range":2,"use":-1,"passive":false}
},

@@ -586,9 +605,10 @@ "fbi": {

"feature": "DODGE : He will dodge 1 deadly hits. No matter the damage. Elite.",
"attack": 5000,
"health": 4000,
"defense":30,
"weapon_defense":50,
"fire_defense":30,
"chemical_defense":60,
"attack": 400,
"health": 300,
"defense":3,
"weapon_defense":5,
"fire_defense":3,
"chemical_defense":6,
"dmg_type":"physical",
"group":250,
"speed": 6,

@@ -616,9 +636,10 @@ "range": 4,

"feature": "GRENADE : Hits 15 enemies at once.",
"attack": 6000,
"health": 2500,
"defense":30,
"weapon_defense":40,
"fire_defense":10,
"chemical_defense":10,
"attack": 500,
"health": 250,
"defense":3,
"weapon_defense":4,
"fire_defense":1,
"chemical_defense":1,
"dmg_type":"fire",
"group":250,
"speed": 17,

@@ -646,9 +667,10 @@ "range": 7,

"feature": "BULLETPROOF : This unit will obtain 500HP back when he reaches 0. Elite.",
"attack": 15000,
"health": 10000,
"defense":40,
"weapon_defense":60,
"fire_defense":40,
"chemical_defense":40,
"attack": 800,
"health": 800,
"defense":4,
"weapon_defense":6,
"fire_defense":4,
"chemical_defense":4,
"dmg_type":"chemical",
"group":250,
"speed": 15,

@@ -655,0 +677,0 @@ "range": 6,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc