use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.
the class Mob method split.
public Mob split(int cell, int damage) {
Mob clone;
try {
clone = getClass().newInstance();
} catch (Exception e) {
throw new TrackedRuntimeException("split issue");
}
clone.hp(Math.max((hp() - damage) / 2, 1));
clone.setPos(cell);
clone.setState(clone.HUNTING);
if (Dungeon.level.map[clone.getPos()] == Terrain.DOOR) {
Door.enter(clone.getPos());
}
Dungeon.level.spawnMob(clone, SPLIT_DELAY);
Actor.addDelayed(new Pushing(clone, getPos(), clone.getPos()), -1);
if (hasBuff(Burning.class)) {
Buff.affect(clone, Burning.class).reignite(clone);
}
if (hasBuff(Poison.class)) {
Buff.affect(clone, Poison.class).set(2);
}
if (isPet()) {
Mob.makePet(clone, Dungeon.hero);
}
return clone;
}
use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.
the class Bundle method put.
public void put(String key, int[] array) {
try {
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < array.length; i++) {
jsonArray.put(i, array[i]);
}
data.put(key, jsonArray);
} catch (JSONException e) {
throw new TrackedRuntimeException("key:" + key, e);
}
}
use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.
the class Bundle method put.
public void put(String key, boolean[] array) {
try {
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < array.length; i++) {
jsonArray.put(i, array[i]);
}
data.put(key, jsonArray);
} catch (JSONException e) {
throw new TrackedRuntimeException("key:" + key, e);
}
}
use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.
the class Bundle method write.
public static void write(Bundle bundle, OutputStream stream) {
try {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream));
writer.write(bundle.data.toString());
writer.close();
} catch (IOException e) {
throw new TrackedRuntimeException("bundle write failed: %s\n", e);
}
}
use of com.nyrds.android.util.TrackedRuntimeException in project pixel-dungeon-remix by NYRDS.
the class Bundle method put.
public void put(String key, Collection<? extends Bundlable> collection) {
JSONArray array = new JSONArray();
for (Bundlable object : collection) {
if (!object.dontPack()) {
Bundle bundle = new Bundle();
bundle.put(CLASS_NAME, object.getClass().getName());
object.storeInBundle(bundle);
BundleHelper.Pack(object, bundle);
array.put(bundle.data);
}
}
try {
data.put(key, array);
} catch (JSONException e) {
throw new TrackedRuntimeException("key:" + key, e);
}
}
Aggregations