Example #1
0
        public Schiff(Pirat p, Meer m)
        {
            Random r = new Random();

            int schiffRandomMain   = r.Next(Enums.Schiff.SchiffMain.Count() - 1);
            int schiffRandomSuffix = r.Next(Enums.Schiff.SchiffSuffix.Count() - 1);

            this.Name = String.Format("{0} {1}",
                                      Enums.Schiff.SchiffMain.First(x => x.Key == (schiffRandomMain < 0 ? 0 : schiffRandomMain)).Value,
                                      Enums.Schiff.SchiffSuffix.First(x => x.Key == (schiffRandomSuffix < 0 ? 0 : schiffRandomSuffix)).Value);

            this.LocationType = Enums.LocationType.Schiff;
            this.NamePrefix   = "auf dem Schiff";
            this.Pirat        = p;
            this.Meer         = m;

            if (this.NPCPiraten == null)
            {
                this.NPCPiraten = new List <Pirat>();
            }
            else
            {
                this.NPCPiraten.Clear();
            }
            for (int c = 0; c < r.Next(1, 3); c++)
            {
                this.NPCPiraten.Add(new Pirat(String.Empty, String.Empty, String.Empty, 30, 100));
                //r.Next(this.Pirat.Staerke + 20)
            }
        }
Example #2
0
        public void Kaempfen(Pirat gegner)
        {
            Random r    = new Random();
            bool   crit = false;

            if (!this.IsNPC)
            {
                crit = (r.Next(30) % 6 == 0 ? true : false);
            }

            double multiplikator = r.NextDouble();

            int schaden = (int)((this.Staerke * multiplikator) / 2);

            Console.WriteLine(String.Format("Sie {0} {1} {2}kritischen Schaden.", (!this.IsNPC ? "machen" : "erhalten"),
                                            schaden,
                                            (crit ? String.Empty : "nicht ")));

            gegner.Health = crit ? gegner.Health - (schaden * 2) : gegner.Health - schaden;

            if (gegner.Health <= 0)
            {
                if (this.Location != null &&
                    this.Location.NPCPiraten.Contains(gegner))
                {
                    var win = r.Next(5, 25);
                    Console.WriteLine("Ihr Gegner wurde besiegt.");
                    Console.WriteLine(String.Format("Ihr erhaltet {0} Münzen", win));
                    this.Money   = this.Money + win;
                    this.Staerke = this.Staerke + 5;
                    this.Location.NPCPiraten.Remove(gegner);
                    this.ShowStatus();
                    return;
                }
                else
                {
                    Console.WriteLine("Ihr wurdet besiegt.");
                    gegner.ShowStatus();
                    return;
                }
            }

            gegner.Kaempfen(this);
        }
Example #3
0
        public Insel(Pirat p, Meer m)
        {
            Random r = new Random();

            int islandRandomPrefix = r.Next(Enums.IslandNames.IslandPrefix.Count() - 1);
            int islandRandomMain   = r.Next(Enums.IslandNames.IslandMain.Count() - 1);
            int islandRandomSuffix = r.Next(Enums.IslandNames.IslandSuffix.Count() - 1);

            this.Name = String.Format("{0} {1} {2}",
                                      Enums.IslandNames.IslandPrefix.First(x => x.Key == (islandRandomPrefix < 0 ? 0: islandRandomPrefix)).Value,
                                      Enums.IslandNames.IslandMain.First(x => x.Key == (islandRandomMain < 0 ? 0 : islandRandomMain)).Value,
                                      Enums.IslandNames.IslandSuffix.First(x => x.Key == (islandRandomSuffix < 0 ? 0 : islandRandomSuffix)).Value);
            this.Kneipe       = new Kneipe(p, this);
            this.Strand       = new Strand(p, this);
            this.LocationType = Enums.LocationType.Insel;
            this.NamePrefix   = "auf der Insel";
            this.Pirat        = p;
            this.Meer         = m;
        }
Example #4
0
        public Strand(Pirat p, Insel i)
        {
            this.Pirat        = p;
            this.Insel        = i;
            this.LocationType = Enums.LocationType.Strand;
            this.NamePrefix   = "am Strand";
            if (this.NPCPiraten == null)
            {
                this.NPCPiraten = new List <Pirat>();
            }
            else
            {
                this.NPCPiraten.Clear();
            }
            Random r = new Random();

            for (int c = 0; c < r.Next(1, 3); c++)
            {
                this.NPCPiraten.Add(new Pirat(String.Empty, String.Empty, String.Empty, 30, 100));
                //r.Next(this.Pirat.Staerke + 20)
            }
        }
Example #5
0
 public Meer(Pirat p)
 {
     this.Pirat = p;
     this.Inseln.Add(new Insel(p, this));
     this.NamePrefix = "im Meer";
 }