V0.1.0 Partial Commit
changed package and application names to differentiate from main PD release
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob.State;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfInvisibility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Blindweed extends Plant {
|
||||
|
||||
private static final String TXT_DESC =
|
||||
"Upon being touched a Blindweed perishes in a bright flash of light." +
|
||||
"The flash is strong enough to disorient for several seconds.";
|
||||
|
||||
{
|
||||
image = 3;
|
||||
plantName = "Blindweed";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
if (ch != null) {
|
||||
int len = Random.Int( 5, 10 );
|
||||
Buff.prolong( ch, Blindness.class, len );
|
||||
Buff.prolong( ch, Cripple.class, len );
|
||||
if (ch instanceof Mob) {
|
||||
((Mob)ch).state = State.WANDERING;
|
||||
((Mob)ch).beckon( Dungeon.level.randomDestination() );
|
||||
}
|
||||
}
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
CellEmitter.get( pos ).burst( Speck.factory( Speck.LIGHT ), 4 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
|
||||
public static class Seed extends Plant.Seed {
|
||||
{
|
||||
plantName = "Blindweed";
|
||||
|
||||
name = "seed of " + plantName;
|
||||
image = ItemSpriteSheet.SEED_BLINDWEED;
|
||||
|
||||
plantClass = Blindweed.class;
|
||||
alchemyClass = PotionOfInvisibility.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfParalyticGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public class Earthroot extends Plant {
|
||||
|
||||
private static final String TXT_DESC =
|
||||
"When a creature touches an Earthroot, its roots " +
|
||||
"create a kind of immobile natural armor around it.";
|
||||
|
||||
{
|
||||
image = 5;
|
||||
plantName = "Earthroot";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
if (ch != null) {
|
||||
Buff.affect( ch, Armor.class ).level = ch.HT;
|
||||
}
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
CellEmitter.bottom( pos ).start( EarthParticle.FACTORY, 0.05f, 8 );
|
||||
Camera.main.shake( 0.25f, 1f );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
|
||||
public static class Seed extends Plant.Seed {
|
||||
{
|
||||
plantName = "Earthroot";
|
||||
|
||||
name = "seed of " + plantName;
|
||||
image = ItemSpriteSheet.SEED_EARTHROOT;
|
||||
|
||||
plantClass = Earthroot.class;
|
||||
alchemyClass = PotionOfParalyticGas.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Armor extends Buff {
|
||||
|
||||
private static final float STEP = 1f;
|
||||
|
||||
private int pos;
|
||||
private int level;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
pos = target.pos;
|
||||
return super.attachTo( target );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.pos != pos) {
|
||||
detach();
|
||||
}
|
||||
spend( STEP );
|
||||
return true;
|
||||
}
|
||||
|
||||
public int absorb( int damage ) {
|
||||
if (damage*2 >= level) {
|
||||
detach();
|
||||
return damage - level;
|
||||
} else {
|
||||
level -= damage-damage/2;
|
||||
return damage/2;
|
||||
}
|
||||
}
|
||||
|
||||
public void level( int value ) {
|
||||
if (level < value) {
|
||||
level = value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.ARMOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.format("Herbal armor (%d)", level);
|
||||
}
|
||||
|
||||
private static final String POS = "pos";
|
||||
private static final String LEVEL = "level";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( POS, pos );
|
||||
bundle.put( LEVEL, level );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
pos = bundle.getInt( POS );
|
||||
level = bundle.getInt( LEVEL );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class Fadeleaf extends Plant {
|
||||
|
||||
private static final String TXT_DESC =
|
||||
"Touching a Fadeleaf will teleport any creature " +
|
||||
"to a random place on the current level.";
|
||||
|
||||
{
|
||||
image = 6;
|
||||
plantName = "Fadeleaf";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
if (ch instanceof Hero) {
|
||||
|
||||
ScrollOfTeleportation.teleportHero( (Hero)ch );
|
||||
((Hero)ch).curAction = null;
|
||||
|
||||
} else if (ch instanceof Mob) {
|
||||
|
||||
// Why do I try to choose a new position 10 times?
|
||||
// I don't remember...
|
||||
int count = 10;
|
||||
int newPos;
|
||||
do {
|
||||
newPos = Dungeon.level.randomRespawnCell();
|
||||
if (count-- <= 0) {
|
||||
break;
|
||||
}
|
||||
} while (newPos == -1);
|
||||
|
||||
if (newPos != -1) {
|
||||
|
||||
ch.pos = newPos;
|
||||
ch.sprite.place( ch.pos );
|
||||
ch.sprite.visible = Dungeon.visible[pos];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
CellEmitter.get( pos ).start( Speck.factory( Speck.LIGHT ), 0.2f, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
|
||||
public static class Seed extends Plant.Seed {
|
||||
{
|
||||
plantName = "Fadeleaf";
|
||||
|
||||
name = "seed of " + plantName;
|
||||
image = ItemSpriteSheet.SEED_FADELEAF;
|
||||
|
||||
plantClass = Fadeleaf.class;
|
||||
alchemyClass = PotionOfMindVision.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class Firebloom extends Plant {
|
||||
|
||||
private static final String TXT_DESC = "When something touches a Firebloom, it bursts into flames.";
|
||||
|
||||
{
|
||||
image = 0;
|
||||
plantName = "Firebloom";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
GameScene.add( Blob.seed( pos, 2, Fire.class ) );
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
CellEmitter.get( pos ).burst( FlameParticle.FACTORY, 5 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
|
||||
public static class Seed extends Plant.Seed {
|
||||
{
|
||||
plantName = "Firebloom";
|
||||
|
||||
name = "seed of " + plantName;
|
||||
image = ItemSpriteSheet.SEED_FIREBLOOM;
|
||||
|
||||
plantClass = Firebloom.class;
|
||||
alchemyClass = PotionOfLiquidFlame.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
import com.watabou.utils.PathFinder;
|
||||
|
||||
public class Icecap extends Plant {
|
||||
|
||||
private static final String TXT_DESC =
|
||||
"Upon touching an Icecap excretes a pollen, which freezes everything in its vicinity.";
|
||||
|
||||
{
|
||||
image = 1;
|
||||
plantName = "Icecap";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
PathFinder.buildDistanceMap( pos, BArray.not( Level.losBlocking, null ), 1 );
|
||||
|
||||
Fire fire = (Fire)Dungeon.level.blobs.get( Fire.class );
|
||||
|
||||
for (int i=0; i < Level.LENGTH; i++) {
|
||||
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||
|
||||
Freezing.affect( i, fire );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
|
||||
public static class Seed extends Plant.Seed {
|
||||
{
|
||||
plantName = "Icecap";
|
||||
|
||||
name = "seed of " + plantName;
|
||||
image = ItemSpriteSheet.SEED_ICECAP;
|
||||
|
||||
plantClass = Icecap.class;
|
||||
alchemyClass = PotionOfFrost.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
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.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.PlantSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Plant implements Bundlable {
|
||||
|
||||
public String plantName;
|
||||
|
||||
public int image;
|
||||
public int pos;
|
||||
|
||||
public PlantSprite sprite;
|
||||
|
||||
public void activate( Char ch ) {
|
||||
|
||||
if (ch instanceof Hero && ((Hero)ch).subClass == HeroSubClass.WARDEN) {
|
||||
Buff.affect( ch, Barkskin.class ).level( ch.HT / 3 );
|
||||
}
|
||||
|
||||
wither();
|
||||
}
|
||||
|
||||
public void wither() {
|
||||
Dungeon.level.uproot( pos );
|
||||
|
||||
sprite.kill();
|
||||
if (Dungeon.visible[pos]) {
|
||||
CellEmitter.get( pos ).burst( LeafParticle.GENERAL, 6 );
|
||||
}
|
||||
|
||||
if (Dungeon.hero.subClass == HeroSubClass.WARDEN) {
|
||||
if (Random.Int( 5 ) == 0) {
|
||||
Dungeon.level.drop( Generator.random( Generator.Category.SEED ), pos ).sprite.drop();
|
||||
}
|
||||
if (Random.Int( 5 ) == 0) {
|
||||
Dungeon.level.drop( new Dewdrop(), pos ).sprite.drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final String POS = "pos";
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
pos = bundle.getInt( POS );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
bundle.put( POS, pos );
|
||||
}
|
||||
|
||||
public String desc() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Seed extends Item {
|
||||
|
||||
public static final String AC_PLANT = "PLANT";
|
||||
|
||||
private static final String TXT_INFO = "Throw this seed to the place where you want to grow %s.\n\n%s";
|
||||
|
||||
private static final float TIME_TO_PLANT = 1f;
|
||||
|
||||
{
|
||||
stackable = true;
|
||||
defaultAction = AC_THROW;
|
||||
}
|
||||
|
||||
protected Class<? extends Plant> plantClass;
|
||||
protected String plantName;
|
||||
|
||||
public Class<? extends Item> alchemyClass;
|
||||
|
||||
@Override
|
||||
public ArrayList<String> actions( Hero hero ) {
|
||||
ArrayList<String> actions = super.actions( hero );
|
||||
actions.add( AC_PLANT );
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onThrow( int cell ) {
|
||||
if (Dungeon.level.map[cell] == Terrain.ALCHEMY || Level.pit[cell]) {
|
||||
super.onThrow( cell );
|
||||
} else {
|
||||
Dungeon.level.plant( this, cell );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute( Hero hero, String action ) {
|
||||
if (action.equals( AC_PLANT )) {
|
||||
|
||||
hero.spend( TIME_TO_PLANT );
|
||||
hero.busy();
|
||||
((Seed)detach( hero.belongings.backpack )).onThrow( hero.pos );
|
||||
|
||||
hero.sprite.operate( hero.pos );
|
||||
|
||||
} else {
|
||||
|
||||
super.execute (hero, action );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Plant couch( int pos ) {
|
||||
try {
|
||||
Sample.INSTANCE.play( Assets.SND_PLANT );
|
||||
Plant plant = plantClass.newInstance();
|
||||
plant.pos = pos;
|
||||
return plant;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUpgradable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIdentified() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int price() {
|
||||
return 10 * quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String info() {
|
||||
return String.format( TXT_INFO, Utils.indefinite( plantName ), desc() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PoisonParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfToxicGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
|
||||
public class Sorrowmoss extends Plant {
|
||||
|
||||
private static final String TXT_DESC =
|
||||
"A Sorrowmoss is a flower (not a moss) with razor-sharp petals, coated with a deadly venom.";
|
||||
|
||||
{
|
||||
image = 2;
|
||||
plantName = "Sorrowmoss";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
if (ch != null) {
|
||||
Buff.affect( ch, Poison.class ).set( 5 + Math.min( Dungeon.depth, 15 ) );
|
||||
}
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
CellEmitter.center( pos ).burst( PoisonParticle.SPLASH, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
|
||||
public static class Seed extends Plant.Seed {
|
||||
{
|
||||
plantName = "Sorrowmoss";
|
||||
|
||||
name = "seed of " + plantName;
|
||||
image = ItemSpriteSheet.SEED_SORROWMOSS;
|
||||
|
||||
plantClass = Sorrowmoss.class;
|
||||
alchemyClass = PotionOfToxicGas.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public class Sungrass extends Plant {
|
||||
|
||||
private static final String TXT_DESC = "Sungrass is renowned for its sap's healing properties.";
|
||||
|
||||
{
|
||||
image = 4;
|
||||
plantName = "Sungrass";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
|
||||
if (ch != null) {
|
||||
Buff.affect( ch, Health.class );
|
||||
}
|
||||
|
||||
if (Dungeon.visible[pos]) {
|
||||
CellEmitter.get( pos ).start( ShaftParticle.FACTORY, 0.2f, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
|
||||
public static class Seed extends Plant.Seed {
|
||||
{
|
||||
plantName = "Sungrass";
|
||||
|
||||
name = "seed of " + plantName;
|
||||
image = ItemSpriteSheet.SEED_SUNGRASS;
|
||||
|
||||
plantClass = Sungrass.class;
|
||||
alchemyClass = PotionOfHealing.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return TXT_DESC;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Health extends Buff {
|
||||
|
||||
private static final float STEP = 1f;
|
||||
|
||||
private int pos;
|
||||
private int healCurr = 2;
|
||||
private int count = 5;
|
||||
private int healTot;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
pos = target.pos;
|
||||
healTot = target.HT;
|
||||
return super.attachTo( target );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.pos != pos || healTot <= 0) {
|
||||
detach();
|
||||
}
|
||||
if (count == 5) {
|
||||
if (healTot <= healCurr) {
|
||||
target.HP = Math.min(target.HT, target.HP + healTot);
|
||||
target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
|
||||
detach();
|
||||
} else {
|
||||
target.HP = Math.min(target.HT, target.HP + healCurr);
|
||||
healTot -= healCurr;
|
||||
healCurr = Math.min(healCurr+healCurr-1,(int)(target.HT*0.15));
|
||||
target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
|
||||
}
|
||||
count = 1;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
spend( STEP );
|
||||
return true;
|
||||
}
|
||||
|
||||
public int absorb( int damage ) {
|
||||
healTot -= damage;
|
||||
if (healTot <= 0)
|
||||
detach();
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.HEALING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.format( "Herbal Healing (%d)", healTot);
|
||||
}
|
||||
|
||||
private static final String POS = "pos";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( POS, pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
pos = bundle.getInt( POS );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user