v0.9.3b: added more safety checks to prismatic images
This commit is contained in:
parent
eb0c857ef8
commit
57d9f7ffad
|
@ -144,12 +144,20 @@ public class PrismaticImage extends NPC {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageRoll() {
|
public int damageRoll() {
|
||||||
|
if (hero != null) {
|
||||||
return Random.NormalIntRange( 1 + hero.lvl/8, 4 + hero.lvl/2 );
|
return Random.NormalIntRange( 1 + hero.lvl/8, 4 + hero.lvl/2 );
|
||||||
|
} else {
|
||||||
|
return Random.NormalIntRange( 1, 4 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int attackSkill( Char target ) {
|
public int attackSkill( Char target ) {
|
||||||
|
if (hero != null) {
|
||||||
return hero.attackSkill(target);
|
return hero.attackSkill(target);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -177,7 +185,7 @@ public class PrismaticImage extends NPC {
|
||||||
@Override
|
@Override
|
||||||
public int defenseProc(Char enemy, int damage) {
|
public int defenseProc(Char enemy, int damage) {
|
||||||
damage = super.defenseProc(enemy, damage);
|
damage = super.defenseProc(enemy, damage);
|
||||||
if (hero.belongings.armor != null){
|
if (hero != null && hero.belongings.armor != null){
|
||||||
return hero.belongings.armor.proc( enemy, this, damage );
|
return hero.belongings.armor.proc( enemy, this, damage );
|
||||||
} else {
|
} else {
|
||||||
return damage;
|
return damage;
|
||||||
|
@ -188,7 +196,7 @@ public class PrismaticImage extends NPC {
|
||||||
public void damage(int dmg, Object src) {
|
public void damage(int dmg, Object src) {
|
||||||
|
|
||||||
//TODO improve this when I have proper damage source logic
|
//TODO improve this when I have proper damage source logic
|
||||||
if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(AntiMagic.class, this)
|
if (hero != null && hero.belongings.armor != null && hero.belongings.armor.hasGlyph(AntiMagic.class, this)
|
||||||
&& AntiMagic.RESISTS.contains(src.getClass())){
|
&& AntiMagic.RESISTS.contains(src.getClass())){
|
||||||
dmg -= AntiMagic.drRoll(hero.belongings.armor.buffedLvl());
|
dmg -= AntiMagic.drRoll(hero.belongings.armor.buffedLvl());
|
||||||
}
|
}
|
||||||
|
@ -198,7 +206,7 @@ public class PrismaticImage extends NPC {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float speed() {
|
public float speed() {
|
||||||
if (hero.belongings.armor != null){
|
if (hero != null && hero.belongings.armor != null){
|
||||||
return hero.belongings.armor.speedFactor(this, super.speed());
|
return hero.belongings.armor.speedFactor(this, super.speed());
|
||||||
}
|
}
|
||||||
return super.speed();
|
return super.speed();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user