v0.6.2: early runestone implementation (only 2 of them in 0.6.2)
This commit is contained in:
parent
0c46963dee
commit
35c38f2f21
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2017 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.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public abstract class InventoryStone extends Runestone {
|
||||||
|
|
||||||
|
protected String inventoryTitle = Messages.get(this, "inv_title");
|
||||||
|
protected WndBag.Mode mode = WndBag.Mode.ALL;
|
||||||
|
|
||||||
|
{
|
||||||
|
defaultAction = AC_USE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String AC_USE = "USE";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<String> actions(Hero hero) {
|
||||||
|
ArrayList<String> actions = super.actions( hero );
|
||||||
|
actions.add( AC_USE );
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(Hero hero, String action) {
|
||||||
|
super.execute(hero, action);
|
||||||
|
if (action.equals(AC_USE)){
|
||||||
|
curItem = detach( hero.belongings.backpack );
|
||||||
|
activate(curUser.pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void activate(int cell) {
|
||||||
|
GameScene.selectItem( itemSelector, mode, inventoryTitle );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void useAnimation() {
|
||||||
|
curUser.spend( 1f );
|
||||||
|
curUser.busy();
|
||||||
|
curUser.sprite.operate(curUser.pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void onItemSelected( Item item );
|
||||||
|
|
||||||
|
protected static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||||
|
@Override
|
||||||
|
public void onSelect( Item item ) {
|
||||||
|
if (item != null) {
|
||||||
|
|
||||||
|
((InventoryStone)curItem).onItemSelected( item );
|
||||||
|
((InventoryStone)curItem).useAnimation();
|
||||||
|
|
||||||
|
Sample.INSTANCE.play( Assets.SND_READ );
|
||||||
|
Invisibility.dispel();
|
||||||
|
|
||||||
|
} else{
|
||||||
|
curItem.collect( curUser.belongings.backpack );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2017 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.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
|
||||||
|
public abstract class Runestone extends Item {
|
||||||
|
|
||||||
|
{
|
||||||
|
stackable = true;
|
||||||
|
defaultAction = AC_THROW;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onThrow(int cell) {
|
||||||
|
if (Dungeon.level.pit[cell] || !defaultAction.equals(AC_THROW)){
|
||||||
|
super.onThrow( cell );
|
||||||
|
} else {
|
||||||
|
activate(cell);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void activate(int cell);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUpgradable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIdentified() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2017 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.effects.Enchanting;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
|
|
||||||
|
public class StoneOfEnchantment extends InventoryStone {
|
||||||
|
|
||||||
|
{
|
||||||
|
mode = WndBag.Mode.ENCHANTABLE;
|
||||||
|
image = ItemSpriteSheet.STONE_TIWAZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onItemSelected(Item item) {
|
||||||
|
|
||||||
|
if (item instanceof Weapon) {
|
||||||
|
|
||||||
|
((Weapon)item).enchant();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
((Armor)item).inscribe();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
curUser.sprite.emitter().start( Speck.factory( Speck.LIGHT ), 0.1f, 5 );
|
||||||
|
Enchanting.show( curUser, item );
|
||||||
|
GLog.w( "your %s glows in the dark", item.name() );
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2017 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.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
|
|
||||||
|
public class StoneOfIntuition extends InventoryStone {
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
mode = WndBag.Mode.UNIDED_POTION_OR_SCROLL;
|
||||||
|
image = ItemSpriteSheet.STONE_ISAZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onItemSelected(Item item) {
|
||||||
|
|
||||||
|
//TODO design and implement interface for this.
|
||||||
|
//GameScene.show( new Window());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -353,7 +353,25 @@ public class ItemSpriteSheet {
|
||||||
assignItemRect(i, 15, 14);
|
assignItemRect(i, 15, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int POTIONS = xy(1, 21); //16 slots
|
private static final int STONES = xy(1, 21); //16 slots
|
||||||
|
public static final int STONE_KAUNAN = STONES+0;
|
||||||
|
public static final int STONE_SOWILO = STONES+1;
|
||||||
|
public static final int STONE_LAGUZ = STONES+2;
|
||||||
|
public static final int STONE_YNGVI = STONES+3;
|
||||||
|
public static final int STONE_GYFU = STONES+4;
|
||||||
|
public static final int STONE_RAIDO = STONES+5;
|
||||||
|
public static final int STONE_ISAZ = STONES+6;
|
||||||
|
public static final int STONE_MANNAZ = STONES+7;
|
||||||
|
public static final int STONE_NAUDIZ = STONES+8;
|
||||||
|
public static final int STONE_BERKANAN = STONES+9;
|
||||||
|
public static final int STONE_ODAL = STONES+10;
|
||||||
|
public static final int STONE_TIWAZ = STONES+11;
|
||||||
|
static {
|
||||||
|
for (int i = STONES; i < STONES+16; i++)
|
||||||
|
assignItemRect(i, 11, 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int POTIONS = xy(1, 22); //16 slots
|
||||||
public static final int POTION_CRIMSON = POTIONS+0;
|
public static final int POTION_CRIMSON = POTIONS+0;
|
||||||
public static final int POTION_AMBER = POTIONS+1;
|
public static final int POTION_AMBER = POTIONS+1;
|
||||||
public static final int POTION_GOLDEN = POTIONS+2;
|
public static final int POTION_GOLDEN = POTIONS+2;
|
||||||
|
@ -371,7 +389,7 @@ public class ItemSpriteSheet {
|
||||||
assignItemRect(i, 10, 14);
|
assignItemRect(i, 10, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int SEEDS = xy(1, 22); //16 slots
|
private static final int SEEDS = xy(1, 23); //16 slots
|
||||||
public static final int SEED_ROTBERRY = SEEDS+0;
|
public static final int SEED_ROTBERRY = SEEDS+0;
|
||||||
public static final int SEED_FIREBLOOM = SEEDS+1;
|
public static final int SEED_FIREBLOOM = SEEDS+1;
|
||||||
public static final int SEED_STARFLOWER = SEEDS+2;
|
public static final int SEED_STARFLOWER = SEEDS+2;
|
||||||
|
@ -389,7 +407,7 @@ public class ItemSpriteSheet {
|
||||||
assignItemRect(i, 10, 10);
|
assignItemRect(i, 10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
//32 free slots
|
//16 free slots
|
||||||
|
|
||||||
private static final int FOOD = xy(1, 25); //16 slots
|
private static final int FOOD = xy(1, 25); //16 slots
|
||||||
public static final int MEAT = FOOD+0;
|
public static final int MEAT = FOOD+0;
|
||||||
|
|
|
@ -64,6 +64,7 @@ import com.watabou.noosa.audio.Sample;
|
||||||
|
|
||||||
public class WndBag extends WndTabbed {
|
public class WndBag extends WndTabbed {
|
||||||
|
|
||||||
|
//FIXME this is getting cumbersome, there should be a better way to manage this
|
||||||
public static enum Mode {
|
public static enum Mode {
|
||||||
ALL,
|
ALL,
|
||||||
UNIDENTIFED,
|
UNIDENTIFED,
|
||||||
|
@ -79,6 +80,7 @@ public class WndBag extends WndTabbed {
|
||||||
FOOD,
|
FOOD,
|
||||||
POTION,
|
POTION,
|
||||||
SCROLL,
|
SCROLL,
|
||||||
|
UNIDED_POTION_OR_SCROLL,
|
||||||
EQUIPMENT,
|
EQUIPMENT,
|
||||||
ALCHEMY
|
ALCHEMY
|
||||||
}
|
}
|
||||||
|
@ -402,6 +404,7 @@ public class WndBag extends WndTabbed {
|
||||||
mode == Mode.FOOD && (item instanceof Food) ||
|
mode == Mode.FOOD && (item instanceof Food) ||
|
||||||
mode == Mode.POTION && (item instanceof Potion) ||
|
mode == Mode.POTION && (item instanceof Potion) ||
|
||||||
mode == Mode.SCROLL && (item instanceof Scroll) ||
|
mode == Mode.SCROLL && (item instanceof Scroll) ||
|
||||||
|
mode == Mode.UNIDED_POTION_OR_SCROLL && (!item.isIdentified() && (item instanceof Scroll || item instanceof Potion)) ||
|
||||||
mode == Mode.EQUIPMENT && (item instanceof EquipableItem) ||
|
mode == Mode.EQUIPMENT && (item instanceof EquipableItem) ||
|
||||||
mode == Mode.ALCHEMY && ((item instanceof Seed && !(item instanceof BlandfruitBush.Seed)) || (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null)) ||
|
mode == Mode.ALCHEMY && ((item instanceof Seed && !(item instanceof BlandfruitBush.Seed)) || (item instanceof Blandfruit && ((Blandfruit) item).potionAttrib == null)) ||
|
||||||
mode == Mode.ALL
|
mode == Mode.ALL
|
||||||
|
|
|
@ -649,6 +649,17 @@ items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, impro
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###runestones
|
||||||
|
items.stones.inventorystone.ac_use=USE
|
||||||
|
|
||||||
|
items.stones.stoneofenchantment.name=Stone of Enchantment
|
||||||
|
items.stones.stoneofenchantment.inv_title=Enchant an item
|
||||||
|
items.stones.stoneofenchantment.desc=This runestone possesses enchanting magic. Unlike a scroll of upgrade, it will not increase the direct power of an item, but will instead imbue a weapon or armor with an enchantment, granting it a new power.
|
||||||
|
|
||||||
|
items.stones.stoneofintuition.name=Stone of Intuition
|
||||||
|
items.stones.stoneofintuition.inv_title=Select an item
|
||||||
|
items.stones.stoneofintuition.desc=This runestone holds a weaker version of the magic found in scrolls of identification. Rather than directly identifying an item, it will work on your intuition, allowing you to attempt to identify a potion or scroll by guessing.
|
||||||
|
|
||||||
###wands
|
###wands
|
||||||
items.wands.cursedwand.ondeath=You were killed by your own %s.
|
items.wands.cursedwand.ondeath=You were killed by your own %s.
|
||||||
items.wands.cursedwand.nothing=Nothing happens.
|
items.wands.cursedwand.nothing=Nothing happens.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user