v0.2.3: first implementation of Alchemist's toolkit, a bit rough.
This commit is contained in:
@@ -17,16 +17,11 @@
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Wraith;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
@@ -34,17 +29,26 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfExperience;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant.Seed;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class Heap implements Bundlable {
|
||||
|
||||
private static final int SEEDS_TO_POTION = 3;
|
||||
@@ -272,32 +276,52 @@ public class Heap implements Bundlable {
|
||||
}
|
||||
}
|
||||
|
||||
if (count >= SEEDS_TO_POTION) {
|
||||
|
||||
//TODO: test this thoroughly
|
||||
//alchemists toolkit gives a chance to cook a potion in two or even one seeds
|
||||
Artifact.ArtifactBuff alchemy = Dungeon.hero.buff(AlchemistsToolkit.alchemy.class);
|
||||
int seeds_to_potion = SEEDS_TO_POTION;
|
||||
int bonus = 0;
|
||||
if (alchemy != null){
|
||||
bonus = alchemy.level();
|
||||
if (Random.int(25) < 10+bonus){
|
||||
seeds_to_potion--;
|
||||
if (Random.Int(30) < bonus){
|
||||
seeds_to_potion--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count >= seeds_to_potion) {
|
||||
|
||||
CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
|
||||
Sample.INSTANCE.play( Assets.SND_PUFF );
|
||||
|
||||
if (Random.Int( count ) == 0) {
|
||||
|
||||
|
||||
//not a buff per-se, meant to cancel out higher potion accuracy when ppl are farming for potions of exp.
|
||||
if (bonus != 0)
|
||||
if (Random.Int(1000/bonus) == 0)
|
||||
return new PotionOfExperience();
|
||||
|
||||
if (Random.Int( count + bonus ) == 0) {
|
||||
|
||||
CellEmitter.center( pos ).burst( Speck.factory( Speck.EVOKE ), 3 );
|
||||
|
||||
|
||||
destroy();
|
||||
|
||||
|
||||
Statistics.potionsCooked++;
|
||||
Badges.validatePotionsCooked();
|
||||
|
||||
|
||||
return Generator.random( Generator.Category.POTION );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
Seed proto = (Seed)items.get( Random.chances( chances ) );
|
||||
Class<? extends Item> itemClass = proto.alchemyClass;
|
||||
|
||||
|
||||
destroy();
|
||||
|
||||
|
||||
Statistics.potionsCooked++;
|
||||
Badges.validatePotionsCooked();
|
||||
|
||||
|
||||
if (itemClass == null) {
|
||||
return Generator.random( Generator.Category.POTION );
|
||||
} else {
|
||||
@@ -307,8 +331,8 @@ public class Heap implements Bundlable {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user