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.1.6 to 0.1.7

lib/drugs.json

25

lib/card.js

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

var Card = function () {
function Card(quality) {
function Card(quality, seed) {
(0, _classCallCheck3.default)(this, Card);

@@ -56,2 +56,3 @@

this.quality = quality;
this.seed = seed;
this.attack = 0;

@@ -91,5 +92,5 @@ this.health = 0;

key: 'getFamily',
value: function getFamily() {
value: function getFamily(seed) {
var rnd = 0;
rnd = this.getRandomInt(1000);
rnd = parseInt(seed.toString().substring(0, 2) * 10);
if (rnd > 999) {

@@ -109,5 +110,5 @@ return 'cops';

key: 'getAttackType',
value: function getAttackType() {
value: function getAttackType(seed) {
var rnd = 0;
rnd = this.getRandomInt(1000);
rnd = parseInt(seed.toString().substring(1, 3) * 10);
if (rnd > 800) {

@@ -127,7 +128,11 @@ return 'chemical';

key: 'generate',
value: function generate(quality) {
value: function generate(quality, seed) {
this.quality = quality;
this.family = this.getFamily();
var hero = _heroes2.default[this.family][this.getRandomArray(_heroes2.default[this.family].length)];
this.family = this.getFamily(seed);
var hero = _heroes2.default[this.family][seed];
var passage = 1;
while (hero === undefined) {
hero = _heroes2.default[this.family][Math.round(seed / 10) - passage];
passage++;
}
this.name = hero.name;

@@ -141,3 +146,3 @@ this.country = hero.country;

this.background = this.getRandomInt(4);
this.attack_type = this.getAttackType();
this.attack_type = this.getAttackType(seed);
this.prefixe = this.setPrefixes(this.quality, this.family);

@@ -144,0 +149,0 @@ this.suffixe = this.setSuffixe(this.quality, this.attack_type);

18

lib/cardpack.js

@@ -22,10 +22,12 @@ 'use strict';

var CardPack = function () {
function CardPack(amount) {
function CardPack(amount, seed) {
(0, _classCallCheck3.default)(this, CardPack);
this.cards = [];
var all = 3;
for (var i = 0; i < amount; i += 1) {
var gen = new _card2.default();
var card = gen.generate(this.setItemQuality());
var card = gen.generate(this.setItemQuality(seed.substring(all - 3, all)), seed.substring(all - 3, all));
this.cards.push(card);
all += 3;
}

@@ -36,15 +38,13 @@ }

key: 'setItemQuality',
value: function setItemQuality() {
var rnd = 0;
rnd = Math.floor(Math.random() * Math.floor(1000));
if (rnd > 990) {
value: function setItemQuality(seed) {
if (seed > 990) {
return 1;
}
if (rnd > 950) {
if (seed > 950) {
return 2;
}
if (rnd > 870) {
if (seed > 870) {
return 3;
}
if (rnd > 710) {
if (seed > 710) {
return 4;

@@ -51,0 +51,0 @@ } else {

@@ -41,2 +41,10 @@ 'use strict';

var _drugs = require('./drugs.json');
var _drugs2 = _interopRequireDefault(_drugs);
var _locations = require('./locations.json');
var _locations2 = _interopRequireDefault(_locations);
var _utils = require('./utils');

@@ -59,3 +67,5 @@

trainings: _trainings2.default,
drugs: _drugs2.default,
locations: _locations2.default,
utils: _utils2.default
};
{
"name": "drugwars",
"version": "0.1.06",
"version": "0.1.07",
"description": "A lightweight JavaScript library for DrugWars",

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

@@ -8,3 +8,3 @@ import suffixes from './suffixes.json';

export default class Card {
constructor(quality) {
constructor(quality,seed) {
this.id = '';

@@ -24,2 +24,3 @@ this.prefixe = '';

this.quality = quality;
this.seed = seed;
this.attack = 0;

@@ -54,5 +55,5 @@ this.health= 0;

getFamily() {
getFamily(seed) {
var rnd = 0
rnd = this.getRandomInt(1000)
rnd = parseInt(seed.toString().substring(0,2)*10);
if (rnd > 999) {

@@ -72,5 +73,5 @@ return 'cops'

getAttackType() {
getAttackType(seed) {
var rnd = 0
rnd = this.getRandomInt(1000)
rnd = parseInt(seed.toString().substring(1,3)*10);
if (rnd > 800) {

@@ -90,8 +91,11 @@ return 'chemical'

generate(quality) {
generate(quality,seed) {
this.quality = quality;
this.family = this.getFamily()
const hero = heroes[this.family][this.getRandomArray(heroes[this.family].length)]
this.family = this.getFamily(seed);
let hero = heroes[this.family][seed];
let passage = 1;
while (hero === undefined) {
hero = heroes[this.family][(Math.round(seed/10))-passage];
passage++;
}
this.name = hero.name;

@@ -105,3 +109,3 @@ this.country = hero.country;

this.background = this.getRandomInt(4);
this.attack_type = this.getAttackType()
this.attack_type = this.getAttackType(seed)
this.prefixe = this.setPrefixes(this.quality,this.family);

@@ -108,0 +112,0 @@ this.suffixe = this.setSuffixe(this.quality,this.attack_type);

import Card from './card';
export default class CardPack {
constructor(amount) {
constructor(amount,seed) {
this.cards = [];
let all = 3;
for (let i = 0; i < amount; i += 1) {
const gen = new Card;
let card = gen.generate(this.setItemQuality())
let card = gen.generate(this.setItemQuality(seed.substring(all-3,all)),seed.substring(all-3,all))
this.cards.push(card);
all+=3;
}

@@ -14,15 +16,13 @@ }

setItemQuality() {
var rnd = 0
rnd = Math.floor(Math.random() * Math.floor(1000))
if (rnd > 990) {
setItemQuality(seed) {
if (seed > 990) {
return 1
}
if (rnd > 950) {
if (seed > 950) {
return 2
}
if (rnd > 870) {
if (seed > 870) {
return 3
}
if (rnd > 710) {
if (seed > 710) {
return 4

@@ -29,0 +29,0 @@ }

@@ -11,2 +11,4 @@ import { Client } from 'kbyte';

import trainings from './trainings.json';
import drugs from './drugs.json';
import locations from './locations.json';
import utils from './utils';

@@ -24,3 +26,5 @@ module.exports = {

trainings,
drugs,
locations,
utils,
};

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