v0.9.3: removed old pre-0.7.5 Tengu code

This commit is contained in:
Evan Debenham 2021-03-24 20:17:33 -04:00
parent d2e2172ede
commit 3f7c0da811
9 changed files with 60 additions and 1059 deletions

View File

@ -865,33 +865,25 @@ actors.mobs.succubus.desc=Succubi are shapeshifting demons that manipulate the m
actors.mobs.swarm.name=swarm of flies
actors.mobs.swarm.desc=The deadly swarm of flies buzzes angrily. Every non-magical attack will split it into two smaller but equally dangerous swarms.
actors.mobs.newtengu.name=Tengu
actors.mobs.newtengu.notice_gotcha=Gotcha, %s!
actors.mobs.newtengu.interesting=Let's make this interesting...
actors.mobs.newtengu.notice_have=I have you now, %s!
actors.mobs.newtengu.defeated=Free at last...
actors.mobs.newtengu.rankings_desc=Assassinated by the Tengu
actors.mobs.newtengu.desc=A famous and enigmatic assassin, named for the mask grafted to his face.\n\nTengu is held down with large clasps on his wrists and knees, though he seems to have gotten rid of his chains long ago.\n\nHe will try to use traps, deceptive magic, and precise attacks to eliminate the only thing stopping his escape: you.
actors.mobs.tengu.name=Tengu
actors.mobs.tengu.notice_gotcha=Gotcha, %s!
actors.mobs.tengu.interesting=Let's make this interesting...
actors.mobs.tengu.notice_have=I have you now, %s!
actors.mobs.tengu.defeated=Free at last...
actors.mobs.tengu.rankings_desc=Assassinated by the Tengu
actors.mobs.tengu.desc=A famous and enigmatic assassin, named for the mask grafted to his face.\n\nTengu is held down with large clasps on his wrists and knees, though he seems to have gotten rid of his chains long ago.\n\nHe will try to use traps, deceptive magic, and precise attacks to eliminate the only thing stopping his escape: you.
actors.mobs.newtengu$bombability$bombblob.desc=A cloud of superheated smoke is billowing here. Watch out, it's going to explode!
actors.mobs.newtengu$bombability$bombitem.name=Smoke Bomb
actors.mobs.newtengu$bombability$bombitem.cant_pickup=It's stuck to the ground, you can't move it!
actors.mobs.newtengu$bombability$bombitem.desc=Tengu has thrown a strange looking smoke bomb here, which is billowing a thick hot smoke. It's making a loud ticking noise, as if its counting down to an explosion!\n\nThe bomb has anchored itself to the ground, so you can't pick it up.
actors.mobs.tengu$bombability$bombblob.desc=A cloud of superheated smoke is billowing here. Watch out, it's going to explode!
actors.mobs.tengu$bombability$bombitem.name=Smoke Bomb
actors.mobs.tengu$bombability$bombitem.cant_pickup=It's stuck to the ground, you can't move it!
actors.mobs.tengu$bombability$bombitem.desc=Tengu has thrown a strange looking smoke bomb here, which is billowing a thick hot smoke. It's making a loud ticking noise, as if its counting down to an explosion!\n\nThe bomb has anchored itself to the ground, so you can't pick it up.
actors.mobs.newtengu$fireability$fireblob.desc=Tengu has thrown a fine powder that seems to be catching into steam here, it's about to ignite!
actors.mobs.tengu$fireability$fireblob.desc=Tengu has thrown a fine powder that seems to be catching into steam here, it's about to ignite!
actors.mobs.newtengu$shockerability$shockerblob.desc=Electrical energy is building here, anything standing on this tile will be shocked next turn!
actors.mobs.newtengu$shockerability$shockeritem.name=Shocker
actors.mobs.newtengu$shockerability$shockeritem.cant_pickup=It's putting out too much electricity, you can't grab it!
actors.mobs.newtengu$shockerability$shockeritem.desc=Tengu has thrown a curious machine here, which seems to be made of DM-100 parts. The machine is constantly arcing electricity around it, but it seems to be going in a predictable pattern.\n\nWith all the electricity arcing around it, there's no way you can pick this up.
actors.mobs.oldtengu.name=Tengu
actors.mobs.oldtengu.notice_mine=You're mine, %s!
actors.mobs.oldtengu.notice_face=Face me, %s!
actors.mobs.oldtengu.interesting=Let's make this interesting...
actors.mobs.oldtengu.defeated=Free at last...
actors.mobs.oldtengu.rankings_desc=Assassinated by the Tengu
actors.mobs.oldtengu.desc=A famous and enigmatic assassin, named for the mask grafted to his face.\n\nTengu is held down with large clasps on his wrists and knees, though he seems to have gotten rid of his chains long ago.\n\nHe will try to use traps, deceptive magic, and precise attacks to eliminate the only thing stopping his escape: you.
actors.mobs.tengu$shockerability$shockerblob.desc=Electrical energy is building here, anything standing on this tile will be shocked next turn!
actors.mobs.tengu$shockerability$shockeritem.name=Shocker
actors.mobs.tengu$shockerability$shockeritem.cant_pickup=It's putting out too much electricity, you can't grab it!
actors.mobs.tengu$shockerability$shockeritem.desc=Tengu has thrown a curious machine here, which seems to be made of DM-100 parts. The machine is constantly arcing electricity around it, but it seems to be going in a predictable pattern.\n\nWith all the electricity arcing around it, there's no way you can pick this up.
actors.mobs.thief.name=crazy thief
actors.mobs.thief.stole=The thief stole %s from you!

View File

@ -54,7 +54,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewCavesBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewCityBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewHallsBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewPrisonBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel;
@ -258,7 +258,7 @@ public class Dungeon {
level = new PrisonLevel();
break;
case 10:
level = new NewPrisonBossLevel();
level = new PrisonBossLevel();
break;
case 11:
case 12:

View File

@ -73,6 +73,12 @@ public class ShatteredPixelDungeon extends Game {
"com.shatteredpixel.shatteredpixeldungeon.levels.HallsBossLevel" );
//v0.9.3
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Tengu.class,
"com.shatteredpixel.shatteredpixeldungeon.actors.mobs.NewTengu" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.NewPrisonBossLevel" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.Waterskin.class,
"com.shatteredpixel.shatteredpixeldungeon.items.DewVial" );

View File

@ -35,7 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StormCloud;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Web;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.NewTengu;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Tengu;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
@ -79,7 +79,7 @@ public class BlobImmunity extends FlavourBuff {
immunities.add( ToxicGas.class );
immunities.add( Web.class );
immunities.add(NewTengu.FireAbility.FireBlob.class);
immunities.add(Tengu.FireAbility.FireBlob.class);
}
@Override

View File

@ -1,296 +0,0 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2021 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.OldPrisonBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TenguSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
//Exists to support pre-0.7.5 saves
public class OldTengu extends Mob {
{
spriteClass = TenguSprite.class;
HP = HT = 120;
EXP = 20;
defenseSkill = 20;
HUNTING = new Hunting();
flying = true; //doesn't literally fly, but he is fleet-of-foot enough to avoid hazards
properties.add(Property.BOSS);
}
@Override
protected void onAdd() {
//when he's removed and re-added to the fight, his time is always set to now.
spend(-cooldown());
super.onAdd();
}
@Override
public int damageRoll() {
return Random.NormalIntRange( 6, 20 );
}
@Override
public int attackSkill( Char target ) {
return 20;
}
@Override
public int drRoll() {
return Random.NormalIntRange(0, 5);
}
@Override
public void damage(int dmg, Object src) {
OldPrisonBossLevel.State state = ((OldPrisonBossLevel)Dungeon.level).state();
int hpBracket;
if (state == OldPrisonBossLevel.State.FIGHT_START){
hpBracket = 12;
} else {
hpBracket = 20;
}
int beforeHitHP = HP;
super.damage(dmg, src);
dmg = beforeHitHP - HP;
LockedFloor lock = Dungeon.hero.buff(LockedFloor.class);
if (lock != null) {
int multiple = state == OldPrisonBossLevel.State.FIGHT_START ? 1 : 4;
lock.addTime(dmg*multiple);
}
//phase 2 of the fight is over
if (HP == 0 && state == OldPrisonBossLevel.State.FIGHT_ARENA) {
//let full attack action complete first
Actor.add(new Actor() {
{
actPriority = VFX_PRIO;
}
@Override
protected boolean act() {
Actor.remove(this);
((OldPrisonBossLevel)Dungeon.level).progress();
return true;
}
});
return;
}
//phase 1 of the fight is over
if (state == OldPrisonBossLevel.State.FIGHT_START && HP <= HT/2){
HP = (HT/2)-1;
yell(Messages.get(this, "interesting"));
((OldPrisonBossLevel)Dungeon.level).progress();
BossHealthBar.bleed(true);
//if tengu has lost a certain amount of hp, jump
} else if (beforeHitHP / hpBracket != HP / hpBracket) {
jump();
}
}
@Override
public boolean isAlive() {
return Dungeon.level.mobs.contains(this); //Tengu has special death rules, see prisonbosslevel.progress()
}
@Override
public void die( Object cause ) {
if (Dungeon.hero.subClass == HeroSubClass.NONE) {
Dungeon.level.drop( new TomeOfMastery(), pos ).sprite.drop();
}
GameScene.bossSlain();
super.die( cause );
Badges.validateBossSlain();
LloydsBeacon beacon = Dungeon.hero.belongings.getItem(LloydsBeacon.class);
if (beacon != null) {
beacon.upgrade();
}
yell( Messages.get(this, "defeated") );
}
@Override
protected boolean canAttack( Char enemy ) {
return new Ballistica( pos, enemy.pos, Ballistica.PROJECTILE).collisionPos == enemy.pos;
}
//tengu's attack is always visible
@Override
protected boolean doAttack(Char enemy) {
sprite.attack( enemy.pos );
spend( attackDelay() );
return false;
}
private void jump() {
Level level = Dungeon.level;
//incase tengu hasn't had a chance to act yet
if (fieldOfView == null || fieldOfView.length != Dungeon.level.length()){
fieldOfView = new boolean[Dungeon.level.length()];
Dungeon.level.updateFieldOfView( this, fieldOfView );
}
if (enemy == null) enemy = chooseEnemy();
if (enemy == null) return;
int newPos;
//if we're in phase 1, want to warp around within the room
if (((OldPrisonBossLevel)Dungeon.level).state() == OldPrisonBossLevel.State.FIGHT_START) {
//place new traps
int tries;
for (int i=0; i < 4; i++) {
int trapPos;
tries = 15;
do {
trapPos = Random.Int( level.length() );
} while (tries-- > 0 && level.map[trapPos] != Terrain.INACTIVE_TRAP
&& level.map[trapPos] != Terrain.TRAP);
if (level.map[trapPos] == Terrain.INACTIVE_TRAP) {
level.setTrap( new GrippingTrap().reveal(), trapPos );
Level.set( trapPos, Terrain.TRAP );
ScrollOfMagicMapping.discover( trapPos );
}
}
tries = 50;
do {
newPos = Random.IntRange(3, 7) + 32*Random.IntRange(26, 30);
} while ( (level.adjacent(newPos, enemy.pos) || Actor.findChar(newPos) != null)
&& --tries > 0);
if (tries <= 0) return;
//otherwise go wherever, as long as it's a little bit away
} else {
do {
newPos = Random.Int(level.length());
} while (
level.solid[newPos] ||
level.distance(newPos, enemy.pos) < 8 ||
Actor.findChar(newPos) != null);
}
if (level.heroFOV[pos]) CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
sprite.move( pos, newPos );
move( newPos );
if (level.heroFOV[newPos]) CellEmitter.get( newPos ).burst( Speck.factory( Speck.WOOL ), 6 );
Sample.INSTANCE.play( Assets.Sounds.PUFF );
spend( 1 / speed() );
}
@Override
public void notice() {
super.notice();
if (!BossHealthBar.isAssigned()) {
BossHealthBar.assignBoss(this);
if (HP <= HT/2) BossHealthBar.bleed(true);
if (HP == HT) {
yell(Messages.get(this, "notice_mine", Dungeon.hero.name()));
for (Char ch : Actor.chars()){
if (ch instanceof DriedRose.GhostHero){
((DriedRose.GhostHero) ch).sayBoss();
}
}
} else {
yell(Messages.get(this, "notice_face", Dungeon.hero.name()));
}
}
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
BossHealthBar.assignBoss(this);
if (HP <= HT/2) BossHealthBar.bleed(true);
}
//tengu is always hunting
private class Hunting extends Mob.Hunting{
@Override
public boolean act(boolean enemyInFOV, boolean justAlerted) {
enemySeen = enemyInFOV;
if (enemyInFOV && !isCharmedBy( enemy ) && canAttack( enemy )) {
return doAttack( enemy );
} else {
if (enemyInFOV) {
target = enemy.pos;
} else {
chooseEnemy();
if (enemy != null) {
target = enemy.pos;
}
}
spend( TICK );
return true;
}
}
}
}

View File

@ -53,7 +53,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.LloydsBeacon;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.NewPrisonBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.PrisonBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -76,7 +76,7 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
import java.util.HashSet;
public class NewTengu extends Mob {
public class Tengu extends Mob {
{
spriteClass = TenguSprite.class;
@ -139,7 +139,7 @@ public class NewTengu extends Mob {
return;
}
NewPrisonBossLevel.State state = ((NewPrisonBossLevel)Dungeon.level).state();
PrisonBossLevel.State state = ((PrisonBossLevel)Dungeon.level).state();
int hpBracket = HT / 8;
@ -154,12 +154,12 @@ public class NewTengu extends Mob {
LockedFloor lock = Dungeon.hero.buff(LockedFloor.class);
if (lock != null) {
int multiple = state == NewPrisonBossLevel.State.FIGHT_START ? 1 : 4;
int multiple = state == PrisonBossLevel.State.FIGHT_START ? 1 : 4;
lock.addTime(dmg*multiple);
}
//phase 2 of the fight is over
if (HP == 0 && state == NewPrisonBossLevel.State.FIGHT_ARENA) {
if (HP == 0 && state == PrisonBossLevel.State.FIGHT_ARENA) {
//let full attack action complete first
Actor.add(new Actor() {
@ -170,7 +170,7 @@ public class NewTengu extends Mob {
@Override
protected boolean act() {
Actor.remove(this);
((NewPrisonBossLevel)Dungeon.level).progress();
((PrisonBossLevel)Dungeon.level).progress();
return true;
}
});
@ -178,10 +178,10 @@ public class NewTengu extends Mob {
}
//phase 1 of the fight is over
if (state == NewPrisonBossLevel.State.FIGHT_START && HP <= HT/2){
if (state == PrisonBossLevel.State.FIGHT_START && HP <= HT/2){
HP = (HT/2);
yell(Messages.get(this, "interesting"));
((NewPrisonBossLevel)Dungeon.level).progress();
((PrisonBossLevel)Dungeon.level).progress();
BossHealthBar.bleed(true);
//if tengu has lost a certain amount of hp, jump
@ -232,17 +232,17 @@ public class NewTengu extends Mob {
if (enemy == null) return;
int newPos;
if (Dungeon.level instanceof NewPrisonBossLevel){
NewPrisonBossLevel level = (NewPrisonBossLevel) Dungeon.level;
if (Dungeon.level instanceof PrisonBossLevel){
PrisonBossLevel level = (PrisonBossLevel) Dungeon.level;
//if we're in phase 1, want to warp around within the room
if (level.state() == NewPrisonBossLevel.State.FIGHT_START) {
if (level.state() == PrisonBossLevel.State.FIGHT_START) {
level.cleanTenguCell();
int tries = 100;
do {
newPos = ((NewPrisonBossLevel)Dungeon.level).randomTenguCellPos();
newPos = ((PrisonBossLevel)Dungeon.level).randomTenguCellPos();
tries--;
} while ( tries > 0 && (level.trueDistance(newPos, enemy.pos) <= 3.5f
|| level.trueDistance(newPos, Dungeon.hero.pos) <= 3.5f
@ -483,22 +483,22 @@ public class NewTengu extends Mob {
if (abilityToUse != lastAbility || Random.Int(10) == 0){
switch (abilityToUse){
case BOMB_ABILITY : default:
abilityUsed = throwBomb(NewTengu.this, enemy);
abilityUsed = throwBomb(Tengu.this, enemy);
//if Tengu cannot use his bomb ability first, use fire instead.
if (abilitiesUsed == 0 && !abilityUsed){
abilityToUse = FIRE_ABILITY;
abilityUsed = throwFire(NewTengu.this, enemy);
abilityUsed = throwFire(Tengu.this, enemy);
}
break;
case FIRE_ABILITY:
abilityUsed = throwFire(NewTengu.this, enemy);
abilityUsed = throwFire(Tengu.this, enemy);
break;
case SHOCKER_ABILITY:
abilityUsed = throwShocker(NewTengu.this, enemy);
abilityUsed = throwShocker(Tengu.this, enemy);
//if Tengu cannot use his shocker ability second, use fire instead.
if (abilitiesUsed == 1 && !abilityUsed){
abilityToUse = FIRE_ABILITY;
abilityUsed = throwFire(NewTengu.this, enemy);
abilityUsed = throwFire(Tengu.this, enemy);
}
break;
}
@ -587,7 +587,7 @@ public class NewTengu extends Mob {
if (PathFinder.distance[cell] < Integer.MAX_VALUE) {
Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof NewTengu)) {
if (ch != null && !(ch instanceof Tengu)) {
int dmg = Random.NormalIntRange(5 + Dungeon.depth, 10 + Dungeon.depth * 2);
dmg -= ch.drRoll();
@ -596,7 +596,7 @@ public class NewTengu extends Mob {
}
if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(NewTengu.class);
Dungeon.fail(Tengu.class);
}
}
@ -704,7 +704,7 @@ public class NewTengu extends Mob {
for (int i = 0; i < PathFinder.CIRCLE8.length; i++){
if (aim.sourcePos+PathFinder.CIRCLE8[i] == aim.path.get(1)){
thrower.sprite.zap(target.pos);
Buff.append(thrower, NewTengu.FireAbility.class).direction = i;
Buff.append(thrower, Tengu.FireAbility.class).direction = i;
thrower.sprite.emitter().start(Speck.factory(Speck.STEAM), .03f, 10);
return true;
@ -820,7 +820,7 @@ public class NewTengu extends Mob {
if (cur[cell] > 0 && off[cell] == 0){
Char ch = Actor.findChar( cell );
if (ch != null && !ch.isImmune(Fire.class) && !(ch instanceof NewTengu)) {
if (ch != null && !ch.isImmune(Fire.class) && !(ch instanceof Tengu)) {
Buff.affect( ch, Burning.class ).reignite( ch );
}
@ -1001,11 +1001,11 @@ public class NewTengu extends Mob {
shocked = true;
Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof NewTengu)){
if (ch != null && !(ch instanceof Tengu)){
ch.damage(2 + Dungeon.depth, new Electricity());
if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(NewTengu.class);
Dungeon.fail(Tengu.class);
GLog.n( Messages.get(Electricity.class, "ondeath") );
}
}

View File

@ -1,701 +0,0 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2021 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.OldTengu;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.HeavyBoomerang;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTilemap;
import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.noosa.Group;
import com.watabou.noosa.Tilemap;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
import java.util.ArrayList;
//Exists to support pre-0.7.5 saves
public class OldPrisonBossLevel extends Level {
{
color1 = 0x6a723d;
color2 = 0x88924c;
}
public enum State {
START,
FIGHT_START,
MAZE,
FIGHT_ARENA,
WON
}
private static final int ARENA_CENTER = 5+28*32;
private static final int ARENA_DOOR = 5+25*32;
private State state;
private OldTengu tengu;
public State state(){
return state;
}
//keep track of that need to be removed as the level is changed. We dump 'em back into the level at the end.
private ArrayList<Item> storedItems = new ArrayList<>();
@Override
public String tilesTex() {
return Assets.Environment.TILES_PRISON;
}
@Override
public String waterTex() {
return Assets.Environment.WATER_PRISON;
}
private static final String STATE = "state";
private static final String TENGU = "tengu";
private static final String STORED_ITEMS = "storeditems";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle(bundle);
bundle.put( STATE, state );
bundle.put( TENGU, tengu );
bundle.put( STORED_ITEMS, storedItems);
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
state = bundle.getEnum( STATE, State.class );
//in some states tengu won't be in the world, in others he will be.
if (state == State.START || state == State.MAZE) {
tengu = (OldTengu)bundle.get( TENGU );
} else {
for (Mob mob : mobs){
if (mob instanceof OldTengu) {
tengu = (OldTengu) mob;
break;
}
}
}
for (Bundlable item : bundle.getCollection(STORED_ITEMS)){
storedItems.add( (Item)item );
}
}
@Override
protected boolean build() {
setSize(32, 32);
map = MAP_START.clone();
buildFlagMaps();
cleanWalls();
state = State.START;
entrance = 5+2*32;
exit = 0;
resetTraps();
return true;
}
@Override
protected void createMobs() {
tengu = new OldTengu(); //We want to keep track of tengu independently of other mobs, he's not always in the level.
}
public Actor addRespawner() {
return null;
}
@Override
protected void createItems() {
Item item = Bones.get();
if (item != null) {
drop( item, randomRespawnCell( null ) ).setHauntedIfCursed().type = Heap.Type.REMAINS;
}
drop(new IronKey(10), randomPrisonCell());
}
private int randomPrisonCell(){
int pos = 1+8*32; //initial position at top-left room
//randomly assign a room.
pos += Random.Int(4)*(4*32); //one of the 4 rows
pos += Random.Int(2)*6; // one of the 2 columns
//and then a certain tile in that room.
pos += Random.Int(3) + Random.Int(3)*32;
return pos;
}
private int randomTenguArenaCell(){
int pos = ARENA_CENTER - 2 - (2*32);//initial position at top-left of room
pos += Random.Int(5)*32;
pos += Random.Int(5);
//cannot choose the center
if (pos == ARENA_CENTER) return randomTenguArenaCell();
else return pos;
}
@Override
public void occupyCell( Char ch ) {
super.occupyCell( ch );
if (ch == Dungeon.hero){
//hero enters tengu's chamber
if (state == State.START
&& (new EmptyRoom().set(2, 25, 8, 32)).inside(cellToPoint(ch.pos))){
progress();
}
//hero finishes the maze
else if (state == State.MAZE
&& (new EmptyRoom().set(4, 0, 7, 4)).inside(cellToPoint(ch.pos))){
progress();
}
}
}
@Override
public int randomRespawnCell( Char ch ) {
int pos = 5+2*32; //random cell adjacent to the entrance.
int cell;
do {
cell = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
} while (!passable[cell]
|| (Char.hasProp(ch, Char.Property.LARGE) && !openSpace[cell])
|| Actor.findChar(cell) != null);
return cell;
}
@Override
public String tileName( int tile ) {
switch (tile) {
case Terrain.WATER:
return Messages.get(PrisonLevel.class, "water_name");
default:
return super.tileName( tile );
}
}
@Override
public String tileDesc(int tile) {
switch (tile) {
case Terrain.EMPTY_DECO:
return Messages.get(PrisonLevel.class, "empty_deco_desc");
case Terrain.BOOKSHELF:
return Messages.get(PrisonLevel.class, "bookshelf_desc");
default:
return super.tileDesc( tile );
}
}
private void resetTraps(){
traps.clear();
for (int i = 0; i < length(); i++){
if (map[i] == Terrain.INACTIVE_TRAP) {
Trap t = new GrippingTrap().reveal();
t.active = false;
setTrap(t, i);
map[i] = Terrain.INACTIVE_TRAP;
}
}
}
private void changeMap(int[] map){
this.map = map.clone();
buildFlagMaps();
cleanWalls();
exit = entrance = 0;
for (int i = 0; i < length(); i ++)
if (map[i] == Terrain.ENTRANCE)
entrance = i;
else if (map[i] == Terrain.EXIT)
exit = i;
BArray.setFalse(visited);
BArray.setFalse(mapped);
for (Blob blob: blobs.values()){
blob.fullyClear();
}
addVisuals(); //this also resets existing visuals
resetTraps();
GameScene.resetMap();
Dungeon.observe();
}
private void clearEntities(Room safeArea){
for (Heap heap : heaps.valueList()){
if (safeArea == null || !safeArea.inside(cellToPoint(heap.pos))){
storedItems.addAll(heap.items);
heap.destroy();
}
}
for (HeavyBoomerang.CircleBack b : Dungeon.hero.buffs(HeavyBoomerang.CircleBack.class)){
if (safeArea == null || !safeArea.inside(cellToPoint(b.returnPos()))){
storedItems.add(b.cancel());
}
}
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])){
if (mob != tengu && (safeArea == null || !safeArea.inside(cellToPoint(mob.pos)))){
mob.destroy();
if (mob.sprite != null)
mob.sprite.killAndErase();
}
}
for (Plant plant : plants.valueList()){
if (safeArea == null || !safeArea.inside(cellToPoint(plant.pos))){
plants.remove(plant.pos);
}
}
}
public void progress(){
switch (state){
//moving to the beginning of the fight
case START:
//if something is occupying Tengu's space, wait and do nothing.
if (Actor.findChar(ARENA_CENTER) != null){
return;
}
seal();
set(ARENA_DOOR, Terrain.LOCKED_DOOR);
GameScene.updateMap(ARENA_DOOR);
for (Mob m : mobs){
//bring the first ally with you
if (m.alignment == Char.Alignment.ALLY && !m.properties().contains(Char.Property.IMMOVABLE)){
m.pos = ARENA_DOOR; //they should immediately walk out of the door
m.sprite.place(m.pos);
break;
}
}
tengu.state = tengu.HUNTING;
tengu.pos = ARENA_CENTER; //in the middle of the fight room
GameScene.add( tengu );
tengu.notice();
state = State.FIGHT_START;
break;
//halfway through, move to the maze
case FIGHT_START:
changeMap(MAP_MAZE);
clearEntities((Room) new EmptyRoom().set(0, 5, 8, 32)); //clear the entrance
Actor.remove(tengu);
mobs.remove(tengu);
TargetHealthIndicator.instance.target(null);
tengu.sprite.kill();
Room maze = new EmptyRoom();
maze.set(10, 1, 31, 29);
maze.connected.put(null, new Room.Door(10, 2));
maze.connected.put(maze, new Room.Door(20, 29));
maze.paint(this);
buildFlagMaps();
cleanWalls();
GameScene.resetMap();
GameScene.flash(0x80FFFFFF);
Sample.INSTANCE.play(Assets.Sounds.BLAST);
state = State.MAZE;
break;
//maze beaten, moving to the arena
case MAZE:
Dungeon.hero.interrupt();
Dungeon.hero.pos += 9+3*32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_ARENA);
clearEntities( (Room) new EmptyRoom().set(0, 0, 10, 4)); //clear all but the area right around the teleport spot
//if any allies are left over, move them along the same way as the hero
for (Mob m : mobs){
if (m.alignment == Char.Alignment.ALLY) {
m.pos += 9 + 3 * 32;
m.sprite().place(m.pos);
}
}
tengu.state = tengu.HUNTING;
do {
tengu.pos = Random.Int(length());
} while (solid[tengu.pos] || distance(tengu.pos, Dungeon.hero.pos) < 8);
GameScene.add(tengu);
tengu.notice();
GameScene.flash(0x80FFFFFF);
Sample.INSTANCE.play(Assets.Sounds.BLAST);
state = State.FIGHT_ARENA;
break;
//arena ended, fight over.
case FIGHT_ARENA:
unseal();
CustomTilemap vis = new exitVisual();
vis.pos(11, 8);
customTiles.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
vis = new exitVisualWalls();
vis.pos(11, 8);
customWalls.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomWall(vis);
Dungeon.hero.interrupt();
Dungeon.hero.pos = 5+27*32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
tengu.pos = ARENA_CENTER;
tengu.sprite.place(ARENA_CENTER);
//remove all mobs, but preserve allies
ArrayList<Mob> allies = new ArrayList<>();
for(Mob m : mobs.toArray(new Mob[0])){
if (m.alignment == Char.Alignment.ALLY && !m.properties().contains(Char.Property.IMMOVABLE)){
allies.add(m);
mobs.remove(m);
}
}
changeMap(MAP_END);
for (Mob m : allies){
do{
m.pos = randomTenguArenaCell();
} while (findMob(m.pos) != null);
if (m.sprite != null) m.sprite.place(m.pos);
mobs.add(m);
}
tengu.die(Dungeon.hero);
clearEntities((Room) new EmptyRoom().set(2, 25, 8, 31)); //arena is safe
for (Item item : storedItems)
drop(item, randomTenguArenaCell());
GameScene.flash(0x80FFFFFF);
Sample.INSTANCE.play(Assets.Sounds.BLAST);
state = State.WON;
break;
}
}
@Override
public Group addVisuals() {
super.addVisuals();
PrisonLevel.addPrisonVisuals(this, visuals);
return visuals;
}
private static final int W = Terrain.WALL;
private static final int D = Terrain.DOOR;
private static final int L = Terrain.LOCKED_DOOR;
private static final int e = Terrain.EMPTY;
private static final int T = Terrain.INACTIVE_TRAP;
private static final int E = Terrain.ENTRANCE;
private static final int X = Terrain.EXIT;
private static final int M = Terrain.WALL_DECO;
private static final int P = Terrain.PEDESTAL;
//TODO if I ever need to store more static maps I should externalize them instead of hard-coding
//Especially as I means I won't be limited to legal identifiers
private static final int[] MAP_START =
{ W, W, W, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, E, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, D, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, M, W, L, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W};
private static final int[] MAP_MAZE =
{ W, W, W, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, e, e, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, e, D, e, e, e, D, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, W, e, e, e, W, W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, W, W, W, W, W, W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, W, W, e, W, W, W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, W, W, D, W, W, W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, M, W, W, e, W, W, M, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, D, e, D, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, M, W, W, e, W, W, M, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, D, e, D, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, M, W, W, e, W, W, M, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, D, e, D, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, M, W, W, e, W, W, M, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, D, e, D, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, W, W, e, W, W, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, W, W, e, W, W, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, M, W, D, W, M, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, T, T, T, T, T, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, T, T, T, T, T, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, T, T, T, T, T, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W,
W, W, W, T, T, T, T, T, W, e, W, W, W, W, W, W, W, W, W, W, e, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, e, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W};
private static final int[] MAP_ARENA =
{ W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W,
W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W, W,
W, e, e, e, e, e, W, e, e, e, e, e, W, W, M, W, W, e, e, e, e, e, W, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, W, e, e, e, e, W, W, e, e, e, W, W, e, e, e, e, W, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, W, W, e, e, e, e, e, D, e, e, e, D, e, e, e, e, e, W, W, e, e, e, e, W, W, W, W,
W, e, e, W, W, W, M, e, e, e, e, W, W, e, e, e, W, W, e, e, e, e, M, W, W, W, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, e, e, e, e, W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, e, W, e, e, e, e, e, e, e, W, e, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, W, W, e, e, e, e, e, e, e, W, W, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, e, W, e, e, e, W, W, W, W,
W, e, e, W, W, D, W, W, e, e, e, e, W, e, e, e, W, e, e, e, e, W, W, D, W, W, e, e, W, W, W, W,
W, e, W, W, e, e, e, W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, e, e, e, W, W, e, W, W, W, W,
W, e, W, W, e, e, e, W, W, e, e, e, e, e, M, e, e, e, e, e, W, W, e, e, e, W, W, e, W, W, W, W,
W, e, W, W, e, e, e, W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, e, e, e, W, W, e, W, W, W, W,
W, e, e, W, W, D, W, W, e, e, e, e, W, e, e, e, W, e, e, e, e, W, W, D, W, W, e, e, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, e, W, e, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, W, W, e, e, e, e, e, e, e, W, W, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, e, W, e, e, e, e, e, e, e, W, e, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, e, e, e, e, W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, e, e, e, e, e, e, W, W, M, W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W,
W, e, e, W, W, W, W, e, e, e, e, W, W, e, e, e, W, W, e, e, e, e, W, W, W, W, e, e, W, W, W, W,
W, e, e, e, e, M, W, e, e, e, e, e, D, e, e, e, D, e, e, e, e, e, W, M, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, W, e, e, e, e, W, W, e, e, e, W, W, e, e, e, e, W, e, e, e, e, e, W, W, W, W,
W, e, e, e, e, e, W, e, e, e, e, e, W, W, W, W, W, e, e, e, e, e, W, e, e, e, e, e, W, W, W, W,
W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, W, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W, W,
W, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W};
private static final int[] MAP_END =
{ W, W, W, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, E, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, D, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, M, e, W, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, e, e, e, e, e, e, e, e, e, e, e, e, e, X, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, W, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, M, W, W, e, W, W, e, W, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, W, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, D, e, D, e, e, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, e, e, e, W, e, W, e, e, e, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, e, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, M, W, D, W, M, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, P, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, T, T, T, T, T, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W,
W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W, W};
public static class exitVisual extends CustomTilemap {
{
texture = Assets.Environment.PRISON_EXIT_OLD;
tileW = 12;
tileH = 14;
}
final int TEX_WIDTH = 256;
private static short[] render = new short[]{
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
@Override
public Tilemap create() {
Tilemap v = super.create();
int[] data = mapSimpleImage(0, 0, TEX_WIDTH);
for (int i = 0; i < data.length; i++){
if (render[i] == 0) data[i] = -1;
}
v.map(data, tileW);
return v;
}
}
public static class exitVisualWalls extends CustomTilemap {
{
texture = Assets.Environment.PRISON_EXIT_OLD;
tileW = 12;
tileH = 14;
}
final int TEX_WIDTH = 256;
private static short[] render = new short[]{
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
@Override
public Tilemap create() {
Tilemap v = super.create();
int[] data = mapSimpleImage(4, 0, TEX_WIDTH);
for (int i = 0; i < data.length; i++){
if (render[i] == 0) data[i] = -1;
}
v.map(data, tileW);
return v;
}
}
}

View File

@ -31,7 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StormCloud;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Doom;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.NewTengu;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Tengu;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
@ -61,7 +61,7 @@ import com.watabou.utils.Rect;
import java.util.ArrayList;
public class NewPrisonBossLevel extends Level {
public class PrisonBossLevel extends Level {
{
color1 = 0x6a723d;
@ -81,7 +81,7 @@ public class NewPrisonBossLevel extends Level {
}
private State state;
private NewTengu tengu;
private Tengu tengu;
public State state(){
return state;
@ -118,11 +118,11 @@ public class NewPrisonBossLevel extends Level {
//in some states tengu won't be in the world, in others he will be.
if (state == State.START || state == State.TRAP_MAZES || state == State.FIGHT_PAUSE) {
tengu = (NewTengu)bundle.get( TENGU );
tengu = (Tengu)bundle.get( TENGU );
} else {
for (Mob mob : mobs){
if (mob instanceof NewTengu) {
tengu = (NewTengu) mob;
if (mob instanceof Tengu) {
tengu = (Tengu) mob;
break;
}
}
@ -479,8 +479,8 @@ public class NewPrisonBossLevel extends Level {
cleanMapState();
for (Item item : storedItems) {
if (!(item instanceof NewTengu.BombAbility.BombItem)
&& !(item instanceof NewTengu.ShockerAbility.ShockerItem)) {
if (!(item instanceof Tengu.BombAbility.BombItem)
&& !(item instanceof Tengu.ShockerAbility.ShockerItem)) {
drop(item, randomTenguCellPos());
}
}
@ -519,7 +519,7 @@ public class NewPrisonBossLevel extends Level {
@Override
protected void createMobs() {
tengu = new NewTengu(); //We want to keep track of tengu independently of other mobs, he's not always in the level.
tengu = new Tengu(); //We want to keep track of tengu independently of other mobs, he's not always in the level.
}
public Actor addRespawner() {

View File

@ -22,7 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.NewTengu;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Tengu;
public class TenguDartTrap extends PoisonDartTrap {
@ -38,6 +38,6 @@ public class TenguDartTrap extends PoisonDartTrap {
@Override
protected boolean canTarget(Char ch) {
return !(ch instanceof NewTengu);
return !(ch instanceof Tengu);
}
}