v2.0.0: fixed various bugs with charged shot and displacing darts
This commit is contained in:
+12
-6
@@ -141,7 +141,7 @@ public class Dart extends MissileWeapon {
|
|||||||
|
|
||||||
int dmg = super.proc(attacker, defender, damage);
|
int dmg = super.proc(attacker, defender, damage);
|
||||||
if (!processingChargedShot) {
|
if (!processingChargedShot) {
|
||||||
processChargedShot(defender.pos, damage);
|
processChargedShot(defender, damage);
|
||||||
}
|
}
|
||||||
return dmg;
|
return dmg;
|
||||||
}
|
}
|
||||||
@@ -155,17 +155,22 @@ public class Dart extends MissileWeapon {
|
|||||||
@Override
|
@Override
|
||||||
protected void onThrow(int cell) {
|
protected void onThrow(int cell) {
|
||||||
updateCrossbow();
|
updateCrossbow();
|
||||||
|
//we have to set this here, as on-hit effects can move the target we aim at
|
||||||
|
chargedShotPos = cell;
|
||||||
super.onThrow(cell);
|
super.onThrow(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean processingChargedShot = false;
|
private boolean processingChargedShot = false;
|
||||||
protected void processChargedShot( int cell, int dmg ){
|
private int chargedShotPos;
|
||||||
|
protected void processChargedShot( Char target, int dmg ){
|
||||||
//don't update xbow here, as dart may be the active weapon atm
|
//don't update xbow here, as dart may be the active weapon atm
|
||||||
processingChargedShot = true;
|
processingChargedShot = true;
|
||||||
if (bow != null && Dungeon.hero.buff(Crossbow.ChargedShot.class) != null) {
|
if (chargedShotPos != -1 && bow != null && Dungeon.hero.buff(Crossbow.ChargedShot.class) != null) {
|
||||||
PathFinder.buildDistanceMap(cell, Dungeon.level.passable, 1);
|
PathFinder.buildDistanceMap(chargedShotPos, Dungeon.level.passable, 1);
|
||||||
|
//necessary to clone as some on-hit effects use Pathfinder
|
||||||
|
int[] distance = PathFinder.distance.clone();
|
||||||
for (Char ch : Actor.chars()){
|
for (Char ch : Actor.chars()){
|
||||||
if (ch.pos == cell){
|
if (ch == target){
|
||||||
Actor.add(new Actor() {
|
Actor.add(new Actor() {
|
||||||
{ actPriority = VFX_PRIO; }
|
{ actPriority = VFX_PRIO; }
|
||||||
@Override
|
@Override
|
||||||
@@ -177,11 +182,12 @@ public class Dart extends MissileWeapon {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (PathFinder.distance[ch.pos] != Integer.MAX_VALUE){
|
} else if (distance[ch.pos] != Integer.MAX_VALUE){
|
||||||
proc(Dungeon.hero, ch, dmg);
|
proc(Dungeon.hero, ch, dmg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
chargedShotPos = -1;
|
||||||
processingChargedShot = false;
|
processingChargedShot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
|
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
@@ -91,10 +92,13 @@ public class DisplacingDart extends TippedDart {
|
|||||||
|
|
||||||
if (chosenPos != -1){
|
if (chosenPos != -1){
|
||||||
ScrollOfTeleportation.appear( defender, chosenPos );
|
ScrollOfTeleportation.appear( defender, chosenPos );
|
||||||
if (!Dungeon.level.heroFOV[chosenPos]){
|
Dungeon.level.occupyCell(defender );
|
||||||
|
if (defender == Dungeon.hero){
|
||||||
|
Dungeon.observe();
|
||||||
|
GameScene.updateFog();
|
||||||
|
} else if (!Dungeon.level.heroFOV[chosenPos]){
|
||||||
Buff.affect(attacker, TalismanOfForesight.CharAwareness.class, 5f).charID = defender.id();
|
Buff.affect(attacker, TalismanOfForesight.CharAwareness.class, 5f).charID = defender.id();
|
||||||
}
|
}
|
||||||
Dungeon.level.occupyCell(defender );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user