v0.9.2: redesigned the freerunner's main ability

This commit is contained in:
Evan Debenham 2021-02-01 14:05:08 -05:00
parent be78ce9966
commit 46df3a1033
9 changed files with 118 additions and 35 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -224,8 +224,12 @@ actors.buffs.magicimmune.desc=All magical effects have lost their hold on you, y
actors.buffs.mindvision.name=Mind vision
actors.buffs.mindvision.desc=Somehow you are able to see all creatures on this floor through your mind. It's a weird feeling.\n\nAll characters on this floor are visible to you as long as you have mind vision. Seeing a creature through mind vision counts as it being seen or nearby for the purposes of many magical effects.\n\nTurns of mind vision remaining: %s.
actors.buffs.momentum.name=Momentum
actors.buffs.momentum.desc=As he moves, the freerunner builds momentum, increasing his speed and ability to dodge.\n\nThe speed bonus is based purely on momentum, however the bonus to dodge is also affected by armor.\n\nThe freerunner will gain additional dodge from momentum for each excess point of strength he has over the requirements of his armor.\n\nCurrent momentum power: %d%%.
actors.buffs.momentum.momentum=Building Momentum
actors.buffs.momentum.running=Freerunning
actors.buffs.momentum.resting=Recovering
actors.buffs.momentum.momentum_desc=As he moves, the freerunner builds momentum, which he can spend to start freerunning.\n\nEach charge of momentum grants two turns of freerunning, and the freerunner can build up to 10 charges. Momentum is rapidly lost when the freerunner stops moving.\n\nCurrent momentum charge: %d.
actors.buffs.momentum.running_desc=As he moves, the freerunner builds momentum, which he can spend to start freerunning.\n\nWhile freerunning, the freerunner moves at double speed and gains bonus evasion based on his level.\n\nTurns remaining: %d.
actors.buffs.momentum.resting_desc=As he moves, the freerunner builds momentum, which he can spend to start freerunning.\n\nThe freerunner needs time to regain his stamina before building momentum again.\n\nTurns remaining: %d.
actors.buffs.ooze.name=Caustic ooze
actors.buffs.ooze.heromsg=Caustic ooze eats your flesh. Wash it away!

View File

@ -35,7 +35,7 @@ public class Haste extends FlavourBuff {
@Override
public int icon() {
return BuffIndicator.MOMENTUM;
return BuffIndicator.HASTE;
}
@Override

View File

@ -21,48 +21,74 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
public class Momentum extends Buff {
public class Momentum extends Buff implements ActionIndicator.Action {
{
type = buffType.POSITIVE;
//acts before the hero
actPriority = HERO_PRIO+1;
}
private int stacks = 0;
private int turnsSinceMove = 0;
private int momentumStacks = 0;
private int freerunTurns = 0;
private int freerunCooldown = 0;
private boolean movedLastTurn = true;
@Override
public boolean act() {
turnsSinceMove++;
if (turnsSinceMove > 0){
stacks = Math.max(0, stacks - turnsSinceMove);
if (stacks == 0) detach();
if (freerunCooldown > 0){
freerunCooldown--;
}
if (freerunTurns > 0){
freerunTurns--;
} else if (!movedLastTurn){
momentumStacks = Math.min(momentumStacks -1, Math.round(momentumStacks * 0.667f));
if (momentumStacks <= 0) {
ActionIndicator.clearAction(this);
if (freerunCooldown <= 0) detach();
}
}
movedLastTurn = false;
spend(TICK);
return true;
}
public void gainStack(){
stacks = Math.min(stacks+1, 10);
turnsSinceMove = -1;
movedLastTurn = true;
if (freerunCooldown <= 0){
postpone(target.cooldown());
momentumStacks = Math.min(momentumStacks + 1, 10);
ActionIndicator.setAction(this);
}
}
public int stacks(){
return stacks;
public boolean freerunning(){
return freerunTurns > 0;
}
public float speedMultiplier(){
//1.33x speed at max stacks
return 1f + (stacks/30f);
return (freerunTurns > 0) ? 2 : 1;
}
public int evasionBonus( int excessArmorStr ){
//8 evasion, +2 evasion per excess str, at max stacks
return Math.round((0.8f + 0.2f*excessArmorStr) * stacks);
public int evasionBonus( int heroLvl, int excessArmorStr ){
if (freerunTurns > 0) {
return heroLvl / 2;
//TODO also grant bonuses based on excess str with talent
} else {
return 0;
}
}
@Override
@ -72,38 +98,88 @@ public class Momentum extends Buff {
@Override
public void tintIcon(Image icon) {
icon.invert();
if (freerunTurns > 0){
icon.hardlight(1,1,0);
} else if (freerunCooldown > 0){
icon.hardlight(0.5f,0.5f,1);
} else {
icon.hardlight(1f - (momentumStacks /10f),1,1f - (momentumStacks /10f));
}
}
@Override
public float iconFadePercent() {
return (10-stacks)/10f;
if (freerunTurns > 0){
return (20 - freerunTurns) / 20f;
} else if (freerunCooldown > 0){
return (freerunCooldown) / 50f;
} else {
return (10 - momentumStacks) / 10f;
}
}
@Override
public String toString() {
return Messages.get(this, "name");
if (freerunTurns > 0){
return Messages.get(this, "running");
} else if (freerunCooldown > 0){
return Messages.get(this, "resting");
} else {
return Messages.get(this, "momentum");
}
}
@Override
public String desc() {
return Messages.get(this, "desc", stacks*10);
if (freerunTurns > 0){
return Messages.get(this, "running_desc", freerunTurns);
} else if (freerunCooldown > 0){
return Messages.get(this, "resting_desc", freerunCooldown);
} else {
return Messages.get(this, "momentum_desc", momentumStacks);
}
}
private static final String STACKS = "stacks";
private static final String TURNS_SINCE = "turnsSinceMove";
private static final String FREERUN_TURNS = "freerun_turns";
private static final String FREERUN_CD = "freerun_CD";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(STACKS, stacks);
bundle.put(TURNS_SINCE, turnsSinceMove);
bundle.put(STACKS, momentumStacks);
bundle.put(FREERUN_TURNS, freerunTurns);
bundle.put(FREERUN_CD, freerunCooldown);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
stacks = bundle.getInt(STACKS);
turnsSinceMove = bundle.getInt(TURNS_SINCE);
momentumStacks = bundle.getInt(STACKS);
freerunTurns = bundle.getInt(FREERUN_TURNS);
freerunCooldown = bundle.getInt(FREERUN_CD);
if (momentumStacks > 0 && freerunTurns <= 0){
ActionIndicator.setAction(this);
}
movedLastTurn = false;
}
@Override
public Image getIcon() {
Image im = new Image(Assets.Interfaces.BUFFS_LARGE, 144, 32, 16, 16);
im.hardlight(0x99992E);
return im;
}
@Override
public void doAction() {
freerunTurns = 2*momentumStacks;
freerunCooldown = 50;
Sample.INSTANCE.play(Assets.Sounds.MISS, 1f, 0.8f);
target.sprite.emitter().burst(Speck.factory(Speck.JET), 5+ momentumStacks);
momentumStacks = 0;
BuffIndicator.refreshHero();
ActionIndicator.clearAction(this);
}
}

View File

@ -35,7 +35,7 @@ public class Stamina extends FlavourBuff {
@Override
public int icon() {
return BuffIndicator.MOMENTUM;
return BuffIndicator.HASTE;
}
@Override

View File

@ -484,9 +484,11 @@ public class Hero extends Char {
}
Momentum momentum = buff(Momentum.class);
if (momentum != null){
((HeroSprite)sprite).sprint( 1f + 0.05f*momentum.stacks());
if (momentum != null && momentum.freerunning()){
((HeroSprite)sprite).sprint( 1.5f );
speed *= momentum.speedMultiplier();
} else {
((HeroSprite)sprite).sprint( 1f );
}
return speed;

View File

@ -323,7 +323,7 @@ public class Armor extends EquipableItem {
Momentum momentum = owner.buff(Momentum.class);
if (momentum != null){
evasion += momentum.evasionBonus(Math.max(0, -aEnc));
evasion += momentum.evasionBonus(((Hero) owner).lvl, Math.max(0, -aEnc));
}
}

View File

@ -86,7 +86,7 @@ public class BuffIndicator extends Component {
public static final int RAGE = 38;
public static final int SACRIFICE = 39;
public static final int BERSERK = 40;
public static final int MOMENTUM = 41;
public static final int HASTE = 41;
public static final int PREPARATION = 42;
public static final int WELL_FED = 43;
public static final int HEALING = 44;
@ -96,6 +96,7 @@ public class BuffIndicator extends Component {
public static final int DEGRADE = 48;
public static final int PINCUSHION = 49;
public static final int UPGRADE = 50;
public static final int MOMENTUM = 51;
public static final int SIZE = 7;