v0.4.0: adjusted cursing trap
This commit is contained in:
parent
99760aac86
commit
6a3de8c7ab
|
@ -31,10 +31,17 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class CursingTrap extends Trap {
|
||||
|
||||
|
@ -54,22 +61,80 @@ public class CursingTrap extends Trap {
|
|||
if (heap != null){
|
||||
for (Item item : heap.items){
|
||||
if (item.isUpgradable())
|
||||
item.cursed = item.cursedKnown = true;
|
||||
curse(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (Dungeon.hero.pos == pos){
|
||||
Hero hero = Dungeon.hero;
|
||||
|
||||
//items the trap wants to curse because it will create a more negative effect
|
||||
ArrayList<Item> priorityCurse = new ArrayList<>();
|
||||
//items the trap can curse if nothing else is available.
|
||||
ArrayList<Item> canCurse = new ArrayList<>();
|
||||
|
||||
KindOfWeapon weapon = hero.belongings.weapon;
|
||||
if (weapon instanceof Weapon && !weapon.cursed){
|
||||
if (((Weapon) weapon).enchantment == null)
|
||||
priorityCurse.add(weapon);
|
||||
else
|
||||
canCurse.add(weapon);
|
||||
}
|
||||
|
||||
Armor armor = hero.belongings.armor;
|
||||
if (!armor.cursed){
|
||||
if (armor.glyph == null)
|
||||
priorityCurse.add(armor);
|
||||
else
|
||||
canCurse.add(armor);
|
||||
}
|
||||
|
||||
KindofMisc misc1 = hero.belongings.misc1;
|
||||
if (misc1 instanceof Artifact){
|
||||
priorityCurse.add(misc1);
|
||||
} else if (misc1 instanceof Ring){
|
||||
canCurse.add(misc1);
|
||||
}
|
||||
|
||||
KindofMisc misc2 = hero.belongings.misc2;
|
||||
if (weapon != null) weapon.cursed = weapon.cursedKnown = true;
|
||||
if (armor != null) armor.cursed = armor.cursedKnown = true;
|
||||
if (misc1 != null) misc1.cursed = misc1.cursedKnown = true;
|
||||
if (misc2 != null) misc2.cursed = misc2.cursedKnown = true;
|
||||
if (misc2 instanceof Artifact){
|
||||
priorityCurse.add(misc2);
|
||||
} else if (misc2 instanceof Ring){
|
||||
canCurse.add(misc2);
|
||||
}
|
||||
|
||||
Collections.shuffle(priorityCurse);
|
||||
Collections.shuffle(canCurse);
|
||||
|
||||
int numCurses = Random.Int(3) == 0 ? 1 : 2;
|
||||
|
||||
for (int i = 0; i < numCurses; i++){
|
||||
if (!priorityCurse.isEmpty()){
|
||||
curse(priorityCurse.remove(0));
|
||||
} else if (!canCurse.isEmpty()){
|
||||
curse(canCurse.remove(0));
|
||||
}
|
||||
}
|
||||
|
||||
EquipableItem.equipCursed(hero);
|
||||
GLog.n( Messages.get(this, "curse") );
|
||||
}
|
||||
}
|
||||
|
||||
private void curse(Item item){
|
||||
item.cursed = item.cursedKnown = true;
|
||||
|
||||
if (item instanceof Weapon){
|
||||
Weapon w = (Weapon) item;
|
||||
if (w.enchantment == null){
|
||||
w.enchantment = Weapon.Enchantment.randomCurse();
|
||||
}
|
||||
}
|
||||
if (item instanceof Armor){
|
||||
Armor a = (Armor) item;
|
||||
if (a.glyph == null){
|
||||
a.glyph = Armor.Glyph.randomCurse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ levels.traps.confusiontrap.desc=Triggering this trap will set a cloud of confusi
|
|||
|
||||
levels.traps.cursingtrap.name=Cursing trap
|
||||
levels.traps.cursingtrap.curse=Your worn equipment becomes cursed!
|
||||
levels.traps.cursingtrap.desc=This trap contains the same malevolent magic found in cursed equipment. Triggering it will curse all worn items, and all items in the immediate area.
|
||||
levels.traps.cursingtrap.desc=This trap contains the same malevolent magic found in cursed equipment. Triggering it will curse some items in the immediate area.
|
||||
|
||||
levels.traps.disarmingtrap.name=Disarming trap
|
||||
levels.traps.disarmingtrap.disarm=Your weapon is teleported away!
|
||||
|
|
Loading…
Reference in New Issue
Block a user