v2.1.0: weps, wands, & ring categories now use the deck system

This commit is contained in:
Evan Debenham
2023-04-30 15:16:30 -04:00
parent a1440b7960
commit b5b2c64def
5 changed files with 34 additions and 24 deletions
@@ -315,8 +315,7 @@ public class Ghost extends NPC {
} }
//50%:tier2, 30%:tier3, 15%:tier4, 5%:tier5 //50%:tier2, 30%:tier3, 15%:tier4, 5%:tier5
int wepTier = Random.chances(new float[]{0, 0, 10, 6, 3, 1}); int wepTier = Random.chances(new float[]{0, 0, 10, 6, 3, 1});
Generator.Category c = Generator.wepTiers[wepTier - 1]; weapon = (Weapon) Generator.randomUsingDefaults(Generator.wepTiers[wepTier - 1]);
weapon = (MeleeWeapon) Reflection.newInstance(c.classes[Random.chances(c.probs)]);
//50%:+0, 30%:+1, 15%:+2, 5%:+3 //50%:+0, 30%:+1, 15%:+2, 5%:+3
float itemLevelRoll = Random.Float(); float itemLevelRoll = Random.Float();
@@ -236,7 +236,7 @@ public class Imp extends NPC {
given = false; given = false;
do { do {
reward = (Ring)Generator.random( Generator.Category.RING ); reward = (Ring)Generator.randomUsingDefaults( Generator.Category.RING );
} while (reward.cursed); } while (reward.cursed);
reward.upgrade( 2 ); reward.upgrade( 2 );
reward.cursed = true; reward.cursed = true;
@@ -312,12 +312,12 @@ public class Wandmaker extends NPC {
spawned = true; spawned = true;
given = false; given = false;
wand1 = (Wand) Generator.random(Generator.Category.WAND); wand1 = (Wand) Generator.randomUsingDefaults(Generator.Category.WAND);
wand1.cursed = false; wand1.cursed = false;
wand1.upgrade(); wand1.upgrade();
do { do {
wand2 = (Wand) Generator.random(Generator.Category.WAND); wand2 = (Wand) Generator.randomUsingDefaults(Generator.Category.WAND);
} while (wand2.getClass().equals(wand1.getClass())); } while (wand2.getClass().equals(wand1.getClass()));
wand2.cursed = false; wand2.cursed = false;
wand2.upgrade(); wand2.upgrade();
@@ -340,7 +340,8 @@ public class Generator {
WandOfTransfusion.class, WandOfTransfusion.class,
WandOfCorruption.class, WandOfCorruption.class,
WandOfRegrowth.class }; WandOfRegrowth.class };
WAND.probs = new float[]{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; WAND.defaultProbs = new float[]{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
WAND.probs = WAND.defaultProbs.clone();
//see generator.randomWeapon //see generator.randomWeapon
WEAPON.classes = new Class<?>[]{}; WEAPON.classes = new Class<?>[]{};
@@ -353,7 +354,8 @@ public class Generator {
Gloves.class, Gloves.class,
Rapier.class Rapier.class
}; };
WEP_T1.probs = new float[]{ 2, 0, 2, 2, 2 }; WEP_T1.defaultProbs = new float[]{ 2, 0, 2, 2, 2 };
WEP_T1.probs = WEP_T1.defaultProbs.clone();
WEP_T2.classes = new Class<?>[]{ WEP_T2.classes = new Class<?>[]{
Shortsword.class, Shortsword.class,
@@ -363,7 +365,8 @@ public class Generator {
Dirk.class, Dirk.class,
Sickle.class Sickle.class
}; };
WEP_T2.probs = new float[]{ 2, 2, 2, 2, 2, 2 }; WEP_T2.defaultProbs = new float[]{ 2, 2, 2, 2, 2, 2 };
WEP_T2.probs = WEP_T2.defaultProbs.clone();
WEP_T3.classes = new Class<?>[]{ WEP_T3.classes = new Class<?>[]{
Sword.class, Sword.class,
@@ -373,7 +376,8 @@ public class Generator {
Sai.class, Sai.class,
Whip.class Whip.class
}; };
WEP_T3.probs = new float[]{ 2, 2, 2, 2, 2, 2 }; WEP_T3.defaultProbs = new float[]{ 2, 2, 2, 2, 2, 2 };
WEP_T3.probs = WEP_T1.defaultProbs.clone();
WEP_T4.classes = new Class<?>[]{ WEP_T4.classes = new Class<?>[]{
Longsword.class, Longsword.class,
@@ -384,7 +388,8 @@ public class Generator {
Crossbow.class, Crossbow.class,
Katana.class Katana.class
}; };
WEP_T4.probs = new float[]{ 2, 2, 2, 2, 2, 2, 2 }; WEP_T4.defaultProbs = new float[]{ 2, 2, 2, 2, 2, 2, 2 };
WEP_T4.probs = WEP_T4.defaultProbs.clone();
WEP_T5.classes = new Class<?>[]{ WEP_T5.classes = new Class<?>[]{
Greatsword.class, Greatsword.class,
@@ -395,7 +400,8 @@ public class Generator {
Gauntlet.class, Gauntlet.class,
WarScythe.class WarScythe.class
}; };
WEP_T5.probs = new float[]{ 2, 2, 2, 2, 2, 2, 2 }; WEP_T5.defaultProbs = new float[]{ 2, 2, 2, 2, 2, 2, 2 };
WEP_T5.probs = WEP_T5.defaultProbs.clone();
//see Generator.randomArmor //see Generator.randomArmor
ARMOR.classes = new Class<?>[]{ ARMOR.classes = new Class<?>[]{
@@ -421,41 +427,47 @@ public class Generator {
ThrowingKnife.class, ThrowingKnife.class,
ThrowingSpike.class ThrowingSpike.class
}; };
MIS_T1.probs = new float[]{ 3, 3, 3 }; MIS_T1.defaultProbs = new float[]{ 3, 3, 3 };
MIS_T1.probs = MIS_T1.defaultProbs.clone();
MIS_T2.classes = new Class<?>[]{ MIS_T2.classes = new Class<?>[]{
FishingSpear.class, FishingSpear.class,
ThrowingClub.class, ThrowingClub.class,
Shuriken.class Shuriken.class
}; };
MIS_T2.probs = new float[]{ 3, 3, 3 }; MIS_T2.defaultProbs = new float[]{ 3, 3, 3 };
MIS_T2.probs = MIS_T2.defaultProbs.clone();
MIS_T3.classes = new Class<?>[]{ MIS_T3.classes = new Class<?>[]{
ThrowingSpear.class, ThrowingSpear.class,
Kunai.class, Kunai.class,
Bolas.class Bolas.class
}; };
MIS_T3.probs = new float[]{ 3, 3, 3 }; MIS_T3.defaultProbs = new float[]{ 3, 3, 3 };
MIS_T3.probs = MIS_T3.defaultProbs.clone();
MIS_T4.classes = new Class<?>[]{ MIS_T4.classes = new Class<?>[]{
Javelin.class, Javelin.class,
Tomahawk.class, Tomahawk.class,
HeavyBoomerang.class HeavyBoomerang.class
}; };
MIS_T4.probs = new float[]{ 3, 3, 3 }; MIS_T4.defaultProbs = new float[]{ 3, 3, 3 };
MIS_T4.probs = MIS_T4.defaultProbs.clone();
MIS_T5.classes = new Class<?>[]{ MIS_T5.classes = new Class<?>[]{
Trident.class, Trident.class,
ThrowingHammer.class, ThrowingHammer.class,
ForceCube.class ForceCube.class
}; };
MIS_T5.probs = new float[]{ 3, 3, 3 }; MIS_T5.defaultProbs = new float[]{ 3, 3, 3 };
MIS_T5.probs = MIS_T5.defaultProbs.clone();
FOOD.classes = new Class<?>[]{ FOOD.classes = new Class<?>[]{
Food.class, Food.class,
Pasty.class, Pasty.class,
MysteryMeat.class }; MysteryMeat.class };
FOOD.probs = new float[]{ 4, 1, 0 }; FOOD.defaultProbs = new float[]{ 4, 1, 0 };
FOOD.probs = FOOD.defaultProbs.clone();
RING.classes = new Class<?>[]{ RING.classes = new Class<?>[]{
RingOfAccuracy.class, RingOfAccuracy.class,
@@ -470,7 +482,8 @@ public class Generator {
RingOfSharpshooting.class, RingOfSharpshooting.class,
RingOfTenacity.class, RingOfTenacity.class,
RingOfWealth.class}; RingOfWealth.class};
RING.probs = new float[]{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; RING.defaultProbs = new float[]{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
RING.probs = RING.defaultProbs.clone();
ARTIFACT.classes = new Class<?>[]{ ARTIFACT.classes = new Class<?>[]{
AlchemistsToolkit.class, AlchemistsToolkit.class,
@@ -625,8 +638,7 @@ public class Generator {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Category c = wepTiers[Random.chances(floorSetTierProbs[floorSet])]; MeleeWeapon w = (MeleeWeapon)random(wepTiers[Random.chances(floorSetTierProbs[floorSet])]);
MeleeWeapon w = (MeleeWeapon)random(c);
w.random(); w.random();
return w; return w;
} }
@@ -647,8 +659,7 @@ public class Generator {
floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1);
Category c = misTiers[Random.chances(floorSetTierProbs[floorSet])]; MissileWeapon w = (MissileWeapon)random(misTiers[Random.chances(floorSetTierProbs[floorSet])]);
MissileWeapon w = (MissileWeapon)Reflection.newInstance(c.classes[Random.chances(c.probs)]);
w.random(); w.random();
return w; return w;
} }
@@ -193,7 +193,7 @@ public class ScrollOfTransmutation extends InventoryScroll {
} }
do { do {
n = (Weapon) Reflection.newInstance(c.classes[Random.chances(c.probs)]); n = (Weapon)Generator.random(c);
} while (Challenges.isItemBlocked(n) || n.getClass() == w.getClass()); } while (Challenges.isItemBlocked(n) || n.getClass() == w.getClass());
int level = w.trueLevel(); int level = w.trueLevel();