v0.3.0: made some changes to EXP earning logic, reworked the warlock, added a level cap at level 30, buffed the potion of experience a bit.
This commit is contained in:
parent
ea35ab544b
commit
f844ee05d4
|
@ -18,15 +18,16 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
@ -113,20 +114,41 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void satisfy( float energy ) {
|
public void satisfy( float energy ) {
|
||||||
|
if (((Hero) target).subClass == HeroSubClass.WARLOCK)
|
||||||
|
return;
|
||||||
|
|
||||||
Artifact.ArtifactBuff buff = target.buff( HornOfPlenty.hornRecharge.class );
|
Artifact.ArtifactBuff buff = target.buff( HornOfPlenty.hornRecharge.class );
|
||||||
if (buff != null && buff.isCursed()){
|
if (buff != null && buff.isCursed()){
|
||||||
energy = Math.round(energy*0.67f);
|
energy *= 0.67f;
|
||||||
GLog.n("The cursed horn steals some of the food energy as you eat.");
|
GLog.n("The cursed horn steals some of the food energy as you eat.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reduceHunger( energy );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void consumeSoul( float energy ){
|
||||||
|
|
||||||
|
if (level >= STARVING)
|
||||||
|
energy *= 1.5f;
|
||||||
|
else if (level < HUNGRY)
|
||||||
|
energy *= 0.75f;
|
||||||
|
|
||||||
|
reduceHunger( energy );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reduceHunger( float energy ) {
|
||||||
|
if (Dungeon.isChallenged(Challenges.NO_FOOD))
|
||||||
|
return;
|
||||||
|
|
||||||
level -= energy;
|
level -= energy;
|
||||||
if (level < 0) {
|
if (level < 0) {
|
||||||
level = 0;
|
level = 0;
|
||||||
} else if (level > STARVING) {
|
} else if (level > STARVING) {
|
||||||
level = STARVING;
|
level = STARVING;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuffIndicator.refreshHero();
|
BuffIndicator.refreshHero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,10 +121,13 @@ public class Hero extends Char {
|
||||||
|
|
||||||
private static final String TXT_LEAVE = "One does not simply leave Pixel Dungeon.";
|
private static final String TXT_LEAVE = "One does not simply leave Pixel Dungeon.";
|
||||||
|
|
||||||
|
public static final int MAX_LEVEL = 30;
|
||||||
private static final String TXT_LEVEL_UP = "level up!";
|
private static final String TXT_LEVEL_UP = "level up!";
|
||||||
private static final String TXT_NEW_LEVEL =
|
private static final String TXT_NEW_LEVEL =
|
||||||
"Welcome to level %d! Now you are healthier and more focused. " +
|
"Welcome to level %d! Now you are healthier and more focused. " +
|
||||||
"It's easier for you to hit enemies and dodge their attacks.";
|
"It's easier for you to hit enemies and dodge their attacks.";
|
||||||
|
private static final String TXT_LEVEL_CAP =
|
||||||
|
"You can't gain any more levels, but your experiences still give you a burst of energy!";
|
||||||
|
|
||||||
public static final String TXT_YOU_NOW_HAVE = "You now have %s";
|
public static final String TXT_YOU_NOW_HAVE = "You now have %s";
|
||||||
|
|
||||||
|
@ -1090,22 +1093,43 @@ public class Hero extends Char {
|
||||||
public void earnExp( int exp ) {
|
public void earnExp( int exp ) {
|
||||||
|
|
||||||
this.exp += exp;
|
this.exp += exp;
|
||||||
|
|
||||||
|
if (subClass == HeroSubClass.WARLOCK) {
|
||||||
|
|
||||||
|
float percent = exp/(float)maxExp();
|
||||||
|
int healed = Math.round(Math.min(HT - HP, HT * percent * 0.3f));
|
||||||
|
if (healed > 0) {
|
||||||
|
HP += healed;
|
||||||
|
sprite.emitter().burst( Speck.factory( Speck.HEALING ), (int)(percent*10) );
|
||||||
|
}
|
||||||
|
|
||||||
|
(buff( Hunger.class )).consumeSoul( Hunger.STARVING*percent );
|
||||||
|
}
|
||||||
|
|
||||||
boolean levelUp = false;
|
boolean levelUp = false;
|
||||||
while (this.exp >= maxExp()) {
|
while (this.exp >= maxExp()) {
|
||||||
this.exp -= maxExp();
|
this.exp -= maxExp();
|
||||||
lvl++;
|
if (lvl < MAX_LEVEL) {
|
||||||
|
lvl++;
|
||||||
HT += 5;
|
levelUp = true;
|
||||||
HP += 5;
|
|
||||||
attackSkill++;
|
HT += 5;
|
||||||
defenseSkill++;
|
HP += 5;
|
||||||
|
attackSkill++;
|
||||||
|
defenseSkill++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//TODO: add blessed buff here
|
||||||
|
|
||||||
|
this.exp = 0;
|
||||||
|
|
||||||
|
GLog.p( "You cannot grow stronger, but your experiences do give you a surge of power!" );
|
||||||
|
//TODO: holy SFX
|
||||||
|
}
|
||||||
|
|
||||||
if (lvl < 10) {
|
if (lvl < 10) {
|
||||||
updateAwareness();
|
updateAwareness();
|
||||||
}
|
}
|
||||||
|
|
||||||
levelUp = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (levelUp) {
|
if (levelUp) {
|
||||||
|
@ -1116,17 +1140,6 @@ public class Hero extends Char {
|
||||||
|
|
||||||
Badges.validateLevelReached();
|
Badges.validateLevelReached();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subClass == HeroSubClass.WARLOCK) {
|
|
||||||
|
|
||||||
int value = Math.min( HT - HP, 1 + (Dungeon.depth - 1) / 5 );
|
|
||||||
if (value > 0) {
|
|
||||||
HP += value;
|
|
||||||
sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
((Hunger)buff( Hunger.class )).satisfy( 10 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int maxExp() {
|
public int maxExp() {
|
||||||
|
|
|
@ -67,7 +67,7 @@ public abstract class Mob extends Char {
|
||||||
protected int defenseSkill = 0;
|
protected int defenseSkill = 0;
|
||||||
|
|
||||||
protected int EXP = 1;
|
protected int EXP = 1;
|
||||||
protected int maxLvl = 30;
|
protected int maxLvl = Hero.MAX_LEVEL;
|
||||||
|
|
||||||
protected Char enemy;
|
protected Char enemy;
|
||||||
protected boolean enemySeen;
|
protected boolean enemySeen;
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class PotionOfExperience extends Potion {
|
||||||
@Override
|
@Override
|
||||||
public void apply( Hero hero ) {
|
public void apply( Hero hero ) {
|
||||||
setKnown();
|
setKnown();
|
||||||
hero.earnExp( hero.maxExp() - hero.exp );
|
hero.earnExp( hero.maxExp() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user