v3.0.0: added glyph sharing property to aura of protection
This commit is contained in:
@@ -684,13 +684,28 @@ public abstract class Char extends Actor {
|
||||
damage = Math.max(damage, 0);
|
||||
}
|
||||
|
||||
// hero and pris images skip this as they already benefit from hero's armor glyph proc
|
||||
if (!(this instanceof Hero || this instanceof PrismaticImage)) {
|
||||
if (Dungeon.hero.alignment == alignment && Dungeon.hero.belongings.armor() != null
|
||||
&& Dungeon.level.distance(pos, Dungeon.hero.pos) <= 2
|
||||
&& Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null) {
|
||||
damage = Dungeon.hero.belongings.armor().proc( enemy, this, damage );
|
||||
}
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
//Returns the level a glyph is at for a char, or -1 if they are not benefitting from that glyph
|
||||
//This function is needed as (unlike enchantments) many glyphs trigger in a variety of cases
|
||||
public int glyphLevel(Class<? extends Armor.Glyph> cls){
|
||||
return -1;
|
||||
if (Dungeon.hero != null && this != Dungeon.hero && Dungeon.hero.alignment == alignment
|
||||
&& Dungeon.level.distance(pos, Dungeon.hero.pos) <= 2
|
||||
&& Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null) {
|
||||
return Dungeon.hero.glyphLevel(cls);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public float speed() {
|
||||
|
||||
@@ -1518,7 +1518,7 @@ public class Hero extends Char {
|
||||
if (belongings.armor() != null && belongings.armor().hasGlyph(cls, this)){
|
||||
return Math.max(super.glyphLevel(cls), belongings.armor.buffedLvl());
|
||||
} else {
|
||||
return super.glyphLevel(cls); //TODO going to have recursion?
|
||||
return super.glyphLevel(cls);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ public class ShadowClone extends ArmorAbility {
|
||||
|
||||
@Override
|
||||
public int glyphLevel(Class<? extends Armor.Glyph> cls) {
|
||||
if (Random.Int(4) < Dungeon.hero.pointsInTalent(Talent.CLONED_ARMOR)){
|
||||
if (Dungeon.hero != null && Random.Int(4) < Dungeon.hero.pointsInTalent(Talent.CLONED_ARMOR)){
|
||||
return Math.max(super.glyphLevel(cls), Dungeon.hero.glyphLevel(cls));
|
||||
} else {
|
||||
return super.glyphLevel(cls);
|
||||
|
||||
@@ -438,9 +438,20 @@ public class Armor extends EquipableItem {
|
||||
}
|
||||
int blocking = ((Hero) defender).subClass == HeroSubClass.PALADIN ? 3 : 1;
|
||||
damage -= Math.round(blocking * Glyph.genericProcChanceMultiplier(defender));
|
||||
} else if (glyph != null) {
|
||||
damage = glyph.proc( this, attacker, defender, damage );
|
||||
} else {
|
||||
if (glyph != null) {
|
||||
damage = glyph.proc(this, attacker, defender, damage);
|
||||
}
|
||||
//so that this effect procs for allies using this armor via aura of protection
|
||||
if (defender.alignment == Dungeon.hero.alignment
|
||||
&& Dungeon.level.distance(defender.pos, Dungeon.hero.pos) <= 2
|
||||
&& Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null
|
||||
&& Dungeon.hero.buff(HolyWard.HolyArmBuff.class) != null) {
|
||||
int blocking = Dungeon.hero.subClass == HeroSubClass.PALADIN ? 3 : 1;
|
||||
damage -= Math.round(blocking * Glyph.genericProcChanceMultiplier(defender));
|
||||
}
|
||||
}
|
||||
damage = Math.max(damage, 0);
|
||||
}
|
||||
|
||||
if (!levelKnown && defender == Dungeon.hero) {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
@@ -49,7 +50,7 @@ public class Entanglement extends Glyph {
|
||||
|
||||
Buff.affect( defender, Earthroot.Armor.class ).level( Math.round((5 + 2 * level)*powerMulti) );
|
||||
CellEmitter.bottom( defender.pos ).start( EarthParticle.FACTORY, 0.05f, 8 );
|
||||
PixelScene.shake( 1, 0.4f );
|
||||
if (defender == Dungeon.hero) PixelScene.shake( 1, 0.4f );
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user