v0.7.2: implemented swift enchantment and polarized curse
also adjusted sniper's mark to last for a static 2 turns
This commit is contained in:
parent
14d7cedb07
commit
cedf68f4b0
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -96,6 +96,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.SpiritBow;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blocking;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Flail;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||
|
@ -459,6 +460,12 @@ public class Hero extends Char {
|
|||
}
|
||||
|
||||
public float attackDelay() {
|
||||
if (buff(Swift.SwiftAttack.class) != null
|
||||
&& buff(Swift.SwiftAttack.class).boostsMelee()) {
|
||||
buff(Swift.SwiftAttack.class).detach();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (belongings.weapon != null) {
|
||||
|
||||
return belongings.weapon.speedFactor( this );
|
||||
|
@ -957,7 +964,6 @@ public class Hero extends Char {
|
|||
switch (subClass) {
|
||||
case SNIPER:
|
||||
if (wep instanceof MissileWeapon && !(wep instanceof SpiritBow.SpiritArrow)) {
|
||||
final float delay = attackDelay();
|
||||
Actor.add(new Actor() {
|
||||
|
||||
{
|
||||
|
@ -967,7 +973,7 @@ public class Hero extends Char {
|
|||
@Override
|
||||
protected boolean act() {
|
||||
if (enemy.isAlive()) {
|
||||
Buff.prolong(Hero.this, SnipersMark.class, delay).object = enemy.id();
|
||||
Buff.prolong(Hero.this, SnipersMark.class, 2f).object = enemy.id();
|
||||
}
|
||||
Actor.remove(this);
|
||||
return true;
|
||||
|
|
|
@ -235,7 +235,7 @@ public class SpiritBow extends Weapon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public float castDelay(Char user, int dst) {
|
||||
public float speedFactor(Char user) {
|
||||
return SpiritBow.this.speedFactor(user);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Displacing;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Exhausting;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Friendly;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Polarized;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Sacrificial;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Wayward;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
||||
|
@ -47,6 +48,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Lucky;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Precise;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Unstable;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Vampiric;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
|
@ -304,7 +306,7 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
Blazing.class, Chilling.class, Shocking.class, Blooming.class};
|
||||
|
||||
private static final Class<?>[] uncommon = new Class<?>[]{
|
||||
/*Swift.class,*/ Elastic.class, Projecting.class,
|
||||
Swift.class, Elastic.class, Projecting.class,
|
||||
Unstable.class, Precise.class, Blocking.class};
|
||||
|
||||
private static final Class<?>[] rare = new Class<?>[]{
|
||||
|
@ -318,7 +320,7 @@ abstract public class Weapon extends KindOfWeapon {
|
|||
|
||||
private static final Class<?>[] curses = new Class<?>[]{
|
||||
Annoying.class, Displacing.class, Exhausting.class, Fragile.class,
|
||||
Sacrificial.class, Wayward.class, /*Shifting.class,*/ Friendly.class
|
||||
Sacrificial.class, Wayward.class, Polarized.class, Friendly.class
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -24,15 +24,21 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Shifting extends Weapon.Enchantment {
|
||||
public class Polarized extends Weapon.Enchantment {
|
||||
|
||||
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
|
||||
|
||||
@Override
|
||||
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||
//TODO implement
|
||||
return damage;
|
||||
public int proc( Weapon weapon, Char attacker, Char defender, int damage ) {
|
||||
|
||||
if (Random.Int(2) == 0){
|
||||
return Math.round(1.5f*damage);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
|
@ -22,8 +22,16 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||
|
||||
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.items.weapon.melee.MeleeWeapon;
|
||||
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.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Swift extends Weapon.Enchantment {
|
||||
|
||||
|
@ -31,8 +39,14 @@ public class Swift extends Weapon.Enchantment {
|
|||
|
||||
@Override
|
||||
public int proc(Weapon weapon, Char attacker, Char defender, int damage) {
|
||||
// lvl 0 - 13%
|
||||
// lvl 1 - 22%
|
||||
// lvl 2 - 30%
|
||||
int level = Math.max( 0, weapon.level() );
|
||||
|
||||
|
||||
if (Random.Int( level + 8 ) >= 7) {
|
||||
Buff.prolong(attacker, SwiftAttack.class, 2).setSourceType(weapon instanceof MeleeWeapon);
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
@ -41,4 +55,55 @@ public class Swift extends Weapon.Enchantment {
|
|||
public ItemSprite.Glowing glowing() {
|
||||
return YELLOW;
|
||||
}
|
||||
|
||||
public static class SwiftAttack extends FlavourBuff {
|
||||
|
||||
boolean sourceWasMelee;
|
||||
|
||||
public void setSourceType( boolean melee ){
|
||||
this.sourceWasMelee = melee;
|
||||
}
|
||||
|
||||
public boolean boostsMelee(){
|
||||
return !sourceWasMelee;
|
||||
}
|
||||
|
||||
public boolean boostsRanged(){
|
||||
return sourceWasMelee;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.WEAPON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tintIcon(Image icon) {
|
||||
icon.hardlight(1, 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Messages.get(this, "name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return Messages.get(this, sourceWasMelee ? "desc_melee" : "desc_ranged", dispTurns());
|
||||
}
|
||||
|
||||
private static final String WAS_MELEE = "was_melee";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(WAS_MELEE, sourceWasMelee);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
sourceWasMelee = bundle.getBoolean(WAS_MELEE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ public class Unstable extends Weapon.Enchantment {
|
|||
Elastic.class,
|
||||
Grim.class,
|
||||
Lucky.class,
|
||||
//precise also not included here, is manually check in attackSkill
|
||||
//precise also not included here, is manually checked in attackSkill
|
||||
//projecting not included, no on-hit effect
|
||||
Shocking.class,
|
||||
//Swift.class,
|
||||
Swift.class,
|
||||
Vampiric.class
|
||||
};
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.TippedDart;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
@ -194,6 +195,12 @@ abstract public class MissileWeapon extends Weapon {
|
|||
|
||||
@Override
|
||||
public float castDelay(Char user, int dst) {
|
||||
if (Actor.findChar( dst ) != null
|
||||
&& user.buff(Swift.SwiftAttack.class) != null
|
||||
&& user.buff(Swift.SwiftAttack.class).boostsRanged()) {
|
||||
user.buff(Swift.SwiftAttack.class).detach();
|
||||
return 0;
|
||||
}
|
||||
return speedFactor( user );
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ public class BuffIndicator extends Component {
|
|||
public static final int PREPARATION = 42;
|
||||
public static final int WELL_FED = 43;
|
||||
public static final int HEALING = 44;
|
||||
public static final int WEAPON = 45;
|
||||
|
||||
public static final int SIZE = 7;
|
||||
|
||||
|
|
|
@ -1152,6 +1152,9 @@ items.weapon.curses.fragile.desc=Fragile weapons start out just as strong as the
|
|||
items.weapon.curses.friendly.name=friendly %s
|
||||
items.weapon.curses.friendly.desc=Friendly weapons are best suited for pacifists, occasionally triggering magic that makes it impossible to fight.
|
||||
|
||||
items.weapon.curses.polarized.name=polarized %s
|
||||
items.weapon.curses.polarized.desc=A polarized weapon is affected by magic that causes its attack to either deal 50% more damage, or not damage at all.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -1192,6 +1195,12 @@ items.weapon.enchantments.projecting.desc=With this enchantment melee weapons wi
|
|||
items.weapon.enchantments.shocking.name=shocking %s
|
||||
items.weapon.enchantments.shocking.desc=Electricity arcs from a shocking weapon, dealing extra damage to all nearby enemies.
|
||||
|
||||
items.weapon.enchantments.swift.name=swift %s
|
||||
items.weapon.enchantments.swift.desc=A swift weapon can allow the wielder to instantly follow up their attack with a second weapon. The two weapons must be of different types however: one ranged, and one melee.
|
||||
items.weapon.enchantments.swift$swiftattack.name=Swift Attack
|
||||
items.weapon.enchantments.swift$swiftattack.desc_melee=The swift enchantment on your melee weapon has made your next attack with a ranged weapon instantaneous. The effect will only last briefly though!
|
||||
items.weapon.enchantments.swift$swiftattack.desc_ranged=The swift enchantment on your ranged weapon has made your next attack with a melee weapon instantaneous. The effect will only last briefly though!
|
||||
|
||||
items.weapon.enchantments.unstable.name=unstable %s
|
||||
items.weapon.enchantments.unstable.desc=This enchantment radiates chaotic energy, acting as a different enchantment with each hit.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user