From 0d4f08237f4c30bdb1b79c9ec56641fa70bf8e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jos=C3=A9?= Date: Sun, 13 Aug 2023 17:49:59 -0300 Subject: [PATCH] mob stufff --- Player.cs | 37 ++++++++++++++++------------------ Program.cs | 6 +++--- bin/Debug/net7.0/LilRogue.dll | Bin 21504 -> 22016 bytes bin/Debug/net7.0/LilRogue.pdb | Bin 19088 -> 19136 bytes mob.cs | 37 +++++++++++++++++++++++----------- 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/Player.cs b/Player.cs index 9276402..b5d65cd 100644 --- a/Player.cs +++ b/Player.cs @@ -17,7 +17,7 @@ public class Player : Entity public int MaxHP = 100; public int mana = 100; public int MaxMana = 100; - public int armor = 0; + public int armor = 1; public int Gold = 0; private SchedulingSystem _schedulingSystem; private List mobs = new List(); @@ -26,7 +26,7 @@ public class Player : Entity public Sound DMGsound = new Sound(DMGsoundBuffer); public static SoundBuffer attacksoundBuffer = new SoundBuffer("attack.wav"); public Sound attacksound = new Sound(attacksoundBuffer); - public Player(Grid grid, Vector2i position, Color fillColor, Color backgroundColor, Color outlineColor, SchedulingSystem schedulingSystem, float outlineThickness = 0, Map map = null, List mobs = null) + public Player(Grid grid, Vector2i position, Color fillColor, Color backgroundColor, Color outlineColor, SchedulingSystem schedulingSystem, float outlineThickness = 0, Map map = null) : base(grid, '@', position, fillColor, backgroundColor, outlineColor, outlineThickness) { movementTimer.Start(); @@ -39,48 +39,48 @@ public Player(Grid grid, Vector2i position, Color fillColor, Color backgro } // Add player-specific logic here, such as handling input and movement - public void HandleInput(Map map) + public void HandleInput(Map map, List mobs) { // Handle player input and update the player's position if (movementTimer.ElapsedMilliseconds >= MovementDelayMilliseconds) { if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad8)) // Numpad 8 for moving up { - tryToMove(0, -1, map); + tryToMove(0, -1, map, mobs); } else if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad2)) // Numpad 2 for moving down { - tryToMove(0, 1, map); + tryToMove(0, 1, map, mobs); } else if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad4)) // Numpad 4 for moving left { - tryToMove(-1, 0, map); + tryToMove(-1, 0, map, mobs); } else if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad6)) // Numpad 6 for moving right { - tryToMove(1, 0, map); + tryToMove(1, 0, map, mobs); } else if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad7)) // Numpad 7 for moving up-left { - tryToMove(-1, -1, map); + tryToMove(-1, -1, map, mobs); } else if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad9)) // Numpad 9 for moving up-right { - tryToMove(1, -1, map); + tryToMove(1, -1, map, mobs); } else if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad1)) // Numpad 1 for moving down-left { - tryToMove(-1, 1, map); + tryToMove(-1, 1, map, mobs); } else if (Keyboard.IsKeyPressed(Keyboard.Key.Numpad3)) // Numpad 3 for moving down-right { - tryToMove(1, 1, map); + tryToMove(1, 1, map, mobs); } @@ -90,7 +90,7 @@ public void HandleInput(Map map) } } - public void tryToMove(int x, int y, Map map) + public void tryToMove(int x, int y, Map map, List mobs) { int newX = Position.X + x; int newY = Position.Y + y; @@ -106,7 +106,7 @@ public void tryToMove(int x, int y, Map map) if (mob.HP >= 0) { - mob.TakeDamage(10); + mob.TakeDamage(15); // play damage sound using SFML attacksound.Play(); // Update the scheduling system's time @@ -155,17 +155,14 @@ public void UpdateMobs(List mobs, Map map) } } - public void TakeDamage(int damage) + public void TakeDamage(double damage) { - var DMGmuti = Math.Clamp(RNG.NextSingle(), 0.7, 1.3); - var finalDMG = (int)(damage * (DMGmuti / (armor + 1))); + var DMGmuti = Math.Clamp(RNG.NextDouble(), 0.8, 1); + var finalDMG = (double) damage * (DMGmuti * (armor + 1 - 0.6)); - HP -= Math.Clamp(finalDMG, 0, 999999); + this.HP -= (int) Math.Round(Math.Clamp(finalDMG * 1.25, 0, 999999), 1); DMGsound.Play(); - - Console.WriteLine(finalDMG); - Console.WriteLine(HP); } } diff --git a/Program.cs b/Program.cs index 3ae004a..1fcb969 100644 --- a/Program.cs +++ b/Program.cs @@ -44,7 +44,7 @@ static void Main(string[] args) var Mobs = new List(); // add mobs - for (int i = 0; i < 5; i++) + for (int i = 0; i < 2; i++) { var mob = new Mob(grid, 'M', FindWalkableCell(gameMap), Color.Black, Color.Red, Color.Black, 35 , 1); Mobs.Add(mob); @@ -53,7 +53,7 @@ static void Main(string[] args) var upStairs = new Entity(grid, '<', new Vector2i(upStairsPosition.X, upStairsPosition.Y), Color.Black, Color.Yellow, Color.White, 1, gameMap); var downStairs = new Entity(grid, '>', new Vector2i(downStairsPosition.X, downStairsPosition.Y), Color.Black, Color.Yellow, Color.White, 1, gameMap); - var player = new Player(grid, new Vector2i(upStairsPosition.X, upStairsPosition.Y), Color.Black, Color.Green, Color.White, schedulingSystem, 1, gameMap, Mobs); + var player = new Player(grid, new Vector2i(upStairsPosition.X, upStairsPosition.Y), Color.Black, Color.Green, Color.White, schedulingSystem, 1, gameMap); // Schedule an action to happen after 12 turns @@ -110,7 +110,7 @@ static void Main(string[] args) - player.HandleInput(gameMap); // Handle player input and movement + player.HandleInput(gameMap, Mobs); // Handle player input and movement window.Display(); } diff --git a/bin/Debug/net7.0/LilRogue.dll b/bin/Debug/net7.0/LilRogue.dll index 72c47ac762ac2c8c370d862745b57ab305d1eb0e..12cebcb86fb0e8413177e446c82552cf2167d655 100644 GIT binary patch delta 8227 zcmb7J33yahmOl6GwI!*lR8fnSt&Pmr-!0+XbYd(+V<<3fcpR4fEgoUP9b@dLCc>b^dei zJ@?#m@4M$#NIuDuPqVEX^XjhMwv+7V1m%&74J4Wjg<&cG(6DXKjVbFIh^BExl4!cR zE!XefMdSwGTTe90%$3T_xva=}>;|a9_)Io8u~IhGe32EgS>|z;7ydOo@Mj`E5~=iL zC5Grn#K5m1(#-1Wf$h_!(?-_MWTI3eFU3|6-RbnPU@&qWk<%vy0_G%Fj^uHe%Up&2 z0ca=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?x9RwDW0c$B`0EbfyI4()O@iCDN(}ATFq&M|(R7GV#4{$nb z=CNiTYv$qRGgGf;eKYHu=_VSduV;BZ`>cmgQg2~R3tP9dyq&GvVcntcfhJj|?`6YY zcG{1xlOy&02z^*T!TL4_Wd|qOdXlXqL$2cehjbnMPgHqGPaVxVl>Z|H|*4zD~)n6LR zUATIzu@U&WPhwa3At5zCW7NG;K2Do~w`x*8VBQPd!SW>k zM(er(e;CwL8LW8KO0`yPR(GktQ#IWEP!GF2$8kYI(W>iYL1c&ukiLmBgaz)~S&i^r|MmX@?e2L4jD_6>Pln~tByS`%dl z+}5D6o6Rv-QG(`Djdf`3($?$8O~V$W$*YbP&iYx+lvlPk?EKS`tu?KCuK2qMU1p@G z1STnpVrB%IwuoTQU{CA!SB{OC_!fy1RQ2P*hlxkSVc(j2)n$q`al)eFoS0i=1apKM zm=u^M|AGU3!B|GH=`I9u#e@jPjF>7+GZ_;Xkg#QBk&xCE}MCR$EV&FKA7f{FO_2YiMhr;#0AupYeYm_i+mV diff --git a/bin/Debug/net7.0/LilRogue.pdb b/bin/Debug/net7.0/LilRogue.pdb index f33ad65568c16215198c4e4bbf9e85fb884d3cf5..e0caba7e24248850544d4727d304ff5ebbc10712 100644 GIT binary patch delta 2456 zcmZXV3vf(V7{|YJa`)bSB(jkQvLs6)SyYf@vyWt(%|jlFU+B6CB zK*JpxHCm9Z=?dWt`@4hk98dZZS`ajpjN_Xb}-S78(-#O==*WI=a z?C1v8mRaQvCrVmQWRD;U=kNoy3un)NaS`G7OeB$nXHt29hQgmJ{NnP`LOk2RL$ks8 zH4CPL<8Obz;M|0NN531t{^MU3?Q3swxjzMc6W!;f7R?-o{d@PujZlE$q z$uLlKrh&eOoK6ExaLP2@iDHte!KKhC=nQlg`U$$?5;=u(-3k>!qo5g(3LS(xp<~bw zP_##(VbEOYE9k1nNVgz|m->lb@RRA5S0*J}rbws8(%B8J!HlE9xyXCK;wMgzU@zDNKNIpp*?L}7 zMUkBGK6uZXjB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Q-Lq3hedRJwm_KX9JN21!mMAq$ve+CA51e=R{dIovzS9Yp+n;?lijo;b6FNg_?JMg725aU=%8&_m_E3hv> ziPVT-x>U-QWYrUN&hT<20_|`ndPBx@3r?K`Ue0K^sAe>S0TX&NFe>26fSv}t&VikZ zCYD&s$S}R(icB?hVswHykt|*PE;u*zKZ*NB^`D&cl6!JGaGDLZ4L8Gcx~j!kRt8us z^YOX7aTjlz&YIffHP_ghYkaMRuM6;|k9czwYtHA*3t+qD4folG`@F@$H(GdeR~o)C ztfA4&$io#E`8e5Vkc11DC}Gfcj(dP1OX#3V{bST5rl{`1sir;bP&WJGpsE%Qmh4=y zs3!{TQk?E2i;|uN!4=Ko7W_NtE2xExDzZ!cMXYeN*5Qs@#9(W%MFV8fyYMgs2e0G} zM|ootZ}Rh|M|{mbzP6UH%jE0+QTG-NVUg;^qG2`*^^?%ZBjJzUE>o1M6bD$8T3Ea$ zZKyWW-LKCyo@}CpK3%o5c)QdlQLegd^bILdA+tJpjGOIIo5xJcXfd#sGTze4TSoH@ nFXT=8*{1z`LrOfu(=?DbA7)#s*p_E(>uUBvVn=kz=Z1d)`ay55 diff --git a/mob.cs b/mob.cs index 9106c37..6067033 100644 --- a/mob.cs +++ b/mob.cs @@ -55,6 +55,7 @@ public void Update(Map map, Player player, SchedulingSystem schedulingSystem, Li { var state = "wander"; var ToGoalPosition = new Vector2i(0,0); + var lastSeenPlayerPosition = new Vector2i(-1, -1); if (HP <= 0 || HP > MaxHP) { // set char to a bloody red "&" @@ -68,32 +69,43 @@ public void Update(Map map, Player player, SchedulingSystem schedulingSystem, Li //update state if (CanbeSeen(map)) { + lastSeenPlayerPosition = new Vector2i(player.Position.X, player.Position.Y); state = "chase"; } - else + else if (lastSeenPlayerPosition.X != -1 && lastSeenPlayerPosition.Y != -1) { state = "wander"; } if (state == "chase"){ - for (int i = 0; i < schedulingSystem.calculateTimeSteps(schedulingSystem.time, schedulingSystem.time + 4, 1); i++) + for (int i = 0; i < schedulingSystem.calculateTimeSteps(schedulingSystem.time, schedulingSystem.time + 1, 2); i++) { - ToGoalPosition = GoToLocation(player.Position.X, player.Position.Y, map); + + ToGoalPosition = GoToLocation(lastSeenPlayerPosition.X, lastSeenPlayerPosition.Y, map); //check if the mob has reached the goal position foreach (var mob in mobs) if (ToGoalPosition.X == player.Position.X && ToGoalPosition.Y == player.Position.Y) { - Console.WriteLine("Goal reached! damaging player..."); - player.TakeDamage(5); + Console.WriteLine("player reached! damaging player..."); + player.TakeDamage(1.25); + break; } else if (ToGoalPosition.X == mob.Position.X && ToGoalPosition.Y == mob.Position.Y) //blocked by another mob { - Console.WriteLine("blocked by another mob...");; + Console.WriteLine("blocked by another mob..."); + break; + } + else if (ToGoalPosition.X == mob.Position.X && ToGoalPosition.Y == mob.Position.Y) + { + Console.WriteLine("cant see player..."); + lastSeenPlayerPosition = new Vector2i(-1, -1); + break; } else { Position = new Vector2i(ToGoalPosition.X, ToGoalPosition.Y); + break; } } } @@ -111,29 +123,30 @@ public void Update(Map map, Player player, SchedulingSystem schedulingSystem, Li if (ToGoalPosition.X == player.Position.X && ToGoalPosition.Y == player.Position.Y) { Console.WriteLine("blocked by player..."); + break; } else if (ToGoalPosition.X == mob.Position.X && ToGoalPosition.Y == mob.Position.Y) //blocked by another mob { Console.WriteLine("blocked by another mob..."); + break; } else { Position = new Vector2i(ToGoalPosition.X, ToGoalPosition.Y); + break; } } } } - public void TakeDamage(int damage) + public void TakeDamage(double damage) { - var DMGmuti = Math.Clamp(RNG.NextSingle(), 0.7, 1.3); - var finalDMG = (int)(damage * (DMGmuti / (armor + 1))); + var DMGmuti = Math.Clamp(RNG.NextDouble(), 0.8, 1); + var finalDMG = (double) damage * (DMGmuti * (armor + 1 - 0.6)); - HP -= Math.Clamp(finalDMG, 0, 999999); + this.HP -= (int) Math.Round(Math.Clamp(finalDMG * 1.25, 0, 999999), 1); - Console.WriteLine(finalDMG); - Console.WriteLine(HP); } }