v1.1.0: fixed some cases of glyphs not working for the ghost or statues

This commit is contained in:
Evan Debenham 2021-10-23 18:28:56 -04:00
parent 2ac630af7f
commit 039dc4eba5
6 changed files with 72 additions and 9 deletions

View File

@ -23,8 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
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.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
@ -70,11 +74,40 @@ public class ArmoredStatue extends Statue {
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
public int defenseProc(Char enemy, int 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
public CharSprite sprite() {
CharSprite sprite = super.sprite();

View File

@ -91,7 +91,7 @@ public class AntiMagic extends Armor.Glyph {
@Override
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;
}

View File

@ -31,7 +31,7 @@ public class Brimstone extends Armor.Glyph {
@Override
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;
}

View File

@ -21,9 +21,14 @@
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.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.watabou.noosa.audio.Sample;
public class Camouflage extends Armor.Glyph {
@ -35,6 +40,13 @@ public class Camouflage extends Armor.Glyph {
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
public ItemSprite.Glowing glowing() {
return GREEN;

View File

@ -627,7 +627,7 @@ public class DriedRose extends Artifact {
//TODO improve this when I have proper damage source logic
if (rose != null && rose.armor != null && rose.armor.hasGlyph(AntiMagic.class, this)
&& AntiMagic.RESISTS.contains(src.getClass())){
dmg -= AntiMagic.drRoll(rose.armor.level());
dmg -= AntiMagic.drRoll(rose.armor.buffedLvl());
}
super.damage( dmg, src );
@ -686,6 +686,15 @@ public class DriedRose extends Artifact {
return block;
}
//used in some glyph calculations
public Armor armor(){
if (rose != null){
return rose.armor;
} else {
return null;
}
}
@Override
public boolean isImmune(Class effect) {
if (effect == Burning.class

View File

@ -31,11 +31,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
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.particles.LeafParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
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.food.Berry;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
@ -121,14 +123,21 @@ public class HighGrass {
}
}
//Camouflage
if (ch instanceof Hero) {
Hero hero = (Hero) ch;
//Camouflage
//FIXME doesn't work with sad ghost
if (hero.belongings.armor() != null && hero.belongings.armor().hasGlyph(Camouflage.class, hero)) {
Buff.prolong(hero, Invisibility.class, 3 + hero.belongings.armor.buffedLvl()/2);
Sample.INSTANCE.play( Assets.Sounds.MELD );
Camouflage.activate(hero, hero.belongings.armor.buffedLvl());
}
} 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());
}
}