Merging 1.9.1 source: actor changes (minus questgivers, they will be done separately)

This commit is contained in:
Evan Debenham 2015-11-10 04:12:06 -05:00
parent 83d492440e
commit 3fdd6452db
9 changed files with 34 additions and 31 deletions

View File

@ -57,7 +57,7 @@ public class Fire extends Blob {
if (fire <= 0 && flamable[pos]) {
int oldTile = Dungeon.level.map[pos];
Level.set( pos, Terrain.EMBERS );
Dungeon.level.destroy( pos );
observe = true;
GameScene.updateMap( pos );

View File

@ -39,21 +39,24 @@ public class Regrowth extends Blob {
if (volume > 0) {
boolean mapUpdated = false;
for (int i=0; i < LENGTH; i++) {
if (off[i] > 0) {
int c = Dungeon.level.map[i];
int c1 = c;
if (c == Terrain.EMPTY || c == Terrain.EMBERS || c == Terrain.EMPTY_DECO) {
Level.set( i, cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS );
mapUpdated = true;
c1 = cur[i] > 9 ? Terrain.HIGH_GRASS : Terrain.GRASS;
} else if (c == Terrain.GRASS && cur[i] > 9 && Dungeon.level.plants.get(i) == null ) {
c1 = Terrain.HIGH_GRASS;
}
if (c1 != c) {
Level.set( i, Terrain.HIGH_GRASS );
mapUpdated = true;
Dungeon.observe();
GameScene.updateMap( i );
if (Dungeon.visible[i]) {
GameScene.discoverTile( i, c );
}
}
Char ch = Actor.findChar( i );
@ -62,11 +65,6 @@ public class Regrowth extends Blob {
}
}
}
if (mapUpdated) {
GameScene.updateMap();
Dungeon.observe();
}
}
}

View File

@ -65,6 +65,7 @@ public class WaterOfHealth extends WellWater {
protected Item affectItem( Item item ) {
if (item instanceof DewVial && !((DewVial)item).isFull()) {
((DewVial)item).fill();
Journal.remove( Feature.WELL_OF_HEALTH );
return item;
}

View File

@ -112,7 +112,7 @@ public class WaterOfTransmutation extends WellWater {
if (n != null) {
int level = w.level;
int level = w.level();
if (level > 0) {
n.upgrade( level );
} else if (level < 0) {
@ -137,9 +137,9 @@ public class WaterOfTransmutation extends WellWater {
n = (Ring)Generator.random( Category.RING );
} while (n.getClass() == r.getClass());
n.level = 0;
n.level(0);
int level = r.level;
int level = r.level();
if (level > 0) {
n.upgrade( level );
} else if (level < 0) {
@ -173,9 +173,8 @@ public class WaterOfTransmutation extends WellWater {
n = (Wand)Generator.random( Category.WAND );
} while (n.getClass() == w.getClass());
n.level = 0;
n.updateLevel();
n.upgrade( w.level );
n.level( 0 );
n.upgrade( w.level() );
n.levelKnown = w.levelKnown;
n.cursedKnown = w.cursedKnown;

View File

@ -321,7 +321,7 @@ public class Hero extends Char {
@Override
public int dr() {
int dr = belongings.armor != null ? Math.max( belongings.armor.DR, 0 ) : 0;
int dr = belongings.armor != null ? Math.max( belongings.armor.DR(), 0 ) : 0;
Barkskin barkskin = buff( Barkskin.class );
if (barkskin != null) {
dr += barkskin.level();

View File

@ -428,13 +428,18 @@ public abstract class Mob extends Char {
}
Badges.validateNightHunter();
}
if (Dungeon.hero.lvl <= maxLvl && EXP > 0) {
Dungeon.hero.sprite.showStatus( CharSprite.POSITIVE, TXT_EXP, EXP );
Dungeon.hero.earnExp( EXP );
int exp = exp();
if (exp > 0) {
Dungeon.hero.sprite.showStatus( CharSprite.POSITIVE, TXT_EXP, exp );
Dungeon.hero.earnExp( exp );
}
}
}
public int exp() {
return Dungeon.hero.lvl <= maxLvl ? EXP : 0;
}
@Override
public void die( Object cause ) {

View File

@ -91,7 +91,7 @@ public class Skeleton extends Mob {
Item loot = Generator.random( Generator.Category.WEAPON );
for (int i=0; i < 2; i++) {
Item l = Generator.random( Generator.Category.WEAPON );
if (l.level < loot.level) {
if (l.level() < loot.level()) {
loot = l;
}
}

View File

@ -55,7 +55,7 @@ public class Statue extends Mob {
do {
weapon = (Weapon)Generator.random( Generator.Category.WEAPON );
} while (!(weapon instanceof MeleeWeapon) || weapon.level < 0);
} while (!(weapon instanceof MeleeWeapon) || weapon.level() < 0);
weapon.identify();
weapon.enchant( Enchantment.random() );
@ -88,7 +88,7 @@ public class Statue extends Mob {
@Override
public int damageRoll() {
return Random.NormalIntRange( weapon.MIN, weapon.MAX );
return Random.NormalIntRange( weapon.min(), weapon.max() );
}
@Override

View File

@ -183,7 +183,7 @@ public class Blacksmith extends NPC {
return "I don't work with cursed items!";
}
if (item1.level < 0 || item2.level < 0) {
if (item1.level() < 0 || item2.level() < 0) {
return "It's a junk, the quality is too poor!";
}
@ -197,7 +197,7 @@ public class Blacksmith extends NPC {
public static void upgrade( Item item1, Item item2 ) {
Item first, second;
if (item2.level > item1.level) {
if (item2.level() > item1.level()) {
first = item2;
second = item1;
} else {