v0.2.4: refactored dieing to glyphs, dieing to self-damage in a defence proc now properly supported.
This commit is contained in:
parent
1f50ce36b4
commit
bb28f2f477
|
@ -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)
|
||||
|
@ -141,10 +151,6 @@ public abstract class Char extends Actor {
|
|||
Camera.main.shake( GameMath.gate( 1, shake, 5), 0.3f );
|
||||
|
||||
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);
|
||||
|
@ -153,17 +159,10 @@ public abstract class Char extends Actor {
|
|||
|
||||
enemy.sprite.bloodBurstA( sprite.center(), effectiveDamage );
|
||||
enemy.sprite.flash();
|
||||
|
||||
|
||||
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 );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -372,8 +373,10 @@ 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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user