v2.1.3: improved code for regeneration pause effects
This commit is contained in:
@@ -147,8 +147,7 @@ public class Berserk extends Buff implements ActionIndicator.Action {
|
||||
detach();
|
||||
}
|
||||
}
|
||||
} else if (state == State.RECOVERING && levelRecovery == 0
|
||||
&& (target.buff(LockedFloor.class) == null || target.buff(LockedFloor.class).regenOn())){
|
||||
} else if (state == State.RECOVERING && levelRecovery == 0 && Regeneration.regenOn()){
|
||||
turnRecovery--;
|
||||
if (turnRecovery <= 0){
|
||||
turnRecovery = 0;
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.journal.Guidebook;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfChallenge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.MiningLevel;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
@@ -67,7 +68,9 @@ public class Hunger extends Buff implements Hero.Doom {
|
||||
if (Dungeon.level.locked
|
||||
|| target.buff(WellFed.class) != null
|
||||
|| SPDSettings.intro()
|
||||
|| target.buff(ScrollOfChallenge.ChallengeArena.class) != null){
|
||||
|| target.buff(ScrollOfChallenge.ChallengeArena.class) != null
|
||||
//this is mainly for the current test sub-level
|
||||
|| Dungeon.level instanceof MiningLevel){
|
||||
spend(STEP);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
|
||||
public void gainEnergy(Mob enemy ){
|
||||
if (target == null) return;
|
||||
|
||||
if (target.buff(LockedFloor.class) != null && !target.buff(LockedFloor.class).regenOn()){
|
||||
if (!Regeneration.regenOn()){
|
||||
return; //to prevent farming boss minions
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class PrismaticGuard extends Buff {
|
||||
}
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (HP < maxHP() && (lock == null || lock.regenOn())){
|
||||
if (HP < maxHP() && Regeneration.regenOn()){
|
||||
HP += 0.1f;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.MiningLevel;
|
||||
|
||||
public class Regeneration extends Buff {
|
||||
|
||||
@@ -41,8 +42,7 @@ public class Regeneration extends Buff {
|
||||
if (target.isAlive()) {
|
||||
|
||||
if (target.HP < regencap() && !((Hero)target).isStarving()) {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (lock == null || lock.regenOn()) {
|
||||
if (regenOn()) {
|
||||
target.HP += 1;
|
||||
if (target.HP == regencap()) {
|
||||
((Hero) target).resting = false;
|
||||
@@ -76,4 +76,15 @@ public class Regeneration extends Buff {
|
||||
public int regencap(){
|
||||
return target.HT;
|
||||
}
|
||||
|
||||
public static boolean regenOn(){
|
||||
LockedFloor lock = Dungeon.hero.buff(LockedFloor.class);
|
||||
if (lock != null && !lock.regenOn()){
|
||||
return false;
|
||||
}
|
||||
if (Dungeon.level instanceof MiningLevel){
|
||||
return false; //this is mainly for the current test sub-level
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
@@ -303,8 +303,7 @@ abstract public class ClassArmor extends Armor {
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (lock == null || lock.regenOn()) {
|
||||
if (Regeneration.regenOn()) {
|
||||
float chargeGain = 100 / 500f; //500 turns to full charge
|
||||
chargeGain *= RingOfEnergy.armorChargeMultiplier(target);
|
||||
charge += chargeGain;
|
||||
|
||||
@@ -26,9 +26,9 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Preparation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
@@ -226,8 +226,7 @@ public class CloakOfShadows extends Artifact {
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (charge < chargeCap && !cursed && target.buff(MagicImmune.class) == null) {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (activeBuff == null && (lock == null || lock.regenOn())) {
|
||||
if (activeBuff == null && Regeneration.regenOn()) {
|
||||
float missing = (chargeCap - charge);
|
||||
if (level() > 7) missing += 5*(level() - 7)/3f;
|
||||
float turnsToCharge = (45 - missing);
|
||||
|
||||
@@ -32,8 +32,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
@@ -397,8 +397,7 @@ public class DriedRose extends Artifact {
|
||||
if (ghost != null && !cursed && target.buff(MagicImmune.class) == null){
|
||||
|
||||
//heals to full over 500 turns
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (ghost.HP < ghost.HT && (lock == null || lock.regenOn())) {
|
||||
if (ghost.HP < ghost.HT && Regeneration.regenOn()) {
|
||||
partialCharge += (ghost.HT / 500f) * RingOfEnergy.artifactChargeMultiplier(target);
|
||||
updateQuickslot();
|
||||
|
||||
@@ -413,11 +412,10 @@ public class DriedRose extends Artifact {
|
||||
return true;
|
||||
}
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.regenOn())) {
|
||||
&& Regeneration.regenOn()) {
|
||||
//500 turns to a full charge
|
||||
partialCharge += (1/5f * RingOfEnergy.artifactChargeMultiplier(target));
|
||||
if (partialCharge > 1){
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Chains;
|
||||
@@ -305,11 +305,10 @@ public class EtherealChains extends Artifact {
|
||||
@Override
|
||||
public boolean act() {
|
||||
int chargeTarget = 5+(level()*2);
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeTarget
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.regenOn())) {
|
||||
&& Regeneration.regenOn()) {
|
||||
//gains a charge in 40 - 2*missingCharge turns
|
||||
float chargeGain = (1 / (40f - (chargeTarget - charge)*2f));
|
||||
chargeGain *= RingOfEnergy.artifactChargeMultiplier(target);
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
|
||||
@@ -311,8 +311,7 @@ public class LloydsBeacon extends Artifact {
|
||||
public class beaconRecharge extends ArtifactBuff{
|
||||
@Override
|
||||
public boolean act() {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) {
|
||||
if (charge < chargeCap && !cursed && Regeneration.regenOn()) {
|
||||
partialCharge += 1 / (100f - (chargeCap - charge)*10f);
|
||||
|
||||
if (partialCharge >= 1) {
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell;
|
||||
@@ -314,11 +314,10 @@ public class TalismanOfForesight extends Artifact {
|
||||
warn = false;
|
||||
}
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.regenOn())) {
|
||||
&& Regeneration.regenOn()) {
|
||||
//fully charges in 2000 turns at +0, scaling to 1000 turns at +10.
|
||||
float chargeGain = (0.05f+(level()*0.005f));
|
||||
chargeGain *= RingOfEnergy.artifactChargeMultiplier(target);
|
||||
|
||||
@@ -27,8 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
@@ -232,11 +232,10 @@ public class TimekeepersHourglass extends Artifact {
|
||||
@Override
|
||||
public boolean act() {
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.regenOn())) {
|
||||
&& Regeneration.regenOn()) {
|
||||
//90 turns to charge at full, 60 turns to charge at 0/10
|
||||
float chargeGain = 1 / (90f - (chargeCap - charge)*3f);
|
||||
chargeGain *= RingOfEnergy.artifactChargeMultiplier(target);
|
||||
|
||||
@@ -25,8 +25,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||
@@ -288,11 +288,10 @@ public class UnstableSpellbook extends Artifact {
|
||||
public class bookRecharge extends ArtifactBuff{
|
||||
@Override
|
||||
public boolean act() {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.regenOn())) {
|
||||
&& Regeneration.regenOn()) {
|
||||
//120 turns to charge at full, 80 turns to charge at 0/8
|
||||
float chargeGain = 1 / (120f - (chargeCap - charge)*5f);
|
||||
chargeGain *= RingOfEnergy.artifactChargeMultiplier(target);
|
||||
|
||||
@@ -29,9 +29,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ScrollEmpower;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
@@ -720,8 +720,7 @@ public abstract class Wand extends Item {
|
||||
float turnsToCharge = (float) (BASE_CHARGE_DELAY
|
||||
+ (SCALING_CHARGE_ADDITION * Math.pow(scalingFactor, missingCharges)));
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (lock == null || lock.regenOn())
|
||||
if (Regeneration.regenOn())
|
||||
partialCharge += (1f/turnsToCharge) * RingOfEnergy.wandChargeMultiplier(target);
|
||||
|
||||
for (Recharging bonus : target.buffs(Recharging.class)){
|
||||
|
||||
@@ -28,9 +28,9 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ArtifactRecharge;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MonkEnergy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
@@ -455,9 +455,8 @@ public class MeleeWeapon extends Weapon {
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charges < chargeCap()){
|
||||
if (lock == null || lock.regenOn()){
|
||||
if (Regeneration.regenOn()){
|
||||
partialCharge += 1/(40f-(chargeCap()-charges)); // 40 to 30 turns per charge
|
||||
}
|
||||
|
||||
@@ -478,7 +477,7 @@ public class MeleeWeapon extends Weapon {
|
||||
|
||||
if (Dungeon.hero.subClass == HeroSubClass.CHAMPION
|
||||
&& secondCharges < secondChargeCap()) {
|
||||
if (lock == null || lock.regenOn()) {
|
||||
if (Regeneration.regenOn()) {
|
||||
// 80 to 60 turns per charge without talent
|
||||
// up to 53.333 to 40 turns per charge at max talent level
|
||||
secondPartialCharge += secondChargeMultiplier() / (40f-(secondChargeCap()-secondCharges));
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.RevealedArea;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Shadows;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
@@ -1064,7 +1065,7 @@ public abstract class Level implements Bundlable {
|
||||
&& ch == Dungeon.hero && Dungeon.hero.hasTalent(Talent.REJUVENATING_STEPS)
|
||||
&& ch.buff(Talent.RejuvenatingStepsCooldown.class) == null){
|
||||
|
||||
if (Dungeon.hero.buff(LockedFloor.class) != null && !Dungeon.hero.buff(LockedFloor.class).regenOn()){
|
||||
if (!Regeneration.regenOn()){
|
||||
set(ch.pos, Terrain.FURROWED_GRASS);
|
||||
} else if (ch.buff(Talent.RejuvenatingStepsFurrow.class) != null && ch.buff(Talent.RejuvenatingStepsFurrow.class).count() >= 200) {
|
||||
set(ch.pos, Terrain.FURROWED_GRASS);
|
||||
|
||||
Reference in New Issue
Block a user