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;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
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.HornOfPlenty;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
|
@ -115,11 +116,32 @@ public class Hunger extends Buff implements Hero.Doom {
|
|||
}
|
||||
|
||||
public void satisfy( float energy ) {
|
||||
if (((Hero) target).subClass == HeroSubClass.WARLOCK)
|
||||
return;
|
||||
|
||||
Artifact.ArtifactBuff buff = target.buff( HornOfPlenty.hornRecharge.class );
|
||||
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.");
|
||||
}
|
||||
|
||||
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;
|
||||
if (level < 0) {
|
||||
level = 0;
|
||||
|
|
|
@ -121,10 +121,13 @@ public class Hero extends Char {
|
|||
|
||||
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_NEW_LEVEL =
|
||||
"Welcome to level %d! Now you are healthier and more focused. " +
|
||||
"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";
|
||||
|
||||
|
@ -1091,21 +1094,42 @@ public class Hero extends Char {
|
|||
|
||||
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;
|
||||
while (this.exp >= maxExp()) {
|
||||
this.exp -= maxExp();
|
||||
lvl++;
|
||||
if (lvl < MAX_LEVEL) {
|
||||
lvl++;
|
||||
levelUp = true;
|
||||
|
||||
HT += 5;
|
||||
HP += 5;
|
||||
attackSkill++;
|
||||
defenseSkill++;
|
||||
HT += 5;
|
||||
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) {
|
||||
updateAwareness();
|
||||
}
|
||||
|
||||
levelUp = true;
|
||||
}
|
||||
|
||||
if (levelUp) {
|
||||
|
@ -1116,17 +1140,6 @@ public class Hero extends Char {
|
|||
|
||||
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() {
|
||||
|
|
|
@ -67,7 +67,7 @@ public abstract class Mob extends Char {
|
|||
protected int defenseSkill = 0;
|
||||
|
||||
protected int EXP = 1;
|
||||
protected int maxLvl = 30;
|
||||
protected int maxLvl = Hero.MAX_LEVEL;
|
||||
|
||||
protected Char enemy;
|
||||
protected boolean enemySeen;
|
||||
|
|
|
@ -31,7 +31,7 @@ public class PotionOfExperience extends Potion {
|
|||
@Override
|
||||
public void apply( Hero hero ) {
|
||||
setKnown();
|
||||
hero.earnExp( hero.maxExp() - hero.exp );
|
||||
hero.earnExp( hero.maxExp() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user