-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
605 lines (548 loc) · 34.7 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
//Button to initialize game
const button1 = document.querySelector("#startGame")
const darkButton = document.querySelector('.darkMode')
const darkChoice = document.querySelector('#choice0')
const darkChoice1 = document.querySelector('#choice1')
const darkChoice2 = document.querySelector('#choice2')
const imageMatch = document.querySelector('#imageMatch')
const remove = document.querySelector('#header')
const remove1 = document.querySelector('#arena')
const remove2 = document.querySelector('#bottomText')
const card = document.querySelector('#effect')
const buttonHome = document.querySelector('#homePage')
const forName = document.querySelector('#forName')
buttonHome.addEventListener('click', (e) => {
location.reload()
})
const match = document.querySelector('#match')
const body = document.querySelector('body')
darkButton.addEventListener('click', e => {
body.setAttribute("class", 'goingDark')
darkChoice.setAttribute('class', 'darkChoice')
darkChoice1.setAttribute('class', 'darkChoice')
darkChoice2.setAttribute('class', 'darkChoice')
})
let questions;
let dmg= 0;
let ehb = 0;
let hl = 0;
let aq = 0;
let ehn = 0;
let ssa = 0;
let dvs = 0;
let agg = 0;
let variables = [dmg,ehb,hl,aq,ehn,ssa,dvs,agg]
//Questions as objects in an array for the user to answer
button1.addEventListener("click", async () => {
questions = [
{
question: "How would you extend your kindness in a challenging situation?",
response: [
{answer: "Offer a listening ear and emotional support to a friend in need.", value: 10},
{answer: "Volunteer at a local charity or community organization to help those less fortunate.", value: 5},
{answer: "Surprise a loved one with a thoughtful gesture or gift to brighten their day.", value: 1}
]
},{
question: "How do you channel your excitement and passion into your daily life?",
response: [
{answer: "Engage in outdoor activities like hiking, dancing, or playing sports to stay active and energized.", value: 10},
{answer: "Join a hobby club or group that aligns with your interests to share your enthusiasm with like-minded individuals.", value: 1},
{answer: "Attend events, concerts, or gatherings that fuel your excitement and allow you to connect with new experiences.", value: 5}
]
},{
question: "How do you showcase courage in your life?",
response: [
{answer: "Stand up for a cause you believe in and actively work towards positive change in your community.", value: 10},
{answer: "Take on new opportunities or challenges, even if they seem daunting, to expand your horizons and overcome fear.", value: 1},
{answer: "Speak up for someone who is being treated unfairly or bullied, demonstrating your courage to defend others.", value: 5}
]
},{
question: "How do you approach challenging situations in your life?",
response: [
{answer: "Confront challenges head-on, drawing on inner strength and determination to find solutions.", value: 5},
{answer: "Seek advice and support from mentors or experienced individuals to navigate and overcome difficult situations.", value: 10},
{answer: "Reflect on past experiences and mistakes, learning from them to build the courage needed to face new challenges.", value: 1}
]
},{
question: "How do you channel your passion into your interests and activities?",
response: [
{answer: "Dive into creative projects that excite you, whether it's painting, writing, or designing, to express your passion.", value: 10},
{answer: "Share your enthusiasm by joining or starting a club, community, or group centered around a hobby or cause you're passionate about.", value: 5},
{answer: "Attend events, workshops, or conventions related to your passions, immersing yourself in an environment that fuels your excitement.", value: 1}
]
},{
question: "How do you extend your care and support to those around you?",
response: [
{answer: "Collaborate with others on projects or initiatives, ensuring everyone's voice is heard and contributions are valued.", value: 1},
{answer: "Volunteer your time and skills to support a cause or organization that aligns with your values, making a positive impact in your community.", value:5},
{answer: "Reach out to friends or acquaintances to offer help or encouragement, demonstrating empathy and understanding in their struggles.", value: 10}
]
},{
question: "How do you value and express your own independence in daily life?",
response: [
{answer: "Enjoy solo adventures or activities that allow you to explore and experience the world on your own terms.", value: 5},
{answer: "Advocate for your opinions and ideas, even if they differ from the majority, valuing your independence of thought and expression.", value: 10},
{answer: "Take on responsibilities and projects independently, demonstrating your capability and self-reliance.", value: 1}
]
},{
question: "How do you foster and strengthen your relationships with others?",
response: [
{answer: "Show your loyalty by consistently supporting and being there for your friends and loved ones, especially in their times of need.", value: 10},
{answer: "Engage in group activities, fostering a sense of camaraderie and unity among your friends and social circles.", value: 5},
{answer: "Encourage and celebrate the achievements and successes of those around you, building a supportive and uplifting community.", value: 1}
]
},{
question: "How do you showcase grace under pressure and adapt to changes in your life?",
response: [
{answer: "Maintain composure and a level head during challenging situations, handling them with grace and poise.", value: 5},
{answer: "Embrace change and learn from new experiences, adjusting and adapting your approach to meet evolving circumstances.", value: 1},
{answer: "Practice patience and understanding, recognizing that adaptability is essential for personal growth and success.", value: 10}
]
},{
question: "How do you empower and motivate others in your personal or professional life?",
response: [
{answer: "Encourage others to voice their ideas and opinions, fostering a sense of collaboration and empowerment within a group.", value: 10},
{answer: "Lead by example, showcasing dedication and determination in your pursuits to inspire and motivate those around you.", value: 5},
{answer: "Mentor or guide others to help them develop their skills and capabilities, empowering them to achieve their goals.", value: 1}
]
},{
question: "How do you demonstrate your commitment to safeguarding and supporting those you care about?",
response: [
{answer: "Prioritize the well-being and safety of your loved ones, always being there to offer guidance and protection when needed.", value: 5},
{answer: "Stand up for your friends and colleagues, advocating for their rights and interests, and fostering a strong sense of loyalty.", value: 1},
{answer: "Offer a listening ear and emotional support to those going through challenging times, demonstrating your care and loyalty.", value: 10}
]
},{
question: "How do you exhibit bravery and bounce back from setbacks in your life?",
response: [
{answer: "Face adversity head-on, showing courage in difficult situations and using challenges as opportunities for growth.", value: 5},
{answer: "Learn from failures and mistakes, using them as stepping stones toward future success and maintaining a resilient attitude.", value: 1},
{answer: "Encourage yourself and others to stay positive and persevere in the face of difficulties, demonstrating a strong spirit and determination.", value: 10}
]
},{
question: "How do you cultivate and nourish your relationships with others?",
response: [
{answer: "Organize gatherings and events to bring friends and acquaintances together, fostering a sense of unity and strengthening your bonds.", value: 1},
{answer: "Collaborate with others on projects or activities, appreciating diverse perspectives and working collectively to achieve common objectives.", value: 5},
{answer: "Show appreciation and gratitude towards your friends and loved ones, demonstrating your care and love through both words and actions.", value: 10}
]
},{
question: "How do you advocate for fairness and stand up for what you believe is right?",
response: [
{answer: "Participate in community service or volunteer activities, dedicating your time to help those in need and make a positive difference.", value: 10},
{answer: "Engage in discussions about social issues, raising awareness and encouraging others to take action for a more just and equal society.", value: 5},
{answer: "Stand up against injustice and unfair treatment, using your voice and influence to advocate for positive change and equality.", value: 1}
]
},{
question: "How do you maintain focus and keep pushing forward towards your goals?",
response: [
{answer: "Set clear goals and create a plan to achieve them, staying determined and focused on your objectives even during challenging times.", value: 1},
{answer: "Learn from failures and setbacks, using them as motivation to keep improving and working hard to reach your aspirations.", value: 10},
{answer: "Surround yourself with supportive and encouraging individuals, drawing strength from their belief in you to persevere and succeed.", value: 5}
]
},{
question: "How do you embrace curiosity and uncover new knowledge in your life?",
response: [
{answer: "Explore uncharted territories, whether it's traveling to new places or delving into unexplored topics, to satisfy your curiosity and thirst for discovery.", value: 1},
{answer: "Engage in intellectual discussions and debates, seeking to unravel complex ideas and concepts, and expanding your understanding of the world.", value: 10},
{answer: "Enjoy mystery novels, escape rooms, or detective games, immersing yourself in puzzles and enigmas that challenge your analytical thinking.", value: 5}
]
},{
question: "How do you respond effectively to unexpected situations or changes?",
response: [
{answer: "Stay calm under pressure, using your ability to think on your feet and make rapid decisions to navigate through unforeseen circumstances.", value: 1},
{answer: "Embrace change and view challenges as opportunities to learn and grow, adjusting your plans and strategies accordingly to succeed in any situation.", value: 10},
{answer: "Participate in games or activities that require quick reflexes and adaptability, honing your skills to react swiftly to changing circumstances.", value: 5}
]
},{
question: "How do you contribute to and strengthen the teams you are a part of?",
response: [
{answer: "Actively listen and consider the ideas and perspectives of your teammates, fostering an environment of open communication and mutual respect within the group.", value: 5},
{answer: "Delegate tasks effectively based on individual strengths and skills, ensuring a cohesive and productive team that works harmoniously towards a common goal.", value: 10},
{answer: "Celebrate the achievements and successes of your team members, acknowledging their contributions and creating a positive and motivating team dynamic.", value: 1}
]
},{
question: "How do you express sophistication and style in your daily life?",
response: [
{answer: "Cultivate a refined taste in art, literature, or music, appreciating the beauty and grace in the finer things in life.", value: 10},
{answer: "Dress in a manner that reflects your personal style and taste, presenting yourself with poise and sophistication in your fashion choices.", value: 5},
{answer: "Attend cultural events and gatherings, immersing yourself in experiences that enhance your appreciation for elegance and refined aesthetics.", value: 1}
]
},{
question: "How do you handle and bounce back from difficult situations?",
response: [
{answer: "Draw on your inner strength and determination to face adversity head-on, refusing to let challenges define or deter you.", value: 1},
{answer: "Seek support and advice from trusted friends or mentors, allowing their guidance and perspective to help you navigate through tough times and emerge stronger.", value: 10},
{answer: "Engage in activities that promote mental and emotional well-being, such as meditation or mindfulness, to build resilience and cope with stress.", value: 5}
]
},{
question: "How do you embrace curiosity and the unknown in your life?",
response: [
{answer: "Explore enigmatic stories, movies, or experiences that captivate your imagination and leave you pondering the unknown.", value: 10},
{answer: "Engage in intellectual conversations or debates, delving into complex topics and unraveling mysteries through critical thinking and analysis.", value: 5},
{answer: "Visit historical or culturally rich locations, immersing yourself in the mysterious allure of the past and embracing the intrigue of different cultures.", value: 1}
]
},{
question: "How do you harness your own strength to overcome challenges in your life?",
response: [
{answer: "Regularly engage in physical training or exercises to build and maintain your physical strength and endurance.", value: 1},
{answer: "Focus on mental and emotional resilience, developing the strength to face difficult situations with a clear and determined mind.", value: 5},
{answer: "Seek inspiration from role models or mentors who embody the kind of strength you aspire to possess, using their stories to motivate and guide you.", value: 10}
]
},{
question: "How do you express your creativity and innovative thinking?",
response: [
{answer: "Engage in hands-on projects or DIY activities, allowing your creativity to flow and manifest through crafting or building.", value: 1},
{answer: "Explore new technologies or advancements in your field of interest, constantly seeking innovative ideas and solutions to improve and evolve.", value: 5},
{answer: "Collaborate with diverse groups of people to gain new perspectives and insights, fostering creativity through varied and stimulating discussions.", value: 10}
]
},{
question: "How do you demonstrate loyalty and reliability to your friends, family, or colleagues?",
response: [
{answer: "Be there for your loved ones in times of need, offering unwavering support and demonstrating your loyalty through actions.", value: 10},
{answer: "Fulfill your commitments and responsibilities, ensuring others can depend on you to follow through on your promises and obligations.", value: 1},
{answer: "Prioritize the needs and well-being of your team or community, placing their interests at the forefront and showing your dedication to their success.", value: 5}
]
}
]
//Event listener function that commences upon button1 being pressed
//API call
const response = await axios.get('https://db.ygoprodeck.com/api/v7/cardinfo.php')
const monster = document.querySelector(".monsterPic")
const host = document.querySelector(".hostBox")
const weevil = document.querySelector(".weevil")
const monstArr = []
const desc = []
const monstName = []
const response2 = response.data.data
// For loop that grabs the specific data I wan and stores it in an array
for (let i = 0; i < response2.length; i++) {
if (response2[i].name === 'Dark Magician Girl' || response2[i].name === 'Harpie Lady' || response2[i].name === 'Elemental HERO Burstinatrix' || response2[i].name === 'Amazoness Queen' || response2[i].name === 'Elemental HERO Neos' || response2[i].name === 'SPYRAL Super Agent' || response2[i].name === 'Dhampir Vampire Sheridan' || response2[i].name === 'Ancient Gear Golem') {
x = response2[i].card_images[0].image_url_cropped
y = response2[i].desc
z = response2[i].name
desc.push(y)
monstArr.push(x)
monstName.push(z)
weevil.setAttribute('src', "clipart905265.png")
host.setAttribute('src', "clipart1246641.png")
}
}
console.log(monstName)
card.innerHTML = `${response2.name}`
const question = document.querySelector("#question")
const choices = Array.from(document.querySelectorAll(".choice"))
let currentQuestion = {}
let questionIndex = Math.floor(Math.random() * questions.length)
//Jeremy helped me design this wicked awesome code, thanks Jeremy
currentQuestion = questions[questionIndex]
questions.splice(questionIndex, 1)
const choice1 = document.querySelector("#choice0")
const choice2 = document.querySelector("#choice1")
const choice3 = document.querySelector("#choice2")
question.innerHTML = currentQuestion.question
choice1.innerHTML = currentQuestion.response[0].answer
choice2.innerHTML = currentQuestion.response[1].answer
choice3.innerHTML = currentQuestion.response[2].answer
function addListeners(evt) {
let id = evt.target.id[evt.target.id.length - 1]
questionIndex = Math.floor(Math.random() * questions.length)
currentQuestion = questions[questionIndex]
question.innerHTML = currentQuestion.question
choice1.innerHTML = currentQuestion.response[0].answer
choice2.innerHTML = currentQuestion.response[1].answer
choice3.innerHTML = currentQuestion.response[2].answer
questions.splice(questionIndex, 1);
if (currentQuestion.question === 'How would you extend your kindness in a challenging situation?') {
if (id === '0') {
dmg += currentQuestion.response[0].value
} else if (id === '1') {
dmg += currentQuestion.response[1].value
} else if (id === '2') {
dmg += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you channel your excitement and passion into your daily life?') {
if (id === '0') {
dmg += currentQuestion.response[0].value
} else if (id === '1') {
dmg += currentQuestion.response[1].value
} else if (id === '2') {
dmg += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you showcase courage in your life?') {
if (id === '0') {
dmg += currentQuestion.response[0].value
} else if (id === '1') {
dmg += currentQuestion.response[1].value
} else if (id === '2') {
dmg += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you approach challenging situations in your life?') {
if (id === '0') {
ehb += currentQuestion.response[0].value
} else if (id === '1') {
ehb += currentQuestion.response[1].value
} else if (id === '2') {
ehb += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you channel your passion into your interests and activities?') {
if (id === '0') {
ehb += currentQuestion.response[0].value
} else if (id === '1') {
ehb += currentQuestion.response[1].value
} else if (id === '2') {
ehb += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you extend your care and support to those around you?') {
if (id === '0') {
ehb += currentQuestion.response[0].value
} else if (id === '1') {
ehb += currentQuestion.response[1].value
} else if (id === '2') {
ehb += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you value and express your own independence in daily life?') {
if (id === '0') {
hl += currentQuestion.response[0].value
} else if (id === '1') {
hl += currentQuestion.response[1].value
} else if (id === '2') {
hl += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you foster and strengthen your relationships with others?') {
if (id === '0') {
hl += currentQuestion.response[0].value
} else if (id === '1') {
hl += currentQuestion.response[1].value
} else if (id === '2') {
hl += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you showcase grace under pressure and adapt to changes in your life?') {
if (id === '0') {
hl += currentQuestion.response[0].value
} else if (id === '1') {
hl += currentQuestion.response[1].value
} else if (id === '2') {
hl += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you empower and motivate others in your personal or professional life?') {
if (id === '0') {
aq += currentQuestion.response[0].value
} else if (id === '1') {
aq += currentQuestion.response[1].value
} else if (id === '2') {
aq += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you demonstrate your commitment to safeguarding and supporting those you care about?') {
if (id === '0') {
aq += currentQuestion.response[0].value
} else if (id === '1') {
aq += currentQuestion.response[1].value
} else if (id === '2') {
aq += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you exhibit bravery and bounce back from setbacks in your life?') {
if (id === '0') {
aq += currentQuestion.response[0].value
} else if (id === '1') {
aq += currentQuestion.response[1].value
} else if (id === '2') {
aq += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you cultivate and nourish your relationships with others?') {
if (id === '0') {
ehn += currentQuestion.response[0].value
} else if (id === '1') {
ehn += currentQuestion.response[1].value
} else if (id === '2') {
ehn += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you advocate for fairness and stand up for what you believe is right?') {
if (id === '0') {
ehn += currentQuestion.response[0].value
} else if (id === '1') {
ehn += currentQuestion.response[1].value
} else if (id === '2') {
ehn += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you maintain focus and keep pushing forward towards your goals?') {
if (id === '0') {
ehn += currentQuestion.response[0].value
} else if (id === '1') {
ehn += currentQuestion.response[1].value
} else if (id === '2') {
ehn += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you embrace curiosity and uncover new knowledge in your life?') {
if (id === '0') {
ssa += currentQuestion.response[0].value
} else if (id === '1') {
ssa += currentQuestion.response[1].value
} else if (id === '2') {
ssa += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you respond effectively to unexpected situations or changes?') {
if (id === '0') {
ssa += currentQuestion.response[0].value
} else if (id === '1') {
ssa += currentQuestion.response[1].value
} else if (id === '2') {
ssa += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you contribute to and strengthen the teams you are a part of?') {
if (id === '0') {
ssa += currentQuestion.response[0].value
} else if (id === '1') {
ssa += currentQuestion.response[1].value
} else if (id === '2') {
ssa += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you express sophistication and style in your daily life?') {
if (id === '0') {
dvs += currentQuestion.response[0].value
} else if (id === '1') {
dvs += currentQuestion.response[1].value
} else if (id === '2') {
dvs += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you handle and bounce back from difficult situations?') {
if (id === '0') {
dvs += currentQuestion.response[0].value
} else if (id === '1') {
dvs += currentQuestion.response[1].value
} else if (id === '2') {
dvs += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you embrace curiosity and the unknown in your life?') {
if (id === '0') {
dvs += currentQuestion.response[0].value
} else if (id === '1') {
dvs += currentQuestion.response[1].value
} else if (id === '2') {
dvs += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you harness your own strength to overcome challenges in your life?') {
if (id === '0') {
agg += currentQuestion.response[0].value
} else if (id === '1') {
agg += currentQuestion.response[1].value
} else if (id === '2') {
agg += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you express your creativity and innovative thinking?') {
if (id === '0') {
agg += currentQuestion.response[0].value
} else if (id === '1') {
agg += currentQuestion.response[1].value
} else if (id === '2') {
agg += currentQuestion.response[2].value
}
}
if (currentQuestion.question === 'How do you demonstrate loyalty and reliability to your friends, family, or colleagues?') {
if (id === '0') {
agg += currentQuestion.response[0].value
} else if (id === '1') {
agg += currentQuestion.response[1].value
} else if (id === '2') {
agg += currentQuestion.response[2].value
}
}
console.log(response2)
if (questions.length === 0) {
for (let i = 0; i < variables.length; i++) {
if (dmg === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
document.getElementById('match').style.display = 'flex'
imageMatch.setAttribute('src', monstArr[2])
forName.innerHTML = `${monstName[2]}`
card.innerHTML = `${desc[2]}`
} else if (ehb === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
document.getElementById('match').style.display = 'flex'
imageMatch.setAttribute('src', monstArr[4])
forName.innerHTML = `${monstName[4]}`
card.innerHTML = `Name:${monstName[4]} Description${ desc[4]}`
} else if (hl === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
imageMatch.setAttribute('src', monstArr[6])
document.getElementById('match').style.display = 'flex'
forName.innerHTML = `${monstName[6]}`
card.innerHTML = `Name:${monstName[6]}Description:${desc[6]}`
} else if (aq === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
imageMatch.setAttribute('src', monstArr[0])
document.getElementById('match').style.display = 'flex'
forName.innerHTML = `${monstName[0]}`
card.innerHTML = `${desc[0]}`
} else if (ehn === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
imageMatch.setAttribute('src', monstArr[5])
document.getElementById('match').style.display = 'flex'
forName.innerHTML = `${monstName[5]}`
card.innerHTML = `${desc[5]}`
} else if (ssa === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
imageMatch.setAttribute('src', monstArr[7])
document.getElementById('match').style.display = 'flex'
forName.innerHTML = `${monstName[7]}`
card.innerHTML = `${desc[7]}`
} else if (dvs === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
imageMatch.setAttribute('src', monstArr[3])
document.getElementById('match').style.display = 'flex'
forName.innerHTML = `${monstName[3]}`
card.innerHTML = `${desc[3]}`
} else if (agg === Math.max(dmg,ehb,hl,aq,ehn,ssa,dvs,agg)) {
remove.remove()
remove1.remove()
remove2.remove()
imageMatch.setAttribute('src', monstArr[1])
document.getElementById('match').style.display = 'flex'
forName.innerHTML = `${monstName[1]}`
card.innerHTML = `${desc[1]}`
}
}
}
}
ansButton = document.querySelectorAll(".choice")
// Hayk assisted me with the code below, thanks Hayk
choices.forEach(choice => {
choice.addEventListener("click", addListeners)
})
})