Merging Source v1.7.2: actor changes

This commit is contained in:
Evan Debenham
2014-10-20 23:51:15 -04:00
parent 724338b57f
commit 4a49763309
30 changed files with 980 additions and 682 deletions
@@ -43,7 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Blacksmith extends Mob.NPC {
public class Blacksmith extends NPC {
private static final String TXT_GOLD_1 =
"Hey human! Wanna be useful, eh? Take dis pickaxe and mine me some _dark gold ore_, _15 pieces_ should be enough. " +
@@ -167,8 +167,8 @@ public class Blacksmith extends Mob.NPC {
if (item1 == item2) {
return "Select 2 different items, not the same item twice!";
}
if (!item1.isSimilar( item2 )) {
if (item1.getClass() != item2.getClass()) {
return "Select 2 items of the same type!";
}
@@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs;
import java.util.HashSet;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.StenchGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
@@ -27,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Crab;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Gnoll;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Rat;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.RatSkull;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
@@ -61,7 +63,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndSadGhost;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Ghost extends Mob.NPC {
public class Ghost extends NPC {
{
name = "sad ghost";
@@ -69,7 +71,7 @@ public class Ghost extends Mob.NPC {
flying = true;
state = State.WANDERING;
state = WANDERING;
}
private static final String TXT_RAT1 =
@@ -195,7 +197,6 @@ public class Ghost extends Mob.NPC {
txt_quest = TXT_CRAB1; break;
}
questBoss.state = Mob.State.WANDERING;
questBoss.pos = Dungeon.level.randomRespawnCell();
if (questBoss.pos != -1) {
@@ -353,6 +354,10 @@ public class Ghost extends Mob.NPC {
}
}
//TODO this is silly, why trap the player with bad armour? Just remove the button from the window.
if (Dungeon.isChallenged( Challenges.NO_ARMOR ))
armor = (Armor)new ClothArmor().degrade();
weapon.identify();
armor.identify();
}
@@ -386,6 +391,8 @@ public class Ghost extends Mob.NPC {
defenseSkill = 4;
EXP = 4;
state = WANDERING;
}
@Override
@@ -445,6 +452,8 @@ public class Ghost extends Mob.NPC {
EXP = 5;
state = WANDERING;
loot = Generator.random(CurareDart.class);
lootChance = 1f;
}
@@ -489,7 +498,7 @@ public class Ghost extends Mob.NPC {
@Override
protected boolean getCloser( int target ) {
combo = 0; //if he's moving, he isn't attacking, reset combo.
if (state == State.HUNTING) {
if (state == HUNTING) {
return enemySeen && getFurther( target );
} else {
return super.getCloser( target );
@@ -573,6 +582,7 @@ public class Ghost extends Mob.NPC {
EXP = 6;
state = WANDERING;
}
private boolean moving = true;
@@ -38,7 +38,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndQuest;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Imp extends Mob.NPC {
public class Imp extends NPC {
{
name = "ambitious imp";
@@ -21,6 +21,8 @@ import java.util.HashSet;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
@@ -29,13 +31,13 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.MirrorSprite;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class MirrorImage extends Mob.NPC {
public class MirrorImage extends NPC {
{
name = "mirror image";
spriteClass = MirrorSprite.class;
state = State.HUNTING;
state = HUNTING;
enemy = DUMMY;
}
@@ -134,5 +136,16 @@ public class MirrorImage extends Mob.NPC {
Dungeon.hero.spend( 1 / Dungeon.hero.speed() );
Dungeon.hero.busy();
}
private static final HashSet<Class<?>> IMMUNITIES = new HashSet<Class<?>>();
static {
IMMUNITIES.add( ToxicGas.class );
IMMUNITIES.add( Burning.class );
}
@Override
public HashSet<Class<?>> immunities() {
return IMMUNITIES;
}
}
@@ -0,0 +1,52 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* 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.npcs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.watabou.utils.Random;
public abstract class NPC extends Mob {
{
HP = HT = 1;
EXP = 0;
hostile = false;
state = PASSIVE;
}
protected void throwItem() {
Heap heap = Dungeon.level.heaps.get( pos );
if (heap != null) {
int n;
do {
n = pos + Level.NEIGHBOURS8[Random.Int( 8 )];
} while (!Level.passable[n] && !Level.avoid[n]);
Dungeon.level.drop( heap.pickUp(), n ).sprite.drop( pos );
}
}
@Override
public void beckon( int cell ) {
}
abstract public void interact();
}
@@ -24,13 +24,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatKingSprite;
public class RatKing extends Mob.NPC {
public class RatKing extends NPC {
{
name = "rat king";
spriteClass = RatKingSprite.class;
state = State.SLEEPING;
state = SLEEPEING;
}
@Override
@@ -64,10 +64,10 @@ public class RatKing extends Mob.NPC {
@Override
public void interact() {
sprite.turnTo( pos, Dungeon.hero.pos );
if (state == State.SLEEPING) {
if (state == SLEEPEING) {
notice();
yell( "I'm not sleeping!" );
state = State.WANDERING;
state = WANDERING;
} else {
yell( "What is it? I have no time for this nonsense. My kingdom won't rule itself!" );
}
@@ -29,7 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ShopkeeperSprite;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem;
public class Shopkeeper extends Mob.NPC {
public class Shopkeeper extends NPC {
public static final String TXT_THIEF = "Thief, Thief!";
@@ -63,7 +63,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndWandmaker;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Wandmaker extends Mob.NPC {
public class Wandmaker extends NPC {
{
name = "old wandmaker";