v1.1.0: refactor to corruption to make it easier to add similar buffs

One notable mechanics change as well: All allies now remove stuck projectiles, not just corruption targets
This commit is contained in:
Evan Debenham 2021-10-22 15:34:54 -04:00
parent f8b11e814d
commit bf22a3c328
24 changed files with 125 additions and 93 deletions

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Electricity;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Adrenaline;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArcaneArmor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Berserk;
@ -884,9 +885,9 @@ public abstract class Char extends Actor {
public enum Property{
BOSS ( new HashSet<Class>( Arrays.asList(Grim.class, GrimTrap.class, ScrollOfRetribution.class, ScrollOfPsionicBlast.class)),
new HashSet<Class>( Arrays.asList(Corruption.class, Dread.class) )),
new HashSet<Class>( Arrays.asList(AllyBuff.class, Dread.class) )),
MINIBOSS ( new HashSet<Class>(),
new HashSet<Class>( Arrays.asList(Corruption.class, Dread.class) )),
new HashSet<Class>( Arrays.asList(AllyBuff.class, Dread.class) )),
UNDEAD,
DEMONIC,
INORGANIC ( new HashSet<Class>(),

View File

@ -0,0 +1,48 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
//generic class for buffs which convert an enemy into an ally
// There is a decent amount of logic that ties into this, which is why it has its own abstract class
public abstract class AllyBuff extends Buff{
@Override
public boolean attachTo(Char target) {
if (super.attachTo(target)){
target.alignment = Char.Alignment.ALLY;
if (target.buff(PinCushion.class) != null){
target.buff(PinCushion.class).detach();
}
return true;
} else {
return false;
}
}
//for when applying an ally buff should also cause that enemy to give exp/loot as if they had died
//consider that chars with the ally alignment do not drop items or award exp on death
public static void affectAndLoot(Mob enemy, Hero hero, Class<?extends AllyBuff> buffCls){
boolean droppingLoot = enemy.alignment != Char.Alignment.ALLY;
Buff.affect(enemy, buffCls);
if (enemy.buff(buffCls) != null){
if (droppingLoot) enemy.rollToDropLoot();
Statistics.enemiesSlain++;
Badges.validateMonstersSlain();
Statistics.qualifiedForNoKilling = false;
if (enemy.EXP > 0 && hero.lvl <= enemy.maxLvl) {
hero.sprite.showStatus(CharSprite.POSITIVE, Messages.get(enemy, "exp", enemy.EXP));
hero.earnExp(enemy.EXP, enemy.getClass());
} else {
hero.earnExp(0, enemy.getClass());
}
}
}
}

View File

@ -91,7 +91,7 @@ public abstract class ChampionEnemy extends Buff {
}
{
immunities.add(Corruption.class);
immunities.add(AllyBuff.class);
}
public static void rollForChampion(Mob m){

View File

@ -26,7 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
public class Corruption extends Buff {
public class Corruption extends AllyBuff {
{
type = buffType.NEGATIVE;
@ -34,14 +34,15 @@ public class Corruption extends Buff {
}
private float buildToDamage = 0f;
@Override
public boolean attachTo(Char target) {
if (super.attachTo(target)){
target.alignment = Char.Alignment.ALLY;
return true;
} else {
return false;
//corrupted enemies are usually fully healed and cleansed of most debuffs
public static void corruptionHeal(Char target){
target.HP = target.HT;
for (Buff buff : target.buffs()) {
if (buff.type == Buff.buffType.NEGATIVE
&& !(buff instanceof SoulMark)) {
buff.detach();
}
}
}

View File

@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Electricity;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.BlobImmunity;
@ -158,7 +159,7 @@ public class SpiritHawk extends ArmorAbility {
attacksAutomatically = false;
immunities.addAll(new BlobImmunity().immunities());
immunities.add(Corruption.class);
immunities.add(AllyBuff.class);
}
@Override

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -150,7 +151,7 @@ public class ShadowClone extends ArmorAbility {
HP = HT = 100;
immunities.add(Corruption.class);
immunities.add(AllyBuff.class);
}
public ShadowAlly(){

View File

@ -24,9 +24,9 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.BeeSprite;
import com.watabou.utils.Bundle;
@ -126,7 +126,8 @@ public class Bee extends Mob {
@Override
public void add(Buff buff) {
super.add(buff);
if (buff instanceof Corruption){
//TODO maybe handle honeyed bees with their own ally buff?
if (buff instanceof AllyBuff){
intelligentAlly = false;
setPotInfo(-1, null);
}
@ -183,7 +184,7 @@ public class Bee extends Mob {
@Override
protected boolean getCloser(int target) {
if (alignment == Alignment.ALLY && enemy == null && buff(Corruption.class) == null){
if (alignment == Alignment.ALLY && enemy == null && buffs(AllyBuff.class).isEmpty()){
target = Dungeon.hero.pos;
} else if (enemy != null && Actor.findById(potHolder) == enemy) {
target = enemy.pos;
@ -194,7 +195,7 @@ public class Bee extends Mob {
@Override
public String description() {
if (alignment == Alignment.ALLY && buff(Corruption.class) == null){
if (alignment == Alignment.ALLY && buffs(AllyBuff.class).isEmpty()){
return Messages.get(this, "desc_honey");
} else {
return super.description();

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Dread;
@ -186,7 +187,7 @@ public class CrystalMimic extends Mimic {
@Override
protected void nowhereToRun() {
if (buff( Terror.class ) == null
&& buff( Corruption.class ) == null
&& buffs( AllyBuff.class ).isEmpty()
&& buff( Dread.class ) == null) {
if (enemySeen) {
sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Mob.class, "rage"));

View File

@ -24,9 +24,9 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
@ -165,8 +165,8 @@ public class Ghoul extends Mob {
protected synchronized void onRemove() {
if (beingLifeLinked) {
for (Buff buff : buffs()) {
//corruption, champion, and king damager are preserved when removed via life link
if (!(buff instanceof Corruption)
//ally buffs, champion, and king damager are preserved when removed via life link
if (!(buff instanceof AllyBuff)
&& (!(buff instanceof ChampionEnemy))
&& !(buff instanceof DwarfKing.KingDamager)) {
buff.detach();

View File

@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Adrenaline;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy;
@ -347,7 +348,7 @@ public abstract class Mob extends Char {
@Override
public void add( Buff buff ) {
super.add( buff );
if (buff instanceof Amok || buff instanceof Corruption) {
if (buff instanceof Amok || buff instanceof AllyBuff) {
state = HUNTING;
} else if (buff instanceof Terror || buff instanceof Dread) {
state = FLEEING;

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Adrenaline;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
@ -217,8 +218,8 @@ public class Necromancer extends Mob {
Dungeon.level.occupyCell( mySkeleton );
((NecromancerSprite)sprite).finishSummoning();
if (buff(Corruption.class) != null){
Buff.affect(mySkeleton, Corruption.class);
for (Buff b : buffs(AllyBuff.class)){
Buff.affect(mySkeleton, b.getClass());
}
for (Buff b : buffs(ChampionEnemy.class)){
Buff.affect( mySkeleton, b.getClass());

View File

@ -3,6 +3,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
@ -118,8 +119,8 @@ public class SpectralNecromancer extends Necromancer {
Dungeon.level.occupyCell( wraith );
((SpectralNecromancerSprite)sprite).finishSummoning();
if (buff(Corruption.class) != null){
Buff.affect(wraith, Corruption.class);
for (Buff b : buffs(AllyBuff.class)){
Buff.affect( wraith, b.getClass());
}
for (Buff b : buffs(ChampionEnemy.class)){
Buff.affect( wraith, b.getClass());

View File

@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy;
@ -128,8 +129,8 @@ public class Swarm extends Mob {
if (buff( Poison.class ) != null) {
Buff.affect( clone, Poison.class ).set(2);
}
if (buff(Corruption.class ) != null) {
Buff.affect( clone, Corruption.class);
for (Buff b : buffs(AllyBuff.class)){
Buff.affect( clone, b.getClass());
}
for (Buff b : buffs(ChampionEnemy.class)){
Buff.affect( clone, b.getClass());

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Dread;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
@ -199,7 +200,7 @@ public class Thief extends Mob {
protected void nowhereToRun() {
if (buff( Terror.class ) == null
&& buff( Dread.class ) == null
&& buff( Corruption.class ) == null) {
&& buffs( AllyBuff.class ).isEmpty() ) {
if (enemySeen) {
sprite.showStatus(CharSprite.NEGATIVE, Messages.get(Mob.class, "rage"));
state = HUNTING;

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
@ -187,7 +188,7 @@ public class MirrorImage extends NPC {
immunities.add( ToxicGas.class );
immunities.add( CorrosiveGas.class );
immunities.add( Burning.class );
immunities.add( Corruption.class );
immunities.add( AllyBuff.class );
}
public static class MirrorInvis extends Invisibility {

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
@ -249,7 +250,7 @@ public class PrismaticImage extends NPC {
immunities.add( ToxicGas.class );
immunities.add( CorrosiveGas.class );
immunities.add( Burning.class );
immunities.add( Corruption.class );
immunities.add( AllyBuff.class );
}
private class Wandering extends Mob.Wandering{

View File

@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
@ -809,7 +810,7 @@ public class DriedRose extends Artifact {
immunities.add( Burning.class );
immunities.add( ScrollOfRetribution.class );
immunities.add( ScrollOfPsionicBlast.class );
immunities.add( Corruption.class );
immunities.add( AllyBuff.class );
}
}

View File

@ -25,8 +25,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -66,7 +66,7 @@ public class PotionOfCleansing extends ExoticPotion {
public static void cleanse(Char ch){
for (Buff b : ch.buffs()){
if (b.type == Buff.buffType.NEGATIVE
&& !(b instanceof Corruption)
&& !(b instanceof AllyBuff)
&& !(b instanceof LostInventory)){
b.detach();
}

View File

@ -22,11 +22,10 @@
package com.shatteredpixel.shatteredpixeldungeon.items.wands;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
@ -46,7 +45,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow;
@ -66,7 +64,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@ -218,31 +215,9 @@ public class WandOfCorruption extends Wand {
}
if (!enemy.isImmune(Corruption.class)){
enemy.HP = enemy.HT;
for (Buff buff : enemy.buffs()) {
if (buff.type == Buff.buffType.NEGATIVE
&& !(buff instanceof SoulMark)) {
buff.detach();
} else if (buff instanceof PinCushion){
buff.detach();
}
}
Corruption.corruptionHeal(enemy);
boolean droppingLoot = enemy.alignment != Char.Alignment.ALLY;
Buff.affect(enemy, Corruption.class);
if (enemy.buff(Corruption.class) != null){
if (droppingLoot) enemy.rollToDropLoot();
Statistics.enemiesSlain++;
Badges.validateMonstersSlain();
Statistics.qualifiedForNoKilling = false;
if (enemy.EXP > 0 && curUser.lvl <= enemy.maxLvl) {
curUser.sprite.showStatus(CharSprite.POSITIVE, Messages.get(enemy, "exp", enemy.EXP));
curUser.earnExp(enemy.EXP, enemy.getClass());
} else {
curUser.earnExp(0, enemy.getClass());
}
}
AllyBuff.affectAndLoot(enemy, curUser, Corruption.class);
} else {
Buff.affect(enemy, Doom.class);
}

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
@ -350,7 +351,7 @@ public class WandOfLivingEarth extends DamageWand {
}
{
immunities.add( Corruption.class );
immunities.add( AllyBuff.class );
}
private static final String DEFENSE = "defense";

View File

@ -25,10 +25,17 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Doom;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Dread;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.mage.WildMagic;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC;
@ -451,8 +458,14 @@ public class WandOfRegrowth extends Wand {
}
{
immunities.add(Corruption.class);
immunities.add(Doom.class);
immunities.add( Paralysis.class );
immunities.add( Amok.class );
immunities.add( Sleep.class );
immunities.add( Terror.class );
immunities.add( Dread.class );
immunities.add( Vertigo.class );
immunities.add( AllyBuff.class );
immunities.add( Doom.class );
}
@Override

View File

@ -4,6 +4,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@ -400,7 +401,7 @@ public class WandOfWarding extends Wand {
}
{
immunities.add( Corruption.class );
immunities.add( AllyBuff.class );
}
private static final String TIER = "tier";

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion;
@ -58,31 +59,10 @@ public class Corrupting extends Weapon.Enchantment {
Mob enemy = (Mob) defender;
Hero hero = (attacker instanceof Hero) ? (Hero) attacker : Dungeon.hero;
enemy.HP = enemy.HT;
for (Buff buff : enemy.buffs()) {
if (buff.type == Buff.buffType.NEGATIVE
&& !(buff instanceof SoulMark)) {
buff.detach();
} else if (buff instanceof PinCushion){
buff.detach();
}
}
if (enemy.alignment == Char.Alignment.ENEMY){
enemy.rollToDropLoot();
}
Buff.affect(enemy, Corruption.class);
Statistics.enemiesSlain++;
Badges.validateMonstersSlain();
Statistics.qualifiedForNoKilling = false;
if (enemy.EXP > 0 && hero.lvl <= enemy.maxLvl) {
hero.sprite.showStatus(CharSprite.POSITIVE, Messages.get(enemy, "exp", enemy.EXP));
hero.earnExp(enemy.EXP, enemy.getClass());
} else {
hero.earnExp(0, enemy.getClass());
}
Corruption.corruptionHeal(enemy);
AllyBuff.affectAndLoot(enemy, hero, Corruption.class);
return 0;
}

View File

@ -243,7 +243,7 @@ abstract public class MissileWeapon extends Weapon {
decrementDurability();
if (durability > 0){
//attempt to stick the missile weapon to the enemy, just drop it if we can't.
if (sticky && enemy != null && enemy.isAlive() && enemy.buff(Corruption.class) == null){
if (sticky && enemy != null && enemy.isAlive() && enemy.alignment != Char.Alignment.ALLY){
PinCushion p = Buff.affect(enemy, PinCushion.class);
if (p.target == enemy){
p.stick(this);