v0.8.0: added a system for dynamic mob spawning weights
This commit is contained in:
parent
a9794a6ab0
commit
ee6a1ce4fc
|
@ -67,6 +67,11 @@ public class Ghoul extends Mob {
|
|||
return Random.NormalIntRange(0, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float spawningWeight() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
private int partnerID = -1;
|
||||
private static final String PARTNER_ID = "partner_id";
|
||||
|
||||
|
|
|
@ -109,6 +109,11 @@ public class Mimic extends Mob {
|
|||
super.rollToDropLoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float spawningWeight() {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reset() {
|
||||
state = WANDERING;
|
||||
|
|
|
@ -672,6 +672,11 @@ public abstract class Mob extends Char {
|
|||
return item;
|
||||
}
|
||||
|
||||
//how many mobs this one should count as when determining spawning totals
|
||||
public float spawningWeight(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean reset() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -105,6 +105,11 @@ public class Piranha extends Mob {
|
|||
Badges.validatePiranhasKilled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float spawningWeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reset() {
|
||||
return true;
|
||||
|
|
|
@ -141,6 +141,11 @@ public class Statue extends Mob {
|
|||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float spawningWeight() {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reset() {
|
||||
state = PASSIVE;
|
||||
|
|
|
@ -84,6 +84,11 @@ public class Wraith extends Mob {
|
|||
enemySeen = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float spawningWeight() {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reset() {
|
||||
state = WANDERING;
|
||||
|
|
|
@ -492,11 +492,12 @@ public abstract class Level implements Bundlable {
|
|||
|
||||
@Override
|
||||
protected boolean act() {
|
||||
int count = 0;
|
||||
float count = 0;
|
||||
|
||||
//TODO some mobs should count for less (ripper shouldn't count at all, ghouls should be 1/2, special enemies should be 0
|
||||
for (Mob mob : mobs.toArray(new Mob[0])){
|
||||
if (mob.alignment == Char.Alignment.ENEMY) count++;
|
||||
if (mob.alignment == Char.Alignment.ENEMY && !mob.properties().contains(Char.Property.MINIBOSS)) {
|
||||
count += mob.spawningWeight();
|
||||
}
|
||||
}
|
||||
|
||||
if (count < nMobs()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user