V0.1.0 Partial Commit
changed package and application names to differentiate from main PD release
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* 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.levels.features;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
|
||||
public class AlchemyPot {
|
||||
|
||||
private static final String TXT_SELECT_SEED = "Select a seed to throw";
|
||||
|
||||
private static Hero hero;
|
||||
private static int pos;
|
||||
|
||||
public static void operate( Hero hero, int pos ) {
|
||||
|
||||
AlchemyPot.hero = hero;
|
||||
AlchemyPot.pos = pos;
|
||||
|
||||
GameScene.selectItem( itemSelector, WndBag.Mode.SEED, TXT_SELECT_SEED );
|
||||
}
|
||||
|
||||
private static final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
if (item != null) {
|
||||
item.cast( hero, pos );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* 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.levels.features;
|
||||
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
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.levels.RegularLevel;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Room;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.MobSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Chasm {
|
||||
|
||||
private static final String TXT_CHASM = "Chasm";
|
||||
private static final String TXT_YES = "Yes, I know what I'm doing";
|
||||
private static final String TXT_NO = "No, I changed my mind";
|
||||
private static final String TXT_JUMP =
|
||||
"Do you really want to jump into the chasm? You can probably die.";
|
||||
|
||||
public static boolean jumpConfirmed = false;
|
||||
|
||||
public static void heroJump( final Hero hero ) {
|
||||
GameScene.show(
|
||||
new WndOptions( TXT_CHASM, TXT_JUMP, TXT_YES, TXT_NO ) {
|
||||
@Override
|
||||
protected void onSelect( int index ) {
|
||||
if (index == 0) {
|
||||
jumpConfirmed = true;
|
||||
hero.resume();
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static void heroFall( int pos ) {
|
||||
|
||||
jumpConfirmed = false;
|
||||
|
||||
Sample.INSTANCE.play( Assets.SND_FALLING );
|
||||
|
||||
if (Dungeon.hero.isAlive()) {
|
||||
Dungeon.hero.interrupt();
|
||||
InterlevelScene.mode = InterlevelScene.Mode.FALL;
|
||||
if (Dungeon.level instanceof RegularLevel) {
|
||||
Room room = ((RegularLevel)Dungeon.level).room( pos );
|
||||
InterlevelScene.fallIntoPit = room != null && room.type == Room.Type.WEAK_FLOOR;
|
||||
} else {
|
||||
InterlevelScene.fallIntoPit = false;
|
||||
}
|
||||
Game.switchScene( InterlevelScene.class );
|
||||
} else {
|
||||
Dungeon.hero.sprite.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void heroLand() {
|
||||
|
||||
Hero hero = Dungeon.hero;
|
||||
|
||||
hero.sprite.burst( hero.sprite.blood(), 10 );
|
||||
Camera.main.shake( 4, 0.2f );
|
||||
|
||||
Buff.prolong( hero, Cripple.class, Cripple.DURATION );
|
||||
hero.damage( Random.IntRange( hero.HT / 3, hero.HT / 2 ), new Hero.Doom() {
|
||||
@Override
|
||||
public void onDeath() {
|
||||
Badges.validateDeathFromFalling();
|
||||
|
||||
Dungeon.fail( Utils.format( ResultDescriptions.FALL, Dungeon.depth ) );
|
||||
GLog.n( "You fell to death..." );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public static void mobFall( Mob mob ) {
|
||||
// Destroy instead of kill to prevent dropping loot
|
||||
mob.destroy();
|
||||
|
||||
((MobSprite)mob.sprite).fall();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* 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.levels.features;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
|
||||
public class Door {
|
||||
|
||||
public static void enter( int pos ) {
|
||||
Level.set( pos, Terrain.OPEN_DOOR );
|
||||
GameScene.updateMap( pos );
|
||||
Dungeon.observe();
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
Sample.INSTANCE.play( Assets.SND_OPEN );
|
||||
}
|
||||
}
|
||||
|
||||
public static void leave( int pos ) {
|
||||
if (Dungeon.level.heaps.get( pos ) == null) {
|
||||
Level.set( pos, Terrain.DOOR );
|
||||
GameScene.updateMap( pos );
|
||||
Dungeon.observe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* 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.levels.features;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfHerbalism.Herbalism;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class HighGrass {
|
||||
|
||||
public static void trample( Level level, int pos, Char ch ) {
|
||||
|
||||
Level.set( pos, Terrain.GRASS );
|
||||
GameScene.updateMap( pos );
|
||||
|
||||
int herbalismLevel = 0;
|
||||
if (ch != null) {
|
||||
Herbalism herbalism = ch.buff( Herbalism.class );
|
||||
if (herbalism != null) {
|
||||
herbalismLevel = herbalism.level;
|
||||
}
|
||||
}
|
||||
|
||||
// Seed
|
||||
if (herbalismLevel >= 0 && Random.Int( 18 ) <= Random.Int( herbalismLevel + 1 )) {
|
||||
level.drop( Generator.random( Generator.Category.SEED ), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
// Dew
|
||||
if (herbalismLevel >= 0 && Random.Int( 6 ) <= Random.Int( herbalismLevel + 1 )) {
|
||||
level.drop( new Dewdrop(), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
int leaves = 4;
|
||||
|
||||
// Barkskin
|
||||
if (ch instanceof Hero && ((Hero)ch).subClass == HeroSubClass.WARDEN) {
|
||||
Buff.affect( ch, Barkskin.class ).level( ch.HT / 3 );
|
||||
leaves = 8;
|
||||
}
|
||||
|
||||
CellEmitter.get( pos ).burst( LeafParticle.LEVEL_SPECIFIC, leaves );
|
||||
Dungeon.observe();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user