v0.6.2: reworked the freerunner subclass

This commit is contained in:
Evan Debenham 2017-09-10 02:32:39 -04:00
parent f8244d013e
commit 6cda24e6ed
7 changed files with 140 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,106 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2017 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
import com.watabou.utils.Bundle;
public class Momentum extends Buff {
private int stacks = 0;
private int turnsSinceMove = 0;
@Override
public boolean act() {
turnsSinceMove++;
if (turnsSinceMove > 0){
stacks = Math.max(0, stacks - turnsSinceMove);
BuffIndicator.refreshHero();
if (stacks == 0) detach();
}
spend(TICK);
return true;
}
public void gainStack(){
stacks = Math.min(stacks+1, 10);
turnsSinceMove = -1;
BuffIndicator.refreshHero();
}
public int stacks(){
return stacks;
}
public float speedMultiplier(){
//1.33x speed at max stacks
return 1f + (stacks/30f);
}
public int evasionBonus( int excessArmorStr ){
//10 evasion, +2.5 evasion per excess str, at max stacks
return Math.round((1f + 0.25f*excessArmorStr) * stacks);
}
@Override
public int icon() {
return BuffIndicator.MOMENTUM;
}
@Override
public void tintIcon(Image icon) {
if (stacks <= 5) {
icon.hardlight(0.2f * (stacks - 1), 1f, 0f);
} else {
icon.hardlight(1f, 1f - 0.2f*(stacks - 6), 0f);
}
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc", stacks*10);
}
private static final String STACKS = "stacks";
private static final String TURNS_SINCE = "turnsSinceMove";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(STACKS, stacks);
bundle.put(TURNS_SINCE, turnsSinceMove);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
stacks = bundle.getInt(STACKS);
turnsSinceMove = bundle.getInt(TURNS_SINCE);
}
}

View File

@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Fury;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SnipersMark; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SnipersMark;
@ -314,16 +315,19 @@ public class Hero extends Char {
int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 10 - STR(); int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 10 - STR();
if (aEnc > 0) { if (aEnc > 0) {
return (int)(defenseSkill * evasion / Math.pow( 1.5, aEnc )); evasion /= Math.pow( 1.5, aEnc );
} else {
int bonus = 0;
if (belongings.armor != null && belongings.armor.hasGlyph(Swiftness.class))
bonus += 5 + belongings.armor.level()*1.5f;
return Math.round((defenseSkill + bonus) * evasion);
} }
int bonus = 0;
if (belongings.armor != null && belongings.armor.hasGlyph(Swiftness.class))
bonus += 5 + belongings.armor.level()*1.5f;
Momentum momentum = buff(Momentum.class);
if (momentum != null){
bonus += momentum.evasionBonus(Math.max(0, -aEnc));
}
return Math.round((defenseSkill + bonus) * evasion);
} }
@Override @Override
@ -381,19 +385,16 @@ public class Hero extends Char {
} }
int aEnc = armor != null ? armor.STRReq() - STR() : 0; int aEnc = armor != null ? armor.STRReq() - STR() : 0;
if (aEnc > 0) { if (aEnc > 0) speed /= Math.pow( 1.2, aEnc );
return (float)(speed / Math.pow( 1.2, aEnc )); Momentum momentum = buff(Momentum.class);
if (momentum != null){
} else { ((HeroSprite)sprite).sprint( 1f + 0.05f*momentum.stacks());
speed *= momentum.speedMultiplier();
return ((HeroSprite)sprite).sprint( subClass == HeroSubClass.FREERUNNER && !isStarving() ) ?
invisible > 0 ?
2f * speed :
1.5f * speed :
speed;
} }
return speed;
} }
public boolean canSurpriseAttack(){ public boolean canSurpriseAttack(){
@ -1100,6 +1101,10 @@ public class Hero extends Char {
spend( moveTime / speed() ); spend( moveTime / speed() );
search(false); search(false);
if (subClass == HeroSubClass.FREERUNNER){
Buff.affect(this, Momentum.class).gainStack();
}
//FIXME this is a fairly sloppy fix for a crash involving pitfall traps. //FIXME this is a fairly sloppy fix for a crash involving pitfall traps.
//really there should be a way for traps to specify whether action should continue or //really there should be a way for traps to specify whether action should continue or

View File

@ -142,9 +142,8 @@ public class HeroSprite extends CharSprite {
super.update(); super.update();
} }
public boolean sprint( boolean on ) { public void sprint( float speed ) {
run.delay = on ? 0.667f / RUN_FRAMERATE : 1f / RUN_FRAMERATE; run.delay = 1f / speed / RUN_FRAMERATE;
return on;
} }
public static TextureFilm tiers() { public static TextureFilm tiers() {

View File

@ -84,6 +84,8 @@ public class BuffIndicator extends Component {
public static final int RAGE = 38; public static final int RAGE = 38;
public static final int SACRIFICE = 39; public static final int SACRIFICE = 39;
public static final int BERSERK = 40; public static final int BERSERK = 40;
public static final int MOMENTUM = 41;
public static final int PREPARATION = 42;
public static final int SIZE = 7; public static final int SIZE = 7;

View File

@ -153,6 +153,9 @@ actors.buffs.magicalsleep.desc=This character has fallen into a deep magical sle
actors.buffs.mindvision.name=Mind vision 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.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.ooze.name=Caustic ooze actors.buffs.ooze.name=Caustic ooze
actors.buffs.ooze.heromsg=Caustic ooze eats your flesh. Wash it away! actors.buffs.ooze.heromsg=Caustic ooze eats your flesh. Wash it away!
actors.buffs.ooze.ondeath=You melt away... actors.buffs.ooze.ondeath=You melt away...
@ -261,7 +264,7 @@ actors.hero.herosubclass.battlemage_desc=When fighting with his staff, the _Batt
actors.hero.herosubclass.assassin=assassin actors.hero.herosubclass.assassin=assassin
actors.hero.herosubclass.assassin_desc=When performing a surprise attack, the _Assassin_ inflicts additional damage to his target. actors.hero.herosubclass.assassin_desc=When performing a surprise attack, the _Assassin_ inflicts additional damage to his target.
actors.hero.herosubclass.freerunner=freerunner actors.hero.herosubclass.freerunner=freerunner
actors.hero.herosubclass.freerunner_desc=The _Freerunner_ moves faster when he unencumbered and not starving, if he is invisible, this speed boost is increased. actors.hero.herosubclass.freerunner_desc=The _Freerunner_ builds momentum as he runs. Momentum increases his movement speed and evasion, but it quickly fades when he isn't moving.
actors.hero.herosubclass.sniper=sniper actors.hero.herosubclass.sniper=sniper
actors.hero.herosubclass.sniper_desc=The _Sniper_ is able to detect weak points in an enemy's armor, effectively ignoring it when using a missile weapon. actors.hero.herosubclass.sniper_desc=The _Sniper_ is able to detect weak points in an enemy's armor, effectively ignoring it when using a missile weapon.
actors.hero.herosubclass.warden=warden actors.hero.herosubclass.warden=warden