Comparing version 0.0.50 to 0.0.51
@@ -49,17 +49,19 @@ 'use strict'; | ||
units.forEach(function (unit) { | ||
if (_units2.default[unit.key].skill.type === "group") { | ||
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; | ||
if (unit.amount > 0) { | ||
if (_units2.default[unit.key].skill.type === "group") { | ||
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; | ||
} | ||
} | ||
} | ||
} 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 (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)); | ||
} | ||
} | ||
@@ -140,4 +142,2 @@ } | ||
// { | ||
// if(unit.skill.type != 'bulletproof') | ||
// unit.use = unit.use -1; | ||
// } | ||
@@ -144,0 +144,0 @@ // else{ |
@@ -37,3 +37,3 @@ 'use strict'; | ||
this.skill = _units2.default[key].skill; | ||
this.use = _units2.default[key].skill.use; | ||
this.use = _units2.default[key].use; | ||
this.type = _units2.default[key].type; | ||
@@ -40,0 +40,0 @@ } |
@@ -23,2 +23,3 @@ { | ||
"alcohols_cost": 400, | ||
"use":-1, | ||
"skill": {"type":"attack","effect":1,"range":1,"use":-1,"passive":true} | ||
@@ -47,2 +48,3 @@ }, | ||
"alcohols_cost": 0, | ||
"use":-1, | ||
"skill": {"type":"group","effect":4,"range":1,"use":-1,"passive":true} | ||
@@ -71,2 +73,3 @@ }, | ||
"alcohols_cost": 1300, | ||
"use":1, | ||
"skill": {"type":"shield","effect":2,"range":1,"use":1,"passive":true} | ||
@@ -95,2 +98,3 @@ }, | ||
"alcohols_cost": 12000, | ||
"use":3, | ||
"skill": {"type":"groupheal","effect":3,"range":3,"use":3,"passive":false} | ||
@@ -119,2 +123,3 @@ }, | ||
"alcohols_cost": 1200, | ||
"use":-1, | ||
"skill": {"type":"tastynasty","effect":1,"range":1,"use":-1,"passive":true} | ||
@@ -143,2 +148,3 @@ }, | ||
"alcohols_cost": 3200, | ||
"use":-1, | ||
"skill": {"type":"accuratehit","effect":1,"range":1,"use":-1,"passive":false} | ||
@@ -167,2 +173,3 @@ }, | ||
"alcohols_cost": 300, | ||
"use":-1, | ||
"skill": {"type":"attack","effect":0,"range":0,"use":-1,"passive":true} | ||
@@ -191,2 +198,3 @@ }, | ||
"alcohols_cost": 5600, | ||
"use":-1, | ||
"skill": {"type":"criticalhit","effect":15,"range":1.5,"use":-1,"passive":false} | ||
@@ -215,2 +223,3 @@ }, | ||
"alcohols_cost": 0, | ||
"use":-1, | ||
"skill": {"type":"multiplehit","effect":11,"range":2,"use":-1,"passive":false} | ||
@@ -239,2 +248,3 @@ }, | ||
"alcohols_cost": 7000, | ||
"use":2, | ||
"skill": {"type":"dodge","effect":1,"range":1,"use":2,"passive":true} | ||
@@ -263,2 +273,3 @@ }, | ||
"alcohols_cost": 13000, | ||
"use":3, | ||
"skill": {"type":"splash","effect":11,"range":6,"use":3,"passive":false} | ||
@@ -287,4 +298,5 @@ }, | ||
"alcohols_cost": 14000, | ||
"use":1, | ||
"skill": {"type":"bulletproof","effect":0,"range":0,"use":1,"passive":true} | ||
} | ||
} |
{ | ||
"name": "drugwars", | ||
"version": "0.0.50", | ||
"version": "0.0.51", | ||
"description": "A lightweight JavaScript library for DrugWars", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -16,30 +16,32 @@ import { orderBy } from 'lodash'; | ||
units.forEach(unit => { | ||
if(dwunits[unit.key].skill.type === "group") | ||
if(unit.amount>0) | ||
{ | ||
let group_amount = unit.amount | ||
while(group_amount>0) | ||
if(dwunits[unit.key].skill.type === "group") | ||
{ | ||
if(group_amount>=effect) | ||
let group_amount = unit.amount | ||
while(group_amount>0) | ||
{ | ||
group_amount = group_amount - effect | ||
this.groups.push(new Troop(unit.key, effect, this.groupid++, name, log)); | ||
if(group_amount>=effect) | ||
{ | ||
group_amount = group_amount - effect | ||
this.groups.push(new Troop(unit.key, effect, 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{ | ||
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)); | ||
} | ||
} | ||
} | ||
}); | ||
@@ -119,4 +121,2 @@ trainings.forEach(training => { | ||
// { | ||
// if(unit.skill.type != 'bulletproof') | ||
// unit.use = unit.use -1; | ||
// } | ||
@@ -123,0 +123,0 @@ // else{ |
@@ -17,3 +17,3 @@ import dunits from './units.json'; | ||
this.skill = dunits[key].skill; | ||
this.use = dunits[key].skill.use; | ||
this.use = dunits[key].use; | ||
this.type = dunits[key].type; | ||
@@ -20,0 +20,0 @@ } |
@@ -23,2 +23,3 @@ { | ||
"alcohols_cost": 400, | ||
"use":-1, | ||
"skill": {"type":"attack","effect":1,"range":1,"use":-1,"passive":true} | ||
@@ -47,2 +48,3 @@ }, | ||
"alcohols_cost": 0, | ||
"use":-1, | ||
"skill": {"type":"group","effect":4,"range":1,"use":-1,"passive":true} | ||
@@ -71,2 +73,3 @@ }, | ||
"alcohols_cost": 1300, | ||
"use":1, | ||
"skill": {"type":"shield","effect":2,"range":1,"use":1,"passive":true} | ||
@@ -95,2 +98,3 @@ }, | ||
"alcohols_cost": 12000, | ||
"use":3, | ||
"skill": {"type":"groupheal","effect":3,"range":3,"use":3,"passive":false} | ||
@@ -119,2 +123,3 @@ }, | ||
"alcohols_cost": 1200, | ||
"use":-1, | ||
"skill": {"type":"tastynasty","effect":1,"range":1,"use":-1,"passive":true} | ||
@@ -143,2 +148,3 @@ }, | ||
"alcohols_cost": 3200, | ||
"use":-1, | ||
"skill": {"type":"accuratehit","effect":1,"range":1,"use":-1,"passive":false} | ||
@@ -167,2 +173,3 @@ }, | ||
"alcohols_cost": 300, | ||
"use":-1, | ||
"skill": {"type":"attack","effect":0,"range":0,"use":-1,"passive":true} | ||
@@ -191,2 +198,3 @@ }, | ||
"alcohols_cost": 5600, | ||
"use":-1, | ||
"skill": {"type":"criticalhit","effect":15,"range":1.5,"use":-1,"passive":false} | ||
@@ -215,2 +223,3 @@ }, | ||
"alcohols_cost": 0, | ||
"use":-1, | ||
"skill": {"type":"multiplehit","effect":11,"range":2,"use":-1,"passive":false} | ||
@@ -239,2 +248,3 @@ }, | ||
"alcohols_cost": 7000, | ||
"use":2, | ||
"skill": {"type":"dodge","effect":1,"range":1,"use":2,"passive":true} | ||
@@ -263,2 +273,3 @@ }, | ||
"alcohols_cost": 13000, | ||
"use":3, | ||
"skill": {"type":"splash","effect":11,"range":6,"use":3,"passive":false} | ||
@@ -287,4 +298,5 @@ }, | ||
"alcohols_cost": 14000, | ||
"use":1, | ||
"skill": {"type":"bulletproof","effect":0,"range":0,"use":1,"passive":true} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2197661
6259