v0.9.3: refactored Combo to tie into Char.attack
This commit is contained in:
@@ -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;
|
if (enemy == null) return false;
|
||||||
|
|
||||||
@@ -287,7 +291,7 @@ public abstract class Char extends Actor {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else if (hit( this, enemy, false )) {
|
} else if (hit( this, enemy, accMulti )) {
|
||||||
|
|
||||||
int dr = enemy.drRoll();
|
int dr = enemy.drRoll();
|
||||||
|
|
||||||
@@ -316,6 +320,9 @@ public abstract class Char extends Actor {
|
|||||||
} else {
|
} else {
|
||||||
dmg = damageRoll();
|
dmg = damageRoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dmg = Math.round(dmg*dmgMulti);
|
||||||
|
dmg += dmgBonus;
|
||||||
|
|
||||||
int effectiveDamage = enemy.defenseProc( this, dmg );
|
int effectiveDamage = enemy.defenseProc( this, dmg );
|
||||||
effectiveDamage = Math.max( effectiveDamage - dr, 0 );
|
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_ACCURACY = 1_000_000;
|
||||||
public static int INFINITE_EVASION = 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 acuStat = attacker.attackSkill( defender );
|
||||||
float defStat = defender.defenseSkill( attacker );
|
float defStat = defender.defenseSkill( attacker );
|
||||||
|
|
||||||
@@ -418,7 +429,7 @@ public abstract class Char extends Actor {
|
|||||||
defRoll *= buff.evasionAndAccuracyFactor();
|
defRoll *= buff.evasionAndAccuracyFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (magic ? acuRoll * 2 : acuRoll) >= defRoll;
|
return (acuRoll * accMulti) >= defRoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int attackSkill( Char target ) {
|
public int attackSkill( Char target ) {
|
||||||
|
|||||||
+31
-62
@@ -282,63 +282,45 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
|||||||
|
|
||||||
private static ComboMove moveBeingUsed;
|
private static ComboMove moveBeingUsed;
|
||||||
|
|
||||||
private void doAttack(final Char enemy){
|
private void doAttack(final Char enemy) {
|
||||||
|
|
||||||
AttackIndicator.target(enemy);
|
AttackIndicator.target(enemy);
|
||||||
|
|
||||||
boolean wasAlly = enemy.alignment == target.alignment;
|
boolean wasAlly = enemy.alignment == target.alignment;
|
||||||
Hero hero = (Hero)target;
|
Hero hero = (Hero) target;
|
||||||
|
|
||||||
if (enemy.defenseSkill(target) >= Char.INFINITE_EVASION){
|
float dmgMulti = 1f;
|
||||||
enemy.sprite.showStatus( CharSprite.NEUTRAL, enemy.defenseVerb() );
|
int dmgBonus = 0;
|
||||||
Sample.INSTANCE.play(Assets.Sounds.MISS);
|
|
||||||
|
|
||||||
} else if (enemy.isInvulnerable(target.getClass())){
|
//variance in damage dealt
|
||||||
enemy.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Char.class, "invulnerable") );
|
switch (moveBeingUsed) {
|
||||||
Sample.INSTANCE.play(Assets.Sounds.MISS);
|
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 {
|
if (hero.attack(enemy, dmgMulti, dmgBonus, Char.INFINITE_ACCURACY)){
|
||||||
|
//special on-hit effects
|
||||||
int dmg = target.damageRoll();
|
|
||||||
|
|
||||||
//variance in damage dealt
|
|
||||||
switch (moveBeingUsed) {
|
switch (moveBeingUsed) {
|
||||||
case CLOBBER:
|
case CLOBBER:
|
||||||
dmg = 0;
|
hit(enemy);
|
||||||
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 );
|
|
||||||
//trace a ballistica to our target (which will also extend past them
|
//trace a ballistica to our target (which will also extend past them
|
||||||
Ballistica trajectory = new Ballistica(target.pos, enemy.pos, Ballistica.STOP_TARGET);
|
Ballistica trajectory = new Ballistica(target.pos, enemy.pos, Ballistica.STOP_TARGET);
|
||||||
//trim it to just be the part that goes past them
|
//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);
|
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
|
//knock them back along that ballistica, ensuring they don't fall into a pit
|
||||||
int dist = 2;
|
int dist = 2;
|
||||||
if (enemy.isAlive() && count >= 7 && hero.pointsInTalent(Talent.ENHANCED_COMBO) >= 1){
|
if (enemy.isAlive() && count >= 7 && hero.pointsInTalent(Talent.ENHANCED_COMBO) >= 1) {
|
||||||
dist ++;
|
dist++;
|
||||||
Buff.prolong(enemy, Vertigo.class, 3);
|
Buff.prolong(enemy, Vertigo.class, 3);
|
||||||
} else if (!enemy.flying) {
|
} else if (!enemy.flying) {
|
||||||
while (dist > trajectory.dist ||
|
while (dist > trajectory.dist ||
|
||||||
@@ -349,26 +331,26 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
|||||||
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false);
|
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false);
|
||||||
break;
|
break;
|
||||||
case PARRY:
|
case PARRY:
|
||||||
hit( enemy );
|
hit(enemy);
|
||||||
break;
|
break;
|
||||||
case CRUSH:
|
case CRUSH:
|
||||||
WandOfBlastWave.BlastWave.blast(enemy.pos);
|
WandOfBlastWave.BlastWave.blast(enemy.pos);
|
||||||
PathFinder.buildDistanceMap(target.pos, BArray.not(Dungeon.level.solid, null), 3);
|
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
|
if (ch != enemy && ch.alignment == Char.Alignment.ENEMY
|
||||||
&& PathFinder.distance[ch.pos] < Integer.MAX_VALUE){
|
&& PathFinder.distance[ch.pos] < Integer.MAX_VALUE) {
|
||||||
int aoeHit = Math.round(target.damageRoll() * 0.25f*count);
|
int aoeHit = Math.round(target.damageRoll() * 0.25f * count);
|
||||||
aoeHit /= 2;
|
aoeHit /= 2;
|
||||||
aoeHit -= ch.drRoll();
|
aoeHit -= ch.drRoll();
|
||||||
if (ch.buff(Vulnerable.class) != null) aoeHit *= 1.33f;
|
if (ch.buff(Vulnerable.class) != null) aoeHit *= 1.33f;
|
||||||
ch.damage(aoeHit, target);
|
ch.damage(aoeHit, target);
|
||||||
ch.sprite.bloodBurstA(target.sprite.center(), dmg);
|
ch.sprite.bloodBurstA(target.sprite.center(), aoeHit);
|
||||||
ch.sprite.flash();
|
ch.sprite.flash();
|
||||||
|
|
||||||
if (!ch.isAlive()) {
|
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);
|
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
|
//nothing
|
||||||
break;
|
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();
|
Invisibility.dispel();
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ public class Goo extends Mob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean attack( Char enemy ) {
|
public boolean attack( Char enemy, float dmgMulti, float dmgBonus, float accMulti ) {
|
||||||
boolean result = super.attack( enemy );
|
boolean result = super.attack( enemy, dmgMulti, dmgBonus, accMulti );
|
||||||
pumpedUp = 0;
|
pumpedUp = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user