v0.7.0: rough implementation of 3 more exotic scrolls

This commit is contained in:
Evan Debenham 2018-07-19 15:42:36 -04:00
parent 81db0652fd
commit c14995902e
8 changed files with 226 additions and 5 deletions
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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;
}
}

View File

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

View File

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

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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();
}
}

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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();
}
}

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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();
}
}

View File

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

View File

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