Comparing version 0.0.46 to 0.0.48
@@ -84,3 +84,3 @@ 'use strict'; | ||
}); | ||
if (protection) unit.defense = unit.defense + unit.defense / 500 * protection.lvl; | ||
if (protection) unit.defense = unit.defense + Math.round(unit.defense / 20 * protection.lvl); | ||
if (unit.spec.type === 'Melee') { | ||
@@ -91,3 +91,3 @@ | ||
}); | ||
if (closecombat) unit.attack = unit.attack + unit.attack / 500 * closecombat.lvl; | ||
if (closecombat) unit.attack = unit.attack + unit.attack / 100 * closecombat.lvl; | ||
} else { | ||
@@ -99,3 +99,3 @@ //ALL RANGE | ||
if (firearms) { | ||
unit.attack = unit.attack + unit.attack / 500 * firearms.lvl; | ||
unit.attack = unit.attack + unit.attack / 100 * firearms.lvl; | ||
} | ||
@@ -108,3 +108,3 @@ | ||
}); | ||
if (sniping) unit.attack = unit.attack + unit.attack / 500 * sniping.lvl; | ||
if (sniping) unit.attack = unit.attack + unit.attack / 100 * sniping.lvl; | ||
} | ||
@@ -117,3 +117,3 @@ | ||
}); | ||
if (bomb) unit.attack = unit.attack + unit.attack / 500 * bomb.lvl; | ||
if (bomb) unit.attack = unit.attack + unit.attack / 100 * bomb.lvl; | ||
} | ||
@@ -127,4 +127,4 @@ | ||
if (psychological) { | ||
unit.attack = unit.attack + unit.attack / 500 * psychological.lvl; | ||
unit.defense = unit.defense + unit.attack / 500 * psychological.lvl; | ||
unit.attack = unit.attack + unit.attack / 100 * psychological.lvl; | ||
unit.defense = unit.defense + unit.attack / 100 * psychological.lvl; | ||
} | ||
@@ -138,3 +138,3 @@ } | ||
}); | ||
if (chemical) unit.attack = unit.attack + unit.attack / 500 * chemical.lvl; | ||
if (chemical) unit.attack = unit.attack + unit.attack / 100 * chemical.lvl; | ||
} | ||
@@ -226,3 +226,3 @@ } | ||
attack.num = num; | ||
attack.dmg = action[1].effect; | ||
attack.dmg = parseInt(action[1].effect); | ||
for (var _i = 0; _i < action[1].range; _i += 1) { | ||
@@ -236,3 +236,3 @@ serie.push(attack); | ||
attack.num = num; | ||
attack.dmg = action[0]; | ||
attack.dmg = parseInt(action[0]); | ||
serie.push(attack); | ||
@@ -244,3 +244,3 @@ break; | ||
attack.num = num; | ||
attack.dmg = action[0]; | ||
attack.dmg = parseInt(action[0]); | ||
for (var _i2 = 0; _i2 < action[1].range; _i2 += 1) { | ||
@@ -254,3 +254,3 @@ serie.push(attack); | ||
attack.num = num; | ||
attack.dmg = action[0] * action[1].range * round * attackpower / 100; | ||
attack.dmg = parseInt(action[0] * action[1].range * round * attackpower / 100); | ||
serie.push(attack); | ||
@@ -266,3 +266,3 @@ break; | ||
if (!unit.dead && serie.length > 0) { | ||
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num); | ||
unit.takeDamages(parseInt(serie[0].dmg * attackpower / 100), skill_type, round, serie[0].author, serie[0].num); | ||
serie.splice(0, 1); | ||
@@ -276,3 +276,3 @@ } | ||
attack.num = num; | ||
attack.dmg = action[0]; | ||
attack.dmg = parseInt(action[0]); | ||
serie.push(attack); | ||
@@ -283,3 +283,3 @@ break; | ||
if (group.undead > 0 && serie.length > 0) { | ||
group.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num); | ||
group.takeGroupDamages(parseInt(serie[0].dmg * attackpower / 100), skill_type, round, serie[0].author, serie[0].num); | ||
serie.splice(0, 1); | ||
@@ -290,3 +290,3 @@ } | ||
if (!unit.dead && serie.length > 0) { | ||
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round, serie[0].author, serie[0].num); | ||
unit.takeDamages(parseInt(serie[0].dmg * attackpower / 100), skill_type, round, serie[0].author, serie[0].num); | ||
serie.splice(0, 1); | ||
@@ -293,0 +293,0 @@ } |
@@ -47,7 +47,7 @@ 'use strict'; | ||
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">' + parseFloat(damages).toFixed(2) + ' 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 ' + this.health + ' HP take <span style="color:red">' + damages + ' DMG</span> from [' + current + '] ' + name + ' (' + num + ') with <span style="color:blueviolet"> "' + skill_type + '"</span>.'; | ||
if (this.type === 'Melee' && skill_type === 'accuratehit' && this.type != 'tastynasty') { | ||
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') took <span style="color:red"> ' + parseFloat(damages / 10).toFixed(2) + ' DMG</span> bonus.'; | ||
this.health = this.health - damages / 10; | ||
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') took <span style="color:red"> ' + damages / 10 + ' DMG</span> bonus.'; | ||
this.health = this.health - parseInt(damages / 10); | ||
} | ||
@@ -67,6 +67,6 @@ | ||
this.use = this.use - 1; | ||
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ')<span style="color:blueviolet"> dodged</span> ' + parseFloat(damages).toFixed(2) + ' DMG.'; | ||
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ')<span style="color:blueviolet"> dodged</span> ' + damages + ' DMG.'; | ||
} else if (this.health > 0 && this.health > damages) { | ||
this.health = this.health - damages; | ||
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') got now ' + parseFloat(this.health).toFixed(2) + ' HP.'; | ||
currentlog += ' [' + this.name.substring(0, 1).toUpperCase() + '] ' + this.key + ' (' + this.i + ') got now ' + this.health + ' HP.'; | ||
} else { | ||
@@ -82,3 +82,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 && 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 ' + parseFloat(this.health).toFixed(2) + ' HP take ' + skill_type + ' <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 ' + this.health + ' HP take ' + skill_type + ' <span style="color:chartreuse">+' + points + ' HP</span> from [' + this.name.substring(0, 1).toUpperCase() + '] ' + name + ' (' + num + ').'); | ||
this.health = this.health + points; | ||
@@ -85,0 +85,0 @@ if (this.health > this.max_health) this.health = this.max_health; |
@@ -10,3 +10,3 @@ { | ||
"feature": "KAMIKAZE : If he meets an enemy at the end of the first round, he will die. This unit can not defend!", | ||
"attack": 2, | ||
"attack": 20, | ||
"health": 0, | ||
@@ -34,5 +34,5 @@ "defense":0, | ||
"feature": "GROUP : The rowdy always fights in groups of 4.", | ||
"attack": 2, | ||
"health": 2, | ||
"defense":1, | ||
"attack": 20, | ||
"health": 20, | ||
"defense":10, | ||
"speed": 12, | ||
@@ -58,5 +58,5 @@ "range": 1, | ||
"feature": "SHIELD : He can use it once and obtain +2 health.", | ||
"attack": 5, | ||
"health": 11, | ||
"defense":3, | ||
"attack": 50, | ||
"health": 110, | ||
"defense":30, | ||
"speed": 11, | ||
@@ -82,5 +82,5 @@ "range": 1, | ||
"feature": "GROUPHEAL : She can heal 3 allies for 3HP at each round (can carry 3 medkit).", | ||
"attack": 12, | ||
"health": 110, | ||
"defense":6, | ||
"attack": 120, | ||
"health": 1100, | ||
"defense":60, | ||
"speed": 20, | ||
@@ -106,5 +106,5 @@ "range": 3, | ||
"feature": "TASTY NASTY : He does not respect any rules, not even those about priority.", | ||
"attack": 8, | ||
"health": 5, | ||
"defense":2, | ||
"attack": 80, | ||
"health": 50, | ||
"defense":20, | ||
"speed": 10, | ||
@@ -130,5 +130,5 @@ "range": 1, | ||
"feature": "ACCURATE HIT : He's pretty good against melee and gives a bonus damage.", | ||
"attack": 16, | ||
"health": 12, | ||
"defense":2, | ||
"attack": 160, | ||
"health": 120, | ||
"defense":20, | ||
"speed": 9, | ||
@@ -155,4 +155,4 @@ "range": 5, | ||
"attack": 0, | ||
"health": 1, | ||
"defense":1, | ||
"health": 10, | ||
"defense":10, | ||
"speed": 3, | ||
@@ -178,5 +178,5 @@ "range": 5, | ||
"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": 15, | ||
"health": 8, | ||
"defense":2, | ||
"attack": 150, | ||
"health": 80, | ||
"defense":20, | ||
"speed": 14, | ||
@@ -202,5 +202,5 @@ "range": 6, | ||
"feature": "MULTIPLE HIT : He will use two guns to take two shots.", | ||
"attack": 11, | ||
"health": 15, | ||
"defense":3, | ||
"attack": 110, | ||
"health": 150, | ||
"defense":30, | ||
"speed": 8, | ||
@@ -226,5 +226,5 @@ "range": 5, | ||
"feature": "DODGE : She will dodge 2 deadly hits. No matter the damage.", | ||
"attack": 40, | ||
"health": 30, | ||
"defense":4, | ||
"attack": 400, | ||
"health": 300, | ||
"defense":40, | ||
"speed": 6, | ||
@@ -250,5 +250,5 @@ "range": 4, | ||
"feature": "SPLASH : Hits 6 enemies at once (can carry 3 rockets).", | ||
"attack": 66, | ||
"health": 25, | ||
"defense":2, | ||
"attack": 660, | ||
"health": 250, | ||
"defense":20, | ||
"speed": 17, | ||
@@ -274,5 +274,5 @@ "range": 7, | ||
"feature": "BULLETPROOF : He is immortal... or not. He just has a bulletproof vest. This unit will obtain 25HP back when he reaches 0.", | ||
"attack": 100, | ||
"health": 75, | ||
"defense":5, | ||
"attack": 1000, | ||
"health": 750, | ||
"defense":50, | ||
"speed": 15, | ||
@@ -279,0 +279,0 @@ "range": 6, |
{ | ||
"name": "drugwars", | ||
"version": "0.0.46", | ||
"version": "0.0.48", | ||
"description": "A lightweight JavaScript library for DrugWars", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -60,3 +60,3 @@ import { orderBy } from 'lodash'; | ||
if(protection) | ||
unit.defense = unit.defense + unit.defense/500 *protection.lvl; | ||
unit.defense = unit.defense + Math.round(unit.defense/20 *protection.lvl); | ||
if(unit.spec.type === 'Melee') | ||
@@ -67,3 +67,3 @@ { | ||
if(closecombat) | ||
unit.attack = unit.attack + unit.attack /500 * closecombat.lvl; | ||
unit.attack = unit.attack + unit.attack /100 * closecombat.lvl; | ||
} | ||
@@ -75,3 +75,3 @@ else{ | ||
{ | ||
unit.attack = unit.attack + unit.attack /500 * firearms.lvl; | ||
unit.attack = unit.attack + unit.attack /100 * firearms.lvl; | ||
} | ||
@@ -84,3 +84,3 @@ | ||
if(sniping) | ||
unit.attack = unit.attack + unit.attack /500 * sniping.lvl; | ||
unit.attack = unit.attack + unit.attack /100 * sniping.lvl; | ||
} | ||
@@ -93,3 +93,3 @@ | ||
if(bomb) | ||
unit.attack = unit.attack + unit.attack /500 * bomb.lvl; | ||
unit.attack = unit.attack + unit.attack /100 * bomb.lvl; | ||
} | ||
@@ -103,4 +103,4 @@ | ||
{ | ||
unit.attack = unit.attack + unit.attack /500 *psychological.lvl; | ||
unit.defense = unit.defense + unit.attack /500 *psychological.lvl; | ||
unit.attack = unit.attack + unit.attack /100 *psychological.lvl; | ||
unit.defense = unit.defense + unit.attack /100 *psychological.lvl; | ||
} | ||
@@ -114,3 +114,3 @@ } | ||
if(chemical) | ||
unit.attack = unit.attack + unit.attack /500 *chemical.lvl; | ||
unit.attack = unit.attack + unit.attack /100 *chemical.lvl; | ||
} | ||
@@ -156,3 +156,3 @@ | ||
processArmyActions(target, actions, attackpower,round) { | ||
processArmyActions(target, actions, attackpower, round) { | ||
const unitsSorted = orderBy(this.units, ['priority'], ['asc']); | ||
@@ -201,3 +201,3 @@ const unitsByHighestPriority = orderBy(this.units, ['priority'], ['desc']); | ||
attack.num = num | ||
attack.dmg = action[1].effect; | ||
attack.dmg = parseInt(action[1].effect); | ||
for (let i = 0; i < action[1].range; i += 1) { | ||
@@ -211,3 +211,3 @@ serie.push(attack); | ||
attack.num = num | ||
attack.dmg = action[0]; | ||
attack.dmg = parseInt(action[0]); | ||
serie.push(attack); | ||
@@ -219,3 +219,3 @@ break; | ||
attack.num = num | ||
attack.dmg = action[0]; | ||
attack.dmg = parseInt(action[0]); | ||
for (let i = 0; i < action[1].range; i += 1) { | ||
@@ -229,3 +229,3 @@ serie.push(attack); | ||
attack.num = num | ||
attack.dmg = (action[0] * action[1].range * round * attackpower / 100); | ||
attack.dmg = parseInt(action[0] * action[1].range * round * attackpower / 100); | ||
serie.push(attack); | ||
@@ -241,3 +241,3 @@ break; | ||
if (!unit.dead && serie.length > 0) { | ||
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round,serie[0].author, serie[0].num); | ||
unit.takeDamages(parseInt(serie[0].dmg * attackpower / 100), skill_type, round,serie[0].author, serie[0].num); | ||
serie.splice(0, 1); | ||
@@ -251,3 +251,3 @@ } | ||
attack.num = num | ||
attack.dmg = action[0]; | ||
attack.dmg = parseInt(action[0]); | ||
serie.push(attack); | ||
@@ -258,3 +258,3 @@ break; | ||
if (group.undead > 0 && serie.length > 0) { | ||
group.takeGroupDamages(serie[0].dmg * attackpower / 100, skill_type, round , serie[0].author, serie[0].num); | ||
group.takeGroupDamages(parseInt(serie[0].dmg * attackpower / 100), skill_type, round , serie[0].author, serie[0].num); | ||
serie.splice(0, 1); | ||
@@ -265,3 +265,3 @@ } | ||
if (!unit.dead && serie.length > 0) { | ||
unit.takeDamages(serie[0].dmg * attackpower / 100, skill_type, round , serie[0].author, serie[0].num); | ||
unit.takeDamages(parseInt(serie[0].dmg * attackpower / 100), skill_type, round , serie[0].author, serie[0].num); | ||
serie.splice(0, 1); | ||
@@ -268,0 +268,0 @@ } |
@@ -27,8 +27,8 @@ import units from './units.json'; | ||
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">${parseFloat(damages).toFixed(2)} 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 ${this.health} HP take <span style="color:red">${damages} DMG</span> from [${current}] ${name} (${num}) with <span style="color:blueviolet"> "${skill_type}"</span>.` | ||
if(this.type === 'Melee' && skill_type === 'accuratehit' && this.type != 'tastynasty') | ||
{ | ||
currentlog +=` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) took <span style="color:red"> ${parseFloat(damages/10).toFixed(2)} DMG</span> bonus.` | ||
this.health = this.health - damages/10; | ||
currentlog +=` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) took <span style="color:red"> ${damages/10} DMG</span> bonus.` | ||
this.health = this.health - parseInt(damages/10); | ||
} | ||
@@ -52,7 +52,7 @@ | ||
this.use = this.use - 1; | ||
currentlog +=` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i})<span style="color:blueviolet"> dodged</span> ${parseFloat(damages).toFixed(2)} DMG.`; | ||
currentlog +=` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i})<span style="color:blueviolet"> dodged</span> ${damages} DMG.`; | ||
} | ||
else if (this.health > 0 && this.health > damages) { | ||
this.health = this.health - damages | ||
currentlog += ` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) got now ${parseFloat(this.health).toFixed(2)} HP.` | ||
currentlog += ` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) got now ${this.health} HP.` | ||
} | ||
@@ -70,3 +70,3 @@ else { | ||
this.log.add( | ||
` [${this.name.substring(0,1).toUpperCase()}] ${this.key} (${this.i}) with ${parseFloat(this.health).toFixed(2)} HP take ${skill_type} <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 ${this.health} HP take ${skill_type} <span style="color:chartreuse">+${points} HP</span> from [${this.name.substring(0,1).toUpperCase()}] ${name} (${num}).`, | ||
); | ||
@@ -73,0 +73,0 @@ this.health = this.health + points; |
@@ -10,3 +10,3 @@ { | ||
"feature": "KAMIKAZE : If he meets an enemy at the end of the first round, he will die. This unit can not defend!", | ||
"attack": 2, | ||
"attack": 20, | ||
"health": 0, | ||
@@ -34,5 +34,5 @@ "defense":0, | ||
"feature": "GROUP : The rowdy always fights in groups of 4.", | ||
"attack": 2, | ||
"health": 2, | ||
"defense":1, | ||
"attack": 20, | ||
"health": 20, | ||
"defense":10, | ||
"speed": 12, | ||
@@ -58,5 +58,5 @@ "range": 1, | ||
"feature": "SHIELD : He can use it once and obtain +2 health.", | ||
"attack": 5, | ||
"health": 11, | ||
"defense":3, | ||
"attack": 50, | ||
"health": 110, | ||
"defense":30, | ||
"speed": 11, | ||
@@ -82,5 +82,5 @@ "range": 1, | ||
"feature": "GROUPHEAL : She can heal 3 allies for 3HP at each round (can carry 3 medkit).", | ||
"attack": 12, | ||
"health": 110, | ||
"defense":6, | ||
"attack": 120, | ||
"health": 1100, | ||
"defense":60, | ||
"speed": 20, | ||
@@ -106,5 +106,5 @@ "range": 3, | ||
"feature": "TASTY NASTY : He does not respect any rules, not even those about priority.", | ||
"attack": 8, | ||
"health": 5, | ||
"defense":2, | ||
"attack": 80, | ||
"health": 50, | ||
"defense":20, | ||
"speed": 10, | ||
@@ -130,5 +130,5 @@ "range": 1, | ||
"feature": "ACCURATE HIT : He's pretty good against melee and gives a bonus damage.", | ||
"attack": 16, | ||
"health": 12, | ||
"defense":2, | ||
"attack": 160, | ||
"health": 120, | ||
"defense":20, | ||
"speed": 9, | ||
@@ -155,4 +155,4 @@ "range": 5, | ||
"attack": 0, | ||
"health": 1, | ||
"defense":1, | ||
"health": 10, | ||
"defense":10, | ||
"speed": 3, | ||
@@ -178,5 +178,5 @@ "range": 5, | ||
"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": 15, | ||
"health": 8, | ||
"defense":2, | ||
"attack": 150, | ||
"health": 80, | ||
"defense":20, | ||
"speed": 14, | ||
@@ -202,5 +202,5 @@ "range": 6, | ||
"feature": "MULTIPLE HIT : He will use two guns to take two shots.", | ||
"attack": 11, | ||
"health": 15, | ||
"defense":3, | ||
"attack": 110, | ||
"health": 150, | ||
"defense":30, | ||
"speed": 8, | ||
@@ -226,5 +226,5 @@ "range": 5, | ||
"feature": "DODGE : She will dodge 2 deadly hits. No matter the damage.", | ||
"attack": 40, | ||
"health": 30, | ||
"defense":4, | ||
"attack": 400, | ||
"health": 300, | ||
"defense":40, | ||
"speed": 6, | ||
@@ -250,5 +250,5 @@ "range": 4, | ||
"feature": "SPLASH : Hits 6 enemies at once (can carry 3 rockets).", | ||
"attack": 66, | ||
"health": 25, | ||
"defense":2, | ||
"attack": 660, | ||
"health": 250, | ||
"defense":20, | ||
"speed": 17, | ||
@@ -274,5 +274,5 @@ "range": 7, | ||
"feature": "BULLETPROOF : He is immortal... or not. He just has a bulletproof vest. This unit will obtain 25HP back when he reaches 0.", | ||
"attack": 100, | ||
"health": 75, | ||
"defense":5, | ||
"attack": 1000, | ||
"health": 750, | ||
"defense":50, | ||
"speed": 15, | ||
@@ -279,0 +279,0 @@ "range": 6, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2279345
6508