v0.2.3: bones now transfer artifact levels (but they are capped as usual)

This commit is contained in:
Evan Debenham 2014-11-19 13:20:38 -05:00
parent 977a320fc2
commit b73ee347f6
3 changed files with 13 additions and 10 deletions

View File

@ -149,16 +149,20 @@ public class Bones {
if (item instanceof Artifact){
if (Generator.removeArtifact((Artifact)item)) {
try {
item = item.getClass().newInstance();
item.cursed = true;
item.cursedKnown = true;
Artifact artifact = (Artifact)item.getClass().newInstance();
artifact.cursed = true;
artifact.cursedKnown = true;
//caps displayed artifact level
artifact.transferUpgrade(Math.min(
item.visiblyUpgraded(),
1 + ((Dungeon.depth * 3) / 10)));
return item;
} catch (Exception e) {
return new Gold(Random.NormalIntRange(150, 250));
return new Gold(item.price());
}
} else {
return new Gold(Random.NormalIntRange(150, 250));
return new Gold(item.price());
}
}

View File

@ -173,7 +173,7 @@ public class WaterOfTransmutation extends WellWater {
if (n != null){
n.cursedKnown = a.cursedKnown;
n.cursed = a.cursed;
n.transferUpgrade(a);
n.transferUpgrade(a.visiblyUpgraded());
Journal.remove( Feature.WELL_OF_TRANSMUTATION );
}

View File

@ -138,10 +138,9 @@ public class Artifact extends KindofMisc {
return ((level*10)/levelCap);
}
//transfers upgrades from another artifact, in terms of displayed level
public void transferUpgrade(Artifact a) {
int transferLvl = Math.round((a.visiblyUpgraded()*levelCap)/10);
upgrade(transferLvl);
//transfers upgrades from another artifact, transfer level will equal the displayed level
public void transferUpgrade(int transferLvl) {
upgrade(Math.round((float)(transferLvl*levelCap)/10));
}
@Override