v0.7.0: adjusted isSimilar logic and added some placeholder items

This commit is contained in:
Evan Debenham 2018-09-27 19:33:41 -04:00
parent 8c1fa0b0ff
commit 4c56360184
12 changed files with 96 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.Iterator;
public class Belongings implements Iterable<Item> {
@ -152,7 +153,7 @@ public class Belongings implements Iterable<Item> {
public Item getSimilar( Item similar ){
for (Item item : this) {
if (item.isSimilar(similar)) {
if (similar.isSimilar(item)) {
return item;
}
}
@ -160,6 +161,18 @@ public class Belongings implements Iterable<Item> {
return null;
}
public ArrayList<Item> getAllSimilar( Item similar ){
ArrayList<Item> result = new ArrayList<>();
for (Item item : this) {
if (similar.isSimilar(item)) {
result.add(item);
}
}
return result;
}
public void identify() {
for (Item item : this) {
item.identify();

View File

@ -79,7 +79,7 @@ public class Bomb extends Item {
@Override
public boolean isSimilar(Item item) {
return item.getClass() == getClass() && this.fuse == ((Bomb) item).fuse;
return super.isSimilar(item) && this.fuse == ((Bomb) item).fuse;
}
@Override

View File

@ -69,12 +69,12 @@ public class Blandfruit extends Food {
@Override
public boolean isSimilar( Item item ) {
if (item instanceof Blandfruit){
if (potionAttrib == null){
if (((Blandfruit)item).potionAttrib == null)
if ( super.isSimilar(item) ){
Blandfruit other = (Blandfruit) item;
if (potionAttrib == null && other.potionAttrib == null) {
return true;
} else if (((Blandfruit)item).potionAttrib != null){
if (((Blandfruit)item).potionAttrib.getClass() == potionAttrib.getClass())
} else if (potionAttrib != null && other.potionAttrib != null
&& potionAttrib.isSimilar(other.potionAttrib)){
return true;
}
}

View File

@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -71,4 +72,22 @@ public class MysteryMeat extends Food {
break;
}
}
public static class PlaceHolder extends MysteryMeat {
{
image = ItemSpriteSheet.MEAT_HOLDER;
}
@Override
public boolean isSimilar(Item item) {
return item instanceof MysteryMeat || item instanceof StewedMeat
|| item instanceof ChargrilledMeat || item instanceof FrozenCarpaccio;
}
@Override
public String info() {
return "";
}
}
}

View File

@ -43,7 +43,7 @@ public abstract class Key extends Item {
@Override
public boolean isSimilar( Item item ) {
return item.getClass() == getClass() && ((Key)item).depth == depth;
return super.isSimilar(item) && ((Key)item).depth == depth;
}
@Override

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public abstract class Runestone extends Item {
@ -56,4 +57,26 @@ public abstract class Runestone extends Item {
public int price() {
return 10 * quantity;
}
public static class PlaceHolder extends Runestone {
{
image = ItemSpriteSheet.STONE_HOLDER;
}
@Override
protected void activate(int cell) {
//does nothing
}
@Override
public boolean isSimilar(Item item) {
return item instanceof Runestone;
}
@Override
public String info() {
return "";
}
}
}

View File

@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
@ -205,5 +206,22 @@ public abstract class Plant implements Bundlable {
public String info() {
return Messages.get( Seed.class, "info", desc() );
}
public static class PlaceHolder extends Seed {
{
image = ItemSpriteSheet.SEED_HOLDER;
}
@Override
public boolean isSimilar(Item item) {
return item instanceof Plant.Seed;
}
@Override
public String info() {
return "";
}
}
}
}

View File

@ -45,7 +45,10 @@ public class ItemSpriteSheet {
public static final int ARTIFACT_HOLDER = PLACEHOLDERS+5;
public static final int POTION_HOLDER = PLACEHOLDERS+6;
public static final int SCROLL_HOLDER = PLACEHOLDERS+7;
public static final int SOMETHING = PLACEHOLDERS+8;
public static final int SEED_HOLDER = PLACEHOLDERS+8;
public static final int STONE_HOLDER = PLACEHOLDERS+9;
public static final int MEAT_HOLDER = PLACEHOLDERS+10;
public static final int SOMETHING = PLACEHOLDERS+11;
static{
assignItemRect(NULLWARN, 16, 7);
assignItemRect(WEAPON_HOLDER, 14, 14);
@ -53,8 +56,11 @@ public class ItemSpriteSheet {
assignItemRect(WAND_HOLDER, 14, 14);
assignItemRect(RING_HOLDER, 8, 10);
assignItemRect(ARTIFACT_HOLDER, 15, 15);
assignItemRect(POTION_HOLDER, 10, 14);
assignItemRect(POTION_HOLDER, 12, 14);
assignItemRect(SCROLL_HOLDER, 15, 14);
assignItemRect(SEED_HOLDER, 10, 10);
assignItemRect(STONE_HOLDER, 14, 12);
assignItemRect(MEAT_HOLDER, 15, 11);
assignItemRect(SOMETHING, 8, 13);
}

View File

@ -447,6 +447,7 @@ items.food.mysterymeat.legs=You can't feel your legs!
items.food.mysterymeat.not_well=You are not feeling well.
items.food.mysterymeat.stuffed=You are stuffed.
items.food.mysterymeat.desc=Eat at your own risk!
items.food.mysterymeat$placeholder.name=meat
items.food.pasty.pasty=pasty
items.food.pasty.pie=pumpkin pie
@ -934,6 +935,7 @@ items.spells.featherfall.light=You feel light as a feather!
items.spells.featherfall.desc=This spell manipulates gravity's effect on the caster, allowing them to fall great distances without harm for a short time. Each use of the spell will only provide enough protection for one chasm.
items.spells.spell.ac_cast=CAST
items.spells.spell.no_magic=You can't cast spells while magic immune.
items.spells.magicalinfusion.name=magical infusion
items.spells.magicalinfusion.inv_title=Infuse an item
@ -943,7 +945,7 @@ items.spells.magicalinfusion.desc=This spell will infuse a weapon or armor with
items.spells.magicalporter.name=magical porter
items.spells.magicalporter.inv_title=Port an item
items.spells.magicalporter.nowhere=There is nowhere for you to port an item to.
items.spells.magicalporter.desc=This spell will magical transport any item it is cast on. Unlike a merchant's beacon however, the items will be transported to the entrance of the next boss floor.
items.spells.magicalporter.desc=This spell will magically transport any item it is cast on. Unlike a merchant's beacon however, the items will be transported to the entrance of the next boss floor.
items.spells.phaseshift.name=phase shift
items.spells.phaseshift.tele_fail=The teleportation magic fails.
@ -965,6 +967,8 @@ items.spells.targetedspell.inv_title=Infuse an item
###runestones
items.stones.inventorystone.ac_use=USE
items.stones.runestone$placeholder.name=runestone
items.stones.stoneofaggression.name=stone of aggression
items.stones.stoneofaggression.desc=When this stone is thrown near an enemy, it will afflict them with aggression magic.\n\nAn enemy under the influence of aggression will be forced to attack you instead of any allies, if any allies are nearby.
items.stones.stoneofaggression$aggression.name=Aggression

View File

@ -48,7 +48,7 @@ journal.document.alchemy_guide.tele_spells.body=Combining certain ingredients in
journal.document.alchemy_guide.item_spells.title=Item Manipulation Spells
journal.document.alchemy_guide.item_spells.body=Item manipulation spells affect the items in your inventory in a variety of different ways.\n\n\nMagical infusion is created by mixing a scroll of upgrade with a stone of enchantment.\n\nCurse infusion is created by mixing a scroll of remove curse with a cursed metal shard.\n\nAlchemize is created by mixing a scroll of recharging with a potion of liquid flame.\n\nRecycle is created by mixing a scroll of transmutation with a scroll of mirror image.
journal.document.alchemy_guide.enviro_spells.title=Environmental Spells
journal.document.alchemy_guide.enviro_spells.body=Environmental spells give you new ways to change or interact with the terrain of the dungeon.\n\n\nReclaim trap is created by mixing a scroll of recharging with a cursed metal shard.\n\nAqua blast is created by mixing a scroll of identify with a potion of storm clouds.\n\nFeatherfall is created by mixing a scroll of lullaby, a potion of levitation, and a good amount of alchemical energy.
journal.document.alchemy_guide.enviro_spells.body=Environmental spells give you new ways to change or interact with the terrain of the dungeon.\n\n\nReclaim trap is created by mixing a scroll of recharging with a cursed metal shard.\n\nAqua blast is created by mixing a scroll of identify with a potion of storm clouds.\n\nFeather fall is created by mixing a scroll of lullaby, a potion of levitation, and a good amount of alchemical energy.
journal.notes$landmark.well_of_health=well of health
journal.notes$landmark.well_of_awareness=well of awareness

View File

@ -32,6 +32,7 @@ plants.icecap$seed.name=seed of icecap
plants.plant$seed.seed_of=seed of %s
plants.plant$seed.ac_plant=PLANT
plants.plant$seed.info=Throw this seed to the place where you want to grow a plant.\n\n%s
plants.plant$seed$placeholder.name=seed
plants.rotberry.name=Rotberry
plants.rotberry.desc=The berries of a young rotberry shrub taste like sweet, sweet death.\n\nGiven several days, this rotberry shrub will grow into another rot heart.