v0.8.2d: tweaked logic when charm is applied in some cases

This commit is contained in:
Evan Debenham 2020-08-29 18:56:39 -04:00
parent 49ed3e4f8b
commit a53a90bba9
4 changed files with 19 additions and 5 deletions

View File

@ -74,8 +74,14 @@ public class Charm extends FlavourBuff {
public String desc() { public String desc() {
return Messages.get(this, "desc", dispTurns()); return Messages.get(this, "desc", dispTurns());
} }
public boolean ignoreNextHit = false;
public void recover() { public void recover() {
if (ignoreNextHit){
ignoreNextHit = false;
return;
}
spend(-5f); spend(-5f);
if (cooldown() <= 0){ if (cooldown() <= 0){
detach(); detach();

View File

@ -70,7 +70,13 @@ public class Terror extends FlavourBuff {
return Messages.get(this, "desc", dispTurns()); return Messages.get(this, "desc", dispTurns());
} }
public boolean ignoreNextHit = false;
public void recover() { public void recover() {
if (ignoreNextHit){
ignoreNextHit = false;
return;
}
spend(-5f); spend(-5f);
if (cooldown() <= 0){ if (cooldown() <= 0){
detach(); detach();

View File

@ -86,8 +86,9 @@ public class Succubus extends Mob {
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 2 ); sprite.emitter().burst( Speck.factory( Speck.HEALING ), 2 );
Sample.INSTANCE.play( Assets.Sounds.CHARMS ); Sample.INSTANCE.play( Assets.Sounds.CHARMS );
} else if (Random.Int( 3 ) == 0) { } else if (Random.Int( 3 ) == 0) {
//attack will reduce by 5 turns, so effectively DURATION-5 turns Charm c = Buff.affect( enemy, Charm.class, Charm.DURATION/2f );
Buff.affect( enemy, Charm.class, Charm.DURATION ).object = id(); c.object = id();
c.ignoreNextHit = true; //so that the -5 duration from succubus hit is ignored
enemy.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 ); enemy.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
Sample.INSTANCE.play( Assets.Sounds.CHARMS ); Sample.INSTANCE.play( Assets.Sounds.CHARMS );
} }

View File

@ -41,8 +41,9 @@ public class Friendly extends Weapon.Enchantment {
Buff.affect( attacker, Charm.class, Charm.DURATION ).object = defender.id(); Buff.affect( attacker, Charm.class, Charm.DURATION ).object = defender.id();
attacker.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 ); attacker.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
//5 turns will be reduced by the attack, so effectively lasts for Charm.DURATION-5 turns Charm c = Buff.affect( defender, Charm.class, Charm.DURATION/2 );
Buff.affect( defender, Charm.class, Charm.DURATION ).object = attacker.id(); c.ignoreNextHit = true;
c.object = attacker.id();
defender.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 ); defender.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
} }