v0.4.0: updated well of transformation logic

This commit is contained in:
Evan Debenham 2016-06-09 07:19:29 -04:00 committed by Evan Debenham
parent 13bb64468e
commit 51fedcb229
2 changed files with 29 additions and 51 deletions

View File

@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.BattleAxe; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.BattleAxe;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dagger; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dagger;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Glaive; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Glaive;
@ -47,8 +48,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Quarterstaff;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Spear; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Spear;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sword;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WarHammer; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WarHammer;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.watabou.utils.Random;
public class WaterOfTransmutation extends WellWater { public class WaterOfTransmutation extends WellWater {
@ -87,59 +90,34 @@ public class WaterOfTransmutation extends WellWater {
emitter.start( Speck.factory( Speck.CHANGE ), 0.2f, 0 ); emitter.start( Speck.factory( Speck.CHANGE ), 0.2f, 0 );
} }
private MeleeWeapon changeWeapon( MeleeWeapon w ) { private Weapon changeWeapon( MeleeWeapon w ) {
MeleeWeapon n = null; Weapon n;
Category c = Generator.wepTiers[w.tier-1];
if (w instanceof Knuckles) {
n = new Dagger();
} else if (w instanceof Dagger) {
n = new Knuckles();
}
else if (w instanceof Spear) {
n = new Quarterstaff();
} else if (w instanceof Quarterstaff) {
n = new Spear();
}
else if (w instanceof Sword) {
n = new Mace();
} else if (w instanceof Mace) {
n = new Sword();
}
else if (w instanceof Longsword) {
n = new BattleAxe();
} else if (w instanceof BattleAxe) {
n = new Longsword();
}
else if (w instanceof Glaive) {
n = new WarHammer();
} else if (w instanceof WarHammer) {
n = new Glaive();
}
if (n != null) {
int level = w.level();
if (level > 0) {
n.upgrade( level );
} else if (level < 0) {
n.degrade( -level );
}
n.enchantment = w.enchantment; do {
n.levelKnown = w.levelKnown; try {
n.cursedKnown = w.cursedKnown; n = (Weapon)c.classes[Random.chances(c.probs)].newInstance();
n.cursed = w.cursed; } catch (Exception e) {
n.imbue = w.imbue; return null;
}
return n; } while (!(n instanceof MeleeWeapon) || n.getClass() == w.getClass());
} else {
return null; int level = w.level();
if (level > 0) {
n.upgrade( level );
} else if (level < 0) {
n.degrade( -level );
} }
n.enchantment = w.enchantment;
n.levelKnown = w.levelKnown;
n.cursedKnown = w.cursedKnown;
n.cursed = w.cursed;
n.imbue = w.imbue;
return n;
} }
private Ring changeRing( Ring r ) { private Ring changeRing( Ring r ) {

View File

@ -332,7 +332,7 @@ public class Generator {
} }
} }
private static final Category[] wepTiers = new Category[]{ public static final Category[] wepTiers = new Category[]{
Category.WEP_T1, Category.WEP_T1,
Category.WEP_T2, Category.WEP_T2,
Category.WEP_T3, Category.WEP_T3,