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.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shock.class, com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shock.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swing" ); "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.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfEnchantment.class, com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion.class,
"com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade" ); "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.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; 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.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.*; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.*;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
@ -116,11 +116,7 @@ public class WaterOfTransmutation extends WellWater {
n.degrade( -level ); n.degrade( -level );
} }
//FIXME enchantment should be preserved. n.enchantment = w.enchantment;
/*if (w.isEnchanted()) {
n.enchant();
}*/
n.levelKnown = w.levelKnown; n.levelKnown = w.levelKnown;
n.cursedKnown = w.cursedKnown; n.cursedKnown = w.cursedKnown;
n.cursed = w.cursed; n.cursed = w.cursed;
@ -197,9 +193,9 @@ public class WaterOfTransmutation extends WellWater {
private Scroll changeScroll( Scroll s ) { private Scroll changeScroll( Scroll s ) {
if (s instanceof ScrollOfUpgrade) { if (s instanceof ScrollOfUpgrade) {
return new ScrollOfWeaponUpgrade(); return new ScrollOfMagicalInfusion();
} else if (s instanceof ScrollOfWeaponUpgrade) { } else if (s instanceof ScrollOfMagicalInfusion) {
return new ScrollOfUpgrade(); 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.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; 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.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
@ -625,7 +625,7 @@ public class Hero extends Char {
} else { } else {
boolean important = 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()); ((item instanceof PotionOfStrength || item instanceof PotionOfMight) && ((Potion)item).isKnown());
if (important) { if (important) {
GLog.p( TXT_YOU_NOW_HAVE, item.name() ); GLog.p( TXT_YOU_NOW_HAVE, item.name() );

View File

@ -95,7 +95,7 @@ public class Generator {
ScrollOfRage.class, ScrollOfRage.class,
ScrollOfTerror.class, ScrollOfTerror.class,
ScrollOfLullaby.class, ScrollOfLullaby.class,
ScrollOfWeaponUpgrade.class, ScrollOfMagicalInfusion.class,
ScrollOfPsionicBlast.class, ScrollOfPsionicBlast.class,
ScrollOfMirrorImage.class }; ScrollOfMirrorImage.class };
Category.SCROLL.probs = new float[]{ 30, 10, 15, 0, 10, 15, 12, 8, 8, 0, 3, 6 }; 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 { public class Stylus extends Item {
private static final String TXT_SELECT_ARMOR = "Select an armor to inscribe on"; 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; private static final float TIME_TO_INSCRIBE = 2;

View File

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

View File

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

View File

@ -21,33 +21,35 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; 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"; name = "Scroll of Magical Infusion";
inventoryTitle = "Select a weapon to upgrade"; inventoryTitle = "Select an item to infuse";
mode = WndBag.Mode.WEAPON; mode = WndBag.Mode.ENCHANTABLE;
bones = true; bones = true;
} }
@Override @Override
protected void onItemSelected( Item item ) { protected void onItemSelected( Item item ) {
ScrollOfRemoveCurse.uncurse( Dungeon.hero, item );
if (item instanceof Weapon)
((Weapon)item).upgrade(true);
else
((Armor)item).upgrade(true);
Weapon weapon = (Weapon)item; GLog.p( TXT_INFUSE, item.name() );
ScrollOfRemoveCurse.uncurse( Dungeon.hero, weapon ); Badges.validateItemLevelAquired( item );
weapon.upgrade( true );
GLog.p( TXT_LOOKS_BETTER, weapon.name() );
Badges.validateItemLevelAquired( weapon );
curUser.sprite.emitter().start( Speck.factory( Speck.UP ), 0.2f, 3 ); curUser.sprite.emitter().start( Speck.factory( Speck.UP ), 0.2f, 3 );
} }
@ -55,8 +57,8 @@ public class ScrollOfWeaponUpgrade extends InventoryScroll {
@Override @Override
public String desc() { public String desc() {
return return
"This scroll will upgrade a melee weapon, improving its quality. In contrast to a regular Scroll of Upgrade, " + "This scroll will infuse a weapon or armor with powerful magical energy.\n\n" +
"this specialized version will never destroy an enchantment on a weapon. On the contrary, it is able to imbue " + "In addition to being upgraded, A weapon will gain a magical enchantment, or armor will be imbued with a magical glyph.\n\n" +
"an unenchanted weapon with a random enchantment."; "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; private int hitsToKnow = HITS_TO_KNOW;
protected Enchantment enchantment; public Enchantment enchantment;
@Override @Override
public void proc( Char attacker, Char defender, int damage ) { public void proc( Char attacker, Char defender, int damage ) {
@ -223,7 +223,7 @@ public class Weapon extends KindOfWeapon {
public boolean isEnchanted() { public boolean isEnchanted() {
return enchantment != null; return enchantment != null;
} }
@Override @Override
public ItemSprite.Glowing glowing() { public ItemSprite.Glowing glowing() {
return enchantment != null ? enchantment.glowing() : null; return enchantment != null ? enchantment.glowing() : null;

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.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; 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.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door; import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.HighGrass; 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.Float() > Math.pow(0.95, bonus)){
if (Random.Int(2) == 0) if (Random.Int(2) == 0)
addItemToSpawn( new ScrollOfWeaponUpgrade() ); addItemToSpawn( new ScrollOfMagicalInfusion() );
else else
addItemToSpawn( new PotionOfMight() ); addItemToSpawn( new PotionOfMight() );
} }