v0.8.0: refactored how rings deal with degraded debuff.

Degraded no longer affects missile durability from sharpshooting
Degraded no longer affects str gained from might
This commit is contained in:
Evan Debenham 2019-12-12 16:10:23 -05:00
parent 15879eafc8
commit fbb62337fe
13 changed files with 36 additions and 16 deletions

View File

@ -630,7 +630,7 @@ public abstract class Mob extends Char {
} }
//ring of wealth logic //ring of wealth logic
if (Ring.getBonus(Dungeon.hero, RingOfWealth.Wealth.class) > 0) { if (Ring.getBuffedBonus(Dungeon.hero, RingOfWealth.Wealth.class) > 0) {
int rolls = 1; int rolls = 1;
if (properties.contains(Property.BOSS)) rolls = 15; if (properties.contains(Property.BOSS)) rolls = 15;
else if (properties.contains(Property.MINIBOSS)) rolls = 5; else if (properties.contains(Property.MINIBOSS)) rolls = 5;

View File

@ -309,8 +309,24 @@ public class Ring extends KindofMisc {
} }
return bonus; return bonus;
} }
public static int getBuffedBonus(Char target, Class<?extends RingBuff> type){
int bonus = 0;
for (RingBuff buff : target.buffs(type)) {
bonus += buff.buffedLvl();
}
return bonus;
}
public int soloBonus(){ public int soloBonus(){
if (cursed){
return Math.min( 0, Ring.this.level()-2 );
} else {
return Ring.this.level()+1;
}
}
public int soloBuffedBonus(){
if (cursed){ if (cursed){
return Math.min( 0, Ring.this.buffedLvl()-2 ); return Math.min( 0, Ring.this.buffedLvl()-2 );
} else { } else {
@ -332,5 +348,9 @@ public class Ring extends KindofMisc {
return Ring.this.soloBonus(); return Ring.this.soloBonus();
} }
public int buffedLvl(){
return Ring.this.soloBuffedBonus();
}
} }
} }

View File

@ -42,7 +42,7 @@ public class RingOfAccuracy extends Ring {
} }
public static float accuracyMultiplier( Char target ){ public static float accuracyMultiplier( Char target ){
return (float)Math.pow(1.3f, getBonus(target, Accuracy.class)); return (float)Math.pow(1.3f, getBuffedBonus(target, Accuracy.class));
} }
public class Accuracy extends RingBuff { public class Accuracy extends RingBuff {

View File

@ -114,11 +114,11 @@ public class RingOfElements extends Ring {
} }
public static float resist( Char target, Class effect ){ public static float resist( Char target, Class effect ){
if (getBonus(target, Resistance.class) == 0) return 1f; if (getBuffedBonus(target, Resistance.class) == 0) return 1f;
for (Class c : RESISTS){ for (Class c : RESISTS){
if (c.isAssignableFrom(effect)){ if (c.isAssignableFrom(effect)){
return (float)Math.pow(0.80, getBonus(target, Resistance.class)); return (float)Math.pow(0.80, getBuffedBonus(target, Resistance.class));
} }
} }

View File

@ -42,7 +42,7 @@ public class RingOfEnergy extends Ring {
} }
public static float wandChargeMultiplier( Char target ){ public static float wandChargeMultiplier( Char target ){
return (float)Math.pow(1.30, getBonus(target, Energy.class)); return (float)Math.pow(1.30, getBuffedBonus(target, Energy.class));
} }
public class Energy extends RingBuff { public class Energy extends RingBuff {

View File

@ -42,7 +42,7 @@ public class RingOfEvasion extends Ring {
} }
public static float evasionMultiplier( Char target ){ public static float evasionMultiplier( Char target ){
return (float) Math.pow( 1.15, getBonus(target, Evasion.class)); return (float) Math.pow( 1.15, getBuffedBonus(target, Evasion.class));
} }
public class Evasion extends RingBuff { public class Evasion extends RingBuff {

View File

@ -35,7 +35,7 @@ public class RingOfForce extends Ring {
} }
public static int armedDamageBonus( Char ch ){ public static int armedDamageBonus( Char ch ){
return getBonus( ch, Force.class); return getBuffedBonus( ch, Force.class);
} }
@ -52,7 +52,7 @@ public class RingOfForce extends Ring {
public static int damageRoll( Hero hero ){ public static int damageRoll( Hero hero ){
if (hero.buff(Force.class) != null) { if (hero.buff(Force.class) != null) {
int level = getBonus(hero, Force.class); int level = getBuffedBonus(hero, Force.class);
float tier = tier(hero.STR()); float tier = tier(hero.STR());
return Random.NormalIntRange(min(level, tier), max(level, tier)); return Random.NormalIntRange(min(level, tier), max(level, tier));
} else { } else {

View File

@ -42,7 +42,7 @@ public class RingOfFuror extends Ring {
} }
public static float attackDelayMultiplier(Char target ){ public static float attackDelayMultiplier(Char target ){
return 1f / (float)Math.pow(1.105, getBonus(target, Furor.class)); return 1f / (float)Math.pow(1.105, getBuffedBonus(target, Furor.class));
} }
public class Furor extends RingBuff { public class Furor extends RingBuff {

View File

@ -42,7 +42,7 @@ public class RingOfHaste extends Ring {
} }
public static float speedMultiplier( Char target ){ public static float speedMultiplier( Char target ){
return (float)Math.pow(1.2, getBonus(target, Haste.class)); return (float)Math.pow(1.2, getBuffedBonus(target, Haste.class));
} }
public class Haste extends RingBuff { public class Haste extends RingBuff {

View File

@ -88,7 +88,7 @@ public class RingOfMight extends Ring {
} }
public static float HTMultiplier( Char target ){ public static float HTMultiplier( Char target ){
return (float)Math.pow(1.035, getBonus(target, Might.class)); return (float)Math.pow(1.035, getBuffedBonus(target, Might.class));
} }
public class Might extends RingBuff { public class Might extends RingBuff {

View File

@ -42,7 +42,7 @@ public class RingOfSharpshooting extends Ring {
} }
public static int levelDamageBonus( Char target ){ public static int levelDamageBonus( Char target ){
return getBonus(target, RingOfSharpshooting.Aim.class); return getBuffedBonus(target, RingOfSharpshooting.Aim.class);
} }
public static float durabilityMultiplier( Char target ){ public static float durabilityMultiplier( Char target ){

View File

@ -43,7 +43,7 @@ public class RingOfTenacity extends Ring {
public static float damageMultiplier( Char t ){ public static float damageMultiplier( Char t ){
//(HT - HP)/HT = heroes current % missing health. //(HT - HP)/HT = heroes current % missing health.
return (float)Math.pow(0.85, getBonus( t, Tenacity.class)*((float)(t.HT - t.HP)/t.HT)); return (float)Math.pow(0.85, getBuffedBonus( t, Tenacity.class)*((float)(t.HT - t.HP)/t.HT));
} }
public class Tenacity extends RingBuff { public class Tenacity extends RingBuff {

View File

@ -80,11 +80,11 @@ public class RingOfWealth extends Ring {
} }
public static float dropChanceMultiplier( Char target ){ public static float dropChanceMultiplier( Char target ){
return (float)Math.pow(1.2, getBonus(target, Wealth.class)); return (float)Math.pow(1.2, getBuffedBonus(target, Wealth.class));
} }
public static ArrayList<Item> tryForBonusDrop(Char target, int tries ){ public static ArrayList<Item> tryForBonusDrop(Char target, int tries ){
if (getBonus(target, Wealth.class) <= 0) return null; if (getBuffedBonus(target, Wealth.class) <= 0) return null;
HashSet<Wealth> buffs = target.buffs(Wealth.class); HashSet<Wealth> buffs = target.buffs(Wealth.class);
float triesToDrop = Float.MIN_VALUE; float triesToDrop = Float.MIN_VALUE;
@ -234,7 +234,7 @@ public class RingOfWealth extends Ring {
} }
private static float dropProgression( Char target, int tries ){ private static float dropProgression( Char target, int tries ){
return tries * (float)Math.pow(1.2f, getBonus(target, Wealth.class) ); return tries * (float)Math.pow(1.2f, getBuffedBonus(target, Wealth.class) );
} }
public class Wealth extends RingBuff { public class Wealth extends RingBuff {