v2.0.1: fixed ranged enemy AI and projecting champ buff in some cases
This commit is contained in:
@@ -71,10 +71,11 @@ public class DM100 extends Mob implements Callback {
|
||||
public int drRoll() {
|
||||
return super.drRoll() + Random.NormalIntRange(0, 4);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
return new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos;
|
||||
return super.canAttack(enemy)
|
||||
|| new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos;
|
||||
}
|
||||
|
||||
//used so resistances can differentiate between melee and magical attacks
|
||||
@@ -83,7 +84,8 @@ public class DM100 extends Mob implements Callback {
|
||||
@Override
|
||||
protected boolean doAttack( Char enemy ) {
|
||||
|
||||
if (Dungeon.level.distance( pos, enemy.pos ) <= 1) {
|
||||
if (Dungeon.level.adjacent( pos, enemy.pos )
|
||||
|| new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos != enemy.pos) {
|
||||
|
||||
return super.doAttack( enemy );
|
||||
|
||||
|
||||
+6
-4
@@ -112,16 +112,18 @@ public abstract class Elemental extends Mob {
|
||||
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
if (rangedCooldown <= 0) {
|
||||
return new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT ).collisionPos == enemy.pos;
|
||||
if (super.canAttack(enemy)){
|
||||
return true;
|
||||
} else {
|
||||
return super.canAttack( enemy );
|
||||
return rangedCooldown < 0 && new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT ).collisionPos == enemy.pos;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean doAttack( Char enemy ) {
|
||||
|
||||
if (Dungeon.level.adjacent( pos, enemy.pos ) || rangedCooldown > 0) {
|
||||
if (Dungeon.level.adjacent( pos, enemy.pos )
|
||||
|| rangedCooldown > 0
|
||||
|| new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT ).collisionPos != enemy.pos) {
|
||||
|
||||
return super.doAttack( enemy );
|
||||
|
||||
|
||||
@@ -93,15 +93,18 @@ public class Eye extends Mob {
|
||||
if (beamCooldown == 0) {
|
||||
Ballistica aim = new Ballistica(pos, enemy.pos, Ballistica.STOP_SOLID);
|
||||
|
||||
if (enemy.invisible == 0 && !isCharmedBy(enemy) && fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){
|
||||
if (enemy.invisible == 0 && !isCharmedBy(enemy) && fieldOfView[enemy.pos]
|
||||
&& (super.canAttack(enemy) || aim.subPath(1, aim.dist).contains(enemy.pos))){
|
||||
beam = aim;
|
||||
beamTarget = aim.collisionPos;
|
||||
return true;
|
||||
} else
|
||||
} else {
|
||||
//if the beam is charged, it has to attack, will aim at previous location of target.
|
||||
return beamCharged;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
return super.canAttack(enemy);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,7 +125,8 @@ public class Eye extends Mob {
|
||||
@Override
|
||||
protected boolean doAttack( Char enemy ) {
|
||||
|
||||
if (beamCooldown > 0) {
|
||||
beam = new Ballistica(pos, enemy.pos, Ballistica.STOP_SOLID);
|
||||
if (beamCooldown > 0 || !beam.subPath(1, beam.dist).contains(enemy.pos)) {
|
||||
return super.doAttack(enemy);
|
||||
} else if (!beamCharged){
|
||||
((EyeSprite)sprite).charge( enemy.pos );
|
||||
@@ -133,7 +137,6 @@ public class Eye extends Mob {
|
||||
|
||||
spend( attackDelay() );
|
||||
|
||||
beam = new Ballistica(pos, beamTarget, Ballistica.STOP_SOLID);
|
||||
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[beam.collisionPos] ) {
|
||||
sprite.zap( beam.collisionPos );
|
||||
return false;
|
||||
|
||||
+2
-2
@@ -66,8 +66,8 @@ public class GnollTrickster extends Gnoll {
|
||||
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE);
|
||||
return !Dungeon.level.adjacent(pos, enemy.pos) && attack.collisionPos == enemy.pos;
|
||||
return !Dungeon.level.adjacent( pos, enemy.pos )
|
||||
&& (super.canAttack(enemy) || new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE).collisionPos == enemy.pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@ public class Scorpio extends Mob {
|
||||
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
Ballistica attack = new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE);
|
||||
return !Dungeon.level.adjacent( pos, enemy.pos ) && attack.collisionPos == enemy.pos;
|
||||
return !Dungeon.level.adjacent( pos, enemy.pos )
|
||||
&& (super.canAttack(enemy) || new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE).collisionPos == enemy.pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,10 +68,11 @@ public abstract class Shaman extends Mob {
|
||||
public int drRoll() {
|
||||
return super.drRoll() + Random.NormalIntRange(0, 6);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
return new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos;
|
||||
return super.canAttack(enemy)
|
||||
|| new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,8 +89,9 @@ public abstract class Shaman extends Mob {
|
||||
}
|
||||
|
||||
protected boolean doAttack(Char enemy ) {
|
||||
|
||||
if (Dungeon.level.adjacent( pos, enemy.pos )) {
|
||||
|
||||
if (Dungeon.level.adjacent( pos, enemy.pos )
|
||||
|| new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos != enemy.pos) {
|
||||
|
||||
return super.doAttack( enemy );
|
||||
|
||||
|
||||
+4
-2
@@ -77,12 +77,14 @@ public class Warlock extends Mob implements Callback {
|
||||
|
||||
@Override
|
||||
protected boolean canAttack( Char enemy ) {
|
||||
return new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos;
|
||||
return super.canAttack(enemy)
|
||||
|| new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos;
|
||||
}
|
||||
|
||||
protected boolean doAttack( Char enemy ) {
|
||||
|
||||
if (Dungeon.level.adjacent( pos, enemy.pos )) {
|
||||
if (Dungeon.level.adjacent( pos, enemy.pos )
|
||||
|| new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos != enemy.pos) {
|
||||
|
||||
return super.doAttack( enemy );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user