From 25391f278312251bd483d084da2f976a79223706 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 28 Mar 2020 19:44:52 +0200 Subject: Started implimenting health system. Trees now drop branches (a branch). --- Mundus/Data/SuperLayers/Mobs/LMI.cs | 2 +- Mundus/Icons/Blanks/blank.png | Bin 3315 -> 0 bytes Mundus/Icons/Blanks/blank_gear.png | Bin 4339 -> 0 bytes Mundus/Icons/Blanks/blank_hand.png | Bin 4339 -> 0 bytes Mundus/Icons/Materials/stick.png | Bin 0 -> 4339 bytes Mundus/Icons/Project files/1-4.xcf | Bin 0 -> 3686 bytes Mundus/Icons/Project files/2-4.xcf | Bin 0 -> 3535 bytes Mundus/Icons/Project files/3-4.xcf | Bin 0 -> 3337 bytes Mundus/Icons/Project files/4-4.xcf | Bin 0 -> 3075 bytes Mundus/Icons/Project files/stick.xcf | Bin 0 -> 2005 bytes Mundus/Icons/UI/Blanks/blank.png | Bin 0 -> 3315 bytes Mundus/Icons/UI/Blanks/blank_gear.png | Bin 0 -> 4339 bytes Mundus/Icons/UI/Blanks/blank_hand.png | Bin 0 -> 4339 bytes Mundus/Icons/UI/Blanks/empty.png | Bin 0 -> 3297 bytes Mundus/Icons/UI/Hearth/1-4.png | Bin 0 -> 4339 bytes Mundus/Icons/UI/Hearth/2-4.png | Bin 0 -> 4339 bytes Mundus/Icons/UI/Hearth/3-4.png | Bin 0 -> 4339 bytes Mundus/Icons/UI/Hearth/4-4.png | Bin 0 -> 4339 bytes Mundus/Mundus.csproj | 13 +++++++--- Mundus/Service/Mobs/IMob.cs | 3 ++- Mundus/Service/Mobs/LandMobs/Player.cs | 8 +++--- Mundus/Service/Mobs/MobStatsController.cs | 39 ++++++++++++++++++++++++++++++ Mundus/Service/Mobs/MobTerraforming.cs | 1 + Mundus/Service/SuperLayers/LandPresets.cs | 2 +- Mundus/Views/Windows/SmallGameWindow.cs | 19 ++++++++++++++- Mundus/gtk-gui/generated.cs | 18 +++++++++++--- Mundus/gtk-gui/gui.stetic | 36 ++++++++++++++++++++++++--- 27 files changed, 125 insertions(+), 16 deletions(-) delete mode 100644 Mundus/Icons/Blanks/blank.png delete mode 100644 Mundus/Icons/Blanks/blank_gear.png delete mode 100644 Mundus/Icons/Blanks/blank_hand.png create mode 100644 Mundus/Icons/Materials/stick.png create mode 100644 Mundus/Icons/Project files/1-4.xcf create mode 100644 Mundus/Icons/Project files/2-4.xcf create mode 100644 Mundus/Icons/Project files/3-4.xcf create mode 100644 Mundus/Icons/Project files/4-4.xcf create mode 100644 Mundus/Icons/Project files/stick.xcf create mode 100644 Mundus/Icons/UI/Blanks/blank.png create mode 100644 Mundus/Icons/UI/Blanks/blank_gear.png create mode 100644 Mundus/Icons/UI/Blanks/blank_hand.png create mode 100644 Mundus/Icons/UI/Blanks/empty.png create mode 100644 Mundus/Icons/UI/Hearth/1-4.png create mode 100644 Mundus/Icons/UI/Hearth/2-4.png create mode 100644 Mundus/Icons/UI/Hearth/3-4.png create mode 100644 Mundus/Icons/UI/Hearth/4-4.png create mode 100644 Mundus/Service/Mobs/MobStatsController.cs diff --git a/Mundus/Data/SuperLayers/Mobs/LMI.cs b/Mundus/Data/SuperLayers/Mobs/LMI.cs index 86f59f2..fc3efc4 100644 --- a/Mundus/Data/SuperLayers/Mobs/LMI.cs +++ b/Mundus/Data/SuperLayers/Mobs/LMI.cs @@ -5,7 +5,7 @@ namespace Mundus.Data.Superlayers.Mobs { public static Player Player { get; private set; } public static void CreateInstances(int inventorySize) { - Player = new Player("player", inventorySize); + Player = new Player("player", 20, inventorySize); } public static void CreateInventories(int screenInvSize) { diff --git a/Mundus/Icons/Blanks/blank.png b/Mundus/Icons/Blanks/blank.png deleted file mode 100644 index 049be24..0000000 Binary files a/Mundus/Icons/Blanks/blank.png and /dev/null differ diff --git a/Mundus/Icons/Blanks/blank_gear.png b/Mundus/Icons/Blanks/blank_gear.png deleted file mode 100644 index 3d369a7..0000000 Binary files a/Mundus/Icons/Blanks/blank_gear.png and /dev/null differ diff --git a/Mundus/Icons/Blanks/blank_hand.png b/Mundus/Icons/Blanks/blank_hand.png deleted file mode 100644 index 3c41e07..0000000 Binary files a/Mundus/Icons/Blanks/blank_hand.png and /dev/null differ diff --git a/Mundus/Icons/Materials/stick.png b/Mundus/Icons/Materials/stick.png new file mode 100644 index 0000000..b6ee812 Binary files /dev/null and b/Mundus/Icons/Materials/stick.png differ diff --git a/Mundus/Icons/Project files/1-4.xcf b/Mundus/Icons/Project files/1-4.xcf new file mode 100644 index 0000000..6d17a43 Binary files /dev/null and b/Mundus/Icons/Project files/1-4.xcf differ diff --git a/Mundus/Icons/Project files/2-4.xcf b/Mundus/Icons/Project files/2-4.xcf new file mode 100644 index 0000000..79c4283 Binary files /dev/null and b/Mundus/Icons/Project files/2-4.xcf differ diff --git a/Mundus/Icons/Project files/3-4.xcf b/Mundus/Icons/Project files/3-4.xcf new file mode 100644 index 0000000..bebbb65 Binary files /dev/null and b/Mundus/Icons/Project files/3-4.xcf differ diff --git a/Mundus/Icons/Project files/4-4.xcf b/Mundus/Icons/Project files/4-4.xcf new file mode 100644 index 0000000..ea63409 Binary files /dev/null and b/Mundus/Icons/Project files/4-4.xcf differ diff --git a/Mundus/Icons/Project files/stick.xcf b/Mundus/Icons/Project files/stick.xcf new file mode 100644 index 0000000..6f90c39 Binary files /dev/null and b/Mundus/Icons/Project files/stick.xcf differ diff --git a/Mundus/Icons/UI/Blanks/blank.png b/Mundus/Icons/UI/Blanks/blank.png new file mode 100644 index 0000000..049be24 Binary files /dev/null and b/Mundus/Icons/UI/Blanks/blank.png differ diff --git a/Mundus/Icons/UI/Blanks/blank_gear.png b/Mundus/Icons/UI/Blanks/blank_gear.png new file mode 100644 index 0000000..3d369a7 Binary files /dev/null and b/Mundus/Icons/UI/Blanks/blank_gear.png differ diff --git a/Mundus/Icons/UI/Blanks/blank_hand.png b/Mundus/Icons/UI/Blanks/blank_hand.png new file mode 100644 index 0000000..3c41e07 Binary files /dev/null and b/Mundus/Icons/UI/Blanks/blank_hand.png differ diff --git a/Mundus/Icons/UI/Blanks/empty.png b/Mundus/Icons/UI/Blanks/empty.png new file mode 100644 index 0000000..24cc5a4 Binary files /dev/null and b/Mundus/Icons/UI/Blanks/empty.png differ diff --git a/Mundus/Icons/UI/Hearth/1-4.png b/Mundus/Icons/UI/Hearth/1-4.png new file mode 100644 index 0000000..c518bee Binary files /dev/null and b/Mundus/Icons/UI/Hearth/1-4.png differ diff --git a/Mundus/Icons/UI/Hearth/2-4.png b/Mundus/Icons/UI/Hearth/2-4.png new file mode 100644 index 0000000..ac1120c Binary files /dev/null and b/Mundus/Icons/UI/Hearth/2-4.png differ diff --git a/Mundus/Icons/UI/Hearth/3-4.png b/Mundus/Icons/UI/Hearth/3-4.png new file mode 100644 index 0000000..af0e680 Binary files /dev/null and b/Mundus/Icons/UI/Hearth/3-4.png differ diff --git a/Mundus/Icons/UI/Hearth/4-4.png b/Mundus/Icons/UI/Hearth/4-4.png new file mode 100644 index 0000000..3afbd5c Binary files /dev/null and b/Mundus/Icons/UI/Hearth/4-4.png differ diff --git a/Mundus/Mundus.csproj b/Mundus/Mundus.csproj index 8e18c30..02cb0f1 100644 --- a/Mundus/Mundus.csproj +++ b/Mundus/Mundus.csproj @@ -55,12 +55,18 @@ - - - + + + + + + + + + @@ -116,6 +122,7 @@ + diff --git a/Mundus/Service/Mobs/IMob.cs b/Mundus/Service/Mobs/IMob.cs index e84e367..9af9cb5 100644 --- a/Mundus/Service/Mobs/IMob.cs +++ b/Mundus/Service/Mobs/IMob.cs @@ -6,6 +6,7 @@ namespace Mundus.Service.Mobs { MobTile Tile { get; } ISuperLayer CurrSuperLayer { get; set; } int XPos { get; set; } - int YPos { get; set; } + int YPos { get; set; } + int Health { get; set; } } } diff --git a/Mundus/Service/Mobs/LandMobs/Player.cs b/Mundus/Service/Mobs/LandMobs/Player.cs index 9a52dd0..280a12f 100644 --- a/Mundus/Service/Mobs/LandMobs/Player.cs +++ b/Mundus/Service/Mobs/LandMobs/Player.cs @@ -8,13 +8,15 @@ namespace Mundus.Service.Mobs.LandMobs { public int YPos { get; set; } public int XPos { get; set; } public Inventory Inventory { get; set; } + public int Health { get; set; } - public Player(string stock_id, int inventorySize) : this(new MobTile(stock_id), inventorySize) + public Player(string stock_id, int health, int inventorySize) : this(new MobTile(stock_id), health, inventorySize) { } - public Player(MobTile tile, int inventorySize) { + public Player(MobTile tile, int health, int inventorySize) { this.Tile = tile; - this.Inventory = new Inventory(inventorySize); + this.Inventory = new Inventory(inventorySize); + this.Health = health; } } } diff --git a/Mundus/Service/Mobs/MobStatsController.cs b/Mundus/Service/Mobs/MobStatsController.cs new file mode 100644 index 0000000..92c8fff --- /dev/null +++ b/Mundus/Service/Mobs/MobStatsController.cs @@ -0,0 +1,39 @@ +using Gtk; +using Mundus.Data; +using Mundus.Data.Superlayers.Mobs; + +namespace Mundus.Service.Mobs { + public static class MobStatsController { + public static int GetPlayerHealth() { + return LMI.Player.Health; + } + + public static Image GetPlayerHearth(int index) { + Image img = new Image("empty", IconSize.Dnd); + + int diff = GetPlayerHealth() - index * 4; + if (diff >= 4) img = new Image("hearth_4-4", IconSize.Dnd); + else if (diff == 1) img = new Image("hearth_1-4", IconSize.Dnd); + else if (diff == 2) img = new Image("hearth_2-4", IconSize.Dnd); + else if (diff == 3) img = new Image("hearth_3-4", IconSize.Dnd); + + return img; + } + + public static void DamagePlayer(int healthPoints) { + LMI.Player.Health -= healthPoints; + + if (LMI.Player.Health <= 0) { + //do smth + } + } + + public static void TryHealPlayer(int healthPoints) { + LMI.Player.Health += healthPoints; + + if (LMI.Player.Health > MapSizes.CurrSize / 5 * 4) { + LMI.Player.Health = MapSizes.CurrSize / 5 * 4; + } + } + } +} diff --git a/Mundus/Service/Mobs/MobTerraforming.cs b/Mundus/Service/Mobs/MobTerraforming.cs index 8c7a4e1..44f865b 100644 --- a/Mundus/Service/Mobs/MobTerraforming.cs +++ b/Mundus/Service/Mobs/MobTerraforming.cs @@ -5,6 +5,7 @@ using Mundus.Service.Tiles.Items; namespace Mundus.Service.Mobs { public static class MobTerraforming { + public static void PlayerDestroyAt(int mapYPos, int mapXPos, string place, int index) { if (LMI.Player.Inventory.GetTile(place, index).GetType() == typeof(Tool)) { var selTool = (Tool)LMI.Player.Inventory.GetTile(place, index); diff --git a/Mundus/Service/SuperLayers/LandPresets.cs b/Mundus/Service/SuperLayers/LandPresets.cs index 658cb2a..73a64a6 100644 --- a/Mundus/Service/SuperLayers/LandPresets.cs +++ b/Mundus/Service/SuperLayers/LandPresets.cs @@ -8,7 +8,7 @@ namespace Mundus.Service.SuperLayers { } public static Structure Tree() { - return new Structure("tree", ToolTypes.Axe, 1); + return new Structure("tree", ToolTypes.Pickaxe, 1, false, new Material("stick")); } } } diff --git a/Mundus/Views/Windows/SmallGameWindow.cs b/Mundus/Views/Windows/SmallGameWindow.cs index 2fd2199..552315f 100644 --- a/Mundus/Views/Windows/SmallGameWindow.cs +++ b/Mundus/Views/Windows/SmallGameWindow.cs @@ -245,7 +245,20 @@ namespace Mundus.Views.Windows { } public void PrintMainMenu() { - //Print stats + //Print lungs + + //Print health + for (int i = 0; i < Size; i++) { + string iName = MobStatsController.GetPlayerHearth(i).Stock; + + switch (i) { + case 0: imgS6.SetFromStock(iName, IconSize.Dnd); break; + case 1: imgS7.SetFromStock(iName, IconSize.Dnd); break; + case 2: imgS8.SetFromStock(iName, IconSize.Dnd); break; + case 3: imgS9.SetFromStock(iName, IconSize.Dnd); break; + case 4: imgS10.SetFromStock(iName, IconSize.Dnd); break; + } + } //Prints hotbar for (int i = 0; i < Size; i++) { @@ -886,10 +899,14 @@ namespace Mundus.Views.Windows { protected void OnBtnIG1Clicked(object sender, EventArgs e) { Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[0] = LandPresets.Boulder(); + //MobStatsController.DamagePlayer(1); + //PrintMainMenu(); } protected void OnBtnIG2Clicked(object sender, EventArgs e) { Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[1] = new Service.Tiles.Items.Tool("blank_hand", Mundus.Data.Tiles.ToolTypes.Pickaxe, 1); + //MobStatsController.TryHealPlayer(1); + //PrintMainMenu(); } } } diff --git a/Mundus/gtk-gui/generated.cs b/Mundus/gtk-gui/generated.cs index 79633c6..c2fce8a 100644 --- a/Mundus/gtk-gui/generated.cs +++ b/Mundus/gtk-gui/generated.cs @@ -18,11 +18,11 @@ namespace Stetic w1.Add("boulder", w3); global::Gtk.IconSet w4 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.player.png")); w1.Add("player", w4); - global::Gtk.IconSet w5 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.Blanks.blank.png")); + global::Gtk.IconSet w5 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Blanks.blank.png")); w1.Add("blank", w5); - global::Gtk.IconSet w6 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.Blanks.blank_hand.png")); + global::Gtk.IconSet w6 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Blanks.blank_hand.png")); w1.Add("blank_hand", w6); - global::Gtk.IconSet w7 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.Blanks.blank_gear.png")); + global::Gtk.IconSet w7 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Blanks.blank_gear.png")); w1.Add("blank_gear", w7); global::Gtk.IconSet w8 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.Materials.land_rock.png")); w1.Add("land_rock", w8); @@ -30,6 +30,18 @@ namespace Stetic w1.Add("tree", w9); global::Gtk.IconSet w10 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.Land.Ground.water.png")); w1.Add("water", w10); + global::Gtk.IconSet w11 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Blanks.empty.png")); + w1.Add("empty", w11); + global::Gtk.IconSet w12 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Hearth.4-4.png")); + w1.Add("hearth_4-4", w12); + global::Gtk.IconSet w13 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Hearth.3-4.png")); + w1.Add("hearth_3-4", w13); + global::Gtk.IconSet w14 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Hearth.2-4.png")); + w1.Add("hearth_2-4", w14); + global::Gtk.IconSet w15 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.UI.Hearth.1-4.png")); + w1.Add("hearth_1-4", w15); + global::Gtk.IconSet w16 = new global::Gtk.IconSet(global::Gdk.Pixbuf.LoadFromResource("Mundus.Icons.Materials.stick.png")); + w1.Add("stick", w16); w1.AddDefault(); } } diff --git a/Mundus/gtk-gui/gui.stetic b/Mundus/gtk-gui/gui.stetic index 874934e..4517ed3 100644 --- a/Mundus/gtk-gui/gui.stetic +++ b/Mundus/gtk-gui/gui.stetic @@ -24,17 +24,17 @@ - resource:Mundus.Icons.Blanks.blank.png + resource:Mundus.Icons.UI.Blanks.blank.png - resource:Mundus.Icons.Blanks.blank_hand.png + resource:Mundus.Icons.UI.Blanks.blank_hand.png - resource:Mundus.Icons.Blanks.blank_gear.png + resource:Mundus.Icons.UI.Blanks.blank_gear.png @@ -52,6 +52,36 @@ resource:Mundus.Icons.Land.Ground.water.png + + + resource:Mundus.Icons.UI.Blanks.empty.png + + + + + resource:Mundus.Icons.UI.Hearth.4-4.png + + + + + resource:Mundus.Icons.UI.Hearth.3-4.png + + + + + resource:Mundus.Icons.UI.Hearth.2-4.png + + + + + resource:Mundus.Icons.UI.Hearth.1-4.png + + + + + resource:Mundus.Icons.Materials.stick.png + + -- cgit v1.2.3