v2.2.0: fixed statues generating weapons whenever they were loaded
This commit is contained in:
@@ -56,14 +56,11 @@ public class Statue extends Mob {
|
|||||||
public Statue() {
|
public Statue() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
weapon = createWeapon();
|
|
||||||
|
|
||||||
HP = HT = 15 + Dungeon.depth * 5;
|
HP = HT = 15 + Dungeon.depth * 5;
|
||||||
defenseSkill = 4 + Dungeon.depth;
|
defenseSkill = 4 + Dungeon.depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Weapon createWeapon(){
|
public void createWeapon(){
|
||||||
Weapon weapon = null;
|
|
||||||
//this is a bit of a hack. I'm strongly considering redesigning this system code-wise though
|
//this is a bit of a hack. I'm strongly considering redesigning this system code-wise though
|
||||||
if (ShatteredPixelDungeon.scene() instanceof InterlevelScene) {
|
if (ShatteredPixelDungeon.scene() instanceof InterlevelScene) {
|
||||||
weapon = (MeleeWeapon) Generator.random(Generator.Category.WEAPON);
|
weapon = (MeleeWeapon) Generator.random(Generator.Category.WEAPON);
|
||||||
@@ -72,7 +69,6 @@ public class Statue extends Mob {
|
|||||||
}
|
}
|
||||||
weapon.cursed = false;
|
weapon.cursed = false;
|
||||||
weapon.enchant( Enchantment.random() );
|
weapon.enchant( Enchantment.random() );
|
||||||
return weapon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String WEAPON = "weapon";
|
private static final String WEAPON = "weapon";
|
||||||
@@ -195,11 +191,14 @@ public class Statue extends Mob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Statue random(){
|
public static Statue random(){
|
||||||
|
Statue statue = null;
|
||||||
if (Random.Int(10) == 0){
|
if (Random.Int(10) == 0){
|
||||||
return new ArmoredStatue();
|
statue = new ArmoredStatue();
|
||||||
} else {
|
} else {
|
||||||
return new Statue();
|
statue = new Statue();
|
||||||
}
|
}
|
||||||
|
statue.createWeapon();
|
||||||
|
return statue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-7
@@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Statue;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
@@ -59,6 +58,7 @@ public class GuardianTrap extends Trap {
|
|||||||
|
|
||||||
for (int i = 0; i < (scalingDepth() - 5)/5; i++){
|
for (int i = 0; i < (scalingDepth() - 5)/5; i++){
|
||||||
Guardian guardian = new Guardian();
|
Guardian guardian = new Guardian();
|
||||||
|
guardian.createWeapon();
|
||||||
guardian.state = guardian.WANDERING;
|
guardian.state = guardian.WANDERING;
|
||||||
guardian.pos = Dungeon.level.randomRespawnCell( guardian );
|
guardian.pos = Dungeon.level.randomRespawnCell( guardian );
|
||||||
if (guardian.pos != -1) {
|
if (guardian.pos != -1) {
|
||||||
@@ -81,12 +81,11 @@ public class GuardianTrap extends Trap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Weapon createWeapon() {
|
public void createWeapon() {
|
||||||
Weapon w = (MeleeWeapon) Generator.randomUsingDefaults(Generator.Category.WEAPON);
|
weapon = (MeleeWeapon) Generator.randomUsingDefaults(Generator.Category.WEAPON);
|
||||||
w.cursed = false;
|
weapon.cursed = false;
|
||||||
w.enchant(null);
|
weapon.enchant(null);
|
||||||
w.level(0);
|
weapon.level(0);
|
||||||
return w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user