-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsocial_engineering.go
68 lines (60 loc) · 1.76 KB
/
social_engineering.go
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
package main
import (
"fmt"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/inpututil"
)
type DialogueOption struct {
Text string
IsCorrect bool
}
var (
socialEngineeringStep int
dialogueOptions [][]DialogueOption
)
func initSocialEngineeringMiniGame() {
socialEngineeringStep = 0
dialogueOptions = [][]DialogueOption{
{
{"Ask about their day", false},
{"Ask for their password", false},
{"Mention a mutual contact", true},
},
{
{"Ask about their work", true},
{"Ask for sensitive info", false},
{"Talk about the weather", false},
},
// Add more steps as needed
}
}
func drawSocialEngineeringMiniGame(screen *ebiten.Image) {
if socialEngineeringStep >= len(dialogueOptions) {
completeMission(true)
return
}
options := dialogueOptions[socialEngineeringStep]
conversationText := fmt.Sprintf("Step %d: Choose your dialogue option", socialEngineeringStep+1)
drawCenteredText(screen, conversationText, 100, fontFace)
for i, option := range options {
drawCenteredText(screen, fmt.Sprintf("%d. %s", i+1, option.Text), 150+(i*30), fontFace)
}
drawCenteredText(screen, "Press 1, 2, or 3 to choose\nPress Escape to fail", 250, fontFace)
}
func handleSocialEngineeringMiniGameInput() {
if socialEngineeringStep >= len(dialogueOptions) {
return
}
options := dialogueOptions[socialEngineeringStep]
if inpututil.IsKeyJustPressed(ebiten.Key1) && options[0].IsCorrect {
socialEngineeringStep++
} else if inpututil.IsKeyJustPressed(ebiten.Key2) && options[1].IsCorrect {
socialEngineeringStep++
} else if inpututil.IsKeyJustPressed(ebiten.Key3) && options[2].IsCorrect {
socialEngineeringStep++
} else if inpututil.IsKeyJustPressed(ebiten.KeyEscape) {
completeMission(false)
} else {
completeMission(false)
}
}