use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Dagger method damageRoll.
@Override
public int damageRoll(Char owner) {
if (owner instanceof Hero) {
Hero hero = (Hero) owner;
Char enemy = hero.enemy();
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
// deals 75% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(min() + Math.round(diff * 0.75f), max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
}
return damage;
}
}
return super.damageRoll(owner);
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class AssassinsBlade method damageRoll.
@Override
public int damageRoll(Char owner) {
if (owner instanceof Hero) {
Hero hero = (Hero) owner;
Char enemy = hero.enemy();
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
// deals 50% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(min() + Math.round(diff * 0.50f), max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
}
return damage;
}
}
return super.damageRoll(owner);
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Monk method attackProc.
@Override
public int attackProc(Char enemy, int damage) {
damage = super.attackProc(enemy, damage);
if (enemy == Dungeon.hero) {
Hero hero = Dungeon.hero;
KindOfWeapon weapon = hero.belongings.weapon;
if (weapon != null && !(weapon instanceof Knuckles) && !(weapon instanceof Gauntlet) && !weapon.cursed) {
if (hitsToDisarm == 0)
hitsToDisarm = Random.NormalIntRange(4, 8);
if (--hitsToDisarm == 0) {
hero.belongings.weapon = null;
Dungeon.quickslot.convertToPlaceholder(weapon);
weapon.updateQuickslot();
Dungeon.level.drop(weapon, hero.pos).sprite.drop();
GLog.w(Messages.get(this, "disarm", weapon.name()));
}
}
}
return damage;
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class DisintegrationTrap method activate.
@Override
public void activate() {
Char target = Actor.findChar(pos);
// find the closest char that can be aimed at
if (target == null) {
for (Char ch : Actor.chars()) {
Ballistica bolt = new Ballistica(pos, ch.pos, Ballistica.PROJECTILE);
if (bolt.collisionPos == ch.pos && (target == null || Dungeon.level.trueDistance(pos, ch.pos) < Dungeon.level.trueDistance(pos, target.pos))) {
target = ch;
}
}
}
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null)
heap.explode();
if (target != null) {
if (Dungeon.level.heroFOV[pos] || Dungeon.level.heroFOV[target.pos]) {
Sample.INSTANCE.play(Assets.SND_RAY);
ShatteredPixelDungeon.scene().add(new Beam.DeathRay(DungeonTilemap.tileCenterToWorld(pos), target.sprite.center()));
}
target.damage(Math.max(target.HT / 5, Random.Int(target.HP / 2, 2 * target.HP / 3)), this);
if (target == Dungeon.hero) {
Hero hero = (Hero) target;
if (!hero.isAlive()) {
Dungeon.fail(getClass());
GLog.n(Messages.get(this, "ondeath"));
} else {
Item item = hero.belongings.randomUnequipped();
Bag bag = hero.belongings.backpack;
// bags do not protect against this trap
if (item instanceof Bag) {
bag = (Bag) item;
item = Random.element(bag.items);
}
if (item == null || item.level() > 0 || item.unique)
return;
if (!item.stackable) {
item.detachAll(bag);
GLog.w(Messages.get(this, "one", item.name()));
} else {
int n = Random.NormalIntRange(1, (item.quantity() + 1) / 2);
for (int i = 1; i <= n; i++) item.detach(bag);
GLog.w(Messages.get(this, "some", item.name()));
}
}
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WarpingTrap method activate.
@Override
public void activate() {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
Char ch = Actor.findChar(pos);
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero((Hero) ch);
BArray.setFalse(Dungeon.level.visited);
BArray.setFalse(Dungeon.level.mapped);
GameScene.updateFog();
Dungeon.observe();
} else if (ch != null) {
int count = 10;
int pos;
do {
pos = Dungeon.level.randomRespawnCell();
if (count-- <= 0) {
break;
}
} while (pos == -1);
if (pos == -1 || Dungeon.bossLevel()) {
GLog.w(Messages.get(ScrollOfTeleportation.class, "no_tele"));
} else {
ch.pos = pos;
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).HUNTING) {
((Mob) ch).state = ((Mob) ch).WANDERING;
}
ch.sprite.place(ch.pos);
ch.sprite.visible = Dungeon.level.heroFOV[pos];
}
}
Heap heap = Dungeon.level.heaps.get(pos);
if (heap != null) {
int cell = Dungeon.level.randomRespawnCell();
Item item = heap.pickUp();
if (cell != -1) {
Dungeon.level.drop(item, cell);
}
}
}
Aggregations