v0.7.0: added 3 more WIP spells

This commit is contained in:
Evan Debenham 2018-09-07 20:48:08 -04:00
parent d06603b95b
commit c3170823bc
10 changed files with 219 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -183,6 +183,7 @@ public class Dungeon {
public static HashSet<Integer> chapters;
public static SparseArray<ArrayList<Item>> droppedItems;
public static SparseArray<ArrayList<Item>> portedItems;
public static int version;
@ -218,7 +219,8 @@ public class Dungeon {
depth = 0;
gold = 0;
droppedItems = new SparseArray<ArrayList<Item>>();
droppedItems = new SparseArray<>();
portedItems = new SparseArray<>();
for (LimitedDrops a : LimitedDrops.values())
a.count = 0;
@ -461,6 +463,7 @@ public class Dungeon {
private static final String GOLD = "gold";
private static final String DEPTH = "depth";
private static final String DROPPED = "dropped%d";
private static final String PORTED = "ported%d";
private static final String LEVEL = "level";
private static final String LIMDROPS = "limited_drops";
private static final String CHAPTERS = "chapters";
@ -482,6 +485,10 @@ public class Dungeon {
for (int d : droppedItems.keyArray()) {
bundle.put(Messages.format(DROPPED, d), droppedItems.get(d));
}
for (int p : portedItems.keyArray()){
bundle.put(Messages.format(PORTED, p), portedItems.get(p));
}
quickslot.storePlaceholders( bundle );
@ -644,14 +651,27 @@ public class Dungeon {
Generator.restoreFromBundle( bundle );
droppedItems = new SparseArray<>();
for (int i=2; i <= Statistics.deepestFloor + 1; i++) {
ArrayList<Item> dropped = new ArrayList<Item>();
portedItems = new SparseArray<>();
for (int i=1; i <= 26; i++) {
//dropped items
ArrayList<Item> items = new ArrayList<Item>();
if (bundle.contains(Messages.format( DROPPED, i )))
for (Bundlable b : bundle.getCollection( Messages.format( DROPPED, i ) ) ) {
dropped.add( (Item)b );
items.add( (Item)b );
}
if (!dropped.isEmpty()) {
droppedItems.put( i, dropped );
if (!items.isEmpty()) {
droppedItems.put( i, items );
}
//ported items
items.clear();
if (bundle.contains(Messages.format( PORTED, i )))
for (Bundlable b : bundle.getCollection( Messages.format( PORTED, i ) ) ) {
items.add( (Item)b );
}
if (!items.isEmpty()) {
portedItems.put( i, items );
}
}
}

View File

@ -0,0 +1,37 @@
/*
* 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.spells;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class BeaconOfReturning extends Spell {
{
image = ItemSpriteSheet.RETURN_BEACON;
}
@Override
protected void onCast(Hero hero) {
//TODO
}
}

View File

@ -0,0 +1,50 @@
/*
* 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.spells;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class FeatherFall extends Spell {
{
image = ItemSpriteSheet.FEATHER_FALL;
}
@Override
protected void onCast(Hero hero) {
Buff.append(hero, FeatherBuff.class);
hero.sprite.operate(hero.pos);
Sample.INSTANCE.play(Assets.SND_READ );
detach( curUser.belongings.backpack );
updateQuickslot();
hero.spendAndNext( 1f );
}
public static class FeatherBuff extends Buff {
//does nothing, just waits to be triggered by chasm falling
}
}

View File

@ -0,0 +1,62 @@
/*
* 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.spells;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import java.util.ArrayList;
public class MagicalPorter extends InventorySpell {
{
image = ItemSpriteSheet.MAGIC_PORTER;
mode = WndBag.Mode.NOT_EQUIPPED;
}
@Override
protected void onCast(Hero hero) {
if (Dungeon.depth >= 25){
GLog.w("There is nowhere for you to port an item to.");
} else {
super.onCast(hero);
}
}
@Override
protected void onItemSelected(Item item) {
Item result = item.detachAll(curUser.belongings.backpack);
ArrayList<Item> ported = Dungeon.portedItems.get(5);
if (ported == null) {
Dungeon.portedItems.put(5 * (1 + Dungeon.depth/5), ported = new ArrayList<>());
}
ported.add(result);
//TODO vfx
}
}

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.spells.FeatherFall;
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.WeakFloorRoom;
@ -93,6 +94,14 @@ public class Chasm {
Hero hero = Dungeon.hero;
FeatherFall.FeatherBuff b = hero.buff(FeatherFall.FeatherBuff.class);
if (b != null){
//TODO visuals
b.detach();
return;
}
Camera.main.shake( 4, 1f );
Dungeon.level.press( hero.pos, hero, true );

View File

@ -378,6 +378,22 @@ public class GameScene extends PixelScene {
}
Dungeon.droppedItems.remove( Dungeon.depth );
}
ArrayList<Item> ported = Dungeon.portedItems.get( Dungeon.depth );
if (ported != null){
//TODO currently items are only ported to boss rooms, so this works well
//might want to have a 'near entrance' function if items can be ported elsewhere
int pos;
do {
pos = Dungeon.level.randomRespawnCell();
} while (Dungeon.level.heaps.get(pos) != null);
for (Item item : ported) {
Dungeon.level.drop( item, pos ).type = Heap.Type.CHEST;
}
Dungeon.level.heaps.get(pos).type = Heap.Type.CHEST;
Dungeon.level.heaps.get(pos).sprite.link(); //sprite reset to show chest
Dungeon.portedItems.remove( Dungeon.depth );
}
Dungeon.hero.next();

View File

@ -563,10 +563,16 @@ public class ItemSpriteSheet {
public static final int PHASE_SHIFT = SPELLS+0;
public static final int AQUA_BLAST = SPELLS+1;
public static final int MAGIC_INFUSE = SPELLS+2;
public static final int MAGIC_PORTER = SPELLS+3;
public static final int RETURN_BEACON = SPELLS+4;
public static final int FEATHER_FALL = SPELLS+5;
static{
assignItemRect(PHASE_SHIFT, 12, 11);
assignItemRect(AQUA_BLAST, 11, 11);
assignItemRect(MAGIC_INFUSE, 10, 15);
assignItemRect(MAGIC_PORTER, 12, 11);
assignItemRect(RETURN_BEACON, 8, 16);
assignItemRect(FEATHER_FALL, 11, 11);
}
private static final int FOOD = xy(1, 28); //16 slots

View File

@ -84,7 +84,8 @@ public class WndBag extends WndTabbed {
CURSE_DETECTABLE,
EQUIPMENT,
TRANMSUTABLE,
ALCHEMY
ALCHEMY,
NOT_EQUIPPED
}
protected static final int COLS_P = 4;
@ -408,6 +409,7 @@ public class WndBag extends WndTabbed {
mode == Mode.EQUIPMENT && (item instanceof EquipableItem) ||
mode == Mode.ALCHEMY && Recipe.usableInRecipe(item) ||
mode == Mode.TRANMSUTABLE && ScrollOfTransmutation.canTransmute(item) ||
mode == Mode.NOT_EQUIPPED && !item.isEquipped(Dungeon.hero) ||
mode == Mode.ALL
);
}

View File

@ -908,6 +908,12 @@ items.scrolls.exotic.scrollofpsionicblast.desc=This scroll contains incredible d
items.spells.aquablast.name=aqua blast
items.spells.aquablast.desc=WIP
items.spells.featherfall.name=feather fall
items.spells.featherfall.desc=WIP
items.spells.beaconofreturning.name=beacon of returning
items.spells.beaconofreturning.desc=WIP
items.spells.spell.ac_cast=CAST
items.spells.magicalinfusion.name=magical infusion
@ -915,6 +921,10 @@ items.spells.magicalinfusion.inv_title=Infuse an item
items.spells.magicalinfusion.infuse=Your %s is infused with arcane energy!
items.spells.magicalinfusion.desc=This spell will infuse a weapon or armor with powerful magical energy.\n\nIn addition to being upgraded, A weapon will gain a magical enchantment, or armor will be imbued with a magical glyph.\n\nIf the item already has an enchantment or glyph, it will not be erased by the upgrade.
items.spells.magicalporter.name=magical porter
items.spells.magicalporter.inv_title=Port an item
items.spells.magicalporter.desc=WIP
items.spells.phaseshift.name=phase shift
items.spells.phaseshift.desc=WIP