From b73ee347f6c5eede86a50f9b18ad9b1ba8a47013 Mon Sep 17 00:00:00 2001
From: Evan Debenham <Evan@ShatteredPixel.com>
Date: Wed, 19 Nov 2014 13:20:38 -0500
Subject: [PATCH] v0.2.3: bones now transfer artifact levels (but they are
 capped as usual)

---
 .../shatteredpixeldungeon/Bones.java               | 14 +++++++++-----
 .../actors/blobs/WaterOfTransmutation.java         |  2 +-
 .../items/artifacts/Artifact.java                  |  7 +++----
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java b/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java
index 1361b0998..9e2a48deb 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java
@@ -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());
                     }
                 }
 				
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java
index 16b771f5d..88ce4d762 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java
@@ -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 );
         }
 
diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java
index 1d4c2366a..9e1c72e96 100644
--- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java
+++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java
@@ -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