v3.0.0: adjusted wealth drop tracking to not be tied to each ring
This commit is contained in:
@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.CounterBuff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
|
||||||
@@ -50,7 +51,6 @@ import com.watabou.utils.Random;
|
|||||||
import com.watabou.utils.Reflection;
|
import com.watabou.utils.Reflection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class RingOfWealth extends Ring {
|
public class RingOfWealth extends Ring {
|
||||||
|
|
||||||
@@ -111,31 +111,23 @@ public class RingOfWealth extends Ring {
|
|||||||
int bonus = getBuffedBonus(target, Wealth.class);
|
int bonus = getBuffedBonus(target, Wealth.class);
|
||||||
|
|
||||||
if (bonus <= 0) return null;
|
if (bonus <= 0) return null;
|
||||||
|
|
||||||
HashSet<Wealth> buffs = target.buffs(Wealth.class);
|
CounterBuff triesToDrop = target.buff(TriesToDropTracker.class);
|
||||||
float triesToDrop = Float.MIN_VALUE;
|
if (triesToDrop.count() == 0){
|
||||||
int dropsToEquip = Integer.MIN_VALUE;
|
triesToDrop.countUp( Random.NormalIntRange(0, 20) );
|
||||||
|
|
||||||
//find the largest count (if they aren't synced yet)
|
|
||||||
for (Wealth w : buffs){
|
|
||||||
if (w.triesToDrop() > triesToDrop){
|
|
||||||
triesToDrop = w.triesToDrop();
|
|
||||||
dropsToEquip = w.dropsToRare();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//reset (if needed), decrement, and store counts
|
CounterBuff dropsToEquip = target.buff(DropsToEquipTracker.class);
|
||||||
if (triesToDrop == Float.MIN_VALUE) {
|
if (dropsToEquip.count() == 0){
|
||||||
triesToDrop = Random.NormalIntRange(0, 20);
|
dropsToEquip.countUp( Random.NormalIntRange(5, 10) );
|
||||||
dropsToEquip = Random.NormalIntRange(5, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//now handle reward logic
|
//now handle reward logic
|
||||||
ArrayList<Item> drops = new ArrayList<>();
|
ArrayList<Item> drops = new ArrayList<>();
|
||||||
|
|
||||||
triesToDrop -= tries;
|
triesToDrop.countDown(tries);
|
||||||
while ( triesToDrop <= 0 ){
|
while ( triesToDrop.count() <= 0 ){
|
||||||
if (dropsToEquip <= 0){
|
if (dropsToEquip.count() <= 0){
|
||||||
int equipBonus = 0;
|
int equipBonus = 0;
|
||||||
|
|
||||||
//A second ring of wealth can be at most +1 when calculating wealth bonus for equips
|
//A second ring of wealth can be at most +1 when calculating wealth bonus for equips
|
||||||
@@ -154,22 +146,16 @@ public class RingOfWealth extends Ring {
|
|||||||
i = genEquipmentDrop(equipBonus - 1);
|
i = genEquipmentDrop(equipBonus - 1);
|
||||||
} while (Challenges.isItemBlocked(i));
|
} while (Challenges.isItemBlocked(i));
|
||||||
drops.add(i);
|
drops.add(i);
|
||||||
dropsToEquip = Random.NormalIntRange(5, 10);
|
dropsToEquip.countUp(Random.NormalIntRange(5, 10));
|
||||||
} else {
|
} else {
|
||||||
Item i;
|
Item i;
|
||||||
do {
|
do {
|
||||||
i = genConsumableDrop(bonus - 1);
|
i = genConsumableDrop(bonus - 1);
|
||||||
} while (Challenges.isItemBlocked(i));
|
} while (Challenges.isItemBlocked(i));
|
||||||
drops.add(i);
|
drops.add(i);
|
||||||
dropsToEquip--;
|
dropsToEquip.countDown(1);
|
||||||
}
|
}
|
||||||
triesToDrop += Random.NormalIntRange(0, 20);
|
triesToDrop.countUp( Random.NormalIntRange(0, 20) );
|
||||||
}
|
|
||||||
|
|
||||||
//store values back into rings
|
|
||||||
for (Wealth w : buffs){
|
|
||||||
w.triesToDrop(triesToDrop);
|
|
||||||
w.dropsToRare(dropsToEquip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return drops;
|
return drops;
|
||||||
@@ -320,22 +306,17 @@ public class RingOfWealth extends Ring {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Wealth extends RingBuff {
|
public class Wealth extends RingBuff {
|
||||||
|
}
|
||||||
private void triesToDrop( float val ){
|
|
||||||
triesToDrop = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
private float triesToDrop(){
|
|
||||||
return triesToDrop;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dropsToRare( int val ) {
|
public static class TriesToDropTracker extends CounterBuff {
|
||||||
dropsToRare = val;
|
{
|
||||||
|
revivePersists = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int dropsToRare(){
|
public static class DropsToEquipTracker extends CounterBuff {
|
||||||
return dropsToRare;
|
{
|
||||||
|
revivePersists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user