use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob 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.mobs.Mob 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.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Ghost method interact.
@Override
public boolean interact() {
sprite.turnTo(pos, Dungeon.hero.pos);
Sample.INSTANCE.play(Assets.SND_GHOST);
if (Quest.given) {
if (Quest.weapon != null) {
if (Quest.processed) {
GameScene.show(new WndSadGhost(this, Quest.type));
} else {
switch(Quest.type) {
case 1:
default:
GameScene.show(new WndQuest(this, Messages.get(this, "rat_2")));
break;
case 2:
GameScene.show(new WndQuest(this, Messages.get(this, "gnoll_2")));
break;
case 3:
GameScene.show(new WndQuest(this, Messages.get(this, "crab_2")));
break;
}
int newPos = -1;
for (int i = 0; i < 10; i++) {
newPos = Dungeon.level.randomRespawnCell();
if (newPos != -1) {
break;
}
}
if (newPos != -1) {
CellEmitter.get(pos).start(Speck.factory(Speck.LIGHT), 0.2f, 3);
pos = newPos;
sprite.place(pos);
sprite.visible = Dungeon.level.heroFOV[pos];
}
}
}
} else {
Mob questBoss;
String txt_quest;
switch(Quest.type) {
case 1:
default:
questBoss = new FetidRat();
txt_quest = Messages.get(this, "rat_1", Dungeon.hero.givenName());
break;
case 2:
questBoss = new GnollTrickster();
txt_quest = Messages.get(this, "gnoll_1", Dungeon.hero.givenName());
break;
case 3:
questBoss = new GreatCrab();
txt_quest = Messages.get(this, "crab_1", Dungeon.hero.givenName());
break;
}
questBoss.pos = Dungeon.level.randomRespawnCell();
if (questBoss.pos != -1) {
GameScene.add(questBoss);
GameScene.show(new WndQuest(this, txt_quest));
Quest.given = true;
Notes.add(Notes.Landmark.GHOST);
}
}
return false;
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class GameScene method examineCell.
public static void examineCell(Integer cell) {
if (cell == null || cell < 0 || cell > Dungeon.level.length() || (!Dungeon.level.visited[cell] && !Dungeon.level.mapped[cell])) {
return;
}
ArrayList<String> names = new ArrayList<>();
final ArrayList<Object> objects = new ArrayList<>();
if (cell == Dungeon.hero.pos) {
objects.add(Dungeon.hero);
names.add(Dungeon.hero.className().toUpperCase(Locale.ENGLISH));
} else {
if (Dungeon.level.heroFOV[cell]) {
Mob mob = (Mob) Actor.findChar(cell);
if (mob != null) {
objects.add(mob);
names.add(Messages.titleCase(mob.name));
}
}
}
Heap heap = Dungeon.level.heaps.get(cell);
if (heap != null && heap.seen) {
objects.add(heap);
names.add(Messages.titleCase(heap.toString()));
}
Plant plant = Dungeon.level.plants.get(cell);
if (plant != null) {
objects.add(plant);
names.add(Messages.titleCase(plant.plantName));
}
Trap trap = Dungeon.level.traps.get(cell);
if (trap != null && trap.visible) {
objects.add(trap);
names.add(Messages.titleCase(trap.name));
}
if (objects.isEmpty()) {
GameScene.show(new WndInfoCell(cell));
} else if (objects.size() == 1) {
examineObject(objects.get(0));
} else {
GameScene.show(new WndOptions(Messages.get(GameScene.class, "choose_examine"), Messages.get(GameScene.class, "multiple_examine"), names.toArray(new String[names.size()])) {
@Override
protected void onSelect(int index) {
examineObject(objects.get(index));
}
});
}
}
use of com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob in project shattered-pixel-dungeon-gdx by 00-Evan.
the class GameScene method create.
@Override
public void create() {
Music.INSTANCE.play(Assets.TUNE, true);
SPDSettings.lastClass(Dungeon.hero.heroClass.ordinal());
super.create();
Camera.main.zoom(GameMath.gate(minZoom, defaultZoom + SPDSettings.zoom(), maxZoom));
scene = this;
terrain = new Group();
add(terrain);
water = new SkinnedBlock(Dungeon.level.width() * DungeonTilemap.SIZE, Dungeon.level.height() * DungeonTilemap.SIZE, Dungeon.level.waterTex()) {
@Override
protected NoosaScript script() {
return NoosaScriptNoLighting.get();
}
@Override
public void draw() {
// water has no alpha component, this improves performance
Blending.disable();
super.draw();
Blending.enable();
}
};
terrain.add(water);
ripples = new Group();
terrain.add(ripples);
DungeonTileSheet.setupVariance(Dungeon.level.map.length, Dungeon.seedCurDepth());
tiles = new DungeonTerrainTilemap();
terrain.add(tiles);
customTiles = new Group();
terrain.add(customTiles);
for (CustomTiledVisual visual : Dungeon.level.customTiles) {
addCustomTile(visual);
}
visualGrid = new GridTileMap();
terrain.add(visualGrid);
terrainFeatures = new TerrainFeaturesTilemap(Dungeon.level.plants, Dungeon.level.traps);
terrain.add(terrainFeatures);
levelVisuals = Dungeon.level.addVisuals();
add(levelVisuals);
heaps = new Group();
add(heaps);
for (IntMap.Entry<Heap> heap : Dungeon.level.heaps) {
addHeapSprite(heap.value);
}
emitters = new Group();
effects = new Group();
healthIndicators = new Group();
emoicons = new Group();
mobs = new Group();
add(mobs);
for (Mob mob : Dungeon.level.mobs) {
addMobSprite(mob);
if (Statistics.amuletObtained) {
mob.beckon(Dungeon.hero.pos);
}
}
walls = new DungeonWallsTilemap();
add(walls);
customWalls = new Group();
add(customWalls);
for (CustomTiledVisual visual : Dungeon.level.customWalls) {
addCustomWall(visual);
}
wallBlocking = new WallBlockingTilemap();
add(wallBlocking);
add(emitters);
add(effects);
gases = new Group();
add(gases);
for (Blob blob : Dungeon.level.blobs.values()) {
blob.emitter = null;
addBlobSprite(blob);
}
fog = new FogOfWar(Dungeon.level.width(), Dungeon.level.height());
add(fog);
spells = new Group();
add(spells);
statuses = new Group();
add(statuses);
add(healthIndicators);
// always appears ontop of other health indicators
add(new TargetHealthIndicator());
add(emoicons);
hero = new HeroSprite();
hero.place(Dungeon.hero.pos);
hero.updateArmor();
mobs.add(hero);
add(cellSelector = new CellSelector(tiles));
pane = new StatusPane();
pane.camera = uiCamera;
pane.setSize(uiCamera.width, 0);
add(pane);
toolbar = new Toolbar();
toolbar.camera = uiCamera;
toolbar.setRect(0, uiCamera.height - toolbar.height(), uiCamera.width, toolbar.height());
add(toolbar);
attack = new AttackIndicator();
attack.camera = uiCamera;
add(attack);
loot = new LootIndicator();
loot.camera = uiCamera;
add(loot);
action = new ActionIndicator();
action.camera = uiCamera;
add(action);
resume = new ResumeIndicator();
resume.camera = uiCamera;
add(resume);
log = new GameLog();
log.camera = uiCamera;
log.newLine();
add(log);
layoutTags();
busy = new BusyIndicator();
busy.camera = uiCamera;
busy.x = 1;
busy.y = pane.bottom() + 1;
add(busy);
switch(InterlevelScene.mode) {
case RESURRECT:
ScrollOfTeleportation.appear(Dungeon.hero, Dungeon.level.entrance);
new Flare(8, 32).color(0xFFFF66, true).show(hero, 2f);
break;
case RETURN:
ScrollOfTeleportation.appear(Dungeon.hero, Dungeon.hero.pos);
break;
case FALL:
Chasm.heroLand();
break;
case DESCEND:
switch(Dungeon.depth) {
case 1:
WndStory.showChapter(WndStory.ID_SEWERS);
break;
case 6:
WndStory.showChapter(WndStory.ID_PRISON);
break;
case 11:
WndStory.showChapter(WndStory.ID_CAVES);
break;
case 16:
WndStory.showChapter(WndStory.ID_CITY);
break;
case 22:
WndStory.showChapter(WndStory.ID_HALLS);
break;
}
if (Dungeon.hero.isAlive() && Dungeon.depth != 22) {
Badges.validateNoKilling();
}
break;
default:
}
ArrayList<Item> dropped = Dungeon.droppedItems.get(Dungeon.depth);
if (dropped != null) {
for (Item item : dropped) {
int pos = Dungeon.level.randomRespawnCell();
if (item instanceof Potion) {
((Potion) item).shatter(pos);
} else if (item instanceof Plant.Seed) {
Dungeon.level.plant((Plant.Seed) item, pos);
} else if (item instanceof Honeypot) {
Dungeon.level.drop(((Honeypot) item).shatter(null, pos), pos);
} else {
Dungeon.level.drop(item, pos);
}
}
Dungeon.droppedItems.remove(Dungeon.depth);
}
Dungeon.hero.next();
Camera.main.target = hero;
if (InterlevelScene.mode != InterlevelScene.Mode.NONE) {
if (Dungeon.depth == Statistics.deepestFloor && (InterlevelScene.mode == InterlevelScene.Mode.DESCEND || InterlevelScene.mode == InterlevelScene.Mode.FALL)) {
GLog.h(Messages.get(this, "descend"), Dungeon.depth);
Sample.INSTANCE.play(Assets.SND_DESCEND);
} else if (InterlevelScene.mode == InterlevelScene.Mode.RESET) {
GLog.h(Messages.get(this, "warp"));
} else {
GLog.h(Messages.get(this, "return"), Dungeon.depth);
}
switch(Dungeon.level.feeling) {
case CHASM:
GLog.w(Messages.get(this, "chasm"));
break;
case WATER:
GLog.w(Messages.get(this, "water"));
break;
case GRASS:
GLog.w(Messages.get(this, "grass"));
break;
case DARK:
GLog.w(Messages.get(this, "dark"));
break;
default:
}
if (Dungeon.level instanceof RegularLevel && ((RegularLevel) Dungeon.level).secretDoors > Random.IntRange(3, 4)) {
GLog.w(Messages.get(this, "secrets"));
}
InterlevelScene.mode = InterlevelScene.Mode.NONE;
fadeIn();
}
selectCell(defaultCellListener);
}
Aggregations