v0.3.0: fixed a bug involving older saves

This commit is contained in:
Evan Debenham 2015-05-26 14:13:36 -04:00
parent 854fca08a3
commit 67601162f7
3 changed files with 13 additions and 12 deletions

View File

@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.levels.CavesBossLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.CavesLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.CityBossLevel;
@ -303,6 +304,15 @@ public class Dungeon {
Light light = hero.buff( Light.class );
hero.viewDistance = light == null ? level.viewDistance : Math.max( Light.DISTANCE, level.viewDistance );
//logic for pre 0.3.0 saves, need to give mages a staff.
if (Dungeon.version <= 38 && Dungeon.hero.heroClass == HeroClass.MAGE){
MagesStaff staff = new MagesStaff();
staff.identify();
if (!staff.collect(Dungeon.hero.belongings.backpack)){
Dungeon.level.drop(staff, Dungeon.hero.pos);
}
}
observe();
try {

View File

@ -221,7 +221,9 @@ public class MagesStaff extends MeleeWeapon {
"Rather than having an innate magic in it, this staff is instead imbued with magical energy from a wand, permanently granting it new power.\n" +
"\n";
if (wand instanceof WandOfMagicMissile){
if (wand == null) {
result += "The staff is currently a slightly magical stick, it needs a wand!";
} else if (wand instanceof WandOfMagicMissile){
result += "The staff radiates consistent magical energy from the wand it is imbued with.";
} else if (wand instanceof WandOfFireblast){
result += "The staff burns and sizzles with fiery energy from the wand it is imbued with.";

View File

@ -334,17 +334,6 @@ public class GameScene extends PixelScene {
Dungeon.droppedItems.remove( Dungeon.depth );
}
//logic for pre 0.3.0 saves, need to give mages a staff.
if (Dungeon.version <= 38 && Dungeon.hero.heroClass == HeroClass.MAGE){
MagesStaff staff = new MagesStaff();
staff.identify();
GLog.p("You have been given a mage's staff, imbue it with a wand!");
if (!staff.collect(Dungeon.hero.belongings.backpack)){
Dungeon.level.drop(staff, Dungeon.hero.pos);
}
}
Camera.main.target = hero;
fadeIn();
}