Merging 1.7.5 Source: actors/hero changes
This commit is contained in:
parent
bbe6c79ab3
commit
e951b7aad8
|
@ -173,7 +173,7 @@ public class Belongings implements Iterable<Item> {
|
|||
item.detachAll( backpack );
|
||||
}
|
||||
} else if (item.unique) {
|
||||
|
||||
// Keep unique items
|
||||
} else if (!item.isEquipped( owner )) {
|
||||
item.detachAll( backpack );
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEvasion;
|
||||
|
@ -79,9 +81,11 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfHaste;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfTenacity;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||
|
@ -89,6 +93,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.AlchemyPot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Sign;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
|
@ -110,6 +115,7 @@ import com.watabou.utils.Bundle;
|
|||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Hero extends Char {
|
||||
|
@ -508,7 +514,7 @@ public class Hero extends Char {
|
|||
}
|
||||
|
||||
public void interrupt() {
|
||||
if (curAction != null && curAction.dst != pos) {
|
||||
if (isAlive() && curAction != null && curAction.dst != pos) {
|
||||
lastAction = curAction;
|
||||
}
|
||||
curAction = null;
|
||||
|
@ -529,9 +535,10 @@ public class Hero extends Char {
|
|||
|
||||
} else {
|
||||
if (Dungeon.level.map[pos] == Terrain.SIGN) {
|
||||
GameScene.show( new WndMessage( Dungeon.tip() ) );
|
||||
Sign.read(pos);
|
||||
}
|
||||
ready();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -614,11 +621,13 @@ public class Hero extends Char {
|
|||
if (item instanceof Dewdrop
|
||||
|| item instanceof TimekeepersHourglass.sandBag
|
||||
|| item instanceof DriedRose.Petal) {
|
||||
|
||||
//Do Nothing
|
||||
} else {
|
||||
|
||||
if ((item instanceof ScrollOfUpgrade && ((ScrollOfUpgrade)item).isKnown()) ||
|
||||
(item instanceof PotionOfStrength && ((PotionOfStrength)item).isKnown())) {
|
||||
boolean important =
|
||||
((item instanceof ScrollOfUpgrade || item instanceof ScrollOfWeaponUpgrade) && ((Scroll)item).isKnown()) ||
|
||||
((item instanceof PotionOfStrength || item instanceof PotionOfMight) && ((Potion)item).isKnown());
|
||||
if (important) {
|
||||
GLog.p( TXT_YOU_NOW_HAVE, item.name() );
|
||||
} else {
|
||||
GLog.i( TXT_YOU_NOW_HAVE, item.name() );
|
||||
|
@ -660,10 +669,8 @@ public class Hero extends Char {
|
|||
if (Level.adjacent( pos, dst ) || pos == dst) {
|
||||
|
||||
Heap heap = Dungeon.level.heaps.get( dst );
|
||||
if (heap != null &&
|
||||
(heap.type == Type.CHEST || heap.type == Type.TOMB || heap.type == Type.SKELETON ||
|
||||
heap.type == Type.REMAINS || heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST)) {
|
||||
|
||||
if (heap != null && (heap.type != Type.HEAP && heap.type != Type.FOR_SALE)) {
|
||||
|
||||
theKey = null;
|
||||
|
||||
if (heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST) {
|
||||
|
@ -831,7 +838,7 @@ public class Hero extends Char {
|
|||
|
||||
enemy = action.target;
|
||||
|
||||
if (Level.adjacent( pos, enemy.pos ) && enemy.isAlive() && !pacified) {
|
||||
if (Level.adjacent( pos, enemy.pos ) && enemy.isAlive() && !isCharmedBy( enemy )) {
|
||||
|
||||
spend( attackDelay() );
|
||||
sprite.attack( enemy.pos );
|
||||
|
@ -888,7 +895,7 @@ public class Hero extends Char {
|
|||
}
|
||||
case SNIPER:
|
||||
if (rangedWeapon != null) {
|
||||
Buff.prolong( enemy, SnipersMark.class, attackDelay() * 1.1f );
|
||||
Buff.prolong( this, SnipersMark.class, attackDelay() * 1.1f ).object = enemy.id();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -985,6 +992,7 @@ public class Hero extends Char {
|
|||
private boolean getCloser( final int target ) {
|
||||
|
||||
if (rooted) {
|
||||
Camera.main.shake( 1, 1f );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1047,9 +1055,8 @@ public class Hero extends Char {
|
|||
|
||||
curAction = new HeroAction.Cook( cell );
|
||||
|
||||
} else
|
||||
if (Level.fieldOfView[cell] && (ch = Actor.findChar( cell )) instanceof Mob) {
|
||||
|
||||
} else if (Level.fieldOfView[cell] && (ch = Actor.findChar( cell )) instanceof Mob) {
|
||||
|
||||
if (ch instanceof NPC) {
|
||||
curAction = new HeroAction.Interact( (NPC)ch );
|
||||
} else {
|
||||
|
@ -1299,7 +1306,29 @@ public class Hero extends Char {
|
|||
Dungeon.observe();
|
||||
|
||||
Dungeon.hero.belongings.identify();
|
||||
|
||||
|
||||
int pos = Dungeon.hero.pos;
|
||||
|
||||
ArrayList<Integer> passable = new ArrayList<Integer>();
|
||||
for (Integer ofs : Level.NEIGHBOURS8) {
|
||||
int cell = pos + ofs;
|
||||
if ((Level.passable[cell] || Level.avoid[cell]) && Dungeon.level.heaps.get( cell ) == null) {
|
||||
passable.add( cell );
|
||||
}
|
||||
}
|
||||
Collections.shuffle( passable );
|
||||
|
||||
ArrayList<Item> items = new ArrayList<Item>( Dungeon.hero.belongings.backpack.items );
|
||||
for (Integer cell : passable) {
|
||||
if (items.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Item item = Random.element( items );
|
||||
Dungeon.level.drop( item, cell ).sprite.drop( pos );
|
||||
items.remove( item );
|
||||
}
|
||||
|
||||
GameScene.gameOver();
|
||||
|
||||
if (cause instanceof Hero.Doom) {
|
||||
|
@ -1498,7 +1527,12 @@ public class Hero extends Char {
|
|||
}
|
||||
return immunities;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void next() {
|
||||
super.next();
|
||||
}
|
||||
|
||||
public static interface Doom {
|
||||
public void onDeath();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user