V0.1.0 Partial Commit
changed package and application names to differentiate from main PD release
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Amok extends FlavourBuff {
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.AMOK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Amok";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
|
||||
public class Awareness extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 2f;
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
Dungeon.observe();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Barkskin extends Buff {
|
||||
|
||||
private int level = 0;
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
spend( TICK );
|
||||
if (--level <= 0) {
|
||||
detach();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
detach();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int level() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void level( int value ) {
|
||||
if (level < value) {
|
||||
level = value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.BARKSKIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Barkskin";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Bleeding extends Buff {
|
||||
|
||||
protected int level;
|
||||
|
||||
private static final String LEVEL = "level";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEVEL, level );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
level = bundle.getInt( LEVEL );
|
||||
}
|
||||
|
||||
public void set( int level ) {
|
||||
this.level = level;
|
||||
};
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.BLEEDING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Bleeding";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
if ((level = Random.Int( level / 2, level )) > 0) {
|
||||
|
||||
target.damage( level, this );
|
||||
if (target.sprite.visible) {
|
||||
Splash.at( target.sprite.center(), -PointF.PI / 2, PointF.PI / 6,
|
||||
target.sprite.blood(), Math.min( 10 * level / target.HT, 10 ) );
|
||||
}
|
||||
|
||||
if (target == Dungeon.hero && !target.isAlive()) {
|
||||
Dungeon.fail( Utils.format( ResultDescriptions.BLEEDING, Dungeon.depth ) );
|
||||
GLog.n( "You bled to death..." );
|
||||
}
|
||||
|
||||
spend( TICK );
|
||||
} else {
|
||||
detach();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
detach();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Blindness extends FlavourBuff {
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
Dungeon.observe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.BLINDNESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Blinded";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Buff extends Actor {
|
||||
|
||||
public Char target;
|
||||
|
||||
public boolean attachTo( Char target ) {
|
||||
|
||||
if (target.immunities().contains( getClass() )) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.target = target;
|
||||
target.add( this );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
target.remove( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
diactivate();
|
||||
return true;
|
||||
}
|
||||
|
||||
public int icon() {
|
||||
return BuffIndicator.NONE;
|
||||
}
|
||||
|
||||
public static<T extends Buff> T affect( Char target, Class<T> buffClass ) {
|
||||
T buff = target.buff( buffClass );
|
||||
if (buff != null) {
|
||||
return buff;
|
||||
} else {
|
||||
try {
|
||||
buff = buffClass.newInstance();
|
||||
buff.attachTo( target );
|
||||
return buff;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static<T extends FlavourBuff> T affect( Char target, Class<T> buffClass, float duration ) {
|
||||
T buff = affect( target, buffClass );
|
||||
buff.spend( duration );
|
||||
return buff;
|
||||
}
|
||||
|
||||
public static<T extends FlavourBuff> T prolong( Char target, Class<T> buffClass, float duration ) {
|
||||
T buff = affect( target, buffClass );
|
||||
buff.postpone( duration );
|
||||
return buff;
|
||||
}
|
||||
|
||||
public static void detach( Buff buff ) {
|
||||
if (buff != null) {
|
||||
buff.detach();
|
||||
}
|
||||
}
|
||||
|
||||
public static void detach( Char target, Class<? extends Buff> cl ) {
|
||||
detach( target.buff( cl ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Burning extends Buff implements Hero.Doom {
|
||||
|
||||
private static final String TXT_BURNS_UP = "%s burns up!";
|
||||
private static final String TXT_BURNED_TO_DEATH = "You burned to death...";
|
||||
|
||||
private static final float DURATION = 8f;
|
||||
|
||||
private float left;
|
||||
|
||||
private static final String LEFT = "left";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEFT, left );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
left = bundle.getFloat( LEFT );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
|
||||
if (target.isAlive()) {
|
||||
|
||||
if (target instanceof Hero) {
|
||||
Buff.prolong( target, Light.class, TICK * 1.01f );
|
||||
}
|
||||
|
||||
target.damage( Random.Int( 1, 5 ), this );
|
||||
|
||||
if (target instanceof Hero) {
|
||||
|
||||
Item item = ((Hero)target).belongings.randomUnequipped();
|
||||
if (item instanceof Scroll) {
|
||||
|
||||
item = item.detach( ((Hero)target).belongings.backpack );
|
||||
GLog.w( TXT_BURNS_UP, item.toString() );
|
||||
|
||||
Heap.burnFX( target.pos );
|
||||
|
||||
} else if (item instanceof MysteryMeat) {
|
||||
|
||||
item = item.detach( ((Hero)target).belongings.backpack );
|
||||
ChargrilledMeat steak = new ChargrilledMeat();
|
||||
if (!steak.collect( ((Hero)target).belongings.backpack )) {
|
||||
Dungeon.level.drop( steak, target.pos ).sprite.drop();
|
||||
}
|
||||
GLog.w( TXT_BURNS_UP, item.toString() );
|
||||
|
||||
Heap.burnFX( target.pos );
|
||||
|
||||
}
|
||||
|
||||
} else if (target instanceof Thief && ((Thief)target).item instanceof Scroll) {
|
||||
|
||||
((Thief)target).item = null;
|
||||
target.sprite.emitter().burst( ElmoParticle.FACTORY, 6 );
|
||||
}
|
||||
|
||||
} else {
|
||||
detach();
|
||||
}
|
||||
|
||||
if (Level.flamable[target.pos]) {
|
||||
GameScene.add( Blob.seed( target.pos, 4, Fire.class ) );
|
||||
}
|
||||
|
||||
spend( TICK );
|
||||
left -= TICK;
|
||||
|
||||
if (left <= 0 ||
|
||||
Random.Float() > (2 + (float)target.HP / target.HT) / 3 ||
|
||||
(Level.water[target.pos] && !target.flying)) {
|
||||
|
||||
detach();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void reignite( Char ch ) {
|
||||
left = duration( ch );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.FIRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Burning";
|
||||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath() {
|
||||
|
||||
Badges.validateDeathFromFire();
|
||||
|
||||
Dungeon.fail( Utils.format( ResultDescriptions.BURNING, Dungeon.depth ) );
|
||||
GLog.n( TXT_BURNED_TO_DEATH );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Charm extends FlavourBuff {
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
target.pacified = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.pacified = false;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.HEART;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Charmed";
|
||||
}
|
||||
|
||||
public static float durationFactor( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() : 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
public class Combo extends Buff {
|
||||
|
||||
private static String TXT_COMBO = "%d hit combo!";
|
||||
|
||||
public int count = 0;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.COMBO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Combo";
|
||||
}
|
||||
|
||||
public int hit( Char enemy, int damage ) {
|
||||
|
||||
count++;
|
||||
|
||||
if (count >= 3) {
|
||||
|
||||
Badges.validateMasteryCombo( count );
|
||||
|
||||
GLog.p( TXT_COMBO, count );
|
||||
postpone( 1.41f - count / 10f );
|
||||
return (int)(damage * (count - 2) / 5f);
|
||||
|
||||
} else {
|
||||
|
||||
postpone( 1.1f );
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
detach();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Cripple extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 10f;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.CRIPPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Crippled";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
// Special kind of buff, that doesn't perform any kind actions
|
||||
public class FlavourBuff extends Buff {
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
detach();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Frost extends FlavourBuff {
|
||||
|
||||
private static final float DURATION = 5f;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
|
||||
target.paralysed = true;
|
||||
Burning.detach( target, Burning.class );
|
||||
|
||||
if (target instanceof Hero) {
|
||||
Hero hero = (Hero)target;
|
||||
Item item = hero.belongings.randomUnequipped();
|
||||
if (item instanceof MysteryMeat) {
|
||||
|
||||
item = item.detach( hero.belongings.backpack );
|
||||
FrozenCarpaccio carpaccio = new FrozenCarpaccio();
|
||||
if (!carpaccio.collect( hero.belongings.backpack )) {
|
||||
Dungeon.level.drop( carpaccio, target.pos ).sprite.drop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.paralysed = false;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.FROST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Frozen";
|
||||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
}
|
||||
@@ -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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Fury extends Buff {
|
||||
|
||||
public static float LEVEL = 0.4f;
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.HP > target.HT * LEVEL) {
|
||||
detach();
|
||||
}
|
||||
|
||||
spend( TICK );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.FURY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Fury";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class GasesImmunity extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 5f;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.IMMUNITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Immune to gases";
|
||||
}
|
||||
|
||||
public static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
|
||||
static {
|
||||
IMMUNITIES.add( Paralysis.class );
|
||||
IMMUNITIES.add( ToxicGas.class );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSatiety;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Hunger extends Buff implements Hero.Doom {
|
||||
|
||||
private static final float STEP = 10f;
|
||||
|
||||
public static final float HUNGRY = 260f;
|
||||
public static final float STARVING = 360f;
|
||||
|
||||
private static final String TXT_HUNGRY = "You are hungry.";
|
||||
private static final String TXT_STARVING = "You are starving!";
|
||||
private static final String TXT_DEATH = "You starved to death...";
|
||||
|
||||
private float level;
|
||||
|
||||
private static final String LEVEL = "level";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEVEL, level );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
level = bundle.getFloat( LEVEL );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
Hero hero = (Hero)target;
|
||||
|
||||
if (isStarving()) {
|
||||
|
||||
if (Random.Float() < 0.3f && (target.HP > 1 || !target.paralysed)) {
|
||||
|
||||
GLog.n( TXT_STARVING );
|
||||
hero.damage( 1, this );
|
||||
|
||||
hero.interrupt();
|
||||
}
|
||||
} else {
|
||||
|
||||
int bonus = 0;
|
||||
for (Buff buff : target.buffs( RingOfSatiety.Satiety.class )) {
|
||||
bonus += ((RingOfSatiety.Satiety)buff).level;
|
||||
}
|
||||
|
||||
float newLevel = level + STEP - bonus;
|
||||
boolean statusUpdated = false;
|
||||
if (newLevel >= STARVING) {
|
||||
|
||||
GLog.n( TXT_STARVING );
|
||||
statusUpdated = true;
|
||||
|
||||
hero.interrupt();
|
||||
|
||||
} else if (newLevel >= HUNGRY && level < HUNGRY) {
|
||||
|
||||
GLog.w( TXT_HUNGRY );
|
||||
statusUpdated = true;
|
||||
|
||||
}
|
||||
level = newLevel;
|
||||
|
||||
if (statusUpdated) {
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float step = ((Hero)target).heroClass == HeroClass.ROGUE ? STEP * 1.2f : STEP;
|
||||
spend( target.buff( Shadows.class ) == null ? step : step * 1.5f );
|
||||
|
||||
} else {
|
||||
|
||||
diactivate();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void satisfy( float energy ) {
|
||||
level -= energy;
|
||||
if (level < 0) {
|
||||
level = 0;
|
||||
} else if (level > STARVING) {
|
||||
level = STARVING;
|
||||
}
|
||||
|
||||
BuffIndicator.refreshHero();
|
||||
}
|
||||
|
||||
public boolean isStarving() {
|
||||
return level >= STARVING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
if (level < HUNGRY) {
|
||||
return BuffIndicator.NONE;
|
||||
} else if (level < STARVING) {
|
||||
return BuffIndicator.HUNGER;
|
||||
} else {
|
||||
return BuffIndicator.STARVATION;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (level < STARVING) {
|
||||
return "Hungry";
|
||||
} else {
|
||||
return "Starving";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath() {
|
||||
|
||||
Badges.validateDeathFromHunger();
|
||||
|
||||
Dungeon.fail( Utils.format( ResultDescriptions.HUNGER, Dungeon.depth ) );
|
||||
GLog.n( TXT_DEATH );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Invisibility extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 15f;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
target.invisible++;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.invisible--;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.INVISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Invisible";
|
||||
}
|
||||
|
||||
public static void dispel() {
|
||||
Invisibility buff = Dungeon.hero.buff( Invisibility.class );
|
||||
if (buff != null && Dungeon.hero.visibleEnemies() > 0) {
|
||||
buff.detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Levitation extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 20f;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
target.flying = true;
|
||||
Roots.detach( target, Roots.class );
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.flying = false;
|
||||
Dungeon.level.press( target.pos, target );
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.LEVITATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Levitating";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Light extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 250f;
|
||||
public static final int DISTANCE = 4;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
// When a level is loading, do nothing
|
||||
if (Dungeon.level != null) {
|
||||
target.viewDistance = Math.max( Dungeon.level.viewDistance, DISTANCE );
|
||||
Dungeon.observe();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.viewDistance = Dungeon.level.viewDistance;
|
||||
Dungeon.observe();
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.LIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Illuminated";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class MindVision extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 20f;
|
||||
|
||||
public int distance = 2;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.MIND_VISION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Mind vision";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
Dungeon.observe();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
|
||||
public class Ooze extends Buff {
|
||||
|
||||
private static final String TXT_HERO_KILLED = "%s killed you...";
|
||||
|
||||
public int damage = 1;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.OOZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Caustic ooze";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
target.damage( damage, this );
|
||||
if (!target.isAlive() && target == Dungeon.hero) {
|
||||
Dungeon.fail( Utils.format( ResultDescriptions.OOZE, Dungeon.depth ) );
|
||||
GLog.n( TXT_HERO_KILLED, toString() );
|
||||
}
|
||||
spend( TICK );
|
||||
}
|
||||
if (Level.water[target.pos]) {
|
||||
detach();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Paralysis extends FlavourBuff {
|
||||
|
||||
private static final float DURATION = 10f;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
target.paralysed = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.paralysed = false;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.PARALYSIS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Paralysed";
|
||||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public class Poison extends Buff implements Hero.Doom {
|
||||
|
||||
public static final int DOT = 2;
|
||||
|
||||
protected float left;
|
||||
|
||||
private static final String LEFT = "left";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEFT, left );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
left = bundle.getFloat( LEFT );
|
||||
}
|
||||
|
||||
public void set( float duration ) {
|
||||
this.left = duration;
|
||||
};
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.POISON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Poisoned";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
target.damage( DOT, this );
|
||||
spend( TICK );
|
||||
|
||||
if ((left -= TICK) <= 0) {
|
||||
detach();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
detach();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static float durationFactor( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath() {
|
||||
Badges.validateDeathFromPoison();
|
||||
|
||||
Dungeon.fail( Utils.format( ResultDescriptions.POISON, Dungeon.depth ) );
|
||||
GLog.n( "You died from poison..." );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMending;
|
||||
|
||||
public class Regeneration extends Buff {
|
||||
|
||||
private static final float REGENERATION_DELAY = 10;
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
if (target.HP < target.HT && !((Hero)target).isStarving()) {
|
||||
target.HP += 1;
|
||||
}
|
||||
|
||||
int bonus = 0;
|
||||
for (Buff buff : target.buffs( RingOfMending.Rejuvenation.class )) {
|
||||
bonus += ((RingOfMending.Rejuvenation)buff).level;
|
||||
}
|
||||
|
||||
spend( (float)(REGENERATION_DELAY / Math.pow( 1.2, bonus )) );
|
||||
|
||||
} else {
|
||||
|
||||
diactivate();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Roots extends FlavourBuff {
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (!target.flying && super.attachTo( target )) {
|
||||
target.rooted = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
target.rooted = false;
|
||||
super.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.ROOTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Rooted";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
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.ui.BuffIndicator;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public class Shadows extends Invisibility {
|
||||
|
||||
protected float left;
|
||||
|
||||
private static final String LEFT = "left";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEFT, left );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
left = bundle.getFloat( LEFT );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
Sample.INSTANCE.play( Assets.SND_MELD );
|
||||
Dungeon.observe();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
Dungeon.observe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
spend( TICK * 2 );
|
||||
|
||||
if (--left <= 0 || Dungeon.hero.visibleEnemies() > 0) {
|
||||
detach();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
detach();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void prolong() {
|
||||
left = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.SHADOWS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Shadowmelded";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
public class Sleep extends FlavourBuff {
|
||||
|
||||
public static final float SWS = 1.5f;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Slow extends FlavourBuff {
|
||||
|
||||
private static final float DURATION = 10f;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.SLOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Slowed";
|
||||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class SnipersMark extends FlavourBuff {
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.MARK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Sniper's mark";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
public class Speed extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 10f;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public class Terror extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 10f;
|
||||
public Char source;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.TERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
// It's not really correct...
|
||||
source = Dungeon.hero;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Terror";
|
||||
}
|
||||
|
||||
public static void recover( Char target ) {
|
||||
Terror terror = target.buff( Terror.class );
|
||||
if (terror != null && terror.cooldown() < DURATION) {
|
||||
target.remove( terror );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Weakness extends FlavourBuff {
|
||||
|
||||
private static final float DURATION = 40f;
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.WEAKNESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Weakened";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
Hero hero = (Hero)target;
|
||||
hero.weakened = true;
|
||||
hero.belongings.discharge();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
((Hero)target).weakened = false;
|
||||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user