diff options
24 files changed, 125 insertions, 16 deletions
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/Materials/stick.png b/Mundus/Icons/Materials/stick.png Binary files differnew file mode 100644 index 0000000..b6ee812 --- /dev/null +++ b/Mundus/Icons/Materials/stick.png diff --git a/Mundus/Icons/Project files/1-4.xcf b/Mundus/Icons/Project files/1-4.xcf Binary files differnew file mode 100644 index 0000000..6d17a43 --- /dev/null +++ b/Mundus/Icons/Project files/1-4.xcf diff --git a/Mundus/Icons/Project files/2-4.xcf b/Mundus/Icons/Project files/2-4.xcf Binary files differnew file mode 100644 index 0000000..79c4283 --- /dev/null +++ b/Mundus/Icons/Project files/2-4.xcf diff --git a/Mundus/Icons/Project files/3-4.xcf b/Mundus/Icons/Project files/3-4.xcf Binary files differnew file mode 100644 index 0000000..bebbb65 --- /dev/null +++ b/Mundus/Icons/Project files/3-4.xcf diff --git a/Mundus/Icons/Project files/4-4.xcf b/Mundus/Icons/Project files/4-4.xcf Binary files differnew file mode 100644 index 0000000..ea63409 --- /dev/null +++ b/Mundus/Icons/Project files/4-4.xcf diff --git a/Mundus/Icons/Project files/stick.xcf b/Mundus/Icons/Project files/stick.xcf Binary files differnew file mode 100644 index 0000000..6f90c39 --- /dev/null +++ b/Mundus/Icons/Project files/stick.xcf diff --git a/Mundus/Icons/Blanks/blank.png b/Mundus/Icons/UI/Blanks/blank.png Binary files differindex 049be24..049be24 100644 --- a/Mundus/Icons/Blanks/blank.png +++ b/Mundus/Icons/UI/Blanks/blank.png diff --git a/Mundus/Icons/Blanks/blank_gear.png b/Mundus/Icons/UI/Blanks/blank_gear.png Binary files differindex 3d369a7..3d369a7 100644 --- a/Mundus/Icons/Blanks/blank_gear.png +++ b/Mundus/Icons/UI/Blanks/blank_gear.png diff --git a/Mundus/Icons/Blanks/blank_hand.png b/Mundus/Icons/UI/Blanks/blank_hand.png Binary files differindex 3c41e07..3c41e07 100644 --- a/Mundus/Icons/Blanks/blank_hand.png +++ b/Mundus/Icons/UI/Blanks/blank_hand.png diff --git a/Mundus/Icons/UI/Blanks/empty.png b/Mundus/Icons/UI/Blanks/empty.png Binary files differnew file mode 100644 index 0000000..24cc5a4 --- /dev/null +++ b/Mundus/Icons/UI/Blanks/empty.png diff --git a/Mundus/Icons/UI/Hearth/1-4.png b/Mundus/Icons/UI/Hearth/1-4.png Binary files differnew file mode 100644 index 0000000..c518bee --- /dev/null +++ b/Mundus/Icons/UI/Hearth/1-4.png diff --git a/Mundus/Icons/UI/Hearth/2-4.png b/Mundus/Icons/UI/Hearth/2-4.png Binary files differnew file mode 100644 index 0000000..ac1120c --- /dev/null +++ b/Mundus/Icons/UI/Hearth/2-4.png diff --git a/Mundus/Icons/UI/Hearth/3-4.png b/Mundus/Icons/UI/Hearth/3-4.png Binary files differnew file mode 100644 index 0000000..af0e680 --- /dev/null +++ b/Mundus/Icons/UI/Hearth/3-4.png diff --git a/Mundus/Icons/UI/Hearth/4-4.png b/Mundus/Icons/UI/Hearth/4-4.png Binary files differnew file mode 100644 index 0000000..3afbd5c --- /dev/null +++ b/Mundus/Icons/UI/Hearth/4-4.png 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 @@ <EmbeddedResource Include="Icons\Land\Ground\grass.png" />
<EmbeddedResource Include="Icons\Land\Items\boulder.png" />
<EmbeddedResource Include="Icons\player.png" />
- <EmbeddedResource Include="Icons\Blanks\blank.png" />
- <EmbeddedResource Include="Icons\Blanks\blank_hand.png" />
- <EmbeddedResource Include="Icons\Blanks\blank_gear.png" />
<EmbeddedResource Include="Icons\Materials\land_rock.png" />
<EmbeddedResource Include="Icons\Land\Items\tree.png" />
<EmbeddedResource Include="Icons\Land\Ground\water.png" />
+ <EmbeddedResource Include="Icons\UI\Blanks\blank.png" />
+ <EmbeddedResource Include="Icons\UI\Blanks\blank_hand.png" />
+ <EmbeddedResource Include="Icons\UI\Blanks\blank_gear.png" />
+ <EmbeddedResource Include="Icons\UI\Blanks\empty.png" />
+ <EmbeddedResource Include="Icons\UI\Hearth\4-4.png" />
+ <EmbeddedResource Include="Icons\UI\Hearth\3-4.png" />
+ <EmbeddedResource Include="Icons\UI\Hearth\2-4.png" />
+ <EmbeddedResource Include="Icons\UI\Hearth\1-4.png" />
+ <EmbeddedResource Include="Icons\Materials\stick.png" />
</ItemGroup>
<ItemGroup>
<Compile Include="gtk-gui\generated.cs" />
@@ -116,6 +122,7 @@ <Compile Include="Service\Mobs\MobFighting.cs" />
<Compile Include="Service\Mobs\MobTerraforming.cs" />
<Compile Include="Service\SuperLayers\LandPresets.cs" />
+ <Compile Include="Service\Mobs\MobStatsController.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Service\" />
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 @@ </icon-set> <icon-set id="blank"> <source> - <property name="Image">resource:Mundus.Icons.Blanks.blank.png</property> + <property name="Image">resource:Mundus.Icons.UI.Blanks.blank.png</property> </source> </icon-set> <icon-set id="blank_hand"> <source> - <property name="Image">resource:Mundus.Icons.Blanks.blank_hand.png</property> + <property name="Image">resource:Mundus.Icons.UI.Blanks.blank_hand.png</property> </source> </icon-set> <icon-set id="blank_gear"> <source> - <property name="Image">resource:Mundus.Icons.Blanks.blank_gear.png</property> + <property name="Image">resource:Mundus.Icons.UI.Blanks.blank_gear.png</property> </source> </icon-set> <icon-set id="land_rock"> @@ -52,6 +52,36 @@ <property name="Image">resource:Mundus.Icons.Land.Ground.water.png</property> </source> </icon-set> + <icon-set id="empty"> + <source> + <property name="Image">resource:Mundus.Icons.UI.Blanks.empty.png</property> + </source> + </icon-set> + <icon-set id="hearth_4-4"> + <source> + <property name="Image">resource:Mundus.Icons.UI.Hearth.4-4.png</property> + </source> + </icon-set> + <icon-set id="hearth_3-4"> + <source> + <property name="Image">resource:Mundus.Icons.UI.Hearth.3-4.png</property> + </source> + </icon-set> + <icon-set id="hearth_2-4"> + <source> + <property name="Image">resource:Mundus.Icons.UI.Hearth.2-4.png</property> + </source> + </icon-set> + <icon-set id="hearth_1-4"> + <source> + <property name="Image">resource:Mundus.Icons.UI.Hearth.1-4.png</property> + </source> + </icon-set> + <icon-set id="stick"> + <source> + <property name="Image">resource:Mundus.Icons.Materials.stick.png</property> + </source> + </icon-set> </icon-factory> <widget class="Gtk.Window" id="Mundus.Views.Windows.NewGameWindow" design-size="581 275"> <property name="MemberName" /> |
