From 5d3e3ec4224e93307d69442ab844a220b8208ccd Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Tue, 5 Jun 2012 12:40:11 -0400 Subject: Monsters now drop items when you kill them The per mille chance that a mob will drop an item is equal to their base experience divided by the floor squared. --- src/com/fourisland/frigidearth/MapViewGameState.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index 71f803a..30a2c93 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java @@ -813,9 +813,9 @@ public class MapViewGameState implements GameState if (mob.health <= 0) { printMessage("You killed the " + mob.getName().toLowerCase() + "!"); - Main.currentGame.experience += (mob.getBaseExperience()/(Main.currentGame.level*Main.currentGame.level)); mobs.remove(mob); + Main.currentGame.experience += (mob.getBaseExperience()/(Main.currentGame.level*Main.currentGame.level)); if (Main.currentGame.experience >= 1000) { Main.currentGame.level++; @@ -827,6 +827,16 @@ public class MapViewGameState implements GameState printMessage("You grow to level " + Main.currentGame.level + "!"); } + + if (Functions.random(0, 1000) < (mob.getBaseExperience() / (floor*floor))) + { + ItemInstance ii = new ItemInstance(); + ii.item = Item.getWeightedRandomItem(); + ii.x = mob.x; + ii.y = mob.y; + + items.add(ii); + } } foundMob = true; -- cgit 1.4.1