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

View File

@ -270,8 +270,12 @@ public abstract class Char extends Actor {
}
}
}
final public boolean attack( Char enemy ){
return attack(enemy, 1f, 0f, 1f);
}
public boolean attack( Char enemy ) {
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();
@ -316,6 +320,9 @@ public abstract class Char extends Actor {
} else {
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 ) {

View File

@ -282,63 +282,45 @@ public class Combo extends Buff implements ActionIndicator.Action {
private static ComboMove moveBeingUsed;
private void doAttack(final Char enemy){
private void doAttack(final Char enemy) {
AttackIndicator.target(enemy);
boolean wasAlly = enemy.alignment == target.alignment;
Hero hero = (Hero)target;
Hero hero = (Hero) target;
if (enemy.defenseSkill(target) >= Char.INFINITE_EVASION){
enemy.sprite.showStatus( CharSprite.NEUTRAL, enemy.defenseVerb() );
Sample.INSTANCE.play(Assets.Sounds.MISS);
float dmgMulti = 1f;
int dmgBonus = 0;
} else if (enemy.isInvulnerable(target.getClass())){
enemy.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Char.class, "invulnerable") );
Sample.INSTANCE.play(Assets.Sounds.MISS);
//variance in damage dealt
switch (moveBeingUsed) {
case CLOBBER:
dmgMulti = 0;
break;
case SLAM:
dmgBonus = Math.round(target.drRoll() * count / 5f);
break;
case CRUSH:
dmgMulti = 1f + (0.25f * count);
break;
case FURY:
dmgMulti = 0.6f;
break;
}
} else {
int dmg = target.damageRoll();
//variance in damage dealt
if (hero.attack(enemy, dmgMulti, dmgBonus, Char.INFINITE_ACCURACY)){
//special on-hit effects
switch (moveBeingUsed) {
case CLOBBER:
dmg = 0;
break;
case SLAM:
dmg += Math.round(target.drRoll() * count/5f);
break;
case CRUSH:
dmg = Math.round(dmg * 0.25f*count);
break;
case FURY:
dmg = Math.round(dmg * 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
switch (moveBeingUsed) {
case CLOBBER:
hit( enemy );
hit(enemy);
//trace a ballistica to our target (which will also extend past them
Ballistica trajectory = new Ballistica(target.pos, enemy.pos, Ballistica.STOP_TARGET);
//trim it to just be the part that goes past them
trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE);
//knock them back along that ballistica, ensuring they don't fall into a pit
int dist = 2;
if (enemy.isAlive() && count >= 7 && hero.pointsInTalent(Talent.ENHANCED_COMBO) >= 1){
dist ++;
if (enemy.isAlive() && count >= 7 && hero.pointsInTalent(Talent.ENHANCED_COMBO) >= 1) {
dist++;
Buff.prolong(enemy, Vertigo.class, 3);
} else if (!enemy.flying) {
while (dist > trajectory.dist ||
@ -349,26 +331,26 @@ public class Combo extends Buff implements ActionIndicator.Action {
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false);
break;
case PARRY:
hit( enemy );
hit(enemy);
break;
case CRUSH:
WandOfBlastWave.BlastWave.blast(enemy.pos);
PathFinder.buildDistanceMap(target.pos, BArray.not(Dungeon.level.solid, null), 3);
for (Char ch : Actor.chars()){
for (Char ch : Actor.chars()) {
if (ch != enemy && ch.alignment == Char.Alignment.ENEMY
&& PathFinder.distance[ch.pos] < Integer.MAX_VALUE){
int aoeHit = Math.round(target.damageRoll() * 0.25f*count);
&& PathFinder.distance[ch.pos] < Integer.MAX_VALUE) {
int aoeHit = Math.round(target.damageRoll() * 0.25f * count);
aoeHit /= 2;
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()) {
if (hero.hasTalent(Talent.LETHAL_DEFENSE) && hero.buff(BrokenSeal.WarriorShield.class) != null){
if (hero.hasTalent(Talent.LETHAL_DEFENSE) && hero.buff(BrokenSeal.WarriorShield.class) != null) {
BrokenSeal.WarriorShield shield = hero.buff(BrokenSeal.WarriorShield.class);
shield.supercharge(Math.round(shield.maxShield() * hero.pointsInTalent(Talent.LETHAL_DEFENSE)/3f));
shield.supercharge(Math.round(shield.maxShield() * hero.pointsInTalent(Talent.LETHAL_DEFENSE) / 3f));
}
}
}
@ -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();

View File

@ -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;
}