v1.1.0: fixed some cases of glyphs not working for the ghost or statues
This commit is contained in:
parent
2ac630af7f
commit
039dc4eba5
|
@ -23,8 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
|
||||||
|
@ -70,11 +74,40 @@ public class ArmoredStatue extends Statue {
|
||||||
return super.drRoll() + Random.NormalIntRange( armor.DRMin(), armor.DRMax());
|
return super.drRoll() + Random.NormalIntRange( armor.DRMin(), armor.DRMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//used in some glyph calculations
|
||||||
|
public Armor armor(){
|
||||||
|
return armor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isImmune(Class effect) {
|
||||||
|
if (effect == Burning.class
|
||||||
|
&& armor != null
|
||||||
|
&& armor.hasGlyph(Brimstone.class, this)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.isImmune(effect);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int defenseProc(Char enemy, int damage) {
|
public int defenseProc(Char enemy, int damage) {
|
||||||
return armor.proc(enemy, this, damage);
|
return armor.proc(enemy, this, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void damage(int dmg, Object src) {
|
||||||
|
//TODO improve this when I have proper damage source logic
|
||||||
|
if (armor != null && armor.hasGlyph(AntiMagic.class, this)
|
||||||
|
&& AntiMagic.RESISTS.contains(src.getClass())){
|
||||||
|
dmg -= AntiMagic.drRoll(armor.buffedLvl());
|
||||||
|
}
|
||||||
|
|
||||||
|
super.damage( dmg, src );
|
||||||
|
|
||||||
|
//for the rose status indicator
|
||||||
|
Item.updateQuickslot();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSprite sprite() {
|
public CharSprite sprite() {
|
||||||
CharSprite sprite = super.sprite();
|
CharSprite sprite = super.sprite();
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class AntiMagic extends Armor.Glyph {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc(Armor armor, Char attacker, Char defender, int damage) {
|
public int proc(Armor armor, Char attacker, Char defender, int damage) {
|
||||||
//no proc effect, see Hero.damage
|
//no proc effect, see Hero.damage and GhostHero.damage and ArmoredStatue.damage
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class Brimstone extends Armor.Glyph {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int proc(Armor armor, Char attacker, Char defender, int damage) {
|
public int proc(Armor armor, Char attacker, Char defender, int damage) {
|
||||||
//no proc effect, see Hero.isImmune and GhostHero.isImmune
|
//no proc effect, see Hero.isImmune and GhostHero.isImmune and ArmoredStatue.isImmune
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,14 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
|
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
|
||||||
public class Camouflage extends Armor.Glyph {
|
public class Camouflage extends Armor.Glyph {
|
||||||
|
|
||||||
|
@ -35,6 +40,13 @@ public class Camouflage extends Armor.Glyph {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void activate(Char ch, int level){
|
||||||
|
Buff.prolong(ch, Invisibility.class, 3 + level/2);
|
||||||
|
if ( Dungeon.level.heroFOV[ch.pos] ) {
|
||||||
|
Sample.INSTANCE.play( Assets.Sounds.MELD );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return GREEN;
|
return GREEN;
|
||||||
|
|
|
@ -627,7 +627,7 @@ public class DriedRose extends Artifact {
|
||||||
//TODO improve this when I have proper damage source logic
|
//TODO improve this when I have proper damage source logic
|
||||||
if (rose != null && rose.armor != null && rose.armor.hasGlyph(AntiMagic.class, this)
|
if (rose != null && rose.armor != null && rose.armor.hasGlyph(AntiMagic.class, this)
|
||||||
&& AntiMagic.RESISTS.contains(src.getClass())){
|
&& AntiMagic.RESISTS.contains(src.getClass())){
|
||||||
dmg -= AntiMagic.drRoll(rose.armor.level());
|
dmg -= AntiMagic.drRoll(rose.armor.buffedLvl());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.damage( dmg, src );
|
super.damage( dmg, src );
|
||||||
|
@ -686,6 +686,15 @@ public class DriedRose extends Artifact {
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//used in some glyph calculations
|
||||||
|
public Armor armor(){
|
||||||
|
if (rose != null){
|
||||||
|
return rose.armor;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isImmune(Class effect) {
|
public boolean isImmune(Class effect) {
|
||||||
if (effect == Burning.class
|
if (effect == Burning.class
|
||||||
|
|
|
@ -31,11 +31,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.ArmoredStatue;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Camouflage;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Berry;
|
import com.shatteredpixel.shatteredpixeldungeon.items.food.Berry;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
|
@ -121,14 +123,21 @@ public class HighGrass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Camouflage
|
||||||
if (ch instanceof Hero) {
|
if (ch instanceof Hero) {
|
||||||
Hero hero = (Hero) ch;
|
Hero hero = (Hero) ch;
|
||||||
|
|
||||||
//Camouflage
|
|
||||||
//FIXME doesn't work with sad ghost
|
|
||||||
if (hero.belongings.armor() != null && hero.belongings.armor().hasGlyph(Camouflage.class, hero)) {
|
if (hero.belongings.armor() != null && hero.belongings.armor().hasGlyph(Camouflage.class, hero)) {
|
||||||
Buff.prolong(hero, Invisibility.class, 3 + hero.belongings.armor.buffedLvl()/2);
|
Camouflage.activate(hero, hero.belongings.armor.buffedLvl());
|
||||||
Sample.INSTANCE.play( Assets.Sounds.MELD );
|
}
|
||||||
|
} else if (ch instanceof DriedRose.GhostHero){
|
||||||
|
DriedRose.GhostHero ghost = (DriedRose.GhostHero) ch;
|
||||||
|
if (ghost.armor() != null && ghost.armor().hasGlyph(Camouflage.class, ghost)){
|
||||||
|
Camouflage.activate(ghost, ghost.armor().buffedLvl());
|
||||||
|
}
|
||||||
|
} else if (ch instanceof ArmoredStatue){
|
||||||
|
ArmoredStatue statue = (ArmoredStatue) ch;
|
||||||
|
if (statue.armor() != null && statue.armor().hasGlyph(Camouflage.class, statue)){
|
||||||
|
Camouflage.activate(statue, statue.armor().buffedLvl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user