From ab6aa5a044d26c850b16de8d9a5d5a0db5674d70 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 16 May 2020 17:21:43 -0400 Subject: [PATCH] v0.8.1: adjusted equipment drops from enemies, and added new ones --- .../shatteredpixeldungeon/Dungeon.java | 5 ++++ .../actors/mobs/DM200.java | 23 ++++++++++++++++++- .../actors/mobs/Golem.java | 23 ++++++++++++++++--- .../actors/mobs/Guard.java | 15 +++++------- .../actors/mobs/Skeleton.java | 17 ++++++-------- .../actors/mobs/Slime.java | 12 +++++++++- 6 files changed, 71 insertions(+), 24 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index b0429e9ea..c9ac5f3cd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -99,8 +99,13 @@ public class Dungeon { BLANDFRUIT_SEED, //Other limited enemy drops + SLIME_WEP, + SKELE_WEP, THEIF_MISC, + GUARD_ARM, SHAMAN_WAND, + DM200_EQUIP, + GOLEM_EQUIP, //containers DEW_VIAL, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM200.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM200.java index d6f89e436..9dc5200c4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM200.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM200.java @@ -21,9 +21,12 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas; +import com.shatteredpixel.shatteredpixeldungeon.items.Generator; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -43,7 +46,8 @@ public class DM200 extends Mob { EXP = 9; maxLvl = 17; - //TODO loot? + loot = Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR); + lootChance = 0.125f; //initially, see rollToDropLoot properties.add(Property.INORGANIC); properties.add(Property.LARGE); @@ -66,6 +70,23 @@ public class DM200 extends Mob { return Random.NormalIntRange(0, 8); } + @Override + public void rollToDropLoot() { + //each drop makes future drops 1/2 as likely + // so loot chance looks like: 1/8, 1/16, 1/32, 1/64, etc. + lootChance *= Math.pow(1/2f, Dungeon.LimitedDrops.DM200_EQUIP.count); + super.rollToDropLoot(); + } + + protected Item createLoot() { + //uses probability tables for dwarf city + if (loot == Generator.Category.WEAPON){ + return Generator.randomWeapon(4); + } else { + return Generator.randomArmor(4); + } + } + private int ventCooldown = 0; private static final String VENT_COOLDOWN = "vent_cooldown"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java index b59d336a5..d7321dff1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java @@ -27,6 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; +import com.shatteredpixel.shatteredpixeldungeon.items.Generator; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.sprites.GolemSprite; import com.watabou.utils.Bundle; @@ -43,7 +45,10 @@ public class Golem extends Mob { EXP = 12; maxLvl = 22; - + + loot = Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR); + lootChance = 0.125f; //initially, see rollToDropLoot + properties.add(Property.INORGANIC); properties.add(Property.LARGE); @@ -65,14 +70,26 @@ public class Golem extends Mob { public int drRoll() { return Random.NormalIntRange(0, 12); } - + @Override public void rollToDropLoot() { Imp.Quest.process( this ); - + + //each drop makes future drops 1/2 as likely + // so loot chance looks like: 1/8, 1/16, 1/32, 1/64, etc. + lootChance *= Math.pow(1/2f, Dungeon.LimitedDrops.GOLEM_EQUIP.count); super.rollToDropLoot(); } + protected Item createLoot() { + //uses probability tables for demon halls + if (loot == Generator.Category.WEAPON){ + return Generator.randomWeapon(5); + } else { + return Generator.randomArmor(5); + } + } + private boolean teleporting = false; private int selfTeleCooldown = 0; private int enemyTeleCooldown = 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java index 1736ab57c..074cf8ae6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java @@ -53,7 +53,7 @@ public class Guard extends Mob { maxLvl = 14; loot = Generator.Category.ARMOR; - lootChance = 0.1667f; + lootChance = 0.2f; //by default, see rollToDropLoot() properties.add(Property.UNDEAD); @@ -124,14 +124,11 @@ public class Guard extends Mob { } @Override - protected Item createLoot() { - Armor loot; - do{ - loot = Generator.randomArmor(); - //50% chance of re-rolling tier 4 or 5 items - } while (loot.tier >= 4 && Random.Int(2) == 0); - loot.level(0); - return loot; + public void rollToDropLoot() { + //each drop makes future drops 1/2 as likely + // so loot chance looks like: 1/5, 1/10, 1/20, 1/40, etc. + lootChance *= Math.pow(1/2f, Dungeon.LimitedDrops.GUARD_ARM.count); + super.rollToDropLoot(); } private final String CHAINSUSED = "chainsused"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java index a0f716452..c819550aa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java @@ -47,7 +47,7 @@ public class Skeleton extends Mob { maxLvl = 10; loot = Generator.Category.WEAPON; - lootChance = 0.125f; + lootChance = 0.1667f; //by default, see rollToDropLoot() properties.add(Property.UNDEAD); properties.add(Property.INORGANIC); @@ -87,16 +87,13 @@ public class Skeleton extends Mob { GLog.n( Messages.get(this, "explo_kill") ); } } - + @Override - protected Item createLoot() { - MeleeWeapon loot; - do { - loot = Generator.randomWeapon(); - //50% chance of re-rolling tier 4 or 5 melee weapons - } while (loot.tier >= 4 && Random.Int(2) == 0); - loot.level(0); - return loot; + public void rollToDropLoot() { + //each drop makes future drops 1/2 as likely + // so loot chance looks like: 1/6, 1/12, 1/24, 1/48, etc. + lootChance *= Math.pow(1/2f, Dungeon.LimitedDrops.SKELE_WEP.count); + super.rollToDropLoot(); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Slime.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Slime.java index a46f425ca..b255b5d2f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Slime.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Slime.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; @@ -40,7 +41,7 @@ public class Slime extends Mob { EXP = 4; maxLvl = 9; - lootChance = 0.1f; + lootChance = 0.2f; //by default, see rollToDropLoot() } @Override @@ -61,9 +62,18 @@ public class Slime extends Mob { } super.damage(dmg, src); } + + @Override + public void rollToDropLoot() { + //each drop makes future drops 1/2 as likely + // so loot chance looks like: 1/5, 1/10, 1/20, 1/40, etc. + lootChance *= Math.pow(1/2f, Dungeon.LimitedDrops.SLIME_WEP.count); + super.rollToDropLoot(); + } @Override protected Item createLoot() { + Dungeon.LimitedDrops.SLIME_WEP.count++; Generator.Category c = Generator.Category.WEP_T2; MeleeWeapon w = (MeleeWeapon) Reflection.newInstance(c.classes[Random.chances(c.probs)]); w.random();