v0.7.3: thrown weapons can now be transmuted

This commit is contained in:
Evan Debenham 2019-05-16 15:05:45 -04:00
parent 1c259b789a
commit 05193278f8
2 changed files with 18 additions and 8 deletions

View File

@ -150,9 +150,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingCl
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingHammer;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingKnife;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingSpear;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingStone;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tomahawk;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Trident;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart;
import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed;
import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil;
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
@ -379,10 +379,10 @@ public class Generator {
MISSILE.probs = new float[]{};
MIS_T1.classes = new Class<?>[]{
Dart.class,
ThrowingStone.class,
ThrowingKnife.class
};
MIS_T1.probs = new float[]{ 1, 1 };
MIS_T1.probs = new float[]{ 6, 5 };
MIS_T2.classes = new Class<?>[]{
FishingSpear.class,

View File

@ -38,11 +38,15 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScrol
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dagger;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart;
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.utils.Random;
@ -58,6 +62,7 @@ public class ScrollOfTransmutation extends InventoryScroll {
public static boolean canTransmute(Item item){
return item instanceof MeleeWeapon ||
(item instanceof MissileWeapon && !(item instanceof Dart)) ||
(item instanceof Potion && !(item instanceof Elixir || item instanceof Brew || item instanceof AlchemicalCatalyst)) ||
item instanceof Scroll ||
item instanceof Ring ||
@ -74,8 +79,8 @@ public class ScrollOfTransmutation extends InventoryScroll {
if (item instanceof MagesStaff) {
result = changeStaff( (MagesStaff)item );
} else if (item instanceof MeleeWeapon) {
result = changeWeapon( (MeleeWeapon)item );
} else if (item instanceof MeleeWeapon || item instanceof MissileWeapon) {
result = changeWeapon( (Weapon)item );
} else if (item instanceof Scroll) {
result = changeScroll( (Scroll)item );
} else if (item instanceof Potion) {
@ -136,14 +141,19 @@ public class ScrollOfTransmutation extends InventoryScroll {
return staff;
}
private Weapon changeWeapon(MeleeWeapon w ) {
private Weapon changeWeapon( Weapon w ) {
Weapon n;
Generator.Category c = Generator.wepTiers[w.tier-1];
Generator.Category c;
if (w instanceof MeleeWeapon) {
c = Generator.wepTiers[((MeleeWeapon)w).tier - 1];
} else {
c = Generator.misTiers[((MissileWeapon)w).tier - 1];
}
do {
try {
n = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance();
n = (Weapon)c.classes[Random.chances(c.probs)].newInstance();
} catch (Exception e) {
ShatteredPixelDungeon.reportException(e);
return null;