v1.4.0: blocking enchantment now grants a shield, instead of armor
This commit is contained in:
@@ -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.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.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.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.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.
|
items.weapon.enchantments.blooming.desc=Blooming weapons contain magic which will cause vegetation to sprout on or around those struck by them.
|
||||||
|
|||||||
@@ -327,9 +327,6 @@ public abstract class Char extends Actor {
|
|||||||
Barkskin bark = enemy.buff(Barkskin.class);
|
Barkskin bark = enemy.buff(Barkskin.class);
|
||||||
if (bark != null) dr += Random.NormalIntRange( 0 , bark.level() );
|
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){
|
if (this instanceof Hero){
|
||||||
Hero h = (Hero)this;
|
Hero h = (Hero)this;
|
||||||
if (h.belongings.weapon() instanceof MissileWeapon
|
if (h.belongings.weapon() instanceof MissileWeapon
|
||||||
|
|||||||
+37
-24
@@ -22,11 +22,15 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
|
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.rings.RingOfArcana;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
@@ -42,8 +46,15 @@ public class Blocking extends Weapon.Enchantment {
|
|||||||
|
|
||||||
int level = Math.max( 0, weapon.buffedLvl() );
|
int level = Math.max( 0, weapon.buffedLvl() );
|
||||||
|
|
||||||
Buff.prolong(attacker, BlockBuff.class, 2 + level/2 * RingOfArcana.enchantPowerMultiplier(attacker))
|
// lvl 0 - 10%
|
||||||
.setBlocking(Math.round((level + 1) * RingOfArcana.enchantPowerMultiplier(attacker)));
|
// 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;
|
return damage;
|
||||||
}
|
}
|
||||||
@@ -53,20 +64,31 @@ public class Blocking extends Weapon.Enchantment {
|
|||||||
return BLUE;
|
return BLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlockBuff extends FlavourBuff {
|
public static class BlockBuff extends ShieldBuff {
|
||||||
|
|
||||||
{
|
{
|
||||||
type = buffType.POSITIVE;
|
type = buffType.POSITIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int blocking = 0;
|
@Override
|
||||||
|
public boolean act() {
|
||||||
public void setBlocking( int blocking ){
|
detach();
|
||||||
this.blocking = blocking;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int blockingRoll(){
|
@Override
|
||||||
return Random.NormalIntRange(0, blocking);
|
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
|
@Override
|
||||||
@@ -84,23 +106,14 @@ public class Blocking extends Weapon.Enchantment {
|
|||||||
return Math.max(0, (5f - visualcooldown()) / 5f);
|
return Math.max(0, (5f - visualcooldown()) / 5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String iconTextDisplay() {
|
||||||
|
return Integer.toString((int)visualcooldown());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String desc() {
|
public String desc() {
|
||||||
return Messages.get(this, "desc", blocking, dispTurns());
|
return Messages.get(this, "desc", shielding(), dispTurns(visualcooldown()));
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user