2017-08-30 19:44:29 +02:00
|
|
|
import {CONSTANTS} from "./Constants.js";
|
|
|
|
import {Player} from "./Player.js";
|
|
|
|
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
|
|
|
|
2017-05-03 19:52:54 +02:00
|
|
|
/* Crimes.js */
|
2017-05-04 07:05:48 +02:00
|
|
|
function commitShopliftCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeShoplift;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 0, 0, 2, 2, 0, 15000, 2000); //$7500/s, 1 exp/s
|
|
|
|
}
|
|
|
|
|
|
|
|
function commitRobStoreCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeRobStore;
|
|
|
|
Player.startCrime(30, 0, 0, 45, 45, 0, 400000, 60000); //$6666,6/2, 0.5exp/s, 0.75exp/s
|
2017-07-30 21:11:30 +02:00
|
|
|
}
|
2017-05-04 07:05:48 +02:00
|
|
|
|
|
|
|
function commitMugCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeMug;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 3, 3, 3, 3, 0, 36000, 4000); //$9000/s, .66 exp/s
|
|
|
|
}
|
|
|
|
|
|
|
|
function commitLarcenyCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeLarceny;
|
|
|
|
Player.startCrime(45, 0, 0, 60, 60, 0, 800000, 90000) // $8888.88/s, .5 exp/s, .66 exp/s
|
2017-07-30 21:11:30 +02:00
|
|
|
}
|
2017-05-04 07:05:48 +02:00
|
|
|
|
|
|
|
function commitDealDrugsCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeDrugs;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 0, 0, 5, 5, 10, 120000, 10000); //$12000/s, .5 exp/s, 1 exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitTraffickArmsCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeTraffickArms;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 20, 20, 20, 20, 40, 600000, 40000); //$15000/s, .5 combat exp/s, 1 cha exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitHomicideCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeHomicide;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 2, 2, 2, 2, 0, 45000, 3000); //$15000/s, 0.66 combat exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-05-08 18:00:34 +02:00
|
|
|
function commitGrandTheftAutoCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeGrandTheftAuto;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 20, 20, 20, 80, 40, 1600000, 80000); //$20000/s, .25 exp/s, 1 exp/s, .5 exp/s
|
2017-05-08 18:00:34 +02:00
|
|
|
}
|
|
|
|
|
2017-05-04 07:05:48 +02:00
|
|
|
function commitKidnapCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeKidnap;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 80, 80, 80, 80, 80, 3600000, 120000); //$30000/s. .66 exp/s
|
2017-05-08 18:00:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitAssassinationCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeAssassination;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(0, 300, 300, 300, 300, 0, 12000000, 300000); //$40000/s, 1 exp/s
|
2017-05-08 18:00:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function commitHeistCrime() {
|
|
|
|
Player.crimeType = CONSTANTS.CrimeHeist;
|
2017-08-01 21:03:45 +02:00
|
|
|
Player.startCrime(450, 450, 450, 450, 450, 450, 120000000, 600000); //$200000/s, .75exp/s
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeSuccess(crime, moneyGained) {
|
|
|
|
var chance = 0;
|
|
|
|
switch (crime) {
|
|
|
|
case CONSTANTS.CrimeShoplift:
|
2017-07-30 21:11:30 +02:00
|
|
|
chance = determineCrimeChanceShoplift();
|
2017-05-04 07:05:48 +02:00
|
|
|
break;
|
2017-08-01 21:03:45 +02:00
|
|
|
case CONSTANTS.CrimeRobStore:
|
|
|
|
chance = determineCrimeChanceRobStore();
|
|
|
|
break;
|
2017-05-04 07:05:48 +02:00
|
|
|
case CONSTANTS.CrimeMug:
|
|
|
|
chance = determineCrimeChanceMug();
|
|
|
|
break;
|
2017-08-01 21:03:45 +02:00
|
|
|
case CONSTANTS.CrimeLarceny:
|
|
|
|
chance = determineCrimeChanceLarceny();
|
|
|
|
break;
|
2017-05-04 07:05:48 +02:00
|
|
|
case CONSTANTS.CrimeDrugs:
|
|
|
|
chance = determineCrimeChanceDealDrugs();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeTraffickArms:
|
|
|
|
chance = determineCrimeChanceTraffickArms();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeHomicide:
|
|
|
|
chance = determineCrimeChanceHomicide();
|
|
|
|
break;
|
2017-05-08 18:00:34 +02:00
|
|
|
case CONSTANTS.CrimeGrandTheftAuto:
|
|
|
|
chance = determineCrimeChanceGrandTheftAuto();
|
|
|
|
break;
|
2017-05-04 07:05:48 +02:00
|
|
|
case CONSTANTS.CrimeKidnap:
|
|
|
|
chance = determineCrimeChanceKidnap();
|
|
|
|
break;
|
2017-05-08 18:00:34 +02:00
|
|
|
case CONSTANTS.CrimeAssassination:
|
|
|
|
chance = determineCrimeChanceAssassination();
|
|
|
|
break;
|
|
|
|
case CONSTANTS.CrimeHeist:
|
|
|
|
chance = determineCrimeChanceHeist();
|
|
|
|
break;
|
2017-05-04 07:05:48 +02:00
|
|
|
default:
|
2017-08-01 21:03:45 +02:00
|
|
|
console.log(crime);
|
2017-05-04 07:05:48 +02:00
|
|
|
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
|
|
|
|
return;
|
|
|
|
}
|
2017-07-30 21:11:30 +02:00
|
|
|
|
2017-05-04 09:05:43 +02:00
|
|
|
if (Math.random() <= chance) {
|
2017-05-04 07:05:48 +02:00
|
|
|
//Success
|
|
|
|
Player.gainMoney(moneyGained);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
//Failure
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceShoplift() {
|
2017-06-18 10:24:08 +02:00
|
|
|
var chance = ((Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) * 20;
|
2017-07-30 21:11:30 +02:00
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-08-01 21:03:45 +02:00
|
|
|
function determineCrimeChanceRobStore() {
|
|
|
|
var chance = ((0.5 * Player.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
2 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
1 * Player.agility / CONSTANTS.MaxSkillLevel)) * 5;
|
|
|
|
chance *= Player.crime_success_mult;
|
|
|
|
return Math.min(chance, 1);
|
|
|
|
}
|
|
|
|
|
2017-05-04 07:05:48 +02:00
|
|
|
function determineCrimeChanceMug() {
|
2017-08-01 21:03:45 +02:00
|
|
|
var chance = ((1.5 * Player.strength / CONSTANTS.MaxSkillLevel +
|
2017-07-30 21:11:30 +02:00
|
|
|
0.5 * Player.defense / CONSTANTS.MaxSkillLevel +
|
2017-06-26 01:39:17 +02:00
|
|
|
1.5 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-06-18 10:24:08 +02:00
|
|
|
0.5 * Player.agility / CONSTANTS.MaxSkillLevel)) * 5;
|
2017-05-30 15:57:24 +02:00
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-08-01 21:03:45 +02:00
|
|
|
function determineCrimeChanceLarceny() {
|
|
|
|
var chance = ((0.5 * Player.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) * 3;
|
|
|
|
chance *= Player.crime_success_mult;
|
|
|
|
return Math.min(chance, 1);
|
|
|
|
}
|
|
|
|
|
2017-05-04 07:05:48 +02:00
|
|
|
function determineCrimeChanceDealDrugs() {
|
2017-06-18 10:24:08 +02:00
|
|
|
var chance = ((3*Player.charisma / CONSTANTS.MaxSkillLevel +
|
|
|
|
2*Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-04 20:37:57 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel));
|
2017-05-30 15:57:24 +02:00
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceTraffickArms() {
|
2017-05-04 20:37:57 +02:00
|
|
|
var chance = ((Player.charisma / CONSTANTS.MaxSkillLevel +
|
2017-07-30 21:11:30 +02:00
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
2017-05-04 07:05:48 +02:00
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-08 16:33:26 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 2;
|
2017-05-30 15:57:24 +02:00
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceHomicide() {
|
2017-07-30 21:11:30 +02:00
|
|
|
var chance = ((2 * Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
2 * Player.defense / CONSTANTS.MaxSkillLevel +
|
2017-06-18 10:24:08 +02:00
|
|
|
0.5 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
|
|
|
0.5 * Player.agility / CONSTANTS.MaxSkillLevel));
|
2017-05-30 15:57:24 +02:00
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-05-08 18:00:34 +02:00
|
|
|
function determineCrimeChanceGrandTheftAuto() {
|
2017-07-30 21:11:30 +02:00
|
|
|
var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
2017-05-08 18:00:34 +02:00
|
|
|
4 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-07-30 21:11:30 +02:00
|
|
|
2 * Player.agility / CONSTANTS.MaxSkillLevel +
|
2017-05-30 15:57:24 +02:00
|
|
|
2 * Player.charisma / CONSTANTS.MaxSkillLevel)) / 8;
|
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-08 18:00:34 +02:00
|
|
|
return Math.min(chance, 1);
|
|
|
|
}
|
|
|
|
|
2017-05-04 07:05:48 +02:00
|
|
|
function determineCrimeChanceKidnap() {
|
2017-05-15 02:14:13 +02:00
|
|
|
var chance = ((Player.charisma / CONSTANTS.MaxSkillLevel +
|
2017-07-30 21:11:30 +02:00
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
2017-05-04 07:05:48 +02:00
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-06-18 10:24:08 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 5;
|
2017-05-30 15:57:24 +02:00
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-08 18:00:34 +02:00
|
|
|
return Math.min(chance, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceAssassination() {
|
2017-07-30 21:11:30 +02:00
|
|
|
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
|
2017-06-18 10:24:08 +02:00
|
|
|
2 * Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-05-30 15:57:24 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel)) / 8;
|
|
|
|
chance *= Player.crime_success_mult;
|
2017-07-30 21:11:30 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-08 18:00:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function determineCrimeChanceHeist() {
|
2017-07-30 21:11:30 +02:00
|
|
|
var chance = ((Player.hacking_skill / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.strength / CONSTANTS.MaxSkillLevel +
|
|
|
|
Player.defense / CONSTANTS.MaxSkillLevel +
|
2017-05-08 18:00:34 +02:00
|
|
|
Player.dexterity / CONSTANTS.MaxSkillLevel +
|
2017-07-30 21:11:30 +02:00
|
|
|
Player.agility / CONSTANTS.MaxSkillLevel +
|
2017-05-30 15:57:24 +02:00
|
|
|
Player.charisma / CONSTANTS.MaxSkillLevel)) / 18;
|
|
|
|
chance *= Player.crime_success_mult;
|
2017-05-04 20:37:57 +02:00
|
|
|
return Math.min(chance, 1);
|
2017-05-04 07:05:48 +02:00
|
|
|
}
|
2017-08-30 19:44:29 +02:00
|
|
|
|
|
|
|
export {commitShopliftCrime, commitRobStoreCrime, commitMugCrime,
|
|
|
|
commitLarcenyCrime, commitDealDrugsCrime, commitTraffickArmsCrime,
|
|
|
|
commitHomicideCrime, commitGrandTheftAutoCrime, commitKidnapCrime,
|
|
|
|
commitAssassinationCrime, commitHeistCrime, determineCrimeSuccess,
|
|
|
|
determineCrimeChanceShoplift, determineCrimeChanceRobStore,
|
|
|
|
determineCrimeChanceMug, determineCrimeChanceLarceny,
|
|
|
|
determineCrimeChanceDealDrugs, determineCrimeChanceTraffickArms,
|
|
|
|
determineCrimeChanceHomicide, determineCrimeChanceGrandTheftAuto,
|
|
|
|
determineCrimeChanceKidnap, determineCrimeChanceAssassination,
|
|
|
|
determineCrimeChanceHeist};
|