From c501a63ec1743ce1f96af6614d5a326489b09a5d Mon Sep 17 00:00:00 2001 From: SirTobyB Date: Sat, 22 Oct 2022 15:24:30 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Bei=20der=20Berechnung=20des=20Gesamtverm?= =?UTF-8?q?=C3=B6gens=20eines=20Spielers=20werden=20Rohstoffe=20nun=20nich?= =?UTF-8?q?t=20anhand=20des=20Standardpreises=20sondern=20des=20aktuellen?= =?UTF-8?q?=20Preises=20in=20der=20Stadt,=20in=20der=20sie=20gelagert=20si?= =?UTF-8?q?nd,=20berechnet;=20Changelog=20erweitert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs | 6 +++--- Conspiratio.Lib/Gameplay/Rohstoffe/Rohstoff.cs | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa465a9..8d27d32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog Conspiratio.Lib +## Unreleased + +_TODO Releasedate_ + +**[DE]** +- Bei der Berechnung des Gesamtvermögens eines Spielers werden Rohstoffe nun nicht anhand des Standardpreises sondern des aktuellen Preises in der Stadt, in der sie gelagert sind, berechnet + ## 2.0.0 _23.12.2021_ diff --git a/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs b/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs index 93effdd..f1e62f1 100644 --- a/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs +++ b/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs @@ -292,7 +292,7 @@ public bool GetHenkersHand() public override int GetGesamtVermoegen(int spielerID) { int gesamtVermoegen = 0; - double factor = 0.7; + double factorWertminderung = 0.7; // Der Faktor stellt die Wertminderung einer Werkstatt dar (sofern sie verkauft werden würde) gesamtVermoegen += Taler; // Bargeld @@ -308,12 +308,12 @@ public override int GetGesamtVermoegen(int spielerID) // Werkstätten if (_spielerHatInStadtXWerkstaettenY[i, j].GetEnabled() == true) { - gesamtVermoegen += Convert.ToInt32(SW.Dynamisch.GetRohstoffwithID(SW.Dynamisch.GetStadtwithID(i).GetRohstoffe()[j]).GetWSKaufpreis() * factor); + gesamtVermoegen += Convert.ToInt32(SW.Dynamisch.GetRohstoffwithID(SW.Dynamisch.GetStadtwithID(i).GetRohstoffe()[j]).GetWSKaufpreis() * factorWertminderung); } // Rohstoffe int rohid = SW.Dynamisch.GetStadtwithID(i).GetRohstoffe()[j]; - gesamtVermoegen += SW.Dynamisch.GetRohstoffwithID(rohid).GetPreisStd() * _hatInStadtXMengeYRohstoffe[i, j]; + gesamtVermoegen += SW.Dynamisch.GetStadtwithID(i).GetRohstoffPreisVonIDX(rohid) * _hatInStadtXMengeYRohstoffe[i, j]; } } diff --git a/Conspiratio.Lib/Gameplay/Rohstoffe/Rohstoff.cs b/Conspiratio.Lib/Gameplay/Rohstoffe/Rohstoff.cs index 527f0a3..8bf95fa 100644 --- a/Conspiratio.Lib/Gameplay/Rohstoffe/Rohstoff.cs +++ b/Conspiratio.Lib/Gameplay/Rohstoffe/Rohstoff.cs @@ -36,7 +36,7 @@ public class Rohstoff /// Faktor Werkstätten für das Verhältnis Arbeiter zu Werkstätten /// Rohstoffstufe (1 bis 3) zur Unterteilung auch für die Handelszertifikate und die Lagermenge /// Text, der im Buch auftaucht, wenn die Ware produziert wurde, z.B. Eure Getreideernte verlief {0} - /// OPTIONAL: Gibt an, wie viel auf einem Qudaratmeter Lagerplatz gelagert werden können + /// OPTIONAL: Gibt an, wie viel auf einem Quadratmeter Lagerplatz gelagert werden können /// (standardmäßig abhängig von der Stufe: 1 = 10, 2 = 6, 3 = 3) public Rohstoff(int preisMin, int preisStd, int preisMax, string name, string produktionstext, int werkstattVerhaeltnisArbeiter, int wekstattVerhaeltnisWerkstatt, int rohstoffStufe, string textQualitaetProduktion, int lagermengeProQMeter = 10) From d59cc5964e391016a5b71e632c05d9cab4111428 Mon Sep 17 00:00:00 2001 From: SirTobyB Date: Sat, 22 Oct 2022 16:27:17 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Neue=20Klasse=20f=C3=BCr=20"Kupplerin"=20hi?= =?UTF-8?q?nzugef=C3=BCgt;=20Version=20angehoben=20auf=202.1.0=20wegen=20n?= =?UTF-8?q?euen=20Features;=20Changelog=20erweitert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + Conspiratio.Lib/Conspiratio.Lib.csproj | 1 + Conspiratio.Lib/Gameplay/Kirche/Kupplerin.cs | 60 ++++++++++++++++++++ Conspiratio.Lib/Properties/AssemblyInfo.cs | 4 +- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 Conspiratio.Lib/Gameplay/Kirche/Kupplerin.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d27d32..e7018d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ _TODO Releasedate_ **[DE]** - Bei der Berechnung des Gesamtvermögens eines Spielers werden Rohstoffe nun nicht anhand des Standardpreises sondern des aktuellen Preises in der Stadt, in der sie gelagert sind, berechnet +- Neue Klasse für "Kupplerin" hinzugefügt ## 2.0.0 diff --git a/Conspiratio.Lib/Conspiratio.Lib.csproj b/Conspiratio.Lib/Conspiratio.Lib.csproj index 545c920..b811895 100644 --- a/Conspiratio.Lib/Conspiratio.Lib.csproj +++ b/Conspiratio.Lib/Conspiratio.Lib.csproj @@ -133,6 +133,7 @@ + diff --git a/Conspiratio.Lib/Gameplay/Kirche/Kupplerin.cs b/Conspiratio.Lib/Gameplay/Kirche/Kupplerin.cs new file mode 100644 index 0000000..f32a040 --- /dev/null +++ b/Conspiratio.Lib/Gameplay/Kirche/Kupplerin.cs @@ -0,0 +1,60 @@ +using System; + +using Conspiratio.Lib.Gameplay.Spielwelt; + +namespace Conspiratio.Lib.Gameplay.Kirche +{ + public class Kupplerin + { + public static int ErmittleOptimalenPartnerFuerSpieler(int spielerId) + { + int optimalerPartnerId = 0; + + for (int i = SW.Statisch.GetMinKIID(); i < SW.Statisch.GetMaxKIID(); i++) + { + // Wenn sie unterschiedliches Geschlecht vorweisen + if (SW.Dynamisch.GetHumWithID(spielerId).GetMaennlich() != SW.Dynamisch.GetKIwithID(i).GetMaennlich()) + { + // und nicht verheiratet sind + if (SW.Dynamisch.GetKIwithID(i).GetVerheiratet() == 0) + { + // und das Amt nicht höher ist als in der Stadtebene + if (SW.Dynamisch.GetKIwithID(i).GetAmtID() < 17) + { + if (optimalerPartnerId == 0) + { + optimalerPartnerId = i; + } + else + { + int Preis = BerechnePreisFuerKupplerin(i); + + if (SW.Dynamisch.GetKIwithID(optimalerPartnerId).GetBeziehungZuKIX(SW.Dynamisch.GetAktiverSpieler()) < SW.Dynamisch.GetKIwithID(i).GetBeziehungZuKIX(SW.Dynamisch.GetAktiverSpieler()) + SW.Statisch.Rnd.Next(-15, 16) && + Preis <= (SW.Dynamisch.GetHumWithID(spielerId).GetGesamtVermoegen(SW.Dynamisch.GetAktiverSpieler()) * 0.4d)) // Nur die Partner vorschlagen, deren Preis nicht höher liegt als 40 % des Gesamtvermögen des Spielers + { + optimalerPartnerId = i; + } + } + } + } + } + } + + return optimalerPartnerId; + } + + public static int BerechnePreisFuerKupplerin(int optimalerPartnerId) + { + return Convert.ToInt32(SW.Dynamisch.GetKIwithID(optimalerPartnerId).GetTaler() * SW.Statisch.GetKupplerProzente()); + } + + public static void BeginneWerbungUmOptimalenPartner(int spierlerId, int optimalerPartnerId, int preis) + { + SW.Dynamisch.GetHumWithID(spierlerId).WirbtUmSpielerID = optimalerPartnerId; + SW.Dynamisch.GetHumWithID(spierlerId).ErhoeheTaler(-preis); + SW.Dynamisch.GetKIwithID(optimalerPartnerId).ErhoeheVerliebt(50); + + SW.Dynamisch.BelTextAnzeigen("Die Kupplerin leitet alle Vorkehrungen in die Wege..."); + } + } +} diff --git a/Conspiratio.Lib/Properties/AssemblyInfo.cs b/Conspiratio.Lib/Properties/AssemblyInfo.cs index cb405de..7db725f 100644 --- a/Conspiratio.Lib/Properties/AssemblyInfo.cs +++ b/Conspiratio.Lib/Properties/AssemblyInfo.cs @@ -30,5 +30,5 @@ // // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: -[assembly: AssemblyVersion("2.0.0")] -[assembly: AssemblyFileVersion("2.0.0")] +[assembly: AssemblyVersion("2.1.0")] +[assembly: AssemblyFileVersion("2.1.0")] From f8fe3e958aecb22718ad8077245ff65ef1baa2c9 Mon Sep 17 00:00:00 2001 From: SirTobyB Date: Sun, 23 Oct 2022 14:00:49 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Debug=20ToString=20Methoden=20zu=20verschie?= =?UTF-8?q?denen=20Spielerklassen=20hinzugef=C3=BCgt,=20um=20Fehler=20einf?= =?UTF-8?q?acher=20finden=20zu=20k=C3=B6nnen=20und=20einen=20besseren=20?= =?UTF-8?q?=C3=9Cberbloick=20=C3=BCber=20die=20undurchsichtige=20Array=20S?= =?UTF-8?q?truktur=20mancher=20Objekt=20zu=20bekommen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Niederlassung/SpHatWerkstaetten.cs | 15 ++++++ .../Gameplay/Personen/HumSpieler.cs | 53 +++++++++++++++++++ Conspiratio.Lib/Gameplay/Personen/Spieler.cs | 17 ++++++ .../Gameplay/Wohnsitz/SpHatHaus.cs | 19 ++++++- 4 files changed, 103 insertions(+), 1 deletion(-) diff --git a/Conspiratio.Lib/Gameplay/Niederlassung/SpHatWerkstaetten.cs b/Conspiratio.Lib/Gameplay/Niederlassung/SpHatWerkstaetten.cs index 3a42aec..80c9391 100644 --- a/Conspiratio.Lib/Gameplay/Niederlassung/SpHatWerkstaetten.cs +++ b/Conspiratio.Lib/Gameplay/Niederlassung/SpHatWerkstaetten.cs @@ -51,5 +51,20 @@ public void SetEnabled(bool enabled) if (!_enabled) _skill[1] = 0; } + + #region ToString (for debugging) + /// + /// Only for debugging purposes + /// + /// + public override string ToString() + { + string text = ""; + text += $"{nameof(_enabled)}: {_enabled}\t"; + text += $"{nameof(_rohstoffID)}: {_rohstoffID}\t"; + text += $"{nameof(_skill)}: {_skill}"; + return text; + } + #endregion } } diff --git a/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs b/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs index f1e62f1..01a0bd3 100644 --- a/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs +++ b/Conspiratio.Lib/Gameplay/Personen/HumSpieler.cs @@ -764,5 +764,58 @@ public int ErmittlePreisWaisenkindAdoptieren(int spielerID) return Convert.ToInt32(prozentfaktor * gesamtvermoegen / 100); } #endregion + + + #region ToString (for debugging) + /// + /// Only for debugging purposes + /// + /// + public override string ToString() + { + string text = ""; + text += base.ToString() + Environment.NewLine; + + string rohstoffrechte = ""; + + for (int i = 1; i < SW.Statisch.GetMaxRohID(); i++) + { + if (GetRohstoffrechteX(i)) + rohstoffrechte += SW.Dynamisch.GetRohstoffwithID(i).GetRohName() + ": Ja"; + } + + text += $"{nameof(_rohstoffrechte)}: {rohstoffrechte}{Environment.NewLine}"; + + string spielerHatHausVonStadtAnArraystelle = ""; + + for (int i = 1; i < SW.Statisch.GetMaxStadtID(); i++) + { + if (GetSpielerHatHausVonStadtAnArraystelle(i).GetHausID() != 0) + spielerHatHausVonStadtAnArraystelle += $"Stadt {SW.Dynamisch.GetStadtwithID(i).GetGebietsName()} ({i}):\t\t{GetSpielerHatHausVonStadtAnArraystelle(i)}{Environment.NewLine}"; + } + + text += $"{nameof(_spielerHatHausVonStadtAnArraystelle)}:{Environment.NewLine}{spielerHatHausVonStadtAnArraystelle}"; + + string spielerHatInStadtXWerkstaettenY = ""; + + for (int i = 0; i < SW.Statisch.GetMaxStadtID(); i++) + { + for (int j = 0; j < SW.Statisch.GetMaxWerkstaettenProStadt(); j++) + { + if (_spielerHatInStadtXWerkstaettenY[i, j].GetEnabled()) + { + string stadtName = "Unbekannt"; + if (i > 0) + stadtName = SW.Dynamisch.GetStadtwithID(i).GetGebietsName(); + + spielerHatInStadtXWerkstaettenY += $"Stadt {stadtName} ({i}):\t\tPlatz: {j + 1} {_spielerHatInStadtXWerkstaettenY[i, j]}{Environment.NewLine}"; + } + } + } + + text += $"{nameof(_spielerHatInStadtXWerkstaettenY)}:{Environment.NewLine}{spielerHatInStadtXWerkstaettenY}"; + return text; + } + #endregion } } diff --git a/Conspiratio.Lib/Gameplay/Personen/Spieler.cs b/Conspiratio.Lib/Gameplay/Personen/Spieler.cs index a23af98..45b61ac 100644 --- a/Conspiratio.Lib/Gameplay/Personen/Spieler.cs +++ b/Conspiratio.Lib/Gameplay/Personen/Spieler.cs @@ -368,5 +368,22 @@ public string GetSeinIhr() return "ihr"; } #endregion + + #region ToString (for debugging) + /// + /// Only for debugging purposes + /// + /// + public override string ToString() + { + string text = ""; + text += $"{nameof(Name)}: {Name}\t"; + text += $"{nameof(Maennlich)}: {Maennlich}\t"; + text += $"{nameof(Taler)}: {Taler}"; + text += $"{nameof(Religion)}: {Religion}"; + text += $"{nameof(Alter)}: {Alter}"; + return text; + } + #endregion } } diff --git a/Conspiratio.Lib/Gameplay/Wohnsitz/SpHatHaus.cs b/Conspiratio.Lib/Gameplay/Wohnsitz/SpHatHaus.cs index f56262f..ee44518 100644 --- a/Conspiratio.Lib/Gameplay/Wohnsitz/SpHatHaus.cs +++ b/Conspiratio.Lib/Gameplay/Wohnsitz/SpHatHaus.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; + using Conspiratio.Lib.Gameplay.Spielwelt; -using Conspiratio.Lib.Gameplay.Wohnsitz; namespace Conspiratio.Lib.Gameplay.Wohnsitz { @@ -246,6 +246,23 @@ private int GetGesundheitsbonusAllerErweiterungen() } #endregion + #region ToString (for debugging) + /// + /// Only for debugging purposes + /// + /// + public override string ToString() + { + string text = ""; + text += $"{nameof(_hausID)}: {_hausID}\t"; + text += $"{nameof(_stadtID)}: {_stadtID}\t"; + text += $"{nameof(_restlicheBauzeit)}: {_restlicheBauzeit}\t"; + text += $"{nameof(_zustandInProzent)}: {_zustandInProzent}\t"; + text += $"{nameof(_wertverlustFaktor)}: {_wertverlustFaktor}"; + return text; + } + #endregion + #region Properties From 3eaf32d8559dda7239e806e3d4dbcea2074c0b3a Mon Sep 17 00:00:00 2001 From: SirTobyB Date: Sun, 23 Oct 2022 14:20:15 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Ausgabe=20f=C3=BCr=20Spieler=20Grundpropert?= =?UTF-8?q?ies=20h=C3=BCbscher=20gemacht;=20Changelog=20erweitert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + Conspiratio.Lib/Gameplay/Personen/Spieler.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7018d9..d85dfaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ _TODO Releasedate_ **[DE]** - Bei der Berechnung des Gesamtvermögens eines Spielers werden Rohstoffe nun nicht anhand des Standardpreises sondern des aktuellen Preises in der Stadt, in der sie gelagert sind, berechnet - Neue Klasse für "Kupplerin" hinzugefügt +- Debug ToString Methoden zu verschiedenen Spielerklassen hinzugefügt, um Fehler einfacher finden zu können und einen besseren Überblick über die undurchsichtige Array Struktur mancher Objekte zu bekommen ## 2.0.0 diff --git a/Conspiratio.Lib/Gameplay/Personen/Spieler.cs b/Conspiratio.Lib/Gameplay/Personen/Spieler.cs index 45b61ac..70c6937 100644 --- a/Conspiratio.Lib/Gameplay/Personen/Spieler.cs +++ b/Conspiratio.Lib/Gameplay/Personen/Spieler.cs @@ -379,8 +379,8 @@ public override string ToString() string text = ""; text += $"{nameof(Name)}: {Name}\t"; text += $"{nameof(Maennlich)}: {Maennlich}\t"; - text += $"{nameof(Taler)}: {Taler}"; - text += $"{nameof(Religion)}: {Religion}"; + text += $"{nameof(Taler)}: {Taler}\t"; + text += $"{nameof(Religion)}: {Religion}\t"; text += $"{nameof(Alter)}: {Alter}"; return text; } From d6e0368970834550454ca02cfa14434bef7b2504 Mon Sep 17 00:00:00 2001 From: SirTobyB Date: Sun, 23 Oct 2022 16:16:32 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Titelstufe=20von=20F=C3=BCrst/F=C3=BCrstin?= =?UTF-8?q?=20und=20Herzog/Herzogin=20vertauscht,=20um=20sie=20an=20den=20?= =?UTF-8?q?historischen=20Rang=20in=20Europa=20anzupassen;=20Changelog=20e?= =?UTF-8?q?rweitert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + Conspiratio.Lib/Gameplay/Spielwelt/StatischeSpieldaten.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d85dfaf..4885cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ _TODO Releasedate_ - Bei der Berechnung des Gesamtvermögens eines Spielers werden Rohstoffe nun nicht anhand des Standardpreises sondern des aktuellen Preises in der Stadt, in der sie gelagert sind, berechnet - Neue Klasse für "Kupplerin" hinzugefügt - Debug ToString Methoden zu verschiedenen Spielerklassen hinzugefügt, um Fehler einfacher finden zu können und einen besseren Überblick über die undurchsichtige Array Struktur mancher Objekte zu bekommen +- Titelstufe von Fürst/Fürstin und Herzog/Herzogin vertauscht, um sie an den historischen Rang in Europa anzupassen ## 2.0.0 diff --git a/Conspiratio.Lib/Gameplay/Spielwelt/StatischeSpieldaten.cs b/Conspiratio.Lib/Gameplay/Spielwelt/StatischeSpieldaten.cs index d11b8fc..d33a360 100644 --- a/Conspiratio.Lib/Gameplay/Spielwelt/StatischeSpieldaten.cs +++ b/Conspiratio.Lib/Gameplay/Spielwelt/StatischeSpieldaten.cs @@ -1221,8 +1221,8 @@ public void Initialisieren(IStrafe[] strafarten, IPrivileg[] privilegien) Tit[5] = new Freiherr(5, "Freiherr", "Freifrau", 55); Tit[6] = new Baron(6, "Baron", "Baronin", 75); Tit[7] = new Graf(7, "Graf", "Gräfin", 100); - Tit[8] = new Herzog(8, "Herzog", "Herzogin", 125); - Tit[9] = new Fuerst(9, "Fürst", "Fürstin", 150); + Tit[8] = new Fuerst(8, "Fürst", "Fürstin", 125); + Tit[9] = new Herzog(9, "Herzog", "Herzogin", 150); #endregion #region Werbegeschenke anlegen