bitburner-src/src/Crimes.js

118 lines
4.2 KiB
JavaScript
Raw Normal View History

/* Crimes.js */
2017-05-04 07:05:48 +02:00
function commitShopliftCrime() {
Player.crimeType = CONSTANTS.CrimeShoplift;
Player.startCrime(0, 0.5, 0.5, 0.5, 0.5, 0, 1000, 2000); //$500/s, .25 exp/s
2017-05-04 07:05:48 +02:00
}
function commitMugCrime() {
Player.crimeType = CONSTANTS.CrimeMug;
Player.startCrime(0, 1, 1, 1, 1, 0, 3000, 4000); //$750/s, .2 exp/s
2017-05-04 07:05:48 +02:00
}
function commitDealDrugsCrime() {
Player.crimeType = CONSTANTS.CrimeDrugs;
Player.startCrime(0, 2, 2, 2, 2, 2, 10000, 10000); //$1000/s, .2 exp/s
2017-05-04 07:05:48 +02:00
}
function commitTraffickArmsCrime() {
Player.crimeType = CONSTANTS.CrimeTraffickArms;
Player.startCrime(0, 8, 8, 8, 8, 12, 60000, 40000); //$1500/s, .2 combat exp/s, .3 cha exp/s
2017-05-04 07:05:48 +02:00
}
function commitHomicideCrime() {
Player.crimeType = CONSTANTS.CrimeHomicide;
Player.startCrime(0, 2, 2, 2, 2, 0, 1000, 3000); //$333.3/s, 0.66 combat exp/s
2017-05-04 07:05:48 +02:00
}
function commitKidnapCrime() {
Player.crimeType = CONSTANTS.CrimeKidnap;
Player.startCrime(0, 20, 20, 20, 20, 20, 200000, 120000); //$1666.666/s. .167 exp/s
2017-05-04 07:05:48 +02:00
}
function determineCrimeSuccess(crime, moneyGained) {
var chance = 0;
switch (crime) {
case CONSTANTS.CrimeShoplift:
chance = determineCrimeChanceShoplift();
break;
case CONSTANTS.CrimeMug:
chance = determineCrimeChanceMug();
break;
case CONSTANTS.CrimeDrugs:
chance = determineCrimeChanceDealDrugs();
break;
case CONSTANTS.CrimeTraffickArms:
chance = determineCrimeChanceTraffickArms();
break;
case CONSTANTS.CrimeHomicide:
chance = determineCrimeChanceHomicide();
break;
case CONSTANTS.CrimeKidnap:
chance = determineCrimeChanceKidnap();
break;
default:
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
return;
}
if (Math.random() <= chance) {
2017-05-04 07:05:48 +02:00
//Success
Player.gainMoney(moneyGained);
return true;
} else {
//Failure
return false;
}
}
function determineCrimeChanceShoplift() {
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
2017-05-04 07:05:48 +02:00
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) * 8;
return Math.min(chance, 1);
2017-05-04 07:05:48 +02:00
}
function determineCrimeChanceMug() {
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
2017-05-04 07:05:48 +02:00
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) * 4;
return Math.min(chance, 1);
2017-05-04 07:05:48 +02:00
}
function determineCrimeChanceDealDrugs() {
var chance = ((1.5*Player.charisma / CONSTANTS.MaxSkillLevel +
Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel));
return Math.min(chance, 1);
2017-05-04 07:05:48 +02:00
}
function determineCrimeChanceTraffickArms() {
var chance = ((Player.charisma / CONSTANTS.MaxSkillLevel +
2017-05-04 07:05:48 +02:00
Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) / 2;
return Math.min(chance, 1);
2017-05-04 07:05:48 +02:00
}
function determineCrimeChanceHomicide() {
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
2017-05-04 07:05:48 +02:00
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel));
return Math.min(chance, 1);
2017-05-04 07:05:48 +02:00
}
function determineCrimeChanceKidnap() {
return ((Player.charisma / CONSTANTS.MaxSkillLevel +
Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) / 4;
return Math.min(chance, 1);
2017-05-04 07:05:48 +02:00
}