v0.7.0: added a cap to regrowth farming
This commit is contained in:
parent
3d47e9a9e8
commit
53aac008f8
|
@ -42,6 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Callback;
|
import com.watabou.utils.Callback;
|
||||||
import com.watabou.utils.ColorMath;
|
import com.watabou.utils.ColorMath;
|
||||||
import com.watabou.utils.PathFinder;
|
import com.watabou.utils.PathFinder;
|
||||||
|
@ -65,6 +66,8 @@ public class WandOfRegrowth extends Wand {
|
||||||
private HashSet<Integer> visualCells;
|
private HashSet<Integer> visualCells;
|
||||||
private int direction = 0;
|
private int direction = 0;
|
||||||
|
|
||||||
|
private int totChrgUsed = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onZap( Ballistica bolt ) {
|
protected void onZap( Ballistica bolt ) {
|
||||||
|
|
||||||
|
@ -82,12 +85,22 @@ public class WandOfRegrowth extends Wand {
|
||||||
|
|
||||||
float numPlants, numDews, numPods, numStars;
|
float numPlants, numDews, numPods, numStars;
|
||||||
|
|
||||||
|
int overLimit = totChrgUsed - chargeLimit(Dungeon.hero.lvl);
|
||||||
|
|
||||||
int chrgUsed = chargesPerCast();
|
int chrgUsed = chargesPerCast();
|
||||||
//numbers greater than n*100% means n guaranteed plants, e.g. 210% = 2 plants w/10% chance for 3 plants.
|
//numbers greater than n*100% means n guaranteed plants, e.g. 210% = 2 plants w/10% chance for 3 plants.
|
||||||
numPlants = 0.2f + chrgUsed*chrgUsed*0.020f; //scales from 22% to 220%
|
numPlants = 0.2f + chrgUsed*chrgUsed*0.020f; //scales from 22% to 220%
|
||||||
numDews = 0.05f + chrgUsed*chrgUsed*0.016f; //scales from 6.6% to 165%
|
numDews = 0.05f + chrgUsed*chrgUsed*0.016f; //scales from 6.6% to 165%
|
||||||
numPods = 0.02f + chrgUsed*chrgUsed*0.013f; //scales from 3.3% to 135%
|
numPods = 0.02f + chrgUsed*chrgUsed*0.013f; //scales from 3.3% to 135%
|
||||||
numStars = (chrgUsed*chrgUsed*chrgUsed/5f)*0.005f; //scales from 0.1% to 100%
|
numStars = (chrgUsed*chrgUsed*chrgUsed/5f)*0.005f; //scales from 0.1% to 100%
|
||||||
|
|
||||||
|
if (overLimit > 0){
|
||||||
|
numPlants -= overLimit*0.02f;
|
||||||
|
numDews -= overLimit*0.02f;
|
||||||
|
numPods -= overLimit*0.02f;
|
||||||
|
numStars -= overLimit*0.02f;
|
||||||
|
}
|
||||||
|
|
||||||
placePlants(numPlants, numDews, numPods, numStars);
|
placePlants(numPlants, numDews, numPods, numStars);
|
||||||
|
|
||||||
for (int i : affectedCells){
|
for (int i : affectedCells){
|
||||||
|
@ -103,9 +116,25 @@ public class WandOfRegrowth extends Wand {
|
||||||
processSoulMark(ch, chargesPerCast());
|
processSoulMark(ch, chargesPerCast());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Random.Int(50) < overLimit){
|
||||||
|
GameScene.add( Blob.seed( i, 9, Regrowth.class ) );
|
||||||
|
} else {
|
||||||
GameScene.add( Blob.seed( i, 10, Regrowth.class ) );
|
GameScene.add( Blob.seed( i, 10, Regrowth.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totChrgUsed += chrgUsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int chargeLimit( int heroLevel ){
|
||||||
|
if (level() >= 12){
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
} else {
|
||||||
|
//4 charges per hero level at +0, with another 2-4 each upgrade from +1 to +9.
|
||||||
|
//then +7 at +10, +16 at +11, and infinite at +12.
|
||||||
|
return Math.round(((4 + 2*level())*heroLevel) * (11f/12f + 1f/(12f-level())));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spreadRegrowth(int cell, float strength){
|
private void spreadRegrowth(int cell, float strength){
|
||||||
|
@ -253,6 +282,20 @@ public class WandOfRegrowth extends Wand {
|
||||||
particle.y += dst;
|
particle.y += dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String TOTAL = "totChrgUsed";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void storeInBundle(Bundle bundle) {
|
||||||
|
super.storeInBundle(bundle);
|
||||||
|
bundle.put( TOTAL, totChrgUsed );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restoreFromBundle(Bundle bundle) {
|
||||||
|
super.restoreFromBundle(bundle);
|
||||||
|
totChrgUsed = bundle.getInt(TOTAL);
|
||||||
|
}
|
||||||
|
|
||||||
public static class Dewcatcher extends Plant{
|
public static class Dewcatcher extends Plant{
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user