v2.1.0: ascension challenge now increases HT, instead of reducing DMG
This commit is contained in:
@@ -649,7 +649,6 @@ public abstract class Char extends Actor {
|
||||
for (ChampionEnemy buff : buffs(ChampionEnemy.class)){
|
||||
dmg = (int) Math.ceil(dmg * buff.damageTakenFactor());
|
||||
}
|
||||
dmg = (int)Math.ceil(dmg / AscensionChallenge.statModifier(this));
|
||||
|
||||
if (!(src instanceof LifeLink) && buff(LifeLink.class) != null){
|
||||
HashSet<LifeLink> links = buffs(LifeLink.class);
|
||||
|
||||
@@ -76,7 +76,7 @@ public class AscensionChallenge extends Buff {
|
||||
}
|
||||
|
||||
public static float statModifier(Char ch){
|
||||
if (Dungeon.hero.buff(AscensionChallenge.class) == null){
|
||||
if (Dungeon.hero == null || Dungeon.hero.buff(AscensionChallenge.class) == null){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
@@ -76,7 +77,7 @@ public class ArmoredBrute extends Brute {
|
||||
return true;
|
||||
}
|
||||
|
||||
absorbDamage( 1 );
|
||||
absorbDamage( Math.round(AscensionChallenge.statModifier(target)) );
|
||||
|
||||
if (shielding() <= 0){
|
||||
target.die(null);
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ShieldBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
|
||||
@@ -128,7 +129,7 @@ public class Brute extends Mob {
|
||||
return true;
|
||||
}
|
||||
|
||||
absorbDamage( 4 );
|
||||
absorbDamage( Math.round(4*AscensionChallenge.statModifier(target)));
|
||||
|
||||
if (shielding() <= 0){
|
||||
target.die(null);
|
||||
|
||||
@@ -126,7 +126,18 @@ public abstract class Mob extends Char {
|
||||
protected boolean alerted = false;
|
||||
|
||||
protected static final float TIME_TO_WAKE_UP = 1f;
|
||||
|
||||
|
||||
protected boolean firstAdded = true;
|
||||
protected void onAdd(){
|
||||
if (firstAdded) {
|
||||
//modify health for ascension challenge if applicable, only on first add
|
||||
float percent = HP / (float) HT;
|
||||
HT = Math.round(HT * AscensionChallenge.statModifier(this));
|
||||
HP = Math.round(HT * percent);
|
||||
firstAdded = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String STATE = "state";
|
||||
private static final String SEEN = "seen";
|
||||
private static final String TARGET = "target";
|
||||
@@ -186,6 +197,9 @@ public abstract class Mob extends Char {
|
||||
if (bundle.contains(ENEMY_ID)) {
|
||||
enemyID = bundle.getInt(ENEMY_ID);
|
||||
}
|
||||
|
||||
//no need to actually save this, must be false
|
||||
firstAdded = false;
|
||||
}
|
||||
|
||||
//mobs need to remember their targets after every actor is added
|
||||
|
||||
@@ -162,7 +162,7 @@ public class Necromancer extends Mob {
|
||||
sprite.parent.add(new Beam.HealthRay(sprite.center(), mySkeleton.sprite.center()));
|
||||
}
|
||||
|
||||
mySkeleton.HP = Math.min(mySkeleton.HP + 5, mySkeleton.HT);
|
||||
mySkeleton.HP = Math.min(mySkeleton.HP + mySkeleton.HT/5, mySkeleton.HT);
|
||||
if (mySkeleton.sprite.visible) mySkeleton.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
|
||||
//otherwise give it adrenaline
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||
@@ -56,10 +57,13 @@ public class Slime extends Mob {
|
||||
|
||||
@Override
|
||||
public void damage(int dmg, Object src) {
|
||||
if (dmg >= 5){
|
||||
float scaleFactor = AscensionChallenge.statModifier(this);
|
||||
int scaledDmg = Math.round(dmg/scaleFactor);
|
||||
if (scaledDmg >= 5){
|
||||
//takes 5/6/7/8/9/10 dmg at 5/7/10/14/19/25 incoming dmg
|
||||
dmg = 4 + (int)(Math.sqrt(8*(dmg - 4) + 1) - 1)/2;
|
||||
scaledDmg = 4 + (int)(Math.sqrt(8*(scaledDmg - 4) + 1) - 1)/2;
|
||||
}
|
||||
dmg = (int)(scaledDmg*AscensionChallenge.statModifier(this));
|
||||
super.damage(dmg, src);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,10 +84,7 @@ public class Swarm extends Mob {
|
||||
@Override
|
||||
public int defenseProc( Char enemy, int damage ) {
|
||||
|
||||
//accounting for reduced damage on ascension
|
||||
int effectiveDmg = (int)Math.ceil(damage / AscensionChallenge.statModifier(this));
|
||||
|
||||
if (HP >= effectiveDmg + 2) {
|
||||
if (HP >= damage + 2) {
|
||||
ArrayList<Integer> candidates = new ArrayList<>();
|
||||
|
||||
int[] neighbours = {pos + 1, pos - 1, pos + Dungeon.level.width(), pos - Dungeon.level.width()};
|
||||
@@ -103,11 +100,11 @@ public class Swarm extends Mob {
|
||||
if (candidates.size() > 0) {
|
||||
|
||||
Swarm clone = split();
|
||||
clone.HP = (HP - effectiveDmg) / 2;
|
||||
clone.pos = Random.element( candidates );
|
||||
clone.state = clone.HUNTING;
|
||||
GameScene.add( clone, SPLIT_DELAY ); //we add before assigning HP due to ascension
|
||||
|
||||
GameScene.add( clone, SPLIT_DELAY );
|
||||
clone.HP = (HP - damage) / 2;
|
||||
Actor.addDelayed( new Pushing( clone, pos, clone.pos ), -1 );
|
||||
|
||||
Dungeon.level.occupyCell(clone);
|
||||
|
||||
@@ -78,7 +78,7 @@ public class RatKing extends NPC {
|
||||
@Override
|
||||
protected void onAdd() {
|
||||
super.onAdd();
|
||||
if (Dungeon.depth != 5){
|
||||
if (firstAdded && Dungeon.depth != 5){
|
||||
yell(Messages.get(this, "confused"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user