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