v0.7.2: further IDing tweaks, now have game feel similar to old system
This commit is contained in:
parent
d940f24571
commit
ab3f699c32
|
@ -101,13 +101,16 @@ public class Armor extends EquipableItem {
|
|||
|
||||
public int tier;
|
||||
|
||||
private float levelsToID = 1;
|
||||
private static final int USES_TO_ID = 10;
|
||||
private int usesLeftToID = USES_TO_ID;
|
||||
private float availableUsesToID = USES_TO_ID/2f;
|
||||
|
||||
public Armor( int tier ) {
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
private static final String LEVELS_TO_ID = "levels_to_ID";
|
||||
|
||||
private static final String USES_LEFT_TO_ID = "uses_left_to_id";
|
||||
private static final String AVAILABLE_USES = "available_uses";
|
||||
private static final String GLYPH = "glyph";
|
||||
private static final String SEAL = "seal";
|
||||
private static final String AUGMENT = "augment";
|
||||
|
@ -115,7 +118,8 @@ public class Armor extends EquipableItem {
|
|||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEVELS_TO_ID, levelsToID );
|
||||
bundle.put( USES_LEFT_TO_ID, usesLeftToID );
|
||||
bundle.put( AVAILABLE_USES, availableUsesToID );
|
||||
bundle.put( GLYPH, glyph );
|
||||
bundle.put( SEAL, seal);
|
||||
bundle.put( AUGMENT, augment);
|
||||
|
@ -124,13 +128,15 @@ public class Armor extends EquipableItem {
|
|||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle(bundle);
|
||||
levelsToID = bundle.getFloat( LEVELS_TO_ID );
|
||||
usesLeftToID = bundle.getInt( USES_LEFT_TO_ID );
|
||||
availableUsesToID = bundle.getInt( AVAILABLE_USES );
|
||||
inscribe((Glyph) bundle.get(GLYPH));
|
||||
seal = (BrokenSeal)bundle.get(SEAL);
|
||||
|
||||
//pre-0.7.2 saves
|
||||
if (bundle.contains( "unfamiliarity" )){
|
||||
levelsToID = bundle.getInt( "unfamiliarity" ) / 10f;
|
||||
usesLeftToID = bundle.getInt( "unfamiliarity" );
|
||||
availableUsesToID = USES_TO_ID/2f;
|
||||
}
|
||||
|
||||
//pre-0.6.5 saves
|
||||
|
@ -140,7 +146,8 @@ public class Armor extends EquipableItem {
|
|||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
levelsToID = 1;
|
||||
usesLeftToID = USES_TO_ID;
|
||||
availableUsesToID = USES_TO_ID/2f;
|
||||
//armor can be kept in bones between runs, the seal cannot.
|
||||
seal = null;
|
||||
}
|
||||
|
@ -363,26 +370,26 @@ public class Armor extends EquipableItem {
|
|||
damage = glyph.proc( this, attacker, defender, damage );
|
||||
}
|
||||
|
||||
if (!levelKnown && defender == Dungeon.hero && availableUsesToID >= 1) {
|
||||
availableUsesToID--;
|
||||
usesLeftToID--;
|
||||
if (usesLeftToID <= 0) {
|
||||
identify();
|
||||
GLog.p( Messages.get(Armor.class, "identify") );
|
||||
Badges.validateItemLevelAquired( this );
|
||||
}
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeroGainExp(float levelPercent, Hero hero) {
|
||||
if (levelKnown || !isEquipped(hero)) return;
|
||||
levelsToID -= levelPercent;
|
||||
if (levelsToID <= 0){
|
||||
identify();
|
||||
GLog.p( Messages.get(Armor.class, "identify") );
|
||||
Badges.validateItemLevelAquired( this );
|
||||
if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
|
||||
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item identify() {
|
||||
levelsToID = 0;
|
||||
return super.identify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return glyph != null && (cursedKnown || !glyph.curse()) ? glyph.name( super.name() ) : super.name();
|
||||
|
|
|
@ -41,8 +41,6 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
|
||||
public class Ring extends KindofMisc {
|
||||
|
||||
private static final int TICKS_TO_KNOW = 200;
|
||||
|
||||
protected Buff buff;
|
||||
|
||||
|
@ -81,6 +79,7 @@ public class Ring extends KindofMisc {
|
|||
|
||||
private String gem;
|
||||
|
||||
//rings cannot be 'used' like other equipment, so they ID purely based on exp
|
||||
private float levelsToID = 1;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -69,10 +69,9 @@ public abstract class Wand extends Item {
|
|||
|
||||
private boolean curChargeKnown = false;
|
||||
|
||||
private float levelsToID = 1;
|
||||
//wands can't be equipped, so the player needs to use them in addition to gaining exp
|
||||
//takes 5 charges spent, giving 15% exp gain each, plus 25% given right away
|
||||
private float levelsToIDAvailable = 0.25f;
|
||||
private static final int USES_TO_ID = 10;
|
||||
private int usesLeftToID = USES_TO_ID;
|
||||
private float availableUsesToID = USES_TO_ID/2f;
|
||||
|
||||
protected int collisionProperties = Ballistica.MAGIC_BOLT;
|
||||
|
||||
|
@ -173,7 +172,6 @@ public abstract class Wand extends Item {
|
|||
@Override
|
||||
public Item identify() {
|
||||
|
||||
levelsToID = levelsToIDAvailable = 0;
|
||||
curChargeKnown = true;
|
||||
super.identify();
|
||||
|
||||
|
@ -183,13 +181,8 @@ public abstract class Wand extends Item {
|
|||
}
|
||||
|
||||
public void onHeroGainExp( float levelPercent, Hero hero ){
|
||||
if (isIdentified()) return;
|
||||
levelsToID -= Math.min(levelsToIDAvailable, levelPercent);
|
||||
levelsToIDAvailable = Math.max(0, levelsToIDAvailable - levelPercent);
|
||||
if (levelsToID <= 0){
|
||||
identify();
|
||||
GLog.p( Messages.get(Wand.class, "identify", name()) );
|
||||
Badges.validateItemLevelAquired( this );
|
||||
if (!isIdentified() && availableUsesToID <= USES_TO_ID/2f) {
|
||||
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,7 +276,15 @@ public abstract class Wand extends Item {
|
|||
}
|
||||
|
||||
protected void wandUsed() {
|
||||
if (!isIdentified()) levelsToIDAvailable += 0.15f * (cursed ? 1 : chargesPerCast());
|
||||
if (!levelKnown && availableUsesToID >= 1) {
|
||||
availableUsesToID--;
|
||||
usesLeftToID--;
|
||||
if (usesLeftToID <= 0) {
|
||||
identify();
|
||||
GLog.p( Messages.get(Wand.class, "identify") );
|
||||
Badges.validateItemLevelAquired( this );
|
||||
}
|
||||
}
|
||||
|
||||
curCharges -= cursed ? 1 : chargesPerCast();
|
||||
|
||||
|
@ -333,9 +334,9 @@ public abstract class Wand extends Item {
|
|||
}
|
||||
return price;
|
||||
}
|
||||
|
||||
private static final String LEVELS_TO_ID = "levels_to_ID";
|
||||
private static final String LEVELS_TO_ID_AVA = "levels_to_ID_available";
|
||||
|
||||
private static final String USES_LEFT_TO_ID = "uses_left_to_id";
|
||||
private static final String AVAILABLE_USES = "available_uses";
|
||||
private static final String CUR_CHARGES = "curCharges";
|
||||
private static final String CUR_CHARGE_KNOWN = "curChargeKnown";
|
||||
private static final String PARTIALCHARGE = "partialCharge";
|
||||
|
@ -343,8 +344,8 @@ public abstract class Wand extends Item {
|
|||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEVELS_TO_ID, levelsToID );
|
||||
bundle.put( LEVELS_TO_ID_AVA, levelsToIDAvailable );
|
||||
bundle.put( USES_LEFT_TO_ID, usesLeftToID );
|
||||
bundle.put( AVAILABLE_USES, availableUsesToID );
|
||||
bundle.put( CUR_CHARGES, curCharges );
|
||||
bundle.put( CUR_CHARGE_KNOWN, curChargeKnown );
|
||||
bundle.put( PARTIALCHARGE , partialCharge );
|
||||
|
@ -353,13 +354,13 @@ public abstract class Wand extends Item {
|
|||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
levelsToID = bundle.getFloat( LEVELS_TO_ID );
|
||||
levelsToIDAvailable = bundle.getFloat( LEVELS_TO_ID_AVA );
|
||||
usesLeftToID = bundle.getInt( USES_LEFT_TO_ID );
|
||||
availableUsesToID = bundle.getInt( AVAILABLE_USES );
|
||||
|
||||
//pre-0.7.2 saves
|
||||
if (bundle.contains( "unfamiliarity" )){
|
||||
levelsToID = bundle.getInt( "unfamiliarity" ) / 20f;
|
||||
levelsToIDAvailable = levelsToID;
|
||||
usesLeftToID = Math.min(10, bundle.getInt( "unfamiliarity" ));
|
||||
availableUsesToID = USES_TO_ID/2f;
|
||||
}
|
||||
curCharges = bundle.getInt( CUR_CHARGES );
|
||||
curChargeKnown = bundle.getBoolean( CUR_CHARGE_KNOWN );
|
||||
|
@ -369,8 +370,8 @@ public abstract class Wand extends Item {
|
|||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
levelsToID = 1;
|
||||
levelsToIDAvailable = 0.25f;
|
||||
usesLeftToID = USES_TO_ID;
|
||||
availableUsesToID = USES_TO_ID/2f;
|
||||
}
|
||||
|
||||
protected static CellSelector.Listener zapper = new CellSelector.Listener() {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
|
||||
|
@ -62,8 +63,6 @@ import java.util.Arrays;
|
|||
|
||||
abstract public class Weapon extends KindOfWeapon {
|
||||
|
||||
private static final int HITS_TO_KNOW = 20;
|
||||
|
||||
public float ACC = 1f; // Accuracy modifier
|
||||
public float DLY = 1f; // Speed modifier
|
||||
public int RCH = 1; // Reach modifier (only applies to melee hits)
|
||||
|
@ -91,8 +90,10 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
}
|
||||
|
||||
public Augment augment = Augment.NONE;
|
||||
|
||||
private float levelsToID = 1;
|
||||
|
||||
private static final int USES_TO_ID = 20;
|
||||
private int usesLeftToID = USES_TO_ID;
|
||||
private float availableUsesToID = USES_TO_ID/2f;
|
||||
|
||||
public Enchantment enchantment;
|
||||
|
||||
|
@ -102,34 +103,36 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
if (enchantment != null && attacker.buff(MagicImmune.class) == null) {
|
||||
damage = enchantment.proc( this, attacker, defender, damage );
|
||||
}
|
||||
|
||||
if (!levelKnown && attacker == Dungeon.hero && availableUsesToID >= 1) {
|
||||
availableUsesToID--;
|
||||
usesLeftToID--;
|
||||
if (usesLeftToID <= 0) {
|
||||
identify();
|
||||
GLog.p( Messages.get(Weapon.class, "identify") );
|
||||
Badges.validateItemLevelAquired( this );
|
||||
}
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
public void onHeroGainExp( float levelPercent, Hero hero ){
|
||||
if (levelKnown || !isEquipped(hero)) return;
|
||||
levelsToID -= levelPercent;
|
||||
if (levelsToID <= 0){
|
||||
identify();
|
||||
GLog.p( Messages.get(Weapon.class, "identify") );
|
||||
Badges.validateItemLevelAquired( this );
|
||||
if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
|
||||
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item identify() {
|
||||
levelsToID = 0;
|
||||
return super.identify();
|
||||
}
|
||||
|
||||
private static final String LEVELS_TO_ID = "levels_to_ID";
|
||||
private static final String USES_LEFT_TO_ID = "uses_left_to_id";
|
||||
private static final String AVAILABLE_USES = "available_uses";
|
||||
private static final String ENCHANTMENT = "enchantment";
|
||||
private static final String AUGMENT = "augment";
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
bundle.put( LEVELS_TO_ID, levelsToID );
|
||||
bundle.put( USES_LEFT_TO_ID, usesLeftToID );
|
||||
bundle.put( AVAILABLE_USES, availableUsesToID );
|
||||
bundle.put( ENCHANTMENT, enchantment );
|
||||
bundle.put( AUGMENT, augment );
|
||||
}
|
||||
|
@ -137,12 +140,14 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
@Override
|
||||
public void restoreFromBundle( Bundle bundle ) {
|
||||
super.restoreFromBundle( bundle );
|
||||
levelsToID = bundle.getFloat( LEVELS_TO_ID );
|
||||
usesLeftToID = bundle.getInt( USES_LEFT_TO_ID );
|
||||
availableUsesToID = bundle.getInt( AVAILABLE_USES );
|
||||
enchantment = (Enchantment)bundle.get( ENCHANTMENT );
|
||||
|
||||
//pre-0.7.2 saves
|
||||
if (bundle.contains( "unfamiliarity" )){
|
||||
levelsToID = bundle.getInt( "unfamiliarity" ) / 20f;
|
||||
usesLeftToID = bundle.getInt( "unfamiliarity" );
|
||||
availableUsesToID = USES_TO_ID/2f;
|
||||
}
|
||||
|
||||
//pre-0.6.5 saves
|
||||
|
@ -159,7 +164,8 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
levelsToID = 1;
|
||||
usesLeftToID = USES_TO_ID;
|
||||
availableUsesToID = USES_TO_ID/2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1062,7 +1062,7 @@ items.wands.wand.ac_zap=ZAP
|
|||
items.wands.wand.fizzles=Your wand fizzles; it must not have enough charge.
|
||||
items.wands.wand.no_magic=Your wand fizzles; you cannot use wands while magic immune.
|
||||
items.wands.wand.self_target=You can't target yourself!
|
||||
items.wands.wand.identify=You are now familiar with your %s.
|
||||
items.wands.wand.identify=You are now familiar enough with your wand to identify it.
|
||||
items.wands.wand.cursed=This wand is cursed, making its magic chaotic and random.
|
||||
items.wands.wand.not_cursed=This wand is free of malevolent magic.
|
||||
items.wands.wand.curse_discover=This %s is cursed!
|
||||
|
|
Loading…
Reference in New Issue
Block a user