v0.4.0: implemented new glyphs

This commit is contained in:
Evan Debenham 2016-06-04 21:54:37 -04:00
parent 14a8fbdd63
commit 6172b46175
23 changed files with 568 additions and 177 deletions

View File

@ -145,7 +145,9 @@ public class ShatteredPixelDungeon extends Game {
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion.class,
"com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Bounce" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion.class,
"com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Displacement" );
}

View File

@ -27,9 +27,11 @@ 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.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
@ -45,8 +47,6 @@ 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 float DURATION = 8f;
private float left;
@ -76,12 +76,25 @@ public class Burning extends Buff implements Hero.Doom {
//maximum damage scales from 6 to 2 depending on remaining hp.
int maxDmg = 3 + Math.round( 4 * target.HP / (float)target.HT );
target.damage( Random.Int( 1, maxDmg ), this );
int damage = Random.Int( 1, maxDmg );
Buff.detach( target, Chill.class);
if (target instanceof Hero) {
Hero hero = (Hero)target;
if (hero.belongings.armor != null && hero.belongings.armor.glyph != null
&& hero.belongings.armor.glyph instanceof Brimstone){
int heal = hero.belongings.armor.level()/2;
if (heal > 0 && hero.HP < hero.HT) {
hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
hero.HP = Math.min(hero.HT, hero.HP + heal);
}
} else {
hero.damage( damage, this );
Item item = hero.belongings.randomUnequipped();
if (item instanceof Scroll) {
@ -103,8 +116,13 @@ public class Burning extends Buff implements Hero.Doom {
}
} else if (target instanceof Thief && ((Thief)target).item instanceof Scroll) {
}
} else {
target.damage( damage, this );
}
if (target instanceof Thief && ((Thief)target).item instanceof Scroll) {
((Thief)target).item = null;
target.sprite.emitter().burst( ElmoParticle.FACTORY, 6 );
}

View File

@ -221,39 +221,12 @@ public class Belongings implements Iterable<Item> {
}
}
public int charge( boolean full) {
public int charge( float charge ) {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand)item;
if (wand.curCharges < wand.maxCharges) {
wand.curCharges = full ? wand.maxCharges : wand.curCharges + 1;
count++;
wand.updateQuickslot();
}
}
}
return count;
}
public int discharge() {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand)item;
if (wand.curCharges > 0) {
wand.curCharges--;
count++;
wand.updateQuickslot();
}
}
for (Wand.Charger charger : owner.buffs(Wand.Charger.class)){
charger.gainCharge(charge);
}
return count;

View File

@ -54,6 +54,11 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Flow;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Obfuscation;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Swiftness;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
@ -287,11 +292,14 @@ public class Hero extends Char {
return (int)(defenseSkill * evasion / Math.pow( 1.5, aEnc ));
} else {
if (heroClass == HeroClass.ROGUE) {
return (int)((defenseSkill - aEnc) * evasion);
} else {
return (int)(defenseSkill * evasion);
}
bonus = 0;
if (heroClass == HeroClass.ROGUE) bonus += -aEnc;
if (belongings.armor != null && belongings.armor.glyph != null
&& belongings.armor.glyph instanceof Swiftness)
bonus += belongings.armor.level()*2;
return Math.round((defenseSkill + bonus) * evasion);
}
}
@ -345,7 +353,18 @@ public class Hero extends Char {
if (hasteLevel != 0)
speed *= Math.pow(1.2, hasteLevel);
int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 0;
Armor armor = belongings.armor;
if (armor != null && armor.glyph != null){
if (armor.glyph instanceof Swiftness) {
speed *= (1.1f + 0.01f * belongings.armor.level());
} else if (armor.glyph instanceof Flow && Level.water[pos]){
speed *= (1.5f + 0.05f * belongings.armor.level());
}
}
int aEnc = armor != null ? armor.STRReq() - STR() : 0;
if (aEnc > 0) {
return (float)(speed / Math.pow( 1.2, aEnc ));
@ -938,6 +957,12 @@ public class Hero extends Char {
if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health.
dmg = (int)Math.ceil((float)dmg * Math.pow(0.9, tenacity*((float)(HT - HP)/HT)));
//TODO improve this when I have proper damage source logic
if (belongings.armor != null && belongings.armor.glyph != null
&& belongings.armor.glyph instanceof AntiMagic && RingOfElements.FULL.contains(src.getClass())){
dmg -= Random.IntRange(0, belongings.armor.DR()/2);
}
super.damage( dmg, src );
}
@ -1210,6 +1235,10 @@ public class Hero extends Char {
for (Buff buff : buffs( RingOfEvasion.Evasion.class )) {
stealth += ((RingOfEvasion.Evasion)buff).effectiveLevel;
}
if (belongings.armor != null && belongings.armor.glyph != null
&& belongings.armor.glyph instanceof Obfuscation){
stealth += belongings.armor.level();
}
return stealth;
}

View File

@ -30,14 +30,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Affection;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiEntropy;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Displacement;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Entanglement;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Metabolism;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Multiplicity;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Flow;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Obfuscation;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Repulsion;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stench;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Swiftness;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Thorns;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
@ -204,7 +207,11 @@ public class Armor extends EquipableItem {
}
public int DR(){
return tier * (2 + level() + (glyph == null ? 0 : 1));
int effectiveTier = tier;
if (glyph != null) effectiveTier += glyph.tierDRAdjust();
effectiveTier = Math.max(0, effectiveTier);
return effectiveTier * (2 + level());
}
@Override
@ -332,8 +339,12 @@ public class Armor extends EquipableItem {
public int STRReq(int lvl){
lvl = Math.max(0, lvl);
int effectiveTier = tier;
if (glyph != null) effectiveTier += glyph.tierSTRAdjust();
effectiveTier = Math.max(0, effectiveTier);
//strength req decreases at +1,+3,+6,+10,etc.
return (8 + tier * 2) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
return (8 + effectiveTier * 2) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
public int typicalDR() {
@ -391,11 +402,14 @@ public class Armor extends EquipableItem {
public static abstract class Glyph implements Bundlable {
private static final Class<?>[] glyphs = new Class<?>[]{
Repulsion.class, Affection.class, AntiEntropy.class, Multiplicity.class,
Potential.class, Metabolism.class, Stench.class, Viscosity.class,
Displacement.class, Entanglement.class };
Obfuscation.class, Swiftness.class, Stone.class, Potential.class,
Brimstone.class, Viscosity.class, Entanglement.class, Repulsion.class, Camouflage.class, Flow.class,
Affection.class, AntiMagic.class, Thorns.class };
private static final float[] chances= new float[]{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
private static final float[] chances= new float[]{
10, 10, 10, 10,
5, 5, 5, 500, 5, 5,
2, 2, 2 };
public abstract int proc( Armor armor, Char attacker, Char defender, int damage );
@ -417,6 +431,14 @@ public class Armor extends EquipableItem {
public abstract ItemSprite.Glowing glowing();
public int tierDRAdjust(){
return 0;
}
public int tierSTRAdjust(){
return 0;
}
public boolean checkOwner( Char owner ) {
if (!owner.isAlive() && owner instanceof Hero) {

View File

@ -26,10 +26,8 @@ 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 {
@ -39,19 +37,16 @@ public class Affection extends Glyph {
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage) {
int level = (int)GameMath.gate( 0, armor.level(), 6 );
//TODO balancing
int level = Math.max(0, armor.level());
if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level / 2 + 5 ) >= 4) {
if (Random.Int( level / 2 + 10 ) >= 9) {
int duration = Random.IntRange( 3, 7 );
int duration = Random.IntRange( 2, 5 );
Buff.affect( attacker, Charm.class, Charm.durationFactor( attacker ) * duration ).object = defender.id();
attacker.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
duration *= Random.Float( 0.5f, 1 );
Buff.affect( defender, Charm.class, Charm.durationFactor( defender ) * duration ).object = attacker.id();
defender.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 );
}
return damage;

View File

@ -0,0 +1,42 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
public class AntiMagic extends Armor.Glyph {
private static ItemSprite.Glowing TEAL = new ItemSprite.Glowing( 0x88EEFF );
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see Hero.damage
return damage;
}
@Override
public ItemSprite.Glowing glowing() {
return TEAL;
}
}

View File

@ -0,0 +1,42 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
public class Brimstone extends Armor.Glyph {
private static ItemSprite.Glowing ORANGE = new ItemSprite.Glowing( 0xFF4400 );
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see Burning.act
return damage;
}
@Override
public ItemSprite.Glowing glowing() {
return ORANGE;
}
}

View File

@ -0,0 +1,97 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
public class Camouflage extends Armor.Glyph {
private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x448822 );
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see HighGrass.trample
return damage;
}
@Override
public ItemSprite.Glowing glowing() {
return GREEN;
}
public static class Camo extends Invisibility {
private int pos;
private int left;
@Override
public boolean act() {
left--;
if (left == 0 || target.pos != pos) {
detach();
} else {
spend(TICK);
}
return true;
}
public void set(int time){
left = time;
pos = target.pos;
Sample.INSTANCE.play( Assets.SND_MELD );
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc", dispTurns(left));
}
private static final String POS = "pos";
private static final String LEFT = "left";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( POS, pos );
bundle.put( LEFT, left );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
pos = bundle.getInt( POS );
left = bundle.getInt( LEFT );
}
}
}

View File

@ -35,17 +35,17 @@ import com.watabou.utils.Random;
public class Entanglement extends Glyph {
private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x448822 );
private static ItemSprite.Glowing BROWN = new ItemSprite.Glowing( 0x663300 );
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
int level = Math.max( 0, armor.level() );
if (Random.Int( 4 ) == 0) {
if (Random.Int( 3 ) == 0) {
Buff.prolong( defender, Roots.class, 5 - level / 5 );
Buff.affect( defender, Earthroot.Armor.class ).level( 5 * (level + 1) );
Buff.prolong( defender, Roots.class, 5 );
Buff.affect( defender, Earthroot.Armor.class ).level( 5 + level );
CellEmitter.bottom( defender.pos ).start( EarthParticle.FACTORY, 0.05f, 8 );
Camera.main.shake( 1, 0.4f );
@ -56,7 +56,7 @@ public class Entanglement extends Glyph {
@Override
public Glowing glowing() {
return GREEN;
return BROWN;
}
}

View File

@ -0,0 +1,22 @@
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
public class Flow extends Armor.Glyph {
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x0000FF );
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see hero.speed for effect.
return damage;
}
@Override
public ItemSprite.Glowing glowing() {
return BLUE;
}
}

View File

@ -0,0 +1,47 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
public class Obfuscation extends Armor.Glyph {
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x888888 );
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see hero.stealth for effect.
return damage;
}
@Override
public int tierDRAdjust() {
return -1;
}
@Override
public ItemSprite.Glowing glowing() {
return GREY;
}
}

View File

@ -25,7 +25,6 @@ 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;
@ -34,22 +33,20 @@ import com.watabou.utils.Random;
public class Potential extends Glyph {
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x66CCEE );
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF, 0.5f );
@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) {
if (Random.Int( level + 10 ) >= 9) {
int dmg = Random.IntRange( 1, damage );
attacker.damage( dmg, LightningTrap.LIGHTNING );
dmg = Random.IntRange( 1, dmg );
defender.damage( dmg, LightningTrap.LIGHTNING );
defender.damage( Random.IntRange( defender.HT/20, defender.HT/10 ), LightningTrap.LIGHTNING );
checkOwner( defender );
if (defender == Dungeon.hero) {
Dungeon.hero.belongings.charge(1f);
Camera.main.shake( 2, 0.3f );
}
@ -62,6 +59,6 @@ public class Potential extends Glyph {
@Override
public Glowing glowing() {
return BLUE;
return WHITE;
}
}

View File

@ -20,18 +20,14 @@
*/
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.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.utils.Random;
public class Repulsion extends Glyph {
public class Repulsion extends Armor.Glyph {
private static ItemSprite.Glowing WHITE = new ItemSprite.Glowing( 0xFFFFFF );
@ -40,31 +36,10 @@ public class Repulsion extends Glyph {
int level = Math.max( 0, armor.level() );
if (Level.adjacent( attacker.pos, defender.pos )
&& !defender.properties().contains(Char.Property.IMMOVABLE)
&& 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;
// FIXME
if (attacker instanceof Mob) {
Dungeon.level.mobPress( (Mob)attacker );
} else {
Dungeon.level.press( newPos, attacker );
}
}
break;
}
}
if (Random.Int( level + 5 ) >= 4){
int oppositeHero = attacker.pos + (attacker.pos - defender.pos);
Ballistica trajectory = new Ballistica(attacker.pos, oppositeHero, Ballistica.MAGIC_BOLT);
WandOfBlastWave.throwChar(attacker, trajectory, 2);
}
return damage;

View File

@ -0,0 +1,52 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
public class Stone extends Armor.Glyph {
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x222222 );
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect
return damage;
}
@Override
public int tierDRAdjust() {
return 1;
}
@Override
public int tierSTRAdjust() {
return 1;
}
@Override
public ItemSprite.Glowing glowing() {
return GREY;
}
}

View File

@ -0,0 +1,52 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
public class Swiftness extends Armor.Glyph {
private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xFFFF00 );
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see hero.defenseskill and hero.speed for effect.
return damage;
}
@Override
public int tierDRAdjust() {
return -2;
}
@Override
public int tierSTRAdjust() {
return -1;
}
@Override
public ItemSprite.Glowing glowing() {
return YELLOW;
}
}

View File

@ -20,46 +20,33 @@
*/
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.buffs.Bleeding;
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.items.scrolls.ScrollOfTeleportation;
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 {
public class Thorns extends Armor.Glyph {
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x66AAFF );
private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0x660022 );
@Override
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
public int proc(Armor armor, Char attacker, Char defender, int damage) {
if (Dungeon.bossLevel()) {
return damage;
}
int level = Math.max(0, armor.level());
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) {
if ( Random.Int( level/2 + 5) >= 4) {
ScrollOfTeleportation.appear( defender, pos );
Dungeon.level.press( pos, defender );
Dungeon.observe();
Buff.affect( attacker, Bleeding.class).set( Math.max( level/2, damage));
break;
}
}
return damage;
}
@Override
public Glowing glowing() {
return BLUE;
public ItemSprite.Glowing glowing() {
return RED;
}
}

View File

@ -48,7 +48,7 @@ public class Viscosity extends Glyph {
int level = Math.max( 0, armor.level() );
if (Random.Int( level + 7 ) >= 6) {
if (Random.Int( level + 4 ) >= 3) {
DeferedDamage debuff = defender.buff( DeferedDamage.class );
if (debuff == null) {
@ -118,7 +118,8 @@ public class Viscosity extends Glyph {
public boolean act() {
if (target.isAlive()) {
target.damage( 1, this );
int damageThisTick = Math.max(1, damage/10);
target.damage( damageThisTick, this );
if (target == Dungeon.hero && !target.isAlive()) {
Dungeon.fail( getClass() );
@ -128,7 +129,8 @@ public class Viscosity extends Glyph {
}
spend( TICK );
if (--damage <= 0) {
damage -= damageThisTick;
if (damage <= 0) {
detach();
}

View File

@ -39,7 +39,7 @@ public class RingOfElements extends Ring {
}
private static final HashSet<Class<?>> EMPTY = new HashSet<Class<?>>();
private static final HashSet<Class<?>> FULL;
public static final HashSet<Class<?>> FULL;
static {
FULL = new HashSet<Class<?>>();
FULL.add( Burning.class );

View File

@ -382,7 +382,7 @@ public abstract class Wand extends Item {
}
};
protected class Charger extends Buff {
public class Charger extends Buff {
private static final float BASE_CHARGE_DELAY = 10f;
private static final float SCALING_CHARGE_ADDITION = 40f;
@ -402,7 +402,7 @@ public abstract class Wand extends Item {
@Override
public boolean act() {
if (curCharges < maxCharges)
gainCharge();
recharge();
if (partialCharge >= 1 && curCharges < maxCharges) {
partialCharge--;
@ -415,7 +415,7 @@ public abstract class Wand extends Item {
return true;
}
private void gainCharge(){
private void recharge(){
int missingCharges = maxCharges - curCharges;
float turnsToCharge = (float) (BASE_CHARGE_DELAY
@ -431,6 +431,16 @@ public abstract class Wand extends Item {
}
}
public void gainCharge(float charge){
partialCharge += charge;
while (partialCharge >= 1f){
curCharges++;
partialCharge--;
}
curCharges = Math.min(curCharges, maxCharges);
updateQuickslot();
}
private void setScaleFactor(float value){
this.scalingFactor = value;
}

View File

@ -98,7 +98,7 @@ public class WandOfBlastWave extends Wand {
}
}
private void throwChar(final Char ch, final Ballistica trajectory, int power){
public static void throwChar(final Char ch, final Ballistica trajectory, int power){
int dist = Math.min(trajectory.dist, power);
if (ch.properties().contains(Char.Property.BOSS))
@ -135,7 +135,7 @@ public class WandOfBlastWave extends Wand {
}
@Override
//a weaker knockback, not dissimilar to the glyph of bounce, but a fair bit stronger.
//behaves just like glyph of Repulsion
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
int level = Math.max(0, staff.level());

View File

@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
@ -84,10 +85,22 @@ public class HighGrass {
int leaves = 4;
if (ch instanceof Hero) {
Hero hero = (Hero)ch;
// Barkskin
if (ch instanceof Hero && ((Hero)ch).subClass == HeroSubClass.WARDEN) {
Buff.affect( ch, Barkskin.class ).level( ch.HT / 3 );
leaves = 8;
if (hero.subClass == HeroSubClass.WARDEN) {
Buff.affect(ch, Barkskin.class).level(ch.HT / 3);
leaves += 4;
}
//Camouflage
if (hero.belongings.armor != null && hero.belongings.armor.glyph != null
&& hero.belongings.armor.glyph instanceof Camouflage){
Buff.affect(hero, Camouflage.Camo.class).set(3 + hero.belongings.armor.level());
leaves += 4;
}
}
CellEmitter.get( pos ).burst( LeafParticle.LEVEL_SPECIFIC, leaves );

View File

@ -3,15 +3,23 @@ items.armor.glyphs.affection.name=%s of affection
items.armor.glyphs.antientropy.name=%s of anti-entropy
items.armor.glyphs.displacement.name=%s of displacement
items.armor.glyphs.antimagic.name=%s of anti-magic
items.armor.glyphs.brimstone.name=%s of brimstone
items.armor.glyphs.camouflage.name=%s of camouflage
items.armor.glyphs.entanglement.name=%s of entanglement
items.armor.glyphs.flow.name=%s of flow
items.armor.glyphs.metabolism.name=%s of metabolism
items.armor.glyphs.multiplicity.name=%s of multiplicity
items.armor.glyphs.multiplicity.rankings_desc=Killed by: glyph of multiplicity
items.armor.glyphs.obfuscation.name=%s of obfuscation
items.armor.glyphs.potential.name=%s of potential
items.armor.glyphs.potential.rankings_desc=Killed by: glyph of potential
@ -19,12 +27,18 @@ items.armor.glyphs.repulsion.name=%s of repulsion
items.armor.glyphs.stench.name=%s of stench
items.armor.glyphs.stone.name=%s of stone
items.armor.glyphs.swiftness.name=%s of swiftness
items.armor.glyphs.thorns.name=%s of thorns
items.armor.glyphs.viscosity.name=%s of viscosity
items.armor.glyphs.viscosity.deferred=deferred %d
items.armor.glyphs.viscosity$defereddamage.name=Deferred damage
items.armor.glyphs.viscosity$defereddamage.ondeath=The deferred damage killed you...
items.armor.glyphs.viscosity$defereddamage.rankings_desc=Killed by deferred damage
items.armor.glyphs.viscosity$defereddamage.desc=While your armor's glyph has protected you from damage, it seems to be slowly paying you back for it.\n\nDamage is being dealt to you over time instead of immediately. You will take one damage per turn until there is no damage left.\n\nDeferred damage remaining: %d.
items.armor.glyphs.viscosity$defereddamage.desc=While your armor's glyph has protected you from damage, it seems to be slowly paying you back for it.\n\nDamage is being dealt to you over time instead of immediately.\n\nDeferred damage remaining: %d.