v2.5.3: added stones of detect magic, replacing stones of disarming

This commit is contained in:
Evan Debenham
2024-09-24 12:19:03 -04:00
parent 4eccfda92a
commit 842d7efce5
6 changed files with 105 additions and 6 deletions

View File

@@ -1289,6 +1289,14 @@ items.stones.stoneofclairvoyance.desc=This stone will instantly reveal all tiles
items.stones.stoneofdeepsleep.name=stone of deep sleep
items.stones.stoneofdeepsleep.desc=When this stone is thrown at an enemy, it will put them into a deep magical sleep. Magically slept enemies will sleep forever until disturbed.
items.stones.stoneofdetectmagic.name=stone of detect magic
items.stones.stoneofdetectmagic.inv_title=Detect an item
items.stones.stoneofdetectmagic.detected_none=You don't detect any magic affecting this item.
items.stones.stoneofdetectmagic.detected_both=You detect both positive and malevolent magic affecting this item!
items.stones.stoneofdetectmagic.detected_good=You detect positive magic affecting this item!
items.stones.stoneofdetectmagic.detected_bad=You detect malevolent magic affecting this item!
items.stones.stoneofdetectmagic.desc=This runestone is able to detect magic affecting an item. Using this stone on an unidentified item will tell you if it is affected by a malevolent curse and whether it is affected by positive magic such as an enchantment or upgrades.
items.stones.stoneofdisarming.name=stone of disarming
items.stones.stoneofdisarming.desc=This runestone holds magic that can disable malicious traps hidden throughout the dungeon. It will disarm up to 9 traps around the area it is thrown at.

View File

@@ -101,7 +101,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlink;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfClairvoyance;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepSleep;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFear;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFlock;
@@ -374,7 +374,7 @@ public class Generator {
STONE.classes = new Class<?>[]{
StoneOfEnchantment.class, //1 is guaranteed to drop on floors 6-19
StoneOfIntuition.class, //1 additional stone is also dropped on floors 1-3
StoneOfDisarming.class,
StoneOfDetectMagic.class,
StoneOfFlock.class,
StoneOfShock.class,
StoneOfBlink.class,

View File

@@ -42,7 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfBlink;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfClairvoyance;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDeepSleep;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFear;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFlock;
@@ -314,7 +314,7 @@ public abstract class Scroll extends Item {
stones.put(ScrollOfRetribution.class, StoneOfBlast.class);
stones.put(ScrollOfRage.class, StoneOfAggression.class);
stones.put(ScrollOfRecharging.class, StoneOfShock.class);
stones.put(ScrollOfRemoveCurse.class, StoneOfDisarming.class);
stones.put(ScrollOfRemoveCurse.class, StoneOfDetectMagic.class);
stones.put(ScrollOfTeleportation.class, StoneOfBlink.class);
stones.put(ScrollOfTerror.class, StoneOfFear.class);
stones.put(ScrollOfTransmutation.class, StoneOfAugmentation.class);

View File

@@ -0,0 +1,90 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2024 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
public class StoneOfDetectMagic extends InventoryStone {
{
preferredBag = Belongings.Backpack.class;
image = ItemSpriteSheet.STONE_DETECT;
}
@Override
public boolean usableOnItem(Item item){
return (item instanceof EquipableItem || item instanceof Wand)
&& (!item.isIdentified() || !item.cursedKnown);
}
@Override
protected void onItemSelected(Item item) {
item.cursedKnown = true;
useAnimation();
boolean negativeMagic = false;
boolean positiveMagic = false;
negativeMagic = item.cursed;
if (!negativeMagic){
if (item instanceof Weapon && ((Weapon) item).hasCurseEnchant()){
negativeMagic = true;
} else if (item instanceof Armor && ((Armor) item).hasCurseGlyph()){
negativeMagic = true;
}
}
positiveMagic = item.trueLevel() > 0;
if (!positiveMagic){
if (item instanceof Weapon && ((Weapon) item).hasGoodEnchant()){
positiveMagic = true;
} else if (item instanceof Armor && ((Armor) item).hasGoodGlyph()){
positiveMagic = true;
}
}
if (!positiveMagic && !negativeMagic){
GLog.i(Messages.get(this, "detected_none"));
} else if (positiveMagic && negativeMagic) {
GLog.h(Messages.get(this, "detected_both"));
} else if (positiveMagic){
GLog.p(Messages.get(this, "detected_good"));
} else if (negativeMagic){
GLog.w(Messages.get(this, "detected_bad"));
}
curItem.detach( curUser.belongings.backpack );
Catalog.countUse(getClass());
}
}

View File

@@ -35,12 +35,13 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
//for pre-v2.5.3 saves, add a conversion in v3.0 and remove entirely later
public class StoneOfDisarming extends Runestone {
private static final int DIST = 8;
{
image = ItemSpriteSheet.STONE_DISARM;
image = ItemSpriteSheet.STONE_DETECT;
}
@Override

View File

@@ -556,7 +556,7 @@ public class ItemSpriteSheet {
public static final int STONE_BLINK = STONES+4;
public static final int STONE_CLAIRVOYANCE = STONES+5;
public static final int STONE_SLEEP = STONES+6;
public static final int STONE_DISARM = STONES+7;
public static final int STONE_DETECT = STONES+7;
public static final int STONE_ENCHANT = STONES+8;
public static final int STONE_FLOCK = STONES+9;
public static final int STONE_INTUITION = STONES+10;