v0.9.3: various code improvements to class armors
This commit is contained in:
parent
815d9383b7
commit
0c67c9cade
|
@ -28,13 +28,13 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
@ -140,7 +140,12 @@ public class Belongings implements Iterable<Item> {
|
||||||
|
|
||||||
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
||||||
if (bundle.contains( ARMOR )){
|
if (bundle.contains( ARMOR )){
|
||||||
info.armorTier = ((Armor)bundle.get( ARMOR )).tier;
|
Armor armor = ((Armor)bundle.get( ARMOR ));
|
||||||
|
if (armor instanceof ClassArmor){
|
||||||
|
info.armorTier = 6;
|
||||||
|
} else {
|
||||||
|
info.armorTier = armor.tier;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
info.armorTier = 0;
|
info.armorTier = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
|
||||||
|
@ -373,7 +374,13 @@ public class Hero extends Char {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int tier() {
|
public int tier() {
|
||||||
return belongings.armor == null ? 0 : belongings.armor.tier;
|
if (belongings.armor instanceof ClassArmor){
|
||||||
|
return 6;
|
||||||
|
} else if (belongings.armor != null){
|
||||||
|
return belongings.armor.tier;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shoot( Char enemy, MissileWeapon wep ) {
|
public boolean shoot( Char enemy, MissileWeapon wep ) {
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
|
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
|
@ -55,11 +54,12 @@ abstract public class ClassArmor extends Armor {
|
||||||
public float charge = 0;
|
public float charge = 0;
|
||||||
|
|
||||||
public ClassArmor() {
|
public ClassArmor() {
|
||||||
super( 6 );
|
super( 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activate(Char ch) {
|
public void activate(Char ch) {
|
||||||
|
super.activate(ch);
|
||||||
charger = new Charger();
|
charger = new Charger();
|
||||||
charger.attachTo(ch);
|
charger.attachTo(ch);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ abstract public class ClassArmor extends Armor {
|
||||||
}
|
}
|
||||||
|
|
||||||
classArmor.level(armor.level() - (armor.curseInfusionBonus ? 1 : 0));
|
classArmor.level(armor.level() - (armor.curseInfusionBonus ? 1 : 0));
|
||||||
classArmor.armorTier = armor.tier;
|
classArmor.tier = armor.tier;
|
||||||
classArmor.augment = armor.augment;
|
classArmor.augment = armor.augment;
|
||||||
classArmor.inscribe( armor.glyph );
|
classArmor.inscribe( armor.glyph );
|
||||||
classArmor.cursed = armor.cursed;
|
classArmor.cursed = armor.cursed;
|
||||||
|
@ -121,14 +121,14 @@ abstract public class ClassArmor extends Armor {
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle( Bundle bundle ) {
|
public void storeInBundle( Bundle bundle ) {
|
||||||
super.storeInBundle( bundle );
|
super.storeInBundle( bundle );
|
||||||
bundle.put( ARMOR_TIER, armorTier );
|
bundle.put( ARMOR_TIER, tier );
|
||||||
bundle.put( CHARGE, charge );
|
bundle.put( CHARGE, charge );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
super.restoreFromBundle( bundle );
|
super.restoreFromBundle( bundle );
|
||||||
armorTier = bundle.getInt( ARMOR_TIER );
|
tier = bundle.getInt( ARMOR_TIER );
|
||||||
charge = bundle.getFloat(CHARGE);
|
charge = bundle.getFloat(CHARGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,25 +191,6 @@ abstract public class ClassArmor extends Armor {
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int STRReq(int lvl) {
|
|
||||||
return STRReq(armorTier, lvl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int DRMax(int lvl){
|
|
||||||
if (Dungeon.isChallenged(Challenges.NO_ARMOR)){
|
|
||||||
return 1 + armorTier + lvl + augment.defenseFactor(lvl);
|
|
||||||
}
|
|
||||||
|
|
||||||
int max = armorTier * (2 + lvl) + augment.defenseFactor(lvl);
|
|
||||||
if (lvl > max){
|
|
||||||
return ((lvl - max)+1)/2;
|
|
||||||
} else {
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isIdentified() {
|
public boolean isIdentified() {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user