mirror of
https://github.com/LucasVbr/EnglishRolePlayGame.git
synced 2026-05-13 17:11:50 +00:00
Edit
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
particlesJS('particles-js',
|
||||
{
|
||||
"particles": {
|
||||
"number": {
|
||||
"value": 40,
|
||||
"density": {
|
||||
"enable": true,
|
||||
"value_area": 800
|
||||
}
|
||||
},
|
||||
"color": {
|
||||
"value": "#ffffff"
|
||||
},
|
||||
"shape": {
|
||||
"type": "circle",
|
||||
"stroke": {
|
||||
"width": 0,
|
||||
"color": "#000000"
|
||||
},
|
||||
"polygon": {
|
||||
"nb_sides": 5
|
||||
},
|
||||
"image": {
|
||||
"src": "img/github.svg",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
}
|
||||
},
|
||||
"opacity": {
|
||||
"value": 0.5,
|
||||
"random": false,
|
||||
"anim": {
|
||||
"enable": false,
|
||||
"speed": 1,
|
||||
"opacity_min": 0.1,
|
||||
"sync": false
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"value": 5,
|
||||
"random": true,
|
||||
"anim": {
|
||||
"enable": false,
|
||||
"speed": 40,
|
||||
"size_min": 0.1,
|
||||
"sync": false
|
||||
}
|
||||
},
|
||||
"line_linked": {
|
||||
"enable": true,
|
||||
"distance": 150,
|
||||
"color": "#ffffff",
|
||||
"opacity": 0.4,
|
||||
"width": 1
|
||||
},
|
||||
"move": {
|
||||
"enable": true,
|
||||
"speed": 6,
|
||||
"direction": "none",
|
||||
"random": false,
|
||||
"straight": false,
|
||||
"out_mode": "out",
|
||||
"attract": {
|
||||
"enable": false,
|
||||
"rotateX": 600,
|
||||
"rotateY": 1200
|
||||
}
|
||||
}
|
||||
},
|
||||
"interactivity": {
|
||||
"detect_on": "canvas",
|
||||
"events": {
|
||||
"onhover": {
|
||||
"enable": true,
|
||||
"mode": "grab"
|
||||
},
|
||||
"onclick": {
|
||||
"enable": false,
|
||||
"mode": "push"
|
||||
},
|
||||
"resize": true
|
||||
},
|
||||
"modes": {
|
||||
"grab": {
|
||||
"distance": 200,
|
||||
"line_linked": {
|
||||
"opacity": 1
|
||||
}
|
||||
},
|
||||
"bubble": {
|
||||
"distance": 400,
|
||||
"size": 40,
|
||||
"duration": 2,
|
||||
"opacity": 8,
|
||||
"speed": 3
|
||||
},
|
||||
"repulse": {
|
||||
"distance": 200
|
||||
},
|
||||
"push": {
|
||||
"particles_nb": 4
|
||||
},
|
||||
"remove": {
|
||||
"particles_nb": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"retina_detect": true,
|
||||
"config_demo": {
|
||||
"hide_card": false,
|
||||
"background_color": "#b61924",
|
||||
"background_image": "",
|
||||
"background_position": "50% 50%",
|
||||
"background_repeat": "no-repeat",
|
||||
"background_size": "cover"
|
||||
}
|
||||
}
|
||||
);
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
let data = [
|
||||
{
|
||||
question:"You conceived a virus: do you sell it?",
|
||||
answers: ["Yes","No"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"You have to protect the NASA from cyber attacks, what do you do?",
|
||||
answers: ["I implement a password manager","I raise employee awareness"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question: "Do you send a phishing email to E-Corp (a NASA subsidiary) with your virus?",
|
||||
answers: ["Yes","No"],
|
||||
points: [4, 1]
|
||||
},
|
||||
{
|
||||
question: "Today, half of the company's computers have crashed: all the processors have imploded and caused a fire in the building, what do you do?",
|
||||
answers: ["I put water to put out the fire","I cut the company's power supply in an emergency"],
|
||||
points: [1, 4]
|
||||
},
|
||||
{
|
||||
question: "Do I get information about NASA employees?",
|
||||
answers: ["Yes","No"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"Do you update the company's VPS virus database?",
|
||||
answers: ["Yes","No"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"You develop a Trojan horse, do you want to publish it on the darkweb?",
|
||||
answers: ["Yes","No"],
|
||||
points: [4, 1]
|
||||
},
|
||||
{
|
||||
question:"Do you spend all day surfing hacking forums?",
|
||||
answers: ["Yes","No"],
|
||||
points: [2, 3]
|
||||
},
|
||||
{
|
||||
question:"Do you want to launch a DDoS attack on the delivery website of the local pizzeria?",
|
||||
answers: ["Yes","No"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"Although you have tried to protect the company, you are a victim of ransomware, what do you do?",
|
||||
answers: ["I disconnect all the power supplies and the company network","I wait for the director to pay the ransom"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"To protect your money do you convert it into Bitcoin?",
|
||||
answers: ["Yes","No"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"You have discovered a virus with interesting technology.",
|
||||
answers: ["You try to trace the hacker from it","You show it to the police and inform the director"],
|
||||
points: [4, 1]
|
||||
},
|
||||
{
|
||||
question:"You become more and more known in the hacking world and you decide to set up a team, do you attack the NSA?",
|
||||
answers: ["Yes","No"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"While surfing on darkweb forums, you heard about the creation of a suspicious team of hackers.",
|
||||
answers: ["You try to infiltrate them","You hire someone to track them down"],
|
||||
points: [3, 3]
|
||||
},
|
||||
{
|
||||
question:"A member of your team reported you to the authorities, what do you do?",
|
||||
answers: ["I move all my money to another bank and change my identity","I move to another country"],
|
||||
points: [4, 1]
|
||||
},
|
||||
{
|
||||
question:"You just got a promotion for your investment in the company. Do you invite your friends to celebrate this good news?",
|
||||
answers: ["Yes","No, I'm already invited to another party"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"Friends invite me to a party, do you go?",
|
||||
answers: ["Yes, no worries, my group will carry out an attack during the night","No, I could be attacked when I'm away"],
|
||||
points: [3, 2]
|
||||
},
|
||||
{
|
||||
question:"During your party you get a call from your boss who informs you that someone has entered the HoneyPot you set up.",
|
||||
answers: ["I continue the party because I am confident in my technology","I leave the party and drive back to work (drink driving again...)"],
|
||||
points: [4, 1]
|
||||
},
|
||||
{
|
||||
question:"You program a website that sells the NASA information, do you put up the information of your friend who works there?",
|
||||
answers: ["Yes","No"],
|
||||
points: [4, 1]
|
||||
},
|
||||
{
|
||||
question:"You hack the website and have access to the information of the hackers, do you want to reveal their identities to the public?",
|
||||
answers: ["Yes","No"],
|
||||
points: [4, 1]
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,87 @@
|
||||
let turn = 0;
|
||||
|
||||
let playerHacker = "";
|
||||
let playerCyber = "";
|
||||
|
||||
let expHacker = 0;
|
||||
let expCyber = 0;
|
||||
|
||||
function main() {
|
||||
|
||||
nextTurn(turn);
|
||||
answersCanvasElement.style.visibility = "visible";
|
||||
turnCanvasElement.style.visibility = "visible";
|
||||
|
||||
}
|
||||
|
||||
function nextTurn(id, rep=0) {
|
||||
const titles = [
|
||||
`Hacker's turn (${playerHacker})`,
|
||||
`Cybersecurity engineer's turn (${playerCyber})`
|
||||
];
|
||||
|
||||
if (id !== 20) {
|
||||
turnTitle.innerText = titles[id % 2];
|
||||
|
||||
hackerPoints.innerHTML = expHacker;
|
||||
cyberPoints.innerHTML = expCyber;
|
||||
|
||||
if (id % 2 === 0) {
|
||||
/* Hacker Turn */
|
||||
backgroundElement.classList.remove("turn-cyber");
|
||||
backgroundElement.classList.add("turn-hacker");
|
||||
|
||||
answerOneInput.style.boxShadow = "var(--black) 0px 0px 25px";
|
||||
answerTwoInput.style.boxShadow = "var(--black) 0px 0px 25px";
|
||||
|
||||
expHacker += data[id].points[rep];
|
||||
|
||||
} else {
|
||||
/* Cyber Turn */
|
||||
backgroundElement.classList.remove("turn-hacker");
|
||||
backgroundElement.classList.add("turn-cyber");
|
||||
|
||||
answerOneInput.style.boxShadow = "var(--black) 0px 0px 25px";
|
||||
answerTwoInput.style.boxShadow = "var(--black) 0px 0px 25px";
|
||||
|
||||
expCyber += data[id].points[rep];
|
||||
}
|
||||
|
||||
|
||||
console.log(`expCyber:${expCyber}\nexpHacker:${expHacker}`);
|
||||
|
||||
titleElement.innerText = data[id].question;
|
||||
answerOneInput.innerText = data[id].answers[0];
|
||||
answerTwoInput.innerText = data[id].answers[1];
|
||||
|
||||
turn++;
|
||||
} else {
|
||||
turnCanvasElement.style.visibility = "hidden";
|
||||
answersCanvasElement.style.visibility = "hidden";
|
||||
|
||||
if (expHacker > expCyber) {
|
||||
titleElement.innerText = playerHacker + " Won!";
|
||||
} else {
|
||||
titleElement.innerText = playerCyber + " Won!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startGame() {
|
||||
playerOneName = playerOneInput.value !== "" ? playerOneInput.value : "Player 1";
|
||||
playerTwoName = playerTwoInput.value !== "" ? playerTwoInput.value : "Player 2";
|
||||
|
||||
/* Cacher le menu de d'input des pseudos */
|
||||
pseudoCanvasElement.style.visibility = "hidden";
|
||||
|
||||
/* Attribue les pseudos */
|
||||
if (Math.random() < 0.5) {
|
||||
playerHacker = playerOneName;
|
||||
playerCyber = playerTwoName;
|
||||
} else {
|
||||
playerHacker = playerTwoName;
|
||||
playerCyber = playerOneName;
|
||||
}
|
||||
|
||||
main();
|
||||
}
|
||||
Reference in New Issue
Block a user