diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicImmune.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicImmune.java
new file mode 100644
index 000000000..fc5934832
--- /dev/null
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicImmune.java
@@ -0,0 +1,43 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * Shattered Pixel Dungeon
+ * Copyright (C) 2014-2018 Evan Debenham
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+
+package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
+
+import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
+
+public class MagicImmune extends FlavourBuff {
+
+ //TODO visuals
+
+ //FIXME this does not currently handle all cases, need to implement:
+ //- all glyph effects not working
+ //- equipped curse being removable
+ //- 0 damage from magical attacks
+ //- text for all of these
+
+ //what about active buffs/debuffs?
+
+ @Override
+ public int icon() {
+ return BuffIndicator.COMBO;
+ }
+
+}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java
index 668e79c10..48df52b09 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java
@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
+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.ItemStatusHandler;
@@ -150,7 +151,9 @@ public abstract class Scroll extends Item {
if (action.equals( AC_READ )) {
- if (hero.buff( Blindness.class ) != null) {
+ if (hero.buff(MagicImmune.class) != null){
+ GLog.w( "no magic!" ); //TODO
+ } else if (hero.buff( Blindness.class ) != null) {
GLog.w( Messages.get(this, "blinded") );
} else if (hero.buff(UnstableSpellbook.bookRecharge.class) != null
&& hero.buff(UnstableSpellbook.bookRecharge.class).isCursed()
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java
index cc7e6201e..28e897236 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ExoticScroll.java
@@ -26,6 +26,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
+import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfLullaby;
+import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
+import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
@@ -48,6 +51,17 @@ public abstract class ExoticScroll extends Scroll {
regToExo.put(ScrollOfTerror.class, ScrollOfPetrification.class);
exoToReg.put(ScrollOfPetrification.class, ScrollOfTerror.class);
+ regToExo.put(ScrollOfRemoveCurse.class, ScrollOfAntiMagic.class);
+ exoToReg.put(ScrollOfAntiMagic.class, ScrollOfRemoveCurse.class);
+
+ regToExo.put(ScrollOfLullaby.class, ScrollOfAffection.class);
+ exoToReg.put(ScrollOfAffection.class, ScrollOfLullaby.class);
+
+ regToExo.put(ScrollOfRage.class, ScrollOfConfusion.class);
+ exoToReg.put(ScrollOfConfusion.class, ScrollOfRage.class);
+
+ regToExo.put(ScrollOfTerror.class, ScrollOfPetrification.class);
+ exoToReg.put(ScrollOfPetrification.class, ScrollOfTerror.class);
}
@Override
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAffection.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAffection.java
new file mode 100644
index 000000000..c8d169162
--- /dev/null
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAffection.java
@@ -0,0 +1,57 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * Shattered Pixel Dungeon
+ * Copyright (C) 2014-2018 Evan Debenham
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+
+package com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic;
+
+import com.shatteredpixel.shatteredpixeldungeon.Assets;
+import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
+import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
+import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm;
+import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
+import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
+import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
+import com.watabou.noosa.audio.Sample;
+
+public class ScrollOfAffection extends ExoticScroll {
+
+ @Override
+ public void doRead() {
+
+ curUser.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
+ Sample.INSTANCE.play( Assets.SND_CHARMS );
+ Invisibility.dispel();
+
+ for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
+ if (Dungeon.level.heroFOV[mob.pos]) {
+ Buff.affect( mob, Charm.class, 20f );
+ mob.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
+ }
+ }
+
+ //GLog.i( Messages.get(this, "sooth") );
+
+ setKnown();
+
+ readAnimation();
+
+ }
+
+}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAntiMagic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAntiMagic.java
new file mode 100644
index 000000000..b6b5f6c0a
--- /dev/null
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfAntiMagic.java
@@ -0,0 +1,42 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * Shattered Pixel Dungeon
+ * Copyright (C) 2014-2018 Evan Debenham
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+
+package com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic;
+
+import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
+import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
+import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
+
+public class ScrollOfAntiMagic extends ExoticScroll {
+ @Override
+ public void doRead() {
+
+ Invisibility.dispel();
+
+ Buff.affect( curUser, MagicImmune.class, 10f );
+
+ //
+
+ setKnown();
+
+ readAnimation();
+ }
+}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfConfusion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfConfusion.java
new file mode 100644
index 000000000..e31c648db
--- /dev/null
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfConfusion.java
@@ -0,0 +1,55 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * Shattered Pixel Dungeon
+ * Copyright (C) 2014-2018 Evan Debenham
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+
+package com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic;
+
+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.Invisibility;
+import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
+import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
+import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
+import com.watabou.noosa.audio.Sample;
+
+public class ScrollOfConfusion extends ExoticScroll {
+
+
+ @Override
+ public void doRead() {
+ for (Mob mob : Dungeon.level.mobs.toArray( new Mob[0] )) {
+ if (Dungeon.level.heroFOV[mob.pos]) {
+ Buff.prolong(mob, Vertigo.class, 10f);
+ Buff.prolong(mob, Blindness.class, 10f);
+ }
+ }
+
+ setKnown();
+
+ curUser.sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.3f, 3 );
+ Sample.INSTANCE.play( Assets.SND_READ );
+ Invisibility.dispel();
+
+ readAnimation();
+ }
+
+}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java
index 50744b84b..c31b4f325 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java
@@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
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.SoulMark;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
@@ -96,9 +97,14 @@ public abstract class Wand extends Item {
if (action.equals( AC_ZAP )) {
- curUser = hero;
- curItem = this;
- GameScene.selectCell( zapper );
+ if (hero.buff(MagicImmune.class) != null){
+ GLog.w( "no magic!" ); //TODO
+ } else {
+
+ curUser = hero;
+ curItem = this;
+ GameScene.selectCell(zapper);
+ }
}
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java
index 624120342..400107220 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java
@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
+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.KindOfWeapon;
@@ -96,7 +97,7 @@ abstract public class Weapon extends KindOfWeapon {
@Override
public int proc( Char attacker, Char defender, int damage ) {
- if (enchantment != null) {
+ if (enchantment != null && attacker.buff(MagicImmune.class) != null) {
damage = enchantment.proc( this, attacker, defender, damage );
}