v2.0.0: fixed teleport effects not being affected by magic immunity

This commit is contained in:
Evan Debenham
2022-12-28 20:48:09 -05:00
parent 3fa1155a6f
commit a97bfd0c19
3 changed files with 11 additions and 9 deletions

View File

@@ -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 );

View File

@@ -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") );

View File

@@ -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);
}