v0.7.0: renamed scroll of foresight to divination, properly implemented antimagic (mostly)

This commit is contained in:
Evan Debenham 2018-07-23 22:56:40 -04:00
parent 644e6543ad
commit baed120f4d
9 changed files with 50 additions and 37 deletions

View File

@ -43,7 +43,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
@ -358,10 +357,6 @@ public abstract class Char extends Actor {
buff( Paralysis.class ).processDamage(dmg);
}
if (buff( MagicImmune.class ) != null && MagicImmune.IMMUNITIES.contains(src)){
dmg = 0;
}
int shielded = dmg;
//FIXME: when I add proper damage properties, should add an IGNORES_SHIELDS property to use here.
if (!(src instanceof Hunger)){

View File

@ -22,29 +22,41 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import java.util.HashSet;
import com.watabou.noosa.Image;
public class MagicImmune extends FlavourBuff {
{
type = buffType.POSITIVE;
announced = true;
}
public static final HashSet<Class> IMMUNITIES = (HashSet<Class>) AntiMagic.RESISTS.clone();
{
immunities.addAll(AntiMagic.RESISTS);
}
//TODO visuals
//FIXME this does not currently handle all cases, need to implement:
//+ all enchant effects not working
//+ all glyph effects not working
//+ equipped curse being removable
//+ 0 damage from magical attacks
//- text for all of these
//what about active buffs/debuffs?
//FIXME what about active buffs/debuffs?, what about rings? what about artifacts?
@Override
public int icon() {
return BuffIndicator.COMBO;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(0, 1, 0);
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc", dispTurns());
}
}

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfAntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAugmentation;
@ -152,12 +153,12 @@ public abstract class Scroll extends Item {
if (action.equals( AC_READ )) {
if (hero.buff(MagicImmune.class) != null){
GLog.w( "no magic!" ); //TODO
GLog.w( Messages.get(this, "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()
&& !(this instanceof ScrollOfRemoveCurse)) {
&& !(this instanceof ScrollOfRemoveCurse || this instanceof ScrollOfAntiMagic)){
GLog.n( Messages.get(this, "cursed") );
} else {
curUser = hero;

View File

@ -48,8 +48,8 @@ public abstract class ExoticScroll extends Scroll {
public static final HashMap<Class<?extends Scroll>, Class<?extends ExoticScroll>> regToExo = new HashMap<>();
public static final HashMap<Class<?extends ExoticScroll>, Class<?extends Scroll>> exoToReg = new HashMap<>();
static{
regToExo.put(ScrollOfIdentify.class, ScrollOfForesight.class);
exoToReg.put(ScrollOfForesight.class, ScrollOfIdentify.class);
regToExo.put(ScrollOfIdentify.class, ScrollOfDivination.class);
exoToReg.put(ScrollOfDivination.class, ScrollOfIdentify.class);
regToExo.put(ScrollOfUpgrade.class, ScrollOfEnchantment.class);
exoToReg.put(ScrollOfEnchantment.class, ScrollOfUpgrade.class);

View File

@ -24,6 +24,7 @@ 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;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
public class ScrollOfAntiMagic extends ExoticScroll {
@ -36,9 +37,8 @@ public class ScrollOfAntiMagic extends ExoticScroll {
Invisibility.dispel();
Buff.affect( curUser, MagicImmune.class, 10f );
//
Buff.affect( curUser, MagicImmune.class, 20f );
new Flare( 5, 32 ).color( 0xFF0000, true ).show( curUser.sprite, 2f );
setKnown();

View File

@ -43,7 +43,7 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.HashSet;
public class ScrollOfForesight extends ExoticScroll {
public class ScrollOfDivination extends ExoticScroll {
{
initials = 0;
@ -107,16 +107,16 @@ public class ScrollOfForesight extends ExoticScroll {
total --;
}
GameScene.show(new WndForesight( IDed ));
GameScene.show(new WndDivination( IDed ));
}
private class WndForesight extends Window {
private class WndDivination extends Window {
private static final int WIDTH = 120;
WndForesight(ArrayList<Item> IDed ){
IconTitle cur = new IconTitle(new ItemSprite(ScrollOfForesight.this),
Messages.titleCase(Messages.get(ScrollOfForesight.class, "name")));
WndDivination(ArrayList<Item> IDed ){
IconTitle cur = new IconTitle(new ItemSprite(ScrollOfDivination.this),
Messages.titleCase(Messages.get(ScrollOfDivination.class, "name")));
cur.setRect(0, 0, WIDTH, 0);
add(cur);

View File

@ -98,7 +98,7 @@ public abstract class Wand extends Item {
if (action.equals( AC_ZAP )) {
if (hero.buff(MagicImmune.class) != null){
GLog.w( "no magic!" ); //TODO
GLog.w( Messages.get(this, "no_magic") );
} else {
curUser = hero;

View File

@ -175,6 +175,9 @@ actors.buffs.magicalsleep.fallasleep=You fall into a deep magical sleep.
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\n Turns 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.

View File

@ -697,6 +697,7 @@ items.scrolls.scroll.odal=scroll of ODAL
items.scrolls.scroll.tiwaz=scroll of TIWAZ
items.scrolls.scroll.unknown_desc=An indecipherable magical rune is written on this parchment. Who knows what it will do when read aloud?
items.scrolls.scroll.blinded=You can't read a scroll while blinded.
items.scrolls.scroll.no_magic=You can't read a scroll while magic immune.
items.scrolls.scroll.cursed=Your cursed spellbook prevents you from invoking this scroll's magic! A scroll of remove curse might be strong enough to still work though...
items.scrolls.inventoryscroll.warning=Do you really want to cancel this scroll usage? It will be consumed anyway.
@ -795,15 +796,15 @@ items.scrolls.exotic.scrollofconfusion.desc=When read aloud, this scroll will un
items.scrolls.exotic.scrollofdistortion.name=scroll of distortion
items.scrolls.exotic.scrollofdistortion.desc=This scroll contains powerful magic capable of warping reality.
items.scrolls.exotic.scrollofdivination.name=scroll of divination
items.scrolls.exotic.scrollofdivination.nothing_left=There is nothing left to identify!
items.scrolls.exotic.scrollofdivination.desc=This scroll will permanently identify four random item types: potion colors, scroll runes, and ring gems. The items identified won't necessary be ones you're carrying.
items.scrolls.exotic.scrollofdivination$wnddivination.desc=Your scroll of divination has identified the following items:
items.scrolls.exotic.scrollofenchantment.name=scroll of enchantment
items.scrolls.exotic.scrollofenchantment.inv_title=enchant an item
items.scrolls.exotic.scrollofenchantment.desc=
items.scrolls.exotic.scrollofforesight.name=scroll of foresight
items.scrolls.exotic.scrollofforesight.nothing_left=There is nothing left to identify!
items.scrolls.exotic.scrollofforesight.desc=This scroll will permanently identify the type of four random items. The items identified won't necessary be ones you're carrying.
items.scrolls.exotic.scrollofforesight$wndforesight.desc=Your scroll of foresight has identified the following items:
items.scrolls.exotic.scrollofmysticalenergy.name=scroll of mystical energy
items.scrolls.exotic.scrollofmysticalenergy.desc=
@ -884,6 +885,7 @@ items.wands.cursedwand.transmogrify=Your wand transmogrifies into a different it
items.wands.wand.ac_zap=ZAP
items.wands.wand.fizzles=Your wand fizzles; it must not have enough charge.
items.wands.wand.no_magic=Your wand fizzles; you cannot use wands while magic immune.
items.wands.wand.self_target=You can't target yourself!
items.wands.wand.identify=You are now familiar with your %s.
items.wands.wand.cursed=This wand is cursed, making its magic chaotic and random.