v2.0.0: fixed teleport effects not being affected by magic immunity
This commit is contained in:
@@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.YogFist;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfArcana;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPsionicBlast;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.CursedWand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
|
||||
@@ -78,6 +79,7 @@ public class AntiMagic extends Armor.Glyph {
|
||||
|
||||
RESISTS.add( Bomb.MagicalBomb.class );
|
||||
RESISTS.add( ScrollOfPsionicBlast.class );
|
||||
RESISTS.add( ScrollOfTeleportation.class );
|
||||
|
||||
RESISTS.add( CursedWand.class );
|
||||
RESISTS.add( WandOfBlastWave.class );
|
||||
|
||||
@@ -84,18 +84,18 @@ public class ScrollOfTeleportation extends Scroll {
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static boolean teleportHero( Hero hero ) {
|
||||
return teleportChar( hero );
|
||||
}
|
||||
|
||||
|
||||
public static boolean teleportChar( Char ch ) {
|
||||
return teleportChar( ch, ScrollOfTeleportation.class );
|
||||
}
|
||||
|
||||
public static boolean teleportChar( Char ch, Class source ) {
|
||||
|
||||
if (!(Dungeon.level instanceof RegularLevel)){
|
||||
return teleportInNonRegularLevel( ch, false );
|
||||
}
|
||||
|
||||
if (Char.hasProp(ch, Char.Property.IMMOVABLE)){
|
||||
if (Char.hasProp(ch, Char.Property.IMMOVABLE) || ch.isImmune(source)){
|
||||
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
|
||||
return false;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public class ScrollOfTeleportation extends Scroll {
|
||||
|
||||
//teleports to a random pathable location on the floor
|
||||
//prefers not seen(optional) > not visible > visible
|
||||
public static boolean teleportInNonRegularLevel(Char ch, boolean preferNotSeen ){
|
||||
private static boolean teleportInNonRegularLevel(Char ch, boolean preferNotSeen ){
|
||||
|
||||
if (Char.hasProp(ch, Char.Property.IMMOVABLE)){
|
||||
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
|
||||
|
||||
@@ -65,12 +65,12 @@ public class Fadeleaf extends Plant {
|
||||
Game.switchScene( InterlevelScene.class );
|
||||
|
||||
} else {
|
||||
ScrollOfTeleportation.teleportChar((Hero) ch);
|
||||
ScrollOfTeleportation.teleportChar(ch, Fadeleaf.class);
|
||||
}
|
||||
|
||||
} else if (ch instanceof Mob && !ch.properties().contains(Char.Property.IMMOVABLE)) {
|
||||
|
||||
ScrollOfTeleportation.teleportChar(ch);
|
||||
ScrollOfTeleportation.teleportChar(ch, Fadeleaf.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user