v2.0.0: fixed enchant and lethal haste errors with xbow
This commit is contained in:
+1
-1
@@ -211,7 +211,7 @@ public class MeleeWeapon extends Weapon {
|
||||
}
|
||||
}
|
||||
|
||||
protected void onAbilityKill( Hero hero ){
|
||||
public void onAbilityKill( Hero hero ){
|
||||
if (hero.hasTalent(Talent.LETHAL_HASTE)){
|
||||
//effectively 1/2 turns of haste
|
||||
Buff.prolong(hero, Haste.class, 0.67f+hero.pointsInTalent(Talent.LETHAL_HASTE));
|
||||
|
||||
+29
-5
@@ -139,7 +139,11 @@ public class Dart extends MissileWeapon {
|
||||
damage = bow.proc(attacker, defender, damage);
|
||||
}
|
||||
|
||||
return super.proc(attacker, defender, damage);
|
||||
int dmg = super.proc(attacker, defender, damage);
|
||||
if (!processingChargedShot) {
|
||||
processChargedShot(defender.pos, damage);
|
||||
}
|
||||
return dmg;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,19 +156,39 @@ public class Dart extends MissileWeapon {
|
||||
protected void onThrow(int cell) {
|
||||
updateCrossbow();
|
||||
super.onThrow(cell);
|
||||
processChargedShot(cell);
|
||||
}
|
||||
|
||||
protected void processChargedShot( int cell ){
|
||||
private boolean processingChargedShot = false;
|
||||
protected void processChargedShot( int cell, int dmg ){
|
||||
//don't update xbow here, as dart may be the active weapon atm
|
||||
processingChargedShot = true;
|
||||
if (bow != null && Dungeon.hero.buff(Crossbow.ChargedShot.class) != null) {
|
||||
PathFinder.buildDistanceMap(cell, Dungeon.level.passable, 1);
|
||||
for (Char ch : Actor.chars()){
|
||||
if (PathFinder.distance[ch.pos] != Integer.MAX_VALUE){
|
||||
proc(Dungeon.hero, ch, 0);
|
||||
if (ch.pos == cell){
|
||||
Actor.add(new Actor() {
|
||||
{ actPriority = VFX_PRIO; }
|
||||
@Override
|
||||
protected boolean act() {
|
||||
if (!ch.isAlive()){
|
||||
bow.onAbilityKill(Dungeon.hero);
|
||||
}
|
||||
Actor.remove(this);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} else if (PathFinder.distance[ch.pos] != Integer.MAX_VALUE){
|
||||
proc(Dungeon.hero, ch, dmg);
|
||||
}
|
||||
}
|
||||
}
|
||||
processingChargedShot = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decrementDurability() {
|
||||
super.decrementDurability();
|
||||
if (Dungeon.hero.buff(Crossbow.ChargedShot.class) != null) {
|
||||
Dungeon.hero.buff(Crossbow.ChargedShot.class).detach();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Crossbow;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
@@ -46,7 +47,6 @@ public class IncendiaryDart extends TippedDart {
|
||||
if (durability > 0){
|
||||
super.onThrow(cell);
|
||||
} else {
|
||||
processChargedShot(cell);
|
||||
Dungeon.level.drop(new Dart(), cell).sprite.drop();
|
||||
}
|
||||
} else{
|
||||
|
||||
Reference in New Issue
Block a user