v1.3.0: reworked the wayward curse

This commit is contained in:
Evan Debenham
2022-05-22 21:32:15 -04:00
parent b6312970be
commit 7c2e5e9205
3 changed files with 58 additions and 6 deletions

View File

@@ -1371,8 +1371,9 @@ items.weapon.curses.sacrificial.name=sacrificial %s
items.weapon.curses.sacrificial.desc=Sacrificial weapons will demand blood from the wearer in return for attacking foes. The more healthy the wearer is, the more blood the curse will take.
items.weapon.curses.wayward.name=wayward %s
items.weapon.curses.wayward.desc=A wayward weapon has a very hard time finding its mark, making it extremely inaccurate unless the attack is guaranteed to succeed.
items.weapon.curses.wayward.desc=Wayward weapons will sometimes become extremely inaccurate. This magic lasts for a little while when it activates, but can be dispelled by landing a blow with the wayward weapon.
items.weapon.curses.wayward$waywardbuff.name=Wayward
items.weapon.curses.wayward$waywardbuff.desc=Your wayward weapon's magic has activated, making it extremely inaccurate for a short time. Note that this does not affect attacks which are guaranteed to hit, such as surprise attacks. Successfully attacking with the wayward weapon will clear this effect immediately.\n\nTurns remaining: %s.
###enchantments
items.weapon.enchantments.blazing.name=blazing %s

View File

@@ -176,11 +176,12 @@ abstract public class Weapon extends KindOfWeapon {
encumbrance = STRReq() - ((Hero)owner).STR();
}
if (hasEnchant(Wayward.class, owner))
encumbrance = Math.max(2, encumbrance+2);
float ACC = this.ACC;
if (owner.buff(Wayward.WaywardBuff.class) != null && enchantment instanceof Wayward){
ACC /= 5;
}
return encumbrance > 0 ? (float)(ACC / Math.pow( 1.5, encumbrance )) : ACC;
}

View File

@@ -22,8 +22,14 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
import com.watabou.utils.Random;
public class Wayward extends Weapon.Enchantment {
@@ -31,7 +37,14 @@ public class Wayward extends Weapon.Enchantment {
@Override
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
//no proc effect, see weapon.accuracyFactor for effect
float procChance = 1/4f * procChanceMultiplier(attacker);
if (attacker.buff(WaywardBuff.class) != null){
Buff.detach(attacker, WaywardBuff.class);
} else if (Random.Float() < procChance){
Buff.prolong(attacker, WaywardBuff.class, WaywardBuff.DURATION);
}
return damage;
}
@@ -45,4 +58,41 @@ public class Wayward extends Weapon.Enchantment {
return BLACK;
}
//see weapon.accuracyFactor for effect
public static class WaywardBuff extends FlavourBuff {
{
type = buffType.NEGATIVE;
announced = true;
}
public static final float DURATION = 10f;
@Override
public int icon() {
return BuffIndicator.WEAKNESS;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(1, 1, 0);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc", dispTurns());
}
}
}