v0.6.1: large ring refactor, moved functionality to within their class
This commit is contained in:
parent
02fd423e77
commit
84b7a6bbb6
|
@ -34,7 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||
|
@ -183,8 +183,7 @@ public class Burning extends Buff implements Hero.Doom {
|
|||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
return DURATION * RingOfElements.durationFactor( ch );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
@ -60,8 +60,7 @@ public class Charm extends FlavourBuff {
|
|||
}
|
||||
|
||||
public static float durationFactor( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() : 1;
|
||||
return RingOfElements.durationFactor( ch );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
|
@ -123,7 +123,6 @@ public class Frost extends FlavourBuff {
|
|||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
return DURATION * RingOfElements.durationFactor( ch );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
@ -79,7 +79,6 @@ public class Paralysis extends FlavourBuff {
|
|||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
return DURATION * RingOfElements.durationFactor( ch );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PoisonParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
@ -114,8 +114,7 @@ public class Poison extends Buff implements Hero.Doom {
|
|||
}
|
||||
|
||||
public static float durationFactor( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() : 1;
|
||||
return RingOfElements.durationFactor( ch );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
|
@ -50,7 +50,6 @@ public class Slow extends FlavourBuff {
|
|||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
return DURATION * RingOfElements.durationFactor( ch );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
|
@ -50,7 +50,6 @@ public class Vertigo extends FlavourBuff {
|
|||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
return DURATION * RingOfElements.durationFactor( ch );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
|
@ -64,8 +64,7 @@ public class Weakness extends FlavourBuff {
|
|||
}
|
||||
|
||||
public static float duration( Char ch ) {
|
||||
Resistance r = ch.buff( Resistance.class );
|
||||
return r != null ? r.durationFactor() * DURATION : DURATION;
|
||||
return DURATION * RingOfElements.durationFactor( ch );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -183,7 +183,7 @@ public class Hero extends Char {
|
|||
public int STR() {
|
||||
int STR = this.STR;
|
||||
|
||||
STR += RingOfMight.getBonus(this, RingOfMight.Might.class);
|
||||
STR += RingOfMight.strengthBonus( this );
|
||||
|
||||
return weakened ? STR - 2 : STR;
|
||||
}
|
||||
|
@ -281,9 +281,8 @@ public class Hero extends Char {
|
|||
@Override
|
||||
public int defenseSkill( Char enemy ) {
|
||||
|
||||
int bonus = RingOfEvasion.getBonus(this, RingOfEvasion.Evasion.class);
|
||||
float evasion = 1f * RingOfEvasion.evasionMultiplier( this );
|
||||
|
||||
float evasion = (float)Math.pow( 1.125, bonus );
|
||||
if (paralysed > 0) {
|
||||
evasion /= 2;
|
||||
}
|
||||
|
@ -294,7 +293,7 @@ public class Hero extends Char {
|
|||
return (int)(defenseSkill * evasion / Math.pow( 1.5, aEnc ));
|
||||
} else {
|
||||
|
||||
bonus = 0;
|
||||
int bonus = 0;
|
||||
if (heroClass == HeroClass.ROGUE) bonus += -aEnc;
|
||||
|
||||
if (belongings.armor != null && belongings.armor.hasGlyph(Swiftness.class))
|
||||
|
@ -326,16 +325,11 @@ public class Hero extends Char {
|
|||
public int damageRoll() {
|
||||
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
|
||||
int dmg;
|
||||
int bonus = RingOfForce.getBonus(this, RingOfForce.Force.class);
|
||||
|
||||
if (wep != null) {
|
||||
dmg = wep.damageRoll( this ) + bonus;
|
||||
dmg = wep.damageRoll( this ) + RingOfForce.armedDamageBonus(this);
|
||||
} else {
|
||||
if (bonus != 0){
|
||||
dmg = RingOfForce.damageRoll(this);
|
||||
} else {
|
||||
dmg = Random.NormalIntRange(1, Math.max(STR()-8, 1));
|
||||
}
|
||||
}
|
||||
if (dmg < 0) dmg = 0;
|
||||
if (subClass == HeroSubClass.BERSERKER){
|
||||
|
@ -350,10 +344,7 @@ public class Hero extends Char {
|
|||
|
||||
float speed = super.speed();
|
||||
|
||||
int hasteLevel = RingOfHaste.getBonus(this, RingOfHaste.Haste.class);
|
||||
|
||||
if (hasteLevel != 0)
|
||||
speed *= Math.pow(1.2, hasteLevel);
|
||||
speed *= RingOfHaste.speedMultiplier(this);
|
||||
|
||||
Armor armor = belongings.armor;
|
||||
|
||||
|
@ -430,8 +421,7 @@ public class Hero extends Char {
|
|||
//Normally putting furor speed on unarmed attacks would be unnecessary
|
||||
//But there's going to be that one guy who gets a furor+force ring combo
|
||||
//This is for that one guy, you shall get your fists of fury!
|
||||
int bonus = RingOfFuror.getBonus(this, RingOfFuror.Furor.class);
|
||||
return (float)(0.2 + (1 - 0.2)*Math.pow(0.85, bonus));
|
||||
return RingOfFuror.modifyAttackDelay(1f, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -958,9 +948,7 @@ public class Hero extends Char {
|
|||
dmg = thorns.proc(dmg, (src instanceof Char ? (Char)src : null), this);
|
||||
}
|
||||
|
||||
int tenacity = RingOfTenacity.getBonus(this, RingOfTenacity.Tenacity.class);
|
||||
if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health.
|
||||
dmg = (int)Math.ceil((float)dmg * Math.pow(0.85, tenacity*((float)(HT - HP)/HT)));
|
||||
dmg = (int)Math.ceil(dmg * RingOfTenacity.damageMultiplier( this ));
|
||||
|
||||
//TODO improve this when I have proper damage source logic
|
||||
if (belongings.armor != null && belongings.armor.hasGlyph(AntiMagic.class)
|
||||
|
@ -1280,7 +1268,7 @@ public class Hero extends Char {
|
|||
public int stealth() {
|
||||
int stealth = super.stealth();
|
||||
|
||||
stealth += RingOfEvasion.getBonus(this, RingOfEvasion.Evasion.class);
|
||||
stealth += RingOfEvasion.stealthBonus( this );
|
||||
|
||||
if (belongings.armor != null && belongings.armor.hasGlyph(Obfuscation.class)){
|
||||
stealth += belongings.armor.level();
|
||||
|
@ -1594,8 +1582,7 @@ public class Hero extends Char {
|
|||
|
||||
@Override
|
||||
public HashSet<Class<?>> resistances() {
|
||||
RingOfElements.Resistance r = buff( RingOfElements.Resistance.class );
|
||||
return r == null ? super.resistances() : r.resistances();
|
||||
return RingOfElements.resistances( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -443,9 +443,7 @@ public abstract class Mob extends Char {
|
|||
boolean seen = enemySeen || (enemy == Dungeon.hero && !Dungeon.hero.canSurpriseAttack());
|
||||
if (seen && paralysed == 0) {
|
||||
int defenseSkill = this.defenseSkill;
|
||||
int penalty = RingOfAccuracy.getBonus(enemy, RingOfAccuracy.Accuracy.class);
|
||||
if (penalty != 0 && enemy == Dungeon.hero)
|
||||
defenseSkill *= Math.pow(0.75, penalty);
|
||||
defenseSkill *= RingOfAccuracy.enemyEvasionMultiplier( enemy );
|
||||
return defenseSkill;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -546,8 +544,7 @@ public abstract class Mob extends Char {
|
|||
super.die( cause );
|
||||
|
||||
float lootChance = this.lootChance;
|
||||
int bonus = RingOfWealth.getBonus(Dungeon.hero, RingOfWealth.Wealth.class);
|
||||
lootChance *= Math.pow(1.15, bonus);
|
||||
lootChance *= RingOfWealth.dropChanceMultiplier( Dungeon.hero );
|
||||
|
||||
if (Random.Float() < lootChance && Dungeon.hero.lvl <= maxLvl + 2) {
|
||||
Item loot = createLoot();
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
||||
public class RingOfAccuracy extends Ring {
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +30,12 @@ public class RingOfAccuracy extends Ring {
|
|||
return new Accuracy();
|
||||
}
|
||||
|
||||
//The ring of accuracy reduces enemy evasion
|
||||
// this makes it more powerful against more evasive enemies
|
||||
public static float enemyEvasionMultiplier( Char target ){
|
||||
return (float)Math.pow(0.75, getBonus(target, Accuracy.class));
|
||||
}
|
||||
|
||||
public class Accuracy extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
|
||||
|
@ -54,16 +55,21 @@ public class RingOfElements extends Ring {
|
|||
FULL.add( Yog.BurningFist.class );
|
||||
}
|
||||
|
||||
public class Resistance extends RingBuff {
|
||||
|
||||
public HashSet<Class<?>> resistances() {
|
||||
if (Random.Int( level() + 2 ) >= 2) {
|
||||
public static HashSet<Class<?>> resistances( Char target ){
|
||||
if (Random.Int( getBonus(target, Resistance.class) + 2 ) >= 2) {
|
||||
return FULL;
|
||||
} else {
|
||||
return EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
public static float durationFactor( Char target ){
|
||||
int level = getBonus( target, Resistance.class);
|
||||
return level <= 0 ? 1 : (1 + 0.5f * level) / (1 + level);
|
||||
}
|
||||
|
||||
public class Resistance extends RingBuff {
|
||||
|
||||
public float durationFactor() {
|
||||
return level() < 0 ? 1 : (1 + 0.5f * level()) / (1 + level());
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
||||
public class RingOfEvasion extends Ring {
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +30,14 @@ public class RingOfEvasion extends Ring {
|
|||
return new Evasion();
|
||||
}
|
||||
|
||||
public static float evasionMultiplier( Char target ){
|
||||
return (float) Math.pow( 1.15, getBonus(target, Evasion.class));
|
||||
}
|
||||
|
||||
public static int stealthBonus( Char target ){
|
||||
return getBonus( target, Evasion.class );
|
||||
}
|
||||
|
||||
public class Evasion extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.utils.Random;
|
||||
|
@ -33,6 +34,13 @@ public class RingOfForce extends Ring {
|
|||
return new Force();
|
||||
}
|
||||
|
||||
public static int armedDamageBonus( Char ch ){
|
||||
return getBonus( ch, Force.class);
|
||||
}
|
||||
|
||||
|
||||
// *** Weapon-like properties ***
|
||||
|
||||
private static float tier(int str){
|
||||
float tier = Math.max(1, (str - 8)/2f);
|
||||
//each str point after 18 is half as effective
|
||||
|
@ -43,9 +51,14 @@ public class RingOfForce extends Ring {
|
|||
}
|
||||
|
||||
public static int damageRoll( Hero hero ){
|
||||
if (hero.buff(Force.class) != null) {
|
||||
int level = getBonus(hero, Force.class);
|
||||
float tier = tier(hero.STR());
|
||||
return Random.NormalIntRange(min(level, tier), max(level, tier));
|
||||
} else {
|
||||
//attack without any ring of force influence
|
||||
return Random.NormalIntRange(1, Math.max(hero.STR()-8, 1));
|
||||
}
|
||||
}
|
||||
|
||||
//same as equivalent tier weapon
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
||||
public class RingOfFuror extends Ring {
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +30,11 @@ public class RingOfFuror extends Ring {
|
|||
return new Furor();
|
||||
}
|
||||
|
||||
public static float modifyAttackDelay( float delay, Char target){
|
||||
//furor bonus only affects delay after 0.2
|
||||
return (float)(0.2 + (delay - 0.2)*Math.pow(0.85, getBonus(target, Furor.class)));
|
||||
}
|
||||
|
||||
public class Furor extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
||||
public class RingOfHaste extends Ring {
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +30,10 @@ public class RingOfHaste extends Ring {
|
|||
return new Haste();
|
||||
}
|
||||
|
||||
public static float speedMultiplier( Char target ){
|
||||
return (float)Math.pow(1.2, getBonus(target, Haste.class));
|
||||
}
|
||||
|
||||
public class Haste extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
|
||||
|
@ -76,6 +77,10 @@ public class RingOfMight extends Ring {
|
|||
return new Might();
|
||||
}
|
||||
|
||||
public static int strengthBonus( Char target ){
|
||||
return getBonus( target, Might.class );
|
||||
}
|
||||
|
||||
public class Might extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
||||
public class RingOfSharpshooting extends Ring {
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +30,10 @@ public class RingOfSharpshooting extends Ring {
|
|||
return new Aim();
|
||||
}
|
||||
|
||||
public static float accuracyMultiplier( Char target ){
|
||||
return (float)(Math.pow(1.2, getBonus(target, Aim.class)));
|
||||
}
|
||||
|
||||
public class Aim extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
||||
public class RingOfTenacity extends Ring {
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +30,11 @@ public class RingOfTenacity extends Ring {
|
|||
return new Tenacity();
|
||||
}
|
||||
|
||||
public static float damageMultiplier( Char t ){
|
||||
//(HT - HP)/HT = heroes current % missing health.
|
||||
return (float)Math.pow(0.85, getBonus( t, Tenacity.class)*((float)(t.HT - t.HP)/t.HT));
|
||||
}
|
||||
|
||||
public class Tenacity extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
|
||||
public class RingOfWealth extends Ring {
|
||||
|
||||
@Override
|
||||
|
@ -28,6 +30,19 @@ public class RingOfWealth extends Ring {
|
|||
return new Wealth();
|
||||
}
|
||||
|
||||
public static float dropChanceMultiplier( Char target ){
|
||||
return (float)Math.pow(1.15, getBonus(target, Wealth.class));
|
||||
}
|
||||
|
||||
//caps at a 50% bonus
|
||||
public static float regularLootChanceBonus( Char target ){
|
||||
return Math.min(0.5f, 0.05f* getBonus(target, Wealth.class));
|
||||
}
|
||||
|
||||
public static float specialLootChance( Char target ){
|
||||
return 1f - (float)Math.pow(0.925, getBonus(target, Wealth.class));
|
||||
}
|
||||
|
||||
public class Wealth extends RingBuff {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,8 +146,7 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
float ACC = this.ACC;
|
||||
|
||||
if (this instanceof MissileWeapon) {
|
||||
int bonus = RingOfSharpshooting.getBonus(hero, RingOfSharpshooting.Aim.class);
|
||||
ACC *= (float)(Math.pow(1.2, bonus));
|
||||
ACC *= RingOfSharpshooting.accuracyMultiplier( hero );
|
||||
}
|
||||
|
||||
return encumbrance > 0 ? (float)(ACC / Math.pow( 1.5, encumbrance )) : ACC;
|
||||
|
@ -163,9 +162,7 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
|
||||
float DLY = imbue.delayFactor(this.DLY);
|
||||
|
||||
int bonus = RingOfFuror.getBonus(hero, RingOfFuror.Furor.class);
|
||||
|
||||
DLY = (float)(0.2 + (DLY - 0.2)*Math.pow(0.85, bonus));
|
||||
DLY = RingOfFuror.modifyAttackDelay(DLY, hero);
|
||||
|
||||
return
|
||||
(encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY);
|
||||
|
|
|
@ -178,24 +178,22 @@ public abstract class Level implements Bundlable {
|
|||
if (!(Dungeon.bossLevel() || Dungeon.depth == 21) /*final shop floor*/) {
|
||||
addItemToSpawn( Generator.random( Generator.Category.FOOD ) );
|
||||
|
||||
int bonus = RingOfWealth.getBonus(Dungeon.hero, RingOfWealth.Wealth.class);
|
||||
|
||||
if (Dungeon.posNeeded()) {
|
||||
if (Random.Float() > Math.pow(0.925, bonus))
|
||||
if (Random.Float() < RingOfWealth.specialLootChance( Dungeon.hero ))
|
||||
addItemToSpawn( new PotionOfMight() );
|
||||
else
|
||||
addItemToSpawn( new PotionOfStrength() );
|
||||
Dungeon.limitedDrops.strengthPotions.count++;
|
||||
}
|
||||
if (Dungeon.souNeeded()) {
|
||||
if (Random.Float() > Math.pow(0.925, bonus))
|
||||
if (Random.Float() < RingOfWealth.specialLootChance( Dungeon.hero ))
|
||||
addItemToSpawn( new ScrollOfMagicalInfusion() );
|
||||
else
|
||||
addItemToSpawn( new ScrollOfUpgrade() );
|
||||
Dungeon.limitedDrops.upgradeScrolls.count++;
|
||||
}
|
||||
if (Dungeon.asNeeded()) {
|
||||
if (Random.Float() > Math.pow(0.925, bonus))
|
||||
if (Random.Float() < RingOfWealth.specialLootChance( Dungeon.hero ))
|
||||
addItemToSpawn( new Stylus() );
|
||||
addItemToSpawn( new Stylus() );
|
||||
Dungeon.limitedDrops.arcaneStyli.count++;
|
||||
|
|
|
@ -312,11 +312,8 @@ public abstract class RegularLevel extends Level {
|
|||
protected void createItems() {
|
||||
|
||||
int nItems = 3;
|
||||
int bonus = RingOfWealth.getBonus(Dungeon.hero, RingOfWealth.Wealth.class);
|
||||
|
||||
//just incase someone gets a ridiculous ring, cap this at 80%
|
||||
bonus = Math.min(bonus, 10);
|
||||
while (Random.Float() < (0.3f + bonus*0.05f)) {
|
||||
while (Random.Float() < (0.3f + RingOfWealth.regularLootChanceBonus( Dungeon.hero ))) {
|
||||
nItems++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user