Skip to content

Commit

Permalink
Wand of Darkness reworked, Wand of Damnation tweaked.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smujb committed Dec 6, 2020
1 parent cb196a6 commit 84943d3
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 53 deletions.
4 changes: 2 additions & 2 deletions core/src/main/assets/messages/items/items.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1485,8 +1485,8 @@ items.wands.wandofvoltage$charged.desc=The target is charged with electrical ene

items.wands.wandofdarkness.name=wand of darkness
items.wands.wandofdarkness.staff_name=staff of darkness
items.wands.wandofdarkness.desc=This wand is made of an ancient mossy stone that looks like it has seen better days. This does not prevent it's bolts from causing havoc however.
items.wands.wandofdarkness.stats_desc=This wand will create a cloud of darkness, that blocks vision and causes enemies to attack each other. The hero will also gain shielding increasing with the number of mobs in the gas. The gas does very little direct damage however.
items.wands.wandofdarkness.desc=This wand is made of an ancient mossy stone that looks like it has seen better days. This wand is abhorred by most surface-dwellers due to it tampering with the essence of life itself.
items.wands.wandofdarkness.stats_desc=This wand produces a cloud of dark gas that does minor damage to anything caught within it and gives them the _mind break_ debuff, causing them to resurrect as allies when killed... for a short time.
items.wands.wandofdarkness.equip_cursed=You are possessed by the darkness!

items.wands.wandofflow.name=wand of flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@
import com.shatteredpixel.yasd.general.Element;
import com.shatteredpixel.yasd.general.actors.Actor;
import com.shatteredpixel.yasd.general.actors.Char;
import com.shatteredpixel.yasd.general.actors.buffs.Aggression;
import com.shatteredpixel.yasd.general.actors.buffs.Barrier;
import com.shatteredpixel.yasd.general.actors.buffs.Buff;
import com.shatteredpixel.yasd.general.actors.hero.Hero;
import com.shatteredpixel.yasd.general.actors.mobs.Mob;
import com.shatteredpixel.yasd.general.actors.buffs.FlavourBuff;
import com.shatteredpixel.yasd.general.effects.BlobEmitter;
import com.shatteredpixel.yasd.general.effects.Speck;
import com.shatteredpixel.yasd.general.levels.Level;
import com.shatteredpixel.yasd.general.messages.Messages;
import com.shatteredpixel.yasd.general.ui.BuffIndicator;
import com.watabou.noosa.Image;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;

Expand All @@ -61,41 +60,10 @@ protected void evolve() {
for (int i = area.left; i < area.right; i++){
for (int j = area.top; j < area.bottom; j++){
cell = i + j*l.width();
l.pressCell(cell);
if (cur[cell] > 0 && (ch = Actor.findChar( cell )) != null) {
if (!ch.isImmune(this.getClass())) {
if (ch instanceof Hero) {
ch.damage(Random.Int(Math.max(1,strength/2), strength+2), new Char.DamageSrc(Element.SHADOW, this).ignoreDefense() );//Take some direct damage, cap scaling with max HP and never 0. Also prevents the hero standing in it for bonus shielding/sneakSkill without consequence
} else {
Buff.prolong(ch, Aggression.class, 3);
}

for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
if (l.distance(mob.pos, cell) < 6) {//All mobs within 5-tile radius are attracted to the location
mob.beckon(cell);
}
}

Char owner = (Char) Actor.findById(ownerID);
if (owner != null) {
int existingShield = 0;
Barrier barrier = owner.buff(Barrier.class);
if (barrier != null) {//Extend shield if possible
existingShield = barrier.shielding();
}
int shield = owner.HT / 30 + existingShield;
int healing = shield/3;
if (shield > strength/2 + 2 & healing > 0 & !(owner.HP >= owner.HT)) {//Converts some shielding to HP if it grows enough
healing = Math.min(owner.missingHP(),healing);
shield -= healing;
owner.sprite.emitter().burst( Speck.factory(Speck.HEALING), 4 );
owner.heal(healing);
}
shield = Math.min(shield,strength*2);//Caps at current strength * 2
if (shield > 1f) {//If it won't even last a turn, adding it is useless
Buff.affect(owner, Barrier.class).setShield(shield);
}
}
ch.damage(Random.Int(Math.max(1,strength/2), strength+2), new Char.DamageSrc(Element.SHADOW, this).ignoreDefense() );
Buff.affect(ch, MindBreak.class, 3);
}
}
}
Expand Down Expand Up @@ -145,4 +113,33 @@ public void storeInBundle( Bundle bundle) {
public String tileDesc() {
return Messages.get(this, "desc");
}

public static class MindBreak extends FlavourBuff {

{
type = buffType.NEGATIVE;
}

public static final float MOB_LIFETIME = 15f;

@Override
public int icon() {
return BuffIndicator.VERTIGO;
}

@Override
public void tintIcon(Image icon) {
icon.hardlight(1f, 0.8f, 0f);
}

@Override
public String toString() {
return Messages.get(this, "name");
}

@Override
public String desc() {
return Messages.get(this, "desc", dispTurns());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.shatteredpixel.yasd.general.actors.blobs.Miasma;
import com.shatteredpixel.yasd.general.effects.CellEmitter;
import com.shatteredpixel.yasd.general.effects.particles.ShadowParticle;
import com.shatteredpixel.yasd.general.items.weapon.enchantments.Grim;
import com.shatteredpixel.yasd.general.messages.Messages;
import com.shatteredpixel.yasd.general.scenes.GameScene;
import com.shatteredpixel.yasd.general.sprites.CharSprite;
Expand Down Expand Up @@ -83,9 +82,12 @@ public void recover(float amount) {
public void detach() {
super.detach();
GameScene.add(Blob.seed(target.pos, 100, Miasma.class));
if (!target.isImmune(Grim.class)) {
target.die(defaultSrc());
}
killTarget();
CellEmitter.get(target.pos).burst(ShadowParticle.UP, 20);
}

//Instantly kill the target regardless of resistances
protected void killTarget() {
target.die(defaultSrc());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import com.shatteredpixel.yasd.general.items.scrolls.ScrollOfRage;
import com.shatteredpixel.yasd.general.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.yasd.general.items.shield.RoundShield;
import com.shatteredpixel.yasd.general.items.wands.WandOfDarkness;
import com.shatteredpixel.yasd.general.items.wands.WandOfMagicMissile;
import com.shatteredpixel.yasd.general.items.wands.WandOfVoltage;
import com.shatteredpixel.yasd.general.items.weapon.SpiritBow;
Expand Down Expand Up @@ -189,6 +190,7 @@ public static void initTest(Hero hero) {
new MegaStick().identify().collect();
new DeveloperItem().collect();
new WandOfVoltage().identify().collect();
new WandOfDarkness().identify().collect();

for (Class<?> itemClass : Generator.Category.WEAPON.classes) {
Item item = (Item) Reflection.newInstance(itemClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.shatteredpixel.yasd.general.actors.Actor;
import com.shatteredpixel.yasd.general.actors.Char;
import com.shatteredpixel.yasd.general.actors.blobs.Blob;
import com.shatteredpixel.yasd.general.actors.blobs.DarkGas;
import com.shatteredpixel.yasd.general.actors.blobs.DemonGas;
import com.shatteredpixel.yasd.general.actors.buffs.Adrenaline;
import com.shatteredpixel.yasd.general.actors.buffs.Aggression;
Expand All @@ -44,6 +45,7 @@
import com.shatteredpixel.yasd.general.actors.buffs.Charm;
import com.shatteredpixel.yasd.general.actors.buffs.Corrosion;
import com.shatteredpixel.yasd.general.actors.buffs.Corruption;
import com.shatteredpixel.yasd.general.actors.buffs.DeferredDeath;
import com.shatteredpixel.yasd.general.actors.buffs.Hunger;
import com.shatteredpixel.yasd.general.actors.buffs.ParryBuff;
import com.shatteredpixel.yasd.general.actors.buffs.Sleep;
Expand Down Expand Up @@ -906,6 +908,16 @@ public void die( DamageSrc cause ) {
}
}

DarkGas.MindBreak mindBreak = buff(DarkGas.MindBreak.class);
if (mindBreak != null && !isImmune(Corruption.class)) {
mindBreak.detach();
updateHT(true);
HP = HT;
Buff.affect(this, DeferredDeath.class, DarkGas.MindBreak.MOB_LIFETIME);
Buff.affect(this, Corruption.class);
return;
}

super.die(cause);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@


import com.shatteredpixel.yasd.general.Assets;
import com.shatteredpixel.yasd.general.Element;
import com.shatteredpixel.yasd.general.actors.Actor;
import com.shatteredpixel.yasd.general.actors.Char;
import com.shatteredpixel.yasd.general.actors.buffs.Buff;
import com.shatteredpixel.yasd.general.actors.buffs.DeferredDeath;
import com.shatteredpixel.yasd.general.actors.mobs.Mob;
import com.shatteredpixel.yasd.general.effects.MagicMissile;
import com.shatteredpixel.yasd.general.items.weapon.enchantments.Grim;
import com.shatteredpixel.yasd.general.items.weapon.melee.MagesStaff;
import com.shatteredpixel.yasd.general.mechanics.Ballistica;
import com.shatteredpixel.yasd.general.sprites.ItemSpriteSheet;
Expand Down Expand Up @@ -100,4 +101,13 @@ public void staffFx(MagesStaff.StaffParticle particle) {
particle.setSize( 0.5f, 2f);
particle.shuffleXY(1f);
}

public static class DeferredDeath extends com.shatteredpixel.yasd.general.actors.buffs.DeferredDeath {

//Do not simply kill the target like the basic deferred death buff, spare anything immune to Grim.
@Override
protected void killTarget() {
target.damage(target.HP, new Char.DamageSrc(Element.SHADOW, new Grim()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,11 @@ public class WandOfDarkness extends Wand {
public void onZap(Ballistica bolt) {
float level = power();
int pos = bolt.collisionPos;
for( int i : PathFinder.NEIGHBOURS9) {
if (!Dungeon.level.solid(pos + i)) {
DarkGas gas = Blob.seed(pos + i, (int) (30 + 5 * level), DarkGas.class);
CellEmitter.center(bolt.collisionPos).burst(SmokeParticle.SPEW, 10 );
gas.setStrength(2 + (int)level);
gas.setOwner(curUser);
GameScene.add(gas);
}
}
DarkGas gas = Blob.seed(pos, (int) (30 + 5 * level), DarkGas.class);
CellEmitter.center(bolt.collisionPos).burst(SmokeParticle.SPEW, 10 );
gas.setStrength(2 + (int) level);
gas.setOwner(curUser);
GameScene.add(gas);


for (int i : PathFinder.NEIGHBOURS9) {
Expand Down

0 comments on commit 84943d3

Please sign in to comment.