V0.1.0 Partial Commit
changed package and application names to differentiate from main PD release
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.items.armor.glyphs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Charm;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.watabou.utils.GameMath;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Affection extends Glyph {
|
||||
|
||||
private static final String TXT_AFFECTION = "%s of affection";
|
||||
|
||||
private static ItemSprite.Glowing PINK = new ItemSprite.Glowing( 0xFF4488 );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
||||
|
||||
int level = (int)GameMath.gate( 0, armor.level, 6 );
|
||||
|
||||
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level / 2 + 5 ) >= 4) {
|
||||
|
||||
int duration = Random.IntRange( 2, 5 );
|
||||
|
||||
Buff.affect( attacker, Charm.class, Charm.durationFactor( attacker ) * duration );
|
||||
attacker.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
|
||||
|
||||
Buff.affect( defender, Charm.class, Random.Float( Charm.durationFactor( defender ) * duration / 2, duration ) );
|
||||
defender.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_AFFECTION, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return PINK;
|
||||
}
|
||||
}
|
||||
@@ -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.items.armor.glyphs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SnowParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class AntiEntropy extends Glyph {
|
||||
|
||||
private static final String TXT_ANTI_ENTROPY = "%s of anti-entropy";
|
||||
|
||||
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x0000FF );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
|
||||
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 6 ) >= 5) {
|
||||
|
||||
Buff.prolong( attacker, Frost.class, Frost.duration( attacker ) * Random.Float( 1f, 1.5f ));
|
||||
CellEmitter.get( attacker.pos ).start( SnowParticle.FACTORY, 0.2f, 6 );
|
||||
|
||||
Buff.affect( defender, Burning.class ).reignite( defender );
|
||||
defender.sprite.emitter().burst( FlameParticle.FACTORY, 5 );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_ANTI_ENTROPY, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return BLUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Bounce extends Glyph {
|
||||
|
||||
private static final String TXT_BOUNCE = "%s of bounce";
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
|
||||
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5) >= 4) {
|
||||
|
||||
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
|
||||
int ofs = Level.NEIGHBOURS8[i];
|
||||
if (attacker.pos - defender.pos == ofs) {
|
||||
int newPos = attacker.pos + ofs;
|
||||
if ((Level.passable[newPos] || Level.avoid[newPos]) && Actor.findChar( newPos ) == null) {
|
||||
|
||||
Actor.addDelayed( new Pushing( attacker, attacker.pos, newPos ), -1 );
|
||||
|
||||
attacker.pos = newPos;
|
||||
// ��� ��� ��� ����� :(
|
||||
if (attacker instanceof Mob) {
|
||||
Dungeon.level.mobPress( (Mob)attacker );
|
||||
} else {
|
||||
Dungeon.level.press( newPos, attacker );
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_BOUNCE, weaponName );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.items.armor.glyphs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlink;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Displacement extends Glyph {
|
||||
|
||||
private static final String TXT_DISPLACEMENT = "%s of displacement";
|
||||
|
||||
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x66AAFF );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
|
||||
|
||||
if (Dungeon.bossLevel()) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
int nTries = (armor.level < 0 ? 1 : armor.level + 1) * 5;
|
||||
for (int i=0; i < nTries; i++) {
|
||||
int pos = Random.Int( Level.LENGTH );
|
||||
if (Dungeon.visible[pos] && Level.passable[pos] && Actor.findChar( pos ) == null) {
|
||||
|
||||
WandOfBlink.appear( defender, pos );
|
||||
Dungeon.level.press( pos, defender );
|
||||
Dungeon.observe();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_DISPLACEMENT, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return BLUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.items.armor.glyphs;
|
||||
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Entanglement extends Glyph {
|
||||
|
||||
private static final String TXT_ENTANGLEMENT = "%s of entanglement";
|
||||
|
||||
private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x448822 );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
|
||||
if (Random.Int( 4 ) == 0) {
|
||||
|
||||
Buff.prolong( defender, Roots.class, 5 - level / 5 );
|
||||
Buff.affect( defender, Earthroot.Armor.class ).level( 5 * (level + 1) );
|
||||
CellEmitter.bottom( defender.pos ).start( EarthParticle.FACTORY, 0.05f, 8 );
|
||||
Camera.main.shake( 1, 0.4f );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_ENTANGLEMENT, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return GREEN;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.items.armor.glyphs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Metabolism extends Glyph {
|
||||
|
||||
private static final String TXT_METABOLISM = "%s of metabolism";
|
||||
|
||||
private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0xCC0000 );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
if (Random.Int( level / 2 + 5 ) >= 4) {
|
||||
|
||||
int healing = Math.min( defender.HT - defender.HP, Random.Int( 1, defender.HT / 5 ) );
|
||||
|
||||
if (healing > 0) {
|
||||
|
||||
Hunger hunger = defender.buff( Hunger.class );
|
||||
|
||||
if (hunger != null && !hunger.isStarving()) {
|
||||
|
||||
hunger.satisfy( -Hunger.STARVING / 10 );
|
||||
BuffIndicator.refreshHero();
|
||||
|
||||
defender.HP += healing;
|
||||
defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
|
||||
defender.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( healing ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_METABOLISM, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return RED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.items.armor.glyphs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlink;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Multiplicity extends Glyph {
|
||||
|
||||
private static final String TXT_MULTIPLICITY = "%s of multiplicity";
|
||||
|
||||
private static ItemSprite.Glowing PINK = new ItemSprite.Glowing( 0xCCAA88 );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
|
||||
if (Random.Int( level / 2 + 6 ) >= 5) {
|
||||
|
||||
ArrayList<Integer> respawnPoints = new ArrayList<Integer>();
|
||||
|
||||
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
|
||||
int p = defender.pos + Level.NEIGHBOURS8[i];
|
||||
if (Actor.findChar( p ) == null && (Level.passable[p] || Level.avoid[p])) {
|
||||
respawnPoints.add( p );
|
||||
}
|
||||
}
|
||||
|
||||
if (respawnPoints.size() > 0) {
|
||||
MirrorImage mob = new MirrorImage();
|
||||
mob.duplicate( (Hero)defender );
|
||||
GameScene.add( mob );
|
||||
WandOfBlink.appear( mob, Random.element( respawnPoints ) );
|
||||
|
||||
defender.damage( Random.IntRange( 1, defender.HT / 6 ), /*attacker*/ this );
|
||||
checkOwner( defender );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_MULTIPLICITY, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return PINK;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2014 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
|
||||
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Lightning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.LightningTrap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Potential extends Glyph {
|
||||
|
||||
private static final String TXT_POTENTIAL = "%s of potential";
|
||||
|
||||
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x66CCEE );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
|
||||
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 7 ) >= 6) {
|
||||
|
||||
int dmg = Random.IntRange( 1, damage );
|
||||
attacker.damage( dmg, LightningTrap.LIGHTNING );
|
||||
dmg = Random.IntRange( 1, dmg );
|
||||
defender.damage( dmg, LightningTrap.LIGHTNING );
|
||||
|
||||
checkOwner( defender );
|
||||
if (defender == Dungeon.hero) {
|
||||
Camera.main.shake( 2, 0.3f );
|
||||
}
|
||||
|
||||
int[] points = {attacker.pos, defender.pos};
|
||||
attacker.sprite.parent.add( new Lightning( points, 2, null ) );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_POTENTIAL, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return BLUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.items.armor.glyphs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Stench extends Glyph {
|
||||
|
||||
private static final String TXT_STENCH = "%s of stench";
|
||||
|
||||
private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x22CC44 );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage) {
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
|
||||
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5 ) >= 4) {
|
||||
|
||||
GameScene.add( Blob.seed( attacker.pos, 20, ToxicGas.class ) );
|
||||
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_STENCH, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return GREEN;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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.items.armor.glyphs;
|
||||
|
||||
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.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
|
||||
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 Viscosity extends Glyph {
|
||||
|
||||
private static final String TXT_VISCOSITY = "%s of viscosity";
|
||||
|
||||
private static ItemSprite.Glowing PURPLE = new ItemSprite.Glowing( 0x8844CC );
|
||||
|
||||
@Override
|
||||
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
|
||||
|
||||
if (damage == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int level = Math.max( 0, armor.level );
|
||||
|
||||
if (Random.Int( level + 7 ) >= 6) {
|
||||
|
||||
DeferedDamage debuff = defender.buff( DeferedDamage.class );
|
||||
if (debuff == null) {
|
||||
debuff = new DeferedDamage();
|
||||
debuff.attachTo( defender );
|
||||
}
|
||||
debuff.prolong( damage );
|
||||
|
||||
defender.sprite.showStatus( CharSprite.WARNING, "deferred %d", damage );
|
||||
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name( String weaponName) {
|
||||
return String.format( TXT_VISCOSITY, weaponName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Glowing glowing() {
|
||||
return PURPLE;
|
||||
}
|
||||
|
||||
public static class DeferedDamage extends Buff {
|
||||
|
||||
protected int damage = 0;
|
||||
|
||||
private static final String DAMAGE = "damage";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( DAMAGE, damage );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
damage = bundle.getInt( DAMAGE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
postpone( TICK );
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void prolong( int damage ) {
|
||||
this.damage += damage;
|
||||
};
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.DEFERRED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.format( "Defered damage (%d)", damage );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
||||
target.damage( 1, this );
|
||||
if (target == Dungeon.hero && !target.isAlive()) {
|
||||
// Refactoring needed!
|
||||
Glyph glyph = new Viscosity();
|
||||
Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, glyph.name(), Dungeon.depth ) );
|
||||
GLog.n( "%s killed you...", glyph.name() );
|
||||
|
||||
Badges.validateDeathFromGlyph();
|
||||
}
|
||||
spend( TICK );
|
||||
|
||||
if (--damage <= 0) {
|
||||
detach();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
detach();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user