Skip to content

Commit 83d5a3d

Browse files
updated item drop function to be templated
1 parent 76419b9 commit 83d5a3d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

SlimeBattleSystem/BattleSystem.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ public static Participant DetermineEnemyTarget(List<Participant> playerParticipa
6565

6666
public static Participant DetermineEnemyTarget(List<Participant> playerParticipants, Random random)
6767
{
68-
// NPCs that are on the player's team have a 25% chance to be hit
69-
// this is where you would also handle any formation based logic
70-
// else, each player character has an equal chance to be hit by the enemy
68+
// currently each player character has an equal chance to be hit by the enemy
7169
return playerParticipants[random.Next(0, playerParticipants.Count )];
7270
}
7371

@@ -211,12 +209,12 @@ public static int DetermineGoldPoints(List<Participant> defeatedParticipants, Ra
211209
return gpSum;
212210
}
213211

214-
public static List<Object> DetermineItemsDropped(Dictionary<Object, int> droppableItems) {
212+
public static List<T> DetermineItemsDropped<T>(Dictionary<T, int> droppableItems) {
215213
return DetermineItemsDropped(droppableItems, Random);
216214
}
217215

218-
public static List<Object> DetermineItemsDropped(Dictionary<Object, int> droppableItems, Random random) {
219-
List<Object> itemsDropped = new List<Object>();
216+
public static List<T> DetermineItemsDropped<T>(Dictionary<T, int> droppableItems, Random random) {
217+
List<T> itemsDropped = new List<T>();
220218

221219
foreach (var droppableItem in droppableItems) {
222220
if (random.Next(droppableItem.Value, 100) <= droppableItem.Value) {

0 commit comments

Comments
 (0)