Merging 1.9.1 source: item changes

This commit is contained in:
Evan Debenham
2015-11-11 02:01:25 -05:00
parent bc1e3ee17a
commit 366dce1610
86 changed files with 409 additions and 352 deletions
@@ -389,7 +389,7 @@ public class CursedWand {
do {
reward = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR,
Generator.Category.RING, Generator.Category.WAND));
} while (reward.level < 2 && !(reward instanceof MissileWeapon));
} while (reward.level() < 2 && !(reward instanceof MissileWeapon));
Sample.INSTANCE.play(Assets.SND_MIMIC, 1, 1, 0.5f);
mimic.items.clear();
mimic.items.add(reward);
@@ -426,7 +426,7 @@ public class CursedWand {
do {
result = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR,
Generator.Category.RING, Generator.Category.ARTIFACT));
} while (result.level < 0 && !(result instanceof MissileWeapon));
} while (result.level() < 0 && !(result instanceof MissileWeapon));
if (result.isUpgradable()) result.upgrade();
result.cursed = result.cursedKnown = true;
GLog.w("your wand transmogrifies into a different item!");
@@ -55,11 +55,7 @@ public abstract class Wand extends Item {
private static final int USAGES_TO_KNOW = 20;
public static final String AC_ZAP = "ZAP";
private static final String TXT_WOOD = "This thin %s wand is warm to the touch. Who knows what it will do when used?";
private static final String TXT_DAMAGE = "When this wand is used as a melee weapon, its average damage is %d points per hit.";
private static final String TXT_WEAPON = "You can use this wand as a melee weapon.";
private static final String TXT_FIZZLES = "your wand fizzles; it must not have enough charge.";
private static final String TXT_SELF_TARGET = "You can't target yourself";
@@ -78,7 +74,6 @@ public abstract class Wand extends Item {
protected int usagesToKnow = USAGES_TO_KNOW;
protected int collisionProperties = Ballistica.MAGIC_BOLT;
{
defaultAction = AC_ZAP;
@@ -139,7 +134,7 @@ public abstract class Wand extends Item {
protected void processSoulMark(Char target, int chargesUsed){
if (target != Dungeon.hero &&
Dungeon.hero.subClass == HeroSubClass.WARLOCK &&
Random.Float() < .15f + (level*chargesUsed*0.03f)){
Random.Float() < .15f + (level()*chargesUsed*0.03f)){
SoulMark.prolong(target, SoulMark.class, SoulMark.DURATION);
}
}
@@ -156,13 +151,9 @@ public abstract class Wand extends Item {
}
}
public int level() {
if (charger != null) {
Magic magic = charger.target.buff( Magic.class );
return magic == null ? level : Math.max( level + magic.level, 0 );
} else {
return level;
}
public void level( int value) {
super.level( value );
updateLevel();
}
@Override
@@ -233,7 +224,7 @@ public abstract class Wand extends Item {
}
public void updateLevel() {
maxCharges = Math.min( initialCharges() + level, 10 );
maxCharges = Math.min( initialCharges() + level(), 10 );
curCharges = Math.min( curCharges, maxCharges );
}
@@ -299,10 +290,10 @@ public abstract class Wand extends Item {
price /= 2;
}
if (levelKnown) {
if (level > 0) {
price *= (level + 1);
} else if (level < 0) {
price /= (1 - level);
if (level() > 0) {
price *= (level() + 1);
} else if (level() < 0) {
price /= (1 - level());
}
}
if (price < 1) {
@@ -63,7 +63,7 @@ public class WandOfBlastWave extends Wand {
Sample.INSTANCE.play( Assets.SND_BLAST );
BlastWave.blast(bolt.collisionPos);
int damage = Random.NormalIntRange(1, 6+(int)(level*level/4f));
int damage = Random.NormalIntRange(1, 6+(int)(level()*level()/4f));
//presses all tiles in the AOE first
for (int i : Level.NEIGHBOURS9){
@@ -80,7 +80,7 @@ public class WandOfBlastWave extends Wand {
if (ch.isAlive()) {
Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT);
int strength = 1 + ((level + 1) / 3);
int strength = 1 + ((level() + 1) / 3);
throwChar(ch, trajectory, strength);
}
}
@@ -94,7 +94,7 @@ public class WandOfBlastWave extends Wand {
if (ch.isAlive() && bolt.path.size() > bolt.dist+1) {
Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT);
int strength = level + 3;
int strength = level() + 3;
throwChar(ch, trajectory, strength);
}
}
@@ -139,7 +139,7 @@ public class WandOfBlastWave extends Wand {
@Override
//a weaker knockback, not dissimilar to the glyph of bounce, but a fair bit stronger.
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
int level = Math.max(0, staff.level);
int level = Math.max(0, staff.level());
// lvl 0 - 25%
// lvl 1 - 40%
@@ -76,7 +76,7 @@ public class WandOfCorruption extends Wand {
return;
}
int basePower = 10 + 2*level;
int basePower = 10 + 2*level();
int mobPower = Random.IntRange(0, ch.HT) + ch.HP*2;
for ( Buff buff : ch.buffs()){
if (buff.type == Buff.buffType.NEGATIVE){
@@ -89,7 +89,7 @@ public class WandOfCorruption extends Wand {
//try to use extra charges to overpower the mob
while (basePower <= mobPower){
extraCharges++;
basePower += 5 + level;
basePower += 5 + level();
}
//if we fail, lose all charges, remember we have 1 left to lose from using the wand.
@@ -114,8 +114,8 @@ public class WandOfCorruption extends Wand {
// lvl 0 - 25%
// lvl 1 - 40%
// lvl 2 - 50%
if (Random.Int( level + 4 ) >= 3){
Buff.prolong( defender, Amok.class, 3+level);
if (Random.Int( level() + 4 ) >= 3){
Buff.prolong( defender, Amok.class, 3+level());
}
}
@@ -74,8 +74,8 @@ public class WandOfDisintegration extends Wand {
}
if (Level.flamable[c]) {
Level.set( c, Terrain.EMBERS );
Dungeon.level.destroy( c );
GameScene.updateMap( c );
terrainAffected = true;
@@ -68,7 +68,7 @@ public class WandOfFireblast extends Wand {
Char ch = Actor.findChar( cell );
if (ch != null) {
ch.damage(Random.NormalIntRange(1, (int) (8 + (level * level * (1 + chargesPerCast()) / 6f))), this);
ch.damage(Random.NormalIntRange(1, (int) (8 + (level() * level() * (1 + chargesPerCast()) / 6f))), this);
Buff.affect( ch, Burning.class ).reignite( ch );
switch(chargesPerCast()){
case 1:
@@ -57,7 +57,7 @@ public class WandOfFrost extends Wand {
Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null){
int damage = Random.NormalIntRange(5+level, 10+(level*level/3));
int damage = Random.NormalIntRange(5+level(), 10+(level()*level()/3));
if (ch.buff(Frost.class) != null){
return; //do nothing, can't affect a frozen target
@@ -65,7 +65,7 @@ public class WandOfFrost extends Wand {
if (ch.buff(Chill.class) != null){
damage = Math.round(damage * ch.buff(Chill.class).speedFactor());
} else {
ch.sprite.burst( 0xFF99CCFF, level / 2 + 2 );
ch.sprite.burst( 0xFF99CCFF, level() / 2 + 2 );
}
processSoulMark(ch, chargesPerCast());
@@ -74,12 +74,12 @@ public class WandOfFrost extends Wand {
if (ch.isAlive()){
if (Level.water[ch.pos]){
//20+(10*level)% chance
if (Random.Int(10) >= 8-level )
if (Random.Int(10) >= 8-level() )
Buff.affect(ch, Frost.class, Frost.duration(ch)*Random.Float(2f, 4f));
else
Buff.prolong(ch, Chill.class, 6+level);
Buff.prolong(ch, Chill.class, 6+level());
} else {
Buff.prolong(ch, Chill.class, 4+level);
Buff.prolong(ch, Chill.class, 4+level());
}
}
}
@@ -60,8 +60,8 @@ public class WandOfLightning extends Wand {
float multipler = 0.4f + (0.6f/affected.size());
if (Level.water[bolt.collisionPos]) multipler *= 1.5f;
int min = 5+level;
int max = Math.round(10 + (level * level / 4f));
int min = 5+level();
int max = Math.round(10 + (level() * level() / 4f));
for (Char ch : affected){
processSoulMark(ch, chargesPerCast());
@@ -42,13 +42,11 @@ public class WandOfMagicMissile extends Wand {
Char ch = Actor.findChar( bolt.collisionPos );
if (ch != null) {
int level = level();
processSoulMark(ch, chargesPerCast());
ch.damage(Random.NormalIntRange(4 , 6 + level * 2), this);
ch.damage(Random.NormalIntRange(4 , 6 + level() * 2), this);
ch.sprite.burst(0xFFFFFFFF, level / 2 + 2);
ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2);
}
}
@@ -56,8 +54,8 @@ public class WandOfMagicMissile extends Wand {
@Override
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
//gain 1 turn of recharging buff per level of the wand.
if (level > 0) {
Buff.prolong( attacker, ScrollOfRecharging.Recharging.class, (float)staff.level);
if (level() > 0) {
Buff.prolong( attacker, ScrollOfRecharging.Recharging.class, (float)staff.level());
SpellSprite.show(attacker, SpellSprite.CHARGE);
}
}
@@ -90,25 +90,25 @@ public class WandOfPrismaticLight extends Wand {
affectMap(beam);
if (curUser.viewDistance < 4)
Buff.prolong( curUser, Light.class, 10f+level*5);
Buff.prolong( curUser, Light.class, 10f+level()*5);
}
private void affectTarget(Char ch){
int dmg = Random.NormalIntRange(level, (int) (8+(level*(level/5f))));
int dmg = Random.NormalIntRange(level(), (int) (8+(level()*(level()/5f))));
//three in (5+lvl) chance of failing
if (Random.Int(5+level) >= 3) {
Buff.prolong(ch, Blindness.class, 2f + (level * 0.34f));
if (Random.Int(5+level()) >= 3) {
Buff.prolong(ch, Blindness.class, 2f + (level() * 0.34f));
ch.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 );
}
if (evilMobs.contains(ch.getClass())){
ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10+level );
ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10+level() );
Sample.INSTANCE.play(Assets.SND_BURNING);
ch.damage((int)(dmg*1.5), this);
} else {
ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level );
ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level() );
ch.damage(dmg, this);
}
@@ -156,7 +156,7 @@ public class WandOfPrismaticLight extends Wand {
@Override
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
//cripples enemy
Buff.prolong( defender, Cripple.class, 1f+staff.level);
Buff.prolong( defender, Cripple.class, 1f+staff.level());
}
@Override
@@ -168,7 +168,7 @@ public class WandOfRegrowth extends Wand {
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
//like vampiric enchantment, except with herbal healing buff
int level = Math.max( 0, staff.level );
int level = Math.max( 0, staff.level() );
// lvl 0 - 33%
// lvl 1 - 43%
@@ -109,24 +109,24 @@ public class WandOfTransfusion extends Wand {
int missingHP = ch.HT - ch.HP;
//heals 30%+3%*lvl missing HP.
int healing = (int)Math.ceil((missingHP * (0.30f+(0.03f*level))));
int healing = (int)Math.ceil((missingHP * (0.30f+(0.03f*level()))));
ch.HP += healing;
ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 + level / 2);
ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 + level() / 2);
ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing);
//harms the undead
} else if (undeadMobs.contains(ch.getClass())){
//deals 30%+5%*lvl total HP.
int damage = (int) Math.ceil(ch.HT*(0.3f+(0.05f*level)));
int damage = (int) Math.ceil(ch.HT*(0.3f+(0.05f*level())));
ch.damage(damage, this);
ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + level);
ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + level());
Sample.INSTANCE.play(Assets.SND_BURNING);
//charms an enemy
} else {
float duration = 5+level;
float duration = 5+level();
Buff.affect(ch, Charm.class, Charm.durationFactor(ch) * duration).object = curUser.id();
duration *= Random.Float(0.75f, 1f);
@@ -143,14 +143,14 @@ public class WandOfTransfusion extends Wand {
Item item = heap.peek();
//30% + 10%*lvl chance to uncurse the item and reset it to base level if degraded.
if (item != null && Random.Float() <= 0.3f+level*0.1f){
if (item != null && Random.Float() <= 0.3f+level()*0.1f){
if (item.cursed){
item.cursed = false;
CellEmitter.get(cell).start( ShadowParticle.UP, 0.05f, 10 );
Sample.INSTANCE.play(Assets.SND_BURNING);
}
int lvldiffFromBase = item.level - (item instanceof Ring ? 1 : 0);
int lvldiffFromBase = item.level() - (item instanceof Ring ? 1 : 0);
if (lvldiffFromBase < 0){
item.upgrade(-lvldiffFromBase);
CellEmitter.get(cell).start(Speck.factory(Speck.UP), 0.2f, 3);
@@ -170,7 +170,7 @@ public class WandOfTransfusion extends Wand {
} else if (Dungeon.level.map[cell] == Terrain.EMBERS) {
//30% + 3%*lvl chance to grow a random plant, or just regrow grass.
if (Random.Float() <= 0.3f+level*0.03f) {
if (Random.Float() <= 0.3f+level()*0.03f) {
Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), cell);
CellEmitter.get( cell ).burst(LeafParticle.LEVEL_SPECIFIC, 8);
GameScene.updateMap(cell);
@@ -213,7 +213,7 @@ public class WandOfTransfusion extends Wand {
// lvl 0 - 10%
// lvl 1 - 18%
// lvl 2 - 25%
if (Random.Int( level + 10 ) >= 9){
if (Random.Int( level() + 10 ) >= 9){
//grants a free use of the staff
freeCharge = true;
GLog.p("Your staff is charged with the life energy of your enemy!");
@@ -45,8 +45,8 @@ public class WandOfVenom extends Wand {
@Override
protected void onZap(Ballistica bolt) {
Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level, VenomGas.class);
((VenomGas)venomGas).setStrength(level+1);
Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level(), VenomGas.class);
((VenomGas)venomGas).setStrength(level()+1);
GameScene.add(venomGas);
Char ch = Actor.findChar(bolt.collisionPos);