v2.2.0: fixed further errors with seal transferring and class armor
This commit is contained in:
@@ -43,6 +43,7 @@ import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class BrokenSeal extends Item {
|
||||
|
||||
@@ -63,6 +64,21 @@ public class BrokenSeal extends Item {
|
||||
|
||||
private Armor.Glyph glyph;
|
||||
|
||||
public boolean canTransferGlyph(){
|
||||
if (glyph == null){
|
||||
return false;
|
||||
}
|
||||
if (Dungeon.hero.pointsInTalent(Talent.RUNIC_TRANSFERENCE) == 2){
|
||||
return true;
|
||||
} else if (Dungeon.hero.pointsInTalent(Talent.RUNIC_TRANSFERENCE) == 1
|
||||
&& (Arrays.asList(Armor.Glyph.common).contains(glyph.getClass())
|
||||
|| Arrays.asList(Armor.Glyph.uncommon).contains(glyph.getClass()))){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Armor.Glyph getGlyph(){
|
||||
return glyph;
|
||||
}
|
||||
|
||||
@@ -183,16 +183,10 @@ public class Armor extends EquipableItem {
|
||||
if (detaching.level() > 0){
|
||||
degrade();
|
||||
}
|
||||
if (detaching.getGlyph() != null){
|
||||
if (hero.hasTalent(Talent.RUNIC_TRANSFERENCE)
|
||||
&& (Arrays.asList(Glyph.common).contains(detaching.getGlyph().getClass())
|
||||
|| Arrays.asList(Glyph.uncommon).contains(detaching.getGlyph().getClass()))){
|
||||
inscribe(null);
|
||||
} else if (hero.pointsInTalent(Talent.RUNIC_TRANSFERENCE) == 2){
|
||||
inscribe(null);
|
||||
} else {
|
||||
detaching.setGlyph(null);
|
||||
}
|
||||
if (detaching.canTransferGlyph()){
|
||||
inscribe(null);
|
||||
} else {
|
||||
detaching.setGlyph(null);
|
||||
}
|
||||
GLog.i( Messages.get(Armor.class, "detach_seal") );
|
||||
hero.sprite.operate(hero.pos);
|
||||
@@ -633,17 +627,17 @@ public class Armor extends EquipableItem {
|
||||
|
||||
public static abstract class Glyph implements Bundlable {
|
||||
|
||||
private static final Class<?>[] common = new Class<?>[]{
|
||||
public static final Class<?>[] common = new Class<?>[]{
|
||||
Obfuscation.class, Swiftness.class, Viscosity.class, Potential.class };
|
||||
|
||||
private static final Class<?>[] uncommon = new Class<?>[]{
|
||||
|
||||
public static final Class<?>[] uncommon = new Class<?>[]{
|
||||
Brimstone.class, Stone.class, Entanglement.class,
|
||||
Repulsion.class, Camouflage.class, Flow.class };
|
||||
|
||||
private static final Class<?>[] rare = new Class<?>[]{
|
||||
|
||||
public static final Class<?>[] rare = new Class<?>[]{
|
||||
Affection.class, AntiMagic.class, Thorns.class };
|
||||
|
||||
private static final float[] typeChances = new float[]{
|
||||
|
||||
public static final float[] typeChances = new float[]{
|
||||
50, //12.5% each
|
||||
40, //6.67% each
|
||||
10 //3.33% each
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
@@ -119,17 +118,9 @@ abstract public class ClassArmor extends Armor {
|
||||
classArmor.level(armor.trueLevel());
|
||||
classArmor.tier = armor.tier;
|
||||
classArmor.augment = armor.augment;
|
||||
BrokenSeal seal = armor.checkSeal();
|
||||
if (seal != null) {
|
||||
//want to preserve whether the glyph is on the armor or the seal
|
||||
if (seal.getGlyph() != null) {
|
||||
classArmor.affixSeal(seal);
|
||||
} else {
|
||||
classArmor.inscribe(armor.glyph);
|
||||
classArmor.affixSeal(seal);
|
||||
}
|
||||
} else {
|
||||
classArmor.inscribe(armor.glyph);
|
||||
classArmor.inscribe(armor.glyph);
|
||||
if (armor.seal != null) {
|
||||
classArmor.seal = armor.seal;
|
||||
}
|
||||
classArmor.cursed = armor.cursed;
|
||||
classArmor.curseInfusionBonus = armor.curseInfusionBonus;
|
||||
@@ -235,17 +226,38 @@ abstract public class ClassArmor extends Armor {
|
||||
level(armor.trueLevel());
|
||||
tier = armor.tier;
|
||||
augment = armor.augment;
|
||||
inscribe( armor.glyph );
|
||||
cursed = armor.cursed;
|
||||
curseInfusionBonus = armor.curseInfusionBonus;
|
||||
masteryPotionBonus = armor.masteryPotionBonus;
|
||||
if (armor.checkSeal() != null) {
|
||||
inscribe(armor.glyph);
|
||||
seal = armor.checkSeal();
|
||||
if (seal.level() > 0) {
|
||||
int newLevel = trueLevel() + 1;
|
||||
level(newLevel);
|
||||
Badges.validateItemLevelAquired(ClassArmor.this);
|
||||
}
|
||||
} else if (checkSeal() != null){
|
||||
//automates the process of detaching the glyph manually
|
||||
// and re-affixing it to the new armor
|
||||
if (seal.level() > 0 && trueLevel() <= armor.trueLevel()){
|
||||
int newLevel = trueLevel() + 1;
|
||||
level(newLevel);
|
||||
Badges.validateItemLevelAquired(ClassArmor.this);
|
||||
}
|
||||
|
||||
//if both source and destination armor have glyphs
|
||||
// we assume the player wants the glyph on the destination armor
|
||||
// they can always manually detach first if they don't.
|
||||
// otherwise we automate glyph transfer just like upgrades
|
||||
if (armor.glyph == null && seal.canTransferGlyph()){
|
||||
//do nothing, keep our glyph
|
||||
} else {
|
||||
inscribe(armor.glyph);
|
||||
seal.setGlyph(null);
|
||||
}
|
||||
} else {
|
||||
inscribe(armor.glyph);
|
||||
}
|
||||
|
||||
identify();
|
||||
|
||||
@@ -347,18 +347,18 @@ abstract public class Weapon extends KindOfWeapon {
|
||||
}
|
||||
|
||||
public static abstract class Enchantment implements Bundlable {
|
||||
|
||||
private static final Class<?>[] common = new Class<?>[]{
|
||||
|
||||
public static final Class<?>[] common = new Class<?>[]{
|
||||
Blazing.class, Chilling.class, Kinetic.class, Shocking.class};
|
||||
|
||||
private static final Class<?>[] uncommon = new Class<?>[]{
|
||||
|
||||
public static final Class<?>[] uncommon = new Class<?>[]{
|
||||
Blocking.class, Blooming.class, Elastic.class,
|
||||
Lucky.class, Projecting.class, Unstable.class};
|
||||
|
||||
private static final Class<?>[] rare = new Class<?>[]{
|
||||
|
||||
public static final Class<?>[] rare = new Class<?>[]{
|
||||
Corrupting.class, Grim.class, Vampiric.class};
|
||||
|
||||
private static final float[] typeChances = new float[]{
|
||||
|
||||
public static final float[] typeChances = new float[]{
|
||||
50, //12.5% each
|
||||
40, //6.67% each
|
||||
10 //3.33% each
|
||||
|
||||
Reference in New Issue
Block a user