v0.3.0: added wand of corruption
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
/**
|
||||
* Created by Evan on 14/05/2015.
|
||||
*/
|
||||
public class Corruption extends Buff {
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
//TODO: need to bundle this
|
||||
private float buildToDamage = 0f;
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
buildToDamage += target.HT/100f;
|
||||
|
||||
int damage = (int)buildToDamage;
|
||||
buildToDamage -= damage;
|
||||
|
||||
if (damage > 0)
|
||||
target.damage(damage, this);
|
||||
|
||||
spend(TICK);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add( CharSprite.State.DARKENED );
|
||||
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.DARKENED );
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: new icon
|
||||
public int icon() {
|
||||
return BuffIndicator.POISON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Corrupted";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "Corruption seeps into the essence of a being, twisting them against their former nature.\n" +
|
||||
"\n" +
|
||||
"Corrupted creatures will attack and aggravate their allies, and ignore their former enemies. " +
|
||||
"Corruption is damaging as well, and will slowly cause its target to succumb.\n" +
|
||||
"\n" +
|
||||
"Corruption is permanent, its effects only end in death.";
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
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.Sleep;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
@@ -173,10 +174,10 @@ public abstract class Mob extends Char {
|
||||
}
|
||||
|
||||
//resets target if: the target is dead, the target has been lost (wandering)
|
||||
//or if the mob is amoked and targeting the hero (will try to target something else)
|
||||
//or if the mob is amoked/corrupted and targeting the hero (will try to target something else)
|
||||
if ( enemy != null &&
|
||||
!enemy.isAlive() || state == WANDERING ||
|
||||
(buff( Amok.class ) != null && enemy == Dungeon.hero ))
|
||||
((buff( Amok.class ) != null || buff(Corruption.class) != null) && enemy == Dungeon.hero ))
|
||||
enemy = null;
|
||||
|
||||
//if there is no current target, find a new one.
|
||||
@@ -184,8 +185,8 @@ public abstract class Mob extends Char {
|
||||
|
||||
HashSet<Char> enemies = new HashSet<Char>();
|
||||
|
||||
//if the mob is amoked...
|
||||
if ( buff(Amok.class) != null ) {
|
||||
//if the mob is amoked or corrupted...
|
||||
if ( buff(Amok.class) != null || buff(Corruption.class) != null) {
|
||||
|
||||
//try to find an enemy mob to attack first.
|
||||
for (Mob mob : Dungeon.level.mobs)
|
||||
@@ -199,8 +200,9 @@ public abstract class Mob extends Char {
|
||||
enemies.add(mob);
|
||||
if (enemies.size() > 0) return Random.element(enemies);
|
||||
|
||||
//if there is nothing, go for the hero.
|
||||
return Dungeon.hero;
|
||||
//if there is nothing, go for the hero, unless corrupted, then go for nothing.
|
||||
if (buff(Corruption.class) != null) return null;
|
||||
else return Dungeon.hero;
|
||||
|
||||
//if the mob is not amoked...
|
||||
} else {
|
||||
@@ -359,6 +361,14 @@ public abstract class Mob extends Char {
|
||||
Surprise.hit(this);
|
||||
}
|
||||
}
|
||||
|
||||
//become aggro'd by a corrupted enemy
|
||||
if (enemy.buff(Corruption.class) != null) {
|
||||
aggro(enemy);
|
||||
target = enemy.pos;
|
||||
state = HUNTING;
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user