v1.4.0: fixed magic immune not applying to rings or artifacts
This commit is contained in:
@@ -253,7 +253,7 @@ actors.buffs.magicalsleep.wakeup=You wake up feeling refreshed and healthy.
|
||||
actors.buffs.magicalsleep.desc=This character has fallen into a deep magical sleep which they will not wake from naturally.\n\nMagical sleep is similar to regular sleep, except that only damage will cause the target to wake up.\n\nFor the hero, magical sleep has some restorative properties, allowing them to rapidly heal while resting.
|
||||
|
||||
actors.buffs.magicimmune.name=Immune to Magic
|
||||
actors.buffs.magicimmune.desc=All magical effects have lost their hold on you, you are completely impervious to them.\n\nWhile magic immune all harmful and helpful magical effects will not apply to you, including curses, enchants, wands, scrolls, etc.\n\nTurns of magic immunity remaining: %s.
|
||||
actors.buffs.magicimmune.desc=All magical effects have lost their hold on you, you are completely impervious to them.\n\nWhile magic immune all harmful and helpful magical effects will not apply to you, including curses, enchants, wands, scrolls, rings, artifacts, etc.\n\nTurns of magic immunity remaining: %s.
|
||||
|
||||
actors.buffs.mindvision.name=Mind vision
|
||||
actors.buffs.mindvision.desc=Somehow you are able to see all creatures on this floor through your mind. It's a weird feeling.\n\nAll characters on this floor are visible to you as long as you have mind vision. Seeing a creature through mind vision counts as it being seen or nearby for the purposes of many magical effects.\n\nTurns of mind vision remaining: %s.
|
||||
|
||||
+12
-2
@@ -22,6 +22,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
@@ -39,8 +40,6 @@ public class MagicImmune extends FlavourBuff {
|
||||
{
|
||||
immunities.addAll(AntiMagic.RESISTS);
|
||||
}
|
||||
|
||||
//FIXME still a lot of cases not handled here, e.g. rings/artifacts and various damage sources
|
||||
|
||||
@Override
|
||||
public boolean attachTo(Char target) {
|
||||
@@ -53,12 +52,23 @@ public class MagicImmune extends FlavourBuff {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target instanceof Hero){
|
||||
((Hero) target).updateHT(false);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
if (target instanceof Hero){
|
||||
((Hero) target).updateHT(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.COMBO;
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class Regeneration extends Buff {
|
||||
ChaliceOfBlood.chaliceRegen regenBuff = Dungeon.hero.buff( ChaliceOfBlood.chaliceRegen.class);
|
||||
|
||||
float delay = REGENERATION_DELAY;
|
||||
if (regenBuff != null) {
|
||||
if (regenBuff != null && target.buff(MagicImmune.class) == null) {
|
||||
if (regenBuff.isCursed()) {
|
||||
delay *= 1.5f;
|
||||
} else {
|
||||
|
||||
+7
-3
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
|
||||
@@ -61,7 +62,7 @@ public class AlchemistsToolkit extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && !cursed) {
|
||||
if (isEquipped( hero ) && !cursed && hero.buff(MagicImmune.class) == null) {
|
||||
actions.add(AC_BREW);
|
||||
if (level() < levelCap) {
|
||||
actions.add(AC_ENERGIZE);
|
||||
@@ -75,6 +76,8 @@ public class AlchemistsToolkit extends Artifact {
|
||||
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals(AC_BREW)){
|
||||
if (!isEquipped(hero)) GLog.i( Messages.get(this, "need_to_equip") );
|
||||
else if (cursed) GLog.w( Messages.get(this, "cursed") );
|
||||
@@ -155,6 +158,7 @@ public class AlchemistsToolkit extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (target.buff(MagicImmune.class) != null) return;
|
||||
partialCharge += 0.25f*amount;
|
||||
if (partialCharge >= 1){
|
||||
partialCharge--;
|
||||
@@ -215,7 +219,7 @@ public class AlchemistsToolkit extends Artifact {
|
||||
@Override
|
||||
public boolean act() {
|
||||
|
||||
if (warmUpDelay > 0){
|
||||
if (warmUpDelay > 0 && !cursed && target.buff(MagicImmune.class) == null){
|
||||
if (level() == 10){
|
||||
warmUpDelay = 0;
|
||||
} else if (warmUpDelay == 101){
|
||||
@@ -232,7 +236,7 @@ public class AlchemistsToolkit extends Artifact {
|
||||
}
|
||||
|
||||
public void gainCharge(float levelPortion) {
|
||||
if (cursed) return;
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
|
||||
//generates 2 energy every hero level, +0.1 energy per toolkit level
|
||||
//to a max of 12 energy per hero level
|
||||
|
||||
+8
-1
@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
@@ -53,7 +54,11 @@ public class ChaliceOfBlood extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && level() < levelCap && !cursed && !hero.isInvulnerable(getClass()))
|
||||
if (isEquipped( hero )
|
||||
&& level() < levelCap
|
||||
&& !cursed
|
||||
&& !hero.isInvulnerable(getClass())
|
||||
&& hero.buff(MagicImmune.class) == null)
|
||||
actions.add(AC_PRICK);
|
||||
return actions;
|
||||
}
|
||||
@@ -148,6 +153,8 @@ public class ChaliceOfBlood extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
|
||||
//grants 5 turns of healing up-front
|
||||
float healDelay = 10f - level()*0.9f;
|
||||
healDelay /= amount;
|
||||
|
||||
+11
-3
@@ -28,6 +28,7 @@ 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.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Preparation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
@@ -70,7 +71,9 @@ public class CloakOfShadows extends Artifact {
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if ((isEquipped( hero ) || hero.hasTalent(Talent.LIGHT_CLOAK))
|
||||
&& !cursed && (charge > 0 || activeBuff != null)) {
|
||||
&& !cursed
|
||||
&& hero.buff(MagicImmune.class) == null
|
||||
&& (charge > 0 || activeBuff != null)) {
|
||||
actions.add(AC_STEALTH);
|
||||
}
|
||||
return actions;
|
||||
@@ -81,6 +84,8 @@ public class CloakOfShadows extends Artifact {
|
||||
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals( AC_STEALTH )) {
|
||||
|
||||
if (activeBuff == null){
|
||||
@@ -171,6 +176,8 @@ public class CloakOfShadows extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (charge < chargeCap) {
|
||||
if (!isEquipped(target)) amount *= 0.75f*target.pointsInTalent(Talent.LIGHT_CLOAK)/3f;
|
||||
partialCharge += 0.25f*amount;
|
||||
@@ -219,7 +226,7 @@ public class CloakOfShadows extends Artifact {
|
||||
public class cloakRecharge extends ArtifactBuff{
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (charge < chargeCap) {
|
||||
if (charge < chargeCap && !cursed && target.buff(MagicImmune.class) == null) {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (activeBuff == null && (lock == null || lock.regenOn())) {
|
||||
float missing = (chargeCap - charge);
|
||||
@@ -241,8 +248,9 @@ public class CloakOfShadows extends Artifact {
|
||||
}
|
||||
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
partialCharge = 0;
|
||||
}
|
||||
|
||||
if (cooldown > 0)
|
||||
cooldown --;
|
||||
|
||||
+18
-4
@@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
@@ -110,7 +111,11 @@ public class DriedRose extends Artifact {
|
||||
actions.remove(AC_EQUIP);
|
||||
return actions;
|
||||
}
|
||||
if (isEquipped( hero ) && charge == chargeCap && !cursed && ghostID == 0) {
|
||||
if (isEquipped( hero )
|
||||
&& charge == chargeCap
|
||||
&& !cursed
|
||||
&& hero.buff(MagicImmune.class) == null
|
||||
&& ghostID == 0) {
|
||||
actions.add(AC_SUMMON);
|
||||
}
|
||||
if (ghostID != 0){
|
||||
@@ -130,6 +135,8 @@ public class DriedRose extends Artifact {
|
||||
|
||||
if (action.equals(AC_SUMMON)) {
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (!Ghost.Quest.completed()) GameScene.show(new WndUseItem(null, this));
|
||||
else if (ghost != null) GLog.i( Messages.get(this, "spawned") );
|
||||
else if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
|
||||
@@ -275,6 +282,8 @@ public class DriedRose extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (ghost == null){
|
||||
if (charge < chargeCap) {
|
||||
charge += Math.round(4*amount);
|
||||
@@ -374,7 +383,7 @@ public class DriedRose extends Artifact {
|
||||
}
|
||||
|
||||
//rose does not charge while ghost hero is alive
|
||||
if (ghost != null){
|
||||
if (ghost != null && !cursed && target.buff(MagicImmune.class) == null){
|
||||
defaultAction = AC_DIRECT;
|
||||
|
||||
//heals to full over 500 turns
|
||||
@@ -397,7 +406,10 @@ public class DriedRose extends Artifact {
|
||||
}
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) {
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.regenOn())) {
|
||||
//500 turns to a full charge
|
||||
partialCharge += (1/5f * RingOfEnergy.artifactChargeMultiplier(target));
|
||||
if (partialCharge > 1){
|
||||
@@ -555,7 +567,9 @@ public class DriedRose extends Artifact {
|
||||
@Override
|
||||
protected boolean act() {
|
||||
updateRose();
|
||||
if (rose == null || !rose.isEquipped(Dungeon.hero)){
|
||||
if (rose == null
|
||||
|| !rose.isEquipped(Dungeon.hero)
|
||||
|| Dungeon.hero.buff(MagicImmune.class) != null){
|
||||
damage(1, this);
|
||||
}
|
||||
|
||||
|
||||
+11
-3
@@ -28,6 +28,7 @@ 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.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Chains;
|
||||
@@ -69,8 +70,9 @@ public class EtherealChains extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions(Hero hero) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped(hero) && charge > 0 && !cursed)
|
||||
if (isEquipped(hero) && charge > 0 && !cursed && hero.buff(MagicImmune.class) == null) {
|
||||
actions.add(AC_CAST);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
@@ -83,6 +85,8 @@ public class EtherealChains extends Artifact {
|
||||
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals(AC_CAST)){
|
||||
|
||||
curUser = hero;
|
||||
@@ -266,6 +270,7 @@ public class EtherealChains extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
int chargeTarget = 5+(level()*2);
|
||||
if (charge < chargeTarget*2){
|
||||
partialCharge += 0.5f*amount;
|
||||
@@ -297,7 +302,10 @@ public class EtherealChains extends Artifact {
|
||||
public boolean act() {
|
||||
int chargeTarget = 5+(level()*2);
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeTarget && !cursed && (lock == null || lock.regenOn())) {
|
||||
if (charge < chargeTarget
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.regenOn())) {
|
||||
//gains a charge in 40 - 2*missingCharge turns
|
||||
float chargeGain = (1 / (40f - (chargeTarget - charge)*2f));
|
||||
chargeGain *= RingOfEnergy.artifactChargeMultiplier(target);
|
||||
@@ -319,7 +327,7 @@ public class EtherealChains extends Artifact {
|
||||
}
|
||||
|
||||
public void gainExp( float levelPortion ) {
|
||||
if (cursed || levelPortion == 0) return;
|
||||
if (cursed || target.buff(MagicImmune.class) != null || levelPortion == 0) return;
|
||||
|
||||
exp += Math.round(levelPortion*100);
|
||||
|
||||
|
||||
+8
-3
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
@@ -71,6 +72,7 @@ public class HornOfPlenty extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (hero.buff(MagicImmune.class) != null) return actions;
|
||||
if (isEquipped( hero ) && charge > 0) {
|
||||
actions.add(AC_SNACK);
|
||||
actions.add(AC_EAT);
|
||||
@@ -86,6 +88,8 @@ public class HornOfPlenty extends Artifact {
|
||||
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals(AC_EAT) || action.equals(AC_SNACK)){
|
||||
|
||||
if (!isEquipped(hero)) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
|
||||
@@ -155,7 +159,7 @@ public class HornOfPlenty extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (charge < chargeCap){
|
||||
if (charge < chargeCap && !cursed && target.buff(MagicImmune.class) == null){
|
||||
partialCharge += 0.25f*amount;
|
||||
if (partialCharge >= 1){
|
||||
partialCharge--;
|
||||
@@ -247,7 +251,7 @@ public class HornOfPlenty extends Artifact {
|
||||
public class hornRecharge extends ArtifactBuff{
|
||||
|
||||
public void gainCharge(float levelPortion) {
|
||||
if (cursed) return;
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (charge < chargeCap) {
|
||||
|
||||
@@ -276,8 +280,9 @@ public class HornOfPlenty extends Artifact {
|
||||
partialCharge = 0;
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
partialCharge = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
-2
@@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.CounterBuff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
@@ -71,13 +72,21 @@ public class MasterThievesArmband extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions(Hero hero) {
|
||||
ArrayList<String> actions = super.actions(hero);
|
||||
if (isEquipped(hero) && charge > 0 && !cursed) actions.add(AC_STEAL);
|
||||
if (isEquipped(hero)
|
||||
&& charge > 0
|
||||
&& hero.buff(MagicImmune.class) == null
|
||||
&& !cursed) {
|
||||
actions.add(AC_STEAL);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Hero hero, String action) {
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals(AC_STEAL)){
|
||||
|
||||
curUser = hero;
|
||||
@@ -206,6 +215,7 @@ public class MasterThievesArmband extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
partialCharge += 0.1f * amount;
|
||||
partialCharge = Math.min(partialCharge, chargeCap - charge);
|
||||
while (partialCharge >= 1f){
|
||||
@@ -261,7 +271,7 @@ public class MasterThievesArmband extends Artifact {
|
||||
}
|
||||
|
||||
public void gainCharge(float levelPortion) {
|
||||
if (cursed) return;
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (charge < chargeCap){
|
||||
float chargeGain = 3f * levelPortion;
|
||||
|
||||
+11
-2
@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
@@ -67,10 +68,15 @@ public class SandalsOfNature extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && level() < 3 && !cursed)
|
||||
if (hero.buff(MagicImmune.class) != null){
|
||||
return actions;
|
||||
}
|
||||
if (isEquipped( hero ) && level() < 3 && !cursed) {
|
||||
actions.add(AC_FEED);
|
||||
if (isEquipped( hero ) && charge > 0)
|
||||
}
|
||||
if (isEquipped( hero ) && charge > 0) {
|
||||
actions.add(AC_ROOT);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
@@ -78,6 +84,8 @@ public class SandalsOfNature extends Artifact {
|
||||
public void execute( Hero hero, String action ) {
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals(AC_FEED)){
|
||||
|
||||
GameScene.selectItem(itemSelector);
|
||||
@@ -171,6 +179,7 @@ public class SandalsOfNature extends Artifact {
|
||||
|
||||
public class Naturalism extends ArtifactBuff{
|
||||
public void charge(float amount) {
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
if (level() > 0 && charge < target.HT){
|
||||
//gain 1+(1*level)% of the difference between current charge and max HP.
|
||||
float chargeGain = (target.HT-charge) * (.01f+ level()*0.01f);
|
||||
|
||||
+17
-4
@@ -28,6 +28,7 @@ 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.LockedFloor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell;
|
||||
@@ -68,7 +69,11 @@ public class TalismanOfForesight extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && !cursed) actions.add(AC_SCRY);
|
||||
if (isEquipped( hero )
|
||||
&& !cursed
|
||||
&& hero.buff(MagicImmune.class) == null) {
|
||||
actions.add(AC_SCRY);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
@@ -76,6 +81,8 @@ public class TalismanOfForesight extends Artifact {
|
||||
public void execute( Hero hero, String action ) {
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals(AC_SCRY)){
|
||||
if (!isEquipped(hero)) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
|
||||
else if (charge < 5) GLog.i( Messages.get(this, "low_charge") );
|
||||
@@ -90,6 +97,7 @@ public class TalismanOfForesight extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (cursed || target.buff(MagicImmune.class) != null) return;
|
||||
if (charge < chargeCap){
|
||||
charge += Math.round(2*amount);
|
||||
if (charge >= chargeCap) {
|
||||
@@ -290,7 +298,9 @@ public class TalismanOfForesight extends Artifact {
|
||||
}
|
||||
}
|
||||
|
||||
if (smthFound && !cursed){
|
||||
if (smthFound
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null){
|
||||
if (!warn){
|
||||
GLog.w( Messages.get(this, "uneasy") );
|
||||
if (target instanceof Hero){
|
||||
@@ -303,7 +313,10 @@ public class TalismanOfForesight extends Artifact {
|
||||
}
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) {
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.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);
|
||||
@@ -323,7 +336,7 @@ public class TalismanOfForesight extends Artifact {
|
||||
}
|
||||
|
||||
public void charge(int boost){
|
||||
if (!cursed) {
|
||||
if (!cursed && target.buff(MagicImmune.class) == null) {
|
||||
charge = Math.min((charge + boost), chargeCap);
|
||||
updateQuickslot();
|
||||
}
|
||||
|
||||
+12
-3
@@ -28,6 +28,7 @@ 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.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
@@ -72,7 +73,10 @@ public class TimekeepersHourglass extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && !cursed && (charge > 0 || activeBuff != null)) {
|
||||
if (isEquipped( hero )
|
||||
&& !cursed
|
||||
&& hero.buff(MagicImmune.class) == null
|
||||
&& (charge > 0 || activeBuff != null)) {
|
||||
actions.add(AC_ACTIVATE);
|
||||
}
|
||||
return actions;
|
||||
@@ -83,6 +87,8 @@ public class TimekeepersHourglass extends Artifact {
|
||||
|
||||
super.execute(hero, action);
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals(AC_ACTIVATE)){
|
||||
|
||||
if (!isEquipped( hero )) GLog.i( Messages.get(Artifact.class, "need_to_equip") );
|
||||
@@ -152,7 +158,7 @@ public class TimekeepersHourglass extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (charge < chargeCap){
|
||||
if (charge < chargeCap && !cursed && target.buff(MagicImmune.class) == null){
|
||||
partialCharge += 0.25f*amount;
|
||||
if (partialCharge >= 1){
|
||||
partialCharge--;
|
||||
@@ -224,7 +230,10 @@ public class TimekeepersHourglass extends Artifact {
|
||||
public boolean act() {
|
||||
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) {
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.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);
|
||||
|
||||
+12
-4
@@ -26,6 +26,7 @@ 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.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||
@@ -96,10 +97,12 @@ public class UnstableSpellbook extends Artifact {
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
if (isEquipped( hero ) && charge > 0 && !cursed)
|
||||
if (isEquipped( hero ) && charge > 0 && !cursed && hero.buff(MagicImmune.class) == null) {
|
||||
actions.add(AC_READ);
|
||||
if (isEquipped( hero ) && level() < levelCap && !cursed)
|
||||
}
|
||||
if (isEquipped( hero ) && level() < levelCap && !cursed && hero.buff(MagicImmune.class) == null) {
|
||||
actions.add(AC_ADD);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
@@ -108,6 +111,8 @@ public class UnstableSpellbook extends Artifact {
|
||||
|
||||
super.execute( hero, action );
|
||||
|
||||
if (hero.buff(MagicImmune.class) != null) return;
|
||||
|
||||
if (action.equals( AC_READ )) {
|
||||
|
||||
if (hero.buff( Blindness.class ) != null) GLog.w( Messages.get(this, "blinded") );
|
||||
@@ -218,7 +223,7 @@ public class UnstableSpellbook extends Artifact {
|
||||
|
||||
@Override
|
||||
public void charge(Hero target, float amount) {
|
||||
if (charge < chargeCap){
|
||||
if (charge < chargeCap && !cursed && target.buff(MagicImmune.class) == null){
|
||||
partialCharge += 0.1f*amount;
|
||||
if (partialCharge >= 1){
|
||||
partialCharge--;
|
||||
@@ -282,7 +287,10 @@ public class UnstableSpellbook extends Artifact {
|
||||
@Override
|
||||
public boolean act() {
|
||||
LockedFloor lock = target.buff(LockedFloor.class);
|
||||
if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) {
|
||||
if (charge < chargeCap
|
||||
&& !cursed
|
||||
&& target.buff(MagicImmune.class) == null
|
||||
&& (lock == null || lock.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);
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EnhancedRings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
@@ -304,6 +305,7 @@ public class Ring extends KindofMisc {
|
||||
}
|
||||
|
||||
public static int getBonus(Char target, Class<?extends RingBuff> type){
|
||||
if (target.buff(MagicImmune.class) != null) return 0;
|
||||
int bonus = 0;
|
||||
for (RingBuff buff : target.buffs(type)) {
|
||||
bonus += buff.level();
|
||||
@@ -312,6 +314,7 @@ public class Ring extends KindofMisc {
|
||||
}
|
||||
|
||||
public static int getBuffedBonus(Char target, Class<?extends RingBuff> type){
|
||||
if (target.buff(MagicImmune.class) != null) return 0;
|
||||
int bonus = 0;
|
||||
for (RingBuff buff : target.buffs(type)) {
|
||||
bonus += buff.buffedLvl();
|
||||
|
||||
Reference in New Issue
Block a user