v0.9.3: refactored Combo to tie into Char.attack

This commit is contained in:
Evan Debenham
2021-05-05 20:57:17 -04:00
parent 05651b37fa
commit 720f6a6590
3 changed files with 48 additions and 68 deletions
@@ -271,7 +271,11 @@ public abstract class Char extends Actor {
}
}
public boolean attack( Char enemy ) {
final public boolean attack( Char enemy ){
return attack(enemy, 1f, 0f, 1f);
}
public boolean attack( Char enemy, float dmgMulti, float dmgBonus, float accMulti ) {
if (enemy == null) return false;
@@ -287,7 +291,7 @@ public abstract class Char extends Actor {
return false;
} else if (hit( this, enemy, false )) {
} else if (hit( this, enemy, accMulti )) {
int dr = enemy.drRoll();
@@ -317,6 +321,9 @@ public abstract class Char extends Actor {
dmg = damageRoll();
}
dmg = Math.round(dmg*dmgMulti);
dmg += dmgBonus;
int effectiveDamage = enemy.defenseProc( this, dmg );
effectiveDamage = Math.max( effectiveDamage - dr, 0 );
@@ -392,7 +399,11 @@ public abstract class Char extends Actor {
public static int INFINITE_ACCURACY = 1_000_000;
public static int INFINITE_EVASION = 1_000_000;
public static boolean hit( Char attacker, Char defender, boolean magic ) {
final public static boolean hit( Char attacker, Char defender, boolean magic ) {
return hit(attacker, defender, magic ? 2f : 1f);
}
public static boolean hit( Char attacker, Char defender, float accMulti ) {
float acuStat = attacker.attackSkill( defender );
float defStat = defender.defenseSkill( attacker );
@@ -418,7 +429,7 @@ public abstract class Char extends Actor {
defRoll *= buff.evasionAndAccuracyFactor();
}
return (magic ? acuRoll * 2 : acuRoll) >= defRoll;
return (acuRoll * accMulti) >= defRoll;
}
public int attackSkill( Char target ) {
@@ -289,45 +289,27 @@ public class Combo extends Buff implements ActionIndicator.Action {
boolean wasAlly = enemy.alignment == target.alignment;
Hero hero = (Hero) target;
if (enemy.defenseSkill(target) >= Char.INFINITE_EVASION){
enemy.sprite.showStatus( CharSprite.NEUTRAL, enemy.defenseVerb() );
Sample.INSTANCE.play(Assets.Sounds.MISS);
} else if (enemy.isInvulnerable(target.getClass())){
enemy.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Char.class, "invulnerable") );
Sample.INSTANCE.play(Assets.Sounds.MISS);
} else {
int dmg = target.damageRoll();
float dmgMulti = 1f;
int dmgBonus = 0;
//variance in damage dealt
switch (moveBeingUsed) {
case CLOBBER:
dmg = 0;
dmgMulti = 0;
break;
case SLAM:
dmg += Math.round(target.drRoll() * count/5f);
dmgBonus = Math.round(target.drRoll() * count / 5f);
break;
case CRUSH:
dmg = Math.round(dmg * 0.25f*count);
dmgMulti = 1f + (0.25f * count);
break;
case FURY:
dmg = Math.round(dmg * 0.6f);
dmgMulti = 0.6f;
break;
}
dmg = enemy.defenseProc(target, dmg);
dmg -= enemy.drRoll();
if (enemy.buff(Vulnerable.class) != null) {
dmg *= 1.33f;
}
dmg = target.attackProc(enemy, dmg);
enemy.damage(dmg, target);
//special effects
if (hero.attack(enemy, dmgMulti, dmgBonus, Char.INFINITE_ACCURACY)){
//special on-hit effects
switch (moveBeingUsed) {
case CLOBBER:
hit(enemy);
@@ -362,7 +344,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
aoeHit -= ch.drRoll();
if (ch.buff(Vulnerable.class) != null) aoeHit *= 1.33f;
ch.damage(aoeHit, target);
ch.sprite.bloodBurstA(target.sprite.center(), dmg);
ch.sprite.bloodBurstA(target.sprite.center(), aoeHit);
ch.sprite.flash();
if (!ch.isAlive()) {
@@ -378,19 +360,6 @@ public class Combo extends Buff implements ActionIndicator.Action {
//nothing
break;
}
if (target.buff(FireImbue.class) != null) target.buff(FireImbue.class).proc(enemy);
if (target.buff(FrostImbue.class) != null) target.buff(FrostImbue.class).proc(enemy);
target.hitSound(Random.Float(0.87f, 1.15f));
if (moveBeingUsed != ComboMove.FURY) Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
enemy.sprite.bloodBurstA(target.sprite.center(), dmg);
enemy.sprite.flash();
if (!enemy.isAlive()) {
GLog.i(Messages.capitalize(Messages.get(Char.class, "defeat", enemy.name())));
}
}
Invisibility.dispel();
@@ -206,8 +206,8 @@ public class Goo extends Mob {
}
@Override
public boolean attack( Char enemy ) {
boolean result = super.attack( enemy );
public boolean attack( Char enemy, float dmgMulti, float dmgBonus, float accMulti ) {
boolean result = super.attack( enemy, dmgMulti, dmgBonus, accMulti );
pumpedUp = 0;
return result;
}