v0.7.0: implemented runestones! minus visuals

This commit is contained in:
Evan Debenham 2018-06-05 15:33:14 -04:00
parent 212e320f45
commit 287fa2b301
15 changed files with 929 additions and 44 deletions

View File

@ -48,6 +48,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourg
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAvoidance;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@ -190,6 +192,14 @@ public abstract class Mob extends Char {
return source;
}
}
StoneOfAggression.Aggression aggro = buff( StoneOfAggression.Aggression.class );
if (aggro != null){
Char source = (Char)Actor.findById( aggro.object );
if (source != null){
return source;
}
}
//find a new enemy if..
boolean newEnemy = false;
@ -202,6 +212,10 @@ public abstract class Mob extends Char {
//We are amoked and current enemy is the hero
else if (buff( Amok.class ) != null && enemy == Dungeon.hero)
newEnemy = true;
//We have avoidance and current enemy is what should be avoided
else if (buff(StoneOfAvoidance.Avoidance.class) != null
&& buff(StoneOfAvoidance.Avoidance.class).object == enemy.id())
newEnemy = true;
if ( newEnemy ) {
@ -251,7 +265,15 @@ public abstract class Mob extends Char {
}
//neutral character in particular do not choose enemies.
StoneOfAvoidance.Avoidance avoid = buff( StoneOfAvoidance.Avoidance.class );
if (avoid != null){
Char source = (Char)Actor.findById( avoid.object );
if (source != null && enemies.contains(source) && enemies.size() > 1){
enemies.remove(source);
}
}
//neutral characters in particular do not choose enemies.
if (enemies.isEmpty()){
return null;
} else {

View File

@ -85,6 +85,19 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportat
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAugmentation;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAvoidance;
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.StoneOfDeepenedSleep;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFlock;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfIntuition;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfShock;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfCorrosion;
@ -177,14 +190,15 @@ public class Generator {
MIS_T5 ( 0, MissileWeapon.class ),
POTION ( 20, Potion.class ),
SEED ( 0, Plant.Seed.class ),
SCROLL ( 20, Scroll.class ),
STONE ( 0, Runestone.class),
WAND ( 3, Wand.class ),
RING ( 1, Ring.class ),
ARTIFACT( 1, Artifact.class),
SEED ( 0, Plant.Seed.class ),
FOOD ( 0, Food.class ),
GOLD ( 20, Gold.class );
@ -217,22 +231,6 @@ public class Generator {
Gold.class };
GOLD.probs = new float[]{ 1 };
SCROLL.classes = new Class<?>[]{
ScrollOfUpgrade.class, //3 drop every chapter, see Dungeon.souNeeded()
ScrollOfIdentify.class,
ScrollOfRemoveCurse.class,
ScrollOfMagicMapping.class,
ScrollOfMirrorImage.class,
ScrollOfRecharging.class,
ScrollOfLullaby.class,
ScrollOfPsionicBlast.class,
ScrollOfRage.class,
ScrollOfTeleportation.class,
ScrollOfTerror.class,
ScrollOfTransmutation.class //1 additional scroll guaranteed on floors 6-19
};
SCROLL.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
POTION.classes = new Class<?>[]{
PotionOfStrength.class, //2 drop every chapter, see Dungeon.posNeeded()
PotionOfHealing.class,
@ -248,6 +246,53 @@ public class Generator {
PotionOfExperience.class};
POTION.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
SEED.classes = new Class<?>[]{
Firebloom.Seed.class,
Icecap.Seed.class,
Sorrowmoss.Seed.class,
Blindweed.Seed.class,
Sungrass.Seed.class,
Earthroot.Seed.class,
Fadeleaf.Seed.class,
Rotberry.Seed.class,
BlandfruitBush.Seed.class,
Dreamfoil.Seed.class,
Stormvine.Seed.class,
Starflower.Seed.class};
SEED.probs = new float[]{ 10, 10, 10, 10, 10, 10, 10, 0, 2, 10, 10, 1 };
SCROLL.classes = new Class<?>[]{
ScrollOfUpgrade.class, //3 drop every chapter, see Dungeon.souNeeded()
ScrollOfIdentify.class,
ScrollOfRemoveCurse.class,
ScrollOfMagicMapping.class,
ScrollOfMirrorImage.class,
ScrollOfRecharging.class,
ScrollOfLullaby.class,
ScrollOfPsionicBlast.class,
ScrollOfRage.class,
ScrollOfTeleportation.class,
ScrollOfTerror.class,
ScrollOfTransmutation.class
};
SCROLL.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
STONE.classes = new Class<?>[]{
StoneOfEnchantment.class, //1 is garunteed to drop on floors 6-19
StoneOfAugmentation.class, //1 is sold in each shop
StoneOfIntuition.class, //1 additional stone is also dropped on floors 1-3
StoneOfAggression.class,
StoneOfAvoidance.class,
StoneOfBlast.class,
StoneOfBlink.class,
StoneOfClairvoyance.class,
StoneOfDeepenedSleep.class,
StoneOfDetectCurse.class,
StoneOfFlock.class,
StoneOfShock.class
};
STONE.probs = new float[]{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
//TODO: add last ones when implemented
WAND.classes = new Class<?>[]{
WandOfMagicMissile.class,
@ -395,21 +440,6 @@ public class Generator {
EtherealChains.class
};
ARTIFACT.probs = INITIAL_ARTIFACT_PROBS.clone();
SEED.classes = new Class<?>[]{
Firebloom.Seed.class,
Icecap.Seed.class,
Sorrowmoss.Seed.class,
Blindweed.Seed.class,
Sungrass.Seed.class,
Earthroot.Seed.class,
Fadeleaf.Seed.class,
Rotberry.Seed.class,
BlandfruitBush.Seed.class,
Dreamfoil.Seed.class,
Stormvine.Seed.class,
Starflower.Seed.class};
SEED.probs = new float[]{ 10, 10, 10, 10, 10, 10, 10, 0, 2, 10, 10, 1 };
}
}

View File

@ -30,7 +30,18 @@ import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAggression;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAugmentation;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAvoidance;
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.StoneOfDeepenedSleep;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfFlock;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfIntuition;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfShock;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
@ -238,7 +249,40 @@ public abstract class Scroll extends Item {
//TODO add more stones as they are implemented
static {
stones.put(ScrollOfIdentify.class, StoneOfIntuition.class);
amnts.put(ScrollOfIdentify.class, 2);
amnts.put(ScrollOfIdentify.class, 3);
stones.put(ScrollOfLullaby.class, StoneOfDeepenedSleep.class);
amnts.put(ScrollOfLullaby.class, 3);
stones.put(ScrollOfMagicMapping.class, StoneOfClairvoyance.class);
amnts.put(ScrollOfMagicMapping.class, 3);
stones.put(ScrollOfMirrorImage.class, StoneOfFlock.class);
amnts.put(ScrollOfMirrorImage.class, 3);
stones.put(ScrollOfPsionicBlast.class, StoneOfBlast.class);
amnts.put(ScrollOfPsionicBlast.class, 2);
stones.put(ScrollOfRage.class, StoneOfAggression.class);
amnts.put(ScrollOfRage.class, 3);
stones.put(ScrollOfRecharging.class, StoneOfShock.class);
amnts.put(ScrollOfRecharging.class, 2);
stones.put(ScrollOfRemoveCurse.class, StoneOfDetectCurse.class);
amnts.put(ScrollOfRemoveCurse.class, 2);
stones.put(ScrollOfTeleportation.class, StoneOfBlink.class);
amnts.put(ScrollOfTeleportation.class, 2);
stones.put(ScrollOfTerror.class, StoneOfAvoidance.class);
amnts.put(ScrollOfTerror.class, 3);
stones.put(ScrollOfTransmutation.class, StoneOfAugmentation.class);
amnts.put(ScrollOfTransmutation.class, 2);
stones.put(ScrollOfUpgrade.class, StoneOfEnchantment.class);
amnts.put(ScrollOfUpgrade.class, 2);
}
@Override

View File

@ -0,0 +1,87 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
public class StoneOfAggression extends Runestone {
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
for (int i : PathFinder.NEIGHBOURS9){
//TODO visuals
Char ch = Actor.findChar( cell + i );
if (ch != null && ch.alignment == Char.Alignment.ENEMY){
Buff.prolong(ch, Aggression.class, Aggression.DURATION).object = curUser.id();
}
}
}
public static class Aggression extends FlavourBuff {
public static final float DURATION = 10f;
public int object = 0;
private static final String OBJECT = "object";
{
type = buffType.NEGATIVE;
}
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle(bundle);
bundle.put(OBJECT, object);
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
object = bundle.getInt( OBJECT );
}
@Override
public String toString() {
return Messages.get(this, "name");
}
}
}

View File

@ -0,0 +1,87 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
public class StoneOfAvoidance extends Runestone {
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
for (int i : PathFinder.NEIGHBOURS9){
//TODO visuals
Char ch = Actor.findChar( cell + i );
if (ch != null && ch.alignment == Char.Alignment.ENEMY){
Buff.prolong(ch, Avoidance.class, Avoidance.DURATION).object = curUser.id();
}
}
}
public static class Avoidance extends FlavourBuff {
public static final float DURATION = 10f;
public int object = 0;
private static final String OBJECT = "object";
{
type = buffType.NEGATIVE;
}
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle(bundle);
bundle.put(OBJECT, object);
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
object = bundle.getInt( OBJECT );
}
@Override
public String toString() {
return Messages.get(this, "name");
}
}
}

View File

@ -0,0 +1,39 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.items.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class StoneOfBlast extends Runestone {
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
new Bomb().explode(cell);
}
}

View File

@ -0,0 +1,38 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class StoneOfBlink extends Runestone {
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
ScrollOfTeleportation.teleportToLocation(curUser, cell);
}
}

View File

@ -0,0 +1,73 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Point;
public class StoneOfClairvoyance extends Runestone {
private static final int DIST = 8;
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
boolean[] FOV = new boolean[Dungeon.level.length()];
Point c = Dungeon.level.cellToPoint(cell);
ShadowCaster.castShadow(c.x, c.y, FOV, DIST);
int sX = Math.max(0, c.x - DIST);
int eX = Math.min(Dungeon.level.width()-1, c.x + DIST);
int sY = Math.max(0, c.y - DIST);
int eY = Math.min(Dungeon.level.height()-1, c.y + DIST);
for (int y = sY; y <= eY; y++){
int curr = y*Dungeon.level.width() + sX;
for ( int x = sX; x <= eX; x++){
curUser.sprite.parent.addToBack( new CheckedCell( curr ) );
if (FOV[curr] && Dungeon.level.secret[curr]){
Dungeon.level.discover( curr );
if (Dungeon.level.heroFOV[curr]) {
GameScene.discoverTile( curr, Dungeon.level.map[curr] );
ScrollOfMagicMapping.discover( curr );
}
}
curr++;
}
}
}
}

View File

@ -0,0 +1,66 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class StoneOfDeepenedSleep extends Runestone {
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
for (int i : PathFinder.NEIGHBOURS9){
CellEmitter.get(cell + i).start( Speck.factory( Speck.NOTE ), 0.3f, 5 );
if (Actor.findChar(cell + i) != null) {
Char c = Actor.findChar(cell + i);
if ((c instanceof Mob && ((Mob) c).state == ((Mob) c).SLEEPING)){
Buff.affect(c, MagicalSleep.class);
}
}
}
Sample.INSTANCE.play( Assets.SND_LULLABY );
}
}

View File

@ -0,0 +1,51 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class StoneOfDetectCurse extends InventoryStone {
//TODO there should be a 'cursed known' visible status for items
{
mode = WndBag.Mode.EQUIPMENT;
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void onItemSelected(Item item) {
item.cursedKnown = true;
//TODO visuals
if (item.cursed){
GLog.w( Messages.get(this, "cursed") );
} else {
GLog.w( Messages.get(this, "not_cursed") );
}
}
}

View File

@ -0,0 +1,65 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class StoneOfFlock extends Runestone {
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
for (int i : PathFinder.NEIGHBOURS9){
if (!Dungeon.level.solid[cell + i]
&& !Dungeon.level.pit[cell + i]
&& Actor.findChar(cell + i) == null) {
Sheep sheep = new Sheep();
sheep.lifespan = 10;
sheep.pos = cell + i;
GameScene.add(sheep);
Dungeon.level.press(sheep.pos, sheep);
CellEmitter.get(sheep.pos).burst(Speck.factory(Speck.WOOL), 4);
}
}
CellEmitter.get(cell).burst(Speck.factory(Speck.WOOL), 4);
Sample.INSTANCE.play(Assets.SND_PUFF);
}
}

View File

@ -21,25 +21,216 @@
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHaste;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLevitation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfPurity;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas;
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.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTerror;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.Image;
import java.util.HashSet;
public class StoneOfIntuition extends InventoryStone {
{
mode = WndBag.Mode.UNIDED_POTION_OR_SCROLL;
//TODO
image = ItemSpriteSheet.STONE_ISAZ;
}
@Override
protected void onItemSelected(Item item) {
//TODO design and implement interface for this.
//GameScene.show( new Window());
GameScene.show( new WndGuess(item));
}
public static class WndGuess extends Window {
private static final int WIDTH = 120;
private static final int BTN_SIZE = 20;
//in order of their consumable icon
public static Class[] potions = new Class[]{
PotionOfExperience.class,
PotionOfFrost.class,
PotionOfHaste.class,
PotionOfHealing.class,
PotionOfInvisibility.class,
PotionOfLevitation.class,
PotionOfLiquidFlame.class,
PotionOfMindVision.class,
PotionOfParalyticGas.class,
PotionOfPurity.class,
PotionOfStrength.class,
PotionOfToxicGas.class,
PotionOfMight.class
};
public static Class[] scrolls = new Class[]{
ScrollOfIdentify.class,
ScrollOfLullaby.class,
ScrollOfMagicMapping.class,
ScrollOfMirrorImage.class,
ScrollOfPsionicBlast.class,
ScrollOfRage.class,
ScrollOfRecharging.class,
ScrollOfRemoveCurse.class,
ScrollOfTeleportation.class,
ScrollOfTerror.class,
ScrollOfTransmutation.class,
ScrollOfUpgrade.class,
ScrollOfMagicalInfusion.class
};
static Class curGuess = null;
public WndGuess(final Item item){
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite(ItemSpriteSheet.STONE_ISAZ, null) );
titlebar.label( Messages.get(StoneOfIntuition.class, "name") );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
RenderedTextMultiline text = PixelScene.renderMultiline(6);
text.text( Messages.get(this, "text") );
text.setPos(0, titlebar.bottom());
text.maxWidth( WIDTH );
add(text);
//TODO visuals
final RedButton guess = new RedButton(""){
@Override
protected void onClick() {
super.onClick();
if (item.getClass() == curGuess){
item.identify();
GLog.p( Messages.get(WndGuess.class, "correct") );
} else {
GLog.n( Messages.get(WndGuess.class, "incorrect") );
}
curGuess = null;
hide();
}
};
guess.visible = false;
guess.icon( new ItemSprite(item) );
guess.enable(false);
guess.setRect(0, 80, WIDTH, 20);
add(guess);
float left;
float top = text.bottom() + 5;
int rows;
int placed = 0;
HashSet<Class<?extends Item>> unIDed = new HashSet<>();
final Class[] all;
if (item.isIdentified()){
hide();
return;
} else if (item instanceof Potion){
unIDed.addAll(Potion.getUnknown());
all = potions;
} else if (item instanceof Scroll){
unIDed.addAll(Scroll.getUnknown());
all = scrolls;
} else {
hide();
return;
}
if (unIDed.size() < 6){
rows = 1;
top += BTN_SIZE/2f;
left = (WIDTH - BTN_SIZE*unIDed.size())/2f;
} else {
rows = 2;
left = (WIDTH - BTN_SIZE*((unIDed.size()+1)/2))/2f;
}
for (int i = 0; i < all.length; i++){
if (!unIDed.contains(all[i])) {
continue;
}
final int j = i;
IconButton btn = new IconButton(){
@Override
protected void onClick() {
curGuess = all[j];
guess.visible = true;
guess.text( Messages.get(curGuess, "name") );
guess.enable(true);
super.onClick();
}
};
Image im = new Image(Assets.CONS_ICONS, 7*i, all == potions ? 0 : 8, 7, 8);
im.scale.set(2f);
btn.icon(im);
btn.setRect(left + placed*BTN_SIZE, top, BTN_SIZE, BTN_SIZE);
add(btn);
placed++;
if (rows == 2 && placed == ((unIDed.size()+1)/2)){
placed = 0;
if (unIDed.size() % 2 == 1){
left += BTN_SIZE/2f;
}
top += BTN_SIZE;
}
}
resize(WIDTH, 100);
}
@Override
public void onBackPressed() {
super.onBackPressed();
new StoneOfIntuition().collect();
}
}
}

View File

@ -0,0 +1,52 @@
/*
* 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.stones;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Electricity;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.PathFinder;
public class StoneOfShock extends Runestone {
{
//TODO
image = ItemSpriteSheet.STONE_TIWAZ;
}
@Override
protected void activate(int cell) {
Sample.INSTANCE.play( Assets.SND_LIGHTNING );
for( int i : PathFinder.NEIGHBOURS9) {
if (!Dungeon.level.solid[cell + i]) {
GameScene.add(Blob.seed(cell + i, 10, Electricity.class));
}
}
}
}

View File

@ -50,8 +50,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.food.SmallRation;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfIntuition;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass;
@ -187,10 +188,14 @@ public abstract class Level implements Bundlable {
Dungeon.LimitedDrops.ARCANE_STYLI.count++;
}
//one scroll of transmutation is guaranteed to spawn somewhere on chapter 2-4
int transChapter = (int)((Dungeon.seed / 10) % 3) + 1;
if ( Dungeon.depth / 5 == transChapter &&
int enchChapter = (int)((Dungeon.seed / 10) % 3) + 1;
if ( Dungeon.depth / 5 == enchChapter &&
Dungeon.seed % 4 + 1 == Dungeon.depth % 5){
addItemToSpawn( new ScrollOfTransmutation() );
addItemToSpawn( new StoneOfEnchantment() );
}
if ( Dungeon.depth == ((Dungeon.seed % 3) + 1)){
addItemToSpawn( new StoneOfIntuition() );
}
DriedRose rose = Dungeon.hero.belongings.getItem( DriedRose.class );

View File

@ -678,7 +678,11 @@ items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, impro
###runestones
items.stones.inventorystone.ac_use=USE
items.stones.stoneofaugmentation.name=Stone of Augmentation
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 attempt to attack the thrower over any other target.
items.stones.stoneofaggression$aggression.name=Aggression
items.stones.stoneofaugmentation.name=stone of augmentation
items.stones.stoneofaugmentation.inv_title=Augment an item
items.stones.stoneofaugmentation.desc=This runestone possesses potent magic which can augment equipment to enhance one property at the cost of another.\n\nUsing on a weapon will allow you to enhance either speed or damage.\n\nUsing on armor will allow you to enhance either defense or evasion.
items.stones.stoneofaugmentation$wndaugment.choice=What would you like to enhance?
@ -689,15 +693,46 @@ items.stones.stoneofaugmentation$wndaugment.defense=Defense
items.stones.stoneofaugmentation$wndaugment.none=Remove Augmentation
items.stones.stoneofaugmentation$wndaugment.cancel=Never mind
items.stones.stoneofenchantment.name=Stone of Enchantment
items.stones.stoneofavoidance.name=stone of avoidance
items.stones.stoneofavoidance.desc=When this stone is thrown near an enemy, it will afflict them with avoidance magic.\n\nAn enemy under the influence of avoidance will prefer to attack any other enemy before the thrower. If the thrower is the only possible target they will still be attacked however.
items.stones.stoneofavoidance$avoidance.name=Avoidance
items.stones.stoneofblast.name=stone of blast
items.stones.stoneofblast.desc=This runestone will instantly explode at the location it is thrown to. Just like a bomb, the explosion will deal damage to anything nearby.
items.stones.stoneofblink.name=stone of blink
items.stones.stoneofblink.desc=This runestone will teleport the user to the location it is thrown to.
items.stones.stoneofclairvoyance.name=stone of clairvoyance
items.stones.stoneofclairvoyance.desc=This stone will instantly search all tiles which are visible from the location it is thrown to.
items.stones.stoneofdeepenedsleep.name=stone of deepened sleep
items.stones.stoneofdeepenedsleep.desc=When this stone is thrown near a sleeping enemy, it will magically deepen their speed. Magically slept enemies will sleep forever until disturbed.
items.stones.stoneofdetectcurse.name=stone of detect curse
items.stones.stoneofdetectcurse.inv_title=Detect an item
items.stones.stoneofdetectcurse.cursed=You sense that the item is cursed!
items.stones.stoneofdetectcurse.not_cursed=There is no evil magic in that item.
items.stones.stoneofdetectcurse.desc=This runestone holds a weaker version of the magic found in scrolls of remove curse. While curses cannot be removed from an item, they will be detected.
items.stones.stoneofenchantment.name=stone of enchantment
items.stones.stoneofenchantment.inv_title=Enchant an item
items.stones.stoneofenchantment.weapon=Your weapon glows in the darkness!
items.stones.stoneofenchantment.armor=Your armor glows in the darkness!
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.stoneofflock.name=stone of flock
items.stones.stoneofflock.desc=This runestone summons magical sheep for a short time around the location is is thrown to.
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.
items.stones.stoneofintuition$wndguess.text=Guess what the unidentified item is. If you guess correctly, it will be identified!
items.stones.stoneofintuition$wndguess.correct=Correct. The item has been identified!
items.stones.stoneofintuition$wndguess.incorrect=Your guess was incorrect.
items.stones.stoneofshock.name=stone of shock
items.stones.stoneofshock.desc=This runestone unleashes a short-lived electrical storm at the location it is thrown to.
###wands
items.wands.cursedwand.ondeath=You were killed by your own %s.