v0.9.4: lost invent debuff now has functionality to work selectively
This commit is contained in:
parent
8328962579
commit
1ae3e4fcbd
|
@ -315,7 +315,7 @@ public abstract class Char extends Actor {
|
||||||
|
|
||||||
if (this instanceof Hero){
|
if (this instanceof Hero){
|
||||||
Hero h = (Hero)this;
|
Hero h = (Hero)this;
|
||||||
if (h.belongings.weapon instanceof MissileWeapon
|
if (h.belongings.weapon() instanceof MissileWeapon
|
||||||
&& h.subClass == HeroSubClass.SNIPER
|
&& h.subClass == HeroSubClass.SNIPER
|
||||||
&& !Dungeon.level.adjacent(h.pos, enemy.pos)){
|
&& !Dungeon.level.adjacent(h.pos, enemy.pos)){
|
||||||
dr = 0;
|
dr = 0;
|
||||||
|
|
|
@ -168,8 +168,8 @@ public class Combo extends Buff implements ActionIndicator.Action {
|
||||||
@Override
|
@Override
|
||||||
public Image getIcon() {
|
public Image getIcon() {
|
||||||
Image icon;
|
Image icon;
|
||||||
if (((Hero)target).belongings.weapon != null){
|
if (((Hero)target).belongings.weapon() != null){
|
||||||
icon = new ItemSprite(((Hero)target).belongings.weapon.image, null);
|
icon = new ItemSprite(((Hero)target).belongings.weapon().image, null);
|
||||||
} else {
|
} else {
|
||||||
icon = new ItemSprite(new Item(){ {image = ItemSpriteSheet.WEAPON_HOLDER; }});
|
icon = new ItemSprite(new Item(){ {image = ItemSpriteSheet.WEAPON_HOLDER; }});
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,18 +44,6 @@ import java.util.Iterator;
|
||||||
public class Belongings implements Iterable<Item> {
|
public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
private Hero owner;
|
private Hero owner;
|
||||||
|
|
||||||
public Bag backpack;
|
|
||||||
|
|
||||||
//FIXME these need accessor methods so they can work in conjunction with the lost inventory debuff =I
|
|
||||||
public KindOfWeapon weapon = null;
|
|
||||||
public Armor armor = null;
|
|
||||||
public Artifact artifact = null;
|
|
||||||
public KindofMisc misc = null;
|
|
||||||
public Ring ring = null;
|
|
||||||
|
|
||||||
//used when thrown weapons temporary occupy the weapon slot
|
|
||||||
public KindOfWeapon stashedWeapon = null;
|
|
||||||
|
|
||||||
public static class Backpack extends Bag {
|
public static class Backpack extends Bag {
|
||||||
public int capacity(){
|
public int capacity(){
|
||||||
|
@ -68,6 +56,8 @@ public class Belongings implements Iterable<Item> {
|
||||||
return cap;
|
return cap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Backpack backpack;
|
||||||
|
|
||||||
public Belongings( Hero owner ) {
|
public Belongings( Hero owner ) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
@ -75,6 +65,69 @@ public class Belongings implements Iterable<Item> {
|
||||||
backpack = new Backpack();
|
backpack = new Backpack();
|
||||||
backpack.owner = owner;
|
backpack.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public KindOfWeapon weapon = null;
|
||||||
|
public Armor armor = null;
|
||||||
|
public Artifact artifact = null;
|
||||||
|
public KindofMisc misc = null;
|
||||||
|
public Ring ring = null;
|
||||||
|
|
||||||
|
//used when thrown weapons temporary become the current weapon
|
||||||
|
public KindOfWeapon thrownWeapon = null;
|
||||||
|
|
||||||
|
//*** these accessor methods are so that worn items can be affected by various effects/debuffs
|
||||||
|
// we still want to access the raw equipped items in cases where effects should be ignored though,
|
||||||
|
// such as when equipping something, showing an interface, or dealing with items from a dead hero
|
||||||
|
|
||||||
|
public KindOfWeapon weapon(){
|
||||||
|
//no point in lost invent check, if it's assigned it must be usable
|
||||||
|
if (thrownWeapon != null) return thrownWeapon;
|
||||||
|
|
||||||
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
if (!lostInvent || (weapon != null && weapon.keptThoughLostInvent)){
|
||||||
|
return weapon;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Armor armor(){
|
||||||
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
if (!lostInvent || (armor != null && armor.keptThoughLostInvent)){
|
||||||
|
return armor;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Artifact artifact(){
|
||||||
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
if (!lostInvent || (artifact != null && artifact.keptThoughLostInvent)){
|
||||||
|
return artifact;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public KindofMisc misc(){
|
||||||
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
if (!lostInvent || (misc != null && misc.keptThoughLostInvent)){
|
||||||
|
return misc;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ring ring(){
|
||||||
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
if (!lostInvent || (ring != null && ring.keptThoughLostInvent)){
|
||||||
|
return ring;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***
|
||||||
|
|
||||||
private static final String WEAPON = "weapon";
|
private static final String WEAPON = "weapon";
|
||||||
private static final String ARMOR = "armor";
|
private static final String ARMOR = "armor";
|
||||||
|
@ -172,11 +225,13 @@ public class Belongings implements Iterable<Item> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public<T extends Item> T getItem( Class<T> itemClass ) {
|
public<T extends Item> T getItem( Class<T> itemClass ) {
|
||||||
|
|
||||||
if (owner != null && owner.buff(LostInventory.class) != null) return null;
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
|
||||||
for (Item item : this) {
|
for (Item item : this) {
|
||||||
if (itemClass.isInstance( item )) {
|
if (itemClass.isInstance( item )) {
|
||||||
return (T)item;
|
if (!lostInvent || item.keptThoughLostInvent) {
|
||||||
|
return (T) item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,11 +241,13 @@ public class Belongings implements Iterable<Item> {
|
||||||
public<T extends Item> ArrayList<T> getAllItems( Class<T> itemClass ) {
|
public<T extends Item> ArrayList<T> getAllItems( Class<T> itemClass ) {
|
||||||
ArrayList<T> result = new ArrayList<>();
|
ArrayList<T> result = new ArrayList<>();
|
||||||
|
|
||||||
if (owner != null && owner.buff(LostInventory.class) != null) return result;
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
|
||||||
for (Item item : this) {
|
for (Item item : this) {
|
||||||
if (itemClass.isInstance( item )) {
|
if (itemClass.isInstance( item )) {
|
||||||
result.add((T) item);
|
if (!lostInvent || item.keptThoughLostInvent) {
|
||||||
|
result.add((T) item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,11 +256,13 @@ public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
public boolean contains( Item contains ){
|
public boolean contains( Item contains ){
|
||||||
|
|
||||||
if (owner != null && owner.buff(LostInventory.class) != null) return false;
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
|
||||||
for (Item item : this) {
|
for (Item item : this) {
|
||||||
if (contains == item ) {
|
if (contains == item) {
|
||||||
return true;
|
if (!lostInvent || item.keptThoughLostInvent) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,11 +271,13 @@ public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
public Item getSimilar( Item similar ){
|
public Item getSimilar( Item similar ){
|
||||||
|
|
||||||
if (owner != null && owner.buff(LostInventory.class) != null) return null;
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
|
||||||
for (Item item : this) {
|
for (Item item : this) {
|
||||||
if (similar != item && similar.isSimilar(item)) {
|
if (similar != item && similar.isSimilar(item)) {
|
||||||
return item;
|
if (!lostInvent || item.keptThoughLostInvent) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,11 +287,13 @@ public class Belongings implements Iterable<Item> {
|
||||||
public ArrayList<Item> getAllSimilar( Item similar ){
|
public ArrayList<Item> getAllSimilar( Item similar ){
|
||||||
ArrayList<Item> result = new ArrayList<>();
|
ArrayList<Item> result = new ArrayList<>();
|
||||||
|
|
||||||
if (owner != null && owner.buff(LostInventory.class) != null) return result;
|
boolean lostInvent = owner != null && owner.buff(LostInventory.class) != null;
|
||||||
|
|
||||||
for (Item item : this) {
|
for (Item item : this) {
|
||||||
if (item != similar && similar.isSimilar(item)) {
|
if (item != similar && similar.isSimilar(item)) {
|
||||||
result.add(item);
|
if (!lostInvent || item.keptThoughLostInvent) {
|
||||||
|
result.add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -359,8 +359,8 @@ public class Hero extends Char {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hitSound(float pitch) {
|
public void hitSound(float pitch) {
|
||||||
if ( belongings.weapon != null ){
|
if ( belongings.weapon() != null ){
|
||||||
belongings.weapon.hitSound(pitch);
|
belongings.weapon().hitSound(pitch);
|
||||||
} else if (RingOfForce.getBuffedBonus(this, RingOfForce.Force.class) > 0) {
|
} else if (RingOfForce.getBuffedBonus(this, RingOfForce.Force.class) > 0) {
|
||||||
//pitch deepens by 2.5% (additive) per point of strength, down to 75%
|
//pitch deepens by 2.5% (additive) per point of strength, down to 75%
|
||||||
super.hitSound( pitch * GameMath.gate( 0.75f, 1.25f - 0.025f*STR(), 1f) );
|
super.hitSound( pitch * GameMath.gate( 0.75f, 1.25f - 0.025f*STR(), 1f) );
|
||||||
|
@ -371,7 +371,7 @@ public class Hero extends Char {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean blockSound(float pitch) {
|
public boolean blockSound(float pitch) {
|
||||||
if ( belongings.weapon != null && belongings.weapon.defenseFactor(this) >= 4 ){
|
if ( belongings.weapon() != null && belongings.weapon().defenseFactor(this) >= 4 ){
|
||||||
Sample.INSTANCE.play( Assets.Sounds.HIT_PARRY, 1, pitch);
|
Sample.INSTANCE.play( Assets.Sounds.HIT_PARRY, 1, pitch);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -387,10 +387,10 @@ public class Hero extends Char {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int tier() {
|
public int tier() {
|
||||||
if (belongings.armor instanceof ClassArmor){
|
if (belongings.armor() instanceof ClassArmor){
|
||||||
return 6;
|
return 6;
|
||||||
} else if (belongings.armor != null){
|
} else if (belongings.armor() != null){
|
||||||
return belongings.armor.tier;
|
return belongings.armor().tier;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -401,12 +401,11 @@ public class Hero extends Char {
|
||||||
this.enemy = enemy;
|
this.enemy = enemy;
|
||||||
|
|
||||||
//temporarily set the hero's weapon to the missile weapon being used
|
//temporarily set the hero's weapon to the missile weapon being used
|
||||||
belongings.stashedWeapon = belongings.weapon;
|
//TODO improve this!
|
||||||
belongings.weapon = wep;
|
belongings.thrownWeapon = wep;
|
||||||
boolean hit = attack( enemy );
|
boolean hit = attack( enemy );
|
||||||
Invisibility.dispel();
|
Invisibility.dispel();
|
||||||
belongings.weapon = belongings.stashedWeapon;
|
belongings.thrownWeapon = null;
|
||||||
belongings.stashedWeapon = null;
|
|
||||||
|
|
||||||
if (hit && subClass == HeroSubClass.GLADIATOR){
|
if (hit && subClass == HeroSubClass.GLADIATOR){
|
||||||
Buff.affect( this, Combo.class ).hit( enemy );
|
Buff.affect( this, Combo.class ).hit( enemy );
|
||||||
|
@ -417,7 +416,7 @@ public class Hero extends Char {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int attackSkill( Char target ) {
|
public int attackSkill( Char target ) {
|
||||||
KindOfWeapon wep = belongings.weapon;
|
KindOfWeapon wep = belongings.weapon();
|
||||||
|
|
||||||
float accuracy = 1;
|
float accuracy = 1;
|
||||||
accuracy *= RingOfAccuracy.accuracyMultiplier( this );
|
accuracy *= RingOfAccuracy.accuracyMultiplier( this );
|
||||||
|
@ -455,8 +454,8 @@ public class Hero extends Char {
|
||||||
evasion /= 2;
|
evasion /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (belongings.armor != null) {
|
if (belongings.armor() != null) {
|
||||||
evasion = belongings.armor.evasionFactor(this, evasion);
|
evasion = belongings.armor().evasionFactor(this, evasion);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Math.round(evasion);
|
return Math.round(evasion);
|
||||||
|
@ -480,17 +479,17 @@ public class Hero extends Char {
|
||||||
public int drRoll() {
|
public int drRoll() {
|
||||||
int dr = 0;
|
int dr = 0;
|
||||||
|
|
||||||
if (belongings.armor != null) {
|
if (belongings.armor() != null) {
|
||||||
int armDr = Random.NormalIntRange( belongings.armor.DRMin(), belongings.armor.DRMax());
|
int armDr = Random.NormalIntRange( belongings.armor().DRMin(), belongings.armor().DRMax());
|
||||||
if (STR() < belongings.armor.STRReq()){
|
if (STR() < belongings.armor().STRReq()){
|
||||||
armDr -= 2*(belongings.armor.STRReq() - STR());
|
armDr -= 2*(belongings.armor().STRReq() - STR());
|
||||||
}
|
}
|
||||||
if (armDr > 0) dr += armDr;
|
if (armDr > 0) dr += armDr;
|
||||||
}
|
}
|
||||||
if (belongings.weapon != null) {
|
if (belongings.weapon() != null) {
|
||||||
int wepDr = Random.NormalIntRange( 0 , belongings.weapon.defenseFactor( this ) );
|
int wepDr = Random.NormalIntRange( 0 , belongings.weapon().defenseFactor( this ) );
|
||||||
if (STR() < ((Weapon)belongings.weapon).STRReq()){
|
if (STR() < ((Weapon)belongings.weapon()).STRReq()){
|
||||||
wepDr -= 2*(((Weapon)belongings.weapon).STRReq() - STR());
|
wepDr -= 2*(((Weapon)belongings.weapon()).STRReq() - STR());
|
||||||
}
|
}
|
||||||
if (wepDr > 0) dr += wepDr;
|
if (wepDr > 0) dr += wepDr;
|
||||||
}
|
}
|
||||||
|
@ -504,7 +503,7 @@ public class Hero extends Char {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageRoll() {
|
public int damageRoll() {
|
||||||
KindOfWeapon wep = belongings.weapon;
|
KindOfWeapon wep = belongings.weapon();
|
||||||
int dmg;
|
int dmg;
|
||||||
|
|
||||||
if (wep != null) {
|
if (wep != null) {
|
||||||
|
@ -525,8 +524,8 @@ public class Hero extends Char {
|
||||||
|
|
||||||
speed *= RingOfHaste.speedMultiplier(this);
|
speed *= RingOfHaste.speedMultiplier(this);
|
||||||
|
|
||||||
if (belongings.armor != null) {
|
if (belongings.armor() != null) {
|
||||||
speed = belongings.armor.speedFactor(this, speed);
|
speed = belongings.armor().speedFactor(this, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
Momentum momentum = buff(Momentum.class);
|
Momentum momentum = buff(Momentum.class);
|
||||||
|
@ -547,9 +546,9 @@ public class Hero extends Char {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSurpriseAttack(){
|
public boolean canSurpriseAttack(){
|
||||||
if (belongings.weapon == null || !(belongings.weapon instanceof Weapon)) return true;
|
if (belongings.weapon() == null || !(belongings.weapon() instanceof Weapon)) return true;
|
||||||
if (STR() < ((Weapon)belongings.weapon).STRReq()) return false;
|
if (STR() < ((Weapon)belongings.weapon()).STRReq()) return false;
|
||||||
if (belongings.weapon instanceof Flail) return false;
|
if (belongings.weapon() instanceof Flail) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -564,7 +563,7 @@ public class Hero extends Char {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
KindOfWeapon wep = Dungeon.hero.belongings.weapon;
|
KindOfWeapon wep = Dungeon.hero.belongings.weapon();
|
||||||
|
|
||||||
if (wep != null){
|
if (wep != null){
|
||||||
return wep.canReach(this, enemy.pos);
|
return wep.canReach(this, enemy.pos);
|
||||||
|
@ -579,9 +578,9 @@ public class Hero extends Char {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (belongings.weapon != null) {
|
if (belongings.weapon() != null) {
|
||||||
|
|
||||||
return belongings.weapon.delayFactor( this );
|
return belongings.weapon().delayFactor( this );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//Normally putting furor speed on unarmed attacks would be unnecessary
|
//Normally putting furor speed on unarmed attacks would be unnecessary
|
||||||
|
@ -1110,7 +1109,7 @@ public class Hero extends Char {
|
||||||
public int attackProc( final Char enemy, int damage ) {
|
public int attackProc( final Char enemy, int damage ) {
|
||||||
damage = super.attackProc( enemy, damage );
|
damage = super.attackProc( enemy, damage );
|
||||||
|
|
||||||
KindOfWeapon wep = belongings.weapon;
|
KindOfWeapon wep = belongings.weapon();
|
||||||
|
|
||||||
if (wep != null) damage = wep.proc( this, enemy, damage );
|
if (wep != null) damage = wep.proc( this, enemy, damage );
|
||||||
|
|
||||||
|
@ -1158,8 +1157,8 @@ public class Hero extends Char {
|
||||||
berserk.damage(damage);
|
berserk.damage(damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (belongings.armor != null) {
|
if (belongings.armor() != null) {
|
||||||
damage = belongings.armor.proc( enemy, this, damage );
|
damage = belongings.armor().proc( enemy, this, damage );
|
||||||
}
|
}
|
||||||
|
|
||||||
Earthroot.Armor armor = buff( Earthroot.Armor.class );
|
Earthroot.Armor armor = buff( Earthroot.Armor.class );
|
||||||
|
@ -1198,9 +1197,9 @@ public class Hero extends Char {
|
||||||
dmg = (int)Math.ceil(dmg * RingOfTenacity.damageMultiplier( this ));
|
dmg = (int)Math.ceil(dmg * RingOfTenacity.damageMultiplier( this ));
|
||||||
|
|
||||||
//TODO improve this when I have proper damage source logic
|
//TODO improve this when I have proper damage source logic
|
||||||
if (belongings.armor != null && belongings.armor.hasGlyph(AntiMagic.class, this)
|
if (belongings.armor() != null && belongings.armor().hasGlyph(AntiMagic.class, this)
|
||||||
&& AntiMagic.RESISTS.contains(src.getClass())){
|
&& AntiMagic.RESISTS.contains(src.getClass())){
|
||||||
dmg -= AntiMagic.drRoll(belongings.armor.buffedLvl());
|
dmg -= AntiMagic.drRoll(belongings.armor().buffedLvl());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buff(Talent.WarriorFoodImmunity.class) != null){
|
if (buff(Talent.WarriorFoodImmunity.class) != null){
|
||||||
|
@ -1586,8 +1585,8 @@ public class Hero extends Char {
|
||||||
public float stealth() {
|
public float stealth() {
|
||||||
float stealth = super.stealth();
|
float stealth = super.stealth();
|
||||||
|
|
||||||
if (belongings.armor != null){
|
if (belongings.armor() != null){
|
||||||
stealth = belongings.armor.stealthFactor(this, stealth);
|
stealth = belongings.armor().stealthFactor(this, stealth);
|
||||||
}
|
}
|
||||||
|
|
||||||
return stealth;
|
return stealth;
|
||||||
|
@ -1834,8 +1833,8 @@ public class Hero extends Char {
|
||||||
@Override
|
@Override
|
||||||
public boolean isImmune(Class effect) {
|
public boolean isImmune(Class effect) {
|
||||||
if (effect == Burning.class
|
if (effect == Burning.class
|
||||||
&& belongings.armor != null
|
&& belongings.armor() != null
|
||||||
&& belongings.armor.hasGlyph(Brimstone.class, this)){
|
&& belongings.armor().hasGlyph(Brimstone.class, this)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.isImmune(effect);
|
return super.isImmune(effect);
|
||||||
|
@ -1982,6 +1981,13 @@ public class Hero extends Char {
|
||||||
Buff.affect(this, LostInventory.class);
|
Buff.affect(this, LostInventory.class);
|
||||||
Buff.affect(this, Invisibility.class, 3f);
|
Buff.affect(this, Invisibility.class, 3f);
|
||||||
//lost inventory is dropped in interlevelscene
|
//lost inventory is dropped in interlevelscene
|
||||||
|
|
||||||
|
//activate items that persist after lost inventory
|
||||||
|
if (belongings.weapon() != null) belongings.weapon().activate(this);
|
||||||
|
if (belongings.armor() != null) belongings.armor().activate(this);
|
||||||
|
if (belongings.artifact() != null) belongings.artifact().activate(this);
|
||||||
|
if (belongings.misc() != null) belongings.misc().activate(this);
|
||||||
|
if (belongings.ring() != null) belongings.ring().activate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -239,8 +239,8 @@ public enum Talent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (talent == ARMSMASTERS_INTUITION && hero.pointsInTalent(ARMSMASTERS_INTUITION) == 2){
|
if (talent == ARMSMASTERS_INTUITION && hero.pointsInTalent(ARMSMASTERS_INTUITION) == 2){
|
||||||
if (hero.belongings.weapon != null) hero.belongings.weapon.identify();
|
if (hero.belongings.weapon() != null) hero.belongings.weapon().identify();
|
||||||
if (hero.belongings.armor != null) hero.belongings.armor.identify();
|
if (hero.belongings.armor() != null) hero.belongings.armor.identify();
|
||||||
}
|
}
|
||||||
if (talent == THIEFS_INTUITION && hero.pointsInTalent(THIEFS_INTUITION) == 2){
|
if (talent == THIEFS_INTUITION && hero.pointsInTalent(THIEFS_INTUITION) == 2){
|
||||||
if (hero.belongings.ring instanceof Ring) hero.belongings.ring.identify();
|
if (hero.belongings.ring instanceof Ring) hero.belongings.ring.identify();
|
||||||
|
@ -446,7 +446,7 @@ public enum Talent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hero.hasTalent(Talent.FOLLOWUP_STRIKE)) {
|
if (hero.hasTalent(Talent.FOLLOWUP_STRIKE)) {
|
||||||
if (hero.belongings.weapon instanceof MissileWeapon) {
|
if (hero.belongings.weapon() instanceof MissileWeapon) {
|
||||||
Buff.affect(enemy, FollowupStrikeTracker.class);
|
Buff.affect(enemy, FollowupStrikeTracker.class);
|
||||||
} else if (enemy.buff(FollowupStrikeTracker.class) != null){
|
} else if (enemy.buff(FollowupStrikeTracker.class) != null){
|
||||||
dmg += 1 + hero.pointsInTalent(FOLLOWUP_STRIKE);
|
dmg += 1 + hero.pointsInTalent(FOLLOWUP_STRIKE);
|
||||||
|
|
|
@ -203,8 +203,8 @@ public class ShadowClone extends ArmorAbility {
|
||||||
public int attackProc( Char enemy, int damage ) {
|
public int attackProc( Char enemy, int damage ) {
|
||||||
damage = super.attackProc( enemy, damage );
|
damage = super.attackProc( enemy, damage );
|
||||||
if (Random.Int(4) < Dungeon.hero.pointsInTalent(Talent.SHADOW_BLADE)
|
if (Random.Int(4) < Dungeon.hero.pointsInTalent(Talent.SHADOW_BLADE)
|
||||||
&& Dungeon.hero.belongings.weapon != null){
|
&& Dungeon.hero.belongings.weapon() != null){
|
||||||
return Dungeon.hero.belongings.weapon.proc( this, enemy, damage );
|
return Dungeon.hero.belongings.weapon().proc( this, enemy, damage );
|
||||||
} else {
|
} else {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,8 @@ public class ShadowClone extends ArmorAbility {
|
||||||
public int defenseProc(Char enemy, int damage) {
|
public int defenseProc(Char enemy, int damage) {
|
||||||
damage = super.defenseProc(enemy, damage);
|
damage = super.defenseProc(enemy, damage);
|
||||||
if (Random.Int(4) < Dungeon.hero.pointsInTalent(Talent.CLONED_ARMOR)
|
if (Random.Int(4) < Dungeon.hero.pointsInTalent(Talent.CLONED_ARMOR)
|
||||||
&& Dungeon.hero.belongings.armor != null){
|
&& Dungeon.hero.belongings.armor() != null){
|
||||||
return Dungeon.hero.belongings.armor.proc( enemy, this, damage );
|
return Dungeon.hero.belongings.armor().proc( enemy, this, damage );
|
||||||
} else {
|
} else {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,7 +568,7 @@ public abstract class Mob extends Char {
|
||||||
public int defenseProc( Char enemy, int damage ) {
|
public int defenseProc( Char enemy, int damage ) {
|
||||||
|
|
||||||
if (enemy instanceof Hero
|
if (enemy instanceof Hero
|
||||||
&& ((Hero) enemy).belongings.weapon instanceof MissileWeapon
|
&& ((Hero) enemy).belongings.weapon() instanceof MissileWeapon
|
||||||
&& !hitWithRanged){
|
&& !hitWithRanged){
|
||||||
hitWithRanged = true;
|
hitWithRanged = true;
|
||||||
Statistics.thrownAssists++;
|
Statistics.thrownAssists++;
|
||||||
|
@ -580,8 +580,8 @@ public abstract class Mob extends Char {
|
||||||
Badges.validateRogueUnlock();
|
Badges.validateRogueUnlock();
|
||||||
//TODO this is somewhat messy, it would be nicer to not have to manually handle delays here
|
//TODO this is somewhat messy, it would be nicer to not have to manually handle delays here
|
||||||
// playing the strong hit sound might work best as another property of weapon?
|
// playing the strong hit sound might work best as another property of weapon?
|
||||||
if (Dungeon.hero.belongings.weapon instanceof SpiritBow.SpiritArrow
|
if (Dungeon.hero.belongings.weapon() instanceof SpiritBow.SpiritArrow
|
||||||
|| Dungeon.hero.belongings.weapon instanceof Dart){
|
|| Dungeon.hero.belongings.weapon() instanceof Dart){
|
||||||
Sample.INSTANCE.playDelayed(Assets.Sounds.HIT_STRONG, 0.125f);
|
Sample.INSTANCE.playDelayed(Assets.Sounds.HIT_STRONG, 0.125f);
|
||||||
} else {
|
} else {
|
||||||
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG);
|
||||||
|
|
|
@ -102,8 +102,8 @@ public class MirrorImage extends NPC {
|
||||||
@Override
|
@Override
|
||||||
public int damageRoll() {
|
public int damageRoll() {
|
||||||
int damage;
|
int damage;
|
||||||
if (hero.belongings.weapon != null){
|
if (hero.belongings.weapon() != null){
|
||||||
damage = hero.belongings.weapon.damageRoll(this);
|
damage = hero.belongings.weapon().damageRoll(this);
|
||||||
} else {
|
} else {
|
||||||
damage = hero.damageRoll(); //handles ring of force
|
damage = hero.damageRoll(); //handles ring of force
|
||||||
}
|
}
|
||||||
|
@ -135,13 +135,13 @@ public class MirrorImage extends NPC {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canAttack(Char enemy) {
|
protected boolean canAttack(Char enemy) {
|
||||||
return super.canAttack(enemy) || (hero.belongings.weapon != null && hero.belongings.weapon.canReach(this, enemy.pos));
|
return super.canAttack(enemy) || (hero.belongings.weapon() != null && hero.belongings.weapon().canReach(this, enemy.pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int drRoll() {
|
public int drRoll() {
|
||||||
if (hero != null && hero.belongings.weapon != null){
|
if (hero != null && hero.belongings.weapon() != null){
|
||||||
return Random.NormalIntRange(0, hero.belongings.weapon.defenseFactor(this)/2);
|
return Random.NormalIntRange(0, hero.belongings.weapon().defenseFactor(this)/2);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,8 @@ public class MirrorImage extends NPC {
|
||||||
if (enemy instanceof Mob) {
|
if (enemy instanceof Mob) {
|
||||||
((Mob)enemy).aggro( this );
|
((Mob)enemy).aggro( this );
|
||||||
}
|
}
|
||||||
if (hero.belongings.weapon != null){
|
if (hero.belongings.weapon() != null){
|
||||||
damage = hero.belongings.weapon.proc( this, enemy, damage );
|
damage = hero.belongings.weapon().proc( this, enemy, damage );
|
||||||
if (!enemy.isAlive() && enemy == Dungeon.hero){
|
if (!enemy.isAlive() && enemy == Dungeon.hero){
|
||||||
Dungeon.fail(getClass());
|
Dungeon.fail(getClass());
|
||||||
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
|
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
|
||||||
|
|
|
@ -185,8 +185,8 @@ public class PrismaticImage extends NPC {
|
||||||
@Override
|
@Override
|
||||||
public int defenseProc(Char enemy, int damage) {
|
public int defenseProc(Char enemy, int damage) {
|
||||||
damage = super.defenseProc(enemy, damage);
|
damage = super.defenseProc(enemy, damage);
|
||||||
if (hero != null && hero.belongings.armor != null){
|
if (hero != null && hero.belongings.armor() != null){
|
||||||
return hero.belongings.armor.proc( enemy, this, damage );
|
return hero.belongings.armor().proc( enemy, this, damage );
|
||||||
} else {
|
} else {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
@ -196,9 +196,9 @@ public class PrismaticImage extends NPC {
|
||||||
public void damage(int dmg, Object src) {
|
public void damage(int dmg, Object src) {
|
||||||
|
|
||||||
//TODO improve this when I have proper damage source logic
|
//TODO improve this when I have proper damage source logic
|
||||||
if (hero != null && hero.belongings.armor != null && hero.belongings.armor.hasGlyph(AntiMagic.class, this)
|
if (hero != null && hero.belongings.armor() != null && hero.belongings.armor().hasGlyph(AntiMagic.class, this)
|
||||||
&& AntiMagic.RESISTS.contains(src.getClass())){
|
&& AntiMagic.RESISTS.contains(src.getClass())){
|
||||||
dmg -= AntiMagic.drRoll(hero.belongings.armor.buffedLvl());
|
dmg -= AntiMagic.drRoll(hero.belongings.armor().buffedLvl());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.damage(dmg, src);
|
super.damage(dmg, src);
|
||||||
|
@ -206,8 +206,8 @@ public class PrismaticImage extends NPC {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float speed() {
|
public float speed() {
|
||||||
if (hero != null && hero.belongings.armor != null){
|
if (hero != null && hero.belongings.armor() != null){
|
||||||
return hero.belongings.armor.speedFactor(this, super.speed());
|
return hero.belongings.armor().speedFactor(this, super.speed());
|
||||||
}
|
}
|
||||||
return super.speed();
|
return super.speed();
|
||||||
}
|
}
|
||||||
|
@ -238,8 +238,8 @@ public class PrismaticImage extends NPC {
|
||||||
public boolean isImmune(Class effect) {
|
public boolean isImmune(Class effect) {
|
||||||
if (effect == Burning.class
|
if (effect == Burning.class
|
||||||
&& hero != null
|
&& hero != null
|
||||||
&& hero.belongings.armor != null
|
&& hero.belongings.armor() != null
|
||||||
&& hero.belongings.armor.hasGlyph(Brimstone.class, this)){
|
&& hero.belongings.armor().hasGlyph(Brimstone.class, this)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.isImmune(effect);
|
return super.isImmune(effect);
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class RatKing extends NPC {
|
||||||
yell( Messages.get(this, "not_sleeping") );
|
yell( Messages.get(this, "not_sleeping") );
|
||||||
state = WANDERING;
|
state = WANDERING;
|
||||||
} else if (crown != null){
|
} else if (crown != null){
|
||||||
if (Dungeon.hero.belongings.armor == null){
|
if (Dungeon.hero.belongings.armor() == null){
|
||||||
yell( Messages.get(RatKing.class, "crown_clothes") );
|
yell( Messages.get(RatKing.class, "crown_clothes") );
|
||||||
} else {
|
} else {
|
||||||
Badges.validateRatmogrify();
|
Badges.validateRatmogrify();
|
||||||
|
@ -135,7 +135,7 @@ public class RatKing extends NPC {
|
||||||
@Override
|
@Override
|
||||||
protected void onSelect(int index) {
|
protected void onSelect(int index) {
|
||||||
if (index == 0){
|
if (index == 0){
|
||||||
crown.upgradeArmor(Dungeon.hero, Dungeon.hero.belongings.armor, new Ratmogrify());
|
crown.upgradeArmor(Dungeon.hero, Dungeon.hero.belongings.armor(), new Ratmogrify());
|
||||||
((RatKingSprite)sprite).resetAnims();
|
((RatKingSprite)sprite).resetAnims();
|
||||||
yell(Messages.get(RatKing.class, "crown_thankyou"));
|
yell(Messages.get(RatKing.class, "crown_thankyou"));
|
||||||
} else if (index == 1) {
|
} else if (index == 1) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Degrade;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Degrade;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
|
@ -87,6 +88,9 @@ public class Item implements Bundlable {
|
||||||
// Unique items persist through revival
|
// Unique items persist through revival
|
||||||
public boolean unique = false;
|
public boolean unique = false;
|
||||||
|
|
||||||
|
// These items are preserved even if the hero's inventory is lost via unblessed ankh
|
||||||
|
public boolean keptThoughLostInvent = false;
|
||||||
|
|
||||||
// whether an item can be included in heroes remains
|
// whether an item can be included in heroes remains
|
||||||
public boolean bones = false;
|
public boolean bones = false;
|
||||||
|
|
||||||
|
@ -484,6 +488,7 @@ public class Item implements Bundlable {
|
||||||
private static final String CURSED = "cursed";
|
private static final String CURSED = "cursed";
|
||||||
private static final String CURSED_KNOWN = "cursedKnown";
|
private static final String CURSED_KNOWN = "cursedKnown";
|
||||||
private static final String QUICKSLOT = "quickslotpos";
|
private static final String QUICKSLOT = "quickslotpos";
|
||||||
|
private static final String KEPT_LOST = "kept_lost";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle( Bundle bundle ) {
|
public void storeInBundle( Bundle bundle ) {
|
||||||
|
@ -495,6 +500,7 @@ public class Item implements Bundlable {
|
||||||
if (Dungeon.quickslot.contains(this)) {
|
if (Dungeon.quickslot.contains(this)) {
|
||||||
bundle.put( QUICKSLOT, Dungeon.quickslot.getSlot(this) );
|
bundle.put( QUICKSLOT, Dungeon.quickslot.getSlot(this) );
|
||||||
}
|
}
|
||||||
|
bundle.put( KEPT_LOST, keptThoughLostInvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -518,6 +524,8 @@ public class Item implements Bundlable {
|
||||||
Dungeon.quickslot.setSlot(bundle.getInt(QUICKSLOT), this);
|
Dungeon.quickslot.setSlot(bundle.getInt(QUICKSLOT), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keptThoughLostInvent = bundle.getBoolean( KEPT_LOST );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int targetingPos( Hero user, int dst ){
|
public int targetingPos( Hero user, int dst ){
|
||||||
|
|
|
@ -44,7 +44,7 @@ abstract public class KindOfWeapon extends EquipableItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEquipped( Hero hero ) {
|
public boolean isEquipped( Hero hero ) {
|
||||||
return hero.belongings.weapon == this || hero.belongings.stashedWeapon == this;
|
return hero.belongings.weapon() == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -174,9 +174,9 @@ public abstract class KindofMisc extends EquipableItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEquipped( Hero hero ) {
|
public boolean isEquipped( Hero hero ) {
|
||||||
return hero.belongings.artifact == this
|
return hero.belongings.artifact() == this
|
||||||
|| hero.belongings.misc == this
|
|| hero.belongings.misc() == this
|
||||||
|| hero.belongings.ring == this;
|
|| hero.belongings.ring() == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,8 @@ public class KingsCrown extends Item {
|
||||||
if (action.equals(AC_WEAR)) {
|
if (action.equals(AC_WEAR)) {
|
||||||
|
|
||||||
curUser = hero;
|
curUser = hero;
|
||||||
if (hero.belongings.armor != null){
|
if (hero.belongings.armor() != null){
|
||||||
GameScene.show( new WndChooseAbility(this, hero.belongings.armor, hero));
|
GameScene.show( new WndChooseAbility(this, hero.belongings.armor(), hero));
|
||||||
} else {
|
} else {
|
||||||
GLog.w( Messages.get(this, "naked"));
|
GLog.w( Messages.get(this, "naked"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items;
|
package com.shatteredpixel.shatteredpixeldungeon.items;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
@ -20,6 +21,17 @@ public class LostBackpack extends Item {
|
||||||
if (hero.buff(LostInventory.class) != null){
|
if (hero.buff(LostInventory.class) != null){
|
||||||
hero.buff(LostInventory.class).detach();
|
hero.buff(LostInventory.class).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Item i : hero.belongings){
|
||||||
|
if (i.keptThoughLostInvent){
|
||||||
|
i.keptThoughLostInvent = false;
|
||||||
|
} else {
|
||||||
|
if (i instanceof EquipableItem && i.isEquipped(hero)){
|
||||||
|
((EquipableItem) i).activate(hero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item.updateQuickslot();
|
Item.updateQuickslot();
|
||||||
Sample.INSTANCE.play( Assets.Sounds.DEWDROP );
|
Sample.INSTANCE.play( Assets.Sounds.DEWDROP );
|
||||||
hero.spendAndNext(TIME_TO_PICK_UP);
|
hero.spendAndNext(TIME_TO_PICK_UP);
|
||||||
|
|
|
@ -276,7 +276,7 @@ public class Armor extends EquipableItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEquipped( Hero hero ) {
|
public boolean isEquipped( Hero hero ) {
|
||||||
return hero.belongings.armor == this;
|
return hero.belongings.armor() == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int DRMax(){
|
public final int DRMax(){
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class Viscosity extends Glyph {
|
||||||
|
|
||||||
//account for huntress armor piercing
|
//account for huntress armor piercing
|
||||||
if (attacker instanceof Hero
|
if (attacker instanceof Hero
|
||||||
&& ((Hero) attacker).belongings.weapon instanceof MissileWeapon
|
&& ((Hero) attacker).belongings.weapon() instanceof MissileWeapon
|
||||||
&& ((Hero) attacker).subClass == HeroSubClass.SNIPER
|
&& ((Hero) attacker).subClass == HeroSubClass.SNIPER
|
||||||
&& !Dungeon.level.adjacent(attacker.pos, defender.pos)){
|
&& !Dungeon.level.adjacent(attacker.pos, defender.pos)){
|
||||||
realDamage = damage;
|
realDamage = damage;
|
||||||
|
|
|
@ -167,7 +167,8 @@ public class Bag extends Item implements Iterable<Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canHold( Item item ){
|
public boolean canHold( Item item ){
|
||||||
if (!loading && owner != null && owner.buff(LostInventory.class) != null){
|
if (!loading && owner != null && owner.buff(LostInventory.class) != null
|
||||||
|
&& !item.keptThoughLostInvent){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ public class Dart extends MissileWeapon {
|
||||||
private static Crossbow bow;
|
private static Crossbow bow;
|
||||||
|
|
||||||
private void updateCrossbow(){
|
private void updateCrossbow(){
|
||||||
if (Dungeon.hero.belongings.weapon instanceof Crossbow){
|
if (Dungeon.hero.belongings.weapon() instanceof Crossbow){
|
||||||
bow = (Crossbow) Dungeon.hero.belongings.weapon;
|
bow = (Crossbow) Dungeon.hero.belongings.weapon();
|
||||||
} else {
|
} else {
|
||||||
bow = null;
|
bow = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class HighGrass {
|
||||||
|
|
||||||
//Camouflage
|
//Camouflage
|
||||||
//FIXME doesn't work with sad ghost
|
//FIXME doesn't work with sad ghost
|
||||||
if (hero.belongings.armor != null && hero.belongings.armor.hasGlyph(Camouflage.class, hero)) {
|
if (hero.belongings.armor() != null && hero.belongings.armor().hasGlyph(Camouflage.class, hero)) {
|
||||||
Buff.prolong(hero, Invisibility.class, 3 + hero.belongings.armor.buffedLvl()/2);
|
Buff.prolong(hero, Invisibility.class, 3 + hero.belongings.armor.buffedLvl()/2);
|
||||||
Sample.INSTANCE.play( Assets.Sounds.MELD );
|
Sample.INSTANCE.play( Assets.Sounds.MELD );
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class CursingTrap extends Trap {
|
||||||
//items the trap can curse if nothing else is available.
|
//items the trap can curse if nothing else is available.
|
||||||
ArrayList<Item> canCurse = new ArrayList<>();
|
ArrayList<Item> canCurse = new ArrayList<>();
|
||||||
|
|
||||||
KindOfWeapon weapon = hero.belongings.weapon;
|
KindOfWeapon weapon = hero.belongings.weapon();
|
||||||
if (weapon instanceof Weapon && !(weapon instanceof MagesStaff)){
|
if (weapon instanceof Weapon && !(weapon instanceof MagesStaff)){
|
||||||
if (((Weapon) weapon).enchantment == null)
|
if (((Weapon) weapon).enchantment == null)
|
||||||
priorityCurse.add(weapon);
|
priorityCurse.add(weapon);
|
||||||
|
@ -82,7 +82,7 @@ public class CursingTrap extends Trap {
|
||||||
canCurse.add(weapon);
|
canCurse.add(weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
Armor armor = hero.belongings.armor;
|
Armor armor = hero.belongings.armor();
|
||||||
if (armor != null){
|
if (armor != null){
|
||||||
if (armor.glyph == null)
|
if (armor.glyph == null)
|
||||||
priorityCurse.add(armor);
|
priorityCurse.add(armor);
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
float speed = SPEED;
|
float speed = SPEED;
|
||||||
if (item instanceof Dart && Dungeon.hero.belongings.weapon instanceof Crossbow){
|
if (item instanceof Dart && Dungeon.hero.belongings.weapon() instanceof Crossbow){
|
||||||
speed *= 3f;
|
speed *= 3f;
|
||||||
|
|
||||||
} else if (item instanceof SpiritBow.SpiritArrow
|
} else if (item instanceof SpiritBow.SpiritArrow
|
||||||
|
|
|
@ -216,7 +216,9 @@ public class QuickSlotButton extends Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableSlot() {
|
private void enableSlot() {
|
||||||
slot.enable(Dungeon.quickslot.isNonePlaceholder( slotNum ) && Dungeon.hero.buff(LostInventory.class) == null);
|
//TODO check if item persists!
|
||||||
|
slot.enable(Dungeon.quickslot.isNonePlaceholder( slotNum )
|
||||||
|
&& (Dungeon.hero.buff(LostInventory.class) == null || Dungeon.quickslot.getItem(slotNum).keptThoughLostInvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void useTargeting(int idx){
|
public static void useTargeting(int idx){
|
||||||
|
|
|
@ -388,7 +388,8 @@ public class WndBag extends WndTabbed {
|
||||||
enable( false );
|
enable( false );
|
||||||
} else if (selector != null && !selector.itemSelectable(item)) {
|
} else if (selector != null && !selector.itemSelectable(item)) {
|
||||||
enable(false);
|
enable(false);
|
||||||
} else if (Dungeon.hero.buff(LostInventory.class) != null){
|
} else if (Dungeon.hero.buff(LostInventory.class) != null
|
||||||
|
&& !item.keptThoughLostInvent){
|
||||||
enable(false);
|
enable(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -55,8 +55,8 @@ public class WndCombo extends Window {
|
||||||
pos = title.bottom() + 3*MARGIN;
|
pos = title.bottom() + 3*MARGIN;
|
||||||
|
|
||||||
Image icon;
|
Image icon;
|
||||||
if (Dungeon.hero.belongings.weapon != null){
|
if (Dungeon.hero.belongings.weapon() != null){
|
||||||
icon = new ItemSprite(Dungeon.hero.belongings.weapon.image, null);
|
icon = new ItemSprite(Dungeon.hero.belongings.weapon().image, null);
|
||||||
} else {
|
} else {
|
||||||
icon = new ItemSprite(new Item(){ {image = ItemSpriteSheet.WEAPON_HOLDER; }});
|
icon = new ItemSprite(new Item(){ {image = ItemSpriteSheet.WEAPON_HOLDER; }});
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,8 +198,9 @@ public class WndQuickBag extends Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Dungeon.hero.buff(LostInventory.class) != null){
|
if (Dungeon.hero.buff(LostInventory.class) != null
|
||||||
enable(false); //TODO enable when hero has selected this item to keep
|
&& !item.keptThoughLostInvent){
|
||||||
|
enable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -69,6 +69,14 @@ public class WndResurrect extends Window {
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
Statistics.ankhsUsed++;
|
Statistics.ankhsUsed++;
|
||||||
|
|
||||||
|
//TODO let the player choose their items, instead of rigid weapon or armor
|
||||||
|
if (Dungeon.hero.belongings.weapon() != null){
|
||||||
|
Dungeon.hero.belongings.weapon().keptThoughLostInvent = true;
|
||||||
|
}
|
||||||
|
if (Dungeon.hero.belongings.armor() != null){
|
||||||
|
Dungeon.hero.belongings.armor().keptThoughLostInvent = true;
|
||||||
|
}
|
||||||
|
|
||||||
InterlevelScene.mode = InterlevelScene.Mode.RESURRECT;
|
InterlevelScene.mode = InterlevelScene.Mode.RESURRECT;
|
||||||
Game.switchScene( InterlevelScene.class );
|
Game.switchScene( InterlevelScene.class );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user