summaryrefslogtreecommitdiff
path: root/DiscoBot/Characters/NPC.cs
blob: 1a71e866d2984b1d8b27091ff5b4f662b0633535 (plain)
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
namespace DiscoBot.Characters
{
    using System;

    using DiscoBot.Auxiliary;

    public class Npc : ICharacter
    {
        private readonly int mean, stDv;

        public Npc(string name, int mean, int stDv)
        {
            this.mean = mean;
            this.stDv = stDv;
            this.Name = name;
        }

        public string Name { get; set; }
        
        public string TestTalent(string talent, int tap = 3)
        {
            for (int i = 0; i <= 2; i++)
            {
                // foreach property, dice and tap 
                int temp = Dice.Roll();
                int eigenschaft = (int)Math.Round(Misc.Random(this.stDv, this.mean));

                if (eigenschaft < temp)
                {
                    tap -= temp - eigenschaft;
                }
            }

            if (tap >= 0)
            {
                return $"{this.Name} vollführt {talent} erfolgreich";
            }


            return $"{this.Name} scheitert an {talent}";
        }

        public string TestEigenschaft(string eigenschaft, int erschwernis = 0)
        {
            int temp = Dice.Roll();
            int prop = (int)Math.Round(Misc.Random(this.stDv, this.stDv));
            
            if (temp + erschwernis < prop)
            {
                return $"{this.Name} vollführt {eigenschaft} erfolgreich";
            }

            return $"{this.Name} scheitert an {eigenschaft}";
        }

        public string Angriff(string waffe, int erschwernis = 0)
        {
            int temp = Dice.Roll();

            if (temp == 1)
            {
                return $"{this.Name} greift kritisch mit {waffe} an";
            }

            if (temp < erschwernis)
            {
                return $"{this.Name} greift mit {waffe} an";
            }

            return $"{this.Name} haut mit {waffe} daneben";
        }

        public string Parade(string waffe, int erschwernis = 0)
        {
            int temp = Dice.Roll();

            if (temp == 1)
            {
                return $"{this.Name} pariert mit {waffe} meisterlich";
            }

            if (temp < erschwernis)
            {
                return $"{this.Name} pariert mit {waffe} an";
            }

            return $"{this.Name} schafft es nicht mit {waffe} zu parieren";
        }

        public string Fernkampf(string waffe, int erschwernis = 0)
        {
            int temp = Dice.Roll();

            if (temp == 1)
            {
                return $"{this.Name} trifft kritisch mit {waffe}";
            }

            if (temp < erschwernis)
            {
                return $"{this.Name} greift mit {waffe} an";
            }

            return $"{this.Name} schießt mit {waffe} daneben";
        }
    }
}