v0.2.4: refactored dieing to glyphs, dieing to self-damage in a defence proc now properly supported.

This commit is contained in:
Evan Debenham 2015-02-13 16:32:16 -05:00
parent 1f50ce36b4
commit bb28f2f477
3 changed files with 16 additions and 18 deletions

View File

@ -132,6 +132,16 @@ public abstract class Char extends Actor {
effectiveDamage = attackProc( enemy, effectiveDamage );
effectiveDamage = enemy.defenseProc( this, effectiveDamage );
if (visibleFight) {
Sample.INSTANCE.play( Assets.SND_HIT, 1, 1, Random.Float( 0.8f, 1.25f ) );
}
// If the enemy is already dead, interrupt the attack.
// This matters as defence procs can sometimes inflict self-damage, such as armor glyphs.
if (!enemy.isAlive()){
return true;
}
//TODO: consider revisiting this and shaking in more cases.
float shake = 0f;
if (enemy == Dungeon.hero)
@ -142,10 +152,6 @@ public abstract class Char extends Actor {
enemy.damage( effectiveDamage, this );
if (visibleFight) {
Sample.INSTANCE.play( Assets.SND_HIT, 1, 1, Random.Float( 0.8f, 1.25f ) );
}
if (buff(FireImbue.class) != null)
buff(FireImbue.class).proc(enemy);
if (buff(EarthImbue.class) != null)
@ -157,13 +163,6 @@ public abstract class Char extends Actor {
if (!enemy.isAlive() && visibleFight) {
if (enemy == Dungeon.hero) {
if (Dungeon.hero.killerGlyph != null) {
// FIXME
// Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, Dungeon.hero.killerGlyph.name(), Dungeon.depth ) );
// GLog.n( TXT_KILL, Dungeon.hero.killerGlyph.name() );
} else {
if ( this instanceof Yog ) {
Dungeon.fail( Utils.format( ResultDescriptions.NAMED, name) );
} if (Bestiary.isUnique( this )) {
@ -173,7 +172,6 @@ public abstract class Char extends Actor {
}
GLog.n( TXT_KILL, name );
}
} else {
GLog.i( TXT_DEFEAT, name, enemy.name );

View File

@ -61,7 +61,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
@ -155,8 +154,6 @@ public class Hero extends Char {
private Char enemy;
public Armor.Glyph killerGlyph = null;
private Item theKey;
public boolean restoreHealth = false;

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
@ -373,7 +374,9 @@ public class Armor extends EquipableItem {
public boolean checkOwner( Char owner ) {
if (!owner.isAlive() && owner instanceof Hero) {
((Hero)owner).killerGlyph = this;
Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, name() ) );
GLog.n( "%s killed you...", name() );
Badges.validateDeathFromGlyph();
return true;