about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2012-06-05 12:40:11 -0400
committerStarla Insigna <hatkirby@fourisland.com>2012-06-05 12:40:11 -0400
commit5d3e3ec4224e93307d69442ab844a220b8208ccd (patch)
tree837c6c0501dcffd1da397b6eb25e95e42edd06dc
parente5025a0037a08c70f653b079c30b46cef8956c4a (diff)
downloadfrigidearth-5d3e3ec4224e93307d69442ab844a220b8208ccd.tar.gz
frigidearth-5d3e3ec4224e93307d69442ab844a220b8208ccd.tar.bz2
frigidearth-5d3e3ec4224e93307d69442ab844a220b8208ccd.zip
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.
-rw-r--r--src/com/fourisland/frigidearth/MapViewGameState.java12
1 files changed, 11 insertions, 1 deletions
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
813 if (mob.health <= 0) 813 if (mob.health <= 0)
814 { 814 {
815 printMessage("You killed the " + mob.getName().toLowerCase() + "!"); 815 printMessage("You killed the " + mob.getName().toLowerCase() + "!");
816 Main.currentGame.experience += (mob.getBaseExperience()/(Main.currentGame.level*Main.currentGame.level));
817 mobs.remove(mob); 816 mobs.remove(mob);
818 817
818 Main.currentGame.experience += (mob.getBaseExperience()/(Main.currentGame.level*Main.currentGame.level));
819 if (Main.currentGame.experience >= 1000) 819 if (Main.currentGame.experience >= 1000)
820 { 820 {
821 Main.currentGame.level++; 821 Main.currentGame.level++;
@@ -827,6 +827,16 @@ public class MapViewGameState implements GameState
827 827
828 printMessage("You grow to level " + Main.currentGame.level + "!"); 828 printMessage("You grow to level " + Main.currentGame.level + "!");
829 } 829 }
830
831 if (Functions.random(0, 1000) < (mob.getBaseExperience() / (floor*floor)))
832 {
833 ItemInstance ii = new ItemInstance();
834 ii.item = Item.getWeightedRandomItem();
835 ii.x = mob.x;
836 ii.y = mob.y;
837
838 items.add(ii);
839 }
830 } 840 }
831 841
832 foundMob = true; 842 foundMob = true;