v0.6.1: reworked the HP mechanics on right of might
This commit is contained in:
parent
42a37ec1ac
commit
8fe920ff17
|
@ -161,6 +161,8 @@ public class Hero extends Char {
|
||||||
public int lvl = 1;
|
public int lvl = 1;
|
||||||
public int exp = 0;
|
public int exp = 0;
|
||||||
|
|
||||||
|
public int HTBoost = 0;
|
||||||
|
|
||||||
private ArrayList<Mob> visibleEnemies;
|
private ArrayList<Mob> visibleEnemies;
|
||||||
|
|
||||||
//This list is maintained so that some logic checks can be skipped
|
//This list is maintained so that some logic checks can be skipped
|
||||||
|
@ -179,6 +181,19 @@ public class Hero extends Char {
|
||||||
|
|
||||||
visibleEnemies = new ArrayList<Mob>();
|
visibleEnemies = new ArrayList<Mob>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateHT( boolean boostHP ){
|
||||||
|
int curHT = HT;
|
||||||
|
|
||||||
|
HT = 20 + 5*(lvl-1) + HTBoost;
|
||||||
|
float multiplier = RingOfMight.HTMultiplier(this);
|
||||||
|
HT = Math.round(multiplier * HT);
|
||||||
|
|
||||||
|
if (boostHP){
|
||||||
|
HP += Math.max(HT - curHT, 0);
|
||||||
|
}
|
||||||
|
HP = Math.min(HP, HT);
|
||||||
|
}
|
||||||
|
|
||||||
public int STR() {
|
public int STR() {
|
||||||
int STR = this.STR;
|
int STR = this.STR;
|
||||||
|
@ -193,6 +208,7 @@ public class Hero extends Char {
|
||||||
private static final String STRENGTH = "STR";
|
private static final String STRENGTH = "STR";
|
||||||
private static final String LEVEL = "lvl";
|
private static final String LEVEL = "lvl";
|
||||||
private static final String EXPERIENCE = "exp";
|
private static final String EXPERIENCE = "exp";
|
||||||
|
private static final String HTBOOST = "htboost";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle( Bundle bundle ) {
|
public void storeInBundle( Bundle bundle ) {
|
||||||
|
@ -209,6 +225,8 @@ public class Hero extends Char {
|
||||||
|
|
||||||
bundle.put( LEVEL, lvl );
|
bundle.put( LEVEL, lvl );
|
||||||
bundle.put( EXPERIENCE, exp );
|
bundle.put( EXPERIENCE, exp );
|
||||||
|
|
||||||
|
bundle.put( HTBOOST, HTBoost );
|
||||||
|
|
||||||
belongings.storeInBundle( bundle );
|
belongings.storeInBundle( bundle );
|
||||||
}
|
}
|
||||||
|
@ -229,6 +247,8 @@ public class Hero extends Char {
|
||||||
lvl = bundle.getInt( LEVEL );
|
lvl = bundle.getInt( LEVEL );
|
||||||
exp = bundle.getInt( EXPERIENCE );
|
exp = bundle.getInt( EXPERIENCE );
|
||||||
|
|
||||||
|
HTBoost = bundle.getInt(HTBOOST);
|
||||||
|
|
||||||
belongings.restoreFromBundle( bundle );
|
belongings.restoreFromBundle( bundle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,8 +1211,7 @@ public class Hero extends Char {
|
||||||
lvl++;
|
lvl++;
|
||||||
levelUp = true;
|
levelUp = true;
|
||||||
|
|
||||||
HT += 5;
|
updateHT( true );
|
||||||
HP += 5;
|
|
||||||
attackSkill++;
|
attackSkill++;
|
||||||
defenseSkill++;
|
defenseSkill++;
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ public class PotionOfMight extends Potion {
|
||||||
setKnown();
|
setKnown();
|
||||||
|
|
||||||
hero.STR++;
|
hero.STR++;
|
||||||
hero.HT += 5;
|
hero.HTBoost += 5;
|
||||||
hero.HP += 5;
|
hero.updateHT( true );
|
||||||
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "msg_1") );
|
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "msg_1") );
|
||||||
GLog.p( Messages.get(this, "msg_2") );
|
GLog.p( Messages.get(this, "msg_2") );
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,7 @@ public class RingOfMight extends Ring {
|
||||||
@Override
|
@Override
|
||||||
public boolean doEquip(Hero hero) {
|
public boolean doEquip(Hero hero) {
|
||||||
if (super.doEquip(hero)){
|
if (super.doEquip(hero)){
|
||||||
hero.HT += level()*5;
|
hero.updateHT( false );
|
||||||
hero.HP = Math.min(hero.HP, hero.HT);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -41,34 +40,30 @@ public class RingOfMight extends Ring {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
|
public boolean doUnequip(Hero hero, boolean collect, boolean single) {
|
||||||
|
|
||||||
if (super.doUnequip(hero, collect, single)){
|
if (super.doUnequip(hero, collect, single)){
|
||||||
hero.HT -= level()*5;
|
hero.updateHT( false );
|
||||||
hero.HP = Math.min(hero.HP, hero.HT);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item upgrade() {
|
public Item upgrade() {
|
||||||
if (buff != null && buff.target != null){
|
super.upgrade();
|
||||||
buff.target.HT += 5;
|
updateTargetHT();
|
||||||
}
|
return this;
|
||||||
return super.upgrade();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void level(int value) {
|
public void level(int value) {
|
||||||
if (buff != null && buff.target != null){
|
|
||||||
buff.target.HT -= level()*5;
|
|
||||||
}
|
|
||||||
super.level(value);
|
super.level(value);
|
||||||
if (buff != null && buff.target != null){
|
updateTargetHT();
|
||||||
buff.target.HT += level()*5;
|
}
|
||||||
buff.target.HP = Math.min(buff.target.HP, buff.target.HT);
|
|
||||||
|
private void updateTargetHT(){
|
||||||
|
if (buff != null && buff.target instanceof Hero){
|
||||||
|
((Hero) buff.target).updateHT( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +75,10 @@ public class RingOfMight extends Ring {
|
||||||
public static int strengthBonus( Char target ){
|
public static int strengthBonus( Char target ){
|
||||||
return getBonus( target, Might.class );
|
return getBonus( target, Might.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float HTMultiplier( Char target ){
|
||||||
|
return (float)Math.pow(1.035, getBonus(target, Might.class));
|
||||||
|
}
|
||||||
|
|
||||||
public class Might extends RingBuff {
|
public class Might extends RingBuff {
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class ScrollOfRemoveCurse extends InventoryScroll {
|
||||||
|
|
||||||
if (procced) {
|
if (procced) {
|
||||||
hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 );
|
hero.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 );
|
||||||
|
hero.updateHT( false ); //for ring of might
|
||||||
}
|
}
|
||||||
|
|
||||||
return procced;
|
return procced;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user