From a5291153e493e9ac1a43e5806b3d1404de5f8b2f Mon Sep 17 00:00:00 2001 From: Batian Styx Date: Mon, 31 May 2021 12:05:16 +0100 Subject: [PATCH] Add Overload Saurfang view --- Graveyard/Graveyard.cs | 9 ++++++- Graveyard/Graveyard.csproj | 1 + Graveyard/Properties/AssemblyInfo.cs | 6 ++--- Graveyard/Resources/Strings.Designer.cs | 18 ++++++++++++++ Graveyard/Resources/Strings.resx | 6 +++++ Graveyard/SaurfangView.cs | 33 +++++++++++++++++++++++++ Graveyard/Settings.Designer.cs | 12 +++++++++ Graveyard/Settings.settings | 3 +++ Graveyard/SettingsView.xaml | 6 ++++- Graveyard/app.config | 3 +++ 10 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 Graveyard/SaurfangView.cs diff --git a/Graveyard/Graveyard.cs b/Graveyard/Graveyard.cs index 1608320..aa04c2b 100644 --- a/Graveyard/Graveyard.cs +++ b/Graveyard/Graveyard.cs @@ -39,6 +39,7 @@ public class Graveyard public LadyLiadrinView LadyLiadrin; public NZothGotDView NZothGotD; public RallyView Rally; + public SaurfangView Saurfang; private StackPanel _friendlyPanel; private StackPanel _enemyPanel; @@ -310,6 +311,11 @@ public void Reset() { Rally = new RallyView(); _friendlyPanel.Children.Add(Rally); + } + if (Settings.Default.SaurfangEnabled && SaurfangView.isValid()) + { + Saurfang = new SaurfangView(); + _friendlyPanel.Children.Add(Saurfang); } } @@ -327,7 +333,8 @@ public void PlayerGraveyardUpdate(Card card) var hoardpillager = HoardPillager?.Update(card) ?? false; var nzothgotd = NZothGotD?.Update(card) ?? false; var rally = Rally?.Update(card) ?? false; - if (!(any || deathrattle || nzoth || hadr || guldan || rez || mulch || kangor || witching || hoardpillager || nzothgotd || rally)) + var saurfang = Saurfang?.Update(card) ?? false; + if (!(any || deathrattle || nzoth || hadr || guldan || rez || mulch || kangor || witching || hoardpillager || nzothgotd || rally || saurfang)) { Normal?.Update(card); } diff --git a/Graveyard/Graveyard.csproj b/Graveyard/Graveyard.csproj index ef65408..580de1e 100644 --- a/Graveyard/Graveyard.csproj +++ b/Graveyard/Graveyard.csproj @@ -95,6 +95,7 @@ True Strings.resx + diff --git a/Graveyard/Properties/AssemblyInfo.cs b/Graveyard/Properties/AssemblyInfo.cs index 00fe8c2..5f8d843 100644 --- a/Graveyard/Properties/AssemblyInfo.cs +++ b/Graveyard/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Graveyard")] -[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.8.10.0")] -[assembly: AssemblyFileVersion("1.8.10.0")] +[assembly: AssemblyVersion("1.8.11.0")] +[assembly: AssemblyFileVersion("1.8.11.0")] diff --git a/Graveyard/Resources/Strings.Designer.cs b/Graveyard/Resources/Strings.Designer.cs index 885dfea..bebf28d 100644 --- a/Graveyard/Resources/Strings.Designer.cs +++ b/Graveyard/Resources/Strings.Designer.cs @@ -483,6 +483,24 @@ public static string ResurrectDescription { } } + /// + /// Looks up a localized string similar to Overlord Saurfang. + /// + public static string Saurfang { + get { + return ResourceManager.GetString("Saurfang", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to When the deck contains 'Overload Saurfang', show summon chance of Frenzy minions that have died.. + /// + public static string SaurfangDescription { + get { + return ResourceManager.GetString("SaurfangDescription", resourceCulture); + } + } + /// /// Looks up a localized string similar to Scale. /// diff --git a/Graveyard/Resources/Strings.resx b/Graveyard/Resources/Strings.resx index c4a1759..5f9dc5a 100644 --- a/Graveyard/Resources/Strings.resx +++ b/Graveyard/Resources/Strings.resx @@ -268,6 +268,12 @@ When the deck contains 'Resurrect', 'Onyx Bishop', 'Eternal Servitude', or 'Lesser Diamond Spellstone', show the resurrect chance of friendly minions that have died + + Overlord Saurfang + + + When the deck contains 'Overload Saurfang', show summon chance of Frenzy minions that have died. + Scale diff --git a/Graveyard/SaurfangView.cs b/Graveyard/SaurfangView.cs new file mode 100644 index 0000000..b5787fb --- /dev/null +++ b/Graveyard/SaurfangView.cs @@ -0,0 +1,33 @@ +using Hearthstone_Deck_Tracker; +using Hearthstone_Deck_Tracker.Hearthstone; +using System.Linq; + +namespace HDT.Plugins.Graveyard +{ + public class SaurfangView : NormalView + { + private ChancesTracker _chances = new ChancesTracker(); + + public static bool isValid() + { + return Core.Game.Player.PlayerCardList.FindIndex(card => card.Id == HearthDb.CardIds.Collectible.Warrior.OverlordSaurfang) > -1; + } + + public SaurfangView() + { + Label.Text = Strings.GetLocalized("Saurfang"); + } + + public bool Update(Card card) + { + if (!((card.Text?.Contains("Frenzy:") ?? false) && base.Update(card))) + { + return false; + } + + _chances.Update(card, Cards, View); + + return true; + } + } +} diff --git a/Graveyard/Settings.Designer.cs b/Graveyard/Settings.Designer.cs index 93bbef4..3ad37ad 100644 --- a/Graveyard/Settings.Designer.cs +++ b/Graveyard/Settings.Designer.cs @@ -418,5 +418,17 @@ public bool AlwaysRallySeparately { this["FriendlyOrientation"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool SaurfangEnabled { + get { + return ((bool)(this["SaurfangEnabled"])); + } + set { + this["SaurfangEnabled"] = value; + } + } } } diff --git a/Graveyard/Settings.settings b/Graveyard/Settings.settings index f5033d0..cb87235 100644 --- a/Graveyard/Settings.settings +++ b/Graveyard/Settings.settings @@ -101,5 +101,8 @@ Vertical + + True + \ No newline at end of file diff --git a/Graveyard/SettingsView.xaml b/Graveyard/SettingsView.xaml index c72222e..3680c06 100644 --- a/Graveyard/SettingsView.xaml +++ b/Graveyard/SettingsView.xaml @@ -203,6 +203,10 @@ Content="{lex:Loc NZothGotD}" ToolTip="{lex:Loc NZothGotDDescription}" Style="{StaticResource ToggleStyle}" /> + + Style="{StaticResource ToggleStyle}" /> diff --git a/Graveyard/app.config b/Graveyard/app.config index 0db7ff8..eadb11f 100644 --- a/Graveyard/app.config +++ b/Graveyard/app.config @@ -106,6 +106,9 @@ Vertical + + True + \ No newline at end of file