v1.4.0: blocking enchantment now grants a shield, instead of armor

This commit is contained in:
Evan Debenham
2022-09-02 16:38:17 -04:00
parent 4799bca59b
commit 3be2da90dc
3 changed files with 44 additions and 34 deletions

View File

@@ -1410,9 +1410,9 @@ items.weapon.enchantments.blazing.name=blazing %s
items.weapon.enchantments.blazing.desc=This enchantment causes flames to spit forth from a weapon, igniting enemies and dealing bonus damage to enemies that are already aflame.
items.weapon.enchantments.blocking.name=blocking %s
items.weapon.enchantments.blocking.desc=This enchantment will enhance your ability to defend yourself after attacking with this weapon.
items.weapon.enchantments.blocking.desc=Blocking weapons have a chance to briefly shield you after attacking with them.
items.weapon.enchantments.blocking$blockbuff.name=blocking
items.weapon.enchantments.blocking$blockbuff.desc=Your weapon's blocking enchantment has given you a short boost of defensive power!\n\nBlocking boost: 0-%d\n\nTurns remaining: %s.
items.weapon.enchantments.blocking$blockbuff.desc=Your weapon's blocking enchantment has granted you a brief boost to your defensive power!\n\nShielding remaining: %d\n\nTurns remaining: %s.
items.weapon.enchantments.blooming.name=blooming %s
items.weapon.enchantments.blooming.desc=Blooming weapons contain magic which will cause vegetation to sprout on or around those struck by them.

View File

@@ -326,9 +326,6 @@ public abstract class Char extends Actor {
Barkskin bark = enemy.buff(Barkskin.class);
if (bark != null) dr += Random.NormalIntRange( 0 , bark.level() );
Blocking.BlockBuff block = enemy.buff(Blocking.BlockBuff.class);
if (block != null) dr += block.blockingRoll();
if (this instanceof Hero){
Hero h = (Hero)this;

View File

@@ -22,11 +22,15 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ShieldBuff;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfArcana;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
@@ -41,9 +45,16 @@ public class Blocking extends Weapon.Enchantment {
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
int level = Math.max( 0, weapon.buffedLvl() );
Buff.prolong(attacker, BlockBuff.class, 2 + level/2 * RingOfArcana.enchantPowerMultiplier(attacker))
.setBlocking(Math.round((level + 1) * RingOfArcana.enchantPowerMultiplier(attacker)));
// lvl 0 - 10%
// lvl 1 ~ 14%
// lvl 2 ~ 18%
float procChance = (level+2f)/(level+20f) * procChanceMultiplier(attacker);
if (Random.Float() < procChance){
BlockBuff b = Buff.affect(attacker, BlockBuff.class);
b.setShield(attacker.HT/10);
attacker.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 5);
}
return damage;
}
@@ -53,22 +64,33 @@ public class Blocking extends Weapon.Enchantment {
return BLUE;
}
public static class BlockBuff extends FlavourBuff {
public static class BlockBuff extends ShieldBuff {
{
type = buffType.POSITIVE;
}
private int blocking = 0;
public void setBlocking( int blocking ){
this.blocking = blocking;
@Override
public boolean act() {
detach();
return true;
}
public int blockingRoll(){
return Random.NormalIntRange(0, blocking);
@Override
public void setShield(int shield) {
super.setShield(shield);
postpone(5f);
}
@Override
public void fx(boolean on) {
if (on) {
target.sprite.add(CharSprite.State.SHIELDED);
} else if (target.buff(Barrier.class) == null) {
target.sprite.remove(CharSprite.State.SHIELDED);
}
}
@Override
public int icon() {
return BuffIndicator.ARMOR;
@@ -83,24 +105,15 @@ public class Blocking extends Weapon.Enchantment {
public float iconFadePercent() {
return Math.max(0, (5f - visualcooldown()) / 5f);
}
@Override
public String iconTextDisplay() {
return Integer.toString((int)visualcooldown());
}
@Override
public String desc() {
return Messages.get(this, "desc", blocking, dispTurns());
}
private static final String BLOCKING = "blocking";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(BLOCKING, blocking);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
blocking = bundle.getInt(BLOCKING);
return Messages.get(this, "desc", shielding(), dispTurns(visualcooldown()));
}
}