v0.6.3: standardized the coding for equipment stat randomization
This commit is contained in:
parent
43d0beb36d
commit
65b28a9145
|
@ -328,25 +328,27 @@ public class Armor extends EquipableItem {
|
|||
|
||||
@Override
|
||||
public Item random() {
|
||||
float roll = Random.Float();
|
||||
if (roll < 0.3f){
|
||||
//30% chance to be level 0 and cursed
|
||||
//+0: 75% (3/4)
|
||||
//+1: 20% (4/20)
|
||||
//+2: 5% (1/20)
|
||||
int n = 0;
|
||||
if (Random.Int(4) == 0) {
|
||||
n++;
|
||||
if (Random.Int(5) == 0) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
level(n);
|
||||
|
||||
//30% chance to be cursed
|
||||
//15% chance to be inscribed
|
||||
float effectRoll = Random.Float();
|
||||
if (effectRoll < 0.3f) {
|
||||
inscribe(Glyph.randomCurse());
|
||||
cursed = true;
|
||||
return this;
|
||||
} else if (roll < 0.75f){
|
||||
//45% chance to be level 0
|
||||
} else if (roll < 0.95f){
|
||||
//15% chance to be +1
|
||||
upgrade(1);
|
||||
} else {
|
||||
//5% chance to be +2
|
||||
upgrade(2);
|
||||
}
|
||||
|
||||
//if not cursed, 16.67% chance to be inscribed (11.67% overall)
|
||||
if (Random.Int(6) == 0)
|
||||
} else if (effectRoll >= 0.85f){
|
||||
inscribe();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -177,6 +177,9 @@ public class Artifact extends KindofMisc {
|
|||
|
||||
@Override
|
||||
public Item random() {
|
||||
//always +0
|
||||
|
||||
//30% chance to be cursed
|
||||
if (Random.Float() < 0.3f) {
|
||||
cursed = true;
|
||||
}
|
||||
|
|
|
@ -196,6 +196,9 @@ public class Ring extends KindofMisc {
|
|||
|
||||
@Override
|
||||
public Item random() {
|
||||
//+0: 66.67% (2/3)
|
||||
//+1: 26.67% (4/15)
|
||||
//+2: 6.67% (1/15)
|
||||
int n = 0;
|
||||
if (Random.Int(3) == 0) {
|
||||
n++;
|
||||
|
@ -203,8 +206,9 @@ public class Ring extends KindofMisc {
|
|||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
level(n);
|
||||
|
||||
//30% chance to be cursed
|
||||
if (Random.Float() < 0.3f) {
|
||||
cursed = true;
|
||||
}
|
||||
|
|
|
@ -279,19 +279,21 @@ public abstract class Wand extends Item {
|
|||
|
||||
@Override
|
||||
public Item random() {
|
||||
//+0: 66.67% (2/3)
|
||||
//+1: 26.67% (4/15)
|
||||
//+2: 6.67% (1/15)
|
||||
int n = 0;
|
||||
|
||||
if (Random.Int(3) == 0) {
|
||||
n++;
|
||||
if (Random.Int(5) == 0){
|
||||
n++;
|
||||
}
|
||||
}
|
||||
level(n);
|
||||
|
||||
upgrade(n);
|
||||
//30% chance to be cursed
|
||||
if (Random.Float() < 0.3f) {
|
||||
cursed = true;
|
||||
cursedKnown = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -227,25 +227,27 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
|
||||
@Override
|
||||
public Item random() {
|
||||
float roll = Random.Float();
|
||||
if (roll < 0.3f){
|
||||
//30% chance to be level 0 and cursed
|
||||
//+0: 75% (3/4)
|
||||
//+1: 20% (4/20)
|
||||
//+2: 5% (1/20)
|
||||
int n = 0;
|
||||
if (Random.Int(4) == 0) {
|
||||
n++;
|
||||
if (Random.Int(5) == 0) {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
level(n);
|
||||
|
||||
//30% chance to be cursed
|
||||
//10% chance to be enchanted
|
||||
float effectRoll = Random.Float();
|
||||
if (effectRoll < 0.3f) {
|
||||
enchant(Enchantment.randomCurse());
|
||||
cursed = true;
|
||||
return this;
|
||||
} else if (roll < 0.75f){
|
||||
//45% chance to be level 0
|
||||
} else if (roll < 0.95f){
|
||||
//15% chance to be +1
|
||||
upgrade(1);
|
||||
} else {
|
||||
//5% chance to be +2
|
||||
upgrade(2);
|
||||
}
|
||||
|
||||
//if not cursed, 10% chance to be enchanted (7% overall)
|
||||
if (Random.Int(10) == 0)
|
||||
} else if (effectRoll >= 0.9f){
|
||||
enchant();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user