v0.7.3: thrown weapons can now be transmuted
This commit is contained in:
parent
1c259b789a
commit
05193278f8
|
@ -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.ThrowingHammer;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingKnife;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingKnife;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingSpear;
|
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.Tomahawk;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Trident;
|
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.Blindweed;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
||||||
|
@ -379,10 +379,10 @@ public class Generator {
|
||||||
MISSILE.probs = new float[]{};
|
MISSILE.probs = new float[]{};
|
||||||
|
|
||||||
MIS_T1.classes = new Class<?>[]{
|
MIS_T1.classes = new Class<?>[]{
|
||||||
Dart.class,
|
ThrowingStone.class,
|
||||||
ThrowingKnife.class
|
ThrowingKnife.class
|
||||||
};
|
};
|
||||||
MIS_T1.probs = new float[]{ 1, 1 };
|
MIS_T1.probs = new float[]{ 6, 5 };
|
||||||
|
|
||||||
MIS_T2.classes = new Class<?>[]{
|
MIS_T2.classes = new Class<?>[]{
|
||||||
FishingSpear.class,
|
FishingSpear.class,
|
||||||
|
|
|
@ -38,11 +38,15 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScrol
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
|
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
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.MagesStaff;
|
||||||
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.darts.Dart;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
@ -58,6 +62,7 @@ public class ScrollOfTransmutation extends InventoryScroll {
|
||||||
|
|
||||||
public static boolean canTransmute(Item item){
|
public static boolean canTransmute(Item item){
|
||||||
return item instanceof MeleeWeapon ||
|
return item instanceof MeleeWeapon ||
|
||||||
|
(item instanceof MissileWeapon && !(item instanceof Dart)) ||
|
||||||
(item instanceof Potion && !(item instanceof Elixir || item instanceof Brew || item instanceof AlchemicalCatalyst)) ||
|
(item instanceof Potion && !(item instanceof Elixir || item instanceof Brew || item instanceof AlchemicalCatalyst)) ||
|
||||||
item instanceof Scroll ||
|
item instanceof Scroll ||
|
||||||
item instanceof Ring ||
|
item instanceof Ring ||
|
||||||
|
@ -74,8 +79,8 @@ public class ScrollOfTransmutation extends InventoryScroll {
|
||||||
|
|
||||||
if (item instanceof MagesStaff) {
|
if (item instanceof MagesStaff) {
|
||||||
result = changeStaff( (MagesStaff)item );
|
result = changeStaff( (MagesStaff)item );
|
||||||
} else if (item instanceof MeleeWeapon) {
|
} else if (item instanceof MeleeWeapon || item instanceof MissileWeapon) {
|
||||||
result = changeWeapon( (MeleeWeapon)item );
|
result = changeWeapon( (Weapon)item );
|
||||||
} else if (item instanceof Scroll) {
|
} else if (item instanceof Scroll) {
|
||||||
result = changeScroll( (Scroll)item );
|
result = changeScroll( (Scroll)item );
|
||||||
} else if (item instanceof Potion) {
|
} else if (item instanceof Potion) {
|
||||||
|
@ -136,14 +141,19 @@ public class ScrollOfTransmutation extends InventoryScroll {
|
||||||
return staff;
|
return staff;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Weapon changeWeapon(MeleeWeapon w ) {
|
private Weapon changeWeapon( Weapon w ) {
|
||||||
|
|
||||||
Weapon n;
|
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 {
|
do {
|
||||||
try {
|
try {
|
||||||
n = (MeleeWeapon)c.classes[Random.chances(c.probs)].newInstance();
|
n = (Weapon)c.classes[Random.chances(c.probs)].newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ShatteredPixelDungeon.reportException(e);
|
ShatteredPixelDungeon.reportException(e);
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user