v0.2.4: corrected enchamtent/glyph logic, renamed scroll of Weapon Upgrade to Scroll of Magical Infusion

This commit is contained in:
Evan Debenham 2015-02-06 15:11:17 -05:00
parent 92afe5977e
commit b2e29708a0
10 changed files with 33 additions and 39 deletions

View File

@ -45,11 +45,11 @@ public class ShatteredPixelDungeon extends Game {
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shock.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swing" );
/* If I rename scroll of weapon upgrade, uncomment this and correct it.
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfEnchantment.class,
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion.class,
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade" );
*/
}

View File

@ -31,7 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.*;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
@ -116,11 +116,7 @@ public class WaterOfTransmutation extends WellWater {
n.degrade( -level );
}
//FIXME enchantment should be preserved.
/*if (w.isEnchanted()) {
n.enchant();
}*/
n.enchantment = w.enchantment;
n.levelKnown = w.levelKnown;
n.cursedKnown = w.cursedKnown;
n.cursed = w.cursed;
@ -197,9 +193,9 @@ public class WaterOfTransmutation extends WellWater {
private Scroll changeScroll( Scroll s ) {
if (s instanceof ScrollOfUpgrade) {
return new ScrollOfWeaponUpgrade();
return new ScrollOfMagicalInfusion();
} else if (s instanceof ScrollOfWeaponUpgrade) {
} else if (s instanceof ScrollOfMagicalInfusion) {
return new ScrollOfUpgrade();

View File

@ -85,7 +85,7 @@ 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.scrolls.ScrollOfMagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
@ -625,7 +625,7 @@ public class Hero extends Char {
} else {
boolean important =
((item instanceof ScrollOfUpgrade || item instanceof ScrollOfWeaponUpgrade) && ((Scroll)item).isKnown()) ||
((item instanceof ScrollOfUpgrade || item instanceof ScrollOfMagicalInfusion) && ((Scroll)item).isKnown()) ||
((item instanceof PotionOfStrength || item instanceof PotionOfMight) && ((Potion)item).isKnown());
if (important) {
GLog.p( TXT_YOU_NOW_HAVE, item.name() );

View File

@ -95,7 +95,7 @@ public class Generator {
ScrollOfRage.class,
ScrollOfTerror.class,
ScrollOfLullaby.class,
ScrollOfWeaponUpgrade.class,
ScrollOfMagicalInfusion.class,
ScrollOfPsionicBlast.class,
ScrollOfMirrorImage.class };
Category.SCROLL.probs = new float[]{ 30, 10, 15, 0, 10, 15, 12, 8, 8, 0, 3, 6 };

View File

@ -32,7 +32,7 @@ import java.util.ArrayList;
public class Stylus extends Item {
private static final String TXT_SELECT_ARMOR = "Select an armor to inscribe on";
private static final String TXT_INSCRIBED = "you inscribed the your %s with the stylus";
private static final String TXT_INSCRIBED = "you inscribed your %s with the stylus";
private static final float TIME_TO_INSCRIBE = 2;

View File

@ -172,10 +172,6 @@ public class Armor extends EquipableItem {
return super.upgrade();
}
public Item safeUpgrade() {
return upgrade( glyph != null );
}
@Override
public Item degrade() {
DR -= tier;

View File

@ -51,7 +51,7 @@ public abstract class Scroll extends Item {
ScrollOfRage.class,
ScrollOfTerror.class,
ScrollOfLullaby.class,
ScrollOfWeaponUpgrade.class,
ScrollOfMagicalInfusion.class,
ScrollOfPsionicBlast.class,
ScrollOfMirrorImage.class
};

View File

@ -21,18 +21,19 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class ScrollOfWeaponUpgrade extends InventoryScroll {
public class ScrollOfMagicalInfusion extends InventoryScroll {
private static final String TXT_LOOKS_BETTER = "your %s certainly looks better now";
private static final String TXT_INFUSE = "your %s is infused with arcane energy!";
{
name = "Scroll of Weapon Upgrade";
inventoryTitle = "Select a weapon to upgrade";
mode = WndBag.Mode.WEAPON;
name = "Scroll of Magical Infusion";
inventoryTitle = "Select an item to infuse";
mode = WndBag.Mode.ENCHANTABLE;
bones = true;
}
@ -40,14 +41,15 @@ public class ScrollOfWeaponUpgrade extends InventoryScroll {
@Override
protected void onItemSelected( Item item ) {
Weapon weapon = (Weapon)item;
ScrollOfRemoveCurse.uncurse( Dungeon.hero, item );
if (item instanceof Weapon)
((Weapon)item).upgrade(true);
else
((Armor)item).upgrade(true);
ScrollOfRemoveCurse.uncurse( Dungeon.hero, weapon );
weapon.upgrade( true );
GLog.p( TXT_INFUSE, item.name() );
GLog.p( TXT_LOOKS_BETTER, weapon.name() );
Badges.validateItemLevelAquired( weapon );
Badges.validateItemLevelAquired( item );
curUser.sprite.emitter().start( Speck.factory( Speck.UP ), 0.2f, 3 );
}
@ -55,8 +57,8 @@ public class ScrollOfWeaponUpgrade extends InventoryScroll {
@Override
public String desc() {
return
"This scroll will upgrade a melee weapon, improving its quality. In contrast to a regular Scroll of Upgrade, " +
"this specialized version will never destroy an enchantment on a weapon. On the contrary, it is able to imbue " +
"an unenchanted weapon with a random enchantment.";
"This scroll will infuse a weapon or armor with powerful magical energy.\n\n" +
"In addition to being upgraded, A weapon will gain a magical enchantment, or armor will be imbued with a magical glyph.\n\n" +
"If the item already has an enchantment or glyph, it will never be erased by the upgrade.";
}
}

View File

@ -56,7 +56,7 @@ public class Weapon extends KindOfWeapon {
private int hitsToKnow = HITS_TO_KNOW;
protected Enchantment enchantment;
public Enchantment enchantment;
@Override
public void proc( Char attacker, Char defender, int damage ) {

View File

@ -58,7 +58,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass;
@ -213,7 +213,7 @@ public abstract class Level implements Bundlable {
}
if (Random.Float() > Math.pow(0.95, bonus)){
if (Random.Int(2) == 0)
addItemToSpawn( new ScrollOfWeaponUpgrade() );
addItemToSpawn( new ScrollOfMagicalInfusion() );
else
addItemToSpawn( new PotionOfMight() );
}