v2.0.0: fixed hold fast and earthroot working after moving with high spd
This commit is contained in:
+11
-1
@@ -22,10 +22,12 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
public class HoldFast extends Buff {
|
public class HoldFast extends Buff {
|
||||||
|
|
||||||
@@ -37,7 +39,6 @@ public class HoldFast extends Buff {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean act() {
|
public boolean act() {
|
||||||
if (pos == -1) pos = target.pos;
|
|
||||||
if (pos != target.pos) {
|
if (pos != target.pos) {
|
||||||
detach();
|
detach();
|
||||||
} else {
|
} else {
|
||||||
@@ -46,6 +47,15 @@ public class HoldFast extends Buff {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int armorBonus(){
|
||||||
|
if (pos == target.pos && target instanceof Hero){
|
||||||
|
return Random.NormalIntRange(0, 2* ((Hero) target).pointsInTalent(Talent.HOLD_FAST));
|
||||||
|
} else {
|
||||||
|
detach();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
return BuffIndicator.ARMOR;
|
return BuffIndicator.ARMOR;
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ public class Hero extends Char {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (buff(HoldFast.class) != null){
|
if (buff(HoldFast.class) != null){
|
||||||
dr += Random.NormalIntRange(0, 2*pointsInTalent(Talent.HOLD_FAST));
|
dr += buff(HoldFast.class).armorBonus();
|
||||||
}
|
}
|
||||||
|
|
||||||
return dr;
|
return dr;
|
||||||
@@ -1170,7 +1170,7 @@ public class Hero extends Char {
|
|||||||
public void rest( boolean fullRest ) {
|
public void rest( boolean fullRest ) {
|
||||||
spendAndNextConstant( TIME_TO_REST );
|
spendAndNextConstant( TIME_TO_REST );
|
||||||
if (hasTalent(Talent.HOLD_FAST)){
|
if (hasTalent(Talent.HOLD_FAST)){
|
||||||
Buff.affect(this, HoldFast.class);
|
Buff.affect(this, HoldFast.class).pos = pos;
|
||||||
}
|
}
|
||||||
if (!fullRest) {
|
if (!fullRest) {
|
||||||
if (sprite != null) {
|
if (sprite != null) {
|
||||||
|
|||||||
@@ -81,12 +81,6 @@ public class Earthroot extends Plant {
|
|||||||
announced = true;
|
announced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean attachTo( Char target ) {
|
|
||||||
pos = target.pos;
|
|
||||||
return super.attachTo( target );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean act() {
|
public boolean act() {
|
||||||
if (target.pos != pos) {
|
if (target.pos != pos) {
|
||||||
@@ -101,6 +95,10 @@ public class Earthroot extends Plant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int absorb( int damage ) {
|
public int absorb( int damage ) {
|
||||||
|
if (pos != target.pos){
|
||||||
|
detach();
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
int block = Math.min( damage, blocking());
|
int block = Math.min( damage, blocking());
|
||||||
if (level <= block) {
|
if (level <= block) {
|
||||||
detach();
|
detach();
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ public class Toolbar extends Component {
|
|||||||
&& Dungeon.hero.handle(Dungeon.hero.pos)){
|
&& Dungeon.hero.handle(Dungeon.hero.pos)){
|
||||||
//trigger hold fast here, even if the hero didn't specifically wait
|
//trigger hold fast here, even if the hero didn't specifically wait
|
||||||
if (Dungeon.hero.hasTalent(Talent.HOLD_FAST)){
|
if (Dungeon.hero.hasTalent(Talent.HOLD_FAST)){
|
||||||
Buff.affect(Dungeon.hero, HoldFast.class);
|
Buff.affect(Dungeon.hero, HoldFast.class).pos = Dungeon.hero.pos;
|
||||||
}
|
}
|
||||||
Dungeon.hero.next();
|
Dungeon.hero.next();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user