Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Commit b2652e4

Browse files
author
nickthegamer5
committed
Merged the !reset command into !setup and changed the hit/miss ratio
1 parent 33ba672 commit b2652e4

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Command | Action
2424
`!state` | Used to view yours and the monsters state.
2525
`!shutdown` | Used to shutdown the bot (Admin only)
2626
`!help` | Display commands
27-
`!reset` | Reset the game
2827

2928
### Features
3029
- Auto login (Currently unsecure, mostly just for testing)

SteamBattleBot/SteamFunctions.cs

+2-14
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ void OnChatMessage(SteamFriends.FriendMsgCallback callBack)
215215
if (players[i].id == callBack.Sender.AccountID)
216216
{
217217
Console.WriteLine("!setup command recived. User: {0}", steamFriends.GetFriendPersonaName(callBack.Sender));
218-
steamFriends.SendChatMessage(callBack.Sender, EChatEntryType.ChatMsg, "ID already found in list; ignoreing command...");
218+
steamFriends.SendChatMessage(callBack.Sender, EChatEntryType.ChatMsg, "Resetting game...");
219+
players[i].setupGame();
219220
return;
220221
}
221222
}
@@ -259,19 +260,6 @@ void OnChatMessage(SteamFriends.FriendMsgCallback callBack)
259260
break;
260261
#endregion
261262

262-
#region !reset
263-
case "!reset":
264-
steamFriends.SendChatMessage(callBack.Sender, EChatEntryType.ChatMsg, "Resetting stats back to 100...");
265-
foreach (Structures.PlayerStructure player in players) // Loop the list
266-
{
267-
if (player.id == callBack.Sender.AccountID)
268-
{
269-
player.setupGame();
270-
}
271-
}
272-
break;
273-
#endregion
274-
275263
#region !help
276264
case "!help":
277265
Console.WriteLine("!help command revied. User: {0}", steamFriends.GetFriendPersonaName(callBack.Sender));

SteamBattleBot/Structures/PlayerStructure.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public void setupGame()
2626

2727
public void attack(SteamFriends.FriendMsgCallback callback, SteamFriends steamFriends)
2828
{
29-
hitChance = _random.Next(1, 3);
30-
if (hitChance == 1) // Missed
29+
hitChance = _random.Next(1, 4);
30+
if (hitChance == 3) // Missed
3131
{
3232
steamFriends.SendChatMessage(callback.Sender, EChatEntryType.ChatMsg, "You missed the monster!");
3333
} else
@@ -36,9 +36,10 @@ public void attack(SteamFriends.FriendMsgCallback callback, SteamFriends steamFr
3636
enemy.hp -= damageDone;
3737
steamFriends.SendChatMessage(callback.Sender, EChatEntryType.ChatMsg, String.Format("You hit the monster for {0} damage!", damageDone));
3838
}
39-
40-
hitChance = _random.Next(1, 3);
41-
if (hitChance == 1) // Missed
39+
Console.WriteLine(hitChance);
40+
hitChance = _random.Next(1, 4);
41+
Console.WriteLine(hitChance);
42+
if (hitChance == 3) // Missed
4243
{
4344
steamFriends.SendChatMessage(callback.Sender, EChatEntryType.ChatMsg, "The monster missed you!");
4445
}

0 commit comments

Comments
 (0)