v0.7.2: further IDing tweaks, now have game feel similar to old system

This commit is contained in:
Evan Debenham 2019-02-14 02:27:14 -05:00
parent d940f24571
commit ab3f699c32
5 changed files with 80 additions and 67 deletions

View File

@ -101,13 +101,16 @@ public class Armor extends EquipableItem {
public int tier; 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 ) { public Armor( int tier ) {
this.tier = 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 GLYPH = "glyph";
private static final String SEAL = "seal"; private static final String SEAL = "seal";
private static final String AUGMENT = "augment"; private static final String AUGMENT = "augment";
@ -115,7 +118,8 @@ public class Armor extends EquipableItem {
@Override @Override
public void storeInBundle( Bundle bundle ) { public void storeInBundle( Bundle bundle ) {
super.storeInBundle( 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( GLYPH, glyph );
bundle.put( SEAL, seal); bundle.put( SEAL, seal);
bundle.put( AUGMENT, augment); bundle.put( AUGMENT, augment);
@ -124,13 +128,15 @@ public class Armor extends EquipableItem {
@Override @Override
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(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)); inscribe((Glyph) bundle.get(GLYPH));
seal = (BrokenSeal)bundle.get(SEAL); seal = (BrokenSeal)bundle.get(SEAL);
//pre-0.7.2 saves //pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){ if (bundle.contains( "unfamiliarity" )){
levelsToID = bundle.getInt( "unfamiliarity" ) / 10f; usesLeftToID = bundle.getInt( "unfamiliarity" );
availableUsesToID = USES_TO_ID/2f;
} }
//pre-0.6.5 saves //pre-0.6.5 saves
@ -140,7 +146,8 @@ public class Armor extends EquipableItem {
@Override @Override
public void reset() { public void reset() {
super.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. //armor can be kept in bones between runs, the seal cannot.
seal = null; seal = null;
} }
@ -363,24 +370,24 @@ public class Armor extends EquipableItem {
damage = glyph.proc( this, attacker, defender, damage ); damage = glyph.proc( this, attacker, defender, damage );
} }
return damage; if (!levelKnown && defender == Dungeon.hero && availableUsesToID >= 1) {
} availableUsesToID--;
usesLeftToID--;
@Override if (usesLeftToID <= 0) {
public void onHeroGainExp(float levelPercent, Hero hero) {
if (levelKnown || !isEquipped(hero)) return;
levelsToID -= levelPercent;
if (levelsToID <= 0){
identify(); identify();
GLog.p( Messages.get(Armor.class, "identify") ); GLog.p( Messages.get(Armor.class, "identify") );
Badges.validateItemLevelAquired( this ); Badges.validateItemLevelAquired( this );
} }
} }
return damage;
}
@Override @Override
public Item identify() { public void onHeroGainExp(float levelPercent, Hero hero) {
levelsToID = 0; if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
return super.identify(); availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f);
}
} }
@Override @Override

View File

@ -42,8 +42,6 @@ import java.util.HashSet;
public class Ring extends KindofMisc { public class Ring extends KindofMisc {
private static final int TICKS_TO_KNOW = 200;
protected Buff buff; protected Buff buff;
private static final Class<?>[] rings = { private static final Class<?>[] rings = {
@ -81,6 +79,7 @@ public class Ring extends KindofMisc {
private String gem; private String gem;
//rings cannot be 'used' like other equipment, so they ID purely based on exp
private float levelsToID = 1; private float levelsToID = 1;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -69,10 +69,9 @@ public abstract class Wand extends Item {
private boolean curChargeKnown = false; private boolean curChargeKnown = false;
private float levelsToID = 1; private static final int USES_TO_ID = 10;
//wands can't be equipped, so the player needs to use them in addition to gaining exp private int usesLeftToID = USES_TO_ID;
//takes 5 charges spent, giving 15% exp gain each, plus 25% given right away private float availableUsesToID = USES_TO_ID/2f;
private float levelsToIDAvailable = 0.25f;
protected int collisionProperties = Ballistica.MAGIC_BOLT; protected int collisionProperties = Ballistica.MAGIC_BOLT;
@ -173,7 +172,6 @@ public abstract class Wand extends Item {
@Override @Override
public Item identify() { public Item identify() {
levelsToID = levelsToIDAvailable = 0;
curChargeKnown = true; curChargeKnown = true;
super.identify(); super.identify();
@ -183,13 +181,8 @@ public abstract class Wand extends Item {
} }
public void onHeroGainExp( float levelPercent, Hero hero ){ public void onHeroGainExp( float levelPercent, Hero hero ){
if (isIdentified()) return; if (!isIdentified() && availableUsesToID <= USES_TO_ID/2f) {
levelsToID -= Math.min(levelsToIDAvailable, levelPercent); availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f);
levelsToIDAvailable = Math.max(0, levelsToIDAvailable - levelPercent);
if (levelsToID <= 0){
identify();
GLog.p( Messages.get(Wand.class, "identify", name()) );
Badges.validateItemLevelAquired( this );
} }
} }
@ -283,7 +276,15 @@ public abstract class Wand extends Item {
} }
protected void wandUsed() { 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(); curCharges -= cursed ? 1 : chargesPerCast();
@ -334,8 +335,8 @@ public abstract class Wand extends Item {
return price; return price;
} }
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 LEVELS_TO_ID_AVA = "levels_to_ID_available"; private static final String AVAILABLE_USES = "available_uses";
private static final String CUR_CHARGES = "curCharges"; private static final String CUR_CHARGES = "curCharges";
private static final String CUR_CHARGE_KNOWN = "curChargeKnown"; private static final String CUR_CHARGE_KNOWN = "curChargeKnown";
private static final String PARTIALCHARGE = "partialCharge"; private static final String PARTIALCHARGE = "partialCharge";
@ -343,8 +344,8 @@ public abstract class Wand extends Item {
@Override @Override
public void storeInBundle( Bundle bundle ) { public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle ); super.storeInBundle( bundle );
bundle.put( LEVELS_TO_ID, levelsToID ); bundle.put( USES_LEFT_TO_ID, usesLeftToID );
bundle.put( LEVELS_TO_ID_AVA, levelsToIDAvailable ); bundle.put( AVAILABLE_USES, availableUsesToID );
bundle.put( CUR_CHARGES, curCharges ); bundle.put( CUR_CHARGES, curCharges );
bundle.put( CUR_CHARGE_KNOWN, curChargeKnown ); bundle.put( CUR_CHARGE_KNOWN, curChargeKnown );
bundle.put( PARTIALCHARGE , partialCharge ); bundle.put( PARTIALCHARGE , partialCharge );
@ -353,13 +354,13 @@ public abstract class Wand extends Item {
@Override @Override
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle ); super.restoreFromBundle( bundle );
levelsToID = bundle.getFloat( LEVELS_TO_ID ); usesLeftToID = bundle.getInt( USES_LEFT_TO_ID );
levelsToIDAvailable = bundle.getFloat( LEVELS_TO_ID_AVA ); availableUsesToID = bundle.getInt( AVAILABLE_USES );
//pre-0.7.2 saves //pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){ if (bundle.contains( "unfamiliarity" )){
levelsToID = bundle.getInt( "unfamiliarity" ) / 20f; usesLeftToID = Math.min(10, bundle.getInt( "unfamiliarity" ));
levelsToIDAvailable = levelsToID; availableUsesToID = USES_TO_ID/2f;
} }
curCharges = bundle.getInt( CUR_CHARGES ); curCharges = bundle.getInt( CUR_CHARGES );
curChargeKnown = bundle.getBoolean( CUR_CHARGE_KNOWN ); curChargeKnown = bundle.getBoolean( CUR_CHARGE_KNOWN );
@ -369,8 +370,8 @@ public abstract class Wand extends Item {
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
levelsToID = 1; usesLeftToID = USES_TO_ID;
levelsToIDAvailable = 0.25f; availableUsesToID = USES_TO_ID/2f;
} }
protected static CellSelector.Listener zapper = new CellSelector.Listener() { protected static CellSelector.Listener zapper = new CellSelector.Listener() {

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon; package com.shatteredpixel.shatteredpixeldungeon.items.weapon;
import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
@ -62,8 +63,6 @@ import java.util.Arrays;
abstract public class Weapon extends KindOfWeapon { abstract public class Weapon extends KindOfWeapon {
private static final int HITS_TO_KNOW = 20;
public float ACC = 1f; // Accuracy modifier public float ACC = 1f; // Accuracy modifier
public float DLY = 1f; // Speed modifier public float DLY = 1f; // Speed modifier
public int RCH = 1; // Reach modifier (only applies to melee hits) public int RCH = 1; // Reach modifier (only applies to melee hits)
@ -92,7 +91,9 @@ abstract public class Weapon extends KindOfWeapon {
public Augment augment = Augment.NONE; 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; public Enchantment enchantment;
@ -103,33 +104,35 @@ abstract public class Weapon extends KindOfWeapon {
damage = enchantment.proc( this, attacker, defender, damage ); damage = enchantment.proc( this, attacker, defender, damage );
} }
return damage; if (!levelKnown && attacker == Dungeon.hero && availableUsesToID >= 1) {
} availableUsesToID--;
usesLeftToID--;
public void onHeroGainExp( float levelPercent, Hero hero ){ if (usesLeftToID <= 0) {
if (levelKnown || !isEquipped(hero)) return;
levelsToID -= levelPercent;
if (levelsToID <= 0){
identify(); identify();
GLog.p( Messages.get(Weapon.class, "identify") ); GLog.p( Messages.get(Weapon.class, "identify") );
Badges.validateItemLevelAquired( this ); Badges.validateItemLevelAquired( this );
} }
} }
@Override return damage;
public Item identify() {
levelsToID = 0;
return super.identify();
} }
private static final String LEVELS_TO_ID = "levels_to_ID"; public void onHeroGainExp( float levelPercent, Hero hero ){
if (!levelKnown && isEquipped(hero) && availableUsesToID <= USES_TO_ID/2f) {
availableUsesToID = Math.min(USES_TO_ID/2f, availableUsesToID + levelPercent * USES_TO_ID/2f);
}
}
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 ENCHANTMENT = "enchantment";
private static final String AUGMENT = "augment"; private static final String AUGMENT = "augment";
@Override @Override
public void storeInBundle( Bundle bundle ) { public void storeInBundle( Bundle bundle ) {
super.storeInBundle( 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( ENCHANTMENT, enchantment );
bundle.put( AUGMENT, augment ); bundle.put( AUGMENT, augment );
} }
@ -137,12 +140,14 @@ abstract public class Weapon extends KindOfWeapon {
@Override @Override
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( 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 ); enchantment = (Enchantment)bundle.get( ENCHANTMENT );
//pre-0.7.2 saves //pre-0.7.2 saves
if (bundle.contains( "unfamiliarity" )){ if (bundle.contains( "unfamiliarity" )){
levelsToID = bundle.getInt( "unfamiliarity" ) / 20f; usesLeftToID = bundle.getInt( "unfamiliarity" );
availableUsesToID = USES_TO_ID/2f;
} }
//pre-0.6.5 saves //pre-0.6.5 saves
@ -159,7 +164,8 @@ abstract public class Weapon extends KindOfWeapon {
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
levelsToID = 1; usesLeftToID = USES_TO_ID;
availableUsesToID = USES_TO_ID/2f;
} }
@Override @Override

View File

@ -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.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.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.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.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.not_cursed=This wand is free of malevolent magic.
items.wands.wand.curse_discover=This %s is cursed! items.wands.wand.curse_discover=This %s is cursed!