v0.6.3: corruption now causes enemies to drop loot and projectiles
This commit is contained in:
parent
0182bae2a0
commit
8461500d66
|
@ -22,6 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
@ -38,6 +39,13 @@ public class Corruption extends Buff {
|
|||
public boolean attachTo(Char target) {
|
||||
if (super.attachTo(target)){
|
||||
target.alignment = Char.Alignment.ALLY;
|
||||
if (target instanceof Mob){
|
||||
((Mob) target).rollToDropLoot();
|
||||
}
|
||||
PinCushion p = target.buff(PinCushion.class);
|
||||
if (p != null){
|
||||
p.detach();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Bandit extends Thief {
|
|||
{
|
||||
spriteClass = BanditSprite.class;
|
||||
|
||||
//1 in 30 chance to be a crazy bandit, equates to overall 1/90 chance.
|
||||
//1 in 50 chance to be a crazy bandit, equates to overall 1/150 chance.
|
||||
lootChance = 0.333f;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Wound;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
|
@ -555,24 +556,8 @@ public abstract class Mob extends Char {
|
|||
|
||||
super.die( cause );
|
||||
|
||||
float lootChance = this.lootChance;
|
||||
lootChance *= RingOfWealth.dropChanceMultiplier( Dungeon.hero );
|
||||
|
||||
if (Random.Float() < lootChance && Dungeon.hero.lvl <= maxLvl + 2) {
|
||||
Item loot = createLoot();
|
||||
if (loot != null)
|
||||
Dungeon.level.drop( loot , pos ).sprite.drop();
|
||||
}
|
||||
|
||||
if (alignment == Alignment.ENEMY && Dungeon.hero.lvl <= maxLvl + 2){
|
||||
int rolls = 1;
|
||||
if (properties.contains(Property.BOSS)) rolls = 15;
|
||||
else if (properties.contains(Property.MINIBOSS)) rolls = 5;
|
||||
ArrayList<Item> bonus = RingOfWealth.tryRareDrop(Dungeon.hero, rolls);
|
||||
if (bonus != null){
|
||||
for (Item b : bonus) Dungeon.level.drop( b , pos ).sprite.drop();
|
||||
new Flare(8, 32).color(0xFFFF00, true).show(sprite, 2f);
|
||||
}
|
||||
if (alignment == Alignment.ENEMY){
|
||||
rollToDropLoot();
|
||||
}
|
||||
|
||||
if (Dungeon.hero.isAlive() && !Dungeon.level.heroFOV[pos]) {
|
||||
|
@ -580,6 +565,32 @@ public abstract class Mob extends Char {
|
|||
}
|
||||
}
|
||||
|
||||
public void rollToDropLoot(){
|
||||
if (Dungeon.hero.lvl > maxLvl + 2) return;
|
||||
|
||||
float lootChance = this.lootChance;
|
||||
lootChance *= RingOfWealth.dropChanceMultiplier( Dungeon.hero );
|
||||
|
||||
if (Random.Float() < lootChance) {
|
||||
Item loot = createLoot();
|
||||
if (loot != null) {
|
||||
Dungeon.level.drop(loot, pos).sprite.drop();
|
||||
}
|
||||
}
|
||||
|
||||
//ring of wealth logic
|
||||
if (Ring.getBonus(Dungeon.hero, RingOfWealth.Wealth.class) > 0) {
|
||||
int rolls = 1;
|
||||
if (properties.contains(Property.BOSS)) rolls = 15;
|
||||
else if (properties.contains(Property.MINIBOSS)) rolls = 5;
|
||||
ArrayList<Item> bonus = RingOfWealth.tryRareDrop(Dungeon.hero, rolls);
|
||||
if (bonus != null) {
|
||||
for (Item b : bonus) Dungeon.level.drop(b, pos).sprite.drop();
|
||||
new Flare(8, 32).color(0xFFFF00, true).show(sprite, 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Object loot = null;
|
||||
protected float lootChance = 0;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class Swarm extends Mob {
|
|||
flying = true;
|
||||
|
||||
loot = new PotionOfHealing();
|
||||
lootChance = 0.1667f; //by default, see die()
|
||||
lootChance = 0.1667f; //by default, see rollToDropLoot()
|
||||
}
|
||||
|
||||
private static final float SPLIT_DELAY = 1f;
|
||||
|
@ -138,12 +138,12 @@ public class Swarm extends Mob {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void die( Object cause ){
|
||||
public void rollToDropLoot() {
|
||||
//sets drop chance
|
||||
lootChance = 1f/((6 + 2* Dungeon.LimitedDrops.SWARM_HP.count ) * (generation+1) );
|
||||
super.die( cause );
|
||||
super.rollToDropLoot();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
Dungeon.LimitedDrops.SWARM_HP.count++;
|
||||
|
|
|
@ -91,19 +91,17 @@ public class Thief extends Mob {
|
|||
protected float attackDelay() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void die( Object cause ) {
|
||||
|
||||
super.die( cause );
|
||||
|
||||
public void rollToDropLoot() {
|
||||
if (item != null) {
|
||||
Dungeon.level.drop( item, pos ).sprite.drop();
|
||||
//updates position
|
||||
if (item instanceof Honeypot.ShatteredPot) ((Honeypot.ShatteredPot)item).setHolder( this );
|
||||
}
|
||||
super.rollToDropLoot();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Item createLoot(){
|
||||
if (!Dungeon.LimitedDrops.THIEVES_ARMBAND.dropped()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user