use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfFrost method onZap.
@Override
protected void onZap(Ballistica bolt) {
Heap heap = Dungeon.level.heaps.get(bolt.collisionPos);
if (heap != null) {
heap.freeze();
}
Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null) {
int damage = damageRoll();
if (ch.buff(Frost.class) != null) {
// do nothing, can't affect a frozen target
return;
}
if (ch.buff(Chill.class) != null) {
// 7.5% less damage per turn of chill remaining
float chill = ch.buff(Chill.class).cooldown();
damage = (int) Math.round(damage * Math.pow(0.9f, chill));
} else {
ch.sprite.burst(0xFF99CCFF, level() / 2 + 2);
}
processSoulMark(ch, chargesPerCast());
ch.damage(damage, this);
if (ch.isAlive()) {
if (Dungeon.level.water[ch.pos])
Buff.prolong(ch, Chill.class, 4 + level());
else
Buff.prolong(ch, Chill.class, 2 + level());
}
} else {
Dungeon.level.press(bolt.collisionPos, null, true);
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WandOfRegrowth method onZap.
@Override
protected void onZap(Ballistica bolt) {
// ignore tiles which can't have anything grow in them.
for (Iterator<Integer> i = affectedCells.iterator(); i.hasNext(); ) {
int c = Dungeon.level.map[i.next()];
if (!(c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO || c == Terrain.GRASS || c == Terrain.HIGH_GRASS)) {
i.remove();
}
}
float numPlants, numDews, numPods, numStars;
int chrgUsed = chargesPerCast();
// numbers greater than n*100% means n guaranteed plants, e.g. 210% = 2 plants w/10% chance for 3 plants.
// scales from 22% to 220%
numPlants = 0.2f + chrgUsed * chrgUsed * 0.020f;
// scales from 6.6% to 165%
numDews = 0.05f + chrgUsed * chrgUsed * 0.016f;
// scales from 3.3% to 135%
numPods = 0.02f + chrgUsed * chrgUsed * 0.013f;
// scales from 0.1% to 100%
numStars = (chrgUsed * chrgUsed * chrgUsed / 5f) * 0.005f;
placePlants(numPlants, numDews, numPods, numStars);
for (int i : affectedCells) {
int c = Dungeon.level.map[i];
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
Level.set(i, Terrain.GRASS);
}
Char ch = Actor.findChar(i);
if (ch != null) {
processSoulMark(ch, chargesPerCast());
}
GameScene.add(Blob.seed(i, 10, Regrowth.class));
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class MissileWeapon method onThrow.
@Override
protected void onThrow(int cell) {
Char enemy = Actor.findChar(cell);
if (enemy == null || enemy == curUser) {
parent = null;
super.onThrow(cell);
} else {
if (!curUser.shoot(enemy, this)) {
rangedMiss(cell);
} else {
rangedHit(enemy, cell);
}
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class MissileWeapon method castDelay.
@Override
public float castDelay(Char user, int dst) {
float delay = speedFactor(user);
Char enemy = Actor.findChar(dst);
if (enemy != null) {
SnipersMark mark = user.buff(SnipersMark.class);
if (mark != null) {
if (mark.object == enemy.id()) {
delay *= 0.5f;
}
}
}
return delay;
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.Char in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Dirk 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 67% 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.67f), max()));
int exStr = hero.STR() - STRReq();
if (exStr > 0) {
damage += Random.IntRange(0, exStr);
}
return damage;
}
}
return super.damageRoll(owner);
}
Aggregations